Skip to contentSkip to conversation

drm/amdgpu: Remove UML build exclusion from Kconfig

PATCH In review Alex Hung 3 participants 5 messages May 5 – May 19

Subsystems (2)
lore
Share & tools
lore

Alex Hung

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Remove UML build exclusion from Kconfig

From: Harry Wentland <[email protected]>

The depends on !UML was added in commit dffe68131707 ("amdgpu: Avoid building on UML") to work around build failures with allyesconfig on UML. The original errors were:

- smu7_hwmgr.c: incompatible pointer type 'struct cpuinfo_um *' vs 'struct cpuinfo_x86 *' in intel_core_rkl_chk()
- kfd_topology.c: 'struct cpuinfo_um' has no member named 'apicid'

Both issues have since been resolved independently:
- intel_core_rkl_chk() has been removed entirely.
- kfd_topology.c now uses a proper #ifdef CONFIG_X86_64 guard.
- All other cpuinfo_x86/cpu_data() references in the driver are guarded by #if IS_ENABLED(CONFIG_X86) or #ifdef CONFIG_X86_64.

Removing this exclusion allows CONFIG_DRM_AMDGPU to be selected on UML, which in turn enables running KUnit tests (such as amdgpu_dm_crc_test) under UML without needing a full hardware-capable kernel build.

Assisted-by Claude:claude-opus-4.6
---
 drivers/gpu/drm/amd/amdgpu/Kconfig | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/Kconfig +0 -1
index 0d4ce2ef9da6..49a7360f45ce 100644
@@ -3,7 +3,6 @@
 config DRM_AMDGPU
 	tristate "AMD GPU"
 	depends on DRM && PCI
-	depends on !UML
 	select FW_LOADER
 	select DRM_CLIENT
 	select DRM_CLIENT_SELECTION

--
2.43.0

#1 lore raw
kernel test robot noticed the following build errors:

Hi Alex,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v7.1-rc3 next-20260508] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alex-Hung/drm-amdgpu-Remove-UML-build-exclusion-from-Kconfig/20260513-150500
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20260505162018.1755740-1-alex.hung%40amd.com
patch subject: [PATCH] drm/amdgpu: Remove UML build exclusion from Kconfig
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20260514/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260514/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c: In function 'kfd_cpumask_to_apic_id':

>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:2353:16: error: implicit declaration of function 'cpu_data' [-Wimplicit-function-declaration]
    2353 |         return cpu_data(first_cpu_of_numa_node).topo.apicid;
         |                ^~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:2353:48: error: request for member 'topo' in something not a structure or union
    2353 |         return cpu_data(first_cpu_of_numa_node).topo.apicid;
         |                                                ^
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:2357:1: warning: control reaches end of non-void function [-Wreturn-type]
    2357 | }
         | ^
--
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c: In function 'kfd_fill_iolink_info_for_cpu':
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1830:34: error: implicit declaration of function 'cpu_data' [-Wimplicit-function-declaration]
    1830 |         struct cpuinfo_x86 *c = &cpu_data(0);
         |                                  ^~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1830:33: error: lvalue required as unary '&' operand
    1830 |         struct cpuinfo_x86 *c = &cpu_data(0);
         |                                 ^
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1833:14: error: invalid use of undefined type 'struct cpuinfo_x86'
    1833 |         if (c->x86_vendor == X86_VENDOR_AMD)
         |              ^~
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1833:30: error: 'X86_VENDOR_AMD' undeclared (first use in this function); did you mean 'X86_VENDOR_ANY'?
    1833 |         if (c->x86_vendor == X86_VENDOR_AMD)
         |                              ^~~~~~~~~~~~~~
         |                              X86_VENDOR_ANY

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1833:30: note: each undeclared identifier is reported only once for each function it appears in

vim +/cpu_data +2353 drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c

851a645efd0fee7 Felix Kuehling  2017-11-27  2342  
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2343  static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask)
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2344  {
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2345  	int first_cpu_of_numa_node;
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2346  
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2347  	if (!cpumask || cpumask == cpu_none_mask)
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2348  		return -1;
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2349  	first_cpu_of_numa_node = cpumask_first(cpumask);
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2350  	if (first_cpu_of_numa_node >= nr_cpu_ids)
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2351  		return -1;
df1dd4f4a7271eb Felix Kuehling  2019-01-02  2352  #ifdef CONFIG_X86_64
b9655e702dc5d85 Thomas Gleixner 2023-08-14 @2353  	return cpu_data(first_cpu_of_numa_node).topo.apicid;
df1dd4f4a7271eb Felix Kuehling  2019-01-02  2354  #else
df1dd4f4a7271eb Felix Kuehling  2019-01-02  2355  	return first_cpu_of_numa_node;
df1dd4f4a7271eb Felix Kuehling  2019-01-02  2356  #endif
520b8fb755ccfb0 Felix Kuehling  2017-12-08  2357  }

520b8fb755ccfb0 Felix Kuehling 2017-12-08 2358

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#2 lore raw
In reply to Alex Hung
kernel test robot noticed the following build errors:

Hi Alex,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v7.1-rc3 next-20260508] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alex-Hung/drm-amdgpu-Remove-UML-build-exclusion-from-Kconfig/20260513-150500
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20260505162018.1755740-1-alex.hung%40amd.com
patch subject: [PATCH] drm/amdgpu: Remove UML build exclusion from Kconfig
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20260514/[email protected]/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260514/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:26:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/um/include/asm/hardirq.h:24:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:1209:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
1209 | return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
| ~~~~~~~~~~ ^

>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:2353:9: error: call to undeclared function 'cpu_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2353 |         return cpu_data(first_cpu_of_numa_node).topo.apicid;
         |                ^
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:2353:41: error: member reference base type 'int' is not a structure or union
    2353 |         return cpu_data(first_cpu_of_numa_node).topo.apicid;
         |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~

1 warning and 2 errors generated.
--
In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:24:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/um/include/asm/hardirq.h:24:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:1209:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
1209 | return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
| ~~~~~~~~~~ ^

>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1830:27: error: call to undeclared function 'cpu_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1830 |         struct cpuinfo_x86 *c = &cpu_data(0);
         |                                  ^
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1830:26: error: cannot take the address of an rvalue of type 'int'
    1830 |         struct cpuinfo_x86 *c = &cpu_data(0);
         |                                 ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1833:7: error: incomplete definition of type 'struct cpuinfo_x86'
    1833 |         if (c->x86_vendor == X86_VENDOR_AMD)
         |             ~^
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1830:9: note: forward declaration of 'struct cpuinfo_x86'
    1830 |         struct cpuinfo_x86 *c = &cpu_data(0);
         |                ^
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c:1833:23: error: use of undeclared identifier 'X86_VENDOR_AMD'
    1833 |         if (c->x86_vendor == X86_VENDOR_AMD)
         |                              ^

1 warning and 4 errors generated.

vim +/cpu_data +2353 drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c

851a645efd0fee Felix Kuehling  2017-11-27  2342  
520b8fb755ccfb Felix Kuehling  2017-12-08  2343  static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask)
520b8fb755ccfb Felix Kuehling  2017-12-08  2344  {
520b8fb755ccfb Felix Kuehling  2017-12-08  2345  	int first_cpu_of_numa_node;
520b8fb755ccfb Felix Kuehling  2017-12-08  2346  
520b8fb755ccfb Felix Kuehling  2017-12-08  2347  	if (!cpumask || cpumask == cpu_none_mask)
520b8fb755ccfb Felix Kuehling  2017-12-08  2348  		return -1;
520b8fb755ccfb Felix Kuehling  2017-12-08  2349  	first_cpu_of_numa_node = cpumask_first(cpumask);
520b8fb755ccfb Felix Kuehling  2017-12-08  2350  	if (first_cpu_of_numa_node >= nr_cpu_ids)
520b8fb755ccfb Felix Kuehling  2017-12-08  2351  		return -1;
df1dd4f4a7271e Felix Kuehling  2019-01-02  2352  #ifdef CONFIG_X86_64
b9655e702dc5d8 Thomas Gleixner 2023-08-14 @2353  	return cpu_data(first_cpu_of_numa_node).topo.apicid;
df1dd4f4a7271e Felix Kuehling  2019-01-02  2354  #else
df1dd4f4a7271e Felix Kuehling  2019-01-02  2355  	return first_cpu_of_numa_node;
df1dd4f4a7271e Felix Kuehling  2019-01-02  2356  #endif
520b8fb755ccfb Felix Kuehling  2017-12-08  2357  }

520b8fb755ccfb Felix Kuehling 2017-12-08 2358

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

maintainer
#3 lore raw
In reply to Alex Hung
Quoted 16 lines · Alex Hung

From: Harry Wentland <[email protected]>

The depends on !UML was added in commit dffe68131707 ("amdgpu: Avoid building on UML") to work around build failures with allyesconfig on UML. The original errors were:

- smu7_hwmgr.c: incompatible pointer type 'struct cpuinfo_um *' vs 'struct cpuinfo_x86 *' in intel_core_rkl_chk()
- kfd_topology.c: 'struct cpuinfo_um' has no member named 'apicid'

Both issues have since been resolved independently:
- intel_core_rkl_chk() has been removed entirely.
- kfd_topology.c now uses a proper #ifdef CONFIG_X86_64 guard.
- All other cpuinfo_x86/cpu_data() references in the driver are guarded by #if IS_ENABLED(CONFIG_X86) or #ifdef CONFIG_X86_64.

Quoted 3 lines

Removing this exclusion allows CONFIG_DRM_AMDGPU to be selected on UML, which in turn enables running KUnit tests (such as amdgpu_dm_crc_test) under UML without needing a full hardware-capable kernel build.

Looks like a good idea but there are 5 automated reports from kernel test robots that the patch causes issues.

It could be that the robots apply the patch to the wrong tree, but please double check.

With that done the patch is Reviewed-by: Christian König <[email protected]>

Regards,
Christian.

Quoted 23 lines
Assisted-by Claude:claude-opus-4.6
---
 drivers/gpu/drm/amd/amdgpu/Kconfig | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/Kconfig +0 -2
index 0d4ce2ef9da6..49a7360f45ce 100644
@@ -3,7 +3,6 @@
 config DRM_AMDGPU
 	tristate "AMD GPU"
 	depends on DRM && PCI
-	depends on !UML
 	select FW_LOADER
 	select DRM_CLIENT
 	select DRM_CLIENT_SELECTION
--

2.43.0

author
#4 lore raw

AMD General

Hi,

Thanks. I sent a patch to fix it: https://patchwork.freedesktop.org/patch/725171/?series=166586&rev=1, and no errors when I built locally.
________________________________
From: Koenig, Christian <[email protected]>
Sent: 18 May 2026 02:39
To: Hung, Alex <[email protected]>; Deucher, Alexander <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nirujogi, Pratap <[email protected]>; Prosyak, Vitaly <[email protected]>; Wentland, Harry <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Remove UML build exclusion from Kconfig

Quoted 16 lines · Alex Hung

From: Harry Wentland <[email protected]>

The depends on !UML was added in commit dffe68131707 ("amdgpu: Avoid building on UML") to work around build failures with allyesconfig on UML. The original errors were:

- smu7_hwmgr.c: incompatible pointer type 'struct cpuinfo_um *' vs 'struct cpuinfo_x86 *' in intel_core_rkl_chk()
- kfd_topology.c: 'struct cpuinfo_um' has no member named 'apicid'

Both issues have since been resolved independently:
- intel_core_rkl_chk() has been removed entirely.
- kfd_topology.c now uses a proper #ifdef CONFIG_X86_64 guard.
- All other cpuinfo_x86/cpu_data() references in the driver are guarded by #if IS_ENABLED(CONFIG_X86) or #ifdef CONFIG_X86_64.

Quoted 3 lines

Removing this exclusion allows CONFIG_DRM_AMDGPU to be selected on UML, which in turn enables running KUnit tests (such as amdgpu_dm_crc_test) under UML without needing a full hardware-capable kernel build.

Looks like a good idea but there are 5 automated reports from kernel test robots that the patch causes issues.

It could be that the robots apply the patch to the wrong tree, but please double check.

With that done the patch is Reviewed-by: Christian König <[email protected]>

Regards,
Christian.

Quoted 23 lines
Assisted-by Claude:claude-opus-4.6
---
 drivers/gpu/drm/amd/amdgpu/Kconfig | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/Kconfig +0 -2
index 0d4ce2ef9da6..49a7360f45ce 100644
@@ -3,7 +3,6 @@
 config DRM_AMDGPU
       tristate "AMD GPU"
       depends on DRM && PCI
-     depends on !UML
       select FW_LOADER
       select DRM_CLIENT
       select DRM_CLIENT_SELECTION
--

2.43.0