Skip to content

s390/string: Convert various functions to C

Heiko Carstens linux-s390 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 2 repliesIn review
  2. v28 patches 6 repliesSuperseded
  3. v18 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- Add additional patch which adds -ffreestanding compile option to string.o [Sashiko [3]]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9s390/purgatory: Enforce z10 minimum architecture levelarch/s390/purgatory/Makefile+4 -20 replies
2/9s390: Add .noinstr.text to boot and purgatory linker scriptsarch/s390/boot/vmlinux.lds.S arch/s390/purgatory/purgatory.lds.S+2 -00 replies
3/9s390/string: Add -ffreestanding compile option to string.oarch/s390/boot/Makefile arch/s390/lib/Makefile+10 -02 replies
4/9s390/string: Convert memmove() to Carch/s390/lib/mem.S arch/s390/lib/string.c+46 -410 replies
5/9s390/string: Convert memset() to Carch/s390/lib/mem.S arch/s390/lib/string.c+61 -630 replies
6/9s390/string: Convert memcpy() to Carch/s390/lib/mem.S arch/s390/lib/string.c+34 -310 replies
7/9s390/string: Convert memset(16|32|64)() to Carch/s390/boot/Makefile arch/s390/boot/mem.S arch/s390/boot/string.c +4 more+50 -700 replies
8/9s390/memmove: Optimize backward copy casearch/s390/lib/string.c+23 -10 replies
9/9s390/tishift: Convert __ashlti3(), __ashrti3(), __lshrti3() to Carch/s390/include/asm/asm-prototypes.h arch/s390/lib/tishift.S arch/s390/lib/tishift.c +1 more+73 -670 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchJuergen Christ
1/9R-b
2/9R-b
3/9R-b
4/9R-b
5/9R-b
6/9R-b
7/9R-b
8/9R-b
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/9] s390/string: Convert various functions to C

v3:
- Add additional patch which adds -ffreestanding compile option to string.o [Sashiko [3]]

v2:
Address various Shashiko findings [2]:

- Off by one comparison bug, which leads to slow path for memmove()
- Incorrect ifdef around __memset()
- Incorrect commit description for memmove() conversion
- Missing noinstr for tishift functions
- Missing header guard for tishift header file

v1:
While working on something else I stumbled again across the various mem*() helper functions, which were implemented in assembler to avoid recursive calls [1], when using the compiler's builtin functions.

Convert the functions back to C using inline assemblies, which makes them hopefully a bit more readable and maintainable. Also improve the memmove() implementation by using the mvcrl instruction for the backward copy case.

Thanks,
Heiko

[1] commit 535c611ddd3e ("s390/string: provide asm lib functions for memcpy and memcmp")
[2] https://sashiko.dev/#/patchset/20260607162937.2927356-1-hca%40linux.ibm.com
[3] https://sashiko.dev/#/patchset/20260608053754.571282-1-hca%40linux.ibm.com

Heiko Carstens (9):
s390/purgatory: Enforce z10 minimum architecture level
s390: Add .noinstr.text to boot and purgatory linker scripts s390/string: Add -ffreestanding compile option to string.o s390/string: Convert memmove() to C
s390/string: Convert memset() to C
s390/string: Convert memcpy() to C
s390/string: Convert memset(16|32|64)() to C s390/memmove: Optimize backward copy case s390/tishift: Convert __ashlti3(), __ashrti3(), __lshrti3() to C

 arch/s390/boot/Makefile                |   7 +-
 arch/s390/boot/mem.S                   |   2 -
 arch/s390/boot/string.c                |   6 +-
 arch/s390/boot/vmlinux.lds.S           |   1 +
 arch/s390/include/asm/asm-prototypes.h |   4 -
 arch/s390/lib/Makefile                 |   6 +-
 arch/s390/lib/mem.S                    | 192 ----------------------
 arch/s390/lib/string.c                 | 210 +++++++++++++++++++++++++
 arch/s390/lib/tishift.S                |  63 --------
 arch/s390/lib/tishift.c                |  64 ++++++++
 arch/s390/lib/tishift.h                |   9 ++
 arch/s390/purgatory/Makefile           |   9 +-
 arch/s390/purgatory/purgatory.lds.S    |   1 +
 13 files changed, 301 insertions(+), 273 deletions(-)
 delete mode 100644 arch/s390/boot/mem.S
 delete mode 100644 arch/s390/lib/mem.S
 delete mode 100644 arch/s390/lib/tishift.S
 create mode 100644 arch/s390/lib/tishift.c
 create mode 100644 arch/s390/lib/tishift.h
Signature · 1 line
2.53.0