diff mbox series

[kvm-unit-tests,GIT,PULL,27/28] s390x: uv-guest: add share bit test

Message ID 20220512093523.36132-28-imbrenda@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series storage keys, attestation, migration tests | expand

Commit Message

Claudio Imbrenda May 12, 2022, 9:35 a.m. UTC
From: Steffen Eiden <seiden@linux.ibm.com>

The UV facility bits shared/unshared must both be set or none.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/uv-guest.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index fd2cfef1..152ad807 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -157,6 +157,16 @@  static void test_invalid(void)
 	report_prefix_pop();
 }
 
+static void test_share_bits(void)
+{
+	bool unshare = uv_query_test_call(BIT_UVC_CMD_REMOVE_SHARED_ACCESS);
+	bool share = uv_query_test_call(BIT_UVC_CMD_SET_SHARED_ACCESS);
+
+	report_prefix_push("query");
+	report(!(share ^ unshare), "share bits are identical");
+	report_prefix_pop();
+}
+
 int main(void)
 {
 	bool has_uvc = test_facility(158);
@@ -167,6 +177,12 @@  int main(void)
 		goto done;
 	}
 
+	/*
+	 * Needs to be done before the guest-fence,
+	 * as the fence tests if both shared bits are present
+	 */
+	test_share_bits();
+
 	if (!uv_os_is_guest()) {
 		report_skip("Not a protected guest");
 		goto done;