Message ID | 1571741584-17621-5-git-send-email-imbrenda@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: SCLP Unit test | expand |
On 22/10/2019 12.53, Claudio Imbrenda wrote: > Add a wrapper for the service call instruction, and use it for SCLP > interactions instead of using inline assembly everywhere. > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > lib/s390x/asm/arch_def.h | 13 +++++++++++++ > lib/s390x/sclp.c | 7 +------ > 2 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h > index 96cca2e..b3caff6 100644 > --- a/lib/s390x/asm/arch_def.h > +++ b/lib/s390x/asm/arch_def.h > @@ -269,4 +269,17 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2) > return cc; > } > > +static inline int servc(uint32_t command, unsigned long sccb) > +{ > + int cc; > + > + asm volatile( > + " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ > + " ipm %0\n" > + " srl %0,28" > + : "=&d" (cc) : "d" (command), "a" (sccb) > + : "cc", "memory"); > + return cc; > +} > + > #endif > diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c > index a57096c..376040e 100644 > --- a/lib/s390x/sclp.c > +++ b/lib/s390x/sclp.c > @@ -116,12 +116,7 @@ int sclp_service_call(unsigned int command, void *sccb) > int cc; > > sclp_setup_int(); > - asm volatile( > - " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ > - " ipm %0\n" > - " srl %0,28" > - : "=&d" (cc) : "d" (command), "a" (__pa(sccb)) > - : "cc", "memory"); > + cc = servc(command, __pa(sccb)); > sclp_wait_busy(); > if (cc == 3) > return -1; > Reviewed-by: Thomas Huth <thuth@redhat.com>
On 22.10.19 12:53, Claudio Imbrenda wrote: > Add a wrapper for the service call instruction, and use it for SCLP > interactions instead of using inline assembly everywhere. The description is weird. "Let's factor out the assembly for the service call instruction, we want to reuse that for actual SCLP service call tests soon." Reviewed-by: David Hildenbrand <david@redhat.com> > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > lib/s390x/asm/arch_def.h | 13 +++++++++++++ > lib/s390x/sclp.c | 7 +------ > 2 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h > index 96cca2e..b3caff6 100644 > --- a/lib/s390x/asm/arch_def.h > +++ b/lib/s390x/asm/arch_def.h > @@ -269,4 +269,17 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2) > return cc; > } > > +static inline int servc(uint32_t command, unsigned long sccb) > +{ > + int cc; > + > + asm volatile( > + " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ > + " ipm %0\n" > + " srl %0,28" > + : "=&d" (cc) : "d" (command), "a" (sccb) > + : "cc", "memory"); > + return cc; > +} > + > #endif > diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c > index a57096c..376040e 100644 > --- a/lib/s390x/sclp.c > +++ b/lib/s390x/sclp.c > @@ -116,12 +116,7 @@ int sclp_service_call(unsigned int command, void *sccb) > int cc; > > sclp_setup_int(); > - asm volatile( > - " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ > - " ipm %0\n" > - " srl %0,28" > - : "=&d" (cc) : "d" (command), "a" (__pa(sccb)) > - : "cc", "memory"); > + cc = servc(command, __pa(sccb)); > sclp_wait_busy(); > if (cc == 3) > return -1; >
diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 96cca2e..b3caff6 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -269,4 +269,17 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2) return cc; } +static inline int servc(uint32_t command, unsigned long sccb) +{ + int cc; + + asm volatile( + " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ + " ipm %0\n" + " srl %0,28" + : "=&d" (cc) : "d" (command), "a" (sccb) + : "cc", "memory"); + return cc; +} + #endif diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index a57096c..376040e 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -116,12 +116,7 @@ int sclp_service_call(unsigned int command, void *sccb) int cc; sclp_setup_int(); - asm volatile( - " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ - " ipm %0\n" - " srl %0,28" - : "=&d" (cc) : "d" (command), "a" (__pa(sccb)) - : "cc", "memory"); + cc = servc(command, __pa(sccb)); sclp_wait_busy(); if (cc == 3) return -1;
Add a wrapper for the service call instruction, and use it for SCLP interactions instead of using inline assembly everywhere. Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> --- lib/s390x/asm/arch_def.h | 13 +++++++++++++ lib/s390x/sclp.c | 7 +------ 2 files changed, 14 insertions(+), 6 deletions(-)