On Mon, 27 Jun 2022 10:35:11 +0200 Janosch Frank <frankja@xxxxxxxxxxxxx> wrote: > On 6/24/22 16:45, Claudio Imbrenda wrote: > > Add some functions to set and/or clear bits in the PSW. > > This should improve code readability. > > > > Also we introduce PSW_MASK_KEY and re-order the PSW_MASK_* constants so > they are descending in value. will fix the description > > > Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx> > > --- > > lib/s390x/asm/arch_def.h | 58 +++++++++++++++++++++++++++++++++++----- > > lib/s390x/asm/pgtable.h | 2 -- > > lib/s390x/mmu.c | 14 +--------- > > lib/s390x/sclp.c | 7 +---- > > s390x/diag288.c | 6 ++--- > > s390x/selftest.c | 4 +-- > > s390x/skrf.c | 12 +++------ > > s390x/smp.c | 18 +++---------- > > 8 files changed, 63 insertions(+), 58 deletions(-) > > > > diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h > > index 78b257b7..b0052848 100644 > > --- a/lib/s390x/asm/arch_def.h > > +++ b/lib/s390x/asm/arch_def.h > > @@ -46,9 +46,10 @@ struct psw { > > #define AS_SECN 2 > > #define AS_HOME 3 > > > > -#define PSW_MASK_EXT 0x0100000000000000UL > > -#define PSW_MASK_IO 0x0200000000000000UL > > #define PSW_MASK_DAT 0x0400000000000000UL > > +#define PSW_MASK_IO 0x0200000000000000UL > > +#define PSW_MASK_EXT 0x0100000000000000UL > > +#define PSW_MASK_KEY 0x00F0000000000000UL > > #define PSW_MASK_WAIT 0x0002000000000000UL > > #define PSW_MASK_PSTATE 0x0001000000000000UL > > #define PSW_MASK_EA 0x0000000100000000UL > > @@ -313,6 +314,53 @@ static inline void load_psw_mask(uint64_t mask) > > : "+r" (tmp) : "a" (&psw) : "memory", "cc" ); > > } > > > > +/** > > + * psw_mask_set_clear_bits - sets and clears bits from the current PSW mask > > + * @clear: bitmask of bits that will be cleared > > + * @set: bitmask of bits that will be set > > + * > > + * Bits will be cleared first, and then set, so if (@clear & @set != 0) then > > + * the bits in the intersection will be set. > > + */ > > +static inline void psw_mask_set_clear_bits(uint64_t clear, uint64_t set) > > This function isn't used at all, no? not currently, but it's useful to have in the lib