Message ID | 1589818051-20549-11-git-send-email-pmorel@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: Testing the Channel Subsystem I/O | expand |
On 5/18/20 6:07 PM, Pierre Morel wrote: > Allow the program to wait for an interrupt. > > The interrupt handler is in charge to remove the WAIT bit > when it finished handling the interrupt. > > Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.ibm.com> > --- > lib/s390x/asm/arch_def.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h > index 54ffd0b..f200e28 100644 > --- a/lib/s390x/asm/arch_def.h > +++ b/lib/s390x/asm/arch_def.h > @@ -10,9 +10,11 @@ > #ifndef _ASM_S390X_ARCH_DEF_H_ > #define _ASM_S390X_ARCH_DEF_H_ > > +#define PSW_MASK_IO 0x0200000000000000UL > #define PSW_MASK_EXT 0x0100000000000000UL > #define PSW_MASK_DAT 0x0400000000000000UL > #define PSW_MASK_SHORT_PSW 0x0008000000000000UL > +#define PSW_MASK_WAIT 0x0002000000000000UL > #define PSW_MASK_PSTATE 0x0001000000000000UL > #define PSW_MASK_BA 0x0000000080000000UL > #define PSW_MASK_EA 0x0000000100000000UL > @@ -253,6 +255,18 @@ static inline void load_psw_mask(uint64_t mask) > : "+r" (tmp) : "a" (&psw) : "memory", "cc" ); > } > > +static inline void wait_for_interrupt(uint64_t irq_mask) > +{ > + uint64_t psw_mask = extract_psw_mask(); > + > + load_psw_mask(psw_mask | irq_mask | PSW_MASK_WAIT); > + /* > + * After being woken and having processed the interrupt, let's restore > + * the PSW mask. > + */ > + load_psw_mask(psw_mask); > +} > + > static inline void enter_pstate(void) > { > uint64_t mask; >
On 2020-05-26 12:42, Janosch Frank wrote: > On 5/18/20 6:07 PM, Pierre Morel wrote: >> Allow the program to wait for an interrupt. >> >> The interrupt handler is in charge to remove the WAIT bit >> when it finished handling the interrupt. >> >> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> > > Reviewed-by: Janosch Frank <frankja@linux.ibm.com> > Thanks, Pierre
On Mon, 18 May 2020 18:07:29 +0200 Pierre Morel <pmorel@linux.ibm.com> wrote: > Allow the program to wait for an interrupt. > > The interrupt handler is in charge to remove the WAIT bit > when it finished handling the interrupt. > > Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> > --- > lib/s390x/asm/arch_def.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) Reviewed-by: Cornelia Huck <cohuck@redhat.com>
On 2020-05-27 11:45, Cornelia Huck wrote: > On Mon, 18 May 2020 18:07:29 +0200 > Pierre Morel <pmorel@linux.ibm.com> wrote: > >> Allow the program to wait for an interrupt. >> >> The interrupt handler is in charge to remove the WAIT bit >> when it finished handling the interrupt. >> >> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> >> --- >> lib/s390x/asm/arch_def.h | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) > > Reviewed-by: Cornelia Huck <cohuck@redhat.com> > Thanks, Pierre
diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 54ffd0b..f200e28 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -10,9 +10,11 @@ #ifndef _ASM_S390X_ARCH_DEF_H_ #define _ASM_S390X_ARCH_DEF_H_ +#define PSW_MASK_IO 0x0200000000000000UL #define PSW_MASK_EXT 0x0100000000000000UL #define PSW_MASK_DAT 0x0400000000000000UL #define PSW_MASK_SHORT_PSW 0x0008000000000000UL +#define PSW_MASK_WAIT 0x0002000000000000UL #define PSW_MASK_PSTATE 0x0001000000000000UL #define PSW_MASK_BA 0x0000000080000000UL #define PSW_MASK_EA 0x0000000100000000UL @@ -253,6 +255,18 @@ static inline void load_psw_mask(uint64_t mask) : "+r" (tmp) : "a" (&psw) : "memory", "cc" ); } +static inline void wait_for_interrupt(uint64_t irq_mask) +{ + uint64_t psw_mask = extract_psw_mask(); + + load_psw_mask(psw_mask | irq_mask | PSW_MASK_WAIT); + /* + * After being woken and having processed the interrupt, let's restore + * the PSW mask. + */ + load_psw_mask(psw_mask); +} + static inline void enter_pstate(void) { uint64_t mask;
Allow the program to wait for an interrupt. The interrupt handler is in charge to remove the WAIT bit when it finished handling the interrupt. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> --- lib/s390x/asm/arch_def.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)