diff mbox series

[03/22] lib: s390x: sie: Fix sie_get_validity() no validity handling

Message ID 20230711141607.40742-4-nrb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series [01/22] lib: s390x: mmu: fix conflicting types for get_dat_entry | expand

Commit Message

Nico Boehr July 11, 2023, 2:15 p.m. UTC
From: Janosch Frank <frankja@linux.ibm.com>

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>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Link: https://lore.kernel.org/r/20230619083329.22680-2-frankja@linux.ibm.com
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 lib/s390x/sie.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
index 9241b4b..b44febd 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;
 }