arch/riscv/include/asm/timex.h:31:16: sparse: sparse: cast removes address space '__iomem' of expression

From: kernel test robot

Date: Wed Jul 15 2026 - 19:00:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 58717b2a1365d06c8c64b72aa948541b53fe31eb
commit: c03ad15f7cf60999681a3e5784404a73a93e6506 riscv: Reuse measure_cycles() in check_vector_unaligned_access()
date: 3 months ago
config: riscv-randconfig-r111-20260715 (https://download.01.org/0day-ci/archive/20260716/202607160619.14G8GHp5-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project b3e6e6dabdc02153552a64fc74ff5c7532447eed)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260716/202607160619.14G8GHp5-lkp@xxxxxxxxx/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
| Fixes: c03ad15f7cf6 ("riscv: Reuse measure_cycles() in check_vector_unaligned_access()")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607160619.14G8GHp5-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
WARNING: invalid argument to '-march': '_zacas_zabha'
arch/riscv/kernel/unaligned_access_speed.c: note: in included file (through include/linux/timex.h, include/linux/time32.h, include/linux/time.h, include/linux/jiffies.h, ...):
>> arch/riscv/include/asm/timex.h:31:16: sparse: sparse: cast removes address space '__iomem' of expression
>> arch/riscv/include/asm/timex.h:31:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int [usertype] * @@
arch/riscv/include/asm/timex.h:31:16: sparse: expected void const volatile [noderef] __iomem *addr
arch/riscv/include/asm/timex.h:31:16: sparse: got unsigned int [usertype] *
>> arch/riscv/include/asm/timex.h:31:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int [usertype] * @@
arch/riscv/include/asm/timex.h:31:16: sparse: expected void const volatile [noderef] __iomem *addr
arch/riscv/include/asm/timex.h:31:16: sparse: got unsigned int [usertype] *
arch/riscv/include/asm/timex.h:25:16: sparse: sparse: cast removes address space '__iomem' of expression
arch/riscv/include/asm/timex.h:25:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int [usertype] * @@
arch/riscv/include/asm/timex.h:25:16: sparse: expected void const volatile [noderef] __iomem *addr
arch/riscv/include/asm/timex.h:25:16: sparse: got unsigned int [usertype] *
>> arch/riscv/include/asm/timex.h:31:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int [usertype] * @@
arch/riscv/include/asm/timex.h:31:16: sparse: expected void const volatile [noderef] __iomem *addr
arch/riscv/include/asm/timex.h:31:16: sparse: got unsigned int [usertype] *
>> arch/riscv/include/asm/timex.h:31:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int [usertype] * @@
arch/riscv/include/asm/timex.h:31:16: sparse: expected void const volatile [noderef] __iomem *addr
arch/riscv/include/asm/timex.h:31:16: sparse: got unsigned int [usertype] *
arch/riscv/include/asm/timex.h:25:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int [usertype] * @@
arch/riscv/include/asm/timex.h:25:16: sparse: expected void const volatile [noderef] __iomem *addr
arch/riscv/include/asm/timex.h:25:16: sparse: got unsigned int [usertype] *

vim +/__iomem +31 arch/riscv/include/asm/timex.h

d5be89a8d118a8e Palmer Dabbelt 2020-09-14 28
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 29 static inline u32 get_cycles_hi(void)
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 30 {
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 @31 return readl_relaxed(((u32 *)clint_time_val) + 1);
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 32 }
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 33 #define get_cycles_hi get_cycles_hi
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 34 #endif /* CONFIG_64BIT */
d5be89a8d118a8e Palmer Dabbelt 2020-09-14 35

:::::: The code at line 31 was first introduced by commit
:::::: d5be89a8d118a8e8d09cd74a921a808f17fbdd09 RISC-V: Resurrect the MMIO timer implementation for M-mode systems

:::::: TO: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>
:::::: CC: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki