Message ID | 20230324120431.20260-2-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: Add PV SIE intercepts and ipl tests | expand |
Quoting Janosch Frank (2023-03-24 13:04:29) > PV related validities are in the 0x20** range but the last byte might > be implementation specific, so everytime we check for a UV validity we > need to mask the last byte. > > Let's add a function that checks for a UV validity and returns a > boolean. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
On Fri, 24 Mar 2023 12:04:29 +0000 Janosch Frank <frankja@linux.ibm.com> wrote: > PV related validities are in the 0x20** range but the last byte might > be implementation specific, so everytime we check for a UV validity we > need to mask the last byte. > > Let's add a function that checks for a UV validity and returns a > boolean. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > lib/s390x/uv.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h > index 5fe29bda..78b979b7 100644 > --- a/lib/s390x/uv.h > +++ b/lib/s390x/uv.h > @@ -35,4 +35,11 @@ static inline void uv_setup_asces(void) > lctlg(13, asce); > } > > +static inline bool uv_validity_check(struct vm *vm) > +{ > + uint16_t vir = sie_get_validity(vm); > + > + return vm->sblk->icptcode == ICPT_VALIDITY && (vir & 0xff00) == 0x2000; > +} > + > #endif /* UV_H */
diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h index 5fe29bda..78b979b7 100644 --- a/lib/s390x/uv.h +++ b/lib/s390x/uv.h @@ -35,4 +35,11 @@ static inline void uv_setup_asces(void) lctlg(13, asce); } +static inline bool uv_validity_check(struct vm *vm) +{ + uint16_t vir = sie_get_validity(vm); + + return vm->sblk->icptcode == ICPT_VALIDITY && (vir & 0xff00) == 0x2000; +} + #endif /* UV_H */
PV related validities are in the 0x20** range but the last byte might be implementation specific, so everytime we check for a UV validity we need to mask the last byte. Let's add a function that checks for a UV validity and returns a boolean. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> --- lib/s390x/uv.h | 7 +++++++ 1 file changed, 7 insertions(+)