]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/sysinfo: Move stsi() to header file
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 7 Feb 2025 14:49:06 +0000 (15:49 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 4 Mar 2025 16:18:07 +0000 (17:18 +0100)
Move stsi() inline assembly to header file so it is possible to use it
also for the decompressor.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/sysinfo.h
arch/s390/kernel/sysinfo.c

index edca5a751df412c6702fdf377b716dfe3e853ed2..9088c5267f3507d51e1bad98825b42e341ffe018 100644 (file)
 #ifndef __ASM_S390_SYSINFO_H
 #define __ASM_S390_SYSINFO_H
 
-#include <asm/bitsperlong.h>
 #include <linux/uuid.h>
+#include <asm/bitsperlong.h>
+#include <asm/asm.h>
+
+/*
+ * stsi - store system information
+ *
+ * Returns the current configuration level if function code 0 was specified.
+ * Otherwise returns 0 on success or a negative value on error.
+ */
+static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
+{
+       int r0 = (fc << 28) | sel1;
+       int cc;
+
+       asm volatile(
+               "       lr      %%r0,%[r0]\n"
+               "       lr      %%r1,%[r1]\n"
+               "       stsi    %[sysinfo]\n"
+               "       lr      %[r0],%%r0\n"
+               CC_IPM(cc)
+               : CC_OUT(cc, cc), [r0] "+d" (r0), [sysinfo] "=Q" (*(char *)sysinfo)
+               : [r1] "d" (sel2)
+               : CC_CLOBBER_LIST("0", "1", "memory"));
+       if (cc == 3)
+               return -EOPNOTSUPP;
+       return fc ? 0 : (unsigned int)r0 >> 28;
+}
 
 struct sysinfo_1_1_1 {
        unsigned char p:1;
index 6c5baff46f91e64b7cba034686b91226fa288ff2..d096a154cc4037a0d828a6d7af98d38712238207 100644 (file)
 
 int topology_max_mnest;
 
-/*
- * stsi - store system information
- *
- * Returns the current configuration level if function code 0 was specified.
- * Otherwise returns 0 on success or a negative value on error.
- */
-int stsi(void *sysinfo, int fc, int sel1, int sel2)
-{
-       int r0 = (fc << 28) | sel1;
-       int cc;
-
-       asm volatile(
-               "       lr      %%r0,%[r0]\n"
-               "       lr      %%r1,%[r1]\n"
-               "       stsi    %[sysinfo]\n"
-               "       lr      %[r0],%%r0\n"
-               CC_IPM(cc)
-               : CC_OUT(cc, cc), [r0] "+d" (r0), [sysinfo] "=Q" (*(char *)sysinfo)
-               : [r1] "d" (sel2)
-               : CC_CLOBBER_LIST("0", "1", "memory"));
-       if (cc == 3)
-               return -EOPNOTSUPP;
-       return fc ? 0 : (unsigned int)r0 >> 28;
-}
-EXPORT_SYMBOL(stsi);
-
 #ifdef CONFIG_PROC_FS
 
 static bool convert_ext_name(unsigned char encoding, char *name, size_t len)