linux/arch/riscv
Xiao Wang 457926b253
riscv: Optimize bitops with Zbb extension
This patch leverages the alternative mechanism to dynamically optimize
bitops (including __ffs, __fls, ffs, fls) with Zbb instructions. When
Zbb ext is not supported by the runtime CPU, legacy implementation is
used. If Zbb is supported, then the optimized variants will be selected
via alternative patching.

The legacy bitops support is taken from the generic C implementation as
fallback.

If the parameter is a build-time constant, we leverage compiler builtin to
calculate the result directly, this approach is inspired by x86 bitops
implementation.

EFI stub runs before the kernel, so alternative mechanism should not be
used there, this patch introduces a macro NO_ALTERNATIVE for this purpose.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20231031064553.2319688-3-xiao.w.wang@intel.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-11-09 10:15:52 -08:00
..
boot riscv: boot: Fix creation of loader.bin 2023-11-06 09:39:26 -08:00
configs riscv: defconfig : add CONFIG_MMC_DW for starfive 2023-11-05 09:04:54 -08:00
errata riscv: errata: andes: Makefile: Fix randconfig build issue 2023-09-27 07:02:48 -07:00
include riscv: Optimize bitops with Zbb extension 2023-11-09 10:15:52 -08:00
kernel Merge patch "drivers: perf: Do not broadcast to other cpus when starting a counter" 2023-11-09 06:44:13 -08:00
kvm riscv: Rearrange hwcap.h and cpufeature.h 2023-11-09 10:15:51 -08:00
lib riscv: Use SYM_*() assembly macros instead of deprecated ones 2023-11-06 09:42:47 -08:00
mm Merge patch series "riscv: Fix set_memory_XX() and set_direct_map_XX()" 2023-11-08 07:08:35 -08:00
net bpf, riscv: use prog pack allocator in the BPF JIT 2023-09-06 06:26:07 -07:00
purgatory riscv: Use SYM_*() assembly macros instead of deprecated ones 2023-11-06 09:42:47 -08:00
tools riscv: Check relocations at compile time 2023-04-19 07:46:32 -07:00
Kbuild kexec: rename ARCH_HAS_KEXEC_PURGATORY 2023-08-18 10:18:54 -07:00
Kconfig riscv: select ARCH_PROC_KCORE_TEXT 2023-11-06 16:25:45 -08:00
Kconfig.debug riscv: Add tests for riscv module loading 2023-11-07 14:59:32 -08:00
Kconfig.errata riscv: Kconfig.errata: Add dependency for RISCV_SBI in ERRATA_ANDES config 2023-09-08 11:25:28 -07:00
Kconfig.socs RISC-V: make ARCH_THEAD preclude XIP_KERNEL 2023-07-05 22:21:23 +02:00
Makefile Merge patch "drivers: perf: Do not broadcast to other cpus when starting a counter" 2023-11-09 06:44:13 -08:00
Makefile.postlink riscv: Use --emit-relocs in order to move .rela.dyn in init 2023-04-19 07:46:33 -07:00