Skip to contentSkip to conversation

arch/riscv/include/uapi/asm/hwprobe.h:58:49: warning: conversion from 'long long unsigned int' to 'long unsigned int' changes value from '4294967296' to '0'

PATCH kernel test robot 2 participants 2 messages Oct 31, 2023 RISC-V

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://github.com/avpatel/linux.git riscv_sbi_nested_v1
head:   9763a6c438da81175e07a5736eeb1e505a74e693
commit: 3b516003495c3ceb036e452b29691977d00616d0 [64/76] RISC-V: hwprobe: Expose Zicboz extension and its block size
config: riscv-rv32_defconfig (https://download.01.org/0day-ci/archive/20231031/[email protected]/config)
compiler: riscv32-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231031/[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]/

All warnings (new ones prefixed by >>):

In file included from arch/riscv/include/asm/hwprobe.h:9,
from arch/riscv/kernel/sys_riscv.c:11:
arch/riscv/kernel/sys_riscv.c: In function 'hwprobe_one_pair':

>> arch/riscv/include/uapi/asm/hwprobe.h:58:49: warning: conversion from 'long long unsigned int' to 'long unsigned int' changes value from '4294967296' to '0' [-Woverflow]
      58 | #define         RISCV_HWPROBE_EXT_ZICBOZ        (1ULL << 32)
         |                                                 ^~~~~~~~~~~~

arch/riscv/kernel/sys_riscv.c:266:44: note: in expansion of macro 'RISCV_HWPROBE_EXT_ZICBOZ'
266 | if (hwprobe_ext0_has(cpus, RISCV_HWPROBE_EXT_ZICBOZ))
| ^~~~~~~~~~~~~~~~~~~~~~~~

vim +58 arch/riscv/include/uapi/asm/hwprobe.h

    19	
    20	#define RISCV_HWPROBE_KEY_MVENDORID	0
    21	#define RISCV_HWPROBE_KEY_MARCHID	1
    22	#define RISCV_HWPROBE_KEY_MIMPID	2
    23	#define RISCV_HWPROBE_KEY_BASE_BEHAVIOR	3
    24	#define		RISCV_HWPROBE_BASE_BEHAVIOR_IMA	(1 << 0)
    25	#define RISCV_HWPROBE_KEY_IMA_EXT_0	4
    26	#define		RISCV_HWPROBE_IMA_FD		(1 << 0)
    27	#define		RISCV_HWPROBE_IMA_C		(1 << 1)
    28	#define		RISCV_HWPROBE_IMA_V		(1 << 2)
    29	#define		RISCV_HWPROBE_EXT_ZBA		(1 << 3)
    30	#define		RISCV_HWPROBE_EXT_ZBB		(1 << 4)
    31	#define		RISCV_HWPROBE_EXT_ZBS		(1 << 5)
    32	#define		RISCV_HWPROBE_EXT_ZBC		(1 << 6)
    33	#define		RISCV_HWPROBE_EXT_ZBKB		(1 << 7)
    34	#define		RISCV_HWPROBE_EXT_ZBKC		(1 << 8)
    35	#define		RISCV_HWPROBE_EXT_ZBKX		(1 << 9)
    36	#define		RISCV_HWPROBE_EXT_ZKND		(1 << 10)
    37	#define		RISCV_HWPROBE_EXT_ZKNE		(1 << 11)
    38	#define		RISCV_HWPROBE_EXT_ZKNH		(1 << 12)
    39	#define		RISCV_HWPROBE_EXT_ZKSED		(1 << 13)
    40	#define		RISCV_HWPROBE_EXT_ZKSH		(1 << 14)
    41	#define		RISCV_HWPROBE_EXT_ZKT		(1 << 15)
    42	#define		RISCV_HWPROBE_EXT_ZVBB		(1 << 16)
    43	#define		RISCV_HWPROBE_EXT_ZVBC		(1 << 17)
    44	#define		RISCV_HWPROBE_EXT_ZVKB		(1 << 18)
    45	#define		RISCV_HWPROBE_EXT_ZVKG		(1 << 19)
    46	#define		RISCV_HWPROBE_EXT_ZVKNED	(1 << 20)
    47	#define		RISCV_HWPROBE_EXT_ZVKNHA	(1 << 21)
    48	#define		RISCV_HWPROBE_EXT_ZVKNHB	(1 << 22)
    49	#define		RISCV_HWPROBE_EXT_ZVKSED	(1 << 23)
    50	#define		RISCV_HWPROBE_EXT_ZVKSH		(1 << 24)
    51	#define		RISCV_HWPROBE_EXT_ZVKT		(1 << 25)
    52	#define		RISCV_HWPROBE_EXT_ZFH		(1 << 26)
    53	#define		RISCV_HWPROBE_EXT_ZFHMIN	(1 << 27)
    54	#define		RISCV_HWPROBE_EXT_ZIHINTNTL	(1 << 28)
    55	#define		RISCV_HWPROBE_EXT_ZVFH		(1 << 29)
    56	#define		RISCV_HWPROBE_EXT_ZVFHMIN	(1 << 30)
    57	#define		RISCV_HWPROBE_EXT_ZFA		(1 << 31)
  > 58	#define		RISCV_HWPROBE_EXT_ZICBOZ	(1ULL << 32)
    59	#define RISCV_HWPROBE_KEY_CPUPERF_0	5
    60	#define		RISCV_HWPROBE_MISALIGNED_UNKNOWN	(0 << 0)
    61	#define		RISCV_HWPROBE_MISALIGNED_EMULATED	(1 << 0)
    62	#define		RISCV_HWPROBE_MISALIGNED_SLOW		(2 << 0)
    63	#define		RISCV_HWPROBE_MISALIGNED_FAST		(3 << 0)
    64	#define		RISCV_HWPROBE_MISALIGNED_UNSUPPORTED	(4 << 0)
    65	#define		RISCV_HWPROBE_MISALIGNED_MASK		(7 << 0)
    66	#define RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE	6
    67	/* Increase RISCV_HWPROBE_MAX_KEY when adding items. */
    68	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 17 lines · kernel test robot
tree:   https://github.com/avpatel/linux.git riscv_sbi_nested_v1
head:   9763a6c438da81175e07a5736eeb1e505a74e693
commit: 3b516003495c3ceb036e452b29691977d00616d0 [64/76] RISC-V: hwprobe: Expose Zicboz extension and its block size
config: riscv-rv32_defconfig (https://download.01.org/0day-ci/archive/20231031/[email protected]/config)
compiler: riscv32-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231031/[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]/

All warnings (new ones prefixed by >>):

In file included from arch/riscv/include/asm/hwprobe.h:9,
from arch/riscv/kernel/sys_riscv.c:11:
arch/riscv/kernel/sys_riscv.c: In function 'hwprobe_one_pair':

Quoted 7 lines
Quoted 1 line
Quoted 1 line

arch/riscv/include/uapi/asm/hwprobe.h:58:49: warning: conversion from 'long long unsigned int' to 'long unsigned int' changes value from '4294967296' to '0' [-Woverflow]

      58 | #define         RISCV_HWPROBE_EXT_ZICBOZ        (1ULL << 32)
         |                                                 ^~~~~~~~~~~~

arch/riscv/kernel/sys_riscv.c:266:44: note: in expansion of macro 'RISCV_HWPROBE_EXT_ZICBOZ'
266 | if (hwprobe_ext0_has(cpus, RISCV_HWPROBE_EXT_ZICBOZ))
| ^~~~~~~~~~~~~~~~~~~~~~~~

It looks like on merge the bit got bumped from 6 to 32, but hwprobe_ext0_has() used unsigned long for the extension, instead of u64. The diff below, which I can send as a proper patch, is the fix.

Thanks,
drew

arch/riscv/kernel/sys_riscv.c +1 -1
index c4c2888c9529..acfd09a63a29 100644
@@ -203,7 +203,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
        pair->value &= ~missing;
 }
 
-static bool hwprobe_ext0_has(const struct cpumask *cpus, unsigned long ext)
+static bool hwprobe_ext0_has(const struct cpumask *cpus, u64 ext)
 {
        struct riscv_hwprobe pair;