Message ID | 20230619083329.22680-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-06-19 10:33:22) > Rather than asserting, we can return a value that's designated as a > programming only value to indicate that there has been no validity. > > The SIE instruction will never write 0xffff as a validity code so > let's just use that constant. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> That's a good solution. Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c index 9241b4b4..b44febde 100644 --- a/lib/s390x/sie.c +++ b/lib/s390x/sie.c @@ -23,7 +23,13 @@ void sie_expect_validity(struct vm *vm) uint16_t sie_get_validity(struct vm *vm) { - assert(vm->sblk->icptcode == ICPT_VALIDITY); + /* + * 0xffff will never be returned by SIE, so we can indicate a + * missing validity via this value. + */ + if (vm->sblk->icptcode != ICPT_VALIDITY) + return 0xffff; + return vm->sblk->ipb >> 16; }
Rather than asserting, we can return a value that's designated as a programming only value to indicate that there has been no validity. The SIE instruction will never write 0xffff as a validity code so let's just use that constant. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> --- lib/s390x/sie.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)