[PATCH v2 0/2] Implement endianness swap macros for RISC-V

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Motivated by [1]. A couple of things to note:

RISC-V needs a default implementation to fall back on. Such
implementation is available in include/uapi/linux/swab.h in the form of 
___constant_swabXX macros. As include/uapi/linux/swab.h can't be 
included from arch/riscv/include/asm/swab.h, the default implementation 
has been moved into asm-generic in the first patch of the series.

Tested with crc_kunit as pointed out in [2]. I can't provide performance 
numbers as I don't have RISC-V hardware yet.

[1] https://lore.kernel.org/all/20250302220426.GC2079@quark.localdomain/
[2] https://lore.kernel.org/all/20250216225530.306980-1-ebiggers@xxxxxxxxxx/

Signed-off-by: Ignacio Encinas <ignacio@xxxxxxxxxxxx>
---
Changes in v2:
- Introduce first patch factoring out the default implementation into
  asm-generic

Patch 2:
- Remove blank line to make checkpatch happy 
- Instead of duplicating the default implementation for swap macros,
  leverage patch 1 and add an include to asm-generic/swab.h

- Link to v1: https://lore.kernel.org/r/20250310-riscv-swab-v1-1-34652ef1ee96@xxxxxxxxxxxx

---
Ignacio Encinas (2):
      include/uapi/linux/swab.h: move default implementation for swab macros into asm-generic
      riscv: introduce asm/swab.h

 arch/riscv/include/asm/swab.h   | 48 +++++++++++++++++++++++++++++++++++++++++
 include/uapi/asm-generic/swab.h | 32 +++++++++++++++++++++++++++
 include/uapi/linux/swab.h       | 33 +---------------------------
 3 files changed, 81 insertions(+), 32 deletions(-)
---
base-commit: a7f2e10ecd8f18b83951b0bab47ddaf48f93bf47
change-id: 20250307-riscv-swab-b81b94a9ac1b

Best regards,
-- 
Ignacio Encinas <ignacio@xxxxxxxxxxxx>





[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux