Message ID | 20250325121624.523258-9-guoren@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | rv64ilp32_abi: Build CONFIG_64BIT kernel-self with ILP32 ABI | expand |
Context | Check | Description |
---|---|---|
bjorn/pre-ci_am | success | Success |
bjorn/build-rv32-defconfig | fail | build-rv32-defconfig |
bjorn/build-rv64-clang-allmodconfig | fail | build-rv64-clang-allmodconfig |
bjorn/build-rv64-gcc-allmodconfig | fail | build-rv64-gcc-allmodconfig |
bjorn/build-rv64-nommu-k210-defconfig | success | build-rv64-nommu-k210-defconfig |
bjorn/build-rv64-nommu-k210-virt | success | build-rv64-nommu-k210-virt |
bjorn/checkpatch | success | checkpatch |
bjorn/dtb-warn-rv64 | success | dtb-warn-rv64 |
bjorn/header-inline | success | header-inline |
bjorn/kdoc | success | kdoc |
bjorn/module-param | success | module-param |
bjorn/verify-fixes | success | verify-fixes |
bjorn/verify-signedoff | success | verify-signedoff |
diff --git a/arch/riscv/include/asm/bitops.h b/arch/riscv/include/asm/bitops.h index c6bd3d8354a9..d041b9e3ba84 100644 --- a/arch/riscv/include/asm/bitops.h +++ b/arch/riscv/include/asm/bitops.h @@ -35,14 +35,27 @@ #include <asm/alternative-macros.h> #include <asm/hwcap.h> -#if (BITS_PER_LONG == 64) +#if (__riscv_xlen == 64) #define CTZW "ctzw " #define CLZW "clzw " + +#if (BITS_PER_LONG == 64) +#define CTZ "ctz " +#define CLZ "clz " #elif (BITS_PER_LONG == 32) +#define CTZ "ctzw " +#define CLZ "clzw " +#else +#error "Unexpected BITS_PER_LONG" +#endif + +#elif (__riscv_xlen == 32) #define CTZW "ctz " #define CLZW "clz " +#define CTZ "ctz " +#define CLZ "clz " #else -#error "Unexpected BITS_PER_LONG" +#error "Unexpected __riscv_xlen" #endif static __always_inline unsigned long variable__ffs(unsigned long word) @@ -53,7 +66,7 @@ static __always_inline unsigned long variable__ffs(unsigned long word) asm volatile (".option push\n" ".option arch,+zbb\n" - "ctz %0, %1\n" + CTZ "%0, %1\n" ".option pop\n" : "=r" (word) : "r" (word) :); @@ -82,7 +95,7 @@ static __always_inline unsigned long variable__fls(unsigned long word) asm volatile (".option push\n" ".option arch,+zbb\n" - "clz %0, %1\n" + CLZ "%0, %1\n" ".option pop\n" : "=r" (word) : "r" (word) :);