Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace
@ 2025-03-24 21:03 Arnd Bergmann
  2025-03-24 21:03 ` [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol Arnd Bergmann
  2025-03-24 22:05 ` [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace Nicolin Chen
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-03-24 21:03 UTC (permalink / raw)
  To: Jason Gunthorpe, Kevin Tian, Joerg Roedel, Will Deacon,
	Nicolin Chen
  Cc: Arnd Bergmann, Robin Murphy, Lu Baolu, Peter Zijlstra, iommu,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/iommu/iommufd/driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/iommufd/driver.c b/drivers/iommu/iommufd/driver.c
index 352513974154..a08ff0f37fc6 100644
--- a/drivers/iommu/iommufd/driver.c
+++ b/drivers/iommu/iommufd/driver.c
@@ -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");
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol
  2025-03-24 21:03 [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace Arnd Bergmann
@ 2025-03-24 21:03 ` Arnd Bergmann
  2025-03-24 22:37   ` Nicolin Chen
  2025-03-24 22:05 ` [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace Nicolin Chen
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2025-03-24 21:03 UTC (permalink / raw)
  To: Jason Gunthorpe, Kevin Tian, Joerg Roedel, Will Deacon,
	Nicolin Chen, Robin Murphy
  Cc: Arnd Bergmann, iommu, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/iommu/iommufd/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
index 0a07f9449fd9..2beeb4f60ee5 100644
--- a/drivers/iommu/iommufd/Kconfig
+++ b/drivers/iommu/iommufd/Kconfig
@@ -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
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace
  2025-03-24 21:03 [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace Arnd Bergmann
  2025-03-24 21:03 ` [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol Arnd Bergmann
@ 2025-03-24 22:05 ` Nicolin Chen
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolin Chen @ 2025-03-24 22:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jason Gunthorpe, Kevin Tian, Joerg Roedel, Will Deacon,
	Arnd Bergmann, Robin Murphy, Lu Baolu, Peter Zijlstra, iommu,
	linux-kernel

On Mon, Mar 24, 2025 at 10:03:22PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Tested-by: Nicolin Chen <nicolinc@nvidia.com>

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol
  2025-03-24 21:03 ` [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol Arnd Bergmann
@ 2025-03-24 22:37   ` Nicolin Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolin Chen @ 2025-03-24 22:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jason Gunthorpe, Kevin Tian, Joerg Roedel, Will Deacon,
	Robin Murphy, Arnd Bergmann, iommu, linux-kernel

On Mon, Mar 24, 2025 at 10:03:23PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/iommu/iommufd/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
> index 0a07f9449fd9..2beeb4f60ee5 100644
> --- a/drivers/iommu/iommufd/Kconfig
> +++ b/drivers/iommu/iommufd/Kconfig
> @@ -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.

Tested-by: Nicolin Chen <nicolinc@nvidia.com>

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-24 22:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-24 21:03 [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace Arnd Bergmann
2025-03-24 21:03 ` [PATCH 2/2] iommufd_driver: make IOMMUFD_DRIVER_CORE a 'bool' symbol Arnd Bergmann
2025-03-24 22:37   ` Nicolin Chen
2025-03-24 22:05 ` [PATCH 1/2] iommufd: import IOMMUFD_INTERNAL namespace Nicolin Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox