drivers/resctrl/test_mpam_devices.c:9:42: sparse: sparse: incorrect type in initializer (different address spaces)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 8f0b4cce4481fb22653697cced8d0d04027cb1e8 commit: e3565d1fd4dcf2c7ee6912094066e47c7500eaf2 arm_mpam: Add kunit test for bitmap reset date: 4 weeks ago config: arm64-randconfig-r133-20251215 (https://download.01.org/0day-ci/archive/20251216/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 8.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251216/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
drivers/resctrl/mpam_devices.c: note: in included file:
>> drivers/resctrl/test_mpam_devices.c:9:42: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char [noderef] __iomem *buf @@ got void * @@ drivers/resctrl/test_mpam_devices.c:9:42: sparse: expected char [noderef] __iomem *buf drivers/resctrl/test_mpam_devices.c:9:42: sparse: got void * >> drivers/resctrl/test_mpam_devices.c:24:24: sparse: sparse: cast removes address space '__iomem' of expression
drivers/resctrl/mpam_devices.c:271:5: sparse: sparse: context imbalance in 'mpam_register_requestor' - wrong count at exit drivers/resctrl/mpam_devices.c:1218:9: sparse: sparse: context imbalance in '_msmon_read' - wrong count at exit drivers/resctrl/mpam_devices.c:1281:6: sparse: sparse: context imbalance in 'mpam_msmon_reset_mbwu' - wrong count at exit drivers/resctrl/mpam_devices.c:1632:9: sparse: sparse: context imbalance in 'mpam_cpu_online' - wrong count at exit drivers/resctrl/mpam_devices.c:1705:9: sparse: sparse: context imbalance in 'mpam_cpu_offline' - wrong count at exit drivers/resctrl/mpam_devices.c:2294:12: sparse: sparse: context imbalance in 'mpam_register_irqs' - wrong count at exit drivers/resctrl/mpam_devices.c:2346:9: sparse: sparse: context imbalance in 'mpam_unregister_irqs' - wrong count at exit drivers/resctrl/mpam_devices.c:2546:9: sparse: sparse: context imbalance in 'mpam_reset_component_locked' - wrong count at exit drivers/resctrl/mpam_devices.c:2567:9: sparse: sparse: context imbalance in 'mpam_reset_class_locked' - wrong count at exit drivers/resctrl/mpam_devices.c:2640:9: sparse: sparse: context imbalance in 'mpam_enable' - wrong count at exit drivers/resctrl/mpam_devices.c:2666:5: sparse: sparse: context imbalance in 'mpam_apply_config' - wrong count at exit
vim +9 drivers/resctrl/test_mpam_devices.c
6
7 static void test_mpam_reset_msc_bitmap(struct kunit *test)
8 {
> 9 char __iomem *buf = kunit_kzalloc(test, SZ_16K, GFP_KERNEL);
10 struct mpam_msc fake_msc = {};
11 u32 *test_result;
12
13 if (!buf)
14 return;
15
16 fake_msc.mapped_hwpage = buf;
17 fake_msc.mapped_hwpage_sz = SZ_16K;
18 cpumask_copy(&fake_msc.accessibility, cpu_possible_mask);
19
20 /* Satisfy lockdep checks */
21 mutex_init(&fake_msc.part_sel_lock);
22 mutex_lock(&fake_msc.part_sel_lock);
23
> 24 test_result = (u32 *)(buf + MPAMCFG_CPBM);
25
26 mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 0);
27 KUNIT_EXPECT_EQ(test, test_result[0], 0);
28 KUNIT_EXPECT_EQ(test, test_result[1], 0);
29 test_result[0] = 0;
30 test_result[1] = 0;
31
32 mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 1);
33 KUNIT_EXPECT_EQ(test, test_result[0], 1);
34 KUNIT_EXPECT_EQ(test, test_result[1], 0);
35 test_result[0] = 0;
36 test_result[1] = 0;
37
38 mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 16);
39 KUNIT_EXPECT_EQ(test, test_result[0], 0xffff);
40 KUNIT_EXPECT_EQ(test, test_result[1], 0);
41 test_result[0] = 0;
42 test_result[1] = 0;
43
44 mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 32);
45 KUNIT_EXPECT_EQ(test, test_result[0], 0xffffffff);
46 KUNIT_EXPECT_EQ(test, test_result[1], 0);
47 test_result[0] = 0;
48 test_result[1] = 0;
49
50 mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 33);
51 KUNIT_EXPECT_EQ(test, test_result[0], 0xffffffff);
52 KUNIT_EXPECT_EQ(test, test_result[1], 1);
53 test_result[0] = 0;
54 test_result[1] = 0;
55
56 mutex_unlock(&fake_msc.part_sel_lock);
57 }
58 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki