* [kvm-unit-tests PATCH 0/4] s390x: Add Protected VM support
@ 2020-08-18 13:04 ` Marc Hartmayer
0 siblings, 0 replies; 28+ messages in thread
From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw)
To: kvm
Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck,
Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390
Add support for Protected Virtual Machine (PVM) tests. For starting a
PVM guest we must be able to generate a PVM image by using the
`genprotimg` tool from the s390-tools collection. This requires the
ability to pass a machine-specific host-key document, so the option
`--host-key-document` is added to the configure script.
For everybody's convenience there is a branch:
https://gitlab.com/mhartmay/kvm-unit-tests/-/tree/pv_v1
Changelog:
RFC v2 -> v1:
+ Rebased
+ patch 1:
- add r-b from Andrew
+ patch 2:
- add explicit dependency on config.mak (Andrew)
- add comment about the order of sourcing (Andrew)
+ patch 3:
- drop dummy function (Andrew)
- add arch_cmd hook function (Andrew)
+ patch 4:
- rephrased the documentation of the configure option (Conny)
- Skip test case if a PVM image wasn't built or the host-key document wasn't set (Conny)
- Run PV tests by default
RFC v1 -> RFC v2:
+ Remove `pv_support` option (Janosch, David)
+ Add some preliminary patches:
- move "testname guard"
- add support for architecture dependent functions
+ Add support for specifying a parmline file for the PV image
generation. This is necessary for the `selftest` because the
kernel cmdline set on the QEMU command line is ignored for PV
guests
Marc Hartmayer (4):
common.bash: run `cmd` only if a test case was found
scripts: add support for architecture dependent functions
run_tests/mkstandalone: add arch_cmd hook
s390x: add Protected VM support
README.md | 3 ++-
configure | 9 +++++++++
run_tests.sh | 3 ---
s390x/Makefile | 17 +++++++++++++++--
s390x/selftest.parmfile | 1 +
s390x/unittests.cfg | 1 +
scripts/common.bash | 21 +++++++++++++++++++--
scripts/mkstandalone.sh | 4 ----
scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++
9 files changed, 82 insertions(+), 12 deletions(-)
create mode 100644 s390x/selftest.parmfile
create mode 100644 scripts/s390x/func.bash
--
2.25.4
^ permalink raw reply [flat|nested] 28+ messages in thread* [kvm-unit-tests PATCH 0/4] s390x: Add Protected VM support @ 2020-08-18 13:04 ` Marc Hartmayer 0 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 Add support for Protected Virtual Machine (PVM) tests. For starting a PVM guest we must be able to generate a PVM image by using the `genprotimg` tool from the s390-tools collection. This requires the ability to pass a machine-specific host-key document, so the option `--host-key-document` is added to the configure script. For everybody's convenience there is a branch: https://gitlab.com/mhartmay/kvm-unit-tests/-/tree/pv_v1 Changelog: RFC v2 -> v1: + Rebased + patch 1: - add r-b from Andrew + patch 2: - add explicit dependency on config.mak (Andrew) - add comment about the order of sourcing (Andrew) + patch 3: - drop dummy function (Andrew) - add arch_cmd hook function (Andrew) + patch 4: - rephrased the documentation of the configure option (Conny) - Skip test case if a PVM image wasn't built or the host-key document wasn't set (Conny) - Run PV tests by default RFC v1 -> RFC v2: + Remove `pv_support` option (Janosch, David) + Add some preliminary patches: - move "testname guard" - add support for architecture dependent functions + Add support for specifying a parmline file for the PV image generation. This is necessary for the `selftest` because the kernel cmdline set on the QEMU command line is ignored for PV guests Marc Hartmayer (4): common.bash: run `cmd` only if a test case was found scripts: add support for architecture dependent functions run_tests/mkstandalone: add arch_cmd hook s390x: add Protected VM support README.md | 3 ++- configure | 9 +++++++++ run_tests.sh | 3 --- s390x/Makefile | 17 +++++++++++++++-- s390x/selftest.parmfile | 1 + s390x/unittests.cfg | 1 + scripts/common.bash | 21 +++++++++++++++++++-- scripts/mkstandalone.sh | 4 ---- scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ 9 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 s390x/selftest.parmfile create mode 100644 scripts/s390x/func.bash -- 2.25.4 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 1/4] common.bash: run `cmd` only if a test case was found 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-18 13:04 ` Marc Hartmayer -1 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 It's only useful to run `cmd` in `for_each_unittest` if a test case was found. This change allows us to remove the guards from the functions `run_task` and `mkstandalone`. Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- run_tests.sh | 3 --- scripts/common.bash | 8 ++++++-- scripts/mkstandalone.sh | 4 ---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 01e36dcfa06e..24aba9cc3a98 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -126,9 +126,6 @@ RUNTIME_log_stdout () { function run_task() { local testname="$1" - if [ -z "$testname" ]; then - return - fi while (( $(jobs | wc -l) == $unittest_run_queues )); do # wait for any background test to finish diff --git a/scripts/common.bash b/scripts/common.bash index 9a6ebbd7f287..96655c9ffd1f 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -17,7 +17,9 @@ function for_each_unittest() while read -r -u $fd line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ -n "${testname}" ]; then + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi testname=${BASH_REMATCH[1]} smp=1 kernel="" @@ -45,6 +47,8 @@ function for_each_unittest() timeout=${BASH_REMATCH[1]} fi done - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ -n "${testname}" ]; then + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi exec {fd}<&- } diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index 9d506cc95072..cefdec30cb33 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -83,10 +83,6 @@ function mkstandalone() { local testname="$1" - if [ -z "$testname" ]; then - return - fi - if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then return fi -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 1/4] common.bash: run `cmd` only if a test case was found @ 2020-08-18 13:04 ` Marc Hartmayer 0 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 It's only useful to run `cmd` in `for_each_unittest` if a test case was found. This change allows us to remove the guards from the functions `run_task` and `mkstandalone`. Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- run_tests.sh | 3 --- scripts/common.bash | 8 ++++++-- scripts/mkstandalone.sh | 4 ---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 01e36dcfa06e..24aba9cc3a98 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -126,9 +126,6 @@ RUNTIME_log_stdout () { function run_task() { local testname="$1" - if [ -z "$testname" ]; then - return - fi while (( $(jobs | wc -l) == $unittest_run_queues )); do # wait for any background test to finish diff --git a/scripts/common.bash b/scripts/common.bash index 9a6ebbd7f287..96655c9ffd1f 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -17,7 +17,9 @@ function for_each_unittest() while read -r -u $fd line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ -n "${testname}" ]; then + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi testname=${BASH_REMATCH[1]} smp=1 kernel="" @@ -45,6 +47,8 @@ function for_each_unittest() timeout=${BASH_REMATCH[1]} fi done - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ -n "${testname}" ]; then + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi exec {fd}<&- } diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index 9d506cc95072..cefdec30cb33 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -83,10 +83,6 @@ function mkstandalone() { local testname="$1" - if [ -z "$testname" ]; then - return - fi - if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then return fi -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 1/4] common.bash: run `cmd` only if a test case was found 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-19 10:20 ` Cornelia Huck -1 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:20 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:21 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > It's only useful to run `cmd` in `for_each_unittest` if a test case > was found. This change allows us to remove the guards from the > functions `run_task` and `mkstandalone`. > > Reviewed-by: Andrew Jones <drjones@redhat.com> > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > run_tests.sh | 3 --- > scripts/common.bash | 8 ++++++-- > scripts/mkstandalone.sh | 4 ---- > 3 files changed, 6 insertions(+), 9 deletions(-) Reviewed-by: Cornelia Huck <cohuck@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 1/4] common.bash: run `cmd` only if a test case was found @ 2020-08-19 10:20 ` Cornelia Huck 0 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:20 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:21 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > It's only useful to run `cmd` in `for_each_unittest` if a test case > was found. This change allows us to remove the guards from the > functions `run_task` and `mkstandalone`. > > Reviewed-by: Andrew Jones <drjones@redhat.com> > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > run_tests.sh | 3 --- > scripts/common.bash | 8 ++++++-- > scripts/mkstandalone.sh | 4 ---- > 3 files changed, 6 insertions(+), 9 deletions(-) Reviewed-by: Cornelia Huck <cohuck@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 1/4] common.bash: run `cmd` only if a test case was found 2020-08-18 13:04 ` Marc Hartmayer (?) (?) @ 2020-08-19 10:37 ` David Hildenbrand -1 siblings, 0 replies; 28+ messages in thread From: David Hildenbrand @ 2020-08-19 10:37 UTC (permalink / raw) To: Marc Hartmayer, kvm Cc: Thomas Huth, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On 18.08.20 15:04, Marc Hartmayer wrote: > It's only useful to run `cmd` in `for_each_unittest` if a test case > was found. This change allows us to remove the guards from the > functions `run_task` and `mkstandalone`. > > Reviewed-by: Andrew Jones <drjones@redhat.com> > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > run_tests.sh | 3 --- > scripts/common.bash | 8 ++++++-- > scripts/mkstandalone.sh | 4 ---- > 3 files changed, 6 insertions(+), 9 deletions(-) > > diff --git a/run_tests.sh b/run_tests.sh > index 01e36dcfa06e..24aba9cc3a98 100755 > --- a/run_tests.sh > +++ b/run_tests.sh > @@ -126,9 +126,6 @@ RUNTIME_log_stdout () { > function run_task() > { > local testname="$1" > - if [ -z "$testname" ]; then > - return > - fi > > while (( $(jobs | wc -l) == $unittest_run_queues )); do > # wait for any background test to finish > diff --git a/scripts/common.bash b/scripts/common.bash > index 9a6ebbd7f287..96655c9ffd1f 100644 > --- a/scripts/common.bash > +++ b/scripts/common.bash > @@ -17,7 +17,9 @@ function for_each_unittest() > > while read -r -u $fd line; do > if [[ "$line" =~ ^\[(.*)\]$ ]]; then > - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + if [ -n "${testname}" ]; then > + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + fi > testname=${BASH_REMATCH[1]} > smp=1 > kernel="" > @@ -45,6 +47,8 @@ function for_each_unittest() > timeout=${BASH_REMATCH[1]} > fi > done > - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + if [ -n "${testname}" ]; then > + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + fi > exec {fd}<&- > } > diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh > index 9d506cc95072..cefdec30cb33 100755 > --- a/scripts/mkstandalone.sh > +++ b/scripts/mkstandalone.sh > @@ -83,10 +83,6 @@ function mkstandalone() > { > local testname="$1" > > - if [ -z "$testname" ]; then > - return > - fi > - > if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then > return > fi > Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-18 13:04 ` Marc Hartmayer -1 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 This is necessary to keep architecture dependent code separate from common code. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- README.md | 3 ++- scripts/common.bash | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48be206c6db1..24d4bdaaee0d 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ all unit tests. ## Directory structure .: configure script, top-level Makefile, and run_tests.sh - ./scripts: helper scripts for building and running tests + ./scripts: general architecture neutral helper scripts for building and running tests + ./scripts/<ARCH>: architecture dependent helper scripts for building and running tests ./lib: general architecture neutral services for the tests ./lib/<ARCH>: architecture dependent services for the tests ./<ARCH>: the sources of the tests and the created objects/images diff --git a/scripts/common.bash b/scripts/common.bash index 96655c9ffd1f..c7acdf14a835 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -1,3 +1,4 @@ +source config.mak function for_each_unittest() { @@ -52,3 +53,10 @@ function for_each_unittest() fi exec {fd}<&- } + +# The current file has to be the only file sourcing the arch helper +# file +ARCH_FUNC=scripts/${ARCH}/func.bash +if [ -f "${ARCH_FUNC}" ]; then + source "${ARCH_FUNC}" +fi -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions @ 2020-08-18 13:04 ` Marc Hartmayer 0 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 This is necessary to keep architecture dependent code separate from common code. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- README.md | 3 ++- scripts/common.bash | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48be206c6db1..24d4bdaaee0d 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ all unit tests. ## Directory structure .: configure script, top-level Makefile, and run_tests.sh - ./scripts: helper scripts for building and running tests + ./scripts: general architecture neutral helper scripts for building and running tests + ./scripts/<ARCH>: architecture dependent helper scripts for building and running tests ./lib: general architecture neutral services for the tests ./lib/<ARCH>: architecture dependent services for the tests ./<ARCH>: the sources of the tests and the created objects/images diff --git a/scripts/common.bash b/scripts/common.bash index 96655c9ffd1f..c7acdf14a835 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -1,3 +1,4 @@ +source config.mak function for_each_unittest() { @@ -52,3 +53,10 @@ function for_each_unittest() fi exec {fd}<&- } + +# The current file has to be the only file sourcing the arch helper +# file +ARCH_FUNC=scripts/${ARCH}/func.bash +if [ -f "${ARCH_FUNC}" ]; then + source "${ARCH_FUNC}" +fi -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions 2020-08-18 13:04 ` Marc Hartmayer (?) @ 2020-08-18 14:31 ` Andrew Jones -1 siblings, 0 replies; 28+ messages in thread From: Andrew Jones @ 2020-08-18 14:31 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, Aug 18, 2020 at 03:04:22PM +0200, Marc Hartmayer wrote: > This is necessary to keep architecture dependent code separate from > common code. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > README.md | 3 ++- > scripts/common.bash | 8 ++++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/README.md b/README.md > index 48be206c6db1..24d4bdaaee0d 100644 > --- a/README.md > +++ b/README.md > @@ -134,7 +134,8 @@ all unit tests. > ## Directory structure > > .: configure script, top-level Makefile, and run_tests.sh > - ./scripts: helper scripts for building and running tests > + ./scripts: general architecture neutral helper scripts for building and running tests > + ./scripts/<ARCH>: architecture dependent helper scripts for building and running tests > ./lib: general architecture neutral services for the tests > ./lib/<ARCH>: architecture dependent services for the tests > ./<ARCH>: the sources of the tests and the created objects/images > diff --git a/scripts/common.bash b/scripts/common.bash > index 96655c9ffd1f..c7acdf14a835 100644 > --- a/scripts/common.bash > +++ b/scripts/common.bash > @@ -1,3 +1,4 @@ > +source config.mak > > function for_each_unittest() > { > @@ -52,3 +53,10 @@ function for_each_unittest() > fi > exec {fd}<&- > } > + > +# The current file has to be the only file sourcing the arch helper > +# file > +ARCH_FUNC=scripts/${ARCH}/func.bash > +if [ -f "${ARCH_FUNC}" ]; then > + source "${ARCH_FUNC}" > +fi > -- > 2.25.4 > Reviewed-by: Andrew Jones <drjones@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-19 10:22 ` Cornelia Huck -1 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:22 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:22 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > This is necessary to keep architecture dependent code separate from > common code. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > README.md | 3 ++- > scripts/common.bash | 8 ++++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > Reviewed-by: Cornelia Huck <cohuck@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions @ 2020-08-19 10:22 ` Cornelia Huck 0 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:22 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:22 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > This is necessary to keep architecture dependent code separate from > common code. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > README.md | 3 ++- > scripts/common.bash | 8 ++++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > Reviewed-by: Cornelia Huck <cohuck@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions 2020-08-18 13:04 ` Marc Hartmayer ` (2 preceding siblings ...) (?) @ 2020-08-19 10:38 ` David Hildenbrand -1 siblings, 0 replies; 28+ messages in thread From: David Hildenbrand @ 2020-08-19 10:38 UTC (permalink / raw) To: Marc Hartmayer, kvm Cc: Thomas Huth, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On 18.08.20 15:04, Marc Hartmayer wrote: > This is necessary to keep architecture dependent code separate from > common code. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > README.md | 3 ++- > scripts/common.bash | 8 ++++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/README.md b/README.md > index 48be206c6db1..24d4bdaaee0d 100644 > --- a/README.md > +++ b/README.md > @@ -134,7 +134,8 @@ all unit tests. > ## Directory structure > > .: configure script, top-level Makefile, and run_tests.sh > - ./scripts: helper scripts for building and running tests > + ./scripts: general architecture neutral helper scripts for building and running tests > + ./scripts/<ARCH>: architecture dependent helper scripts for building and running tests > ./lib: general architecture neutral services for the tests > ./lib/<ARCH>: architecture dependent services for the tests > ./<ARCH>: the sources of the tests and the created objects/images > diff --git a/scripts/common.bash b/scripts/common.bash > index 96655c9ffd1f..c7acdf14a835 100644 > --- a/scripts/common.bash > +++ b/scripts/common.bash > @@ -1,3 +1,4 @@ > +source config.mak > > function for_each_unittest() > { > @@ -52,3 +53,10 @@ function for_each_unittest() > fi > exec {fd}<&- > } > + > +# The current file has to be the only file sourcing the arch helper > +# file > +ARCH_FUNC=scripts/${ARCH}/func.bash > +if [ -f "${ARCH_FUNC}" ]; then > + source "${ARCH_FUNC}" > +fi > Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-18 13:04 ` Marc Hartmayer -1 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 This allows us, for example, to auto generate a new test case based on an existing test case. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- scripts/common.bash | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/common.bash b/scripts/common.bash index c7acdf14a835..a6044b7c6c35 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -19,7 +19,7 @@ function for_each_unittest() while read -r -u $fd line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then if [ -n "${testname}" ]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" fi testname=${BASH_REMATCH[1]} smp=1 @@ -49,11 +49,16 @@ function for_each_unittest() fi done if [ -n "${testname}" ]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" fi exec {fd}<&- } +function arch_cmd() +{ + [ "${ARCH_CMD}" ] && echo "${ARCH_CMD}" +} + # The current file has to be the only file sourcing the arch helper # file ARCH_FUNC=scripts/${ARCH}/func.bash -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook @ 2020-08-18 13:04 ` Marc Hartmayer 0 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 This allows us, for example, to auto generate a new test case based on an existing test case. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- scripts/common.bash | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/common.bash b/scripts/common.bash index c7acdf14a835..a6044b7c6c35 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -19,7 +19,7 @@ function for_each_unittest() while read -r -u $fd line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then if [ -n "${testname}" ]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" fi testname=${BASH_REMATCH[1]} smp=1 @@ -49,11 +49,16 @@ function for_each_unittest() fi done if [ -n "${testname}" ]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" fi exec {fd}<&- } +function arch_cmd() +{ + [ "${ARCH_CMD}" ] && echo "${ARCH_CMD}" +} + # The current file has to be the only file sourcing the arch helper # file ARCH_FUNC=scripts/${ARCH}/func.bash -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook 2020-08-18 13:04 ` Marc Hartmayer (?) @ 2020-08-18 14:32 ` Andrew Jones -1 siblings, 0 replies; 28+ messages in thread From: Andrew Jones @ 2020-08-18 14:32 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, Aug 18, 2020 at 03:04:23PM +0200, Marc Hartmayer wrote: > This allows us, for example, to auto generate a new test case based on > an existing test case. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > scripts/common.bash | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/scripts/common.bash b/scripts/common.bash > index c7acdf14a835..a6044b7c6c35 100644 > --- a/scripts/common.bash > +++ b/scripts/common.bash > @@ -19,7 +19,7 @@ function for_each_unittest() > while read -r -u $fd line; do > if [[ "$line" =~ ^\[(.*)\]$ ]]; then > if [ -n "${testname}" ]; then > - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > fi > testname=${BASH_REMATCH[1]} > smp=1 > @@ -49,11 +49,16 @@ function for_each_unittest() > fi > done > if [ -n "${testname}" ]; then > - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > fi > exec {fd}<&- > } > > +function arch_cmd() > +{ > + [ "${ARCH_CMD}" ] && echo "${ARCH_CMD}" > +} > + > # The current file has to be the only file sourcing the arch helper > # file > ARCH_FUNC=scripts/${ARCH}/func.bash > -- > 2.25.4 > Reviewed-by: Andrew Jones <drjones@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-19 10:23 ` Cornelia Huck -1 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:23 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:23 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > This allows us, for example, to auto generate a new test case based on > an existing test case. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > scripts/common.bash | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) Reviewed-by: Cornelia Huck <cohuck@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook @ 2020-08-19 10:23 ` Cornelia Huck 0 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:23 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:23 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > This allows us, for example, to auto generate a new test case based on > an existing test case. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > scripts/common.bash | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) Reviewed-by: Cornelia Huck <cohuck@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook 2020-08-18 13:04 ` Marc Hartmayer ` (2 preceding siblings ...) (?) @ 2020-08-19 10:39 ` David Hildenbrand -1 siblings, 0 replies; 28+ messages in thread From: David Hildenbrand @ 2020-08-19 10:39 UTC (permalink / raw) To: Marc Hartmayer, kvm Cc: Thomas Huth, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On 18.08.20 15:04, Marc Hartmayer wrote: > This allows us, for example, to auto generate a new test case based on > an existing test case. An example would have been nice :) > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > scripts/common.bash | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/scripts/common.bash b/scripts/common.bash > index c7acdf14a835..a6044b7c6c35 100644 > --- a/scripts/common.bash > +++ b/scripts/common.bash > @@ -19,7 +19,7 @@ function for_each_unittest() > while read -r -u $fd line; do > if [[ "$line" =~ ^\[(.*)\]$ ]]; then > if [ -n "${testname}" ]; then > - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > fi > testname=${BASH_REMATCH[1]} > smp=1 > @@ -49,11 +49,16 @@ function for_each_unittest() > fi > done > if [ -n "${testname}" ]; then > - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > fi > exec {fd}<&- > } > > +function arch_cmd() > +{ > + [ "${ARCH_CMD}" ] && echo "${ARCH_CMD}" > +} > + > # The current file has to be the only file sourcing the arch helper > # file > ARCH_FUNC=scripts/${ARCH}/func.bash > Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-18 13:04 ` Marc Hartmayer -1 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 Add support for Protected Virtual Machine (PVM) tests. For starting a PVM guest we must be able to generate a PVM image by using the `genprotimg` tool from the s390-tools collection. This requires the ability to pass a machine-specific host-key document, so the option `--host-key-document` is added to the configure script. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- configure | 9 +++++++++ s390x/Makefile | 17 +++++++++++++++-- s390x/selftest.parmfile | 1 + s390x/unittests.cfg | 1 + scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 s390x/selftest.parmfile create mode 100644 scripts/s390x/func.bash diff --git a/configure b/configure index f9d030fd2f03..0e64af58b3c1 100755 --- a/configure +++ b/configure @@ -18,6 +18,7 @@ u32_long= vmm="qemu" errata_force=0 erratatxt="$srcdir/errata.txt" +host_key_document= usage() { cat <<-EOF @@ -40,6 +41,9 @@ usage() { no environ is provided by the user (enabled by default) --erratatxt=FILE specify a file to use instead of errata.txt. Use '--erratatxt=' to ensure no file is used. + --host-key-document=HOST_KEY_DOCUMENT + Specify the machine-specific host-key document for creating + a PVM image with 'genprotimg' (s390x only) EOF exit 1 } @@ -92,6 +96,9 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --host-key-document) + host_key_document="$arg" + ;; --help) usage ;; @@ -205,6 +212,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks ENVIRON_DEFAULT=$environ_default ERRATATXT=$erratatxt U32_LONG_FMT=$u32_long +GENPROTIMG=${GENPROTIMG-genprotimg} +HOST_KEY_DOCUMENT=$host_key_document EOF cat <<EOF > lib/config.h diff --git a/s390x/Makefile b/s390x/Makefile index 0f54bf43bfb7..cd4e270952ec 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf tests += $(TEST_DIR)/smp.elf tests += $(TEST_DIR)/sclp.elf tests += $(TEST_DIR)/css.elf -tests_binary = $(patsubst %.elf,%.bin,$(tests)) -all: directories test_cases test_cases_binary +tests_binary = $(patsubst %.elf,%.bin,$(tests)) +ifneq ($(HOST_KEY_DOCUMENT),) +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) +else +tests_pv_binary = +endif + +all: directories test_cases test_cases_binary test_cases_pv test_cases: $(tests) test_cases_binary: $(tests_binary) +test_cases_pv: $(tests_pv_binary) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding @@ -72,6 +79,12 @@ FLATLIBS = $(libcflat) %.bin: %.elf $(OBJCOPY) -O binary $< $@ +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ + +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ + arch_clean: asm_offsets_clean $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile new file mode 100644 index 000000000000..5613931aa5c6 --- /dev/null +++ b/s390x/selftest.parmfile @@ -0,0 +1 @@ +test 123 \ No newline at end of file diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 0f156afbe741..12f6fb613995 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -21,6 +21,7 @@ [selftest-setup] file = selftest.elf groups = selftest +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile extra_params = -append 'test 123' [intercept] diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash new file mode 100644 index 000000000000..b2d59d0d6f25 --- /dev/null +++ b/scripts/s390x/func.bash @@ -0,0 +1,35 @@ +# The file scripts/common.bash has to be the only file sourcing this +# arch helper file +source config.mak + +ARCH_CMD=arch_cmd_s390x + +function arch_cmd_s390x() +{ + local cmd=$1 + local testname=$2 + local groups=$3 + local smp=$4 + local kernel=$5 + local opts=$6 + local arch=$7 + local check=$8 + local accel=$9 + local timeout=${10} + + # run the normal test case + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + + # run PV test case + kernel=${kernel%.elf}.pv.bin + if [ ! -f "${kernel}" ]; then + if [ -z "${HOST_KEY_DOCUMENT}" ]; then + print_result 'SKIP' $testname '(no host-key document specified)' + return 2 + fi + + print_result 'SKIP' $testname '(PVM image was not created)' + return 2 + fi + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" +} -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support @ 2020-08-18 13:04 ` Marc Hartmayer 0 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-18 13:04 UTC (permalink / raw) To: kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 Add support for Protected Virtual Machine (PVM) tests. For starting a PVM guest we must be able to generate a PVM image by using the `genprotimg` tool from the s390-tools collection. This requires the ability to pass a machine-specific host-key document, so the option `--host-key-document` is added to the configure script. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- configure | 9 +++++++++ s390x/Makefile | 17 +++++++++++++++-- s390x/selftest.parmfile | 1 + s390x/unittests.cfg | 1 + scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 s390x/selftest.parmfile create mode 100644 scripts/s390x/func.bash diff --git a/configure b/configure index f9d030fd2f03..0e64af58b3c1 100755 --- a/configure +++ b/configure @@ -18,6 +18,7 @@ u32_long= vmm="qemu" errata_force=0 erratatxt="$srcdir/errata.txt" +host_key_document= usage() { cat <<-EOF @@ -40,6 +41,9 @@ usage() { no environ is provided by the user (enabled by default) --erratatxt=FILE specify a file to use instead of errata.txt. Use '--erratatxt=' to ensure no file is used. + --host-key-document=HOST_KEY_DOCUMENT + Specify the machine-specific host-key document for creating + a PVM image with 'genprotimg' (s390x only) EOF exit 1 } @@ -92,6 +96,9 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --host-key-document) + host_key_document="$arg" + ;; --help) usage ;; @@ -205,6 +212,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks ENVIRON_DEFAULT=$environ_default ERRATATXT=$erratatxt U32_LONG_FMT=$u32_long +GENPROTIMG=${GENPROTIMG-genprotimg} +HOST_KEY_DOCUMENT=$host_key_document EOF cat <<EOF > lib/config.h diff --git a/s390x/Makefile b/s390x/Makefile index 0f54bf43bfb7..cd4e270952ec 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf tests += $(TEST_DIR)/smp.elf tests += $(TEST_DIR)/sclp.elf tests += $(TEST_DIR)/css.elf -tests_binary = $(patsubst %.elf,%.bin,$(tests)) -all: directories test_cases test_cases_binary +tests_binary = $(patsubst %.elf,%.bin,$(tests)) +ifneq ($(HOST_KEY_DOCUMENT),) +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) +else +tests_pv_binary = +endif + +all: directories test_cases test_cases_binary test_cases_pv test_cases: $(tests) test_cases_binary: $(tests_binary) +test_cases_pv: $(tests_pv_binary) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding @@ -72,6 +79,12 @@ FLATLIBS = $(libcflat) %.bin: %.elf $(OBJCOPY) -O binary $< $@ +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ + +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ + arch_clean: asm_offsets_clean $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile new file mode 100644 index 000000000000..5613931aa5c6 --- /dev/null +++ b/s390x/selftest.parmfile @@ -0,0 +1 @@ +test 123 \ No newline at end of file diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 0f156afbe741..12f6fb613995 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -21,6 +21,7 @@ [selftest-setup] file = selftest.elf groups = selftest +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile extra_params = -append 'test 123' [intercept] diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash new file mode 100644 index 000000000000..b2d59d0d6f25 --- /dev/null +++ b/scripts/s390x/func.bash @@ -0,0 +1,35 @@ +# The file scripts/common.bash has to be the only file sourcing this +# arch helper file +source config.mak + +ARCH_CMD=arch_cmd_s390x + +function arch_cmd_s390x() +{ + local cmd=$1 + local testname=$2 + local groups=$3 + local smp=$4 + local kernel=$5 + local opts=$6 + local arch=$7 + local check=$8 + local accel=$9 + local timeout=${10} + + # run the normal test case + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + + # run PV test case + kernel=${kernel%.elf}.pv.bin + if [ ! -f "${kernel}" ]; then + if [ -z "${HOST_KEY_DOCUMENT}" ]; then + print_result 'SKIP' $testname '(no host-key document specified)' + return 2 + fi + + print_result 'SKIP' $testname '(PVM image was not created)' + return 2 + fi + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" +} -- 2.25.4 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-18 13:04 ` Marc Hartmayer (?) @ 2020-08-18 13:20 ` Janosch Frank -1 siblings, 0 replies; 28+ messages in thread From: Janosch Frank @ 2020-08-18 13:20 UTC (permalink / raw) To: Marc Hartmayer, kvm Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 [-- Attachment #1.1: Type: text/plain, Size: 5617 bytes --] On 8/18/20 3:04 PM, Marc Hartmayer wrote: > Add support for Protected Virtual Machine (PVM) tests. For starting a > PVM guest we must be able to generate a PVM image by using the > `genprotimg` tool from the s390-tools collection. This requires the > ability to pass a machine-specific host-key document, so the option > `--host-key-document` is added to the configure script. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> I like that solution a lot, it's easy to add the parmline, the host key document is configured once and the tests are run as default if they have been created. It's everything that I wished for. Reviewed-by: Janosch Frank <frankja@linux.ibm.com> > --- > configure | 9 +++++++++ > s390x/Makefile | 17 +++++++++++++++-- > s390x/selftest.parmfile | 1 + > s390x/unittests.cfg | 1 + > scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ > 5 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 s390x/selftest.parmfile > create mode 100644 scripts/s390x/func.bash > > diff --git a/configure b/configure > index f9d030fd2f03..0e64af58b3c1 100755 > --- a/configure > +++ b/configure > @@ -18,6 +18,7 @@ u32_long= > vmm="qemu" > errata_force=0 > erratatxt="$srcdir/errata.txt" > +host_key_document= > > usage() { > cat <<-EOF > @@ -40,6 +41,9 @@ usage() { > no environ is provided by the user (enabled by default) > --erratatxt=FILE specify a file to use instead of errata.txt. Use > '--erratatxt=' to ensure no file is used. > + --host-key-document=HOST_KEY_DOCUMENT > + Specify the machine-specific host-key document for creating > + a PVM image with 'genprotimg' (s390x only) > EOF > exit 1 > } > @@ -92,6 +96,9 @@ while [[ "$1" = -* ]]; do > erratatxt= > [ "$arg" ] && erratatxt=$(eval realpath "$arg") > ;; > + --host-key-document) > + host_key_document="$arg" > + ;; > --help) > usage > ;; > @@ -205,6 +212,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks > ENVIRON_DEFAULT=$environ_default > ERRATATXT=$erratatxt > U32_LONG_FMT=$u32_long > +GENPROTIMG=${GENPROTIMG-genprotimg} > +HOST_KEY_DOCUMENT=$host_key_document > EOF > > cat <<EOF > lib/config.h > diff --git a/s390x/Makefile b/s390x/Makefile > index 0f54bf43bfb7..cd4e270952ec 100644 > --- a/s390x/Makefile > +++ b/s390x/Makefile > @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf > tests += $(TEST_DIR)/smp.elf > tests += $(TEST_DIR)/sclp.elf > tests += $(TEST_DIR)/css.elf > -tests_binary = $(patsubst %.elf,%.bin,$(tests)) > > -all: directories test_cases test_cases_binary > +tests_binary = $(patsubst %.elf,%.bin,$(tests)) > +ifneq ($(HOST_KEY_DOCUMENT),) > +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) > +else > +tests_pv_binary = > +endif > + > +all: directories test_cases test_cases_binary test_cases_pv > > test_cases: $(tests) > test_cases_binary: $(tests_binary) > +test_cases_pv: $(tests_pv_binary) > > CFLAGS += -std=gnu99 > CFLAGS += -ffreestanding > @@ -72,6 +79,12 @@ FLATLIBS = $(libcflat) > %.bin: %.elf > $(OBJCOPY) -O binary $< $@ > > +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) > + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ > + > +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) > + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ > + > arch_clean: asm_offsets_clean > $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d > > diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile > new file mode 100644 > index 000000000000..5613931aa5c6 > --- /dev/null > +++ b/s390x/selftest.parmfile > @@ -0,0 +1 @@ > +test 123 > \ No newline at end of file > diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg > index 0f156afbe741..12f6fb613995 100644 > --- a/s390x/unittests.cfg > +++ b/s390x/unittests.cfg > @@ -21,6 +21,7 @@ > [selftest-setup] > file = selftest.elf > groups = selftest > +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile > extra_params = -append 'test 123' > > [intercept] > diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash > new file mode 100644 > index 000000000000..b2d59d0d6f25 > --- /dev/null > +++ b/scripts/s390x/func.bash > @@ -0,0 +1,35 @@ > +# The file scripts/common.bash has to be the only file sourcing this > +# arch helper file > +source config.mak > + > +ARCH_CMD=arch_cmd_s390x > + > +function arch_cmd_s390x() > +{ > + local cmd=$1 > + local testname=$2 > + local groups=$3 > + local smp=$4 > + local kernel=$5 > + local opts=$6 > + local arch=$7 > + local check=$8 > + local accel=$9 > + local timeout=${10} > + > + # run the normal test case > + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + > + # run PV test case > + kernel=${kernel%.elf}.pv.bin > + if [ ! -f "${kernel}" ]; then > + if [ -z "${HOST_KEY_DOCUMENT}" ]; then > + print_result 'SKIP' $testname '(no host-key document specified)' > + return 2 > + fi > + > + print_result 'SKIP' $testname '(PVM image was not created)' > + return 2 > + fi > + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > +} > [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-18 13:04 ` Marc Hartmayer @ 2020-08-19 10:34 ` Cornelia Huck -1 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:34 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:24 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > Add support for Protected Virtual Machine (PVM) tests. For starting a > PVM guest we must be able to generate a PVM image by using the > `genprotimg` tool from the s390-tools collection. This requires the > ability to pass a machine-specific host-key document, so the option > `--host-key-document` is added to the configure script. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > configure | 9 +++++++++ > s390x/Makefile | 17 +++++++++++++++-- > s390x/selftest.parmfile | 1 + > s390x/unittests.cfg | 1 + > scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ > 5 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 s390x/selftest.parmfile > create mode 100644 scripts/s390x/func.bash (...) > +function arch_cmd_s390x() > +{ > + local cmd=$1 > + local testname=$2 > + local groups=$3 > + local smp=$4 > + local kernel=$5 > + local opts=$6 > + local arch=$7 > + local check=$8 > + local accel=$9 > + local timeout=${10} > + > + # run the normal test case > + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + > + # run PV test case > + kernel=${kernel%.elf}.pv.bin > + if [ ! -f "${kernel}" ]; then > + if [ -z "${HOST_KEY_DOCUMENT}" ]; then > + print_result 'SKIP' $testname '(no host-key document specified)' > + return 2 > + fi > + > + print_result 'SKIP' $testname '(PVM image was not created)' When can that happen? Don't we already fail earlier if we specified a host key document, but genprotimg does not work? > + return 2 > + fi > + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > +} ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support @ 2020-08-19 10:34 ` Cornelia Huck 0 siblings, 0 replies; 28+ messages in thread From: Cornelia Huck @ 2020-08-19 10:34 UTC (permalink / raw) To: Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, 18 Aug 2020 15:04:24 +0200 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > Add support for Protected Virtual Machine (PVM) tests. For starting a > PVM guest we must be able to generate a PVM image by using the > `genprotimg` tool from the s390-tools collection. This requires the > ability to pass a machine-specific host-key document, so the option > `--host-key-document` is added to the configure script. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > configure | 9 +++++++++ > s390x/Makefile | 17 +++++++++++++++-- > s390x/selftest.parmfile | 1 + > s390x/unittests.cfg | 1 + > scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ > 5 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 s390x/selftest.parmfile > create mode 100644 scripts/s390x/func.bash (...) > +function arch_cmd_s390x() > +{ > + local cmd=$1 > + local testname=$2 > + local groups=$3 > + local smp=$4 > + local kernel=$5 > + local opts=$6 > + local arch=$7 > + local check=$8 > + local accel=$9 > + local timeout=${10} > + > + # run the normal test case > + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + > + # run PV test case > + kernel=${kernel%.elf}.pv.bin > + if [ ! -f "${kernel}" ]; then > + if [ -z "${HOST_KEY_DOCUMENT}" ]; then > + print_result 'SKIP' $testname '(no host-key document specified)' > + return 2 > + fi > + > + print_result 'SKIP' $testname '(PVM image was not created)' When can that happen? Don't we already fail earlier if we specified a host key document, but genprotimg does not work? > + return 2 > + fi > + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > +} ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-19 10:34 ` Cornelia Huck (?) @ 2020-08-19 11:38 ` Marc Hartmayer -1 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-19 11:38 UTC (permalink / raw) To: Cornelia Huck, Marc Hartmayer Cc: kvm, Thomas Huth, David Hildenbrand, Janosch Frank, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Wed, Aug 19, 2020 at 12:34 PM +0200, Cornelia Huck <cohuck@redhat.com> wrote: > On Tue, 18 Aug 2020 15:04:24 +0200 > Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > >> Add support for Protected Virtual Machine (PVM) tests. For starting a >> PVM guest we must be able to generate a PVM image by using the >> `genprotimg` tool from the s390-tools collection. This requires the >> ability to pass a machine-specific host-key document, so the option >> `--host-key-document` is added to the configure script. >> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> >> --- >> configure | 9 +++++++++ >> s390x/Makefile | 17 +++++++++++++++-- >> s390x/selftest.parmfile | 1 + >> s390x/unittests.cfg | 1 + >> scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ >> 5 files changed, 61 insertions(+), 2 deletions(-) >> create mode 100644 s390x/selftest.parmfile >> create mode 100644 scripts/s390x/func.bash > > (...) > >> +function arch_cmd_s390x() >> +{ >> + local cmd=$1 >> + local testname=$2 >> + local groups=$3 >> + local smp=$4 >> + local kernel=$5 >> + local opts=$6 >> + local arch=$7 >> + local check=$8 >> + local accel=$9 >> + local timeout=${10} >> + >> + # run the normal test case >> + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" >> + >> + # run PV test case >> + kernel=${kernel%.elf}.pv.bin >> + if [ ! -f "${kernel}" ]; then >> + if [ -z "${HOST_KEY_DOCUMENT}" ]; then >> + print_result 'SKIP' $testname '(no host-key document specified)' >> + return 2 >> + fi >> + >> + print_result 'SKIP' $testname '(PVM image was not created)' > > When can that happen? Don't we already fail earlier if we specified a > host key document, but genprotimg does not work? ./configure make -j ./configure --host-key-document=… ./run_tests.sh A contrived example, but… > >> + return 2 >> + fi >> + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" >> +} > -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-18 13:04 ` Marc Hartmayer ` (2 preceding siblings ...) (?) @ 2020-08-19 10:42 ` David Hildenbrand 2020-08-19 11:49 ` Marc Hartmayer -1 siblings, 1 reply; 28+ messages in thread From: David Hildenbrand @ 2020-08-19 10:42 UTC (permalink / raw) To: Marc Hartmayer, kvm Cc: Thomas Huth, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On 18.08.20 15:04, Marc Hartmayer wrote: > Add support for Protected Virtual Machine (PVM) tests. For starting a > PVM guest we must be able to generate a PVM image by using the > `genprotimg` tool from the s390-tools collection. This requires the > ability to pass a machine-specific host-key document, so the option > `--host-key-document` is added to the configure script. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > configure | 9 +++++++++ > s390x/Makefile | 17 +++++++++++++++-- > s390x/selftest.parmfile | 1 + > s390x/unittests.cfg | 1 + > scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ > 5 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 s390x/selftest.parmfile > create mode 100644 scripts/s390x/func.bash > > diff --git a/configure b/configure > index f9d030fd2f03..0e64af58b3c1 100755 > --- a/configure > +++ b/configure > @@ -18,6 +18,7 @@ u32_long= > vmm="qemu" > errata_force=0 > erratatxt="$srcdir/errata.txt" > +host_key_document= > > usage() { > cat <<-EOF > @@ -40,6 +41,9 @@ usage() { > no environ is provided by the user (enabled by default) > --erratatxt=FILE specify a file to use instead of errata.txt. Use > '--erratatxt=' to ensure no file is used. > + --host-key-document=HOST_KEY_DOCUMENT > + Specify the machine-specific host-key document for creating > + a PVM image with 'genprotimg' (s390x only) > EOF > exit 1 > } > @@ -92,6 +96,9 @@ while [[ "$1" = -* ]]; do > erratatxt= > [ "$arg" ] && erratatxt=$(eval realpath "$arg") > ;; > + --host-key-document) > + host_key_document="$arg" > + ;; > --help) > usage > ;; > @@ -205,6 +212,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks > ENVIRON_DEFAULT=$environ_default > ERRATATXT=$erratatxt > U32_LONG_FMT=$u32_long > +GENPROTIMG=${GENPROTIMG-genprotimg} > +HOST_KEY_DOCUMENT=$host_key_document > EOF > > cat <<EOF > lib/config.h > diff --git a/s390x/Makefile b/s390x/Makefile > index 0f54bf43bfb7..cd4e270952ec 100644 > --- a/s390x/Makefile > +++ b/s390x/Makefile > @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf > tests += $(TEST_DIR)/smp.elf > tests += $(TEST_DIR)/sclp.elf > tests += $(TEST_DIR)/css.elf > -tests_binary = $(patsubst %.elf,%.bin,$(tests)) > > -all: directories test_cases test_cases_binary > +tests_binary = $(patsubst %.elf,%.bin,$(tests)) > +ifneq ($(HOST_KEY_DOCUMENT),) > +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) > +else > +tests_pv_binary = > +endif > + > +all: directories test_cases test_cases_binary test_cases_pv > > test_cases: $(tests) > test_cases_binary: $(tests_binary) > +test_cases_pv: $(tests_pv_binary) > > CFLAGS += -std=gnu99 > CFLAGS += -ffreestanding > @@ -72,6 +79,12 @@ FLATLIBS = $(libcflat) > %.bin: %.elf > $(OBJCOPY) -O binary $< $@ > > +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) > + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ > + > +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) > + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ > + > arch_clean: asm_offsets_clean > $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d > > diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile > new file mode 100644 > index 000000000000..5613931aa5c6 > --- /dev/null > +++ b/s390x/selftest.parmfile > @@ -0,0 +1 @@ > +test 123 > \ No newline at end of file > diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg > index 0f156afbe741..12f6fb613995 100644 > --- a/s390x/unittests.cfg > +++ b/s390x/unittests.cfg > @@ -21,6 +21,7 @@ > [selftest-setup] > file = selftest.elf > groups = selftest > +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile > extra_params = -append 'test 123' This is ugly, can't we somehow create the parmfiles dynamically? > > [intercept] > diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash > new file mode 100644 > index 000000000000..b2d59d0d6f25 > --- /dev/null > +++ b/scripts/s390x/func.bash > @@ -0,0 +1,35 @@ > +# The file scripts/common.bash has to be the only file sourcing this > +# arch helper file > +source config.mak > + > +ARCH_CMD=arch_cmd_s390x > + > +function arch_cmd_s390x() > +{ > + local cmd=$1 > + local testname=$2 > + local groups=$3 > + local smp=$4 > + local kernel=$5 > + local opts=$6 > + local arch=$7 > + local check=$8 > + local accel=$9 > + local timeout=${10} > + > + # run the normal test case > + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + Why ${testname} instead of $testname ? > + # run PV test case > + kernel=${kernel%.elf}.pv.bin > + if [ ! -f "${kernel}" ]; then > + if [ -z "${HOST_KEY_DOCUMENT}" ]; then > + print_result 'SKIP' $testname '(no host-key document specified)' > + return 2 > + fi > + > + print_result 'SKIP' $testname '(PVM image was not created)' > + return 2 > + fi > + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" dito > +} > -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-19 10:42 ` David Hildenbrand @ 2020-08-19 11:49 ` Marc Hartmayer 0 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-19 11:49 UTC (permalink / raw) To: David Hildenbrand, Marc Hartmayer, kvm Cc: Thomas Huth, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Wed, Aug 19, 2020 at 12:42 PM +0200, David Hildenbrand <david@redhat.com> wrote: > On 18.08.20 15:04, Marc Hartmayer wrote: >> Add support for Protected Virtual Machine (PVM) tests. For starting a >> PVM guest we must be able to generate a PVM image by using the >> `genprotimg` tool from the s390-tools collection. This requires the >> ability to pass a machine-specific host-key document, so the option >> `--host-key-document` is added to the configure script. >> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> >> --- >> configure | 9 +++++++++ >> s390x/Makefile | 17 +++++++++++++++-- >> s390x/selftest.parmfile | 1 + >> s390x/unittests.cfg | 1 + >> scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ >> 5 files changed, 61 insertions(+), 2 deletions(-) >> create mode 100644 s390x/selftest.parmfile >> create mode 100644 scripts/s390x/func.bash >> >> diff --git a/configure b/configure >> index f9d030fd2f03..0e64af58b3c1 100755 >> --- a/configure >> +++ b/configure >> @@ -18,6 +18,7 @@ u32_long= >> vmm="qemu" >> errata_force=0 >> erratatxt="$srcdir/errata.txt" >> +host_key_document= >> >> usage() { >> cat <<-EOF >> @@ -40,6 +41,9 @@ usage() { >> no environ is provided by the user (enabled by default) >> --erratatxt=FILE specify a file to use instead of errata.txt. Use >> '--erratatxt=' to ensure no file is used. >> + --host-key-document=HOST_KEY_DOCUMENT >> + Specify the machine-specific host-key document for creating >> + a PVM image with 'genprotimg' (s390x only) >> EOF >> exit 1 >> } >> @@ -92,6 +96,9 @@ while [[ "$1" = -* ]]; do >> erratatxt= >> [ "$arg" ] && erratatxt=$(eval realpath "$arg") >> ;; >> + --host-key-document) >> + host_key_document="$arg" >> + ;; >> --help) >> usage >> ;; >> @@ -205,6 +212,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks >> ENVIRON_DEFAULT=$environ_default >> ERRATATXT=$erratatxt >> U32_LONG_FMT=$u32_long >> +GENPROTIMG=${GENPROTIMG-genprotimg} >> +HOST_KEY_DOCUMENT=$host_key_document >> EOF >> >> cat <<EOF > lib/config.h >> diff --git a/s390x/Makefile b/s390x/Makefile >> index 0f54bf43bfb7..cd4e270952ec 100644 >> --- a/s390x/Makefile >> +++ b/s390x/Makefile >> @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf >> tests += $(TEST_DIR)/smp.elf >> tests += $(TEST_DIR)/sclp.elf >> tests += $(TEST_DIR)/css.elf >> -tests_binary = $(patsubst %.elf,%.bin,$(tests)) >> >> -all: directories test_cases test_cases_binary >> +tests_binary = $(patsubst %.elf,%.bin,$(tests)) >> +ifneq ($(HOST_KEY_DOCUMENT),) >> +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) >> +else >> +tests_pv_binary = >> +endif >> + >> +all: directories test_cases test_cases_binary test_cases_pv >> >> test_cases: $(tests) >> test_cases_binary: $(tests_binary) >> +test_cases_pv: $(tests_pv_binary) >> >> CFLAGS += -std=gnu99 >> CFLAGS += -ffreestanding >> @@ -72,6 +79,12 @@ FLATLIBS = $(libcflat) >> %.bin: %.elf >> $(OBJCOPY) -O binary $< $@ >> >> +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) >> + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ >> + >> +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) >> + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ >> + >> arch_clean: asm_offsets_clean >> $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d >> >> diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile >> new file mode 100644 >> index 000000000000..5613931aa5c6 >> --- /dev/null >> +++ b/s390x/selftest.parmfile >> @@ -0,0 +1 @@ >> +test 123 >> \ No newline at end of file >> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg >> index 0f156afbe741..12f6fb613995 100644 >> --- a/s390x/unittests.cfg >> +++ b/s390x/unittests.cfg >> @@ -21,6 +21,7 @@ >> [selftest-setup] >> file = selftest.elf >> groups = selftest >> +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile >> extra_params = -append 'test 123' > > This is ugly, can't we somehow create the parmfiles dynamically? An alternative would be to parse the unittests.cfg (and the extra_params) in the Makefile. Not sure it's worth the effort. > >> >> [intercept] >> diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash >> new file mode 100644 >> index 000000000000..b2d59d0d6f25 >> --- /dev/null >> +++ b/scripts/s390x/func.bash >> @@ -0,0 +1,35 @@ >> +# The file scripts/common.bash has to be the only file sourcing this >> +# arch helper file >> +source config.mak >> + >> +ARCH_CMD=arch_cmd_s390x >> + >> +function arch_cmd_s390x() >> +{ >> + local cmd=$1 >> + local testname=$2 >> + local groups=$3 >> + local smp=$4 >> + local kernel=$5 >> + local opts=$6 >> + local arch=$7 >> + local check=$8 >> + local accel=$9 >> + local timeout=${10} >> + >> + # run the normal test case >> + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" >> + > > Why ${testname} instead of $testname ? Probably to be in common with "${testname}_PV" :) I can change it here. > >> + # run PV test case >> + kernel=${kernel%.elf}.pv.bin >> + if [ ! -f "${kernel}" ]; then >> + if [ -z "${HOST_KEY_DOCUMENT}" ]; then >> + print_result 'SKIP' $testname '(no host-key document specified)' >> + return 2 >> + fi >> + >> + print_result 'SKIP' $testname '(PVM image was not created)' >> + return 2 >> + fi >> + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > > dito $testname_PV would refer to a non-existent variable. Thanks for the feedback! > >> +} >> > > > -- > Thanks, > > David / dhildenb > -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support 2020-08-18 13:04 ` Marc Hartmayer ` (3 preceding siblings ...) (?) @ 2020-08-21 11:47 ` Marc Hartmayer -1 siblings, 0 replies; 28+ messages in thread From: Marc Hartmayer @ 2020-08-21 11:47 UTC (permalink / raw) To: Marc Hartmayer, kvm Cc: Thomas Huth, David Hildenbrand, Janosch Frank, Cornelia Huck, Andrew Jones, Paolo Bonzini, Christian Borntraeger, linux-s390 On Tue, Aug 18, 2020 at 03:04 PM +0200, Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > Add support for Protected Virtual Machine (PVM) tests. For starting a > PVM guest we must be able to generate a PVM image by using the > `genprotimg` tool from the s390-tools collection. This requires the > ability to pass a machine-specific host-key document, so the option > `--host-key-document` is added to the configure script. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > configure | 9 +++++++++ > s390x/Makefile | 17 +++++++++++++++-- > s390x/selftest.parmfile | 1 + > s390x/unittests.cfg | 1 + > scripts/s390x/func.bash | 35 +++++++++++++++++++++++++++++++++++ > 5 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 s390x/selftest.parmfile > create mode 100644 scripts/s390x/func.bash > > diff --git a/configure b/configure > index f9d030fd2f03..0e64af58b3c1 100755 > --- a/configure > +++ b/configure > @@ -18,6 +18,7 @@ u32_long= > vmm="qemu" > errata_force=0 > erratatxt="$srcdir/errata.txt" > +host_key_document= > > usage() { > cat <<-EOF > @@ -40,6 +41,9 @@ usage() { > no environ is provided by the user (enabled by default) > --erratatxt=FILE specify a file to use instead of errata.txt. Use > '--erratatxt=' to ensure no file is used. > + --host-key-document=HOST_KEY_DOCUMENT > + Specify the machine-specific host-key document for creating > + a PVM image with 'genprotimg' (s390x only) > EOF > exit 1 > } > @@ -92,6 +96,9 @@ while [[ "$1" = -* ]]; do > erratatxt= > [ "$arg" ] && erratatxt=$(eval realpath "$arg") > ;; > + --host-key-document) > + host_key_document="$arg" > + ;; > --help) > usage > ;; > @@ -205,6 +212,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks > ENVIRON_DEFAULT=$environ_default > ERRATATXT=$erratatxt > U32_LONG_FMT=$u32_long > +GENPROTIMG=${GENPROTIMG-genprotimg} > +HOST_KEY_DOCUMENT=$host_key_document > EOF > > cat <<EOF > lib/config.h > diff --git a/s390x/Makefile b/s390x/Makefile > index 0f54bf43bfb7..cd4e270952ec 100644 > --- a/s390x/Makefile > +++ b/s390x/Makefile > @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf > tests += $(TEST_DIR)/smp.elf > tests += $(TEST_DIR)/sclp.elf > tests += $(TEST_DIR)/css.elf > -tests_binary = $(patsubst %.elf,%.bin,$(tests)) > > -all: directories test_cases test_cases_binary > +tests_binary = $(patsubst %.elf,%.bin,$(tests)) > +ifneq ($(HOST_KEY_DOCUMENT),) > +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) > +else > +tests_pv_binary = > +endif > + > +all: directories test_cases test_cases_binary test_cases_pv > > test_cases: $(tests) > test_cases_binary: $(tests_binary) > +test_cases_pv: $(tests_pv_binary) > > CFLAGS += -std=gnu99 > CFLAGS += -ffreestanding > @@ -72,6 +79,12 @@ FLATLIBS = $(libcflat) > %.bin: %.elf > $(OBJCOPY) -O binary $< $@ > > +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) > + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ > + > +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) > + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ > + > arch_clean: asm_offsets_clean > $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d > > diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile > new file mode 100644 > index 000000000000..5613931aa5c6 > --- /dev/null > +++ b/s390x/selftest.parmfile > @@ -0,0 +1 @@ > +test 123 > \ No newline at end of file > diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg > index 0f156afbe741..12f6fb613995 100644 > --- a/s390x/unittests.cfg > +++ b/s390x/unittests.cfg > @@ -21,6 +21,7 @@ > [selftest-setup] > file = selftest.elf > groups = selftest > +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile > extra_params = -append 'test 123' > > [intercept] > diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash > new file mode 100644 > index 000000000000..b2d59d0d6f25 > --- /dev/null > +++ b/scripts/s390x/func.bash > @@ -0,0 +1,35 @@ > +# The file scripts/common.bash has to be the only file sourcing this > +# arch helper file > +source config.mak > + > +ARCH_CMD=arch_cmd_s390x > + > +function arch_cmd_s390x() > +{ > + local cmd=$1 > + local testname=$2 > + local groups=$3 > + local smp=$4 > + local kernel=$5 > + local opts=$6 > + local arch=$7 > + local check=$8 > + local accel=$9 > + local timeout=${10} > + > + # run the normal test case > + "$cmd" "${testname}" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > + > + # run PV test case > + kernel=${kernel%.elf}.pv.bin > + if [ ! -f "${kernel}" ]; then > + if [ -z "${HOST_KEY_DOCUMENT}" ]; then > + print_result 'SKIP' $testname '(no host-key document specified)' One argument for ‘print_result‘ is missing and $testname has to be ${testname}_PV. > + return 2 > + fi > + > + print_result 'SKIP' $testname '(PVM image was not created)' …and here as well. I’ll fix it. > + return 2 > + fi > + "$cmd" "${testname}_PV" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" > +} > -- > 2.25.4 > -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2020-08-21 11:47 UTC | newest] Thread overview: 28+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-08-18 13:04 [kvm-unit-tests PATCH 0/4] s390x: Add Protected VM support Marc Hartmayer 2020-08-18 13:04 ` Marc Hartmayer 2020-08-18 13:04 ` [kvm-unit-tests PATCH 1/4] common.bash: run `cmd` only if a test case was found Marc Hartmayer 2020-08-18 13:04 ` Marc Hartmayer 2020-08-19 10:20 ` Cornelia Huck 2020-08-19 10:20 ` Cornelia Huck 2020-08-19 10:37 ` David Hildenbrand 2020-08-18 13:04 ` [kvm-unit-tests PATCH 2/4] scripts: add support for architecture dependent functions Marc Hartmayer 2020-08-18 13:04 ` Marc Hartmayer 2020-08-18 14:31 ` Andrew Jones 2020-08-19 10:22 ` Cornelia Huck 2020-08-19 10:22 ` Cornelia Huck 2020-08-19 10:38 ` David Hildenbrand 2020-08-18 13:04 ` [kvm-unit-tests PATCH 3/4] run_tests/mkstandalone: add arch_cmd hook Marc Hartmayer 2020-08-18 13:04 ` Marc Hartmayer 2020-08-18 14:32 ` Andrew Jones 2020-08-19 10:23 ` Cornelia Huck 2020-08-19 10:23 ` Cornelia Huck 2020-08-19 10:39 ` David Hildenbrand 2020-08-18 13:04 ` [kvm-unit-tests PATCH 4/4] s390x: add Protected VM support Marc Hartmayer 2020-08-18 13:04 ` Marc Hartmayer 2020-08-18 13:20 ` Janosch Frank 2020-08-19 10:34 ` Cornelia Huck 2020-08-19 10:34 ` Cornelia Huck 2020-08-19 11:38 ` Marc Hartmayer 2020-08-19 10:42 ` David Hildenbrand 2020-08-19 11:49 ` Marc Hartmayer 2020-08-21 11:47 ` Marc Hartmayer
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.