From 80427c381f62c991a617d95f949a1cbbf369e395 Mon Sep 17 00:00:00 2001
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Date: Sat, 17 Jan 2026 16:27:02 -0500
Subject: [PATCH] drm/amdgpu: fix non-x86 GPU VCRAT parsing

On a non-x86 platform (ppc64le), the insertion of an IO link entry in
the GPU VCRAT table results in a parsing failure:

amdgpu [...]: amdgpu: Error parsing VCRAT
kfd kfd: amdgpu: Error adding device to topology
kfd kfd: amdgpu: Error initializing KFD node
kfd kfd: amdgpu: device [...]:[...] NOT added due to errors

This patch makes kfd_create_vcrat_image_gpu skip inserting an IO link
entry on non-x86 platforms, matching kfd_create_vcrat_image_cpu's
non-x86 behaviour.
---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 4a7180b46b71..2c1095d63b38 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -2334,6 +2334,7 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
 	 *  Only direct links are added here which is Link from GPU to
 	 *  its NUMA node. Indirect links are added by userspace.
 	 */
+#ifdef CONFIG_X86_64
 	sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
 		sub_type_hdr->length);
 	ret = kfd_fill_gpu_direct_io_link_to_cpu(&avail_size, kdev,
@@ -2344,6 +2345,9 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
 
 	crat_table->length += sub_type_hdr->length;
 	crat_table->total_entries++;
+#else
+	pr_info("IO link not available for non x86 platforms\n");
+#endif
 
 
 	/* Fill in Subtype: IO_LINKS
-- 
2.47.3

