summaryrefslogtreecommitdiff
path: root/arch/riscv/mm/init.c
diff options
context:
space:
mode:
authorXiao Wang <xiao.w.wang@intel.com>2023-10-31 14:45:53 +0800
committerPalmer Dabbelt <palmer@rivosinc.com>2023-11-09 10:15:52 -0800
commit457926b253200bd9bdfae9a016a3b1d1dc661d55 (patch)
tree28d569b7577836d8163a8ebc37f67bbf5524749e /arch/riscv/mm/init.c
parente72c4333d2f2e7f2200f71a88c0480fd2a769a64 (diff)
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>
Diffstat (limited to 'arch/riscv/mm/init.c')
0 files changed, 0 insertions, 0 deletions