[PATCH v3 0/2] arch/riscv: Add bitrev.h file to support rev8 and brev8

Yury Norov ynorov at nvidia.com
Fri Apr 17 09:09:03 PDT 2026


On Fri, Apr 17, 2026 at 05:31:00PM +0800, Jinjie Ruan wrote:
> Add bitrev.h file to support rev8 and brev8 for riscv.
> 
> Tested functionally on riscv64 QEMU with:
> 	"-M virt,acpi=on,zbkb=true,zbb=true"
> 
> Changes in v3:
> - Fix the build issue by remving the CONFIG_HAVE_ARCH_BITREVERSE macro
>   for byte_rev_table.

No arch needs byte_rev_table, except risc-v under a very certain
configuration. Please find a better approach that wouldn't bloat
random victims' .data section.

> - Update the riscv implementation as David suggested.
> - Add Reviwed-by.
> 
> Changes in v2:
> - Define generic __bitrev8/16/32 for reuse in riscv.
> 
> Jinjie Ruan (2):
>   bitops: Define generic __bitrev8/16/32 for reuse
>   arch/riscv: Add bitrev.h file to support rev8 and brev8
> 
>  arch/riscv/Kconfig                    |  1 +
>  arch/riscv/include/asm/bitrev.h       | 55 +++++++++++++++++++++++++++
>  include/asm-generic/bitops/__bitrev.h | 22 +++++++++++
>  include/linux/bitrev.h                | 20 ++--------
>  lib/bitrev.c                          |  3 --
>  5 files changed, 82 insertions(+), 19 deletions(-)
>  create mode 100644 arch/riscv/include/asm/bitrev.h
>  create mode 100644 include/asm-generic/bitops/__bitrev.h
> 
> -- 
> 2.34.1



More information about the linux-riscv mailing list