[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250919133316.2741279-1-smostafa@google.com>
Date: Fri, 19 Sep 2025 13:33:09 +0000
From: Mostafa Saleh <smostafa@...gle.com>
To: iommu@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: robin.murphy@....com, will@...nel.org, joro@...tes.org, jgg@...pe.ca,
praan@...gle.com, Mostafa Saleh <smostafa@...gle.com>
Subject: [PATCH v3 0/4] Move io-pgtable-arm selftest to KUnit
This is a small series to clean up the io-pgtable-arm library.
The first patch is a small clean up to reduce the depedencies of the
test before moving it.
The second patch was originally part of the SMMUv3 KVM driver support[1],
which needed to factor out the kernel code from the io-pgtable-arm
library, and based on Jason’s suggestion this can be taken out as a
cleanup, and a step further to convert it to kunit.
The second patch just moves the code to a new file with no other changes,
so it can be easier to review with “--color-moved”
The third patch converts the sefltest to be modular, that is useful as
kunit can be a module and it can run anytime after boot.
The fourth patch registers the test using kunit, and converges some of
the APIs, some notes about that:
Granularity of tests:
---------------------
To make the series easier to review, the series changes the test to run in
kunit without making intrusive changes to the test itself.
It’s possible to refactor the tests to have smaller granularity (although
I think that would make it less efficient as we might create the same io-pgtable
config multiple times) and integrate them in kunit as multiple tests, that
change would be more intrusive, if you think that is the right approach,
I can add a couple of more patches re-writing the tests.
Other changes:
--------------
- Also, to make the test changes minimal, and the fail messages similar,
“KUNIT_FAIL()” is used to fail all tests instead of using KUNIT specific
assertions.
- Instead of using faux device, we rely on kunit_device_register()
- The WARN is removed when a test fails, as that doesn’t seem to be a pattern
used with kunit.
You can find the instructions on how to run kunit in the last patch commit message.
A failure at the test with the new implementation look as
[ 191.675985] # arm_lpae_do_selftests: selftest: pgsize_bitmap 0x20010000, IAS 40 OAS 48
[ 191.676057] # arm_lpae_do_selftests: EXPECTATION FAILED at drivers/iommu/io-pgtable-arm-selftests.c:91
[ 191.676087] # arm_lpae_do_selftests: selftest: test failed for fmt idx 0
Main changes in v3:
-------------------
- Move back unused code
- Simplify printing based on Jason comments + some renames
- Collect Jasons Rb
v2: https://lore.kernel.org/all/20250917191143.3847487-1-smostafa@google.com/
Main changes in v2:
-------------------
- Make the test modular
v1: https://lore.kernel.org/linux-iommu/20250917140216.2199055-1-smostafa@google.com/
[1] https://lore.kernel.org/all/20250819215156.2494305-5-smostafa@google.com/
Mostafa Saleh (4):
iommu/io-pgtable-arm: Simplify error prints for selftests
iommu/io-pgtable-arm: Move selftests to a separate file
iommu/io-pgtable-arm-selftests: Modularize the test
iommu/io-pgtable-arm-selftests: Use KUnit
drivers/iommu/Kconfig | 12 +-
drivers/iommu/Makefile | 1 +
drivers/iommu/io-pgtable-arm-selftests.c | 222 +++++++++++++++++++++++
drivers/iommu/io-pgtable-arm.c | 204 ---------------------
4 files changed, 230 insertions(+), 209 deletions(-)
create mode 100644 drivers/iommu/io-pgtable-arm-selftests.c
--
2.51.0.534.gc79095c0ca-goog
Powered by blists - more mailing lists