linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Implement endianess swap macros for RISC-V
@ 2025-04-03 20:34 Ignacio Encinas
  2025-04-03 20:34 ` [PATCH v3 1/2] include/uapi/linux/swab.h: move default implementation for swab macros into asm-generic Ignacio Encinas
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Ignacio Encinas @ 2025-04-03 20:34 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. There is one
available in include/uapi/linux/swab.h but that header can't be included
from arch/riscv/include/asm/swab.h. Therefore, the first patch in this
series moves the default implementation into asm-generic.

Tested with crc_kunit as pointed out here [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 v3:

PATCH 2:
  Use if(riscv_has_extension_likely) instead of asm goto (Eric). It 
  looks like both versions generate the same assembly. Perhaps we should 
  do the same change in other places such as arch/riscv/include/asm/bitops.h

- Link to v2: https://lore.kernel.org/r/20250319-riscv-swab-v2-0-d53b6d6ab915@iencinas.com

Arnd, I tried your suggestion but couldn't make it work. Let me know if
I missed something in my response.

Changes in v2:
- Introduce first patch factoring out the default implementation into
  asm-generic
- Remove blank line to make checkpatch happy
- 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   | 43 +++++++++++++++++++++++++++++++++++++++++
 include/uapi/asm-generic/swab.h | 32 ++++++++++++++++++++++++++++++
 include/uapi/linux/swab.h       | 33 +------------------------------
 3 files changed, 76 insertions(+), 32 deletions(-)
---
base-commit: a7f2e10ecd8f18b83951b0bab47ddaf48f93bf47
change-id: 20250307-riscv-swab-b81b94a9ac1b

Best regards,
-- 
Ignacio Encinas <ignacio@iencinas.com>


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

end of thread, other threads:[~2025-04-24 17:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 20:34 [PATCH v3 0/2] Implement endianess swap macros for RISC-V Ignacio Encinas
2025-04-03 20:34 ` [PATCH v3 1/2] include/uapi/linux/swab.h: move default implementation for swab macros into asm-generic Ignacio Encinas
2025-04-04 15:31   ` kernel test robot
2025-04-03 20:34 ` [PATCH v3 2/2] riscv: introduce asm/swab.h Ignacio Encinas
2025-04-04  5:58   ` Arnd Bergmann
2025-04-04 15:54     ` Ben Dooks
2025-04-04 17:35     ` Ignacio Encinas
2025-04-23 11:08       ` Alexandre Ghiti
2025-04-24 17:27         ` Ignacio Encinas Rubio
2025-04-04 15:47   ` Ben Dooks
2025-04-04 17:53     ` Ignacio Encinas
2025-04-04 19:28     ` Eric Biggers
2025-04-04 15:55   ` Ben Dooks
2025-04-04 18:13     ` Ignacio Encinas
2025-04-04 15:56 ` [PATCH v3 0/2] Implement endianess swap macros for RISC-V Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).