diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2024-02-03 11:45:21 +0100 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2024-02-16 14:30:17 +0100 |
commit | 3a74f44de2c901e1536d227d29257cae1a6ed18f (patch) | |
tree | 3ddf7dc168688604eca4d9dfa146fca65f7bb9d2 /arch/s390/include/asm/checksum.h | |
parent | s390/checksum: call instrument_read() instead of kasan_check_read() (diff) | |
download | linux-3a74f44de2c901e1536d227d29257cae1a6ed18f.tar.xz linux-3a74f44de2c901e1536d227d29257cae1a6ed18f.zip |
s390/checksum: provide and use cksm() inline assembly
Convert those callers of csum_partial() to use the cksm instruction,
which are either very early or in critical paths, like panic/dump, so
they don't have to rely on a working kernel infrastructure, which will
be introduced with a subsequent patch.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/checksum.h')
-rw-r--r-- | arch/s390/include/asm/checksum.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h index fcef9ae433a7..414264b3ed6c 100644 --- a/arch/s390/include/asm/checksum.h +++ b/arch/s390/include/asm/checksum.h @@ -15,6 +15,21 @@ #include <linux/instrumented.h> #include <linux/in6.h> +static inline __wsum cksm(const void *buff, int len, __wsum sum) +{ + union register_pair rp = { + .even = (unsigned long)buff, + .odd = (unsigned long)len, + }; + + instrument_read(buff, len); + asm volatile("\n" + "0: cksm %[sum],%[rp]\n" + " jo 0b\n" + : [sum] "+&d" (sum), [rp] "+&d" (rp.pair) : : "cc", "memory"); + return sum; +} + /* * Computes the checksum of a memory block at buff, length len, * and adds in "sum" (32-bit). @@ -29,17 +44,7 @@ */ static inline __wsum csum_partial(const void *buff, int len, __wsum sum) { - union register_pair rp = { - .even = (unsigned long) buff, - .odd = (unsigned long) len, - }; - - instrument_read(buff, len); - asm volatile( - "0: cksm %[sum],%[rp]\n" - " jo 0b\n" - : [sum] "+&d" (sum), [rp] "+&d" (rp.pair) : : "cc", "memory"); - return sum; + return cksm(buff, len, sum); } /* |