arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: sparse: incorrect type in argument 2 (different address spaces)

kernel test robot
2023-12-05T07:48:17Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: 90db9dbedd26ce029f3a0f8d2cbd3a142f452408 kasan, powerpc: don't rename memintrinsics if compiler adds prefixes
date: 9 months ago
config: powerpc-randconfig-r123-20231204 (https://download.01.org/0day-ci/archive/20231205/202312051524.fOUthBRF-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce: (https://download.01.org/0day-ci/archive/20231205/202312051524.fOUthBRF-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312051524.fOUthBRF-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
>> arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *q @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: expected void const *q
arch/powerpc/platforms/52xx/mpc52xx_pm.c:135:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
>> arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *p @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: expected void *p
arch/powerpc/platforms/52xx/mpc52xx_pm.c:138:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: got void [noderef] __iomem *irq_0x500
>> arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *q @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: expected void const *q
arch/powerpc/platforms/52xx/mpc52xx_pm.c:157:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: got void [noderef] __iomem *irq_0x500
>> arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *p @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: expected void *p
arch/powerpc/platforms/52xx/mpc52xx_pm.c:158:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *p @@ got void [noderef] __iomem *irq_0x500 @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: expected void *p
arch/powerpc/platforms/52xx/mpc52xx_pm.c:165:9: sparse: got void [noderef] __iomem *irq_0x500
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: expected void const *
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *p @@ got void [noderef] __iomem *static [assigned] [toplevel] sram @@
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: expected void *p
arch/powerpc/platforms/52xx/mpc52xx_pm.c:178:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] sram

vim +135 arch/powerpc/platforms/52xx/mpc52xx_pm.c

2e1ee1f76684c5 Domen Puncer 2007-05-07 114
2e1ee1f76684c5 Domen Puncer 2007-05-07 115 int mpc52xx_pm_enter(suspend_state_t state)
2e1ee1f76684c5 Domen Puncer 2007-05-07 116 {
2e1ee1f76684c5 Domen Puncer 2007-05-07 117 u32 clk_enables;
2e1ee1f76684c5 Domen Puncer 2007-05-07 118 u32 msr, hid0;
2e1ee1f76684c5 Domen Puncer 2007-05-07 119 u32 intr_main_mask;
d3e0e02804a5f4 Domen Puncer 2007-07-09 120 void __iomem * irq_0x500 = (void __iomem *)CONFIG_KERNEL_START + 0x500;
2e1ee1f76684c5 Domen Puncer 2007-05-07 121 unsigned long irq_0x500_stop = (unsigned long)irq_0x500 + mpc52xx_ds_cached_size;
741c5640a15a23 Kees Cook 2018-07-02 122 char saved_0x500[0x600-0x500];
741c5640a15a23 Kees Cook 2018-07-02 123
741c5640a15a23 Kees Cook 2018-07-02 124 if (WARN_ON(mpc52xx_ds_cached_size > sizeof(saved_0x500)))
741c5640a15a23 Kees Cook 2018-07-02 125 return -ENOMEM;
2e1ee1f76684c5 Domen Puncer 2007-05-07 126
2e1ee1f76684c5 Domen Puncer 2007-05-07 127 /* disable all interrupts in PIC */
2e1ee1f76684c5 Domen Puncer 2007-05-07 128 intr_main_mask = in_be32(&intr->main_mask);
2e1ee1f76684c5 Domen Puncer 2007-05-07 129 out_be32(&intr->main_mask, intr_main_mask | 0x1ffff);
2e1ee1f76684c5 Domen Puncer 2007-05-07 130
2e1ee1f76684c5 Domen Puncer 2007-05-07 131 /* don't let DEC expire any time soon */
2e1ee1f76684c5 Domen Puncer 2007-05-07 132 mtspr(SPRN_DEC, 0x7fffffff);
2e1ee1f76684c5 Domen Puncer 2007-05-07 133
2e1ee1f76684c5 Domen Puncer 2007-05-07 134 /* save SRAM */
2e1ee1f76684c5 Domen Puncer 2007-05-07 @135 memcpy(saved_sram, sram, sram_size);
2e1ee1f76684c5 Domen Puncer 2007-05-07 136
2e1ee1f76684c5 Domen Puncer 2007-05-07 137 /* copy low level suspend code to sram */
2e1ee1f76684c5 Domen Puncer 2007-05-07 @138 memcpy(sram, mpc52xx_ds_sram, mpc52xx_ds_sram_size);
2e1ee1f76684c5 Domen Puncer 2007-05-07 139
2e1ee1f76684c5 Domen Puncer 2007-05-07 140 out_8(&cdm->ccs_sleep_enable, 1);
2e1ee1f76684c5 Domen Puncer 2007-05-07 141 out_8(&cdm->osc_sleep_enable, 1);
2e1ee1f76684c5 Domen Puncer 2007-05-07 142 out_8(&cdm->ccs_qreq_test, 1);
2e1ee1f76684c5 Domen Puncer 2007-05-07 143
2e1ee1f76684c5 Domen Puncer 2007-05-07 144 /* disable all but SDRAM and bestcomm (SRAM) clocks */
2e1ee1f76684c5 Domen Puncer 2007-05-07 145 clk_enables = in_be32(&cdm->clk_enables);
2e1ee1f76684c5 Domen Puncer 2007-05-07 146 out_be32(&cdm->clk_enables, clk_enables & 0x00088000);
2e1ee1f76684c5 Domen Puncer 2007-05-07 147
2e1ee1f76684c5 Domen Puncer 2007-05-07 148 /* disable power management */
2e1ee1f76684c5 Domen Puncer 2007-05-07 149 msr = mfmsr();
2e1ee1f76684c5 Domen Puncer 2007-05-07 150 mtmsr(msr & ~MSR_POW);
2e1ee1f76684c5 Domen Puncer 2007-05-07 151
2e1ee1f76684c5 Domen Puncer 2007-05-07 152 /* enable sleep mode, disable others */
2e1ee1f76684c5 Domen Puncer 2007-05-07 153 hid0 = mfspr(SPRN_HID0);
2e1ee1f76684c5 Domen Puncer 2007-05-07 154 mtspr(SPRN_HID0, (hid0 & ~(HID0_DOZE | HID0_NAP | HID0_DPM)) | HID0_SLEEP);
2e1ee1f76684c5 Domen Puncer 2007-05-07 155
2e1ee1f76684c5 Domen Puncer 2007-05-07 156 /* save original, copy our irq handler, flush from dcache and invalidate icache */
2e1ee1f76684c5 Domen Puncer 2007-05-07 @157 memcpy(saved_0x500, irq_0x500, mpc52xx_ds_cached_size);
2e1ee1f76684c5 Domen Puncer 2007-05-07 @158 memcpy(irq_0x500, mpc52xx_ds_cached, mpc52xx_ds_cached_size);
2e1ee1f76684c5 Domen Puncer 2007-05-07 159 flush_icache_range((unsigned long)irq_0x500, irq_0x500_stop);
2e1ee1f76684c5 Domen Puncer 2007-05-07 160
2e1ee1f76684c5 Domen Puncer 2007-05-07 161 /* call low-level sleep code */
2e1ee1f76684c5 Domen Puncer 2007-05-07 162 mpc52xx_deep_sleep(sram, sdram, cdm, intr);
2e1ee1f76684c5 Domen Puncer 2007-05-07 163
2e1ee1f76684c5 Domen Puncer 2007-05-07 164 /* restore original irq handler */
2e1ee1f76684c5 Domen Puncer 2007-05-07 165 memcpy(irq_0x500, saved_0x500, mpc52xx_ds_cached_size);
2e1ee1f76684c5 Domen Puncer 2007-05-07 166 flush_icache_range((unsigned long)irq_0x500, irq_0x500_stop);
2e1ee1f76684c5 Domen Puncer 2007-05-07 167
2e1ee1f76684c5 Domen Puncer 2007-05-07 168 /* restore old power mode */
2e1ee1f76684c5 Domen Puncer 2007-05-07 169 mtmsr(msr & ~MSR_POW);
2e1ee1f76684c5 Domen Puncer 2007-05-07 170 mtspr(SPRN_HID0, hid0);
2e1ee1f76684c5 Domen Puncer 2007-05-07 171 mtmsr(msr);
2e1ee1f76684c5 Domen Puncer 2007-05-07 172
2e1ee1f76684c5 Domen Puncer 2007-05-07 173 out_be32(&cdm->clk_enables, clk_enables);
2e1ee1f76684c5 Domen Puncer 2007-05-07 174 out_8(&cdm->ccs_sleep_enable, 0);
2e1ee1f76684c5 Domen Puncer 2007-05-07 175 out_8(&cdm->osc_sleep_enable, 0);
2e1ee1f76684c5 Domen Puncer 2007-05-07 176
2e1ee1f76684c5 Domen Puncer 2007-05-07 177 /* restore SRAM */
2e1ee1f76684c5 Domen Puncer 2007-05-07 178 memcpy(sram, saved_sram, sram_size);
2e1ee1f76684c5 Domen Puncer 2007-05-07 179
2e1ee1f76684c5 Domen Puncer 2007-05-07 180 /* reenable interrupts in PIC */
2e1ee1f76684c5 Domen Puncer 2007-05-07 181 out_be32(&intr->main_mask, intr_main_mask);
2e1ee1f76684c5 Domen Puncer 2007-05-07 182
2e1ee1f76684c5 Domen Puncer 2007-05-07 183 return 0;
2e1ee1f76684c5 Domen Puncer 2007-05-07 184 }
2e1ee1f76684c5 Domen Puncer 2007-05-07 185

:::::: The code at line 135 was first introduced by commit
:::::: 2e1ee1f76684c5d4dd8e5a08cbf22d57f88769ed [POWERPC] mpc52xx suspend to deep-sleep

:::::: TO: Domen Puncer <domen.puncer@telargo.com>
:::::: CC: Paul Mackerras <paulus@samba.org>

--
0-DAY CI Kernel Test Service