Skip to contentSkip to conversation

s390x and Travis CI updates

GIT PULL David Hildenbrand 4 participants 18 messages Nov 18, 2019 KVM

lore
Share & tools
lore
#0 lore raw

Hi Paolo,

The following changes since commit af8dfe97b47d03876041506e8b38f718914aeea4:

x86/unittests.cfg: Increase the timeout of the sieve test to 180s (2019-11-15 15:56:19 +0100)

are available in the Git repository at:

https://github.com/davidhildenbrand/kvm-unit-tests.git tags/s390x-2019-11-18

for you to fetch changes up to c71d8a9fab524269785d688eb0db7f6391b5510c:

travis.yml: Expect that at least one test succeeds (2019-11-18 10:47:27 +0100)

----------------------------------------------------------------
Cleanups and bugfixes (especially to make the tests run natively under LPAR). Travis CI improvements (e.g., x86 support, KVM support on x86_64).

----------------------------------------------------------------
Claudio Imbrenda (3):
s390x: remove redundant defines
s390x: improve error reporting for interrupts
s390x: sclp: expose ram_size and max_ram_size

Janosch Frank (4):
s390x: Use loop to save and restore fprs
s390x: Fix initial cr0 load comments
s390x: Add CR save area
s390x: Load reset psw on diag308 reset

Thomas Huth (5):
travis.yml: Re-arrange the test matrix
travis.yml: Install only the required packages for each entry in the
matrix
travis.yml: Test with KVM instead of TCG (on x86) travis.yml: Test the i386 build, too
travis.yml: Expect that at least one test succeeds

 .travis.yml              | 156 ++++++++++++++++++++++++++-------------
 lib/s390x/asm-offsets.c  |   3 +-
 lib/s390x/asm/arch_def.h |   6 +-
 lib/s390x/interrupt.c    |   8 +-
 lib/s390x/sclp.c         |  10 +++
 lib/s390x/sclp.h         |   4 +-
 lib/s390x/smp.c          |   2 +-
 s390x/cstart64.S         |  76 ++++++++-----------
 8 files changed, 158 insertions(+), 107 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

[kvm-unit-tests PULL 01/12] s390x: Use loop to save and restore fprs

From: Janosch Frank <[email protected]>

Let's save some lines in the assembly by using a loop to save and restore the fprs.

Message-Id: <[email protected]>

---
 s390x/cstart64.S | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)
s390x/cstart64.S +6 -32
index 5dc1577..8e2b21e 100644
@@ -99,44 +99,18 @@ memsetxc:
 	lctlg	%c0, %c0, 0(%r1)
 	/* save fprs 0-15 + fpc */
 	la	%r1, GEN_LC_SW_INT_FPRS
-	std	%f0, 0(%r1)
-	std	%f1, 8(%r1)
-	std	%f2, 16(%r1)
-	std	%f3, 24(%r1)
-	std	%f4, 32(%r1)
-	std	%f5, 40(%r1)
-	std	%f6, 48(%r1)
-	std	%f7, 56(%r1)
-	std	%f8, 64(%r1)
-	std	%f9, 72(%r1)
-	std	%f10, 80(%r1)
-	std	%f11, 88(%r1)
-	std	%f12, 96(%r1)
-	std	%f13, 104(%r1)
-	std	%f14, 112(%r1)
-	std	%f15, 120(%r1)
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	std	\i, \i * 8(%r1)
+	.endr
 	stfpc	GEN_LC_SW_INT_FPC
 	.endm
 
 	.macro RESTORE_REGS
 	/* restore fprs 0-15 + fpc */
 	la	%r1, GEN_LC_SW_INT_FPRS
-	ld	%f0, 0(%r1)
-	ld	%f1, 8(%r1)
-	ld	%f2, 16(%r1)
-	ld	%f3, 24(%r1)
-	ld	%f4, 32(%r1)
-	ld	%f5, 40(%r1)
-	ld	%f6, 48(%r1)
-	ld	%f7, 56(%r1)
-	ld	%f8, 64(%r1)
-	ld	%f9, 72(%r1)
-	ld	%f10, 80(%r1)
-	ld	%f11, 88(%r1)
-	ld	%f12, 96(%r1)
-	ld	%f13, 104(%r1)
-	ld	%f14, 112(%r1)
-	ld	%f15, 120(%r1)
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	ld	\i, \i * 8(%r1)
+	.endr
 	lfpc	GEN_LC_SW_INT_FPC
 	/* restore cr0 */
 	lctlg	%c0, %c0, GEN_LC_SW_INT_CR0
Signature · 1 line
2.21.0
#2 lore raw

[kvm-unit-tests PULL 02/12] s390x: remove redundant defines

In reply to David Hildenbrand

From: Claudio Imbrenda <[email protected]>

Message-Id: <[email protected]>

---
 lib/s390x/sclp.h | 2 --
 1 file changed, 2 deletions(-)
lib/s390x/sclp.h +0 -2
index 4e69845..f00c3df 100644
@@ -27,8 +27,6 @@
 #define SCLP_ASSIGN_STORAGE                     0x000D0001
 #define SCLP_CMD_READ_EVENT_DATA                0x00770005
 #define SCLP_CMD_WRITE_EVENT_DATA               0x00760005
-#define SCLP_CMD_READ_EVENT_DATA                0x00770005
-#define SCLP_CMD_WRITE_EVENT_DATA               0x00760005
 #define SCLP_CMD_WRITE_EVENT_MASK               0x00780005
 
 /* SCLP Memory hotplug codes */
Signature · 1 line
2.21.0
#3 lore raw

[kvm-unit-tests PULL 03/12] s390x: improve error reporting for interrupts

In reply to David Hildenbrand

From: Claudio Imbrenda <[email protected]>

Improve error reporting for unexpected external interrupts to also print the received external interrupt code.

Message-Id: <[email protected]>

---
 lib/s390x/interrupt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/s390x/interrupt.c +2 -2
index 5cade23..1636207 100644
@@ -118,8 +118,8 @@ void handle_ext_int(void)
 {
 	if (!ext_int_expected &&
 	    lc->ext_int_code != EXT_IRQ_SERVICE_SIG) {
-		report_abort("Unexpected external call interrupt: at %#lx",
-			     lc->ext_old_psw.addr);
+		report_abort("Unexpected external call interrupt (code %#x): at %#lx",
+			     lc->ext_int_code, lc->ext_old_psw.addr);
 		return;
 	}
 
Signature · 1 line
2.21.0
#4 lore raw

[kvm-unit-tests PULL 04/12] s390x: sclp: expose ram_size and max_ram_size

In reply to David Hildenbrand

From: Claudio Imbrenda <[email protected]>

Expose ram_size and max_ram_size through accessor functions.

We only use get_ram_size in an upcoming patch, but having an accessor for the other one does not hurt.

Message-Id: <[email protected]>

---
 lib/s390x/sclp.c | 10 ++++++++++
 lib/s390x/sclp.h |  2 ++
 2 files changed, 12 insertions(+)
lib/s390x/sclp.c +10 -0
index 56fca0c..7798f04 100644
@@ -167,3 +167,13 @@ void sclp_memory_setup(void)
 
 	mem_init(ram_size);
 }
+
+uint64_t get_ram_size(void)
+{
+	return ram_size;
+}
+
+uint64_t get_max_ram_size(void)
+{
+	return max_ram_size;
+}
lib/s390x/sclp.h +2 -0
index f00c3df..6d40fb7 100644
@@ -272,5 +272,7 @@ void sclp_console_setup(void);
 void sclp_print(const char *str);
 int sclp_service_call(unsigned int command, void *sccb);
 void sclp_memory_setup(void);
+uint64_t get_ram_size(void);
+uint64_t get_max_ram_size(void);
 
 #endif /* SCLP_H */
Signature · 1 line
2.21.0
#5 lore raw

[kvm-unit-tests PULL 05/12] s390x: Fix initial cr0 load comments

In reply to David Hildenbrand

From: Janosch Frank <[email protected]>

We need to load cr0 to have access to all fprs during save and restore of fprs. Saving conditionally on basis of the CR0 AFP bit would be a pain.

Message-Id: <[email protected]>

---
 s390x/cstart64.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
s390x/cstart64.S +2 -2
index 8e2b21e..043e34a 100644
@@ -94,7 +94,7 @@ memsetxc:
 	stmg	%r0, %r15, GEN_LC_SW_INT_GRS
 	/* save cr0 */
 	stctg	%c0, %c0, GEN_LC_SW_INT_CR0
-	/* load initial cr0 again */
+	/* load a cr0 that has the AFP control bit which enables all FPRs */
 	larl	%r1, initial_cr0
 	lctlg	%c0, %c0, 0(%r1)
 	/* save fprs 0-15 + fpc */
@@ -139,7 +139,7 @@ diag308_load_reset:
 	xgr	%r2, %r2
 	br	%r14
 	/* Success path */
-	/* We lost cr0 due to the reset */
+	/* load a cr0 that has the AFP control bit which enables all FPRs */
 0:	larl	%r1, initial_cr0
 	lctlg	%c0, %c0, 0(%r1)
 	RESTORE_REGS
Signature · 1 line
2.21.0
#6 lore raw

[kvm-unit-tests PULL 06/12] s390x: Add CR save area

In reply to David Hildenbrand

From: Janosch Frank <[email protected]>

If we run with DAT enabled and do a reset, we need to save the CRs to backup our ASCEs on a diag308 for example.

Message-Id: <[email protected]>

---
 lib/s390x/asm-offsets.c  |  2 +-
 lib/s390x/asm/arch_def.h |  4 ++--
 lib/s390x/interrupt.c    |  4 ++--
 lib/s390x/smp.c          |  2 +-
 s390x/cstart64.S         | 10 +++++-----
 5 files changed, 11 insertions(+), 11 deletions(-)
lib/s390x/asm-offsets.c +1 -1
index 6e2d259..4b213f8 100644
@@ -57,7 +57,7 @@ int main(void)
 	OFFSET(GEN_LC_SW_INT_GRS, lowcore, sw_int_grs);
 	OFFSET(GEN_LC_SW_INT_FPRS, lowcore, sw_int_fprs);
 	OFFSET(GEN_LC_SW_INT_FPC, lowcore, sw_int_fpc);
-	OFFSET(GEN_LC_SW_INT_CR0, lowcore, sw_int_cr0);
+	OFFSET(GEN_LC_SW_INT_CRS, lowcore, sw_int_crs);
 	OFFSET(GEN_LC_MCCK_EXT_SA_ADDR, lowcore, mcck_ext_sa_addr);
 	OFFSET(GEN_LC_FPRS_SA, lowcore, fprs_sa);
 	OFFSET(GEN_LC_GRS_SA, lowcore, grs_sa);
lib/s390x/asm/arch_def.h +2 -2
index 96cca2e..07d4e5e 100644
@@ -78,8 +78,8 @@ struct lowcore {
 	uint64_t	sw_int_fprs[16];		/* 0x0280 */
 	uint32_t	sw_int_fpc;			/* 0x0300 */
 	uint8_t		pad_0x0304[0x0308 - 0x0304];	/* 0x0304 */
-	uint64_t	sw_int_cr0;			/* 0x0308 */
-	uint8_t		pad_0x0310[0x11b0 - 0x0310];	/* 0x0310 */
+	uint64_t	sw_int_crs[16];			/* 0x0308 */
+	uint8_t		pad_0x0310[0x11b0 - 0x0388];	/* 0x0388 */
 	uint64_t	mcck_ext_sa_addr;		/* 0x11b0 */
 	uint8_t		pad_0x11b8[0x1200 - 0x11b8];	/* 0x11b8 */
 	uint64_t	fprs_sa[16];			/* 0x1200 */
lib/s390x/interrupt.c +2 -2
index 1636207..3e07867 100644
@@ -124,13 +124,13 @@ void handle_ext_int(void)
 	}
 
 	if (lc->ext_int_code == EXT_IRQ_SERVICE_SIG) {
-		lc->sw_int_cr0 &= ~(1UL << 9);
+		lc->sw_int_crs[0] &= ~(1UL << 9);
 		sclp_handle_ext();
 	} else {
 		ext_int_expected = false;
 	}
 
-	if (!(lc->sw_int_cr0 & CR0_EXTM_MASK))
+	if (!(lc->sw_int_crs[0] & CR0_EXTM_MASK))
 		lc->ext_old_psw.mask &= ~PSW_MASK_EXT;
 }
 
lib/s390x/smp.c +1 -1
index 7602886..f57f420 100644
@@ -189,7 +189,7 @@ int smp_cpu_setup(uint16_t addr, struct psw psw)
 	cpu->lowcore->sw_int_grs[15] = (uint64_t)cpu->stack + (PAGE_SIZE * 4);
 	lc->restart_new_psw.mask = 0x0000000180000000UL;
 	lc->restart_new_psw.addr = (uint64_t)smp_cpu_setup_state;
-	lc->sw_int_cr0 = 0x0000000000040000UL;
+	lc->sw_int_crs[0] = 0x0000000000040000UL;
 
 	/* Start processing */
 	rc = sigp_retry(cpu->addr, SIGP_RESTART, 0, NULL);
s390x/cstart64.S +5 -5
index 043e34a..4be20fc 100644
@@ -92,8 +92,8 @@ memsetxc:
 	.macro SAVE_REGS
 	/* save grs 0-15 */
 	stmg	%r0, %r15, GEN_LC_SW_INT_GRS
-	/* save cr0 */
-	stctg	%c0, %c0, GEN_LC_SW_INT_CR0
+	/* save crs 0-15 */
+	stctg	%c0, %c15, GEN_LC_SW_INT_CRS
 	/* load a cr0 that has the AFP control bit which enables all FPRs */
 	larl	%r1, initial_cr0
 	lctlg	%c0, %c0, 0(%r1)
@@ -112,8 +112,8 @@ memsetxc:
 	ld	\i, \i * 8(%r1)
 	.endr
 	lfpc	GEN_LC_SW_INT_FPC
-	/* restore cr0 */
-	lctlg	%c0, %c0, GEN_LC_SW_INT_CR0
+	/* restore crs 0-15 */
+	lctlg	%c0, %c15, GEN_LC_SW_INT_CRS
 	/* restore grs 0-15 */
 	lmg	%r0, %r15, GEN_LC_SW_INT_GRS
 	.endm
@@ -150,7 +150,7 @@ diag308_load_reset:
 smp_cpu_setup_state:
 	xgr	%r1, %r1
 	lmg     %r0, %r15, GEN_LC_SW_INT_GRS
-	lctlg   %c0, %c0, GEN_LC_SW_INT_CR0
+	lctlg   %c0, %c0, GEN_LC_SW_INT_CRS
 	br	%r14
 
 pgm_int:
Signature · 1 line
2.21.0
#7 lore raw

[kvm-unit-tests PULL 08/12] travis.yml: Re-arrange the test matrix

In reply to David Hildenbrand

From: Thomas Huth <[email protected]>

We will soon need more control over the individual test matrix entries, so we should not limit the matrix to "env" sections, i.e. put the "matrix:" keyword on the top, not the "env:".

Message-Id: <[email protected]>

---
 .travis.yml | 92 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 56 insertions(+), 36 deletions(-)
.travis.yml +56 -36
index 6c14953..611bbdc 100644
@@ -16,44 +16,64 @@ addons:
       - qemu-system
 git:
   submodules: false
-env:
-  matrix:
-    - CONFIG=""
-      BUILD_DIR="."
-      TESTS="vmexit_cpuid vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ipi
+
+matrix:
+  include:
+    - env:
+      - CONFIG=""
+      - BUILD_DIR="."
+      - TESTS="vmexit_cpuid vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ipi
              vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed"
-    - CONFIG=""
-      BUILD_DIR="x86-builddir"
-      TESTS="ioapic-split ioapic smptest smptest3 eventinj msr port80 syscall
+
+    - env:
+      - CONFIG=""
+      - BUILD_DIR="x86-builddir"
+      - TESTS="ioapic-split ioapic smptest smptest3 eventinj msr port80 syscall
              tsc rmap_chain umip intel_iommu vmexit_inl_pmtimer vmexit_ipi_halt"
-    - CONFIG="--arch=arm --cross-prefix=arm-linux-gnueabihf-"
-      BUILD_DIR="."
-      TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
-    - CONFIG="--arch=arm --cross-prefix=arm-linux-gnueabihf-"
-      BUILD_DIR="arm-buildir"
-      TESTS="pci-test pmu gicv2-active gicv3-active psci selftest-setup"
-    - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
-      BUILD_DIR="."
-      TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
-    - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
-      BUILD_DIR="arm64-buildir"
-      TESTS="pci-test pmu gicv2-active gicv3-active psci timer selftest-setup"
-    - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
-      BUILD_DIR="."
-      TESTS="spapr_hcall emulator rtas-set-time-of-day"
-      ACCEL="tcg,cap-htm=off"
-    - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
-      BUILD_DIR="ppc64le-buildir"
-      TESTS="rtas-get-time-of-day rtas-get-time-of-day-base"
-      ACCEL="tcg,cap-htm=off"
-    - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
-      BUILD_DIR="."
-      TESTS="diag10 diag308"
-      ACCEL="tcg,firmware=s390x/run"
-    - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
-      BUILD_DIR="s390x-builddir"
-      TESTS="sieve"
-      ACCEL="tcg,firmware=s390x/run"
+
+    - env:
+      - CONFIG="--arch=arm --cross-prefix=arm-linux-gnueabihf-"
+      - BUILD_DIR="."
+      - TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
+
+    - env:
+      - CONFIG="--arch=arm --cross-prefix=arm-linux-gnueabihf-"
+      - BUILD_DIR="arm-buildir"
+      - TESTS="pci-test pmu gicv2-active gicv3-active psci selftest-setup"
+
+    - env:
+      - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
+      - BUILD_DIR="."
+      - TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
+
+    - env:
+      - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
+      - BUILD_DIR="arm64-buildir"
+      - TESTS="pci-test pmu gicv2-active gicv3-active psci timer selftest-setup"
+
+    - env:
+      - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
+      - BUILD_DIR="."
+      - TESTS="spapr_hcall emulator rtas-set-time-of-day"
+      - ACCEL="tcg,cap-htm=off"
+
+    - env:
+      - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
+      - BUILD_DIR="ppc64le-buildir"
+      - TESTS="rtas-get-time-of-day rtas-get-time-of-day-base"
+      - ACCEL="tcg,cap-htm=off"
+
+    - env:
+      - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
+      - BUILD_DIR="."
+      - TESTS="diag10 diag308"
+      - ACCEL="tcg,firmware=s390x/run"
+
+    - env:
+      - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
+      - BUILD_DIR="s390x-builddir"
+      - TESTS="sieve"
+      - ACCEL="tcg,firmware=s390x/run"
 
 before_script:
   - mkdir -p $BUILD_DIR && cd $BUILD_DIR
Signature · 1 line
2.21.0
#8 lore raw

[kvm-unit-tests PULL 09/12] travis.yml: Install only the required packages for each entry in the matrix

In reply to David Hildenbrand

From: Thomas Huth <[email protected]>

We don't need all cross compiler and QEMU versions for each and every entry in the test matrix, only the ones for the current target architecture. So let's speed up the installation process a little bit by only installing the packages that we really need.

Message-Id: <[email protected]>

---
 .travis.yml | 53 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 22 deletions(-)
.travis.yml +31 -22
index 611bbdc..3f5b5ee 100644
@@ -1,75 +1,84 @@
 sudo: false
 dist: bionic
 language: c
-compiler:
-  - gcc
 cache: ccache
-addons:
-  apt:
-    packages:
-      # Cross Toolchains
-      - gcc-arm-linux-gnueabihf
-      - gcc-aarch64-linux-gnu
-      - gcc-powerpc64le-linux-gnu
-      - gcc-s390x-linux-gnu
-      # Run dependencies
-      - qemu-system
 git:
   submodules: false
 
 matrix:
   include:
-    - env:
+
+    - addons:
+        apt_packages: gcc qemu-system-x86
+      env:
       - CONFIG=""
       - BUILD_DIR="."
       - TESTS="vmexit_cpuid vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ipi
              vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed"
 
-    - env:
+    - addons:
+        apt_packages: gcc qemu-system-x86
+      env:
       - CONFIG=""
       - BUILD_DIR="x86-builddir"
       - TESTS="ioapic-split ioapic smptest smptest3 eventinj msr port80 syscall
              tsc rmap_chain umip intel_iommu vmexit_inl_pmtimer vmexit_ipi_halt"
 
-    - env:
+    - addons:
+        apt_packages: gcc-arm-linux-gnueabihf qemu-system-arm
+      env:
       - CONFIG="--arch=arm --cross-prefix=arm-linux-gnueabihf-"
       - BUILD_DIR="."
       - TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
 
-    - env:
+    - addons:
+        apt_packages: gcc-arm-linux-gnueabihf qemu-system-arm
+      env:
       - CONFIG="--arch=arm --cross-prefix=arm-linux-gnueabihf-"
       - BUILD_DIR="arm-buildir"
       - TESTS="pci-test pmu gicv2-active gicv3-active psci selftest-setup"
 
-    - env:
+    - addons:
+        apt_packages: gcc-aarch64-linux-gnu qemu-system-aarch64
+      env:
       - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
       - BUILD_DIR="."
       - TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
 
-    - env:
+    - addons:
+        apt_packages: gcc-aarch64-linux-gnu qemu-system-aarch64
+      env:
       - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
       - BUILD_DIR="arm64-buildir"
       - TESTS="pci-test pmu gicv2-active gicv3-active psci timer selftest-setup"
 
-    - env:
+    - addons:
+        apt_packages: gcc-powerpc64le-linux-gnu qemu-system-ppc
+      env:
       - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
       - BUILD_DIR="."
       - TESTS="spapr_hcall emulator rtas-set-time-of-day"
       - ACCEL="tcg,cap-htm=off"
 
-    - env:
+    - addons:
+        apt_packages: gcc-powerpc64le-linux-gnu qemu-system-ppc
+      env:
       - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
       - BUILD_DIR="ppc64le-buildir"
       - TESTS="rtas-get-time-of-day rtas-get-time-of-day-base"
       - ACCEL="tcg,cap-htm=off"
 
-    - env:
+    - addons:
+        apt_packages: gcc-s390x-linux-gnu qemu-system-s390x
+      env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="."
       - TESTS="diag10 diag308"
       - ACCEL="tcg,firmware=s390x/run"
 
-    - env:
+    - addons:
+        apt_packages: gcc-s390x-linux-gnu qemu-system-s390x
+      env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="s390x-builddir"
       - TESTS="sieve"
Signature · 1 line
2.21.0
#9 lore raw

[kvm-unit-tests PULL 10/12] travis.yml: Test with KVM instead of TCG (on x86)

In reply to David Hildenbrand

From: Thomas Huth <[email protected]>

Travis nowadays supports KVM in their CI pipelines, so we can finally run the kvm-unit-tests with KVM instead of TCG here. Unfortunately, there are some quirks:

First, /dev/kvm is not accessible on Ubuntu by default. You have to be "root" or in the "kvm" group to access it. But changing the group of the current user is not taking into account for the current shell process, so that would need some indirections in the yml file. Thus the yml script now rather changes the group and "g+s" permission of the qemu binary instead.

Second, not all x86 tests are working in this environment, so we still have to manually select the test set here (but the amount of tests is definitely higher now than what we were able to run with TCG before).

Message-Id: <[email protected]>

---
 .travis.yml | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
.travis.yml +14 -5
index 3f5b5ee..89c50fe 100644
@@ -1,4 +1,4 @@
-sudo: false
+sudo: true
 dist: bionic
 language: c
 cache: ccache
@@ -13,16 +13,21 @@ matrix:
       env:
       - CONFIG=""
       - BUILD_DIR="."
-      - TESTS="vmexit_cpuid vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ipi
-             vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed"
+      - TESTS="access asyncpf debug emulator ept hypercall hyperv_stimer
+               hyperv_synic idt_test intel_iommu ioapic ioapic-split
+               kvmclock_test msr pcid rdpru realmode rmap_chain s3 umip"
+      - ACCEL="kvm"
 
     - addons:
         apt_packages: gcc qemu-system-x86
       env:
       - CONFIG=""
       - BUILD_DIR="x86-builddir"
-      - TESTS="ioapic-split ioapic smptest smptest3 eventinj msr port80 syscall
-             tsc rmap_chain umip intel_iommu vmexit_inl_pmtimer vmexit_ipi_halt"
+      - TESTS="smptest smptest3 tsc tsc_adjust xsave vmexit_cpuid vmexit_vmcall
+               sieve vmexit_inl_pmtimer vmexit_ipi_halt vmexit_mov_from_cr8
+               vmexit_mov_to_cr8 vmexit_ple_round_robin vmexit_tscdeadline
+               vmexit_tscdeadline_immed  vmx_apic_passthrough_thread syscall"
+      - ACCEL="kvm"
 
     - addons:
         apt_packages: gcc-arm-linux-gnueabihf qemu-system-arm
@@ -85,6 +90,10 @@ matrix:
       - ACCEL="tcg,firmware=s390x/run"
 
 before_script:
+  - if [ "$ACCEL" = "kvm" ]; then
+      sudo chgrp kvm /usr/bin/qemu-system-* ;
+      sudo chmod g+s /usr/bin/qemu-system-* ;
+    fi
   - mkdir -p $BUILD_DIR && cd $BUILD_DIR
   - if [ -e ./configure ]; then ./configure $CONFIG ; fi
   - if [ -e ../configure ]; then ../configure $CONFIG ; fi
Signature · 1 line
2.21.0
#10 lore raw

[kvm-unit-tests PULL 07/12] s390x: Load reset psw on diag308 reset

In reply to David Hildenbrand

From: Janosch Frank <[email protected]>

On a diag308 subcode 0 CRs will be reset, so we need a PSW mask without DAT. Also we need to set the short psw indication to be compliant with the architecture.

Let's therefore define a reset PSW mask with 64 bit addressing and short PSW indication that is compliant with architecture and use it.

Message-Id: <[email protected]>

---
 lib/s390x/asm-offsets.c  |  1 +
 lib/s390x/asm/arch_def.h |  4 +++-
 s390x/cstart64.S         | 24 +++++++++++++++++-------
 3 files changed, 21 insertions(+), 8 deletions(-)
lib/s390x/asm-offsets.c +1 -0
index 4b213f8..61d2658 100644
@@ -58,6 +58,7 @@ int main(void)
 	OFFSET(GEN_LC_SW_INT_FPRS, lowcore, sw_int_fprs);
 	OFFSET(GEN_LC_SW_INT_FPC, lowcore, sw_int_fpc);
 	OFFSET(GEN_LC_SW_INT_CRS, lowcore, sw_int_crs);
+	OFFSET(GEN_LC_SW_INT_PSW, lowcore, sw_int_psw);
 	OFFSET(GEN_LC_MCCK_EXT_SA_ADDR, lowcore, mcck_ext_sa_addr);
 	OFFSET(GEN_LC_FPRS_SA, lowcore, fprs_sa);
 	OFFSET(GEN_LC_GRS_SA, lowcore, grs_sa);
lib/s390x/asm/arch_def.h +3 -1
index 07d4e5e..cf6e1ca 100644
@@ -79,7 +79,8 @@ struct lowcore {
 	uint32_t	sw_int_fpc;			/* 0x0300 */
 	uint8_t		pad_0x0304[0x0308 - 0x0304];	/* 0x0304 */
 	uint64_t	sw_int_crs[16];			/* 0x0308 */
-	uint8_t		pad_0x0310[0x11b0 - 0x0388];	/* 0x0388 */
+	struct psw	sw_int_psw;			/* 0x0388 */
+	uint8_t		pad_0x0310[0x11b0 - 0x0398];	/* 0x0398 */
 	uint64_t	mcck_ext_sa_addr;		/* 0x11b0 */
 	uint8_t		pad_0x11b8[0x1200 - 0x11b8];	/* 0x11b8 */
 	uint64_t	fprs_sa[16];			/* 0x1200 */
@@ -98,6 +99,7 @@ struct lowcore {
 	uint8_t		pad_0x1400[0x1800 - 0x1400];	/* 0x1400 */
 	uint8_t		pgm_int_tdb[0x1900 - 0x1800];	/* 0x1800 */
 } __attribute__ ((__packed__));
+_Static_assert(sizeof(struct lowcore) == 0x1900, "Lowcore size");
 
 #define PGM_INT_CODE_OPERATION			0x01
 #define PGM_INT_CODE_PRIVILEGED_OPERATION	0x02
s390x/cstart64.S +17 -7
index 4be20fc..86dd4c4 100644
@@ -126,13 +126,18 @@ memsetxc:
 .globl diag308_load_reset
 diag308_load_reset:
 	SAVE_REGS
-	/* Save the first PSW word to the IPL PSW */
+	/* Backup current PSW mask, as we have to restore it on success */
 	epsw	%r0, %r1
-	st	%r0, 0
-	/* Store the address and the bit for 31 bit addressing */
-	larl    %r0, 0f
-	oilh    %r0, 0x8000
-	st      %r0, 0x4
+	st	%r0, GEN_LC_SW_INT_PSW
+	st	%r1, GEN_LC_SW_INT_PSW + 4
+	/* Load reset psw mask (short psw, 64 bit) */
+	lg	%r0, reset_psw
+	/* Load the success label address */
+	larl    %r1, 0f
+	/* Or it to the mask */
+	ogr	%r0, %r1
+	/* Store it at the reset PSW location (real 0x0) */
+	stg	%r0, 0
 	/* Do the reset */
 	diag    %r0,%r2,0x308
 	/* Failure path */
@@ -144,7 +149,10 @@ diag308_load_reset:
 	lctlg	%c0, %c0, 0(%r1)
 	RESTORE_REGS
 	lhi	%r2, 1
-	br	%r14
+	larl	%r0, 1f
+	stg	%r0, GEN_LC_SW_INT_PSW + 8
+	lpswe	GEN_LC_SW_INT_PSW
+1:	br	%r14
 
 .globl smp_cpu_setup_state
 smp_cpu_setup_state:
@@ -184,6 +192,8 @@ svc_int:
 	lpswe	GEN_LC_SVC_OLD_PSW
 
 	.align	8
+reset_psw:
+	.quad	0x0008000180000000
 initial_psw:
 	.quad	0x0000000180000000, clear_bss_start
 pgm_int_psw:
Signature · 1 line
2.21.0
#11 lore raw

[kvm-unit-tests PULL 12/12] travis.yml: Expect that at least one test succeeds

In reply to David Hildenbrand

From: Thomas Huth <[email protected]>

While working on the travis.yml file, I've run into cases where all tests are reported as "SKIP" by the run_test.sh script (e.g. when QEMU could not be started). This should not result in a successful test run, so mark it as failed if not at least one test passed.

Message-Id: <[email protected]>

---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)
.travis.yml +1 -0
index 6858c3a..4162366 100644
@@ -116,3 +116,4 @@ script:
   - make -j3
   - ACCEL="${ACCEL:-tcg}" ./run_tests.sh -v $TESTS | tee results.txt
   - if grep -q FAIL results.txt ; then exit 1 ; fi
+  - if ! grep -q PASS results.txt ; then exit 1 ; fi
Signature · 1 line
2.21.0
#12 lore raw

[kvm-unit-tests PULL 11/12] travis.yml: Test the i386 build, too

In reply to David Hildenbrand

From: Thomas Huth <[email protected]>

After installing gcc-multilib, we can also test the 32-bit builds on Travis.

Message-Id: <[email protected]>

---
 .travis.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
.travis.yml +15 -0
index 89c50fe..6858c3a 100644
@@ -29,6 +29,21 @@ matrix:
                vmexit_tscdeadline_immed  vmx_apic_passthrough_thread syscall"
       - ACCEL="kvm"
 
+    - addons:
+        apt_packages: gcc gcc-multilib qemu-system-x86
+      env:
+      - CONFIG="--arch=i386"
+      - BUILD_DIR="."
+      - TESTS="eventinj port80 sieve tsc taskswitch umip vmexit_ple_round_robin"
+
+    - addons:
+        apt_packages: gcc gcc-multilib qemu-system-x86
+      env:
+      - CONFIG="--arch=i386"
+      - BUILD_DIR="i386-builddir"
+      - TESTS="vmexit_mov_from_cr8 vmexit_ipi vmexit_ipi_halt vmexit_mov_to_cr8
+               vmexit_cpuid vmexit_tscdeadline vmexit_tscdeadline_immed"
+
     - addons:
         apt_packages: gcc-arm-linux-gnueabihf qemu-system-arm
       env:
Signature · 1 line
2.21.0
#14 lore raw
In reply to David Hildenbrand

For what its worth (maybe a future patch) travis has now alpha s390x build support
https://docs.travis-ci.com/user/multi-cpu-architectures

I think the number of instances for s390 is still limited, but it works for open source software.

Quoted 48 lines · David Hildenbrand

Hi Paolo,

The following changes since commit af8dfe97b47d03876041506e8b38f718914aeea4:

x86/unittests.cfg: Increase the timeout of the sieve test to 180s (2019-11-15 15:56:19 +0100)

are available in the Git repository at:

https://github.com/davidhildenbrand/kvm-unit-tests.git tags/s390x-2019-11-18

for you to fetch changes up to c71d8a9fab524269785d688eb0db7f6391b5510c:

travis.yml: Expect that at least one test succeeds (2019-11-18 10:47:27 +0100)

----------------------------------------------------------------
Cleanups and bugfixes (especially to make the tests run natively under LPAR). Travis CI improvements (e.g., x86 support, KVM support on x86_64).

----------------------------------------------------------------
Claudio Imbrenda (3):
s390x: remove redundant defines
s390x: improve error reporting for interrupts
s390x: sclp: expose ram_size and max_ram_size

Janosch Frank (4):
s390x: Use loop to save and restore fprs
s390x: Fix initial cr0 load comments
s390x: Add CR save area
s390x: Load reset psw on diag308 reset

Thomas Huth (5):
travis.yml: Re-arrange the test matrix
travis.yml: Install only the required packages for each entry in the
matrix
travis.yml: Test with KVM instead of TCG (on x86) travis.yml: Test the i386 build, too
travis.yml: Expect that at least one test succeeds

 .travis.yml              | 156 ++++++++++++++++++++++++++-------------
 lib/s390x/asm-offsets.c  |   3 +-
 lib/s390x/asm/arch_def.h |   6 +-
 lib/s390x/interrupt.c    |   8 +-
 lib/s390x/sclp.c         |  10 +++
 lib/s390x/sclp.h         |   4 +-
 lib/s390x/smp.c          |   2 +-
 s390x/cstart64.S         |  76 ++++++++-----------
 8 files changed, 158 insertions(+), 107 deletions(-)
#15 lore raw
Quoted 5 lines · Christian Borntraeger

For what its worth (maybe a future patch) travis has now alpha s390x build support
https://docs.travis-ci.com/user/multi-cpu-architectures

I think the number of instances for s390 is still limited, but it works for open source software.

I already tried that... Unfortunately the LXD containers that they use on s390x (and ppc64 and arm64) are rather limited - you can't use KVM here on Travis, unlike with x86.

So the only advantage of adding a s390x build here is that we'd check native builds instead of using the cross compiler... not sure whether that gives us that much more of test coverage for the kvm-unit-tests...

Thomas

#16 lore raw
Quoted 7 lines · Thomas Huth
Quoted 5 lines · Christian Borntraeger

For what its worth (maybe a future patch) travis has now alpha s390x build support
https://docs.travis-ci.com/user/multi-cpu-architectures

I think the number of instances for s390 is still limited, but it works for open source software.

Quoted 7 lines

I already tried that... Unfortunately the LXD containers that they use on s390x (and ppc64 and arm64) are rather limited - you can't use KVM here on Travis, unlike with x86.

So the only advantage of adding a s390x build here is that we'd check native builds instead of using the cross compiler... not sure whether that gives us that much more of test coverage for the kvm-unit-tests...

Right. It might be more useful for the qemu travis build?

#17 lore raw
Quoted 14 lines · Christian Borntraeger
Quoted 11 lines · Thomas Huth
Quoted 5 lines · Christian Borntraeger

For what its worth (maybe a future patch) travis has now alpha s390x build support
https://docs.travis-ci.com/user/multi-cpu-architectures

I think the number of instances for s390 is still limited, but it works for open source software.

I already tried that... Unfortunately the LXD containers that they use on s390x (and ppc64 and arm64) are rather limited - you can't use KVM here on Travis, unlike with x86.

Quoted 5 lines
Quoted 3 lines

So the only advantage of adding a s390x build here is that we'd check native builds instead of using the cross compiler... not sure whether that gives us that much more of test coverage for the kvm-unit-tests...

Right. It might be more useful for the qemu travis build?

Yes, it might be useful for QEMU. But there are some issues to be solved first, e.g. some tests of QEMU are failing there in very weird ways (I guess it's because some system calls are blocked in the LXD container).

Thomas