summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2024-02-03 13:45:21 +0300
committerHeiko Carstens <hca@linux.ibm.com>2024-02-16 16:30:17 +0300
commit3a74f44de2c901e1536d227d29257cae1a6ed18f (patch)
tree3ddf7dc168688604eca4d9dfa146fca65f7bb9d2 /arch/s390/include/asm
parent4ce69fcf17d067112f754414aa563e0cd74cc49d (diff)
downloadlinux-3a74f44de2c901e1536d227d29257cae1a6ed18f.tar.xz
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')
-rw-r--r--arch/s390/include/asm/checksum.h27
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);
}
/*