Thread (9 messages) 9 messages, 4 authors, 2026-03-06

Re: [PATCH 1/2] arm_mpam: Force __iomem casts

From: James Morse <james.morse@arm.com>
Date: 2026-03-06 18:26:36
Also in: lkml

Hi Krzysztof, Ben,

On 27/02/2026 14:51, Krzysztof Kozlowski wrote:
On 27/02/2026 15:06, Ben Horgan wrote:
quoted
On 2/16/26 11:02, Krzysztof Kozlowski wrote:
quoted
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.
quoted
quoted
diff --git a/drivers/resctrl/test_mpam_devices.c b/drivers/resctrl/test_mpam_devices.c
index 3e8d564a0c64..2de41b47c138 100644
--- a/drivers/resctrl/test_mpam_devices.c
+++ b/drivers/resctrl/test_mpam_devices.c
@@ -324,7 +324,7 @@ static void test_mpam_enable_merge_features(struct kunit *test)
 
 static void test_mpam_reset_msc_bitmap(struct kunit *test)
 {
-	char __iomem *buf = kunit_kzalloc(test, SZ_16K, GFP_KERNEL);
+	char __iomem *buf = (__force char __iomem *)kunit_kzalloc(test, SZ_16K, GFP_KERNEL);
 	struct mpam_msc fake_msc = {};
 	u32 *test_result;
 
quoted
This change looks good to me.
[...]
quoted
Acked-by: Ben Horgan <ben.horgan@arm.com>

Thanks! I've picked this for a fixes branch. I'm not sure what Will or Catalin will think
this needs fixing during the release as the driver is behind CONFIG_EXPERT. I'll ask...


Thanks,

James
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help