Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <krzysztof.kozlowski@oss.qualcomm.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512160133.eAzPdJv2-lkp@intel.com/
Acked-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Will Deacon
fb75437b c1376f1f

+2 -2
+2 -2
drivers/resctrl/test_mpam_devices.c
··· 332 332 333 333 static void test_mpam_reset_msc_bitmap(struct kunit *test) 334 334 { 335 - char __iomem *buf = kunit_kzalloc(test, SZ_16K, GFP_KERNEL); 335 + char __iomem *buf = (__force char __iomem *)kunit_kzalloc(test, SZ_16K, GFP_KERNEL); 336 336 struct mpam_msc fake_msc = {}; 337 337 u32 *test_result; 338 338 ··· 347 347 mutex_init(&fake_msc.part_sel_lock); 348 348 mutex_lock(&fake_msc.part_sel_lock); 349 349 350 - test_result = (u32 *)(buf + MPAMCFG_CPBM); 350 + test_result = (__force u32 *)(buf + MPAMCFG_CPBM); 351 351 352 352 __test_mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 0); 353 353 KUNIT_EXPECT_EQ(test, test_result[0], 0);