9c6c51
From 3984480fb9a20cd47de94db3f0246c90eb8c3c14 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <3984480fb9a20cd47de94db3f0246c90eb8c3c14@dist-git>
9c6c51
From: Erik Skultety <eskultet@redhat.com>
9c6c51
Date: Mon, 20 Aug 2018 17:18:51 +0200
9c6c51
Subject: [PATCH] tests: sev: Test launch-security with specific QEMU version
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
In order to test SEV we need real QEMU capabilities. Ideally, this would
9c6c51
be tested with -latest capabilities, however, our capabilities are
9c6c51
currently tied to Intel HW, even the 2.12.0 containing SEV were edited by
9c6c51
hand, so we can only use that one for now, as splitting the capabilities
9c6c51
according to the vendor is a refactor for another day. The need for real
9c6c51
capabilities comes from the extended SEV platform data (PDH, cbitpos,
9c6c51
etc.) we'll need to cache/parse.
9c6c51
9c6c51
Signed-off-by: Erik Skultety <eskultet@redhat.com>
9c6c51
Acked-by: Peter Krempa <pkrempa@redhat.com>
9c6c51
(cherry picked from commit 6c50cef8a3e4e3407fb42a713a353e42ae3f2bc6)
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1612009
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1619150
9c6c51
9c6c51
Signed-off-by: Erik Skultety <eskultet@redhat.com>
9c6c51
9c6c51
 Conflicts:
9c6c51
	tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
9c6c51
            - this wasn't a 100% clean file rename and git doesn't like
9c6c51
            that
9c6c51
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 ...=> launch-security-sev.x86_64-2.12.0.args} | 19 ++++++++++++-------
9c6c51
 tests/qemuxml2argvtest.c                      |  4 +---
9c6c51
 2 files changed, 13 insertions(+), 10 deletions(-)
9c6c51
 rename tests/qemuxml2argvdata/{launch-security-sev.args => launch-security-sev.x86_64-2.12.0.args} (54%)
9c6c51
9c6c51
diff --git a/tests/qemuxml2argvdata/launch-security-sev.args b/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
9c6c51
similarity index 54%
9c6c51
rename from tests/qemuxml2argvdata/launch-security-sev.args
9c6c51
rename to tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
9c6c51
index db0be1a27d..6da068e1a5 100644
9c6c51
--- a/tests/qemuxml2argvdata/launch-security-sev.args
9c6c51
+++ b/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
9c6c51
@@ -5,25 +5,30 @@ USER=test \
9c6c51
 LOGNAME=test \
9c6c51
 QEMU_AUDIO_DRV=none \
9c6c51
 /usr/bin/qemu-system-x86_64 \
9c6c51
--name QEMUGuest1 \
9c6c51
+-name guest=QEMUGuest1,debug-threads=on \
9c6c51
 -S \
9c6c51
+-object secret,id=masterKey0,format=raw,\
9c6c51
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
9c6c51
 -machine pc-1.0,accel=kvm,usb=off,dump-guest-core=off,memory-encryption=sev0 \
9c6c51
 -m 214 \
9c6c51
+-realtime mlock=off \
9c6c51
 -smp 1,sockets=1,cores=1,threads=1 \
9c6c51
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
9c6c51
 -display none \
9c6c51
 -no-user-config \
9c6c51
 -nodefaults \
9c6c51
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
9c6c51
-server,nowait \
9c6c51
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
9c6c51
 -mon chardev=charmonitor,id=monitor,mode=control \
9c6c51
 -rtc base=utc \
9c6c51
 -no-shutdown \
9c6c51
 -no-acpi \
9c6c51
--boot c \
9c6c51
--usb \
9c6c51
+-boot strict=on \
9c6c51
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
9c6c51
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
9c6c51
--device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
9c6c51
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
9c6c51
 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1,policy=0x1,\
9c6c51
 dh-cert-file=/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,\
9c6c51
-session-file=/tmp/lib/domain--1-QEMUGuest1/session.base64
9c6c51
+session-file=/tmp/lib/domain--1-QEMUGuest1/session.base64 \
9c6c51
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
9c6c51
+resourcecontrol=deny \
9c6c51
+-msg timestamp=on
9c6c51
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
9c6c51
index e6c0120670..02bb9889ee 100644
9c6c51
--- a/tests/qemuxml2argvtest.c
9c6c51
+++ b/tests/qemuxml2argvtest.c
9c6c51
@@ -2950,9 +2950,7 @@ mymain(void)
9c6c51
     DO_TEST_CAPS_LATEST("vhost-vsock");
9c6c51
     DO_TEST_CAPS_LATEST("vhost-vsock-auto");
9c6c51
 
9c6c51
-    DO_TEST("launch-security-sev",
9c6c51
-            QEMU_CAPS_KVM,
9c6c51
-            QEMU_CAPS_SEV_GUEST);
9c6c51
+    DO_TEST_CAPS_VER("launch-security-sev", "2.12.0");
9c6c51
 
9c6c51
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
9c6c51
         virFileDeleteTree(fakerootdir);
9c6c51
-- 
9c6c51
2.18.0
9c6c51