All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests
@ 2022-05-12  9:34 Claudio Imbrenda
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 01/28] s390x: gs: move to new header file Claudio Imbrenda
                   ` (27 more replies)
  0 siblings, 28 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:34 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

Hi Paolo,

please merge the following changes:
* improved host detection
* overall cleanups
* storage key tests
* some migration tests
* attestation UV interface

MERGE:
https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/merge_requests/30

PIPELINE:
https://gitlab.com/imbrenda/kvm-unit-tests/-/pipelines/537301867

PULL:
https://gitlab.com/imbrenda/kvm-unit-tests.git s390x-next-2022-05

Janis Schoetterl-Glausch (3):
  s390x: Give name to return value of tprot()
  s390x: Test effect of storage keys on some instructions
  Disable s390x skey test in GitLab CI

Janosch Frank (10):
  lib: s390x: hardware: Add host_is_qemu() function
  s390x: css: Skip if we're not run by qemu
  s390x: diag308: Only test subcode 2 under QEMU
  s390x: pfmf: Initialize pfmf_r1 union on declaration
  s390x: snippets: asm: Add license and copyright headers
  s390x: pv-diags: Cleanup includes
  s390x: css: Cleanup includes
  s390x: iep: Cleanup includes
  s390x: mvpg: Cleanup includes
  s390x: uv-host: Fix pgm tests

Nico Boehr (9):
  s390x: gs: move to new header file
  s390x: add test for SIGP STORE_ADTL_STATUS order
  s390x: epsw: fix report_pop_prefix() when running under non-QEMU
  s390x: tprot: use lib include for mmu.h
  s390x: smp: make stop stopped cpu look the same as the running case
  lib: s390x: add support for SCLP console read
  s390x: add support for migration tests
  s390x: don't run migration tests under PV
  s390x: add basic migration test

Steffen Eiden (6):
  s390x: uv-host: Add invalid command attestation check
  s390x: lib: Add QUI getter
  s390x: uv-guest: remove duplicated checks
  s390x: uv-guest: Remove double report_prefix_pop
  s390x: uv-guest: add share bit test
  s390x: Add attestation tests

 scripts/s390x/func.bash                    |   2 +-
 s390x/run                                  |   7 +-
 s390x/Makefile                             |   4 +
 lib/s390x/asm/arch_def.h                   |  31 +-
 lib/s390x/asm/uv.h                         |  28 +-
 lib/s390x/asm/vector.h                     |  16 +
 lib/s390x/gs.h                             |  69 ++++
 lib/s390x/hardware.h                       |   5 +
 lib/s390x/sclp.h                           |   8 +
 lib/s390x/uv.h                             |   1 +
 lib/s390x/sclp-console.c                   |  79 +++-
 lib/s390x/sclp.c                           |   6 +-
 lib/s390x/uv.c                             |   8 +
 s390x/snippets/asm/snippet-pv-diag-288.S   |   9 +
 s390x/snippets/asm/snippet-pv-diag-500.S   |   9 +
 s390x/snippets/asm/snippet-pv-diag-yield.S |   9 +
 s390x/adtl-status.c                        | 408 +++++++++++++++++++++
 s390x/css.c                                |  18 +-
 s390x/diag308.c                            |  18 +-
 s390x/epsw.c                               |   4 +-
 s390x/gs.c                                 |  54 +--
 s390x/iep.c                                |   3 +-
 s390x/migration.c                          | 198 ++++++++++
 s390x/mvpg.c                               |   3 -
 s390x/pfmf.c                               |  39 +-
 s390x/pv-attest.c                          | 225 ++++++++++++
 s390x/pv-diags.c                           |  17 +-
 s390x/skey.c                               | 249 +++++++++++++
 s390x/smp.c                                |   5 +-
 s390x/tprot.c                              |  26 +-
 s390x/uv-guest.c                           |  51 ++-
 s390x/uv-host.c                            |   3 +-
 s390x/unittests.cfg                        |  30 ++
 .gitlab-ci.yml                             |   2 +-
 34 files changed, 1483 insertions(+), 161 deletions(-)
 create mode 100644 lib/s390x/asm/vector.h
 create mode 100644 lib/s390x/gs.h
 create mode 100644 s390x/adtl-status.c
 create mode 100644 s390x/migration.c
 create mode 100644 s390x/pv-attest.c

-- 
2.36.1


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 01/28] s390x: gs: move to new header file
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
@ 2022-05-12  9:34 ` Claudio Imbrenda
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order Claudio Imbrenda
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:34 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

Move the guarded-storage related structs and instructions to a new
header file because we will also need them for the SIGP store additional
status tests.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/gs.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 s390x/gs.c     | 54 +--------------------------------------
 2 files changed, 70 insertions(+), 53 deletions(-)
 create mode 100644 lib/s390x/gs.h

diff --git a/lib/s390x/gs.h b/lib/s390x/gs.h
new file mode 100644
index 00000000..9c94e580
--- /dev/null
+++ b/lib/s390x/gs.h
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Guarded storage related definitions
+ *
+ * Copyright 2018 IBM Corp.
+ *
+ * Authors:
+ *    Martin Schwidefsky <schwidefsky@de.ibm.com>
+ *    Janosch Frank <frankja@linux.ibm.com>
+ */
+#include <stdint.h>
+
+#ifndef _S390X_GS_H_
+#define _S390X_GS_H_
+
+struct gs_cb {
+	uint64_t reserved;
+	uint64_t gsd;
+	uint64_t gssm;
+	uint64_t gs_epl_a;
+};
+
+struct gs_epl {
+	uint8_t pad1;
+	union {
+		uint8_t gs_eam;
+		struct {
+			uint8_t		: 6;
+			uint8_t e	: 1;
+			uint8_t b	: 1;
+		};
+	};
+	union {
+		uint8_t gs_eci;
+		struct {
+			uint8_t tx	: 1;
+			uint8_t cx	: 1;
+			uint8_t		: 5;
+			uint8_t in	: 1;
+		};
+	};
+	union {
+		uint8_t gs_eai;
+		struct {
+			uint8_t		: 1;
+			uint8_t t	: 1;
+			uint8_t as	: 2;
+			uint8_t ar	: 4;
+		};
+	};
+	uint32_t pad2;
+	uint64_t gs_eha;
+	uint64_t gs_eia;
+	uint64_t gs_eoa;
+	uint64_t gs_eir;
+	uint64_t gs_era;
+};
+
+static inline void load_gs_cb(struct gs_cb *gs_cb)
+{
+	asm volatile(".insn rxy,0xe3000000004d,0,%0" : : "Q" (*gs_cb));
+}
+
+static inline void store_gs_cb(struct gs_cb *gs_cb)
+{
+	asm volatile(".insn rxy,0xe30000000049,0,%0" : : "Q" (*gs_cb));
+}
+
+#endif
diff --git a/s390x/gs.c b/s390x/gs.c
index 7567bb78..4993eb8f 100644
--- a/s390x/gs.c
+++ b/s390x/gs.c
@@ -13,49 +13,7 @@
 #include <asm/facility.h>
 #include <asm/interrupt.h>
 #include <asm-generic/barrier.h>
-
-struct gs_cb {
-	uint64_t reserved;
-	uint64_t gsd;
-	uint64_t gssm;
-	uint64_t gs_epl_a;
-};
-
-struct gs_epl {
-	uint8_t pad1;
-	union {
-		uint8_t gs_eam;
-		struct {
-			uint8_t		: 6;
-			uint8_t e	: 1;
-			uint8_t b	: 1;
-		};
-	};
-	union {
-		uint8_t gs_eci;
-		struct {
-			uint8_t tx	: 1;
-			uint8_t cx	: 1;
-			uint8_t		: 5;
-			uint8_t in	: 1;
-		};
-	};
-	union {
-		uint8_t gs_eai;
-		struct {
-			uint8_t		: 1;
-			uint8_t t	: 1;
-			uint8_t as	: 2;
-			uint8_t ar	: 4;
-		};
-	};
-	uint32_t pad2;
-	uint64_t gs_eha;
-	uint64_t gs_eia;
-	uint64_t gs_eoa;
-	uint64_t gs_eir;
-	uint64_t gs_era;
-};
+#include <gs.h>
 
 static volatile int guarded = 0;
 static struct gs_cb gs_cb;
@@ -64,16 +22,6 @@ static unsigned long gs_area = 0x2000000;
 
 void gs_handler(struct gs_cb *this_cb);
 
-static inline void load_gs_cb(struct gs_cb *gs_cb)
-{
-	asm volatile(".insn rxy,0xe3000000004d,0,%0" : : "Q" (*gs_cb));
-}
-
-static inline void store_gs_cb(struct gs_cb *gs_cb)
-{
-	asm volatile(".insn rxy,0xe30000000049,0,%0" : : "Q" (*gs_cb));
-}
-
 static inline unsigned long load_guarded(unsigned long *p)
 {
 	unsigned long v;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 01/28] s390x: gs: move to new header file Claudio Imbrenda
@ 2022-05-12  9:34 ` Claudio Imbrenda
  2022-09-20 15:53   ` Thomas Huth
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 03/28] s390x: epsw: fix report_pop_prefix() when running under non-QEMU Claudio Imbrenda
                   ` (25 subsequent siblings)
  27 siblings, 1 reply; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:34 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

Add a test for SIGP STORE_ADDITIONAL_STATUS order.

There are several cases to cover:
- when neither vector nor guarded-storage facility is available, check
  the order is rejected.
- when one of the facilities is there, test the order is rejected and
  adtl_status is not touched when the target CPU is running or when an
  invalid CPU address is specified. Also check the order is rejected
  in case of invalid alignment.
- when the vector facility is there, write some data to the CPU's
  vector registers and check we get the right contents.
- when the guarded-storage facility is there, populate the CPU's
  guarded-storage registers with some data and again check we get the
  right contents.

To make sure we cover all these cases, adjust unittests.cfg to run the
test with both guarded-storage and vector facility off and on. In TCG, we don't
have guarded-storage support, so we just run with vector facility off and on.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/Makefile         |   1 +
 lib/s390x/asm/vector.h |  16 ++
 s390x/adtl-status.c    | 408 +++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg    |  25 +++
 4 files changed, 450 insertions(+)
 create mode 100644 lib/s390x/asm/vector.h
 create mode 100644 s390x/adtl-status.c

diff --git a/s390x/Makefile b/s390x/Makefile
index 8ff84db5..c11f6efb 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -29,6 +29,7 @@ tests += $(TEST_DIR)/mvpg-sie.elf
 tests += $(TEST_DIR)/spec_ex-sie.elf
 tests += $(TEST_DIR)/firq.elf
 tests += $(TEST_DIR)/epsw.elf
+tests += $(TEST_DIR)/adtl-status.elf
 
 pv-tests += $(TEST_DIR)/pv-diags.elf
 
diff --git a/lib/s390x/asm/vector.h b/lib/s390x/asm/vector.h
new file mode 100644
index 00000000..ee48bfa6
--- /dev/null
+++ b/lib/s390x/asm/vector.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Vector facility related defines and functions
+ *
+ * Copyright IBM Corp. 2022
+ *
+ * Authors:
+ *    Nico Boehr <nrb@linux.ibm.com>
+ */
+#ifndef _ASMS390X_VECTOR_H_
+#define _ASMS390X_VECTOR_H_
+
+#define VEC_REGISTER_NUM 32
+#define VEC_REGISTER_SIZE 16
+
+#endif
diff --git a/s390x/adtl-status.c b/s390x/adtl-status.c
new file mode 100644
index 00000000..9fb76319
--- /dev/null
+++ b/s390x/adtl-status.c
@@ -0,0 +1,408 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Tests sigp store additional status order
+ *
+ * Copyright IBM Corp. 2022
+ *
+ * Authors:
+ *    Nico Boehr <nrb@linux.ibm.com>
+ */
+#include <libcflat.h>
+#include <asm/asm-offsets.h>
+#include <asm/interrupt.h>
+#include <asm/facility.h>
+#include <asm-generic/barrier.h>
+#include <asm/sigp.h>
+#include <asm/vector.h>
+
+#include <smp.h>
+#include <gs.h>
+
+static int testflag = 0;
+
+#define INVALID_CPU_ADDRESS -4711
+
+struct mcesa_lc12 {
+	uint8_t vregs[0x200];		      /* 0x000 */
+	uint8_t reserved200[0x400 - 0x200];   /* 0x200 */
+	struct gs_cb gs_cb;                   /* 0x400 */
+	uint8_t reserved420[0x800 - 0x420];   /* 0x420 */
+	uint8_t reserved800[0x1000 - 0x800];  /* 0x800 */
+};
+
+static struct mcesa_lc12 adtl_status __attribute__((aligned(4096)));
+
+static uint8_t expected_vec_contents[VEC_REGISTER_NUM][VEC_REGISTER_SIZE];
+
+static struct gs_cb gs_cb;
+static struct gs_epl gs_epl;
+
+static bool memisset(void *s, int c, size_t n)
+{
+	uint8_t *p = s;
+	size_t i;
+
+	for (i = 0; i < n; i++) {
+		if (p[i] != c)
+			return false;
+	}
+
+	return true;
+}
+
+static void wait_for_flag(void)
+{
+	while (!testflag)
+		mb();
+}
+
+static void set_flag(int val)
+{
+	mb();
+	testflag = val;
+	mb();
+}
+
+static void test_func(void)
+{
+	set_flag(1);
+}
+
+static bool have_adtl_status(void)
+{
+	return test_facility(133) || test_facility(129);
+}
+
+static void test_store_adtl_status(void)
+{
+	uint32_t status = -1;
+	int cc;
+
+	report_prefix_push("store additional status");
+
+	if (!have_adtl_status()) {
+		report_skip("no guarded-storage or vector facility installed");
+		goto out;
+	}
+
+	memset(&adtl_status, 0xff, sizeof(adtl_status));
+
+	report_prefix_push("running");
+	smp_cpu_restart(1);
+
+	cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS,
+		  (unsigned long)&adtl_status, &status);
+
+	report(cc == 1, "CC = 1");
+	report(status == SIGP_STATUS_INCORRECT_STATE, "status = INCORRECT_STATE");
+	report(memisset(&adtl_status, 0xff, sizeof(adtl_status)),
+	       "additional status not touched");
+
+	report_prefix_pop();
+
+	report_prefix_push("invalid CPU address");
+
+	cc = sigp(INVALID_CPU_ADDRESS, SIGP_STORE_ADDITIONAL_STATUS,
+		  (unsigned long)&adtl_status, &status);
+	report(cc == 3, "CC = 3");
+	report(memisset(&adtl_status, 0xff, sizeof(adtl_status)),
+	       "additional status not touched");
+
+	report_prefix_pop();
+
+	report_prefix_push("unaligned");
+	smp_cpu_stop(1);
+
+	cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS,
+		  (unsigned long)&adtl_status + 256, &status);
+	report(cc == 1, "CC = 1");
+	report(status == SIGP_STATUS_INVALID_PARAMETER, "status = INVALID_PARAMETER");
+	report(memisset(&adtl_status, 0xff, sizeof(adtl_status)),
+	       "additional status not touched");
+
+	report_prefix_pop();
+
+out:
+	report_prefix_pop();
+}
+
+static void test_store_adtl_status_unavail(void)
+{
+	uint32_t status = 0;
+	int cc;
+
+	report_prefix_push("store additional status unavailable");
+
+	if (have_adtl_status()) {
+		report_skip("guarded-storage or vector facility installed");
+		goto out;
+	}
+
+	report_prefix_push("not accepted");
+	smp_cpu_stop(1);
+
+	memset(&adtl_status, 0xff, sizeof(adtl_status));
+
+	cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS,
+		  (unsigned long)&adtl_status, &status);
+
+	report(cc == 1, "CC = 1");
+	report(status == SIGP_STATUS_INVALID_ORDER,
+	       "status = INVALID_ORDER");
+	report(memisset(&adtl_status, 0xff, sizeof(adtl_status)),
+	       "additional status not touched");
+
+	report_prefix_pop();
+
+out:
+	report_prefix_pop();
+}
+
+static void restart_write_vector(void)
+{
+	uint8_t *vec_reg;
+	/* vlm handles at most 16 registers at a time */
+	uint8_t *vec_reg_16_31 = &expected_vec_contents[16][0];
+	uint64_t cr0, cr0_mask = ~BIT_ULL(CTL0_VECTOR);
+	int i;
+
+	for (i = 0; i < VEC_REGISTER_NUM; i++) {
+		vec_reg = &expected_vec_contents[i][0];
+		/* i+1 to avoid zero content */
+		memset(vec_reg, i + 1, VEC_REGISTER_SIZE);
+	}
+
+	ctl_set_bit(0, CTL0_VECTOR);
+
+	asm volatile (
+		"	.machine z13\n"
+		/* load vector registers */
+		"	vlm 0,15, %[vec_reg_0_15]\n"
+		"	vlm 16,31, %[vec_reg_16_31]\n"
+		/* turn off vector instructions */
+		"	stctg 0,0, %[cr0]\n"
+		"	ng %[cr0_mask], %[cr0]\n"
+		"	stg %[cr0_mask], %[cr0]\n"
+		"	lctlg 0,0, %[cr0]\n"
+		/* inform CPU 0 we are done by setting testflag to 1 */
+		"	mvhi %[testflag], 1\n"
+		/*
+		 * infinite loop. function epilogue will restore floating point
+		 * registers and hence destroy vector register contents
+		 */
+		"0:	j 0\n"
+		: [cr0_mask] "+&d"(cr0_mask)
+		: [vec_reg_0_15] "Q"(expected_vec_contents),
+		  [vec_reg_16_31] "Q"(*vec_reg_16_31),
+		  [cr0] "Q"(cr0),
+		  [testflag] "T"(testflag)
+		: "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
+		  "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18",
+		  "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27",
+		  "v28", "v29", "v30", "v31", "cc", "memory"
+	);
+}
+
+static void cpu_write_magic_to_vector_regs(uint16_t cpu_idx)
+{
+	struct psw new_psw;
+
+	smp_cpu_stop(cpu_idx);
+
+	new_psw.mask = extract_psw_mask();
+	new_psw.addr = (unsigned long)restart_write_vector;
+
+	set_flag(0);
+
+	smp_cpu_start(cpu_idx, new_psw);
+
+	wait_for_flag();
+}
+
+static int adtl_status_check_unmodified_fields_for_lc(unsigned long lc)
+{
+	assert (!lc || (lc >= 10 && lc <= 12));
+
+	if (lc <= 10 && !memisset(&adtl_status.gs_cb, 0xff, sizeof(adtl_status.gs_cb)))
+		return false;
+
+	if (!memisset(adtl_status.reserved200, 0xff, sizeof(adtl_status.reserved200)))
+		return false;
+
+	if (!memisset(adtl_status.reserved420, 0xff, sizeof(adtl_status.reserved420)))
+		return false;
+
+	if (!memisset(adtl_status.reserved800, 0xff, sizeof(adtl_status.reserved800)))
+		return false;
+
+	return true;
+}
+
+static void __store_adtl_status_vector_lc(unsigned long lc)
+{
+	uint32_t status = -1;
+	struct psw psw;
+	int cc;
+
+	report_prefix_pushf("LC %lu", lc);
+
+	if (!test_facility(133) && lc) {
+		report_skip("not supported, no guarded-storage facility");
+		goto out;
+	}
+
+	cpu_write_magic_to_vector_regs(1);
+	smp_cpu_stop(1);
+
+	memset(&adtl_status, 0xff, sizeof(adtl_status));
+
+	cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS,
+		  (unsigned long)&adtl_status | lc, &status);
+	report(!cc, "CC = 0");
+
+	report(!memcmp(adtl_status.vregs,
+		       expected_vec_contents, sizeof(expected_vec_contents)),
+	       "additional status contents match");
+
+	report(adtl_status_check_unmodified_fields_for_lc(lc),
+	       "no write outside expected fields");
+
+	/*
+	 * To avoid the floating point/vector registers being cleaned up, we
+	 * stopped CPU1 right in the middle of a function. Hence the cleanup of
+	 * the function didn't run yet and the stackpointer is messed up.
+	 * Destroy and re-initalize the CPU to fix that.
+	 */
+	smp_cpu_destroy(1);
+	psw.mask = extract_psw_mask();
+	psw.addr = (unsigned long)test_func;
+	smp_cpu_setup(1, psw);
+
+out:
+	report_prefix_pop();
+}
+
+static void test_store_adtl_status_vector(void)
+{
+	report_prefix_push("store additional status vector");
+
+	if (!test_facility(129)) {
+		report_skip("vector facility not installed");
+		goto out;
+	}
+
+	__store_adtl_status_vector_lc(0);
+	__store_adtl_status_vector_lc(10);
+	__store_adtl_status_vector_lc(11);
+	__store_adtl_status_vector_lc(12);
+
+out:
+	report_prefix_pop();
+}
+
+static void restart_write_gs_regs(void)
+{
+	const unsigned long gs_area = 0x2000000;
+	const unsigned long gsc = 25; /* align = 32 M, section size = 512K */
+
+	ctl_set_bit(2, CTL2_GUARDED_STORAGE);
+
+	gs_cb.gsd = gs_area | gsc;
+	gs_cb.gssm = 0xfeedc0ffe;
+	gs_cb.gs_epl_a = (uint64_t) &gs_epl;
+
+	load_gs_cb(&gs_cb);
+
+	set_flag(1);
+
+	ctl_clear_bit(2, CTL2_GUARDED_STORAGE);
+
+	/*
+	 * Safe to return here. r14 will point to the endless loop in
+	 * smp_cpu_setup_state.
+	 */
+}
+
+static void cpu_write_to_gs_regs(uint16_t cpu_idx)
+{
+	struct psw new_psw;
+
+	smp_cpu_stop(cpu_idx);
+
+	new_psw.mask = extract_psw_mask();
+	new_psw.addr = (unsigned long)restart_write_gs_regs;
+
+	set_flag(0);
+
+	smp_cpu_start(cpu_idx, new_psw);
+
+	wait_for_flag();
+}
+
+static void __store_adtl_status_gs(unsigned long lc)
+{
+	uint32_t status = 0;
+	int cc;
+
+	report_prefix_pushf("LC %lu", lc);
+
+	cpu_write_to_gs_regs(1);
+	smp_cpu_stop(1);
+
+	memset(&adtl_status, 0xff, sizeof(adtl_status));
+
+	cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS,
+		  (unsigned long)&adtl_status | lc, &status);
+	report(!cc, "CC = 0");
+
+	report(!memcmp(&adtl_status.gs_cb, &gs_cb, sizeof(gs_cb)),
+	       "additional status contents match");
+
+	report(adtl_status_check_unmodified_fields_for_lc(lc),
+	       "no write outside expected fields");
+
+	report_prefix_pop();
+}
+
+static void test_store_adtl_status_gs(void)
+{
+	report_prefix_push("store additional status guarded-storage");
+
+	if (!test_facility(133)) {
+		report_skip("guarded-storage facility not installed");
+		goto out;
+	}
+
+	__store_adtl_status_gs(11);
+	__store_adtl_status_gs(12);
+
+out:
+	report_prefix_pop();
+}
+
+int main(void)
+{
+	struct psw psw;
+	report_prefix_push("adtl_status");
+
+	if (smp_query_num_cpus() == 1) {
+		report_skip("need at least 2 cpus for this test");
+		goto done;
+	}
+
+	/* Setting up the cpu to give it a stack and lowcore */
+	psw.mask = extract_psw_mask();
+	psw.addr = (unsigned long)test_func;
+	smp_cpu_setup(1, psw);
+	smp_cpu_stop(1);
+
+	test_store_adtl_status_unavail();
+	test_store_adtl_status_vector();
+	test_store_adtl_status_gs();
+	test_store_adtl_status();
+	smp_cpu_destroy(1);
+
+done:
+	report_prefix_pop();
+	return report_summary();
+}
diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index 743013b2..256c7169 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -146,3 +146,28 @@ extra_params = -device virtio-net-ccw
 
 [tprot]
 file = tprot.elf
+
+[adtl-status-kvm]
+file = adtl-status.elf
+smp = 2
+accel = kvm
+extra_params = -cpu host,gs=on,vx=on
+
+[adtl-status-no-vec-no-gs-kvm]
+file = adtl-status.elf
+smp = 2
+accel = kvm
+extra_params = -cpu host,gs=off,vx=off
+
+[adtl-status-tcg]
+file = adtl-status.elf
+smp = 2
+accel = tcg
+# no guarded-storage support in tcg
+extra_params = -cpu qemu,vx=on
+
+[adtl-status-no-vec-no-gs-tcg]
+file = adtl-status.elf
+smp = 2
+accel = tcg
+extra_params = -cpu qemu,gs=off,vx=off
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 03/28] s390x: epsw: fix report_pop_prefix() when running under non-QEMU
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 01/28] s390x: gs: move to new header file Claudio Imbrenda
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order Claudio Imbrenda
@ 2022-05-12  9:34 ` Claudio Imbrenda
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 04/28] s390x: tprot: use lib include for mmu.h Claudio Imbrenda
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:34 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr, Eric Farman

From: Nico Boehr <nrb@linux.ibm.com>

When we don't run in QEMU, we didn't push a prefix, hence pop won't work. Fix
this by pushing the prefix before the QEMU check.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/epsw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/s390x/epsw.c b/s390x/epsw.c
index 5b73f4b3..d8090d95 100644
--- a/s390x/epsw.c
+++ b/s390x/epsw.c
@@ -97,13 +97,13 @@ static void test_epsw(void)
 
 int main(int argc, char **argv)
 {
+	report_prefix_push("epsw");
+
 	if (!host_is_kvm() && !host_is_tcg()) {
 		report_skip("Not running under QEMU");
 		goto done;
 	}
 
-	report_prefix_push("epsw");
-
 	test_epsw();
 
 done:
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 04/28] s390x: tprot: use lib include for mmu.h
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (2 preceding siblings ...)
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 03/28] s390x: epsw: fix report_pop_prefix() when running under non-QEMU Claudio Imbrenda
@ 2022-05-12  9:34 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 05/28] s390x: smp: make stop stopped cpu look the same as the running case Claudio Imbrenda
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:34 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

mmu.h should come from the library includes

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/tprot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/s390x/tprot.c b/s390x/tprot.c
index 460a0db7..760e7ecd 100644
--- a/s390x/tprot.c
+++ b/s390x/tprot.c
@@ -12,7 +12,7 @@
 #include <bitops.h>
 #include <asm/pgtable.h>
 #include <asm/interrupt.h>
-#include "mmu.h"
+#include <mmu.h>
 #include <vmalloc.h>
 #include <sclp.h>
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 05/28] s390x: smp: make stop stopped cpu look the same as the running case
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (3 preceding siblings ...)
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 04/28] s390x: tprot: use lib include for mmu.h Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 06/28] lib: s390x: hardware: Add host_is_qemu() function Claudio Imbrenda
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

Adjust the stop stopped CPU case such that it looks the same as the stop running
CPU case: use the nowait variant, handle the error code in the same way and make
the report messages look the same.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/smp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/s390x/smp.c b/s390x/smp.c
index 5257852c..de3aba71 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -144,8 +144,9 @@ static void test_stop(void)
 	report(smp_cpu_stopped(1), "cpu stopped");
 
 	report_prefix_push("stop stopped CPU");
-	report(!smp_cpu_stop(1), "STOP succeeds");
-	report(smp_cpu_stopped(1), "CPU is stopped");
+	rc = smp_cpu_stop_nowait(1);
+	report(!rc, "return code");
+	report(smp_cpu_stopped(1), "cpu stopped");
 	report_prefix_pop();
 
 	report_prefix_pop();
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 06/28] lib: s390x: hardware: Add host_is_qemu() function
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (4 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 05/28] s390x: smp: make stop stopped cpu look the same as the running case Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 07/28] s390x: css: Skip if we're not run by qemu Claudio Imbrenda
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Janosch Frank <frankja@linux.ibm.com>

In the future we'll likely need to check if we're hosted on QEMU so
let's make this as easy as possible by providing a dedicated function.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/hardware.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h
index 01eeb261..86fe873c 100644
--- a/lib/s390x/hardware.h
+++ b/lib/s390x/hardware.h
@@ -45,6 +45,11 @@ static inline bool host_is_lpar(void)
 	return detect_host() == HOST_IS_LPAR;
 }
 
+static inline bool host_is_qemu(void)
+{
+	return host_is_tcg() || host_is_kvm();
+}
+
 static inline bool machine_is_z15(void)
 {
 	uint16_t machine = get_machine_id();
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 07/28] s390x: css: Skip if we're not run by qemu
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (5 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 06/28] lib: s390x: hardware: Add host_is_qemu() function Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 08/28] s390x: diag308: Only test subcode 2 under QEMU Claudio Imbrenda
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Janosch Frank <frankja@linux.ibm.com>

There's no guarantee that we even find a device at the address we're
testing for if we're not running under QEMU.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/css.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/s390x/css.c b/s390x/css.c
index a333e55a..13a1509f 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -15,6 +15,7 @@
 #include <interrupt.h>
 #include <asm/arch_def.h>
 #include <alloc_page.h>
+#include <hardware.h>
 
 #include <malloc_io.h>
 #include <css.h>
@@ -642,13 +643,21 @@ int main(int argc, char *argv[])
 	int i;
 
 	report_prefix_push("Channel Subsystem");
+
+	/* There's no guarantee where our devices are without qemu */
+	if (!host_is_qemu()) {
+		report_skip("Not running under QEMU");
+		goto done;
+	}
+
 	enable_io_isc(0x80 >> IO_SCH_ISC);
 	for (i = 0; tests[i].name; i++) {
 		report_prefix_push(tests[i].name);
 		tests[i].func();
 		report_prefix_pop();
 	}
-	report_prefix_pop();
 
+done:
+	report_prefix_pop();
 	return report_summary();
 }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 08/28] s390x: diag308: Only test subcode 2 under QEMU
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (6 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 07/28] s390x: css: Skip if we're not run by qemu Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 09/28] s390x: pfmf: Initialize pfmf_r1 union on declaration Claudio Imbrenda
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Janosch Frank <frankja@linux.ibm.com>

Other hypervisors might implement it and therefore not send a
specification exception.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/diag308.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/s390x/diag308.c b/s390x/diag308.c
index c9d6c499..ea41b455 100644
--- a/s390x/diag308.c
+++ b/s390x/diag308.c
@@ -8,6 +8,7 @@
 #include <libcflat.h>
 #include <asm/asm-offsets.h>
 #include <asm/interrupt.h>
+#include <hardware.h>
 
 /* The diagnose calls should be blocked in problem state */
 static void test_priv(void)
@@ -75,7 +76,7 @@ static void test_subcode6(void)
 /* Unsupported subcodes should generate a specification exception */
 static void test_unsupported_subcode(void)
 {
-	int subcodes[] = { 2, 0x101, 0xffff, 0x10001, -1 };
+	int subcodes[] = { 0x101, 0xffff, 0x10001, -1 };
 	int idx;
 
 	for (idx = 0; idx < ARRAY_SIZE(subcodes); idx++) {
@@ -85,6 +86,21 @@ static void test_unsupported_subcode(void)
 		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 		report_prefix_pop();
 	}
+
+	/*
+	 * Subcode 2 is not available under QEMU but might be on other
+	 * hypervisors so we only check for the specification
+	 * exception on QEMU.
+	 */
+	report_prefix_pushf("0x%04x", 2);
+	if (host_is_qemu()) {
+		expect_pgm_int();
+		asm volatile ("diag %0,%1,0x308" :: "d"(0), "d"(2));
+		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+	} else {
+		report_skip("subcode is supported");
+	}
+	report_prefix_pop();
 }
 
 static struct {
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 09/28] s390x: pfmf: Initialize pfmf_r1 union on declaration
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (7 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 08/28] s390x: diag308: Only test subcode 2 under QEMU Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 10/28] s390x: snippets: asm: Add license and copyright headers Claudio Imbrenda
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

From: Janosch Frank <frankja@linux.ibm.com>

Let's make this test look a bit nicer.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/pfmf.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/s390x/pfmf.c b/s390x/pfmf.c
index aa130529..178abb5a 100644
--- a/s390x/pfmf.c
+++ b/s390x/pfmf.c
@@ -28,7 +28,11 @@ static void test_priv(void)
 
 static void test_4k_key(void)
 {
-	union pfmf_r1 r1;
+	union pfmf_r1 r1 = {
+		.reg.sk = 1,
+		.reg.fsc = PFMF_FSC_4K,
+		.reg.key = 0x30,
+	};
 	union skey skey;
 
 	report_prefix_push("4K");
@@ -36,10 +40,6 @@ static void test_4k_key(void)
 		report_skip("storage key removal facility is active");
 		goto out;
 	}
-	r1.val = 0;
-	r1.reg.sk = 1;
-	r1.reg.fsc = PFMF_FSC_4K;
-	r1.reg.key = 0x30;
 	pfmf(r1.val, pagebuf);
 	skey.val = get_storage_key(pagebuf);
 	skey.val &= SKEY_ACC | SKEY_FP;
@@ -52,18 +52,19 @@ static void test_1m_key(void)
 {
 	int i;
 	bool rp = true;
-	union pfmf_r1 r1;
 	union skey skey;
+	union pfmf_r1 r1 = {
+		.reg.fsc = PFMF_FSC_1M,
+		.reg.key = 0x30,
+		.reg.sk = 1,
+	};
 
 	report_prefix_push("1M");
 	if (test_facility(169)) {
 		report_skip("storage key removal facility is active");
 		goto out;
 	}
-	r1.val = 0;
-	r1.reg.sk = 1;
-	r1.reg.fsc = PFMF_FSC_1M;
-	r1.reg.key = 0x30;
+
 	pfmf(r1.val, pagebuf);
 	for (i = 0; i < 256; i++) {
 		skey.val = get_storage_key(pagebuf + i * PAGE_SIZE);
@@ -80,11 +81,10 @@ out:
 
 static void test_4k_clear(void)
 {
-	union pfmf_r1 r1;
-
-	r1.val = 0;
-	r1.reg.cf = 1;
-	r1.reg.fsc = PFMF_FSC_4K;
+	union pfmf_r1 r1 = {
+		.reg.cf = 1,
+		.reg.fsc = PFMF_FSC_4K,
+	};
 
 	report_prefix_push("4K");
 	memset(pagebuf, 42, PAGE_SIZE);
@@ -97,13 +97,12 @@ static void test_4k_clear(void)
 static void test_1m_clear(void)
 {
 	int i;
-	union pfmf_r1 r1;
+	union pfmf_r1 r1 = {
+		.reg.cf = 1,
+		.reg.fsc = PFMF_FSC_1M,
+	};
 	unsigned long sum = 0;
 
-	r1.val = 0;
-	r1.reg.cf = 1;
-	r1.reg.fsc = PFMF_FSC_1M;
-
 	report_prefix_push("1M");
 	memset(pagebuf, 42, PAGE_SIZE * 256);
 	pfmf(r1.val, pagebuf);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 10/28] s390x: snippets: asm: Add license and copyright headers
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (8 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 09/28] s390x: pfmf: Initialize pfmf_r1 union on declaration Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 11/28] s390x: pv-diags: Cleanup includes Claudio Imbrenda
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

From: Janosch Frank <frankja@linux.ibm.com>

Time for some cleanup of the snippets to make them look like any other
test file.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/snippets/asm/snippet-pv-diag-288.S   | 9 +++++++++
 s390x/snippets/asm/snippet-pv-diag-500.S   | 9 +++++++++
 s390x/snippets/asm/snippet-pv-diag-yield.S | 9 +++++++++
 3 files changed, 27 insertions(+)

diff --git a/s390x/snippets/asm/snippet-pv-diag-288.S b/s390x/snippets/asm/snippet-pv-diag-288.S
index e3e63121..aaee3cd1 100644
--- a/s390x/snippets/asm/snippet-pv-diag-288.S
+++ b/s390x/snippets/asm/snippet-pv-diag-288.S
@@ -1,3 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Diagnose 0x288 snippet used for PV interception testing.
+ *
+ * Copyright (c) 2021 IBM Corp
+ *
+ * Authors:
+ *  Janosch Frank <frankja@linux.ibm.com>
+ */
 #include <asm/asm-offsets.h>
 .section .text
 
diff --git a/s390x/snippets/asm/snippet-pv-diag-500.S b/s390x/snippets/asm/snippet-pv-diag-500.S
index 50c06779..8dd66bd9 100644
--- a/s390x/snippets/asm/snippet-pv-diag-500.S
+++ b/s390x/snippets/asm/snippet-pv-diag-500.S
@@ -1,3 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Diagnose 0x500 snippet used for PV interception tests
+ *
+ * Copyright (c) 2021 IBM Corp
+ *
+ * Authors:
+ *  Janosch Frank <frankja@linux.ibm.com>
+ */
 #include <asm/asm-offsets.h>
 .section .text
 
diff --git a/s390x/snippets/asm/snippet-pv-diag-yield.S b/s390x/snippets/asm/snippet-pv-diag-yield.S
index 5795cf0f..78a5b07a 100644
--- a/s390x/snippets/asm/snippet-pv-diag-yield.S
+++ b/s390x/snippets/asm/snippet-pv-diag-yield.S
@@ -1,3 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Diagnose 0x44 and 0x9c snippet used for PV interception tests
+ *
+ * Copyright (c) 2021 IBM Corp
+ *
+ * Authors:
+ *  Janosch Frank <frankja@linux.ibm.com>
+ */
 .section .text
 
 xgr	%r0, %r0
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 11/28] s390x: pv-diags: Cleanup includes
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (9 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 10/28] s390x: snippets: asm: Add license and copyright headers Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 12/28] s390x: css: " Claudio Imbrenda
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

From: Janosch Frank <frankja@linux.ibm.com>

This file has way too much includes. Time to remove some.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/pv-diags.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/s390x/pv-diags.c b/s390x/pv-diags.c
index 6899b859..9ced68c7 100644
--- a/s390x/pv-diags.c
+++ b/s390x/pv-diags.c
@@ -8,23 +8,10 @@
  *  Janosch Frank <frankja@linux.ibm.com>
  */
 #include <libcflat.h>
-#include <asm/asm-offsets.h>
-#include <asm-generic/barrier.h>
-#include <asm/interrupt.h>
-#include <asm/pgtable.h>
-#include <mmu.h>
-#include <asm/page.h>
-#include <asm/facility.h>
-#include <asm/mem.h>
-#include <asm/sigp.h>
-#include <smp.h>
-#include <alloc_page.h>
-#include <vmalloc.h>
-#include <sclp.h>
 #include <snippet.h>
 #include <sie.h>
-#include <uv.h>
-#include <asm/uv.h>
+#include <sclp.h>
+#include <asm/facility.h>
 
 static struct vm vm;
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 12/28] s390x: css: Cleanup includes
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (10 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 11/28] s390x: pv-diags: Cleanup includes Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 13/28] s390x: iep: " Claudio Imbrenda
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

From: Janosch Frank <frankja@linux.ibm.com>

Most includes were related to allocation but that's done in the io
allocation library so having them in the test doesn't make sense.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/css.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/s390x/css.c b/s390x/css.c
index 13a1509f..fabe5237 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -9,17 +9,14 @@
  */
 
 #include <libcflat.h>
-#include <alloc_phys.h>
-#include <asm/page.h>
-#include <string.h>
 #include <interrupt.h>
-#include <asm/arch_def.h>
-#include <alloc_page.h>
 #include <hardware.h>
 
+#include <asm/arch_def.h>
+#include <asm/page.h>
+
 #include <malloc_io.h>
 #include <css.h>
-#include <asm/barrier.h>
 
 #define DEFAULT_CU_TYPE		0x3832 /* virtio-ccw */
 static unsigned long cu_type = DEFAULT_CU_TYPE;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 13/28] s390x: iep: Cleanup includes
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (11 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 12/28] s390x: css: " Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 14/28] s390x: mvpg: " Claudio Imbrenda
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

From: Janosch Frank <frankja@linux.ibm.com>

We don't use barriers so let's remove the include.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/iep.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/s390x/iep.c b/s390x/iep.c
index 8d5e044b..4b3e09a7 100644
--- a/s390x/iep.c
+++ b/s390x/iep.c
@@ -9,11 +9,10 @@
  */
 #include <libcflat.h>
 #include <vmalloc.h>
+#include <mmu.h>
 #include <asm/facility.h>
 #include <asm/interrupt.h>
-#include <mmu.h>
 #include <asm/pgtable.h>
-#include <asm-generic/barrier.h>
 
 static void test_iep(void)
 {
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 14/28] s390x: mvpg: Cleanup includes
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (12 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 13/28] s390x: iep: " Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 15/28] s390x: uv-host: Fix pgm tests Claudio Imbrenda
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja

From: Janosch Frank <frankja@linux.ibm.com>

Time to remove unneeded includes.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/mvpg.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/s390x/mvpg.c b/s390x/mvpg.c
index 62f0fc5a..04e5218f 100644
--- a/s390x/mvpg.c
+++ b/s390x/mvpg.c
@@ -9,15 +9,12 @@
  */
 #include <libcflat.h>
 #include <asm/asm-offsets.h>
-#include <asm-generic/barrier.h>
 #include <asm/interrupt.h>
 #include <asm/pgtable.h>
 #include <mmu.h>
 #include <asm/page.h>
 #include <asm/facility.h>
 #include <asm/mem.h>
-#include <asm/sigp.h>
-#include <smp.h>
 #include <alloc_page.h>
 #include <bitops.h>
 #include <hardware.h>
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 15/28] s390x: uv-host: Fix pgm tests
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (13 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 14/28] s390x: mvpg: " Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 16/28] lib: s390x: add support for SCLP console read Claudio Imbrenda
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Janosch Frank <frankja@linux.ibm.com>

We don't want to re-enter the UV call on a cc > 1 for this test.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/uv-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index d3018e3c..5ac8a32c 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -76,7 +76,7 @@ static void test_priv(void)
 		uvcb.cmd = cmds[i].cmd;
 		uvcb.len = cmds[i].len;
 		enter_pstate();
-		uv_call(0, (uint64_t)&uvcb);
+		uv_call_once(0, (uint64_t)&uvcb);
 		pgm = clear_pgm_int();
 		report(pgm == PGM_INT_CODE_PRIVILEGED_OPERATION, "%s", cmds[i].name);
 	}
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 16/28] lib: s390x: add support for SCLP console read
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (14 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 15/28] s390x: uv-host: Fix pgm tests Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 17/28] s390x: add support for migration tests Claudio Imbrenda
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

Add a basic implementation for reading from the SCLP ASCII console. The goal of
this is to support migration tests on s390x. To know when the migration has been
finished, we need to listen for a newline on our console.

Hence, this implementation is focused on the SCLP ASCII console of QEMU and
currently won't work under e.g. LPAR.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/Makefile           |  1 +
 lib/s390x/sclp.h         |  8 ++++
 lib/s390x/sclp-console.c | 79 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/s390x/Makefile b/s390x/Makefile
index c11f6efb..f38f442b 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -75,6 +75,7 @@ cflatobjs += lib/alloc_phys.o
 cflatobjs += lib/alloc_page.o
 cflatobjs += lib/vmalloc.o
 cflatobjs += lib/alloc_phys.o
+cflatobjs += lib/getchar.o
 cflatobjs += lib/s390x/io.o
 cflatobjs += lib/s390x/stack.o
 cflatobjs += lib/s390x/sclp.o
diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h
index fead007a..e48a5a3d 100644
--- a/lib/s390x/sclp.h
+++ b/lib/s390x/sclp.h
@@ -313,6 +313,14 @@ typedef struct ReadEventData {
 	uint32_t mask;
 } __attribute__((packed)) ReadEventData;
 
+#define SCLP_EVENT_ASCII_TYPE_DATA_STREAM_FOLLOWS 0
+typedef struct ReadEventDataAsciiConsole {
+	SCCBHeader h;
+	EventBufferHeader ebh;
+	uint8_t type;
+	char data[];
+} __attribute__((packed)) ReadEventDataAsciiConsole;
+
 extern char _sccb[];
 void sclp_setup_int(void);
 void sclp_handle_ext(void);
diff --git a/lib/s390x/sclp-console.c b/lib/s390x/sclp-console.c
index fa36a6a4..19c74e46 100644
--- a/lib/s390x/sclp-console.c
+++ b/lib/s390x/sclp-console.c
@@ -89,6 +89,10 @@ static char lm_buff[120];
 static unsigned char lm_buff_off;
 static struct spinlock lm_buff_lock;
 
+static char read_buf[4096];
+static int read_index = sizeof(read_buf) - 1;
+static int read_buf_length = 0;
+
 static void sclp_print_ascii(const char *str)
 {
 	int len = strlen(str);
@@ -185,7 +189,7 @@ static void sclp_print_lm(const char *str)
  * indicating which messages the control program (we) want(s) to
  * send/receive.
  */
-static void sclp_set_write_mask(void)
+static void sclp_write_event_mask(int receive_mask, int send_mask)
 {
 	WriteEventMask *sccb = (void *)_sccb;
 
@@ -195,18 +199,27 @@ static void sclp_set_write_mask(void)
 	sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
 	sccb->mask_length = sizeof(sccb_mask_t);
 
-	/* For now we don't process sclp input. */
-	sccb->cp_receive_mask = 0;
-	/* We send ASCII and line mode. */
-	sccb->cp_send_mask = SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG;
+	sccb->cp_receive_mask = receive_mask;
+	sccb->cp_send_mask = send_mask;
 
 	sclp_service_call(SCLP_CMD_WRITE_EVENT_MASK, sccb);
 	assert(sccb->h.response_code == SCLP_RC_NORMAL_COMPLETION);
 }
 
+static void sclp_console_enable_read(void)
+{
+	sclp_write_event_mask(SCLP_EVENT_MASK_MSG_ASCII, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG);
+}
+
+static void sclp_console_disable_read(void)
+{
+	sclp_write_event_mask(0, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG);
+}
+
 void sclp_console_setup(void)
 {
-	sclp_set_write_mask();
+	/* We send ASCII and line mode. */
+	sclp_write_event_mask(0, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG);
 }
 
 void sclp_print(const char *str)
@@ -227,3 +240,57 @@ void sclp_print(const char *str)
 	sclp_print_ascii(str);
 	sclp_print_lm(str);
 }
+
+static int console_refill_read_buffer(void)
+{
+	const int max_event_buffer_len = SCCB_SIZE - offsetof(ReadEventDataAsciiConsole, ebh);
+	ReadEventDataAsciiConsole *sccb = (void *)_sccb;
+	const int event_buffer_ascii_recv_header_len = sizeof(sccb->ebh) + sizeof(sccb->type);
+	int ret = -1;
+
+	sclp_console_enable_read();
+
+	sclp_mark_busy();
+	memset(sccb, 0, SCCB_SIZE);
+	sccb->h.length = PAGE_SIZE;
+	sccb->h.function_code = SCLP_UNCONDITIONAL_READ;
+	sccb->h.control_mask[2] = SCLP_CM2_VARIABLE_LENGTH_RESPONSE;
+
+	sclp_service_call(SCLP_CMD_READ_EVENT_DATA, sccb);
+
+	if (sccb->h.response_code == SCLP_RC_NO_EVENT_BUFFERS_STORED ||
+	    sccb->ebh.type != SCLP_EVENT_ASCII_CONSOLE_DATA ||
+	    sccb->type != SCLP_EVENT_ASCII_TYPE_DATA_STREAM_FOLLOWS) {
+		ret = -1;
+		goto out;
+	}
+
+	assert(sccb->ebh.length <= max_event_buffer_len);
+	assert(sccb->ebh.length > event_buffer_ascii_recv_header_len);
+
+	read_buf_length = sccb->ebh.length - event_buffer_ascii_recv_header_len;
+
+	assert(read_buf_length <= sizeof(read_buf));
+	memcpy(read_buf, sccb->data, read_buf_length);
+
+	read_index = 0;
+	ret = 0;
+
+out:
+	sclp_console_disable_read();
+
+	return ret;
+}
+
+int __getchar(void)
+{
+	int ret;
+
+	if (read_index >= read_buf_length) {
+		ret = console_refill_read_buffer();
+		if (ret < 0)
+			return ret;
+	}
+
+	return read_buf[read_index++];
+}
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 17/28] s390x: add support for migration tests
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (15 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 16/28] lib: s390x: add support for SCLP console read Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 18/28] s390x: don't run migration tests under PV Claudio Imbrenda
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

Now that we have SCLP console read support, run our tests with migration_cmd, so
we can get migration support on s390x.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/run | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/s390x/run b/s390x/run
index 064ecd1b..2bcdabba 100755
--- a/s390x/run
+++ b/s390x/run
@@ -25,7 +25,7 @@ M+=",accel=$ACCEL"
 command="$qemu -nodefaults -nographic $M"
 command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
 command+=" -kernel"
-command="$(timeout_cmd) $command"
+command="$(migration_cmd) $(timeout_cmd) $command"
 
 # We return the exit code via stdout, not via the QEMU return code
 run_qemu_status $command "$@"
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 18/28] s390x: don't run migration tests under PV
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (16 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 17/28] s390x: add support for migration tests Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 19/28] s390x: add basic migration test Claudio Imbrenda
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

PV doesn't support migration, so don't run the migration tests there.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 scripts/s390x/func.bash | 2 +-
 s390x/run               | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash
index bf799a56..2a941bbb 100644
--- a/scripts/s390x/func.bash
+++ b/scripts/s390x/func.bash
@@ -21,7 +21,7 @@ function arch_cmd_s390x()
 	"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 
 	# run PV test case
-	if [ "$ACCEL" = 'tcg' ]; then
+	if [ "$ACCEL" = 'tcg' ] || find_word "migration" "$groups"; then
 		return
 	fi
 	kernel=${kernel%.elf}.pv.bin
diff --git a/s390x/run b/s390x/run
index 2bcdabba..24138f68 100755
--- a/s390x/run
+++ b/s390x/run
@@ -20,6 +20,11 @@ if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$ACCEL" = "
 	exit 2
 fi
 
+if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$MIGRATION" = "yes" ]; then
+	echo "Migration isn't supported under Protected Virtualization"
+	exit 2
+fi
+
 M='-machine s390-ccw-virtio'
 M+=",accel=$ACCEL"
 command="$qemu -nodefaults -nographic $M"
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 19/28] s390x: add basic migration test
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (17 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 18/28] s390x: don't run migration tests under PV Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 20/28] s390x: Give name to return value of tprot() Claudio Imbrenda
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Nico Boehr

From: Nico Boehr <nrb@linux.ibm.com>

Add a basic migration test for s390x. This tests the guarded-storage
registers and vector registers are preserved on migration.

Check for the respective facilities. Since it is possible neither
guarded-storage nor vector are there, add an additional report_pass()
such that least one PASS is reported.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/Makefile      |   1 +
 s390x/migration.c   | 198 ++++++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg |   5 ++
 3 files changed, 204 insertions(+)
 create mode 100644 s390x/migration.c

diff --git a/s390x/Makefile b/s390x/Makefile
index f38f442b..5336ed8a 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -30,6 +30,7 @@ tests += $(TEST_DIR)/spec_ex-sie.elf
 tests += $(TEST_DIR)/firq.elf
 tests += $(TEST_DIR)/epsw.elf
 tests += $(TEST_DIR)/adtl-status.elf
+tests += $(TEST_DIR)/migration.elf
 
 pv-tests += $(TEST_DIR)/pv-diags.elf
 
diff --git a/s390x/migration.c b/s390x/migration.c
new file mode 100644
index 00000000..a4529637
--- /dev/null
+++ b/s390x/migration.c
@@ -0,0 +1,198 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Migration Test for s390x
+ *
+ * Copyright IBM Corp. 2022
+ *
+ * Authors:
+ *  Nico Boehr <nrb@linux.ibm.com>
+ */
+#include <libcflat.h>
+#include <asm/arch_def.h>
+#include <asm/vector.h>
+#include <asm/barrier.h>
+#include <asm/facility.h>
+#include <gs.h>
+#include <bitops.h>
+#include <smp.h>
+
+static struct gs_cb gs_cb;
+static struct gs_epl gs_epl;
+
+/* set by CPU1 to signal it has completed */
+static int flag_thread_complete;
+/* set by CPU0 to signal migration has completed */
+static int flag_migration_complete;
+
+static void write_gs_regs(void)
+{
+	const unsigned long gs_area = 0x2000000;
+	const unsigned long gsc = 25; /* align = 32 M, section size = 512K */
+
+	gs_cb.gsd = gs_area | gsc;
+	gs_cb.gssm = 0xfeedc0ffe;
+	gs_cb.gs_epl_a = (uint64_t) &gs_epl;
+
+	load_gs_cb(&gs_cb);
+}
+
+static void check_gs_regs(void)
+{
+	struct gs_cb gs_cb_after_migration;
+
+	store_gs_cb(&gs_cb_after_migration);
+
+	report_prefix_push("guarded-storage registers");
+
+	report(gs_cb_after_migration.gsd == gs_cb.gsd, "gsd matches");
+	report(gs_cb_after_migration.gssm == gs_cb.gssm, "gssm matches");
+	report(gs_cb_after_migration.gs_epl_a == gs_cb.gs_epl_a, "gs_epl_a matches");
+
+	report_prefix_pop();
+}
+
+static bool have_vector_facility(void)
+{
+	return test_facility(129);
+}
+
+static bool have_guarded_storage_facility(void)
+{
+	return test_facility(133);
+}
+
+static void test_func(void)
+{
+	uint8_t expected_vec_contents[VEC_REGISTER_NUM][VEC_REGISTER_SIZE];
+	uint8_t actual_vec_contents[VEC_REGISTER_NUM][VEC_REGISTER_SIZE];
+	uint8_t *vec_reg;
+	int i;
+	int vec_result = 0;
+
+	if (have_guarded_storage_facility()) {
+		ctl_set_bit(2, CTL2_GUARDED_STORAGE);
+
+		write_gs_regs();
+	}
+
+	if (have_vector_facility()) {
+		for (i = 0; i < VEC_REGISTER_NUM; i++) {
+			vec_reg = &expected_vec_contents[i][0];
+			/* i+1 to avoid zero content */
+			memset(vec_reg, i + 1, VEC_REGISTER_SIZE);
+		}
+
+		ctl_set_bit(0, CTL0_VECTOR);
+
+		/*
+		 * It is important loading the vector/floating point registers and
+		 * comparing their contents occurs in the same inline assembly block.
+		 * Otherwise, the compiler is allowed to re-use the registers for
+		 * something else in between.
+		 * For this very reason, this also runs on a second CPU, so all the
+		 * complex console stuff can be done in C on the first CPU and here we
+		 * just need to wait for it to set the flag.
+		 */
+		asm inline(
+			"	.machine z13\n"
+			/* load vector registers: vlm handles at most 16 registers at a time */
+			"	vlm 0,15, 0(%[expected_vec_reg])\n"
+			"	vlm 16,31, 256(%[expected_vec_reg])\n"
+			/* inform CPU0 we are done, it will request migration */
+			"	mvhi %[flag_thread_complete], 1\n"
+			/* wait for migration to finish */
+			"0:	clfhsi %[flag_migration_complete], 1\n"
+			"	jnz 0b\n"
+			/*
+			 * store vector register contents in actual_vec_reg: vstm
+			 * handles at most 16 registers at a time
+			 */
+			"	vstm 0,15, 0(%[actual_vec_reg])\n"
+			"	vstm 16,31, 256(%[actual_vec_reg])\n"
+			/*
+			 * compare the contents in expected_vec_reg with actual_vec_reg:
+			 * clc handles at most 256 bytes at a time
+			 */
+			"	clc 0(256, %[expected_vec_reg]), 0(%[actual_vec_reg])\n"
+			"	jnz 1f\n"
+			"	clc 256(256, %[expected_vec_reg]), 256(%[actual_vec_reg])\n"
+			"	jnz 1f\n"
+			/* success */
+			"	mvhi %[vec_result], 1\n"
+			"1:"
+			:
+			: [expected_vec_reg] "a"(expected_vec_contents),
+			  [actual_vec_reg] "a"(actual_vec_contents),
+			  [flag_thread_complete] "Q"(flag_thread_complete),
+			  [flag_migration_complete] "Q"(flag_migration_complete),
+			  [vec_result] "Q"(vec_result)
+			: "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
+			  "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18",
+			  "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27",
+			  "v28", "v29", "v30", "v31", "cc", "memory"
+		);
+
+		report(vec_result, "vector contents match");
+
+		report(stctg(0) & BIT(CTL0_VECTOR), "ctl0 vector bit set");
+
+		ctl_clear_bit(0, CTL0_VECTOR);
+	} else {
+		flag_thread_complete = 1;
+		while(!flag_migration_complete)
+			mb();
+	}
+
+	report_pass("Migrated");
+
+	if (have_guarded_storage_facility()) {
+		check_gs_regs();
+
+		report(stctg(2) & BIT(CTL2_GUARDED_STORAGE), "ctl2 guarded-storage bit set");
+
+		ctl_clear_bit(2, CTL2_GUARDED_STORAGE);
+	}
+
+	flag_thread_complete = 1;
+}
+
+int main(void)
+{
+	struct psw psw;
+
+	/* don't say migrate here otherwise we will migrate right away */
+	report_prefix_push("migration");
+
+	if (smp_query_num_cpus() == 1) {
+		report_skip("need at least 2 cpus for this test");
+		goto done;
+	}
+
+	/* Second CPU does the actual tests */
+	psw.mask = extract_psw_mask();
+	psw.addr = (unsigned long)test_func;
+	smp_cpu_setup(1, psw);
+
+	/* wait for thread setup */
+	while(!flag_thread_complete)
+		mb();
+	flag_thread_complete = 0;
+
+	/* ask migrate_cmd to migrate (it listens for 'migrate') */
+	puts("Please migrate me, then press return\n");
+
+	/* wait for migration to finish, we will read a newline */
+	(void)getchar();
+
+	flag_migration_complete = 1;
+
+	/* wait for thread to complete assertions */
+	while(!flag_thread_complete)
+		mb();
+
+	smp_cpu_destroy(1);
+
+done:
+	report_prefix_pop();
+	return report_summary();
+}
diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index 256c7169..b456b288 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -171,3 +171,8 @@ file = adtl-status.elf
 smp = 2
 accel = tcg
 extra_params = -cpu qemu,gs=off,vx=off
+
+[migration]
+file = migration.elf
+groups = migration
+smp = 2
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 20/28] s390x: Give name to return value of tprot()
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (18 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 19/28] s390x: add basic migration test Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 21/28] s390x: Test effect of storage keys on some instructions Claudio Imbrenda
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Janis Schoetterl-Glausch

From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>

Improve readability by making the return value of tprot() an enum.

No functional change intended.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/asm/arch_def.h | 11 +++++++++--
 lib/s390x/sclp.c         |  6 +++---
 s390x/tprot.c            | 24 ++++++++++++------------
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index bab3c374..46c370e6 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -228,7 +228,14 @@ static inline uint64_t stidp(void)
 	return cpuid;
 }
 
-static inline int tprot(unsigned long addr, char access_key)
+enum tprot_permission {
+	TPROT_READ_WRITE = 0,
+	TPROT_READ = 1,
+	TPROT_RW_PROTECTED = 2,
+	TPROT_TRANSL_UNAVAIL = 3,
+};
+
+static inline enum tprot_permission tprot(unsigned long addr, char access_key)
 {
 	int cc;
 
@@ -237,7 +244,7 @@ static inline int tprot(unsigned long addr, char access_key)
 		"	ipm	%0\n"
 		"	srl	%0,28\n"
 		: "=d" (cc) : "a" (addr), "a" (access_key << 4) : "cc");
-	return cc;
+	return (enum tprot_permission)cc;
 }
 
 static inline void lctlg(int cr, uint64_t value)
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 33985eb4..b8204c5f 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -198,7 +198,7 @@ int sclp_service_call(unsigned int command, void *sccb)
 void sclp_memory_setup(void)
 {
 	uint64_t rnmax, rnsize;
-	int cc;
+	enum tprot_permission permission;
 
 	assert(read_info);
 
@@ -222,9 +222,9 @@ void sclp_memory_setup(void)
 	/* probe for r/w memory up to max memory size */
 	while (ram_size < max_ram_size) {
 		expect_pgm_int();
-		cc = tprot(ram_size + storage_increment_size - 1, 0);
+		permission = tprot(ram_size + storage_increment_size - 1, 0);
 		/* stop once we receive an exception or have protected memory */
-		if (clear_pgm_int() || cc != 0)
+		if (clear_pgm_int() || permission != TPROT_READ_WRITE)
 			break;
 		ram_size += storage_increment_size;
 	}
diff --git a/s390x/tprot.c b/s390x/tprot.c
index 760e7ecd..a4281abb 100644
--- a/s390x/tprot.c
+++ b/s390x/tprot.c
@@ -20,26 +20,26 @@ static uint8_t pagebuf[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
 
 static void test_tprot_rw(void)
 {
-	int cc;
+	enum tprot_permission permission;
 
 	report_prefix_push("Page read/writeable");
 
-	cc = tprot((unsigned long)pagebuf, 0);
-	report(cc == 0, "CC = 0");
+	permission = tprot((unsigned long)pagebuf, 0);
+	report(permission == TPROT_READ_WRITE, "CC = 0");
 
 	report_prefix_pop();
 }
 
 static void test_tprot_ro(void)
 {
-	int cc;
+	enum tprot_permission permission;
 
 	report_prefix_push("Page readonly");
 
 	protect_dat_entry(pagebuf, PAGE_ENTRY_P, 5);
 
-	cc = tprot((unsigned long)pagebuf, 0);
-	report(cc == 1, "CC = 1");
+	permission = tprot((unsigned long)pagebuf, 0);
+	report(permission == TPROT_READ, "CC = 1");
 
 	unprotect_dat_entry(pagebuf, PAGE_ENTRY_P, 5);
 
@@ -48,28 +48,28 @@ static void test_tprot_ro(void)
 
 static void test_tprot_low_addr_prot(void)
 {
-	int cc;
+	enum tprot_permission permission;
 
 	report_prefix_push("low-address protection");
 
 	low_prot_enable();
-	cc = tprot(0, 0);
+	permission = tprot(0, 0);
 	low_prot_disable();
-	report(cc == 1, "CC = 1");
+	report(permission == TPROT_READ, "CC = 1");
 
 	report_prefix_pop();
 }
 
 static void test_tprot_transl_unavail(void)
 {
-	int cc;
+	enum tprot_permission permission;
 
 	report_prefix_push("Page translation unavailable");
 
 	protect_dat_entry(pagebuf, PAGE_ENTRY_I, 5);
 
-	cc = tprot((unsigned long)pagebuf, 0);
-	report(cc == 3, "CC = 3");
+	permission = tprot((unsigned long)pagebuf, 0);
+	report(permission == TPROT_TRANSL_UNAVAIL, "CC = 3");
 
 	unprotect_dat_entry(pagebuf, PAGE_ENTRY_I, 5);
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 21/28] s390x: Test effect of storage keys on some instructions
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (19 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 20/28] s390x: Give name to return value of tprot() Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 22/28] Disable s390x skey test in GitLab CI Claudio Imbrenda
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Janis Schoetterl-Glausch

From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>

Some instructions are emulated by KVM. Test that KVM correctly emulates
storage key checking for two of those instructions (STORE CPU ADDRESS,
SET PREFIX).
Test success and error conditions, including coverage of storage and
fetch protection override.
Also add test for TEST PROTECTION, even if that instruction will not be
emulated by KVM under normal conditions.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/asm/arch_def.h |  20 ++--
 s390x/skey.c             | 249 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 260 insertions(+), 9 deletions(-)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 46c370e6..72553819 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -55,15 +55,17 @@ struct psw {
 #define PSW_MASK_BA			0x0000000080000000UL
 #define PSW_MASK_64			(PSW_MASK_BA | PSW_MASK_EA)
 
-#define CTL0_LOW_ADDR_PROT		(63 - 35)
-#define CTL0_EDAT			(63 - 40)
-#define CTL0_IEP			(63 - 43)
-#define CTL0_AFP			(63 - 45)
-#define CTL0_VECTOR			(63 - 46)
-#define CTL0_EMERGENCY_SIGNAL		(63 - 49)
-#define CTL0_EXTERNAL_CALL		(63 - 50)
-#define CTL0_CLOCK_COMPARATOR		(63 - 52)
-#define CTL0_SERVICE_SIGNAL		(63 - 54)
+#define CTL0_LOW_ADDR_PROT			(63 - 35)
+#define CTL0_EDAT				(63 - 40)
+#define CTL0_FETCH_PROTECTION_OVERRIDE		(63 - 38)
+#define CTL0_STORAGE_PROTECTION_OVERRIDE	(63 - 39)
+#define CTL0_IEP				(63 - 43)
+#define CTL0_AFP				(63 - 45)
+#define CTL0_VECTOR				(63 - 46)
+#define CTL0_EMERGENCY_SIGNAL			(63 - 49)
+#define CTL0_EXTERNAL_CALL			(63 - 50)
+#define CTL0_CLOCK_COMPARATOR			(63 - 52)
+#define CTL0_SERVICE_SIGNAL			(63 - 54)
 #define CR0_EXTM_MASK			0x0000000000006200UL /* Combined external masks */
 
 #define CTL2_GUARDED_STORAGE		(63 - 59)
diff --git a/s390x/skey.c b/s390x/skey.c
index edad53e9..32bf1070 100644
--- a/s390x/skey.c
+++ b/s390x/skey.c
@@ -10,6 +10,7 @@
 #include <libcflat.h>
 #include <asm/asm-offsets.h>
 #include <asm/interrupt.h>
+#include <vmalloc.h>
 #include <asm/page.h>
 #include <asm/facility.h>
 #include <asm/mem.h>
@@ -118,6 +119,249 @@ static void test_invalid_address(void)
 	report_prefix_pop();
 }
 
+static void test_test_protection(void)
+{
+	unsigned long addr = (unsigned long)pagebuf;
+
+	report_prefix_push("TPROT");
+
+	set_storage_key(pagebuf, 0x10, 0);
+	report(tprot(addr, 0) == TPROT_READ_WRITE, "zero key: no protection");
+	report(tprot(addr, 1) == TPROT_READ_WRITE, "matching key: no protection");
+
+	report_prefix_push("mismatching key");
+
+	report(tprot(addr, 2) == TPROT_READ, "no fetch protection: store protection");
+
+	set_storage_key(pagebuf, 0x18, 0);
+	report(tprot(addr, 2) == TPROT_RW_PROTECTED,
+	       "fetch protection: fetch & store protection");
+
+	report_prefix_push("fetch-protection override");
+	set_storage_key(0, 0x18, 0);
+	report(tprot(0, 2) == TPROT_RW_PROTECTED, "disabled: fetch & store protection");
+	ctl_set_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
+	report(tprot(0, 2) == TPROT_READ, "enabled: store protection");
+	report(tprot(2048, 2) == TPROT_RW_PROTECTED, "invalid: fetch & store protection");
+	ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
+	set_storage_key(0, 0x00, 0);
+	report_prefix_pop();
+
+	ctl_set_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE);
+	set_storage_key(pagebuf, 0x90, 0);
+	report(tprot(addr, 2) == TPROT_READ_WRITE,
+	       "storage-protection override: no protection");
+	ctl_clear_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE);
+
+	report_prefix_pop();
+	set_storage_key(pagebuf, 0x00, 0);
+	report_prefix_pop();
+}
+
+/*
+ * Perform STORE CPU ADDRESS (STAP) instruction while temporarily executing
+ * with access key 1.
+ */
+static void store_cpu_address_key_1(uint16_t *out)
+{
+	asm volatile (
+		"spka	0x10\n\t"
+		"stap	%0\n\t"
+		"spka	0\n"
+	     : "+Q" (*out) /* exception: old value remains in out -> + constraint */
+	);
+}
+
+static void test_store_cpu_address(void)
+{
+	uint16_t *out = (uint16_t *)pagebuf;
+	uint16_t cpu_addr;
+
+	report_prefix_push("STORE CPU ADDRESS");
+	asm ("stap %0" : "=Q" (cpu_addr));
+
+	report_prefix_push("zero key");
+	set_storage_key(pagebuf, 0x20, 0);
+	WRITE_ONCE(*out, 0xbeef);
+	asm ("stap %0" : "=Q" (*out));
+	report(*out == cpu_addr, "store occurred");
+	report_prefix_pop();
+
+	report_prefix_push("matching key");
+	set_storage_key(pagebuf, 0x10, 0);
+	*out = 0xbeef;
+	store_cpu_address_key_1(out);
+	report(*out == cpu_addr, "store occurred");
+	report_prefix_pop();
+
+	report_prefix_push("mismatching key");
+	set_storage_key(pagebuf, 0x20, 0);
+	expect_pgm_int();
+	*out = 0xbeef;
+	store_cpu_address_key_1(out);
+	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
+	report(*out == 0xbeef, "no store occurred");
+	report_prefix_pop();
+
+	ctl_set_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE);
+
+	report_prefix_push("storage-protection override, invalid key");
+	set_storage_key(pagebuf, 0x20, 0);
+	expect_pgm_int();
+	*out = 0xbeef;
+	store_cpu_address_key_1(out);
+	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
+	report(*out == 0xbeef, "no store occurred");
+	report_prefix_pop();
+
+	report_prefix_push("storage-protection override, override key");
+	set_storage_key(pagebuf, 0x90, 0);
+	*out = 0xbeef;
+	store_cpu_address_key_1(out);
+	report(*out == cpu_addr, "override occurred");
+	report_prefix_pop();
+
+	ctl_clear_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE);
+
+	report_prefix_push("storage-protection override disabled, override key");
+	set_storage_key(pagebuf, 0x90, 0);
+	expect_pgm_int();
+	*out = 0xbeef;
+	store_cpu_address_key_1(out);
+	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
+	report(*out == 0xbeef, "no store occurred");
+	report_prefix_pop();
+
+	set_storage_key(pagebuf, 0x00, 0);
+	report_prefix_pop();
+}
+
+/*
+ * Perform SET PREFIX (SPX) instruction while temporarily executing
+ * with access key 1.
+ */
+static void set_prefix_key_1(uint32_t *prefix_ptr)
+{
+	asm volatile (
+		"spka	0x10\n\t"
+		"spx	%0\n\t"
+		"spka	0\n"
+	     :: "Q" (*prefix_ptr)
+	);
+}
+
+/*
+ * We remapped page 0, making the lowcore inaccessible, which breaks the normal
+ * handler and breaks skipping the faulting instruction.
+ * Just disable dynamic address translation to make things work.
+ */
+static void dat_fixup_pgm_int(void)
+{
+	uint64_t psw_mask = extract_psw_mask();
+
+	psw_mask &= ~PSW_MASK_DAT;
+	load_psw_mask(psw_mask);
+}
+
+#define PREFIX_AREA_SIZE (PAGE_SIZE * 2)
+static char lowcore_tmp[PREFIX_AREA_SIZE] __attribute__((aligned(PREFIX_AREA_SIZE)));
+
+/*
+ * Test accessibility of the operand to SET PREFIX given different configurations
+ * with regards to storage keys. That is, check the accessibility of the location
+ * holding the new prefix, not that of the new prefix area. The new prefix area
+ * is a valid lowcore, so that the test does not crash on failure.
+ */
+static void test_set_prefix(void)
+{
+	uint32_t *prefix_ptr = (uint32_t *)pagebuf;
+	uint32_t *no_override_prefix_ptr;
+	uint32_t old_prefix;
+	pgd_t *root;
+
+	report_prefix_push("SET PREFIX");
+	root = (pgd_t *)(stctg(1) & PAGE_MASK);
+	old_prefix = get_prefix();
+	memcpy(lowcore_tmp, 0, sizeof(lowcore_tmp));
+	assert(((uint64_t)&lowcore_tmp >> 31) == 0);
+	*prefix_ptr = (uint32_t)(uint64_t)&lowcore_tmp;
+
+	report_prefix_push("zero key");
+	set_prefix(old_prefix);
+	set_storage_key(prefix_ptr, 0x20, 0);
+	set_prefix(*prefix_ptr);
+	report(get_prefix() == *prefix_ptr, "set prefix");
+	report_prefix_pop();
+
+	report_prefix_push("matching key");
+	set_prefix(old_prefix);
+	set_storage_key(pagebuf, 0x10, 0);
+	set_prefix_key_1(prefix_ptr);
+	report(get_prefix() == *prefix_ptr, "set prefix");
+	report_prefix_pop();
+
+	report_prefix_push("mismatching key");
+
+	report_prefix_push("no fetch protection");
+	set_prefix(old_prefix);
+	set_storage_key(pagebuf, 0x20, 0);
+	set_prefix_key_1(prefix_ptr);
+	report(get_prefix() == *prefix_ptr, "set prefix");
+	report_prefix_pop();
+
+	report_prefix_push("fetch protection");
+	set_prefix(old_prefix);
+	set_storage_key(pagebuf, 0x28, 0);
+	expect_pgm_int();
+	set_prefix_key_1(prefix_ptr);
+	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
+	report(get_prefix() == old_prefix, "did not set prefix");
+	report_prefix_pop();
+
+	register_pgm_cleanup_func(dat_fixup_pgm_int);
+
+	report_prefix_push("remapped page, fetch protection");
+	set_prefix(old_prefix);
+	set_storage_key(pagebuf, 0x28, 0);
+	expect_pgm_int();
+	install_page(root, virt_to_pte_phys(root, pagebuf), 0);
+	set_prefix_key_1((uint32_t *)0);
+	install_page(root, 0, 0);
+	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
+	report(get_prefix() == old_prefix, "did not set prefix");
+	report_prefix_pop();
+
+	ctl_set_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
+
+	report_prefix_push("fetch protection override applies");
+	set_prefix(old_prefix);
+	set_storage_key(pagebuf, 0x28, 0);
+	install_page(root, virt_to_pte_phys(root, pagebuf), 0);
+	set_prefix_key_1((uint32_t *)0);
+	install_page(root, 0, 0);
+	report(get_prefix() == *prefix_ptr, "set prefix");
+	report_prefix_pop();
+
+	no_override_prefix_ptr = (uint32_t *)(pagebuf + 2048);
+	WRITE_ONCE(*no_override_prefix_ptr, (uint32_t)(uint64_t)&lowcore_tmp);
+	report_prefix_push("fetch protection override does not apply");
+	set_prefix(old_prefix);
+	set_storage_key(pagebuf, 0x28, 0);
+	expect_pgm_int();
+	install_page(root, virt_to_pte_phys(root, pagebuf), 0);
+	set_prefix_key_1((uint32_t *)2048);
+	install_page(root, 0, 0);
+	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
+	report(get_prefix() == old_prefix, "did not set prefix");
+	report_prefix_pop();
+
+	ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
+	register_pgm_cleanup_func(NULL);
+	report_prefix_pop();
+	set_storage_key(pagebuf, 0x00, 0);
+	report_prefix_pop();
+}
+
 int main(void)
 {
 	report_prefix_push("skey");
@@ -130,6 +374,11 @@ int main(void)
 	test_set();
 	test_set_mb();
 	test_chg();
+	test_test_protection();
+	test_store_cpu_address();
+
+	setup_vm();
+	test_set_prefix();
 done:
 	report_prefix_pop();
 	return report_summary();
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 22/28] Disable s390x skey test in GitLab CI
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (20 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 21/28] s390x: Test effect of storage keys on some instructions Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 23/28] s390x: uv-host: Add invalid command attestation check Claudio Imbrenda
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Janis Schoetterl-Glausch

From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>

The test cases newly added to skey.c require kernel 5.18.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4f3049d8..e5768f1d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -166,7 +166,7 @@ s390x-kvm:
   - ./configure --arch=s390x
   - make -j$(nproc)
   - ACCEL=kvm ./run_tests.sh
-      selftest-setup intercept emulator sieve sthyi skey diag10 diag308 pfmf
+      selftest-setup intercept emulator sieve sthyi diag10 diag308 pfmf
       cmm vector gs iep cpumodel diag288 stsi sclp-1g sclp-3g css skrf sie
       | tee results.txt
   - grep -q PASS results.txt && ! grep -q FAIL results.txt
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 23/28] s390x: uv-host: Add invalid command attestation check
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (21 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 22/28] Disable s390x skey test in GitLab CI Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 24/28] s390x: lib: Add QUI getter Claudio Imbrenda
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Steffen Eiden

From: Steffen Eiden <seiden@linux.ibm.com>

Adds an invalid command test for attestation in the uv-host.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/asm/uv.h | 23 ++++++++++++++++++++++-
 s390x/uv-host.c    |  1 +
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
index 70bf65c4..7c8c399d 100644
--- a/lib/s390x/asm/uv.h
+++ b/lib/s390x/asm/uv.h
@@ -1,7 +1,7 @@
 /*
  * s390x Ultravisor related definitions
  *
- * Copyright (c) 2020 IBM Corp
+ * Copyright IBM Corp. 2020, 2022
  *
  * Authors:
  *  Janosch Frank <frankja@linux.ibm.com>
@@ -47,6 +47,7 @@
 #define UVC_CMD_UNPIN_PAGE_SHARED	0x0342
 #define UVC_CMD_SET_SHARED_ACCESS	0x1000
 #define UVC_CMD_REMOVE_SHARED_ACCESS	0x1001
+#define UVC_CMD_ATTESTATION		0x1020
 
 /* Bits in installed uv calls */
 enum uv_cmds_inst {
@@ -71,6 +72,7 @@ enum uv_cmds_inst {
 	BIT_UVC_CMD_UNSHARE_ALL = 20,
 	BIT_UVC_CMD_PIN_PAGE_SHARED = 21,
 	BIT_UVC_CMD_UNPIN_PAGE_SHARED = 22,
+	BIT_UVC_CMD_ATTESTATION = 28,
 };
 
 struct uv_cb_header {
@@ -178,6 +180,25 @@ struct uv_cb_cfs {
 	u64 paddr;
 }  __attribute__((packed))  __attribute__((aligned(8)));
 
+/* Retrieve Attestation Measurement */
+struct uv_cb_attest {
+	struct uv_cb_header header;	/* 0x0000 */
+	uint64_t reserved08[2];		/* 0x0008 */
+	uint64_t arcb_addr;		/* 0x0018 */
+	uint64_t continuation_token;	/* 0x0020 */
+	uint8_t  reserved28[6];		/* 0x0028 */
+	uint16_t user_data_length;	/* 0x002e */
+	uint8_t  user_data[256];	/* 0x0030 */
+	uint32_t reserved130[3];	/* 0x0130 */
+	uint32_t measurement_length;	/* 0x013c */
+	uint64_t measurement_address;	/* 0x0140 */
+	uint8_t  config_uid[16];	/* 0x0148 */
+	uint32_t reserved158;		/* 0x0158 */
+	uint32_t add_data_length;	/* 0x015c */
+	uint64_t add_data_address;	/* 0x0160 */
+	uint64_t reserved168[4];	/* 0x0168 */
+}  __attribute__((packed))  __attribute__((aligned(8)));
+
 /* Set Secure Config Parameter */
 struct uv_cb_ssc {
 	struct uv_cb_header header;
diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index 5ac8a32c..a1a6d120 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -418,6 +418,7 @@ static struct cmd_list invalid_cmds[] = {
 	{ "bogus", 0x4242, sizeof(struct uv_cb_header), -1},
 	{ "share", UVC_CMD_SET_SHARED_ACCESS, sizeof(struct uv_cb_share), BIT_UVC_CMD_SET_SHARED_ACCESS },
 	{ "unshare", UVC_CMD_REMOVE_SHARED_ACCESS, sizeof(struct uv_cb_share), BIT_UVC_CMD_REMOVE_SHARED_ACCESS },
+	{ "attest", UVC_CMD_ATTESTATION, sizeof(struct uv_cb_attest), BIT_UVC_CMD_ATTESTATION },
 	{ NULL, 0, 0 },
 };
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 24/28] s390x: lib: Add QUI getter
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (22 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 23/28] s390x: uv-host: Add invalid command attestation check Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 25/28] s390x: uv-guest: remove duplicated checks Claudio Imbrenda
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Steffen Eiden

From: Steffen Eiden <seiden@linux.ibm.com>

Some tests need the information provided by the QUI UVC and lib/s390x/uv.c
already has cached the qui result. Let's add a function to avoid
unnecessary QUI UVCs.

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>
---
 lib/s390x/uv.h | 1 +
 lib/s390x/uv.c | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h
index 8175d9c6..44264861 100644
--- a/lib/s390x/uv.h
+++ b/lib/s390x/uv.h
@@ -8,6 +8,7 @@
 bool uv_os_is_guest(void);
 bool uv_os_is_host(void);
 bool uv_query_test_call(unsigned int nr);
+const struct uv_cb_qui *uv_get_query_data(void);
 void uv_init(void);
 int uv_setup(void);
 void uv_create_guest(struct vm *vm);
diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
index 6fe11dff..3b4cafa9 100644
--- a/lib/s390x/uv.c
+++ b/lib/s390x/uv.c
@@ -47,6 +47,14 @@ bool uv_query_test_call(unsigned int nr)
 	return test_bit_inv(nr, uvcb_qui.inst_calls_list);
 }
 
+const struct uv_cb_qui *uv_get_query_data(void)
+{
+	/* Query needs to be called first */
+	assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100);
+
+	return &uvcb_qui;
+}
+
 int uv_setup(void)
 {
 	if (!test_facility(158))
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 25/28] s390x: uv-guest: remove duplicated checks
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (23 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 24/28] s390x: lib: Add QUI getter Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 26/28] s390x: uv-guest: Remove double report_prefix_pop Claudio Imbrenda
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Steffen Eiden

From: Steffen Eiden <seiden@linux.ibm.com>

Removing some tests which are done at other points in the code
implicitly.

In lib/s390x/uc.c#setup_uv(void) the rc of the qui result is verified
using asserts.
The whole test is fenced by lib/s390x/uc.c#uv_os_is_guest(void) that
checks if SET and REMOVE SHARED is present.

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 | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index 99120cae..728c60aa 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -69,23 +69,15 @@ static void test_query(void)
 	cc = uv_call(0, (u64)&uvcb);
 	report(cc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, "length");
 
-	uvcb.header.len = sizeof(uvcb);
-	cc = uv_call(0, (u64)&uvcb);
-	report((!cc && uvcb.header.rc == UVC_RC_EXECUTED) ||
-	       (cc == 1 && uvcb.header.rc == 0x100),
-		"successful query");
-
 	/*
-	 * These bits have been introduced with the very first
-	 * Ultravisor version and are expected to always be available
-	 * because they are basic building blocks.
+	 * BIT_UVC_CMD_QUI, BIT_UVC_CMD_SET_SHARED_ACCESS and
+	 * BIT_UVC_CMD_REMOVE_SHARED_ACCESS are always present as they
+	 * have been introduced with the first Ultravisor version.
+	 * However, we only need to check for QUI as
+	 * SET/REMOVE SHARED are used to fence this test to be only
+	 * executed by protected guests.
 	 */
-	report(test_bit_inv(BIT_UVC_CMD_QUI, &uvcb.inst_calls_list[0]),
-	       "query indicated");
-	report(test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, &uvcb.inst_calls_list[0]),
-	       "share indicated");
-	report(test_bit_inv(BIT_UVC_CMD_REMOVE_SHARED_ACCESS, &uvcb.inst_calls_list[0]),
-	       "unshare indicated");
+	report(uv_query_test_call(BIT_UVC_CMD_QUI), "query indicated");
 	report_prefix_pop();
 }
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 26/28] s390x: uv-guest: Remove double report_prefix_pop
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (24 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 25/28] s390x: uv-guest: remove duplicated checks Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 27/28] s390x: uv-guest: add share bit test Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 28/28] s390x: Add attestation tests Claudio Imbrenda
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Steffen Eiden

From: Steffen Eiden <seiden@linux.ibm.com>

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 | 2 --
 1 file changed, 2 deletions(-)

diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index 728c60aa..fd2cfef1 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -111,8 +111,6 @@ static void test_sharing(void)
 	cc = uv_call(0, (u64)&uvcb);
 	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "unshare");
 	report_prefix_pop();
-
-	report_prefix_pop();
 }
 
 static struct {
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 27/28] s390x: uv-guest: add share bit test
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (25 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 26/28] s390x: uv-guest: Remove double report_prefix_pop Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 28/28] s390x: Add attestation tests Claudio Imbrenda
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Steffen Eiden

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 --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;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [kvm-unit-tests GIT PULL 28/28] s390x: Add attestation tests
  2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
                   ` (26 preceding siblings ...)
  2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 27/28] s390x: uv-guest: add share bit test Claudio Imbrenda
@ 2022-05-12  9:35 ` Claudio Imbrenda
  27 siblings, 0 replies; 33+ messages in thread
From: Claudio Imbrenda @ 2022-05-12  9:35 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, thuth, frankja, Steffen Eiden

From: Steffen Eiden <seiden@linux.ibm.com>

Adds several tests to verify correct error paths of attestation.

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/Makefile     |   1 +
 lib/s390x/asm/uv.h |   5 +-
 s390x/pv-attest.c  | 225 +++++++++++++++++++++++++++++++++++++++++++++
 s390x/uv-guest.c   |  11 ++-
 4 files changed, 240 insertions(+), 2 deletions(-)
 create mode 100644 s390x/pv-attest.c

diff --git a/s390x/Makefile b/s390x/Makefile
index 5336ed8a..a8e04aa6 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -31,6 +31,7 @@ tests += $(TEST_DIR)/firq.elf
 tests += $(TEST_DIR)/epsw.elf
 tests += $(TEST_DIR)/adtl-status.elf
 tests += $(TEST_DIR)/migration.elf
+tests += $(TEST_DIR)/pv-attest.elf
 
 pv-tests += $(TEST_DIR)/pv-diags.elf
 
diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
index 7c8c399d..38920461 100644
--- a/lib/s390x/asm/uv.h
+++ b/lib/s390x/asm/uv.h
@@ -108,7 +108,10 @@ struct uv_cb_qui {
 	u8  reserved88[158 - 136];	/* 0x0088 */
 	uint16_t max_guest_cpus;	/* 0x009e */
 	u64 uv_feature_indications;	/* 0x00a0 */
-	u8  reserveda8[200 - 168];	/* 0x00a8 */
+	uint8_t  reserveda8[224 - 168];	/* 0x00a8 */
+	uint64_t supp_att_hdr_ver;	/* 0x00e0 */
+	uint64_t supp_paf;		/* 0x00e8 */
+	uint8_t  reservedf0[256 - 240];	/* 0x00f0 */
 }  __attribute__((packed))  __attribute__((aligned(8)));
 
 struct uv_cb_cgc {
diff --git a/s390x/pv-attest.c b/s390x/pv-attest.c
new file mode 100644
index 00000000..7a3dac75
--- /dev/null
+++ b/s390x/pv-attest.c
@@ -0,0 +1,225 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Retrieve Attestation Measurement Utravisor Call tests
+ *
+ * Copyright IBM Corp. 2022
+ *
+ * Authors:
+ *  Steffen Eiden <seiden@linux.ibm.com>
+ */
+
+#include <libcflat.h>
+#include <alloc_page.h>
+#include <asm/page.h>
+#include <asm/facility.h>
+#include <asm/uv.h>
+#include <sclp.h>
+#include <uv.h>
+
+#define ARCB_VERSION_NONE 0
+#define ARCB_VERSION_1 0x100
+#define ARCB_MEAS_NONE 0
+#define ARCB_MEAS_HMAC_SHA512 1
+#define MEASUREMENT_SIZE_HMAC_SHA512 64
+#define PAF_PHKH_ATT (1ULL << 61)
+#define ADDITIONAL_SIZE_PAF_PHKH_ATT 32
+/* arcb with one key slot and no nonce */
+struct uv_arcb_v1 {
+	uint64_t reserved0;		/* 0x0000 */
+	uint32_t req_ver;		/* 0x0008 */
+	uint32_t req_len;		/* 0x000c */
+	uint8_t  iv[12];		/* 0x0010 */
+	uint32_t reserved1c;		/* 0x001c */
+	uint8_t  reserved20[7];		/* 0x0020 */
+	uint8_t  nks;			/* 0x0027 */
+	int32_t reserved28;		/* 0x0028 */
+	uint32_t sea;			/* 0x002c */
+	uint64_t plaint_att_flags;	/* 0x0030 */
+	uint32_t meas_alg_id;		/* 0x0038 */
+	uint32_t reserved3c;		/* 0x003c */
+	uint8_t  cpk[160];		/* 0x0040 */
+	uint8_t  key_slot[80];		/* 0x00e0 */
+	uint8_t  meas_key[64];		/* 0x0130 */
+	uint8_t  tag[16];		/* 0x0170 */
+} __attribute__((packed));
+
+struct attest_request_v1 {
+	struct uv_arcb_v1 arcb;
+	uint8_t measurement[MEASUREMENT_SIZE_HMAC_SHA512];
+	uint8_t additional[ADDITIONAL_SIZE_PAF_PHKH_ATT];
+};
+
+static void test_attest_v1(uint64_t page)
+{
+	struct uv_cb_attest uvcb = {
+		.header.cmd = UVC_CMD_ATTESTATION,
+		.header.len = sizeof(uvcb),
+	};
+	const struct uv_cb_qui *uvcb_qui = uv_get_query_data();
+	struct attest_request_v1 *attest_req = (void *)page;
+	struct uv_arcb_v1 *arcb = &attest_req->arcb;
+	int cc;
+
+	report_prefix_push("v1");
+	if (!test_bit_inv(0, &uvcb_qui->supp_att_hdr_ver)) {
+		report_skip("Attestation version 1 not supported");
+		goto done;
+	}
+
+	memset((void *)page, 0, PAGE_SIZE);
+
+	/*
+	 * Create a minimal arcb/uvcb such that FW has everything to start
+	 * unsealing the request. However, this unsealing will fail as the
+	 * kvm-unit-test framework provides no cryptography functions that
+	 * would be needed to seal such requests.
+	 */
+	arcb->req_ver = ARCB_VERSION_1;
+	arcb->req_len = sizeof(*arcb);
+	arcb->nks = 1;
+	arcb->sea = sizeof(arcb->meas_key);
+	arcb->plaint_att_flags = PAF_PHKH_ATT;
+	arcb->meas_alg_id = ARCB_MEAS_HMAC_SHA512;
+	uvcb.arcb_addr = (uint64_t)&attest_req->arcb;
+	uvcb.measurement_address = (uint64_t)attest_req->measurement;
+	uvcb.measurement_length = sizeof(attest_req->measurement);
+	uvcb.add_data_address = (uint64_t)attest_req->additional;
+	uvcb.add_data_length = sizeof(attest_req->additional);
+
+	uvcb.continuation_token = 0xff;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x101, "invalid continuation token");
+	uvcb.continuation_token = 0;
+
+	uvcb.user_data_length = sizeof(uvcb.user_data) + 1;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x102, "invalid user data size");
+	uvcb.user_data_length = 0;
+
+	uvcb.arcb_addr = get_ram_size() + PAGE_SIZE;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x103, "invalid address arcb");
+	uvcb.arcb_addr = page;
+
+	/* 0x104 - 0x105 need an unseal-able request */
+
+	arcb->req_ver = ARCB_VERSION_NONE;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x106, "unsupported version");
+	arcb->req_ver = ARCB_VERSION_1;
+
+	arcb->req_len += 1;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x107, "arcb too big");
+	arcb->req_len -= 1;
+
+	/*
+	 * The arcb needs to grow as well if number of key slots (nks)
+	 * is increased. However, this is not the case and there is no explicit
+	 * 'too many/less nks for that arcb size' error code -> expect 0x107
+	 */
+	arcb->nks = 2;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x107, "too many nks for arcb");
+	arcb->nks = 1;
+
+	arcb->nks = 0;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x108, "invalid num key slots");
+	arcb->nks = 1;
+
+	/*
+	 * Possible valid size (when using nonce).
+	 * However, req_len too small to host a nonce
+	 */
+	arcb->sea = 80;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x109, "encrypted size too big");
+	arcb->sea = 17;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x109, "encrypted size too small");
+	arcb->sea = 64;
+
+	arcb->plaint_att_flags = uvcb_qui->supp_paf ^ GENMASK_ULL(63, 0);
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x10a, "invalid flag");
+	arcb->plaint_att_flags = PAF_PHKH_ATT;
+
+	arcb->meas_alg_id = ARCB_MEAS_NONE;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x10b, "invalid measurement algorithm");
+	arcb->meas_alg_id = ARCB_MEAS_HMAC_SHA512;
+
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x10c, "unable unseal");
+
+	uvcb.measurement_length = 0;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x10d, "invalid measurement size");
+	uvcb.measurement_length = sizeof(attest_req->measurement);
+
+	uvcb.add_data_length = 0;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x10e, "invalid additional size");
+	uvcb.add_data_length = sizeof(attest_req->additional);
+
+done:
+	report_prefix_pop();
+}
+
+static void test_attest(uint64_t page)
+{
+	struct uv_cb_attest uvcb = {
+		.header.cmd = UVC_CMD_ATTESTATION,
+		.header.len = sizeof(uvcb),
+	};
+	const struct uv_cb_qui *uvcb_qui = uv_get_query_data();
+	int cc;
+
+	/* Verify that the UV supports at least one header version */
+	report(uvcb_qui->supp_att_hdr_ver, "has hdr support");
+
+	memset((void *)page, 0, PAGE_SIZE);
+
+	uvcb.header.len -= 1;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc && uvcb.header.rc == UVC_RC_INV_LEN, "uvcb too small");
+	uvcb.header.len += 1;
+
+	uvcb.header.len += 1;
+	cc = uv_call(0, (uint64_t)&uvcb);
+	report(cc && uvcb.header.rc == UVC_RC_INV_LEN, "uvcb too large");
+	uvcb.header.len -= 1;
+}
+
+int main(void)
+{
+	bool has_uvc = test_facility(158);
+	uint64_t page;
+
+
+	report_prefix_push("attestation");
+	if (!has_uvc) {
+		report_skip("Ultravisor call facility is not available");
+		goto done;
+	}
+
+	if (!uv_os_is_guest()) {
+		report_skip("Not a protected guest");
+		goto done;
+	}
+
+	if (!uv_query_test_call(BIT_UVC_CMD_ATTESTATION)) {
+		report_skip("Attestation not supported.");
+		goto done;
+	}
+
+	page = (uint64_t)alloc_page();
+	/* The privilege check is done in uv-guest.c */
+	test_attest(page);
+	test_attest_v1(page);
+	free_page((void *)page);
+done:
+	report_prefix_pop();
+	return report_summary();
+}
diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index 152ad807..c16f19d4 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -2,7 +2,7 @@
 /*
  * Guest Ultravisor Call tests
  *
- * Copyright (c) 2020 IBM Corp
+ * Copyright IBM Corp. 2020, 2022
  *
  * Authors:
  *  Janosch Frank <frankja@linux.ibm.com>
@@ -53,6 +53,15 @@ static void test_priv(void)
 	check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
 	report_prefix_pop();
 
+	report_prefix_push("attest");
+	uvcb.cmd = UVC_CMD_ATTESTATION;
+	uvcb.len = sizeof(struct uv_cb_attest);
+	expect_pgm_int();
+	enter_pstate();
+	uv_call_once(0, (uint64_t)&uvcb);
+	check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
+	report_prefix_pop();
+
 	report_prefix_pop();
 }
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order
  2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order Claudio Imbrenda
@ 2022-09-20 15:53   ` Thomas Huth
  2022-10-05 13:18     ` Nico Boehr
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Huth @ 2022-09-20 15:53 UTC (permalink / raw)
  To: Claudio Imbrenda, Nico Boehr; +Cc: kvm, frankja

On 12/05/2022 11.34, Claudio Imbrenda wrote:
[...]
> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> index 743013b2..256c7169 100644
> --- a/s390x/unittests.cfg
> +++ b/s390x/unittests.cfg
> @@ -146,3 +146,28 @@ extra_params = -device virtio-net-ccw
>   
>   [tprot]
>   file = tprot.elf
> +
> +[adtl-status-kvm]
> +file = adtl-status.elf
> +smp = 2
> +accel = kvm
> +extra_params = -cpu host,gs=on,vx=on

FWIW, on my z13 LPAR, I now see a warning:

SKIP adtl-status-kvm (qemu-kvm: can't apply global host-s390x-cpu.gs=on: 
Feature 'gs' is not available for CPU model 'z13.2', it was introduced with 
later models.)

Could we silence that somehow?

  Thomas


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order
  2022-09-20 15:53   ` Thomas Huth
@ 2022-10-05 13:18     ` Nico Boehr
  2022-10-05 13:25       ` Thomas Huth
  0 siblings, 1 reply; 33+ messages in thread
From: Nico Boehr @ 2022-10-05 13:18 UTC (permalink / raw)
  To: Claudio Imbrenda, Thomas Huth; +Cc: kvm, frankja

Hi Thomas,

Quoting Thomas Huth (2022-09-20 17:53:28)
> On 12/05/2022 11.34, Claudio Imbrenda wrote:
> [...]
> > diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> > index 743013b2..256c7169 100644
> > --- a/s390x/unittests.cfg
> > +++ b/s390x/unittests.cfg
> > @@ -146,3 +146,28 @@ extra_params = -device virtio-net-ccw
> >   
> >   [tprot]
> >   file = tprot.elf
> > +
> > +[adtl-status-kvm]
> > +file = adtl-status.elf
> > +smp = 2
> > +accel = kvm
> > +extra_params = -cpu host,gs=on,vx=on
> 
> FWIW, on my z13 LPAR, I now see a warning:
> 
> SKIP adtl-status-kvm (qemu-kvm: can't apply global host-s390x-cpu.gs=on: 
> Feature 'gs' is not available for CPU model 'z13.2', it was introduced with 
> later models.)
> 
> Could we silence that somehow?

instead of a SKIP, what would you expect to see in this case? Or do you mean the message inside the parenthesis?

Nico

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order
  2022-10-05 13:18     ` Nico Boehr
@ 2022-10-05 13:25       ` Thomas Huth
  2022-10-05 14:00         ` Nico Boehr
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Huth @ 2022-10-05 13:25 UTC (permalink / raw)
  To: Nico Boehr, Claudio Imbrenda; +Cc: kvm, frankja

On 05/10/2022 15.18, Nico Boehr wrote:
> Hi Thomas,
> 
> Quoting Thomas Huth (2022-09-20 17:53:28)
>> On 12/05/2022 11.34, Claudio Imbrenda wrote:
>> [...]
>>> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
>>> index 743013b2..256c7169 100644
>>> --- a/s390x/unittests.cfg
>>> +++ b/s390x/unittests.cfg
>>> @@ -146,3 +146,28 @@ extra_params = -device virtio-net-ccw
>>>    
>>>    [tprot]
>>>    file = tprot.elf
>>> +
>>> +[adtl-status-kvm]
>>> +file = adtl-status.elf
>>> +smp = 2
>>> +accel = kvm
>>> +extra_params = -cpu host,gs=on,vx=on
>>
>> FWIW, on my z13 LPAR, I now see a warning:
>>
>> SKIP adtl-status-kvm (qemu-kvm: can't apply global host-s390x-cpu.gs=on:
>> Feature 'gs' is not available for CPU model 'z13.2', it was introduced with
>> later models.)
>>
>> Could we silence that somehow?
> 
> instead of a SKIP, what would you expect to see in this case? Or do you mean the message inside the parenthesis?

I meant the message inside the parenthesis ... but thinking about it twice, 
it's maybe even useful to have it here ... so I'm also fine if we keep it. 
... it's just a little bit long ...

  Thomas



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order
  2022-10-05 13:25       ` Thomas Huth
@ 2022-10-05 14:00         ` Nico Boehr
  0 siblings, 0 replies; 33+ messages in thread
From: Nico Boehr @ 2022-10-05 14:00 UTC (permalink / raw)
  To: Claudio Imbrenda, Thomas Huth; +Cc: kvm, frankja

Quoting Thomas Huth (2022-10-05 15:25:03)
> On 05/10/2022 15.18, Nico Boehr wrote:
> > Hi Thomas,
> > 
> > Quoting Thomas Huth (2022-09-20 17:53:28)
> >> On 12/05/2022 11.34, Claudio Imbrenda wrote:
> >> [...]
> >>> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> >>> index 743013b2..256c7169 100644
> >>> --- a/s390x/unittests.cfg
> >>> +++ b/s390x/unittests.cfg
> >>> @@ -146,3 +146,28 @@ extra_params = -device virtio-net-ccw
> >>>    
> >>>    [tprot]
> >>>    file = tprot.elf
> >>> +
> >>> +[adtl-status-kvm]
> >>> +file = adtl-status.elf
> >>> +smp = 2
> >>> +accel = kvm
> >>> +extra_params = -cpu host,gs=on,vx=on
> >>
> >> FWIW, on my z13 LPAR, I now see a warning:
> >>
> >> SKIP adtl-status-kvm (qemu-kvm: can't apply global host-s390x-cpu.gs=on:
> >> Feature 'gs' is not available for CPU model 'z13.2', it was introduced with
> >> later models.)
> >>
> >> Could we silence that somehow?
> > 
> > instead of a SKIP, what would you expect to see in this case? Or do you mean the message inside the parenthesis?
> 
> I meant the message inside the parenthesis ... but thinking about it twice, 
> it's maybe even useful to have it here ... so I'm also fine if we keep it. 
> ... it's just a little bit long ...

We could have

cpu = host

in unittest.cfg for adtl-status-kvm.

But this would mean if the host doesn't support vector or gs, we would just see

PASS adtl-status-kvm

with some skipped tests. So, to me, it feels like the current solution is better even if the error message is ugly and long.

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2022-10-05 14:00 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  9:34 [kvm-unit-tests GIT PULL 00/28] storage keys, attestation, migration tests Claudio Imbrenda
2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 01/28] s390x: gs: move to new header file Claudio Imbrenda
2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order Claudio Imbrenda
2022-09-20 15:53   ` Thomas Huth
2022-10-05 13:18     ` Nico Boehr
2022-10-05 13:25       ` Thomas Huth
2022-10-05 14:00         ` Nico Boehr
2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 03/28] s390x: epsw: fix report_pop_prefix() when running under non-QEMU Claudio Imbrenda
2022-05-12  9:34 ` [kvm-unit-tests GIT PULL 04/28] s390x: tprot: use lib include for mmu.h Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 05/28] s390x: smp: make stop stopped cpu look the same as the running case Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 06/28] lib: s390x: hardware: Add host_is_qemu() function Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 07/28] s390x: css: Skip if we're not run by qemu Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 08/28] s390x: diag308: Only test subcode 2 under QEMU Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 09/28] s390x: pfmf: Initialize pfmf_r1 union on declaration Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 10/28] s390x: snippets: asm: Add license and copyright headers Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 11/28] s390x: pv-diags: Cleanup includes Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 12/28] s390x: css: " Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 13/28] s390x: iep: " Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 14/28] s390x: mvpg: " Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 15/28] s390x: uv-host: Fix pgm tests Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 16/28] lib: s390x: add support for SCLP console read Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 17/28] s390x: add support for migration tests Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 18/28] s390x: don't run migration tests under PV Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 19/28] s390x: add basic migration test Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 20/28] s390x: Give name to return value of tprot() Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 21/28] s390x: Test effect of storage keys on some instructions Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 22/28] Disable s390x skey test in GitLab CI Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 23/28] s390x: uv-host: Add invalid command attestation check Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 24/28] s390x: lib: Add QUI getter Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 25/28] s390x: uv-guest: remove duplicated checks Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 26/28] s390x: uv-guest: Remove double report_prefix_pop Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 27/28] s390x: uv-guest: add share bit test Claudio Imbrenda
2022-05-12  9:35 ` [kvm-unit-tests GIT PULL 28/28] s390x: Add attestation tests Claudio Imbrenda

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.