@@ -24,6 +24,7 @@ wa_divide=
vmm="qemu"
errata_force=0
erratatxt="$srcdir/errata.txt"
+host_key_document=
usage() {
cat <<-EOF
@@ -46,6 +47,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
}
@@ -98,6 +102,9 @@ while [[ "$1" = -* ]]; do
erratatxt=
[ "$arg" ] && erratatxt=$(eval realpath "$arg")
;;
+ --host-key-document)
+ host_key_document="$arg"
+ ;;
--help)
usage
;;
@@ -229,6 +236,8 @@ ENVIRON_DEFAULT=$environ_default
ERRATATXT=$erratatxt
U32_LONG_FMT=$u32_long
WA_DIVIDE=$wa_divide
+GENPROTIMG=${GENPROTIMG-genprotimg}
+HOST_KEY_DOCUMENT=$host_key_document
EOF
cat <<EOF > lib/config.h
@@ -19,12 +19,19 @@ tests += $(TEST_DIR)/smp.elf
tests += $(TEST_DIR)/sclp.elf
tests += $(TEST_DIR)/css.elf
tests += $(TEST_DIR)/uv-guest.elf
+
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
+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
@@ -73,6 +80,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
new file mode 100644
@@ -0,0 +1 @@
+test 123
\ No newline at end of file
@@ -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]
new file mode 100644
@@ -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
+ testname=${testname}_PV
+ if [ ! -f "${kernel}" ]; then
+ if [ -z "${HOST_KEY_DOCUMENT}" ]; then
+ return 2
+ fi
+
+ print_result 'SKIP' $testname '' 'PVM image was not created'
+ return 2
+ fi
+ "$cmd" "$testname" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+}