On Mon, Dec 22, 2025 at 06:50:06PM +0100, Michal Wajdeczko wrote:
> On configs where Xe is built-in (DRM_XE=y) but configfs is defined
> as a module (CONFIGFS=m), we were not enabling our configfs stubs,
> which might lead to the following build errors:
>
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_guc.o: in function
> `xe_guc_init_post_hwconfig':
> xe_guc.c:(.text+0x2f08): undefined reference to
> `xe_configfs_get_psmi_enabled'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_hw_engine.o: in function
> `xe_hw_engines_init_early':
> xe_hw_engine.c:(.text+0xedc): undefined reference to
> `xe_configfs_get_engines_allowed'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_lrc.o: in function
> `setup_configfs_post_ctx_restore_bb':
> xe_lrc.c:(.text+0xb30): undefined reference to
> `xe_configfs_get_ctx_restore_post_bb'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_lrc.o: in function
> `setup_configfs_mid_ctx_restore_bb':
> xe_lrc.c:(.text+0xbc0): undefined reference to
> `xe_configfs_get_ctx_restore_mid_bb'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_lrc.o: in function `xe_lrc_init':
> xe_lrc.c:(.text+0x32fc): undefined reference to
> `xe_configfs_get_ctx_restore_mid_bb'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_module.o:(.data.rel.ro+0x10):
> undefined reference to `xe_configfs_init'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_module.o:(.data.rel.ro+0x18):
> undefined reference to `xe_configfs_exit'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_pci.o: in function
> `xe_pci_probe':
> xe_pci.c:(.text+0x1514): undefined reference to `xe_configfs_check_device'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_psmi.o: in function
> `xe_psmi_debugfs_register':
> xe_psmi.c:(.text+0x508): undefined reference to
> `xe_configfs_get_psmi_enabled'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_psmi.o: in function
> `xe_psmi_init':
> xe_psmi.c:(.text+0x5c4): undefined reference to
> `xe_configfs_get_psmi_enabled'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_rtp.o: in function
> `xe_rtp_match_psmi_enabled':
> xe_rtp.c:(.text+0xba0): undefined reference to
> `xe_configfs_get_psmi_enabled'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_survivability_mode.o: in
> function `xe_survivability_mode_is_requested':
> xe_survivability_mode.c:(.text+0x434): undefined reference to
> `xe_configfs_get_survivability_mode'
> powerpc64-linux-ld: drivers/gpu/drm/xe/xe_sriov_pf.o: in function
> `xe_sriov_pf_readiness':
> xe_sriov_pf.c:(.text+0x2a0): undefined reference to
> `xe_configfs_get_max_vfs'
>
> Fix that by using IS_REACHABLE check instead of IS_ENABLED when
> deciding whether to stub variant or not.
>
> Fixes: 16280ded45fb ("drm/xe: Add configfs to enable survivability mode")
> Reported-by: kernel test robot <[email protected]>
> Closes:
> https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Michal Wajdeczko <[email protected]>
> Cc: Rodrigo Vivi <[email protected]>
> Cc: Matt Roper <[email protected]>
> Cc: Riana Tauro <[email protected]>
> ---
> drivers/gpu/drm/xe/xe_configfs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_configfs.h
> b/drivers/gpu/drm/xe/xe_configfs.h
> index 9998ec7c9956..ab75485b08b6 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.h
> +++ b/drivers/gpu/drm/xe/xe_configfs.h
> @@ -12,7 +12,7 @@
>
> struct pci_dev;
>
> -#if IS_ENABLED(CONFIG_CONFIGFS_FS)
> +#if IS_REACHABLE(CONFIG_CONFIGFS_FS)
Well, I'm not 100% confident with this. And probably the Jani's suggestion is
the safest one.
But perhaps this is acceptable in this case, only because if
we are built-in (y), we are not able to use configfs at all anyway...
our configfs usage already depends on us as module...
> int xe_configfs_init(void);
> void xe_configfs_exit(void);
> void xe_configfs_check_device(struct pci_dev *pdev);
> --
> 2.47.1
>