[PATCH v9 9/9] iommu/arm-smmu-v3: Add unit tests for arm_smmu_write_entry
Jerry Snitselaar
jsnitsel at redhat.com
Wed May 8 19:21:10 PDT 2024
On Wed, May 08, 2024 at 07:17:40PM GMT, Jerry Snitselaar wrote:
> On Tue, Apr 30, 2024 at 02:21:41PM GMT, Jason Gunthorpe wrote:
> > Add tests for some of the more common STE update operations that we expect
> > to see, as well as some artificial STE updates to test the edges of
> > arm_smmu_write_entry. These also serve as a record of which common
> > operation is expected to be hitless, and how many syncs they require.
> >
> > arm_smmu_write_entry implements a generic algorithm that updates an STE/CD
> > to any other abritrary STE/CD configuration. The update requires a
> > sequence of write+sync operations with some invariants that must be held
> > true after each sync. arm_smmu_write_entry lends itself well to
> > unit-testing since the function's interaction with the STE/CD is already
> > abstracted by input callbacks that we can hook to introspect into the
> > sequence of operations. We can use these hooks to guarantee that
> > invariants are held throughout the entire update operation.
> >
> > Link: https://lore.kernel.org/r/20240106083617.1173871-3-mshavit@google.com
> > Tested-by: Nicolin Chen <nicolinc at nvidia.com>
> > Signed-off-by: Michael Shavit <mshavit at google.com>
> > Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> > ---
> > drivers/iommu/Kconfig | 13 +-
> > drivers/iommu/arm/arm-smmu-v3/Makefile | 1 +
> > .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 8 +-
> > .../iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c | 465 ++++++++++++++++++
> > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 +-
> > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 30 ++
> > 6 files changed, 533 insertions(+), 27 deletions(-)
> > create mode 100644 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c
> >
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index 0af39bbbe3a30e..f872aeccd82041 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -397,9 +397,9 @@ config ARM_SMMU_V3
> > Say Y here if your system includes an IOMMU device implementing
> > the ARM SMMUv3 architecture.
> >
> > +if ARM_SMMU_V3
> > config ARM_SMMU_V3_SVA
> > bool "Shared Virtual Addressing support for the ARM SMMUv3"
> > - depends on ARM_SMMU_V3
> > select IOMMU_SVA
> > select IOMMU_IOPF
> > select MMU_NOTIFIER
> > @@ -410,6 +410,17 @@ config ARM_SMMU_V3_SVA
> > 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
>
> Should this be 'depends on KUNIT=y'
>
> Seeing ld complain when building it on top of the rhel kernel. I'm grabbing a system
> to verify that it happens with joerg's next branch as well.
>
> Regards,
> Jerry
>
And I see you and Will are discussing it already. Ignore :)
More information about the linux-arm-kernel
mailing list