From: Heiko Carstens Date: Fri, 7 Feb 2025 14:49:06 +0000 (+0100) Subject: s390/sysinfo: Move stsi() to header file X-Git-Tag: v6.15-rc1~113^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91d6e44221e871c6a2b6c4a67f52b62b36c441a3;p=thirdparty%2Fkernel%2Flinux.git s390/sysinfo: Move stsi() to header file Move stsi() inline assembly to header file so it is possible to use it also for the decompressor. Reviewed-by: Vasily Gorbik Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h index edca5a751df41..9088c5267f350 100644 --- a/arch/s390/include/asm/sysinfo.h +++ b/arch/s390/include/asm/sysinfo.h @@ -11,8 +11,34 @@ #ifndef __ASM_S390_SYSINFO_H #define __ASM_S390_SYSINFO_H -#include #include +#include +#include + +/* + * 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; diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c index 6c5baff46f91e..d096a154cc403 100644 --- a/arch/s390/kernel/sysinfo.c +++ b/arch/s390/kernel/sysinfo.c @@ -26,32 +26,6 @@ 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)