public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: thuth@redhat.com, imbrenda@linux.ibm.com, nrb@linux.ibm.com
Subject: [kvm-unit-tests PATCH v2 1/3] lib: s390x: Introduce UV validity function
Date: Fri, 24 Mar 2023 12:04:29 +0000	[thread overview]
Message-ID: <20230324120431.20260-2-frankja@linux.ibm.com> (raw)
In-Reply-To: <20230324120431.20260-1-frankja@linux.ibm.com>

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(+)

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 */
-- 
2.34.1


  reply	other threads:[~2023-03-24 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 12:04 [kvm-unit-tests PATCH v2 0/3] s390x: Add PV SIE intercepts and ipl tests Janosch Frank
2023-03-24 12:04 ` Janosch Frank [this message]
2023-03-24 12:24   ` [kvm-unit-tests PATCH v2 1/3] lib: s390x: Introduce UV validity function Nico Boehr
2023-03-28 14:44   ` Claudio Imbrenda
2023-03-24 12:04 ` [kvm-unit-tests PATCH v2 2/3] s390x: pv: Test sie entry intercepts and validities Janosch Frank
2023-03-28 15:52   ` Claudio Imbrenda
2023-03-24 12:04 ` [kvm-unit-tests PATCH v2 3/3] s390x: pv: Add IPL reset tests Janosch Frank
2023-03-28 16:37   ` Claudio Imbrenda

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=20230324120431.20260-2-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=nrb@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox