All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PULL 00/17] s390x updates
@ 2020-04-30 15:24 David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 01/17] MAINTAINERS: Add Janosch as a s390x maintainer David Hildenbrand
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	David Hildenbrand, Andrew Jones, Christian Borntraeger,
	Cornelia Huck, Janosch Frank, Janosch Frank

Hi Paolo,

The following changes since commit 5c052c904ded7ecd80d8f7efe2803821b45ce483:

  kvm-unit-tests: nSVM: Test that CR0[63:32] are not set on VMRUN of nested guests (2020-04-21 12:16:07 -0400)

are available in the Git repository at:

  https://github.com/davidhildenbrand/kvm-unit-tests.git tags/s390x-2020-04-30

for you to fetch changes up to f7df29115f736b9ffe8e529ba9c2b418d2f5e736:

  s390x: Fix library constant definitions (2020-04-30 16:52:14 +0200)

----------------------------------------------------------------
New maintainer, reviewer, and cc list. New STSI test. Lots of minor fixes
and cleanups

----------------------------------------------------------------
Andrew Jones (1):
      s390x: unittests: Use smp parameter

Christian Borntraeger (2):
      s390x/smp: fix detection of "running"
      s390x/smp: add minimal test for sigp sense running status

Cornelia Huck (2):
      MAINTAINERS: s390x: add myself as reviewer
      MAINTAINERS: s390x: add linux-s390 list

David Hildenbrand (1):
      s390x: STFLE operates on doublewords

Janosch Frank (10):
      s390x: Add stsi 3.2.2 tests
      s390x: smp: Test all CRs on initial reset
      s390x: smp: Dirty fpc before initial reset test
      s390x: smp: Test stop and store status on a running and stopped cpu
      s390x: smp: Test local interrupts after cpu reset
      s390x: smp: Loop if secondary cpu returns into cpu setup again
      s390x: smp: Remove unneeded cpu loops
      s390x: smp: Use full PSW to bringup new cpu
      s390x: smp: Add restart when running test
      s390x: Fix library constant definitions

Thomas Huth (1):
      MAINTAINERS: Add Janosch as a s390x maintainer

 MAINTAINERS              |   4 +-
 lib/s390x/asm/arch_def.h |   8 ++--
 lib/s390x/asm/facility.h |  14 +++----
 lib/s390x/io.c           |   2 +-
 lib/s390x/smp.c          |   6 ++-
 lib/s390x/smp.h          |   2 +-
 s390x/cstart64.S         |   5 ++-
 s390x/smp.c              | 105 +++++++++++++++++++++++++++++++++++++++++++----
 s390x/stsi.c             |  73 ++++++++++++++++++++++++++++++++
 s390x/unittests.cfg      |   3 +-
 10 files changed, 196 insertions(+), 26 deletions(-)

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

* [kvm-unit-tests PULL 01/17] MAINTAINERS: Add Janosch as a s390x maintainer
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 02/17] MAINTAINERS: s390x: add myself as reviewer David Hildenbrand
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Janosch Frank, David Hildenbrand

From: Thomas Huth <thuth@redhat.com>

Both, David and I, often do not have as much spare time for the
kvm-unit-tests as we would like to have, so we could use a little
bit of additional help here. Janosch did some excellent work for
the s390x kvm-unit-tests in the past months and is listed as reviewer
for these patches since quite a while already, so he's a very well
suited for the maintainer job here, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Janosch Frank <frankja@de.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200205101935.19219-1-thuth@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 48da1db..082be95 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -80,7 +80,7 @@ F: lib/ppc64/*
 S390X
 M: Thomas Huth <thuth@redhat.com>
 M: David Hildenbrand <david@redhat.com>
-R: Janosch Frank <frankja@linux.ibm.com>
+M: Janosch Frank <frankja@linux.ibm.com>
 L: kvm@vger.kernel.org
 F: s390x/*
 F: lib/s390x/*
-- 
2.25.3

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

* [kvm-unit-tests PULL 02/17] MAINTAINERS: s390x: add myself as reviewer
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 01/17] MAINTAINERS: Add Janosch as a s390x maintainer David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 03/17] MAINTAINERS: s390x: add linux-s390 list David Hildenbrand
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

From: Cornelia Huck <cohuck@redhat.com>

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20200324121722.9776-2-cohuck@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 082be95..4642909 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -81,6 +81,7 @@ S390X
 M: Thomas Huth <thuth@redhat.com>
 M: David Hildenbrand <david@redhat.com>
 M: Janosch Frank <frankja@linux.ibm.com>
+R: Cornelia Huck <cohuck@redhat.com>
 L: kvm@vger.kernel.org
 F: s390x/*
 F: lib/s390x/*
-- 
2.25.3

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

* [kvm-unit-tests PULL 03/17] MAINTAINERS: s390x: add linux-s390 list
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 01/17] MAINTAINERS: Add Janosch as a s390x maintainer David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 02/17] MAINTAINERS: s390x: add myself as reviewer David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 04/17] s390x: Add stsi 3.2.2 tests David Hildenbrand
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

From: Cornelia Huck <cohuck@redhat.com>

It makes sense to cc: patches there as well.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200324121722.9776-3-cohuck@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4642909..52a3eb6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -83,6 +83,7 @@ M: David Hildenbrand <david@redhat.com>
 M: Janosch Frank <frankja@linux.ibm.com>
 R: Cornelia Huck <cohuck@redhat.com>
 L: kvm@vger.kernel.org
+L: linux-s390@vger.kernel.org
 F: s390x/*
 F: lib/s390x/*
 
-- 
2.25.3

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

* [kvm-unit-tests PULL 04/17] s390x: Add stsi 3.2.2 tests
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (2 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 03/17] MAINTAINERS: s390x: add linux-s390 list David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 05/17] s390x/smp: fix detection of "running" David Hildenbrand
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Subcode 3.2.2 is handled by KVM/QEMU and should therefore be tested
a bit more thoroughly.

In this test we set a custom name and uuid through the QEMU command
line. Both parameters will be passed to the guest on a stsi subcode
3.2.2 call and will then be checked.

We also compare the configured cpu numbers against the smp reported
numbers and if the reserved + configured add up to the total number
reported.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200331071456.3302-1-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/stsi.c        | 73 +++++++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg |  1 +
 2 files changed, 74 insertions(+)

diff --git a/s390x/stsi.c b/s390x/stsi.c
index e9206bc..66b4257 100644
--- a/s390x/stsi.c
+++ b/s390x/stsi.c
@@ -14,7 +14,28 @@
 #include <asm/page.h>
 #include <asm/asm-offsets.h>
 #include <asm/interrupt.h>
+#include <smp.h>
 
+struct stsi_322 {
+	uint8_t reserved[31];
+	uint8_t count;
+	struct {
+		uint8_t reserved2[4];
+		uint16_t total_cpus;
+		uint16_t conf_cpus;
+		uint16_t standby_cpus;
+		uint16_t reserved_cpus;
+		uint8_t name[8];
+		uint32_t caf;
+		uint8_t cpi[16];
+		uint8_t reserved5[3];
+		uint8_t ext_name_encoding;
+		uint32_t reserved3;
+		uint8_t uuid[16];
+	} vm[8];
+	uint8_t reserved4[1504];
+	uint8_t ext_names[8][256];
+};
 static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2)));
 
 static void test_specs(void)
@@ -76,11 +97,63 @@ static void test_fc(void)
 	report(stsi_get_fc(pagebuf) >= 2, "query fc >= 2");
 }
 
+static void test_3_2_2(void)
+{
+	int rc;
+	/* EBCDIC for "kvm-unit" */
+	const uint8_t vm_name[] = { 0x92, 0xa5, 0x94, 0x60, 0xa4, 0x95, 0x89,
+				    0xa3 };
+	const uint8_t uuid[] = { 0x0f, 0xb8, 0x4a, 0x86, 0x72, 0x7c,
+				 0x11, 0xea, 0xbc, 0x55, 0x02, 0x42, 0xac, 0x13,
+				 0x00, 0x03 };
+	/* EBCDIC for "KVM/" */
+	const uint8_t cpi_kvm[] = { 0xd2, 0xe5, 0xd4, 0x61 };
+	const char *vm_name_ext = "kvm-unit-test";
+	struct stsi_322 *data = (void *)pagebuf;
+
+	report_prefix_push("3.2.2");
+
+	/* Is the function code available at all? */
+	if (stsi_get_fc(pagebuf) < 3) {
+		report_skip("Running under lpar, no level 3 to test.");
+		goto out;
+	}
+
+	rc = stsi(pagebuf, 3, 2, 2);
+	report(!rc, "call");
+
+	/* For now we concentrate on KVM/QEMU */
+	if (memcmp(&data->vm[0].cpi, cpi_kvm, sizeof(cpi_kvm))) {
+		report_skip("Not running under KVM/QEMU.");
+		goto out;
+	}
+
+	report(!memcmp(data->vm[0].uuid, uuid, sizeof(uuid)), "uuid");
+	report(data->vm[0].conf_cpus == smp_query_num_cpus(), "cpu # configured");
+	report(data->vm[0].total_cpus ==
+	       data->vm[0].reserved_cpus + data->vm[0].conf_cpus,
+	       "cpu # total == conf + reserved");
+	report(data->vm[0].standby_cpus == 0, "cpu # standby");
+	report(!memcmp(data->vm[0].name, vm_name, sizeof(data->vm[0].name)),
+	       "VM name == kvm-unit-test");
+
+	if (data->vm[0].ext_name_encoding != 2) {
+		report_skip("Extended VM names are not UTF-8.");
+		goto out;
+	}
+	report(!memcmp(data->ext_names[0], vm_name_ext, sizeof(vm_name_ext)),
+		       "ext VM name == kvm-unit-test");
+
+out:
+	report_prefix_pop();
+}
+
 int main(void)
 {
 	report_prefix_push("stsi");
 	test_priv();
 	test_specs();
 	test_fc();
+	test_3_2_2();
 	return report_summary();
 }
diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index 07013b2..535db21 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -71,6 +71,7 @@ extra_params=-device diag288,id=watchdog0 --watchdog-action inject-nmi
 
 [stsi]
 file = stsi.elf
+extra_params=-name kvm-unit-test --uuid 0fb84a86-727c-11ea-bc55-0242ac130003 -smp 1,maxcpus=8
 
 [smp]
 file = smp.elf
-- 
2.25.3

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

* [kvm-unit-tests PULL 05/17] s390x/smp: fix detection of "running"
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (3 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 04/17] s390x: Add stsi 3.2.2 tests David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 06/17] s390x: STFLE operates on doublewords David Hildenbrand
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Christian Borntraeger, Janosch Frank, Cornelia Huck,
	David Hildenbrand

From: Christian Borntraeger <borntraeger@de.ibm.com>

On s390x hosts with a single CPU, the smp test case hangs (loops).
The check if our restart has finished is wrong.
Sigp sense running status checks if the CPU is currently backed by a
real CPU. This means that on single CPU hosts a sigp sense running
will never claim that a target is running. We need to check for not
being stopped instead.

Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20200330084911.34248-2-borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index 3f86243..203792a 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw)
 	 * The order has been accepted, but the actual restart may not
 	 * have been performed yet, so wait until the cpu is running.
 	 */
-	while (!smp_cpu_running(addr))
+	while (smp_cpu_stopped(addr))
 		mb();
 	cpu->active = true;
 	return 0;
-- 
2.25.3

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

* [kvm-unit-tests PULL 06/17] s390x: STFLE operates on doublewords
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (4 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 05/17] s390x/smp: fix detection of "running" David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 07/17] s390x/smp: add minimal test for sigp sense running status David Hildenbrand
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	David Hildenbrand, Christian Borntraeger

STFLE operates on doublewords, not bytes. Passing in "256" resulted in
some ignored bits getting set. Not bad, but also not clean.

Let's just convert our stfle handling code to operate on doublewords.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20200401163305.31550-1-david@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/asm/facility.h | 14 +++++++-------
 lib/s390x/io.c           |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/s390x/asm/facility.h b/lib/s390x/asm/facility.h
index e34dc2c..def2705 100644
--- a/lib/s390x/asm/facility.h
+++ b/lib/s390x/asm/facility.h
@@ -14,12 +14,12 @@
 #include <asm/facility.h>
 #include <asm/arch_def.h>
 
-#define NR_STFL_BYTES 256
-extern uint8_t stfl_bytes[];
+#define NB_STFL_DOUBLEWORDS 32
+extern uint64_t stfl_doublewords[];
 
 static inline bool test_facility(int nr)
 {
-	return stfl_bytes[nr / 8] & (0x80U >> (nr % 8));
+	return stfl_doublewords[nr / 64] & (0x8000000000000000UL >> (nr % 64));
 }
 
 static inline void stfl(void)
@@ -27,9 +27,9 @@ static inline void stfl(void)
 	asm volatile("	stfl	0(0)\n" : : : "memory");
 }
 
-static inline void stfle(uint8_t *fac, unsigned int len)
+static inline void stfle(uint64_t *fac, unsigned int nb_doublewords)
 {
-	register unsigned long r0 asm("0") = len - 1;
+	register unsigned long r0 asm("0") = nb_doublewords - 1;
 
 	asm volatile("	.insn	s,0xb2b00000,0(%1)\n"
 		     : "+d" (r0) : "a" (fac) : "memory", "cc");
@@ -40,9 +40,9 @@ static inline void setup_facilities(void)
 	struct lowcore *lc = NULL;
 
 	stfl();
-	memcpy(stfl_bytes, &lc->stfl, sizeof(lc->stfl));
+	memcpy(stfl_doublewords, &lc->stfl, sizeof(lc->stfl));
 	if (test_facility(7))
-		stfle(stfl_bytes, NR_STFL_BYTES);
+		stfle(stfl_doublewords, NB_STFL_DOUBLEWORDS);
 }
 
 #endif
diff --git a/lib/s390x/io.c b/lib/s390x/io.c
index e091c37..c0f0bf7 100644
--- a/lib/s390x/io.c
+++ b/lib/s390x/io.c
@@ -19,7 +19,7 @@
 #include "smp.h"
 
 extern char ipl_args[];
-uint8_t stfl_bytes[NR_STFL_BYTES] __attribute__((aligned(8)));
+uint64_t stfl_doublewords[NB_STFL_DOUBLEWORDS];
 
 static struct spinlock lock;
 
-- 
2.25.3

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

* [kvm-unit-tests PULL 07/17] s390x/smp: add minimal test for sigp sense running status
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (5 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 06/17] s390x: STFLE operates on doublewords David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 08/17] s390x: unittests: Use smp parameter David Hildenbrand
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Christian Borntraeger, Cornelia Huck, David Hildenbrand

From: Christian Borntraeger <borntraeger@de.ibm.com>

Two minimal tests:
- our own CPU should be running when we check ourselves
- a CPU should at least have some times with a not running
indication. To speed things up we stop CPU1

Also rename smp_cpu_running to smp_sense_running_status.

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20200402154441.13063-1-borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/smp.c |  2 +-
 lib/s390x/smp.h |  2 +-
 s390x/smp.c     | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index 203792a..df8dcd9 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -58,7 +58,7 @@ bool smp_cpu_stopped(uint16_t addr)
 	return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED));
 }
 
-bool smp_cpu_running(uint16_t addr)
+bool smp_sense_running_status(uint16_t addr)
 {
 	if (sigp(addr, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED)
 		return true;
diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h
index ce63a89..d66e39a 100644
--- a/lib/s390x/smp.h
+++ b/lib/s390x/smp.h
@@ -40,7 +40,7 @@ struct cpu_status {
 int smp_query_num_cpus(void);
 struct cpu *smp_cpu_from_addr(uint16_t addr);
 bool smp_cpu_stopped(uint16_t addr);
-bool smp_cpu_running(uint16_t addr);
+bool smp_sense_running_status(uint16_t addr);
 int smp_cpu_restart(uint16_t addr);
 int smp_cpu_start(uint16_t addr, struct psw psw);
 int smp_cpu_stop(uint16_t addr);
diff --git a/s390x/smp.c b/s390x/smp.c
index fa40753..1641979 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -182,6 +182,19 @@ static void test_emcall(void)
 	report_prefix_pop();
 }
 
+static void test_sense_running(void)
+{
+	report_prefix_push("sense_running");
+	/* we (CPU0) are running */
+	report(smp_sense_running_status(0), "CPU0 sense claims running");
+	/* stop the target CPU (CPU1) to speed up the not running case */
+	smp_cpu_stop(1);
+	/* Make sure to have at least one time with a not running indication */
+	while(smp_sense_running_status(1));
+	report(true, "CPU1 sense claims not running");
+	report_prefix_pop();
+}
+
 static void test_reset_initial(void)
 {
 	struct cpu_status *status = alloc_pages(0);
@@ -251,6 +264,7 @@ int main(void)
 	test_store_status();
 	test_ecall();
 	test_emcall();
+	test_sense_running();
 	test_reset();
 	test_reset_initial();
 	smp_cpu_destroy(1);
-- 
2.25.3

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

* [kvm-unit-tests PULL 08/17] s390x: unittests: Use smp parameter
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (6 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 07/17] s390x/smp: add minimal test for sigp sense running status David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 09/17] s390x: smp: Test all CRs on initial reset David Hildenbrand
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Andrew Jones, David Hildenbrand

From: Andrew Jones <drjones@redhat.com>

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20200403094015.506838-1-drjones@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/unittests.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index 535db21..b307329 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -75,7 +75,7 @@ extra_params=-name kvm-unit-test --uuid 0fb84a86-727c-11ea-bc55-0242ac130003 -sm
 
 [smp]
 file = smp.elf
-extra_params =-smp 2
+smp = 2
 
 [sclp-1g]
 file = sclp.elf
-- 
2.25.3

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

* [kvm-unit-tests PULL 09/17] s390x: smp: Test all CRs on initial reset
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (7 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 08/17] s390x: unittests: Use smp parameter David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 10/17] s390x: smp: Dirty fpc before initial reset test David Hildenbrand
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, Christian Borntraeger, David Hildenbrand

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

All CRs are set to 0 and CRs 0 and 14 are set to pre-defined values,
so we also need to test 1-13 and 15 for 0.

And while we're at it, let's also set some values to cr 1, 7 and 13, so
we can actually be sure that they will be zeroed.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200424093356.11931-1-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/smp.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/s390x/smp.c b/s390x/smp.c
index 1641979..08fa770 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -195,16 +195,28 @@ static void test_sense_running(void)
 	report_prefix_pop();
 }
 
+/* Used to dirty registers of cpu #1 before it is reset */
+static void test_func_initial(void)
+{
+	lctlg(1, 0x42000UL);
+	lctlg(7, 0x43000UL);
+	lctlg(13, 0x44000UL);
+	set_flag(1);
+}
+
 static void test_reset_initial(void)
 {
 	struct cpu_status *status = alloc_pages(0);
 	struct psw psw;
+	int i;
 
 	psw.mask = extract_psw_mask();
-	psw.addr = (unsigned long)test_func;
+	psw.addr = (unsigned long)test_func_initial;
 
 	report_prefix_push("reset initial");
+	set_flag(0);
 	smp_cpu_start(1, psw);
+	wait_for_flag();
 
 	sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL);
 	sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL);
@@ -215,6 +227,10 @@ static void test_reset_initial(void)
 	report(!status->fpc, "fpc");
 	report(!status->cputm, "cpu timer");
 	report(!status->todpr, "todpr");
+	for (i = 1; i <= 13; i++) {
+		report(status->crs[i] == 0, "cr%d == 0", i);
+	}
+	report(status->crs[15] == 0, "cr15 == 0");
 	report_prefix_pop();
 
 	report_prefix_push("initialized");
-- 
2.25.3

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

* [kvm-unit-tests PULL 10/17] s390x: smp: Dirty fpc before initial reset test
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (8 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 09/17] s390x: smp: Test all CRs on initial reset David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 11/17] s390x: smp: Test stop and store status on a running and stopped cpu David Hildenbrand
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Let's dirty the fpc, before we test if the initial reset sets it to 0.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429143518.1360468-3-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/smp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/s390x/smp.c b/s390x/smp.c
index 08fa770..bf082d1 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -198,6 +198,7 @@ static void test_sense_running(void)
 /* Used to dirty registers of cpu #1 before it is reset */
 static void test_func_initial(void)
 {
+	asm volatile("sfpc %0" :: "d" (0x11));
 	lctlg(1, 0x42000UL);
 	lctlg(7, 0x43000UL);
 	lctlg(13, 0x44000UL);
-- 
2.25.3

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

* [kvm-unit-tests PULL 11/17] s390x: smp: Test stop and store status on a running and stopped cpu
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (9 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 10/17] s390x: smp: Dirty fpc before initial reset test David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 12/17] s390x: smp: Test local interrupts after cpu reset David Hildenbrand
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Let's also test the stop portion of the "stop and store status" sigp
order.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429143518.1360468-4-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/smp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/s390x/smp.c b/s390x/smp.c
index bf082d1..57eacb2 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -76,6 +76,18 @@ static void test_stop_store_status(void)
 	struct lowcore *lc = (void *)0x0;
 
 	report_prefix_push("stop store status");
+	report_prefix_push("running");
+	smp_cpu_restart(1);
+	lc->prefix_sa = 0;
+	lc->grs_sa[15] = 0;
+	smp_cpu_stop_store_status(1);
+	mb();
+	report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix");
+	report(lc->grs_sa[15], "stack");
+	report(smp_cpu_stopped(1), "cpu stopped");
+	report_prefix_pop();
+
+	report_prefix_push("stopped");
 	lc->prefix_sa = 0;
 	lc->grs_sa[15] = 0;
 	smp_cpu_stop_store_status(1);
@@ -83,6 +95,8 @@ static void test_stop_store_status(void)
 	report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix");
 	report(lc->grs_sa[15], "stack");
 	report_prefix_pop();
+
+	report_prefix_pop();
 }
 
 static void test_store_status(void)
-- 
2.25.3

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

* [kvm-unit-tests PULL 12/17] s390x: smp: Test local interrupts after cpu reset
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (10 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 11/17] s390x: smp: Test stop and store status on a running and stopped cpu David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 13/17] s390x: smp: Loop if secondary cpu returns into cpu setup again David Hildenbrand
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Local interrupts (external and emergency call) should be cleared after
any cpu reset.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200429143518.1360468-5-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/smp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/s390x/smp.c b/s390x/smp.c
index 57eacb2..447b998 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -258,6 +258,19 @@ static void test_reset_initial(void)
 	report_prefix_pop();
 }
 
+static void test_local_ints(void)
+{
+	unsigned long mask;
+
+	/* Open masks for ecall and emcall */
+	ctl_set_bit(0, 13);
+	ctl_set_bit(0, 14);
+	mask = extract_psw_mask();
+	mask |= PSW_MASK_EXT;
+	load_psw_mask(mask);
+	set_flag(1);
+}
+
 static void test_reset(void)
 {
 	struct psw psw;
@@ -266,10 +279,18 @@ static void test_reset(void)
 	psw.addr = (unsigned long)test_func;
 
 	report_prefix_push("cpu reset");
+	sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL);
+	sigp(1, SIGP_EXTERNAL_CALL, 0, NULL);
 	smp_cpu_start(1, psw);
 
 	sigp_retry(1, SIGP_CPU_RESET, 0, NULL);
 	report(smp_cpu_stopped(1), "cpu stopped");
+
+	set_flag(0);
+	psw.addr = (unsigned long)test_local_ints;
+	smp_cpu_start(1, psw);
+	wait_for_flag();
+	report(true, "local interrupts cleared");
 	report_prefix_pop();
 }
 
-- 
2.25.3

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

* [kvm-unit-tests PULL 13/17] s390x: smp: Loop if secondary cpu returns into cpu setup again
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (11 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 12/17] s390x: smp: Test local interrupts after cpu reset David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 14/17] s390x: smp: Remove unneeded cpu loops David Hildenbrand
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Up to now a secondary cpu could have returned from the function it was
executing and ending up somewhere in cstart64.S. This was mostly
circumvented by an endless loop in the function that it executed.

Let's add a loop to the end of the cpu setup, so we don't have to rely
on added loops in the tests.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200429143518.1360468-6-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/cstart64.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index 9af6bb3..ecffbe0 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -161,7 +161,9 @@ smp_cpu_setup_state:
 	lctlg   %c0, %c0, GEN_LC_SW_INT_CRS
 	/* We should only go once through cpu setup and not for every restart */
 	stg	%r14, GEN_LC_RESTART_NEW_PSW + 8
-	br	%r14
+	brasl	%r14, %r14
+	/* If the function returns, just loop here */
+0:	j	0
 
 pgm_int:
 	SAVE_REGS
-- 
2.25.3

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

* [kvm-unit-tests PULL 14/17] s390x: smp: Remove unneeded cpu loops
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (12 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 13/17] s390x: smp: Loop if secondary cpu returns into cpu setup again David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 15/17] s390x: smp: Use full PSW to bringup new cpu David Hildenbrand
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Now that we have a loop which is executed after we return from the
main function of a secondary cpu, we can remove the surplus loops.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429143518.1360468-7-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/smp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/s390x/smp.c b/s390x/smp.c
index 447b998..f2319c4 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -35,15 +35,9 @@ static void set_flag(int val)
 	mb();
 }
 
-static void cpu_loop(void)
-{
-	for (;;) {}
-}
-
 static void test_func(void)
 {
 	set_flag(1);
-	cpu_loop();
 }
 
 static void test_start(void)
@@ -306,7 +300,7 @@ int main(void)
 
 	/* Setting up the cpu to give it a stack and lowcore */
 	psw.mask = extract_psw_mask();
-	psw.addr = (unsigned long)cpu_loop;
+	psw.addr = (unsigned long)test_func;
 	smp_cpu_setup(1, psw);
 	smp_cpu_stop(1);
 
-- 
2.25.3

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

* [kvm-unit-tests PULL 15/17] s390x: smp: Use full PSW to bringup new cpu
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (13 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 14/17] s390x: smp: Remove unneeded cpu loops David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 16/17] s390x: smp: Add restart when running test David Hildenbrand
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Up to now we ignored the psw mask and only used the psw address when
bringing up a new cpu. For DAT we need to also load the mask, so let's
do that.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429143518.1360468-8-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/smp.c  | 2 ++
 s390x/cstart64.S | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index df8dcd9..2860e9c 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -202,6 +202,8 @@ int smp_cpu_setup(uint16_t addr, struct psw psw)
 	cpu->stack = (uint64_t *)alloc_pages(2);
 
 	/* Start without DAT and any other mask bits. */
+	cpu->lowcore->sw_int_psw.mask = psw.mask;
+	cpu->lowcore->sw_int_psw.addr = psw.addr;
 	cpu->lowcore->sw_int_grs[14] = psw.addr;
 	cpu->lowcore->sw_int_grs[15] = (uint64_t)cpu->stack + (PAGE_SIZE * 4);
 	lc->restart_new_psw.mask = 0x0000000180000000UL;
diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index ecffbe0..e084f13 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -161,7 +161,8 @@ smp_cpu_setup_state:
 	lctlg   %c0, %c0, GEN_LC_SW_INT_CRS
 	/* We should only go once through cpu setup and not for every restart */
 	stg	%r14, GEN_LC_RESTART_NEW_PSW + 8
-	brasl	%r14, %r14
+	larl	%r14, 0f
+	lpswe	GEN_LC_SW_INT_PSW
 	/* If the function returns, just loop here */
 0:	j	0
 
-- 
2.25.3

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

* [kvm-unit-tests PULL 16/17] s390x: smp: Add restart when running test
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (14 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 15/17] s390x: smp: Use full PSW to bringup new cpu David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-04-30 15:24 ` [kvm-unit-tests PULL 17/17] s390x: Fix library constant definitions David Hildenbrand
  2020-05-04 16:44 ` [kvm-unit-tests PULL 00/17] s390x updates Paolo Bonzini
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Cornelia Huck, David Hildenbrand

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

Let's make sure we can restart a cpu that is already running.
Restarting it if it is stopped is implicitely tested by the the other
restart calls in the smp test.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429143518.1360468-10-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 s390x/smp.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/s390x/smp.c b/s390x/smp.c
index f2319c4..ad30e3c 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -52,6 +52,34 @@ static void test_start(void)
 	report(1, "start");
 }
 
+/*
+ * Does only test restart when the target is running.
+ * The other tests do restarts when stopped multiple times already.
+ */
+static void test_restart(void)
+{
+	struct cpu *cpu = smp_cpu_from_addr(1);
+	struct lowcore *lc = cpu->lowcore;
+
+	lc->restart_new_psw.mask = extract_psw_mask();
+	lc->restart_new_psw.addr = (unsigned long)test_func;
+
+	/* Make sure cpu is running */
+	smp_cpu_stop(0);
+	set_flag(0);
+	smp_cpu_restart(1);
+	wait_for_flag();
+
+	/*
+	 * Wait until cpu 1 has set the flag because it executed the
+	 * restart function.
+	 */
+	set_flag(0);
+	smp_cpu_restart(1);
+	wait_for_flag();
+	report(1, "restart while running");
+}
+
 static void test_stop(void)
 {
 	smp_cpu_stop(1);
@@ -305,6 +333,7 @@ int main(void)
 	smp_cpu_stop(1);
 
 	test_start();
+	test_restart();
 	test_stop();
 	test_stop_store_status();
 	test_store_status();
-- 
2.25.3

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

* [kvm-unit-tests PULL 17/17] s390x: Fix library constant definitions
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (15 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 16/17] s390x: smp: Add restart when running test David Hildenbrand
@ 2020-04-30 15:24 ` David Hildenbrand
  2020-05-04 16:44 ` [kvm-unit-tests PULL 00/17] s390x updates Paolo Bonzini
  17 siblings, 0 replies; 19+ messages in thread
From: David Hildenbrand @ 2020-04-30 15:24 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Thomas Huth, Janosch Frank, linux-s390,
	Christian Borntraeger, Cornelia Huck, David Hildenbrand

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

Seems like I uppercased the whole region instead of only the ULs when
I added those definitions. Let's make the x lowercase again.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429143518.1360468-11-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/asm/arch_def.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 15a4d49..1b3bb0c 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -19,10 +19,10 @@ struct psw {
 #define PSW_MASK_DAT			0x0400000000000000UL
 #define PSW_MASK_PSTATE			0x0001000000000000UL
 
-#define CR0_EXTM_SCLP			0X0000000000000200UL
-#define CR0_EXTM_EXTC			0X0000000000002000UL
-#define CR0_EXTM_EMGC			0X0000000000004000UL
-#define CR0_EXTM_MASK			0X0000000000006200UL
+#define CR0_EXTM_SCLP			0x0000000000000200UL
+#define CR0_EXTM_EXTC			0x0000000000002000UL
+#define CR0_EXTM_EMGC			0x0000000000004000UL
+#define CR0_EXTM_MASK			0x0000000000006200UL
 
 struct lowcore {
 	uint8_t		pad_0x0000[0x0080 - 0x0000];	/* 0x0000 */
-- 
2.25.3

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

* Re: [kvm-unit-tests PULL 00/17] s390x updates
  2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
                   ` (16 preceding siblings ...)
  2020-04-30 15:24 ` [kvm-unit-tests PULL 17/17] s390x: Fix library constant definitions David Hildenbrand
@ 2020-05-04 16:44 ` Paolo Bonzini
  17 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2020-05-04 16:44 UTC (permalink / raw)
  To: David Hildenbrand, kvm
  Cc: Thomas Huth, Janosch Frank, linux-s390, Andrew Jones,
	Christian Borntraeger, Cornelia Huck, Janosch Frank,
	Janosch Frank

On 30/04/20 17:24, David Hildenbrand wrote:
>   https://github.com/davidhildenbrand/kvm-unit-tests.git tags/s390x-2020-04-30

Pulled, thanks.

Paolo

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

end of thread, other threads:[~2020-05-04 16:45 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 15:24 [kvm-unit-tests PULL 00/17] s390x updates David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 01/17] MAINTAINERS: Add Janosch as a s390x maintainer David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 02/17] MAINTAINERS: s390x: add myself as reviewer David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 03/17] MAINTAINERS: s390x: add linux-s390 list David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 04/17] s390x: Add stsi 3.2.2 tests David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 05/17] s390x/smp: fix detection of "running" David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 06/17] s390x: STFLE operates on doublewords David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 07/17] s390x/smp: add minimal test for sigp sense running status David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 08/17] s390x: unittests: Use smp parameter David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 09/17] s390x: smp: Test all CRs on initial reset David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 10/17] s390x: smp: Dirty fpc before initial reset test David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 11/17] s390x: smp: Test stop and store status on a running and stopped cpu David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 12/17] s390x: smp: Test local interrupts after cpu reset David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 13/17] s390x: smp: Loop if secondary cpu returns into cpu setup again David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 14/17] s390x: smp: Remove unneeded cpu loops David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 15/17] s390x: smp: Use full PSW to bringup new cpu David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 16/17] s390x: smp: Add restart when running test David Hildenbrand
2020-04-30 15:24 ` [kvm-unit-tests PULL 17/17] s390x: Fix library constant definitions David Hildenbrand
2020-05-04 16:44 ` [kvm-unit-tests PULL 00/17] s390x updates Paolo Bonzini

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.