Re: [PATCH v7 9/9] iommu/arm-smmu-v3: Add unit tests for arm_smmu_write_entry

Jason Gunthorpe
2024-04-18T12:49:27Z

On Thu, Apr 18, 2024 at 12:39:29PM +0800, Michael Shavit wrote:
> > > Forgot that my SVA sanity doesn't cover this patch. And it looks
> > > like some problems here when building it with "=m":
> > >
> > > ERROR: modpost: missing MODULE_LICENSE() in drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.o
> > > ERROR: modpost: "arm_smmu_make_cdtable_ste" [drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.ko] undefined!
> > > ERROR: modpost: "arm_smmu_make_bypass_ste" [drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.ko] undefined!
> > > ERROR: modpost: "arm_smmu_make_abort_ste" [drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.ko] undefined!
> > > ERROR: modpost: "arm_smmu_make_s2_domain_ste" [drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.ko] undefined!
> > > ERROR: modpost: "arm_smmu_get_ste_used" [drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.ko] undefined!
> > > ERROR: modpost: "arm_smmu_write_entry" [drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.ko] undefined!
> > >
> > > Likely needs MODULE_LICENSE and some EXPORT_SYMBOLs.
> >
> > Oh! The kbuild never tested this kconfig combination...
> >
> > I think just this? Michael?
>
> Urhh I'm not sure... Should this also depend on ARM_SMMU_V3?

It does:

if ARM_SMMU_V3
config ARM_SMMU_V3_SVA
bool "Shared Virtual Addressing support for the ARM SMMUv3"
select IOMMU_SVA
select IOMMU_IOPF
select MMU_NOTIFIER
help
Support for sharing process address spaces with devices using the
SMMUv3.

Say Y here if your system supports SVA extensions such as PCIe PASID
and PRI.

config ARM_SMMU_V3_KUNIT_TEST
bool "KUnit tests for arm-smmu-v3 driver" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
help
Enable this option to unit-test arm-smmu-v3 driver functions.

If unsure, say N.
endif

The 'if' creates an automatic dependency and groups things into a
kconfig menu

> Also what
> happens if ARM_SMMU_V3=m and ARM_SMMU_V3_KUNIT_TEST=y ?

Works fine, the kunit symbols are exported and we still build one
module for smmu so we don't need to have internal cross-module stuff

Jason