All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rc 0/3] Fix some kconfig related issues with iommu pt
@ 2026-01-06 19:22 Jason Gunthorpe
  2026-01-06 19:22 ` [PATCH rc 1/3] iommupt: Fix the kunit building Jason Gunthorpe
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2026-01-06 19:22 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Robin Murphy, Will Deacon
  Cc: Alejandro Jimenez, Arnd Bergmann, Geert Uytterhoeven,
	Joerg Roedel, Kevin Tian, kernel test robot, Nicolin Chen,
	Pasha Tatashin, patches, Samiullah Khawaja

Two issues found while checking the kunit against rc4, and one from some
build bots.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Jason Gunthorpe (3):
  iommupt: Fix the kunit building
  iommufd/selftest: Add missing kconfig for DMA_SHARED_BUFFER
  iommufd/selftest: Prevent module/builtin conflicts in kconfig

 drivers/iommu/generic_pt/.kunitconfig | 2 +-
 drivers/iommu/iommufd/Kconfig         | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)


base-commit: 9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
-- 
2.43.0


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

* [PATCH rc 1/3] iommupt: Fix the kunit building
  2026-01-06 19:22 [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Jason Gunthorpe
@ 2026-01-06 19:22 ` Jason Gunthorpe
  2026-01-08 14:37   ` Alejandro Jimenez
  2026-01-06 19:22 ` [PATCH rc 2/3] iommufd/selftest: Add missing kconfig for DMA_SHARED_BUFFER Jason Gunthorpe
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jason Gunthorpe @ 2026-01-06 19:22 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Robin Murphy, Will Deacon
  Cc: Alejandro Jimenez, Arnd Bergmann, Geert Uytterhoeven,
	Joerg Roedel, Kevin Tian, kernel test robot, Nicolin Chen,
	Pasha Tatashin, patches, Samiullah Khawaja

The kunit doesn't work since the below commit made GENERIC_PT
unselectable:

 $ make ARCH=x86_64 O=build_kunit_x86_64 olddefconfig
 ERROR:root:Not all Kconfig options selected in kunitconfig were in the generated .config.
 This is probably due to unsatisfied dependencies.
 Missing: CONFIG_DEBUG_GENERIC_PT=y, CONFIG_IOMMUFD_TEST=y,
 CONFIG_IOMMU_PT_X86_64=y, CONFIG_GENERIC_PT=y, CONFIG_IOMMU_PT_AMDV1=y,
 CONFIG_IOMMU_PT_VTDSS=y, CONFIG_IOMMU_PT=y, CONFIG_IOMMU_PT_KUNIT_TEST=y

Also remove the unneeded CONFIG_IOMMUFD_TEST reference as the iommupt kunit
doesn't interact with iommufd, and it doesn't currently build for the
kunit due problems with DMA_SHARED buffer either.

Fixes: 01569c216dde ("genpt: Make GENERIC_PT invisible")
Fixes: 1dd4187f53c3 ("iommupt: Add a kunit test for Generic Page Table")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/generic_pt/.kunitconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/generic_pt/.kunitconfig b/drivers/iommu/generic_pt/.kunitconfig
index 52ac9e661ffd2b..a78b295f264d23 100644
--- a/drivers/iommu/generic_pt/.kunitconfig
+++ b/drivers/iommu/generic_pt/.kunitconfig
@@ -1,4 +1,5 @@
 CONFIG_KUNIT=y
+CONFIG_COMPILE_TEST=y
 CONFIG_GENERIC_PT=y
 CONFIG_DEBUG_GENERIC_PT=y
 CONFIG_IOMMU_PT=y
@@ -11,4 +12,3 @@ CONFIG_IOMMUFD=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_FAULT_INJECTION=y
 CONFIG_RUNTIME_TESTING_MENU=y
-CONFIG_IOMMUFD_TEST=y
-- 
2.43.0


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

* [PATCH rc 2/3] iommufd/selftest: Add missing kconfig for DMA_SHARED_BUFFER
  2026-01-06 19:22 [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Jason Gunthorpe
  2026-01-06 19:22 ` [PATCH rc 1/3] iommupt: Fix the kunit building Jason Gunthorpe
@ 2026-01-06 19:22 ` Jason Gunthorpe
  2026-01-06 19:22 ` [PATCH rc 3/3] iommufd/selftest: Prevent module/builtin conflicts in kconfig Jason Gunthorpe
  2026-01-10  9:41 ` [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Joerg Roedel
  3 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2026-01-06 19:22 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Robin Murphy, Will Deacon
  Cc: Alejandro Jimenez, Arnd Bergmann, Geert Uytterhoeven,
	Joerg Roedel, Kevin Tian, kernel test robot, Nicolin Chen,
	Pasha Tatashin, patches, Samiullah Khawaja

The test doesn't build without it, dma-buf.h does not provide stub
functions if it is not enabled. Compilation can fail with:

 ERROR:root:ld: vmlinux.o: in function `iommufd_test':
 (.text+0x3b1cdd): undefined reference to `dma_buf_get'
 ld: (.text+0x3b1d08): undefined reference to `dma_buf_put'
 ld: (.text+0x3b2105): undefined reference to `dma_buf_export'
 ld: (.text+0x3b211f): undefined reference to `dma_buf_fd'
 ld: (.text+0x3b2e47): undefined reference to `dma_buf_move_notify'

Add the missing select.

Fixes: d2041f1f11dd ("iommufd/selftest: Add some tests for the dmabuf flow")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/iommufd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
index eae3f03629b0c1..7e41e3ccea7587 100644
--- a/drivers/iommu/iommufd/Kconfig
+++ b/drivers/iommu/iommufd/Kconfig
@@ -42,6 +42,7 @@ config IOMMUFD_TEST
 	depends on FAULT_INJECTION
 	depends on RUNTIME_TESTING_MENU
 	depends on IOMMU_PT_AMDV1
+	select DMA_SHARED_BUFFER
 	select IOMMUFD_DRIVER
 	default n
 	help
-- 
2.43.0


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

* [PATCH rc 3/3] iommufd/selftest: Prevent module/builtin conflicts in kconfig
  2026-01-06 19:22 [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Jason Gunthorpe
  2026-01-06 19:22 ` [PATCH rc 1/3] iommupt: Fix the kunit building Jason Gunthorpe
  2026-01-06 19:22 ` [PATCH rc 2/3] iommufd/selftest: Add missing kconfig for DMA_SHARED_BUFFER Jason Gunthorpe
@ 2026-01-06 19:22 ` Jason Gunthorpe
  2026-01-10  9:41 ` [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Joerg Roedel
  3 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2026-01-06 19:22 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Robin Murphy, Will Deacon
  Cc: Alejandro Jimenez, Arnd Bergmann, Geert Uytterhoeven,
	Joerg Roedel, Kevin Tian, kernel test robot, Nicolin Chen,
	Pasha Tatashin, patches, Samiullah Khawaja

The selftest now depends on the AMDv1 page table, however the selftest
kconfig itself is just an sub-option of the main IOMMUFD module kconfig.

This means it cannot be modular and so kconfig allowed a modular
IOMMU_PT_AMDV1 with a built in IOMMUFD. This causes link failures:

   ld: vmlinux.o: in function `mock_domain_alloc_pgtable.isra.0':
   selftest.c:(.text+0x12e8ad3): undefined reference to `pt_iommu_amdv1_init'
   ld: vmlinux.o: in function `BSWAP_SHUFB_CTL':
   sha1-avx2-asm.o:(.rodata+0xaa36a8): undefined reference to `pt_iommu_amdv1_read_and_clear_dirty'
   ld: sha1-avx2-asm.o:(.rodata+0xaa36f0): undefined reference to `pt_iommu_amdv1_map_pages'
   ld: sha1-avx2-asm.o:(.rodata+0xaa36f8): undefined reference to `pt_iommu_amdv1_unmap_pages'
   ld: sha1-avx2-asm.o:(.rodata+0xaa3720): undefined reference to `pt_iommu_amdv1_iova_to_phys'

Adjust the kconfig to disable IOMMUFD_TEST if IOMMU_PT_AMDV1 is incompatible.

Fixes: e93d5945ed5b ("iommufd: Change the selftest to use iommupt instead of xarray")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512210135.freQWpxa-lkp@intel.com/
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/iommufd/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Arnd, I think the above kbuild report is matching what you were reporting, I
was able to test this with those instructions.

diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
index 7e41e3ccea7587..455bac0351f289 100644
--- a/drivers/iommu/iommufd/Kconfig
+++ b/drivers/iommu/iommufd/Kconfig
@@ -41,7 +41,7 @@ config IOMMUFD_TEST
 	depends on DEBUG_KERNEL
 	depends on FAULT_INJECTION
 	depends on RUNTIME_TESTING_MENU
-	depends on IOMMU_PT_AMDV1
+	depends on IOMMU_PT_AMDV1=y || IOMMUFD=IOMMU_PT_AMDV1
 	select DMA_SHARED_BUFFER
 	select IOMMUFD_DRIVER
 	default n
-- 
2.43.0


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

* Re: [PATCH rc 1/3] iommupt: Fix the kunit building
  2026-01-06 19:22 ` [PATCH rc 1/3] iommupt: Fix the kunit building Jason Gunthorpe
@ 2026-01-08 14:37   ` Alejandro Jimenez
  2026-01-08 14:49     ` Jason Gunthorpe
  0 siblings, 1 reply; 8+ messages in thread
From: Alejandro Jimenez @ 2026-01-08 14:37 UTC (permalink / raw)
  To: Jason Gunthorpe, iommu, Joerg Roedel, Robin Murphy, Will Deacon
  Cc: Arnd Bergmann, Geert Uytterhoeven, Joerg Roedel, Kevin Tian,
	kernel test robot, Nicolin Chen, Pasha Tatashin, patches,
	Samiullah Khawaja



On 1/6/26 2:22 PM, Jason Gunthorpe wrote:
> The kunit doesn't work since the below commit made GENERIC_PT
> unselectable:
> 
>   $ make ARCH=x86_64 O=build_kunit_x86_64 olddefconfig
>   ERROR:root:Not all Kconfig options selected in kunitconfig were in the generated .config.
>   This is probably due to unsatisfied dependencies.
>   Missing: CONFIG_DEBUG_GENERIC_PT=y, CONFIG_IOMMUFD_TEST=y,
>   CONFIG_IOMMU_PT_X86_64=y, CONFIG_GENERIC_PT=y, CONFIG_IOMMU_PT_AMDV1=y,
>   CONFIG_IOMMU_PT_VTDSS=y, CONFIG_IOMMU_PT=y, CONFIG_IOMMU_PT_KUNIT_TEST=y
> 
> Also remove the unneeded CONFIG_IOMMUFD_TEST reference as the iommupt kunit
> doesn't interact with iommufd, and it doesn't currently build for the
> kunit due problems with DMA_SHARED buffer either.
> 
> Fixes: 01569c216dde ("genpt: Make GENERIC_PT invisible")
> Fixes: 1dd4187f53c3 ("iommupt: Add a kunit test for Generic Page Table")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Verified on AMD Zen4 host that kunit now builds and runs as expected 
with this patch applied. One question below..

> ---
>   drivers/iommu/generic_pt/.kunitconfig | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/generic_pt/.kunitconfig b/drivers/iommu/generic_pt/.kunitconfig
> index 52ac9e661ffd2b..a78b295f264d23 100644
> --- a/drivers/iommu/generic_pt/.kunitconfig
> +++ b/drivers/iommu/generic_pt/.kunitconfig
> @@ -1,4 +1,5 @@
>   CONFIG_KUNIT=y
> +CONFIG_COMPILE_TEST=y

I was wondering if there are any side effects from enabling 
COMPILE_TEST. I see that Geert had the same question on:

https://lore.kernel.org/all/20251120193326.GB233636@ziepe.ca/

and that you agreed with his proposed approach to do:

  menuconfig GENERIC_PT
-       bool "Generic Radix Page Table" if COMPILE_TEST
+       bool "Generic Radix Page Table" if COMPILE_TEST || KUNIT

(which also works as long as CONFIG_IOMMUFD_TEST=y is removed).
Is there a problem with making GENERIC_PT visible on KUNIT=y?

Thank you,
Alejandro

>   CONFIG_GENERIC_PT=y
>   CONFIG_DEBUG_GENERIC_PT=y
>   CONFIG_IOMMU_PT=y
> @@ -11,4 +12,3 @@ CONFIG_IOMMUFD=y
>   CONFIG_DEBUG_KERNEL=y
>   CONFIG_FAULT_INJECTION=y
>   CONFIG_RUNTIME_TESTING_MENU=y
> -CONFIG_IOMMUFD_TEST=y




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

* Re: [PATCH rc 1/3] iommupt: Fix the kunit building
  2026-01-08 14:37   ` Alejandro Jimenez
@ 2026-01-08 14:49     ` Jason Gunthorpe
  2026-01-09 18:23       ` Alejandro Jimenez
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Gunthorpe @ 2026-01-08 14:49 UTC (permalink / raw)
  To: Alejandro Jimenez
  Cc: iommu, Joerg Roedel, Robin Murphy, Will Deacon, Arnd Bergmann,
	Geert Uytterhoeven, Joerg Roedel, Kevin Tian, kernel test robot,
	Nicolin Chen, Pasha Tatashin, patches, Samiullah Khawaja

On Thu, Jan 08, 2026 at 09:37:17AM -0500, Alejandro Jimenez wrote:
> > diff --git a/drivers/iommu/generic_pt/.kunitconfig b/drivers/iommu/generic_pt/.kunitconfig
> > index 52ac9e661ffd2b..a78b295f264d23 100644
> > --- a/drivers/iommu/generic_pt/.kunitconfig
> > +++ b/drivers/iommu/generic_pt/.kunitconfig
> > @@ -1,4 +1,5 @@
> >   CONFIG_KUNIT=y
> > +CONFIG_COMPILE_TEST=y
> 
> I was wondering if there are any side effects from enabling COMPILE_TEST. I
> see that Geert had the same question on:

On it's own COMPILE_TEST isn't supposed to make any functional
changes, just enable more drivers.

IMHO the .kunitconfig fragments are really only for direct use by the
kunit.py, if some distro wanted to enable kunits on top of a
production kernel they should not just blindly import the
.kunitconfigs into the .config..

> and that you agreed with his proposed approach to do:
> 
>  menuconfig GENERIC_PT
> -       bool "Generic Radix Page Table" if COMPILE_TEST
> +       bool "Generic Radix Page Table" if COMPILE_TEST || KUNIT
> 
> (which also works as long as CONFIG_IOMMUFD_TEST=y is removed).
> Is there a problem with making GENERIC_PT visible on KUNIT=y?

Ah, I may have forgot about this, I don't have a strong opinion either
way.

Jason

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

* Re: [PATCH rc 1/3] iommupt: Fix the kunit building
  2026-01-08 14:49     ` Jason Gunthorpe
@ 2026-01-09 18:23       ` Alejandro Jimenez
  0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Jimenez @ 2026-01-09 18:23 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: iommu, Joerg Roedel, Robin Murphy, Will Deacon, Arnd Bergmann,
	Geert Uytterhoeven, Joerg Roedel, Kevin Tian, kernel test robot,
	Nicolin Chen, Pasha Tatashin, patches, Samiullah Khawaja



On 1/8/26 9:49 AM, Jason Gunthorpe wrote:
> On Thu, Jan 08, 2026 at 09:37:17AM -0500, Alejandro Jimenez wrote:
>>> diff --git a/drivers/iommu/generic_pt/.kunitconfig b/drivers/iommu/generic_pt/.kunitconfig
>>> index 52ac9e661ffd2b..a78b295f264d23 100644
>>> --- a/drivers/iommu/generic_pt/.kunitconfig
>>> +++ b/drivers/iommu/generic_pt/.kunitconfig
>>> @@ -1,4 +1,5 @@
>>>   CONFIG_KUNIT=y
>>> +CONFIG_COMPILE_TEST=y
>>
>> I was wondering if there are any side effects from enabling COMPILE_TEST. I
>> see that Geert had the same question on:
> 
> On it's own COMPILE_TEST isn't supposed to make any functional
> changes, just enable more drivers.
> 
Yes, I thought it might make the "building" stage of running the kunit
slower, but that is negligible.

> IMHO the .kunitconfig fragments are really only for direct use by the
> kunit.py, if some distro wanted to enable kunits on top of a
> production kernel they should not just blindly import the
> .kunitconfigs into the .config..
> 
>> and that you agreed with his proposed approach to do:
>>
>>  menuconfig GENERIC_PT
>> -       bool "Generic Radix Page Table" if COMPILE_TEST
>> +       bool "Generic Radix Page Table" if COMPILE_TEST || KUNIT
>>
>> (which also works as long as CONFIG_IOMMUFD_TEST=y is removed).
>> Is there a problem with making GENERIC_PT visible on KUNIT=y?
> 
> Ah, I may have forgot about this, I don't have a strong opinion either
> way.
> 
As far as I have tested, either approach works.

Reviewed-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>

> Jason


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

* Re: [PATCH rc 0/3] Fix some kconfig related issues with iommu pt
  2026-01-06 19:22 [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Jason Gunthorpe
                   ` (2 preceding siblings ...)
  2026-01-06 19:22 ` [PATCH rc 3/3] iommufd/selftest: Prevent module/builtin conflicts in kconfig Jason Gunthorpe
@ 2026-01-10  9:41 ` Joerg Roedel
  3 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2026-01-10  9:41 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: iommu, Robin Murphy, Will Deacon, Alejandro Jimenez,
	Arnd Bergmann, Geert Uytterhoeven, Joerg Roedel, Kevin Tian,
	kernel test robot, Nicolin Chen, Pasha Tatashin, patches,
	Samiullah Khawaja

On Tue, Jan 06, 2026 at 03:22:09PM -0400, Jason Gunthorpe wrote:
> Two issues found while checking the kunit against rc4, and one from some
> build bots.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> 
> Jason Gunthorpe (3):
>   iommupt: Fix the kunit building
>   iommufd/selftest: Add missing kconfig for DMA_SHARED_BUFFER
>   iommufd/selftest: Prevent module/builtin conflicts in kconfig

Applied for -rc, thanks.

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

end of thread, other threads:[~2026-01-10  9:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 19:22 [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Jason Gunthorpe
2026-01-06 19:22 ` [PATCH rc 1/3] iommupt: Fix the kunit building Jason Gunthorpe
2026-01-08 14:37   ` Alejandro Jimenez
2026-01-08 14:49     ` Jason Gunthorpe
2026-01-09 18:23       ` Alejandro Jimenez
2026-01-06 19:22 ` [PATCH rc 2/3] iommufd/selftest: Add missing kconfig for DMA_SHARED_BUFFER Jason Gunthorpe
2026-01-06 19:22 ` [PATCH rc 3/3] iommufd/selftest: Prevent module/builtin conflicts in kconfig Jason Gunthorpe
2026-01-10  9:41 ` [PATCH rc 0/3] Fix some kconfig related issues with iommu pt Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.