[PW_SID:1090622] [v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE#1875
[PW_SID:1090622] [v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE#1875linux-riscv-bot wants to merge 6 commits into
Conversation
Architectures may have bit reversal instructions, but if the API not needed, the corresponding option should not be selected because it may lead to generating the unneeded code. Signed-off-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The generic bit reversal implementation is controlled by !HAVE_ARCH_BITREVERSE. This makes it difficult for architectures to provide a hardware-accelerated implementation while being able to fall back to the generic version if needed. This patch adds GENERIC_BITREVERSE, so bitreverse API is controlled by BITREVERSE, GENERIC_BITREVERSE and HAVE_ARCH_BITREVERSE options. The relationship between them is described as follows: - BITREVERSE is selected by user code; it's required to generate the API; - Architectures may select HAVE_ARCH_BITREVERSE and provide an arch implementation in arch/$(ARCH)/include/asm/bitrev.h. - if HAVE_ARCH_BITREVERSE isn't set, BITREVERSE selects GENERIC_BITREVERSE; - if GENERIC_BITREVERSE is set and HAVE_ARCH_BITREVERSE is not, the kernel provides generic implementation only, and wires bitrevXX() to it. - if HAVE_ARCH_BITREVERSE is set and GENERIC_BITREVERSE is not, the arch code provides __arch_bitrevXX(), and it is wired to bitrevXX(); - if both GENERIC_BITREVERSE and HAVE_ARCH_BITREVERSE are selected, the kernel generates generic___bitrev(), but wires bitrev() to the __arch_bitrev(). The last option allows architectures to use generic___bitrev() as a fallback option. Drivers and core code should never select GENERIC_BITREVERSE or HAVE_ARCH_BITREVERSE explicitly. Architectures that require generic bitreverse API as a fallback should explicitly enable GENERIC_BITREVERSE together with HAVE_ARCH_BITREVERSE. Signed-off-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Define generic___bitrev8/16/32 using the implementation in <linux/bitrev.h>, so they can be reused in <asm/bitrev.h>, such as RISCV. Reviewed-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The RISC-V Bit-manipulation Extension for Cryptography (Zbkb) provides the 'brev8' instruction, which reverses the bits within each byte. Combined with the 'rev8' instruction (from Zbb or Zbkb), which reverses the byte order of a register, we can efficiently implement 16-bit, 32-bit, and (on RV64) 64-bit bit reversal. This is significantly faster than the default software table-lookup implementation in lib/bitrev.c, as it replaces memory accesses and multiple arithmetic operations with just two or three hardware instructions. Select HAVE_ARCH_BITREVERSE as well as GENERIC_BITREVERSE, and provide <asm/bitrev.h> to utilize these instructions when the Zbkb extension is available at runtime via the alternatives mechanism. [Yury: select the options conditionally on BITREVERSE] Link: https://docs.riscv.org/reference/isa/unpriv/b-st-ext.html Suggested-by: David Laight <david.laight.linux@gmail.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Arch bitrev API is covered in MAINTAINERS under the BITOPS entry, while generic bitrev is unmaintained. Move it under BITOPS too. Signed-off-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 1: "[v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 2: "[v2,2/5] lib/bitrev: Introduce GENERIC_BITREVERSE" |
|
Patch 3: "[v2,3/5] bitops: Define generic___bitrev8/16/32 for reuse" |
|
Patch 3: "[v2,3/5] bitops: Define generic___bitrev8/16/32 for reuse" |
|
Patch 3: "[v2,3/5] bitops: Define generic___bitrev8/16/32 for reuse" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 4: "[v2,4/5] arch/riscv: Add bitrev.h file to support rev8 and brev8" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
|
Patch 5: "[v2,5/5] MAINTAINERS: BITOPS: include bitrev.[ch]" |
2c3b264 to
2d4fcdd
Compare
PR for series 1090622 applied to workflow__riscv__fixes
Name: [v2,1/5] arch: select HAVE_ARCH_BITREVERSE conditionally on BITREVERSE
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1090622
Version: 2