All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com,
	nrb@linux.ibm.com
Subject: [kvm-unit-tests PATCH v5 1/8] lib: s390x: sie: Fix sie_get_validity() no validity handling
Date: Mon, 19 Jun 2023 08:33:22 +0000	[thread overview]
Message-ID: <20230619083329.22680-2-frankja@linux.ibm.com> (raw)
In-Reply-To: <20230619083329.22680-1-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>
---
 lib/s390x/sie.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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;
 }
 
-- 
2.34.1


  reply	other threads:[~2023-06-19  8:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19  8:33 [kvm-unit-tests PATCH v5 0/8] s390x: Add PV SIE intercepts and ipl tests Janosch Frank
2023-06-19  8:33 ` Janosch Frank [this message]
2023-06-20 15:12   ` [kvm-unit-tests PATCH v5 1/8] lib: s390x: sie: Fix sie_get_validity() no validity handling Nico Boehr
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 2/8] lib: s390x: uv: Introduce UV validity function Janosch Frank
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 3/8] lib: s390x: uv: Add intercept data check library function Janosch Frank
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 4/8] s390x: pv-diags: Drop snippet from snippet names Janosch Frank
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 5/8] lib: s390x: uv: Add pv host requirement check function Janosch Frank
2023-06-20 14:13   ` Janosch Frank
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 6/8] s390x: pv: Add sie entry intercept and validity test Janosch Frank
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 7/8] s390x: pv: Add IPL reset tests Janosch Frank
2023-06-19  8:33 ` [kvm-unit-tests PATCH v5 8/8] s390x: pv-diags: Add the test to unittests.conf Janosch Frank

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230619083329.22680-2-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.