This patch adds a test case for domain XML with the tpm-spapr TPM device model. Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx> Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> --- .../tpm-emulator-spapr.ppc64-latest.args | 45 ++++++++++++++ tests/qemuxml2argvdata/tpm-emulator-spapr.xml | 60 +++++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++ 3 files changed, 109 insertions(+) create mode 100644 tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args create mode 100644 tests/qemuxml2argvdata/tpm-emulator-spapr.xml diff --git a/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args b/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args new file mode 100644 index 0000000000..f4c8a062c1 --- /dev/null +++ b/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args @@ -0,0 +1,45 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-TPM-VM \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-TPM-VM/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-TPM-VM/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-TPM-VM/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-ppc64 \ +-name guest=TPM-VM,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-TPM-VM/master-key.aes \ +-machine pseries-5.0,accel=tcg,usb=off,dump-guest-core=off \ +-cpu POWER9 \ +-m 2048 \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid 11d7cd22-da89-3094-6212-079a48a309a1 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot menu=on,strict=on \ +-device pci-ohci,id=usb,bus=pci.0,addr=0x1 \ +-device spapr-vscsi,id=scsi0,reg=0x00002000 \ +-device spapr-vscsi,id=scsi1,reg=0x00003000 \ +-drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi1-0-0-0 \ +-device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,\ +device_id=drive-scsi1-0-0-0,drive=drive-scsi1-0-0-0,id=scsi1-0-0-0,bootindex=1 \ +-chardev pty,id=charserial0 \ +-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \ +-chardev pty,id=charserial1 \ +-device spapr-vty,chardev=charserial1,id=serial1,reg=0x30001000 \ +-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \ +-chardev socket,id=chrtpm,path=/dev/test \ +-device tpm-spapr,tpmdev=tpm-tpm0,id=tpm0,reg=0x00005000 \ +-global spapr-nvram.reg=0x4000 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/tpm-emulator-spapr.xml b/tests/qemuxml2argvdata/tpm-emulator-spapr.xml new file mode 100644 index 0000000000..f9cda19727 --- /dev/null +++ b/tests/qemuxml2argvdata/tpm-emulator-spapr.xml @@ -0,0 +1,60 @@ +<domain type='qemu'> + <name>TPM-VM</name> + <uuid>11d7cd22-da89-3094-6212-079a48a309a1</uuid> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>512288</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries-5.0'>hvm</type> + <boot dev='hd'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <console type='pty'> + <address type="spapr-vio"/> + </console> + + <!-- Two serials, first is the console --> + <serial type="pty"> + <address type="spapr-vio"/> + </serial> + <serial type="pty"> + <address type="spapr-vio"/> + </serial> + + <!-- One disk --> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/scsidisk.img"/> + <target dev="sda" bus="scsi"/> + <address type="drive" controller="1"/> + </disk> + + <!-- Two SCSI controllers --> + <controller type="scsi" index="1"> + <address type="spapr-vio"/> + </controller> + <controller type="scsi" index="0"> + <address type="spapr-vio"/> + </controller> + + <nvram> + <address type='spapr-vio' reg='0x4000'/> + </nvram> + + <!-- TPM emulator --> + <tpm model='tpm-spapr'> + <backend type='emulator' version='2.0'/> + </tpm> + + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a36183bf34..5691317bad 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -738,6 +738,9 @@ mymain(void) # define DO_TEST_CAPS_VER(name, ver) \ DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) +# define DO_TEST_CAPS_LATEST_PPC64(name) \ + DO_TEST_CAPS_ARCH_LATEST(name, "ppc64") + # define DO_TEST_CAPS_ARCH_LATEST_FAILURE(name, arch) \ DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \ ARG_FLAGS, FLAG_EXPECT_FAILURE) @@ -2193,6 +2196,7 @@ mymain(void) DO_TEST_CAPS_LATEST("tpm-emulator"); DO_TEST_CAPS_LATEST("tpm-emulator-tpm2"); DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-enc"); + DO_TEST_CAPS_LATEST_PPC64("tpm-emulator-spapr"); DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE); DO_TEST_PARSE_ERROR("pci-bus-invalid", NONE); -- 2.17.1