Commit Graph
4 Commits
Author SHA1 Message Date
Krzysztof Kozlowski fb75437b44 arm_mpam: Force __iomem casts
Code allocates standard kernel memory to pass to the MPAM, which expects
__iomem.  The code is safe, because __iomem accessors should work fine
on kernel mapped memory, however leads to sparse warnings:

  test_mpam_devices.c:327:42: warning: incorrect type in initializer (different address spaces)
  test_mpam_devices.c:327:42:    expected char [noderef] __iomem *buf
  test_mpam_devices.c:327:42:    got void *
  test_mpam_devices.c:342:24: warning: cast removes address space '__iomem' of expression

Cast the pointer to memory via __force to silence them.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Acked-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
2026-03-13 14:17:30 +00:00
Ben Horgan c1376f1ff3 arm_mpam: Disable preemption when making accesses to fake MSC in kunit test
Accesses to MSC must be made from a cpu that is affine to that MSC and the
driver checks this in __mpam_write_reg() using smp_processor_id(). A fake
in-memory MSC is used for testing. When using that, it doesn't matter which
cpu we access it from but calling smp_processor_id() from a preemptible
context gives warnings when running with CONFIG_DEBUG_PREEMPT.

Add a test helper that wraps mpam_reset_msc_bitmap() with preemption
disabled to ensure all (fake) MSC accesses are made with preemption
disabled.

Signed-off-by: Ben Horgan <[email protected]>
Reviewed-by: James Morse <[email protected]>
Signed-off-by: James Morse <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
2026-03-13 14:17:30 +00:00
James Morse 2557e0eafe arm_mpam: Add kunit tests for props_mismatch()
When features are mismatched between MSC the way features are combined
to the class determines whether resctrl can support this SoC.

Add some tests to illustrate the sort of thing that is expected to
work, and those that must be removed.

Signed-off-by: James Morse <[email protected]>
Reviewed-by: Ben Horgan <[email protected]>
Reviewed-by: Fenghua Yu <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Tested-by: Fenghua Yu <[email protected]>
Tested-by: Carl Worth <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Hanjun Guo <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
2025-11-19 18:34:24 +00:00
James Morse e3565d1fd4 arm_mpam: Add kunit test for bitmap reset
The bitmap reset code has been a source of bugs. Add a unit test.

This currently has to be built in, as the rest of the driver is
builtin.

Suggested-by: Jonathan Cameron <[email protected]>
Signed-off-by: James Morse <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Ben Horgan <[email protected]>
Reviewed-by: Fenghua Yu <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Tested-by: Fenghua Yu <[email protected]>
Tested-by: Carl Worth <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Hanjun Guo <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
2025-11-19 18:34:24 +00:00