public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Implement endianness swap macros for RISC-V
@ 2025-03-19 21:09 Ignacio Encinas
  2025-03-19 21:09 ` [PATCH v2 1/2] include/uapi/linux/swab.h: move default implementation for swab macros into asm-generic Ignacio Encinas
  2025-03-19 21:09 ` [PATCH v2 2/2] riscv: introduce asm/swab.h Ignacio Encinas
  0 siblings, 2 replies; 11+ messages in thread
From: Ignacio Encinas @ 2025-03-19 21:09 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Alexandre Ghiti, Arnd Bergmann
  Cc: Eric Biggers, linux-riscv, linux-kernel, linux-kernel-mentees,
	skhan, Zhihang Shao, Björn Töpel, linux-arch,
	Ignacio Encinas

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@kernel.org/

Signed-off-by: Ignacio Encinas <ignacio@iencinas.com>
---
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@iencinas.com

---
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@iencinas.com>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-21 21:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-19 21:09 [PATCH v2 0/2] Implement endianness swap macros for RISC-V Ignacio Encinas
2025-03-19 21:09 ` [PATCH v2 1/2] include/uapi/linux/swab.h: move default implementation for swab macros into asm-generic Ignacio Encinas
2025-03-19 21:12   ` Arnd Bergmann
2025-03-19 21:37     ` Ignacio Encinas Rubio
2025-03-19 21:49       ` Arnd Bergmann
2025-03-20 22:36         ` Ignacio Encinas Rubio
2025-03-21 10:23           ` Arnd Bergmann
2025-03-21 18:38             ` Ignacio Encinas Rubio
2025-03-19 21:09 ` [PATCH v2 2/2] riscv: introduce asm/swab.h Ignacio Encinas
2025-03-21  3:37   ` Eric Biggers
2025-03-21 21:07     ` Ignacio Encinas Rubio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox