Skip to contentSkip to conversation

iommufd: import IOMMUFD_INTERNAL namespace

PATCH In review Arnd Bergmann 2 participants 4 messages Mar 24, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iommufd: import IOMMUFD_INTERNAL namespace

From: Arnd Bergmann <[email protected]>

Building the iommufd driver as a loadable module causes a failure now:

ERROR: modpost: module iommufd_driver uses symbol iommu_attach_handle_get from namespace IOMMUFD_INTERNAL, but does not import it.

Import the namespace as needed here.

Fixes 916a207692ce ("iommufd: Move iommufd_sw_msi and related functions to driver.c")
---
 drivers/iommu/iommufd/driver.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iommu/iommufd/driver.c +1 -0
index 352513974154..a08ff0f37fc6 100644
@@ -247,4 +247,5 @@ EXPORT_SYMBOL_NS_GPL(iommufd_sw_msi, "IOMMUFD");
 #endif
 
 MODULE_DESCRIPTION("iommufd code shared with builtin modules");
+MODULE_IMPORT_NS("IOMMUFD_INTERNAL");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.39.5
#1 lore raw

PATCH 2/2 iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol

From: Arnd Bergmann <[email protected]>

Calling iommufd_sw_msi() from iommu_dma_prepare_msi() in the iommu core code is no longer possible if the driver core is in a loadable module because it is now a direct call rather than a function pointer:

arm-linux-gnueabi-ld: drivers/iommu/iommu.o: in function `iommu_dma_prepare_msi':
iommu.c:(.text+0x4fb4): undefined reference to `iommufd_sw_msi'

This effectively makes the iommu driver core part of the iommu subsystem itself, so disallow building it as a loadable module.

Fixes e009e088d88e ("iommu: Drop sw_msi from iommu_domain")
---
 drivers/iommu/iommufd/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommufd/Kconfig +1 -1
index 0a07f9449fd9..2beeb4f60ee5 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config IOMMUFD_DRIVER_CORE
-	tristate
+	bool
 	default (IOMMUFD_DRIVER || IOMMUFD) if IOMMUFD!=n
 
 config IOMMUFD
Signature · 1 line
2.39.5
Tested-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol

Quoted 23 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Calling iommufd_sw_msi() from iommu_dma_prepare_msi() in the iommu core code is no longer possible if the driver core is in a loadable module because it is now a direct call rather than a function pointer:

arm-linux-gnueabi-ld: drivers/iommu/iommu.o: in function `iommu_dma_prepare_msi':
iommu.c:(.text+0x4fb4): undefined reference to `iommufd_sw_msi'

This effectively makes the iommu driver core part of the iommu subsystem itself, so disallow building it as a loadable module.

Fixes e009e088d88e ("iommu: Drop sw_msi from iommu_domain")
---
 drivers/iommu/iommufd/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommufd/Kconfig +0 -0
index 0a07f9449fd9..2beeb4f60ee5 100644

drivers/iommu/iommufd/Kconfig line 3

Quoted 4 lines
drivers/iommu/iommufd/Kconfig +1 -1
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config IOMMUFD_DRIVER_CORE
-	tristate
+	bool

Hmm, looks like giving up this "tristate" is the only option as IOMMU_API is now accessing iommufd_sw_msi() that itself and two functions are kind of too big to be placed in a header.

Thanks!

Tested-by on v1 1/2
#3 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Building the iommufd driver as a loadable module causes a failure now:

ERROR: modpost: module iommufd_driver uses symbol iommu_attach_handle_get from namespace IOMMUFD_INTERNAL, but does not import it.

Import the namespace as needed here.

Fixes 916a207692ce ("iommufd: Move iommufd_sw_msi and related functions to driver.c")

Thanks!