Message ID | b69367a6-7744-6dbf-c370-3019bd66965c@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3,1/3] s390x/tcg: Implement Miscellaneous-Instruction-Extensions Facility 3 for the s390x | expand |
On 15.02.22 21:27, David Miller wrote: > tests/tcg/s390x/mie3-compl.c: [N]*K instructions > tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction > tests/tcg/s390x/mie3-sel.c: SELECT instruction > > Signed-off-by: David Miller <dmiller423@gmail.com> > --- > tests/tcg/s390x/Makefile.target | 2 +- > tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ > tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ > tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ > 4 files changed, 130 insertions(+), 1 deletion(-) > create mode 100644 tests/tcg/s390x/mie3-compl.c > create mode 100644 tests/tcg/s390x/mie3-mvcrl.c > create mode 100644 tests/tcg/s390x/mie3-sel.c > > diff --git a/tests/tcg/s390x/Makefile.target > b/tests/tcg/s390x/Makefile.target > index 1a7238b4eb..16b9d45307 100644 > --- a/tests/tcg/s390x/Makefile.target > +++ b/tests/tcg/s390x/Makefile.target > @@ -1,6 +1,6 @@ > S390X_SRC=$(SRC_PATH)/tests/tcg/s390x > VPATH+=$(S390X_SRC) > -CFLAGS+=-march=zEC12 -m64 > +CFLAGS+=-march=z15 -m64 Unfortunately, this makes our docker builds unhappy -- fail. I assume the compiler in the container is outdated. $ make run-tcg-tests-s390x-linux-user changing dir to build for make "run-tcg-tests-s390x-linux-user"... make[1]: Entering directory '/home/dhildenb/git/qemu/build' GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp BUILD debian10 BUILD debian-s390x-cross BUILD TCG tests for s390x-linux-user CHECK debian10 CHECK debian-s390x-cross BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? Maybe debian11 could, work. @Thomas do you have any idea if we could get this to work with '-march=z15' or should we work around that by manually encoding the relevant instructions instead?
Am 16.02.22 um 10:17 schrieb David Hildenbrand: > On 15.02.22 21:27, David Miller wrote: >> tests/tcg/s390x/mie3-compl.c: [N]*K instructions >> tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction >> tests/tcg/s390x/mie3-sel.c: SELECT instruction >> >> Signed-off-by: David Miller <dmiller423@gmail.com> >> --- >> tests/tcg/s390x/Makefile.target | 2 +- >> tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ >> tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ >> tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ >> 4 files changed, 130 insertions(+), 1 deletion(-) >> create mode 100644 tests/tcg/s390x/mie3-compl.c >> create mode 100644 tests/tcg/s390x/mie3-mvcrl.c >> create mode 100644 tests/tcg/s390x/mie3-sel.c >> >> diff --git a/tests/tcg/s390x/Makefile.target >> b/tests/tcg/s390x/Makefile.target >> index 1a7238b4eb..16b9d45307 100644 >> --- a/tests/tcg/s390x/Makefile.target >> +++ b/tests/tcg/s390x/Makefile.target >> @@ -1,6 +1,6 @@ >> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >> VPATH+=$(S390X_SRC) >> -CFLAGS+=-march=zEC12 -m64 >> +CFLAGS+=-march=z15 -m64 > > Unfortunately, this makes our docker builds unhappy -- fail. I assume the > compiler in the container is outdated. > > $ make run-tcg-tests-s390x-linux-user > changing dir to build for make "run-tcg-tests-s390x-linux-user"... > make[1]: Entering directory '/home/dhildenb/git/qemu/build' > GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp > BUILD debian10 > BUILD debian-s390x-cross > BUILD TCG tests for s390x-linux-user > CHECK debian10 > CHECK debian-s390x-cross > BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross > s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' > s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? > > Maybe debian11 could, work. > > @Thomas do you have any idea if we could get this to work with > '-march=z15' or should we work around that by manually encoding > the relevant instructions instead? Yes, the problem is that binutils reject new mnemomics for older -march settings. The Linux kernel handles this by using .insn instead of the mnemonic. This will also allow to compile the testcase with older compilers/binutils. So something like "ncrk 0, 3, 2" -> ".insn rrf,0xb9f50000,0,3,2,0"
On 16.02.22 10:28, Christian Borntraeger wrote: > > > Am 16.02.22 um 10:17 schrieb David Hildenbrand: >> On 15.02.22 21:27, David Miller wrote: >>> tests/tcg/s390x/mie3-compl.c: [N]*K instructions >>> tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction >>> tests/tcg/s390x/mie3-sel.c: SELECT instruction >>> >>> Signed-off-by: David Miller <dmiller423@gmail.com> >>> --- >>> tests/tcg/s390x/Makefile.target | 2 +- >>> tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ >>> tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ >>> tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ >>> 4 files changed, 130 insertions(+), 1 deletion(-) >>> create mode 100644 tests/tcg/s390x/mie3-compl.c >>> create mode 100644 tests/tcg/s390x/mie3-mvcrl.c >>> create mode 100644 tests/tcg/s390x/mie3-sel.c >>> >>> diff --git a/tests/tcg/s390x/Makefile.target >>> b/tests/tcg/s390x/Makefile.target >>> index 1a7238b4eb..16b9d45307 100644 >>> --- a/tests/tcg/s390x/Makefile.target >>> +++ b/tests/tcg/s390x/Makefile.target >>> @@ -1,6 +1,6 @@ >>> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >>> VPATH+=$(S390X_SRC) >>> -CFLAGS+=-march=zEC12 -m64 >>> +CFLAGS+=-march=z15 -m64 >> >> Unfortunately, this makes our docker builds unhappy -- fail. I assume the >> compiler in the container is outdated. >> >> $ make run-tcg-tests-s390x-linux-user >> changing dir to build for make "run-tcg-tests-s390x-linux-user"... >> make[1]: Entering directory '/home/dhildenb/git/qemu/build' >> GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp >> BUILD debian10 >> BUILD debian-s390x-cross >> BUILD TCG tests for s390x-linux-user >> CHECK debian10 >> CHECK debian-s390x-cross >> BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross >> s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' >> s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? >> >> Maybe debian11 could, work. >> >> @Thomas do you have any idea if we could get this to work with >> '-march=z15' or should we work around that by manually encoding >> the relevant instructions instead? > > Yes, the problem is that binutils reject new mnemomics for older -march settings. > The Linux kernel handles this by using > .insn instead of the mnemonic. This will also allow to compile the testcase with older compilers/binutils. > > So something like > "ncrk 0, 3, 2" -> ".insn rrf,0xb9f50000,0,3,2,0" > I tried diff --git a/tests/docker/dockerfiles/debian-s390x-cross.docker b/tests/docker/dockerfiles/debian-s390x-cross.docker index 9f2ab51eb0..10e70e0fe8 100644 --- a/tests/docker/dockerfiles/debian-s390x-cross.docker +++ b/tests/docker/dockerfiles/debian-s390x-cross.docker @@ -1,9 +1,9 @@ # # Docker s390 cross-compiler target # -# This docker target builds on the debian Stretch base image. +# This docker target builds on the debian Bullseye base image. # -FROM qemu/debian10 +FROM qemu/debian11 But some of the packages we need (including gcc-multilib-s390x-linux-gnu) seem to be "held broken": E: Unable to correct problems, you have held broken packages.
On 16/02/2022 10.17, David Hildenbrand wrote: > On 15.02.22 21:27, David Miller wrote: ... >> diff --git a/tests/tcg/s390x/Makefile.target >> b/tests/tcg/s390x/Makefile.target >> index 1a7238b4eb..16b9d45307 100644 >> --- a/tests/tcg/s390x/Makefile.target >> +++ b/tests/tcg/s390x/Makefile.target >> @@ -1,6 +1,6 @@ >> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >> VPATH+=$(S390X_SRC) >> -CFLAGS+=-march=zEC12 -m64 >> +CFLAGS+=-march=z15 -m64 > > Unfortunately, this makes our docker builds unhappy -- fail. I assume the > compiler in the container is outdated. > > $ make run-tcg-tests-s390x-linux-user > changing dir to build for make "run-tcg-tests-s390x-linux-user"... > make[1]: Entering directory '/home/dhildenb/git/qemu/build' > GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp > BUILD debian10 > BUILD debian-s390x-cross > BUILD TCG tests for s390x-linux-user > CHECK debian10 > CHECK debian-s390x-cross > BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross > s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' > s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? > > Maybe debian11 could, work. > > @Thomas do you have any idea if we could get this to work with > '-march=z15' or should we work around that by manually encoding > the relevant instructions instead? I'm not an expert when it comes to containers, but I think you could try to update to debian11 in tests/docker/dockerfiles/debian-s390x-cross.docker and in ./.gitlab-ci.d/container-cross.yml ... if that does not work, it's maybe better to manually encode the instructions. Thomas
On 16.02.22 10:43, Thomas Huth wrote: > On 16/02/2022 10.17, David Hildenbrand wrote: >> On 15.02.22 21:27, David Miller wrote: > ... >>> diff --git a/tests/tcg/s390x/Makefile.target >>> b/tests/tcg/s390x/Makefile.target >>> index 1a7238b4eb..16b9d45307 100644 >>> --- a/tests/tcg/s390x/Makefile.target >>> +++ b/tests/tcg/s390x/Makefile.target >>> @@ -1,6 +1,6 @@ >>> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >>> VPATH+=$(S390X_SRC) >>> -CFLAGS+=-march=zEC12 -m64 >>> +CFLAGS+=-march=z15 -m64 >> >> Unfortunately, this makes our docker builds unhappy -- fail. I assume the >> compiler in the container is outdated. >> >> $ make run-tcg-tests-s390x-linux-user >> changing dir to build for make "run-tcg-tests-s390x-linux-user"... >> make[1]: Entering directory '/home/dhildenb/git/qemu/build' >> GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp >> BUILD debian10 >> BUILD debian-s390x-cross >> BUILD TCG tests for s390x-linux-user >> CHECK debian10 >> CHECK debian-s390x-cross >> BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross >> s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' >> s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? >> >> Maybe debian11 could, work. >> >> @Thomas do you have any idea if we could get this to work with >> '-march=z15' or should we work around that by manually encoding >> the relevant instructions instead? > > I'm not an expert when it comes to containers, but I think you could try to > update to debian11 in tests/docker/dockerfiles/debian-s390x-cross.docker and > in ./.gitlab-ci.d/container-cross.yml ... if that does not work, it's maybe > better to manually encode the instructions. debian11 won't work for general cross builds. But, it should work with the tests: From 8108b075e4f74fa4c590f3acf932e221e166889c Mon Sep 17 00:00:00 2001 From: David Hildenbrand <david@redhat.com> Date: Wed, 16 Feb 2022 10:45:21 +0100 Subject: [PATCH] tests/tcg/s390x: Build tests with debian11 We need a newer compiler to build with -march=z15, to be used soon. Signed-off-by: David Hildenbrand <david@redhat.com> --- tests/docker/Makefile.include | 2 ++ .../dockerfiles/debian-s390x-test-cross.docker | 13 +++++++++++++ tests/tcg/configure.sh | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/docker/dockerfiles/debian-s390x-test-cross.docker diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index f1a0c5db7a..e77e5a2f40 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -210,6 +210,7 @@ docker-image-debian-arm64-test-cross: docker-image-debian11 docker-image-debian-microblaze-cross: docker-image-debian10 docker-image-debian-nios2-cross: docker-image-debian10 docker-image-debian-powerpc-test-cross: docker-image-debian11 +docker-image-debian-s390x-test-cross: docker-image-debian11 # These images may be good enough for building tests but not for test builds DOCKER_PARTIAL_IMAGES += debian-alpha-cross @@ -219,6 +220,7 @@ DOCKER_PARTIAL_IMAGES += debian-hppa-cross DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross DOCKER_PARTIAL_IMAGES += debian-microblaze-cross DOCKER_PARTIAL_IMAGES += debian-nios2-cross +DOCKER_PARTIAL_IMAGES += debian-s390x-test-cross DOCKER_PARTIAL_IMAGES += debian-sh4-cross debian-sparc64-cross DOCKER_PARTIAL_IMAGES += debian-tricore-cross DOCKER_PARTIAL_IMAGES += debian-xtensa-cross diff --git a/tests/docker/dockerfiles/debian-s390x-test-cross.docker b/tests/docker/dockerfiles/debian-s390x-test-cross.docker new file mode 100644 index 0000000000..26435287b6 --- /dev/null +++ b/tests/docker/dockerfiles/debian-s390x-test-cross.docker @@ -0,0 +1,13 @@ +# +# Docker s390x cross-compiler target (tests only) +# +# This docker target builds on the debian Bullseye base image. +# +FROM qemu/debian11 + +# Add the foreign architecture we want and install dependencies +RUN dpkg --add-architecture s390x +RUN apt update && \ + DEBIAN_FRONTEND=noninteractive eatmydata \ + apt install -y --no-install-recommends \ + crossbuild-essential-s390x gcc-10-s390x-linux-gnu diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh index 763e9b6ad8..3f00f9307f 100755 --- a/tests/tcg/configure.sh +++ b/tests/tcg/configure.sh @@ -185,7 +185,7 @@ for target in $target_list; do ;; s390x-*) container_hosts=x86_64 - container_image=debian-s390x-cross + container_image=debian-s390x-test-cross container_cross_cc=s390x-linux-gnu-gcc ;; sh4-*)
On 15.02.22 21:27, David Miller wrote: > tests/tcg/s390x/mie3-compl.c: [N]*K instructions > tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction > tests/tcg/s390x/mie3-sel.c: SELECT instruction > > Signed-off-by: David Miller <dmiller423@gmail.com> > --- > tests/tcg/s390x/Makefile.target | 2 +- > tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ > tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ > tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ > 4 files changed, 130 insertions(+), 1 deletion(-) > create mode 100644 tests/tcg/s390x/mie3-compl.c > create mode 100644 tests/tcg/s390x/mie3-mvcrl.c > create mode 100644 tests/tcg/s390x/mie3-sel.c > > diff --git a/tests/tcg/s390x/Makefile.target > b/tests/tcg/s390x/Makefile.target > index 1a7238b4eb..16b9d45307 100644 > --- a/tests/tcg/s390x/Makefile.target > +++ b/tests/tcg/s390x/Makefile.target > @@ -1,6 +1,6 @@ > S390X_SRC=$(SRC_PATH)/tests/tcg/s390x > VPATH+=$(S390X_SRC) > -CFLAGS+=-march=zEC12 -m64 > +CFLAGS+=-march=z15 -m64 > TESTS+=hello-s390x > TESTS+=csst > TESTS+=ipm Your patch is missing the following hunk: diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target index 16b9d45307..54e67446aa 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -7,6 +7,9 @@ TESTS+=ipm TESTS+=exrl-trt TESTS+=exrl-trtr TESTS+=pack +TESTS+=mie3-compl +TESTS+=mie3-mvcrl +TESTS+=mie3-sel TESTS+=mvo TESTS+=mvc TESTS+=shift With debian11, I can build the tests. However, mie3-sel seems to have an issue: TEST mie3-compl on s390x TEST mie3-mvcrl on s390x TEST mie3-sel on s390x timeout: the monitored command dumped core make[3]: *** [../Makefile.target:156: run-mie3-sel] Error 132 make[2]: *** [/home/dhildenb/git/qemu/tests/tcg/Makefile.qemu:102: run-guest-tests] Error 2 make[1]: *** [/home/dhildenb/git/qemu/tests/Makefile.include:59: run-tcg-tests-s390x-linux-user] Error 2 make[1]: Leaving directory '/home/dhildenb/git/qemu/build' make: *** [GNUmakefile:11: run-tcg-tests-s390x-linux-user] Error 2 qemu-s390x gets killed via "Program terminated with signal SIGILL, Illegal instruction."
On 16.02.22 10:57, David Hildenbrand wrote: > On 15.02.22 21:27, David Miller wrote: >> tests/tcg/s390x/mie3-compl.c: [N]*K instructions >> tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction >> tests/tcg/s390x/mie3-sel.c: SELECT instruction >> >> Signed-off-by: David Miller <dmiller423@gmail.com> >> --- >> tests/tcg/s390x/Makefile.target | 2 +- >> tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ >> tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ >> tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ >> 4 files changed, 130 insertions(+), 1 deletion(-) >> create mode 100644 tests/tcg/s390x/mie3-compl.c >> create mode 100644 tests/tcg/s390x/mie3-mvcrl.c >> create mode 100644 tests/tcg/s390x/mie3-sel.c >> >> diff --git a/tests/tcg/s390x/Makefile.target >> b/tests/tcg/s390x/Makefile.target >> index 1a7238b4eb..16b9d45307 100644 >> --- a/tests/tcg/s390x/Makefile.target >> +++ b/tests/tcg/s390x/Makefile.target >> @@ -1,6 +1,6 @@ >> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >> VPATH+=$(S390X_SRC) >> -CFLAGS+=-march=zEC12 -m64 >> +CFLAGS+=-march=z15 -m64 >> TESTS+=hello-s390x >> TESTS+=csst >> TESTS+=ipm > > Your patch is missing the following hunk: > > diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target > index 16b9d45307..54e67446aa 100644 > --- a/tests/tcg/s390x/Makefile.target > +++ b/tests/tcg/s390x/Makefile.target > @@ -7,6 +7,9 @@ TESTS+=ipm > TESTS+=exrl-trt > TESTS+=exrl-trtr > TESTS+=pack > +TESTS+=mie3-compl > +TESTS+=mie3-mvcrl > +TESTS+=mie3-sel > TESTS+=mvo > TESTS+=mvc > TESTS+=shift > > > With debian11, I can build the tests. However, mie3-sel seems to have an issue: > > > TEST mie3-compl on s390x > TEST mie3-mvcrl on s390x > TEST mie3-sel on s390x > timeout: the monitored command dumped core > make[3]: *** [../Makefile.target:156: run-mie3-sel] Error 132 > make[2]: *** [/home/dhildenb/git/qemu/tests/tcg/Makefile.qemu:102: run-guest-tests] Error 2 > make[1]: *** [/home/dhildenb/git/qemu/tests/Makefile.include:59: run-tcg-tests-s390x-linux-user] Error 2 > make[1]: Leaving directory '/home/dhildenb/git/qemu/build' > make: *** [GNUmakefile:11: run-tcg-tests-s390x-linux-user] Error 2 > > qemu-s390x gets killed via > > "Program terminated with signal SIGILL, Illegal instruction." > Fault on my end, I forgot to copy the "SELECT HIGH" instruction when manually applying each hunk. With that, tests run fine under debian11.
On 15.02.22 21:27, David Miller wrote: > tests/tcg/s390x/mie3-compl.c: [N]*K instructions > tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction > tests/tcg/s390x/mie3-sel.c: SELECT instruction > (I know, a lot of mails from my side :) ) 1. I think we usually use the prefix in the subject "tests/tcg/s390x: " 2. Make sure the patches are checkpatch clean as good as possible: For this patch: $ rm *.patch $ git format-patch -1 $ ./scripts/checkpatch.pl *.patch WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #45: new file mode 100644 ERROR: spaces required around that ':' (ctx:VxW) #53: FILE: tests/tcg/s390x/mie3-compl.c:4: +#define F_EPI "stg %%r0, %[res] ": [res] "+m" (res) : : "r0", "r2", "r3" ^ ERROR: unnecessary whitespace before a quoted newline #57: FILE: tests/tcg/s390x/mie3-compl.c:8: + "lg %%r2, %[a] \n" \ ERROR: space prohibited before that close parenthesis ')' #61: FILE: tests/tcg/s390x/mie3-compl.c:12: + : "r2", "r3" ) ERROR: unnecessary whitespace before a quoted newline #67: FILE: tests/tcg/s390x/mie3-compl.c:18: +FbinOp(_ncrk, asm("ncrk %%r0, %%r3, %%r2 \n" F_EPI)) ERROR: unnecessary whitespace before a quoted newline #68: FILE: tests/tcg/s390x/mie3-compl.c:19: +FbinOp(_ncgrk, asm("ncgrk %%r0, %%r3, %%r2 \n" F_EPI)) ...
David Hildenbrand <david@redhat.com> writes: > On 15.02.22 21:27, David Miller wrote: >> tests/tcg/s390x/mie3-compl.c: [N]*K instructions >> tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction >> tests/tcg/s390x/mie3-sel.c: SELECT instruction >> >> Signed-off-by: David Miller <dmiller423@gmail.com> >> --- >> tests/tcg/s390x/Makefile.target | 2 +- >> tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ >> tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ >> tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ >> 4 files changed, 130 insertions(+), 1 deletion(-) >> create mode 100644 tests/tcg/s390x/mie3-compl.c >> create mode 100644 tests/tcg/s390x/mie3-mvcrl.c >> create mode 100644 tests/tcg/s390x/mie3-sel.c >> >> diff --git a/tests/tcg/s390x/Makefile.target >> b/tests/tcg/s390x/Makefile.target >> index 1a7238b4eb..16b9d45307 100644 >> --- a/tests/tcg/s390x/Makefile.target >> +++ b/tests/tcg/s390x/Makefile.target >> @@ -1,6 +1,6 @@ >> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >> VPATH+=$(S390X_SRC) >> -CFLAGS+=-march=zEC12 -m64 >> +CFLAGS+=-march=z15 -m64 > > Unfortunately, this makes our docker builds unhappy -- fail. I assume the > compiler in the container is outdated. > > $ make run-tcg-tests-s390x-linux-user > changing dir to build for make "run-tcg-tests-s390x-linux-user"... > make[1]: Entering directory '/home/dhildenb/git/qemu/build' > GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp > BUILD debian10 > BUILD debian-s390x-cross > BUILD TCG tests for s390x-linux-user > CHECK debian10 > CHECK debian-s390x-cross > BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross > s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' > s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 > arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 > z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? > > Maybe debian11 could, work. > > @Thomas do you have any idea if we could get this to work with > '-march=z15' or should we work around that by manually encoding > the relevant instructions instead? Yeah you'll need to update the docker container. The way it works is we always assume the docker based compilers have the compiler features needed to test something. tests/tcg/configure.sh does feature tests for compilers which are detected on the host filesystem (e.g. do we support SVE). My last testing/next post: Subject: [PATCH v1 00/11] testing/next (docker, lcitool, ci, tcg) Date: Fri, 11 Feb 2022 16:02:58 +0000 Message-Id: <20220211160309.335014-1-alex.bennee@linaro.org> converted the aarch64 container to debian11 with lci-tool. You should be able to do the same with the s390x one.
On 16.02.22 15:19, Alex Bennée wrote: > > David Hildenbrand <david@redhat.com> writes: > >> On 15.02.22 21:27, David Miller wrote: >>> tests/tcg/s390x/mie3-compl.c: [N]*K instructions >>> tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction >>> tests/tcg/s390x/mie3-sel.c: SELECT instruction >>> >>> Signed-off-by: David Miller <dmiller423@gmail.com> >>> --- >>> tests/tcg/s390x/Makefile.target | 2 +- >>> tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ >>> tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ >>> tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ >>> 4 files changed, 130 insertions(+), 1 deletion(-) >>> create mode 100644 tests/tcg/s390x/mie3-compl.c >>> create mode 100644 tests/tcg/s390x/mie3-mvcrl.c >>> create mode 100644 tests/tcg/s390x/mie3-sel.c >>> >>> diff --git a/tests/tcg/s390x/Makefile.target >>> b/tests/tcg/s390x/Makefile.target >>> index 1a7238b4eb..16b9d45307 100644 >>> --- a/tests/tcg/s390x/Makefile.target >>> +++ b/tests/tcg/s390x/Makefile.target >>> @@ -1,6 +1,6 @@ >>> S390X_SRC=$(SRC_PATH)/tests/tcg/s390x >>> VPATH+=$(S390X_SRC) >>> -CFLAGS+=-march=zEC12 -m64 >>> +CFLAGS+=-march=z15 -m64 >> >> Unfortunately, this makes our docker builds unhappy -- fail. I assume the >> compiler in the container is outdated. >> >> $ make run-tcg-tests-s390x-linux-user >> changing dir to build for make "run-tcg-tests-s390x-linux-user"... >> make[1]: Entering directory '/home/dhildenb/git/qemu/build' >> GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp >> BUILD debian10 >> BUILD debian-s390x-cross >> BUILD TCG tests for s390x-linux-user >> CHECK debian10 >> CHECK debian-s390x-cross >> BUILD s390x-linux-user guest-tests with docker qemu/debian-s390x-cross >> s390x-linux-gnu-gcc: error: unrecognized argument in option '-march=z15' >> s390x-linux-gnu-gcc: note: valid arguments to '-march=' are: arch10 >> arch11 arch12 arch3 arch5 arch6 arch7 arch8 arch9 g5 g6 native z10 z13 >> z14 z196 z9-109 z9-ec z900 z990 zEC12; did you mean 'z10'? >> >> Maybe debian11 could, work. >> >> @Thomas do you have any idea if we could get this to work with >> '-march=z15' or should we work around that by manually encoding >> the relevant instructions instead? > > Yeah you'll need to update the docker container. The way it works is we > always assume the docker based compilers have the compiler features > needed to test something. tests/tcg/configure.sh does feature tests for > compilers which are detected on the host filesystem (e.g. do we support > SVE). > > My last testing/next post: > > Subject: [PATCH v1 00/11] testing/next (docker, lcitool, ci, tcg) > Date: Fri, 11 Feb 2022 16:02:58 +0000 > Message-Id: <20220211160309.335014-1-alex.bennee@linaro.org> > > converted the aarch64 container to debian11 with lci-tool. You should be > able to do the same with the s390x one. > I followed the upstream debain11 test-only aarch64 and powerpc example and posted the s390x one that seems to work at: https://lkml.kernel.org/r/20220216115102.206129-1-david@redhat.com Hopefully that's what you had in mind as well. (I am not familiar with lci-tool)
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target index 1a7238b4eb..16b9d45307 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -1,6 +1,6 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x VPATH+=$(S390X_SRC) -CFLAGS+=-march=zEC12 -m64 +CFLAGS+=-march=z15 -m64 TESTS+=hello-s390x TESTS+=csst TESTS+=ipm diff --git a/tests/tcg/s390x/mie3-compl.c b/tests/tcg/s390x/mie3-compl.c new file mode 100644 index 0000000000..1254fe21fb --- /dev/null +++ b/tests/tcg/s390x/mie3-compl.c @@ -0,0 +1,56 @@ +#include <stdint.h> + + +#define F_EPI "stg %%r0, %[res] ": [res] "+m" (res) : : "r0", "r2", "r3" + +#define F_PRO asm ( \ + "llihf %%r0,801\n" \ + "lg %%r2, %[a] \n" \ + "lg %%r3, %[b] " \ + : : [a] "m" (a), \ + [b] "m" (b) \ + : "r2", "r3" ) + +#define FbinOp(S, ASM) uint64_t S(uint64_t a, uint64_t b) \ +{ uint64_t res = 0; F_PRO; ASM; return res; } + +/* AND WITH COMPLEMENT */ +FbinOp(_ncrk, asm("ncrk %%r0, %%r3, %%r2 \n" F_EPI)) +FbinOp(_ncgrk, asm("ncgrk %%r0, %%r3, %%r2 \n" F_EPI)) + +/* NAND */ +FbinOp(_nnrk, asm("nnrk %%r0, %%r3, %%r2 \n" F_EPI)) +FbinOp(_nngrk, asm("nngrk %%r0, %%r3, %%r2 \n" F_EPI)) + +/* NOT XOR */ +FbinOp(_nxrk, asm("nxrk %%r0, %%r3, %%r2 \n" F_EPI)) +FbinOp(_nxgrk, asm("nxgrk %%r0, %%r3, %%r2 \n" F_EPI)) + +/* NOR */ +FbinOp(_nork, asm("nork %%r0, %%r3, %%r2 \n" F_EPI)) +FbinOp(_nogrk, asm("nogrk %%r0, %%r3, %%r2 \n" F_EPI)) + +/* OR WITH COMPLEMENT */ +FbinOp(_ocrk, asm("ocrk %%r0, %%r3, %%r2 \n" F_EPI)) +FbinOp(_ocgrk, asm("ocgrk %%r0, %%r3, %%r2 \n" F_EPI)) + + + +int main(int argc, char *argv[]) +{ + if (_ncrk(0xFF88, 0xAA11) != 0x0000032100000011ull || + _nnrk(0xFF88, 0xAA11) != 0x00000321FFFF55FFull || + _nork(0xFF88, 0xAA11) != 0x00000321FFFF0066ull || + _nxrk(0xFF88, 0xAA11) != 0x00000321FFFFAA66ull || + _ocrk(0xFF88, 0xAA11) != 0x00000321FFFFAA77ull || + _ncgrk(0xFF88, 0xAA11) != 0x0000000000000011ull || + _nngrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFF55FFull || + _nogrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFF0066ull || + _nxgrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFFAA66ull || + _ocgrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFFAA77ull) + { + return 1; + } + + return 0; +} diff --git a/tests/tcg/s390x/mie3-mvcrl.c b/tests/tcg/s390x/mie3-mvcrl.c new file mode 100644 index 0000000000..00f9c150a1 --- /dev/null +++ b/tests/tcg/s390x/mie3-mvcrl.c @@ -0,0 +1,31 @@ +#include <stdint.h> +#include <string.h> + + +static inline void mvcrl_8(const char *dst, const char *src) +{ + asm volatile ( + "llill %%r0, 8 \n" + "mvcrl 0(%[dst]), 0(%[src]) \n" + : : [dst] "d" (dst), [src] "d" (src) + : "memory"); +} + + +int main(int argc, char *argv[]) +{ + const char* alpha = "abcdefghijklmnop"; + + /* array missing 'i' */ + char tstr[17] = "abcdefghjklmnop\0" ; + + /* mvcrl reference use: 'open a hole in an array' */ + mvcrl_8(tstr+9, tstr+8); + + /* place missing 'i' */ + tstr[8] = 'i'; + + return strncmp(alpha, tstr, 16ul); +} + + diff --git a/tests/tcg/s390x/mie3-sel.c b/tests/tcg/s390x/mie3-sel.c new file mode 100644 index 0000000000..e771b1e413 --- /dev/null +++ b/tests/tcg/s390x/mie3-sel.c @@ -0,0 +1,42 @@ +#include <stdint.h> + + +#define F_EPI "stg %%r0, %[res] ": [res] "+m" (res) : : "r0", "r2", "r3" + +#define F_PRO asm ( \ + "lg %%r2, %[a] \n" \ + "lg %%r3, %[b] \n" \ + "lg %%r0, %[c] \n" \ + "ltgr %%r0, %%r0" \ + : : [a] "m" (a), \ + [b] "m" (b), \ + [c] "m" (c) \ + : "r0", "r2", "r3", "r4") + + + +#define Fi3(S, ASM) uint64_t S(uint64_t a, uint64_t b, uint64_t c) \ +{ uint64_t res=0; F_PRO ; ASM ; return res; } + + +Fi3 (_selre, asm("selre %%r0, %%r3, %%r2 \n" F_EPI)) +Fi3 (_selgrz, asm("selgrz %%r0, %%r3, %%r2 \n" F_EPI)) +Fi3 (_selfhrnz, asm("selfhrnz %%r0, %%r3, %%r2 \n" F_EPI)) + + +int main(int argc, char *argv[]) +{ + uint64_t a = ~0, b = ~0, c = ~0; + a = _selre(0x066600000066ull, 0x066600000006ull,a); + b = _selgrz(0xF00D00000005ull, 0xF00D00000055ull,b); + c = _selfhrnz(0x004400000044ull, 0x000400000004ull,c); + + if( (0xFFFFFFFF00000066ull != a) || + (0x0000F00D00000005ull != b) || + (0x00000004FFFFFFFFull != c) ) + { + return 1; + } + return 0; +} +
tests/tcg/s390x/mie3-compl.c: [N]*K instructions tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction tests/tcg/s390x/mie3-sel.c: SELECT instruction Signed-off-by: David Miller <dmiller423@gmail.com> --- tests/tcg/s390x/Makefile.target | 2 +- tests/tcg/s390x/mie3-compl.c | 56 +++++++++++++++++++++++++++++++++ tests/tcg/s390x/mie3-mvcrl.c | 31 ++++++++++++++++++ tests/tcg/s390x/mie3-sel.c | 42 +++++++++++++++++++++++++ 4 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/s390x/mie3-compl.c create mode 100644 tests/tcg/s390x/mie3-mvcrl.c create mode 100644 tests/tcg/s390x/mie3-sel.c