s390/cio/ioasm: Convert to use flag output macros

Use flag output macros in inline asm to allow for better code generation if
the compiler has support for the flag output constraint.

Reviewed-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
Heiko Carstens 2024-11-07 16:11:53 +01:00
parent f62ad9073a
commit e200565d43

View File

@ -8,6 +8,7 @@
#include <asm/asm-extable.h> #include <asm/asm-extable.h>
#include <asm/chpid.h> #include <asm/chpid.h>
#include <asm/schid.h> #include <asm/schid.h>
#include <asm/asm.h>
#include <asm/crw.h> #include <asm/crw.h>
#include "ioasm.h" #include "ioasm.h"
@ -18,19 +19,20 @@
static inline int __stsch(struct subchannel_id schid, struct schib *addr) static inline int __stsch(struct subchannel_id schid, struct schib *addr)
{ {
unsigned long r1 = *(unsigned int *)&schid; unsigned long r1 = *(unsigned int *)&schid;
int ccode = -EIO; int ccode, exception;
exception = 1;
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" stsch %[addr]\n" " stsch %[addr]\n"
"0: ipm %[cc]\n" "0: lhi %[exc],0\n"
" srl %[cc],28\n"
"1:\n" "1:\n"
CC_IPM(cc)
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
: [cc] "+&d" (ccode), [addr] "=Q" (*addr) : CC_OUT(cc, ccode), [addr] "=Q" (*addr), [exc] "+d" (exception)
: [r1] "d" (r1) : [r1] "d" (r1)
: "cc", "1"); : CC_CLOBBER_LIST("1"));
return ccode; return exception ? -EIO : CC_TRANSFORM(ccode);
} }
int stsch(struct subchannel_id schid, struct schib *addr) int stsch(struct subchannel_id schid, struct schib *addr)
@ -47,19 +49,20 @@ EXPORT_SYMBOL(stsch);
static inline int __msch(struct subchannel_id schid, struct schib *addr) static inline int __msch(struct subchannel_id schid, struct schib *addr)
{ {
unsigned long r1 = *(unsigned int *)&schid; unsigned long r1 = *(unsigned int *)&schid;
int ccode = -EIO; int ccode, exception;
exception = 1;
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" msch %[addr]\n" " msch %[addr]\n"
"0: ipm %[cc]\n" "0: lhi %[exc],0\n"
" srl %[cc],28\n"
"1:\n" "1:\n"
CC_IPM(cc)
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
: [cc] "+&d" (ccode) : CC_OUT(cc, ccode), [exc] "+d" (exception)
: [r1] "d" (r1), [addr] "Q" (*addr) : [r1] "d" (r1), [addr] "Q" (*addr)
: "cc", "1"); : CC_CLOBBER_LIST("1"));
return ccode; return exception ? -EIO : CC_TRANSFORM(ccode);
} }
int msch(struct subchannel_id schid, struct schib *addr) int msch(struct subchannel_id schid, struct schib *addr)
@ -80,12 +83,11 @@ static inline int __tsch(struct subchannel_id schid, struct irb *addr)
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" tsch %[addr]\n" " tsch %[addr]\n"
" ipm %[cc]\n" CC_IPM(cc)
" srl %[cc],28" : CC_OUT(cc, ccode), [addr] "=Q" (*addr)
: [cc] "=&d" (ccode), [addr] "=Q" (*addr)
: [r1] "d" (r1) : [r1] "d" (r1)
: "cc", "1"); : CC_CLOBBER_LIST("1"));
return ccode; return CC_TRANSFORM(ccode);
} }
int tsch(struct subchannel_id schid, struct irb *addr) int tsch(struct subchannel_id schid, struct irb *addr)
@ -101,19 +103,20 @@ int tsch(struct subchannel_id schid, struct irb *addr)
static inline int __ssch(struct subchannel_id schid, union orb *addr) static inline int __ssch(struct subchannel_id schid, union orb *addr)
{ {
unsigned long r1 = *(unsigned int *)&schid; unsigned long r1 = *(unsigned int *)&schid;
int ccode = -EIO; int ccode, exception;
exception = 1;
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" ssch %[addr]\n" " ssch %[addr]\n"
"0: ipm %[cc]\n" "0: lhi %[exc],0\n"
" srl %[cc],28\n"
"1:\n" "1:\n"
CC_IPM(cc)
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
: [cc] "+&d" (ccode) : CC_OUT(cc, ccode), [exc] "+d" (exception)
: [r1] "d" (r1), [addr] "Q" (*addr) : [r1] "d" (r1), [addr] "Q" (*addr)
: "cc", "memory", "1"); : CC_CLOBBER_LIST("memory", "1"));
return ccode; return CC_TRANSFORM(ccode);
} }
int ssch(struct subchannel_id schid, union orb *addr) int ssch(struct subchannel_id schid, union orb *addr)
@ -135,12 +138,11 @@ static inline int __csch(struct subchannel_id schid)
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" csch\n" " csch\n"
" ipm %[cc]\n" CC_IPM(cc)
" srl %[cc],28\n" : CC_OUT(cc, ccode)
: [cc] "=&d" (ccode)
: [r1] "d" (r1) : [r1] "d" (r1)
: "cc", "1"); : CC_CLOBBER_LIST("1"));
return ccode; return CC_TRANSFORM(ccode);
} }
int csch(struct subchannel_id schid) int csch(struct subchannel_id schid)
@ -160,11 +162,11 @@ int tpi(struct tpi_info *addr)
asm volatile( asm volatile(
" tpi %[addr]\n" " tpi %[addr]\n"
" ipm %[cc]\n" CC_IPM(cc)
" srl %[cc],28" : CC_OUT(cc, ccode), [addr] "=Q" (*addr)
: [cc] "=&d" (ccode), [addr] "=Q" (*addr)
: :
: "cc"); : CC_CLOBBER);
ccode = CC_TRANSFORM(ccode);
trace_s390_cio_tpi(addr, ccode); trace_s390_cio_tpi(addr, ccode);
return ccode; return ccode;
@ -173,17 +175,19 @@ int tpi(struct tpi_info *addr)
int chsc(void *chsc_area) int chsc(void *chsc_area)
{ {
typedef struct { char _[4096]; } addr_type; typedef struct { char _[4096]; } addr_type;
int cc = -EIO; int cc, exception;
exception = 1;
asm volatile( asm volatile(
" .insn rre,0xb25f0000,%[chsc_area],0\n" " .insn rre,0xb25f0000,%[chsc_area],0\n"
"0: ipm %[cc]\n" "0: lhi %[exc],0\n"
" srl %[cc],28\n"
"1:\n" "1:\n"
CC_IPM(cc)
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
: [cc] "+&d" (cc), "+m" (*(addr_type *)chsc_area) : CC_OUT(cc, cc), "+m" (*(addr_type *)chsc_area), [exc] "+d" (exception)
: [chsc_area] "d" (chsc_area) : [chsc_area] "d" (chsc_area)
: "cc"); : CC_CLOBBER);
cc = exception ? -EIO : CC_TRANSFORM(cc);
trace_s390_cio_chsc(chsc_area, cc); trace_s390_cio_chsc(chsc_area, cc);
return cc; return cc;
@ -198,12 +202,11 @@ static inline int __rsch(struct subchannel_id schid)
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" rsch\n" " rsch\n"
" ipm %[cc]\n" CC_IPM(cc)
" srl %[cc],28\n" : CC_OUT(cc, ccode)
: [cc] "=&d" (ccode)
: [r1] "d" (r1) : [r1] "d" (r1)
: "cc", "memory", "1"); : CC_CLOBBER_LIST("memory", "1"));
return ccode; return CC_TRANSFORM(ccode);
} }
int rsch(struct subchannel_id schid) int rsch(struct subchannel_id schid)
@ -224,12 +227,11 @@ static inline int __hsch(struct subchannel_id schid)
asm volatile( asm volatile(
" lgr 1,%[r1]\n" " lgr 1,%[r1]\n"
" hsch\n" " hsch\n"
" ipm %[cc]\n" CC_IPM(cc)
" srl %[cc],28\n" : CC_OUT(cc, ccode)
: [cc] "=&d" (ccode)
: [r1] "d" (r1) : [r1] "d" (r1)
: "cc", "1"); : CC_CLOBBER_LIST("1"));
return ccode; return CC_TRANSFORM(ccode);
} }
int hsch(struct subchannel_id schid) int hsch(struct subchannel_id schid)
@ -256,7 +258,7 @@ static inline int __xsch(struct subchannel_id schid)
: [cc] "=&d" (ccode) : [cc] "=&d" (ccode)
: [r1] "d" (r1) : [r1] "d" (r1)
: "cc", "1"); : "cc", "1");
return ccode; return CC_TRANSFORM(ccode);
} }
int xsch(struct subchannel_id schid) int xsch(struct subchannel_id schid)
@ -275,12 +277,11 @@ static inline int __stcrw(struct crw *crw)
asm volatile( asm volatile(
" stcrw %[crw]\n" " stcrw %[crw]\n"
" ipm %[cc]\n" CC_IPM(cc)
" srl %[cc],28\n" : CC_OUT(cc, ccode), [crw] "=Q" (*crw)
: [cc] "=&d" (ccode), [crw] "=Q" (*crw)
: :
: "cc"); : CC_CLOBBER);
return ccode; return CC_TRANSFORM(ccode);
} }
static inline int _stcrw(struct crw *crw) static inline int _stcrw(struct crw *crw)