SHA256
1
0
forked from pool/qemu

Accepting request 602824 from Virtualization:Staging

Update to v2.12.0. Includes more tests for qemu-testsuite.

OBS-URL: https://build.opensuse.org/request/show/602824
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=409
This commit is contained in:
Bruce Rogers 2018-05-01 15:20:58 +00:00 committed by Git OBS Bridge
parent 1f38d8f308
commit 0a85de9260
106 changed files with 1027 additions and 5977 deletions

View File

@ -1,4 +1,4 @@
From 1a51a6b423402ce1cf03188d5b47d47c07854349 Mon Sep 17 00:00:00 2001
From 853d867a5db06bc90044554b6f30c339377a8389 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 21 Nov 2011 23:50:36 +0100
Subject: [PATCH] XXX dont dump core on sigabort
@ -8,7 +8,7 @@ Subject: [PATCH] XXX dont dump core on sigabort
1 file changed, 6 insertions(+)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index b858f1b0f1..752e814bc4 100644
index b283270391..93ba2c3304 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -560,6 +560,10 @@ static void QEMU_NORETURN dump_core_and_abort(int target_sig)

View File

@ -1,4 +1,4 @@
From 4f39ca8b4bfa8077b05faf7cfe5e15f326e7b5c4 Mon Sep 17 00:00:00 2001
From 59f664e34a535f0c55ffcb1f37b1dc10ece83c9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Wed, 10 Aug 2016 19:00:24 +0200
Subject: [PATCH] qemu-binfmt-conf: Modify default path
@ -14,10 +14,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 8afc3eb5bb..5c3ba942ec 100755
index 7ab7435fbd..adb3e1a613 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -264,7 +264,7 @@ BINFMT_SET=qemu_register_interpreter
@@ -299,7 +299,7 @@ BINFMT_SET=qemu_register_interpreter
SYSTEMDDIR="/etc/binfmt.d"
DEBIANDIR="/usr/share/binfmts"

View File

@ -1,4 +1,4 @@
From 1fcc7fdc072463a0954e7c0c934080058a8fb0d4 Mon Sep 17 00:00:00 2001
From fa82bb32e04288022ab786ad7d5b223d6e4fa4b5 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:25:41 +0200
Subject: [PATCH] qemu-cvs-gettimeofday
@ -9,10 +9,10 @@ No clue what this is for.
1 file changed, 2 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 11c9116c4a..dc6a102449 100644
index 643b8833de..db2a3f132c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8996,6 +8996,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
@@ -9159,6 +9159,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_gettimeofday:
{
struct timeval tv;

View File

@ -1,4 +1,4 @@
From 22461f1aeea83aecb71dfeaf8b90ffb74216fa6a Mon Sep 17 00:00:00 2001
From f04ab80dbccb7dc8badb7e510b80d75675a340f5 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:26:33 +0200
Subject: [PATCH] qemu-cvs-ioctl_debug
@ -12,10 +12,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index dc6a102449..faf890774a 100644
index db2a3f132c..ef7de52667 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5632,7 +5632,12 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
@@ -5698,7 +5698,12 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {

View File

@ -1,4 +1,4 @@
From 66779c72be83467bd5053d40f6c189c5238fc97a Mon Sep 17 00:00:00 2001
From 2dfd9f6a65dd6a5b2ea36ca9cbdb13c7ee649891 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:27:36 +0200
Subject: [PATCH] qemu-cvs-ioctl_nodirection
@ -15,10 +15,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
1 file changed, 6 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index faf890774a..5288ee0078 100644
index ef7de52667..25cc3e90bc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5669,6 +5669,11 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
@@ -5735,6 +5735,11 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
arg_type++;
target_size = thunk_type_size(arg_type, 0);
switch(ie->access) {
@ -30,7 +30,7 @@ index faf890774a..5288ee0078 100644
case IOC_R:
ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp));
if (!is_error(ret)) {
@@ -5687,6 +5692,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
@@ -5753,6 +5758,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
unlock_user(argptr, arg, 0);
ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp));
break;

View File

@ -1,4 +1,4 @@
From 66515950d58fda6057d0d17dbea2490d60f5bd0b Mon Sep 17 00:00:00 2001
From 8b8005b5c48ab1ee7ca8254d055c8fd2825df176 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 30 Sep 2011 19:40:36 +0200
Subject: [PATCH] linux-user: add binfmt wrapper for argv[0] handling
@ -37,7 +37,7 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
create mode 100644 linux-user/binfmt.c
diff --git a/Makefile.target b/Makefile.target
index f9a9da7e7c..3920383fb7 100644
index d0ec77a307..ddd1b0f1e9 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -36,6 +36,10 @@ endif

View File

@ -1,4 +1,4 @@
From 954d17d5ccae3340de3893872bc306542c2ad492 Mon Sep 17 00:00:00 2001
From 55aceb5b2167a94a65e03da12676d5c8318d1625 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 6 Jan 2012 01:05:55 +0100
Subject: [PATCH] PPC: KVM: Disable mmu notifier check
@ -13,10 +13,10 @@ KVM guests work there, even if possibly racy in some odd circumstances.
1 file changed, 2 insertions(+)
diff --git a/exec.c b/exec.c
index 03238a3449..1ca0f9e0ab 100644
index 02b1efebb7..3caa8c1eed 100644
--- a/exec.c
+++ b/exec.c
@@ -1975,11 +1975,13 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
@@ -2052,11 +2052,13 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
return NULL;
}

View File

@ -1,4 +1,4 @@
From e61d37b1ec17800a82e06a9231a4708f232da4ea Mon Sep 17 00:00:00 2001
From 2635ac986fb70408292c274b4c0327f2cfc401e2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 13 Jan 2012 17:05:41 +0100
Subject: [PATCH] linux-user: fix segfault deadlock
@ -26,10 +26,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 4 insertions(+)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index f42285ea1c..a96c56aa33 100644
index 26a3ffbba1..43bbf92f36 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -102,6 +102,10 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
@@ -103,6 +103,10 @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
pc, address, is_write, *(unsigned long *)old_set);
#endif
@ -38,5 +38,5 @@ index f42285ea1c..a96c56aa33 100644
+ tb_lock_reset();
+
/* XXX: locking issue */
if (is_write && h2g_valid(address)) {
switch (page_unprotect(h2g(address), pc)) {
/* Note that it is important that we don't call page_unprotect() unless
* this is really a "write to nonwriteable page" fault, because

View File

@ -1,4 +1,4 @@
From 9ae09852f058ac34d118cdde08082cbd37f86c2b Mon Sep 17 00:00:00 2001
From 18678e03622d987031ceb4da08fdc67f2d428832 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 2 Feb 2012 18:02:33 +0100
Subject: [PATCH] linux-user: binfmt: support host binaries

View File

@ -1,4 +1,4 @@
From 09f0630a44d60be34c6fae2a875e57ac72e4d276 Mon Sep 17 00:00:00 2001
From 5398492297fa5a5ae2b893aeed5c12d62c1a58de Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 23 Jul 2012 10:24:14 +0200
Subject: [PATCH] linux-user: Fake /proc/cpuinfo
@ -22,10 +22,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 20 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5288ee0078..feb8556076 100644
index 25cc3e90bc..d1e14071ad 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7499,6 +7499,25 @@ static int open_self_stat(void *cpu_env, int fd)
@@ -7566,6 +7566,25 @@ static int open_self_stat(void *cpu_env, int fd)
return 0;
}
@ -51,7 +51,7 @@ index 5288ee0078..feb8556076 100644
static int open_self_auxv(void *cpu_env, int fd)
{
CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
@@ -7613,6 +7632,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
@@ -7680,6 +7699,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
{ "/proc/net/route", open_net_route, is_proc },
#endif

View File

@ -1,4 +1,4 @@
From 5cd617b2b651852a98f5e3c4f3631fd461349410 Mon Sep 17 00:00:00 2001
From ba79c7b6559b50210be412d7f23e83749b4982a9 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 21 Aug 2012 14:20:40 +0200
Subject: [PATCH] linux-user: XXX disable fiemap
@ -9,10 +9,10 @@ agraf: fiemap breaks in libarchive. Disable it for now.
1 file changed, 5 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index feb8556076..da7deec78d 100644
index d1e14071ad..4e2f5e0fd0 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5097,6 +5097,11 @@ static abi_long do_ioctl_fs_ioc_fiemap(const IOCTLEntry *ie, uint8_t *buf_temp,
@@ -5154,6 +5154,11 @@ static abi_long do_ioctl_fs_ioc_fiemap(const IOCTLEntry *ie, uint8_t *buf_temp,
uint32_t outbufsz;
int free_fm = 0;

View File

@ -1,4 +1,4 @@
From 9a7bc05f85db8f058793c5d5709b453ad0d0542b Mon Sep 17 00:00:00 2001
From da2d73f2809fa98721f963fd858bd36f5bf8498f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 9 Oct 2012 09:06:49 +0200
Subject: [PATCH] linux-user: use target_ulong
@ -17,10 +17,10 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 4edd7d0c08..25208645e9 100644
index 192a0d2fef..725f3f5e63 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -196,10 +196,10 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
@@ -192,10 +192,10 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
void target_set_brk(abi_ulong new_brk);
abi_long do_brk(abi_ulong new_brk);
void syscall_init(void);
@ -33,13 +33,13 @@ index 4edd7d0c08..25208645e9 100644
+ abi_ulong arg5, abi_ulong arg6, abi_ulong arg7,
+ abi_ulong arg8);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
extern THREAD CPUState *thread_cpu;
extern __thread CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index da7deec78d..dee97c05be 100644
index 4e2f5e0fd0..6ce64d6c2e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7755,10 +7755,10 @@ static TargetFdTrans target_inotify_trans = {
@@ -7889,10 +7889,10 @@ static int host_to_target_cpu_mask(const unsigned long *host_mask,
/* do_syscall() should always have a single exit point at the end so
that actions, such as logging of syscall results, can be performed.
All errnos that do_syscall() returns must be -TARGET_<errcode>. */

View File

@ -1,4 +1,4 @@
From 87982f31e45440ef105d24afffbfd3023ce80331 Mon Sep 17 00:00:00 2001
From 29af67d7cdb46c617a920158b37626148b94b66d Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 1 Apr 2010 17:36:23 +0200
Subject: [PATCH] Make char muxer more robust wrt small FIFOs
@ -24,10 +24,11 @@ This patch fixes input when using -nographic on s390 for me.
chardev/char-mux.c | 14 ++++++++++++++
chardev/char.c | 1 +
include/chardev/char-mux.h | 3 +++
4 files changed, 19 insertions(+)
tests/test-char.c | 1 +
5 files changed, 20 insertions(+)
diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index ee6d596100..41e0b251a4 100644
index b1f228e8b5..f6e923bd7d 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -21,6 +21,7 @@
@ -39,18 +40,18 @@ index ee6d596100..41e0b251a4 100644
#include "qemu/error-report.h"
#include "qapi/error.h"
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 4cda5e7458..a6dc05c624 100644
index 1b925c8dec..bc97973f87 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
+#define HW_POISON_H // avoid poison since we patch against rules it "enforces"
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
@@ -179,6 +180,15 @@ static void mux_chr_accept_input(Chardev *chr)
#include "qemu/option.h"
@@ -190,6 +191,15 @@ static void mux_chr_accept_input(Chardev *chr)
be->chr_read(be->opaque,
&d->buffer[m][d->cons[m]++ & MUX_BUFFER_MASK], 1);
}
@ -66,7 +67,7 @@ index 4cda5e7458..a6dc05c624 100644
}
static int mux_chr_can_read(void *opaque)
@@ -314,6 +324,10 @@ static void qemu_chr_open_mux(Chardev *chr,
@@ -323,6 +333,10 @@ static void qemu_chr_open_mux(Chardev *chr,
}
d->focus = -1;
@ -78,22 +79,22 @@ index 4cda5e7458..a6dc05c624 100644
* set of muxes
*/
diff --git a/chardev/char.c b/chardev/char.c
index 2ae4f465ec..f90d428cfe 100644
index 76d866e6fe..021744f7e9 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
+#define HW_POISON_H // avoid poison since we patch against rules it "enforces"
#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "monitor/monitor.h"
diff --git a/include/chardev/char-mux.h b/include/chardev/char-mux.h
index 8928977897..ee9bfe7205 100644
index 1e13187767..3a000a9e9f 100644
--- a/include/chardev/char-mux.h
+++ b/include/chardev/char-mux.h
@@ -36,6 +36,9 @@ typedef struct MuxChardev {
@@ -34,6 +34,9 @@ typedef struct MuxChardev {
Chardev parent;
CharBackend *backends[MAX_MUX];
CharBackend chr;
@ -103,3 +104,12 @@ index 8928977897..ee9bfe7205 100644
int focus;
int mux_cnt;
int term_got_escape;
diff --git a/tests/test-char.c b/tests/test-char.c
index 306c728335..918f7b8820 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -1,3 +1,4 @@
+#define HW_POISON_H // avoid poison since we patch against rules it "enforces"
#include "qemu/osdep.h"
#include <glib/gstdio.h>

View File

@ -1,4 +1,4 @@
From 5e10b103a7060771d8314aa50f809a5097a7288c Mon Sep 17 00:00:00 2001
From a36180d75a0525d1cd2bb1929e6b348a0ba17be2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 13 Dec 2012 14:29:22 +0100
Subject: [PATCH] linux-user: lseek: explicitly cast non-set offsets to signed
@ -16,10 +16,10 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index dee97c05be..95fb8de295 100644
index 6ce64d6c2e..9dbcb7668d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8134,9 +8134,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
@@ -8268,9 +8268,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
case TARGET_NR_oldstat:
goto unimplemented;
#endif

View File

@ -1,4 +1,4 @@
From 0fc340f81a8d6ef82e99d1767103a1e775400ed1 Mon Sep 17 00:00:00 2001
From a8e7b6f492b5fe2d98ecb257e222c9e73942407d Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 14 Jan 2015 01:32:11 +0100
Subject: [PATCH] AIO: Reduce number of threads for 32bit hosts

View File

@ -1,4 +1,4 @@
From 45783db0ed8628cb9cdb4d3ebbf7471f2f88db9b Mon Sep 17 00:00:00 2001
From 150300e170a70517df3b59eb8e743277a76fccc9 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Wed, 9 Mar 2016 15:18:11 -0700
Subject: [PATCH] xen_disk: Add suse specific flush disable handling and map to
@ -17,10 +17,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
1 file changed, 15 insertions(+)
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index e431bd89e8..dceee88a78 100644
index f74fcd42d1..1696382f36 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -113,6 +113,7 @@ struct XenBlkDev {
@@ -115,6 +115,7 @@ struct XenBlkDev {
int requests_finished;
unsigned int max_requests;
@ -28,7 +28,7 @@ index e431bd89e8..dceee88a78 100644
/* Persistent grants extension */
gboolean feature_discard;
gboolean feature_persistent;
@@ -944,6 +945,16 @@ static void blk_parse_discard(struct XenBlkDev *blkdev)
@@ -967,6 +968,16 @@ static void blk_parse_discard(struct XenBlkDev *blkdev)
}
}
@ -45,7 +45,7 @@ index e431bd89e8..dceee88a78 100644
static int blk_init(struct XenDevice *xendev)
{
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
@@ -1022,6 +1033,7 @@ static int blk_init(struct XenDevice *xendev)
@@ -1047,6 +1058,7 @@ static int blk_init(struct XenDevice *xendev)
MAX_RING_PAGE_ORDER);
blk_parse_discard(blkdev);
@ -53,7 +53,7 @@ index e431bd89e8..dceee88a78 100644
g_free(directiosafe);
return 0;
@@ -1077,6 +1089,9 @@ static int blk_connect(struct XenDevice *xendev)
@@ -1104,6 +1116,9 @@ static int blk_connect(struct XenDevice *xendev)
qflags |= BDRV_O_UNMAP;
}

View File

@ -1,4 +1,4 @@
From 7d8219b4427779376c0d6405c169fb950ea1f43b Mon Sep 17 00:00:00 2001
From f3de20db1304cf3e517c2f5f901fa94a37f95166 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Tue, 2 Aug 2016 11:36:02 -0600
Subject: [PATCH] qemu-bridge-helper: reduce security profile

View File

@ -1,4 +1,4 @@
From 467907dc59bb7b955d78f37a190958cbb4cc837d Mon Sep 17 00:00:00 2001
From fb67fe30ce2ebaec9884de1339283c1f8f040516 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Fri, 12 Aug 2016 18:20:49 +0200
Subject: [PATCH] qemu-binfmt-conf: use qemu-ARCH-binfmt
@ -13,10 +13,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 5c3ba942ec..bb29213fa5 100755
index adb3e1a613..1107386b80 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -206,7 +206,7 @@ qemu_check_systemd() {
@@ -241,7 +241,7 @@ qemu_check_systemd() {
}
qemu_generate_register() {
@ -25,7 +25,7 @@ index 5c3ba942ec..bb29213fa5 100755
}
qemu_register_interpreter() {
@@ -247,9 +247,9 @@ qemu_set_binfmts() {
@@ -282,9 +282,9 @@ qemu_set_binfmts() {
continue
fi

View File

@ -1,4 +1,4 @@
From f885b1a3afadad00b6a28af2ce25ecebe4cc32cb Mon Sep 17 00:00:00 2001
From a6780492932efe56032ad1fc336fb5f03b3ee4b2 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Thu, 8 Sep 2016 11:21:05 +0200
Subject: [PATCH] linux-user: properly test for infinite timeout in poll (#8)
@ -16,10 +16,10 @@ Signed-off-by: Andreas Schwab <schwab@suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 95fb8de295..642462242b 100644
index 9dbcb7668d..5b8d844d9b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10286,7 +10286,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
@@ -10454,7 +10454,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
{
struct timespec ts, *pts;

View File

@ -1,4 +1,4 @@
From 6d5775e5a6a2ef48703c545772c6f0a0ab9ed887 Mon Sep 17 00:00:00 2001
From 1dc760f3b436dc6bf9e68ec529682aa3d79ce217 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Sat, 19 Nov 2016 08:06:30 -0700
Subject: [PATCH] roms/Makefile: pass a packaging timestamp to subpackages with
@ -20,7 +20,7 @@ Signed-off-by: Bruce Rogers <brogers@suse.com>
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/roms/Makefile b/roms/Makefile
index b5e5a69e91..89d69eb350 100644
index 02b69fbac8..7d97ba46a9 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -52,6 +52,12 @@ SEABIOS_EXTRAVERSION="-prebuilt.qemu-project.org"
@ -36,7 +36,7 @@ index b5e5a69e91..89d69eb350 100644
default:
@echo "nothing is build by default"
@echo "available build targets:"
@@ -106,7 +112,7 @@ build-lgplvgabios:
@@ -107,7 +113,7 @@ build-lgplvgabios:
.PHONY: sgabios skiboot
sgabios:
@ -45,7 +45,7 @@ index b5e5a69e91..89d69eb350 100644
cp sgabios/sgabios.bin ../pc-bios
@@ -126,18 +132,22 @@ efi-rom-%: build-pxe-roms build-efi-roms
@@ -127,18 +133,22 @@ efi-rom-%: build-pxe-roms build-efi-roms
build-pxe-roms:
$(MAKE) -C ipxe/src CONFIG=qemu \

View File

@ -1,4 +1,4 @@
From 34dc5aecd47ac65b43fda0d85c17ea33f333b9ce Mon Sep 17 00:00:00 2001
From 522aede2849b955e7407624870c6d1fff518b7c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Sun, 15 Jan 2012 19:53:49 +0100
Subject: [PATCH] Raise soft address space limit to hard limit
@ -17,18 +17,18 @@ Signed-off-by: Bruce Rogers <brogers@suse.com>
1 file changed, 12 insertions(+)
diff --git a/vl.c b/vl.c
index 1ad1c04637..11d14b3ec1 100644
index fce1fd12d8..c00a250831 100644
--- a/vl.c
+++ b/vl.c
@@ -26,6 +26,7 @@
@@ -28,6 +28,7 @@
#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "qemu/uuid.h"
+#include <sys/resource.h>
#ifdef CONFIG_SECCOMP
#include "sysemu/seccomp.h"
@@ -3132,6 +3133,7 @@ int main(int argc, char **argv, char **envp)
#include <sys/prctl.h>
@@ -3059,6 +3060,7 @@ int main(int argc, char **argv, char **envp)
} BlockdevOptions_queue;
QSIMPLEQ_HEAD(, BlockdevOptions_queue) bdo_queue
= QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
@ -36,8 +36,8 @@ index 1ad1c04637..11d14b3ec1 100644
module_call_init(MODULE_INIT_TRACE);
@@ -3139,6 +3141,16 @@ int main(int argc, char **argv, char **envp)
qemu_init_cpu_loop();
@@ -3067,6 +3069,16 @@ int main(int argc, char **argv, char **envp)
qemu_mutex_lock_iothread();
+ /*

View File

@ -1,4 +1,4 @@
From 43638ed256283e67877d0c18f38f0b8b2a132116 Mon Sep 17 00:00:00 2001
From 277b158cc6e5f00f3be96aab16bda13865d3b354 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Fri, 17 May 2013 16:49:58 -0600
Subject: [PATCH] increase x86_64 physical bits to 42
@ -19,10 +19,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index f3d0ebb673..4e66a0404e 100644
index 1b219fafc4..164884f1d8 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1508,7 +1508,7 @@ uint64_t cpu_get_tsc(CPUX86State *env);
@@ -1583,7 +1583,7 @@ uint64_t cpu_get_tsc(CPUX86State *env);
/* XXX: This value should match the one returned by CPUID
* and in exec.c */
# if defined(TARGET_X86_64)

View File

@ -1,4 +1,4 @@
From 46f00361392e6b37f7784759fa0bafaba4f53ccc Mon Sep 17 00:00:00 2001
From 5f889cb737fd5bf76d03e265d7bbffae0572516a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Wed, 12 Jun 2013 19:26:37 +0200
Subject: [PATCH] vga: Raise VRAM to 16 MiB for pc-0.15 and below
@ -25,10 +25,10 @@ Signed-off-by: Bruce Rogers <brogers@suse.com>
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5e47528993..a1994c77ee 100644
index 729a0508aa..6000f8c898 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -793,7 +793,32 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
@@ -797,7 +797,32 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
#define PC_COMPAT_0_15 \

View File

@ -1,4 +1,4 @@
From cb942fa994767ed596877a74d12c07469941e4a3 Mon Sep 17 00:00:00 2001
From cb75869521f011bff93fe429d1084051aaf5896f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Wed, 31 Jul 2013 17:05:29 +0200
Subject: [PATCH] i8254: Fix migration from SLE11 SP2
@ -17,10 +17,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 7 insertions(+)
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
index b623c96198..18e69688c9 100644
index 6190b6fc5d..177b1acf37 100644
--- a/hw/timer/i8254_common.c
+++ b/hw/timer/i8254_common.c
@@ -260,6 +260,12 @@ static int pit_dispatch_post_load(void *opaque, int version_id)
@@ -259,6 +259,12 @@ static int pit_dispatch_post_load(void *opaque, int version_id)
return 0;
}
@ -33,7 +33,7 @@ index b623c96198..18e69688c9 100644
static const VMStateDescription vmstate_pit_common = {
.name = "i8254",
.version_id = 3,
@@ -269,6 +275,7 @@ static const VMStateDescription vmstate_pit_common = {
@@ -268,6 +274,7 @@ static const VMStateDescription vmstate_pit_common = {
.pre_save = pit_dispatch_pre_save,
.post_load = pit_dispatch_post_load,
.fields = (VMStateField[]) {

View File

@ -1,4 +1,4 @@
From b95747d42aadcc6555a98eb2c5db15cae291b0b0 Mon Sep 17 00:00:00 2001
From 647e494a0b04cb5a262ee973ebfaedba688ed772 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Wed, 31 Jul 2013 17:32:35 +0200
Subject: [PATCH] acpi_piix4: Fix migration from SLE11 SP2
@ -17,7 +17,7 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index a0fb1ce037..67a36cb660 100644
index 8b703455b7..4fddf8d694 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -311,7 +311,7 @@ static const VMStateDescription vmstate_cpuhp_state = {

View File

@ -1,4 +1,4 @@
From 14812344beb127d20d9fc58d9283d78946b432e6 Mon Sep 17 00:00:00 2001
From c630166cf5b74b95af9ef894251b385e305963b8 Mon Sep 17 00:00:00 2001
From: Chunyan Liu <cyliu@suse.com>
Date: Thu, 3 Mar 2016 16:48:17 +0800
Subject: [PATCH] Fix tigervnc long press issue
@ -24,10 +24,10 @@ Signed-off-by: Chunyan Liu <cyliu@suse.com>
1 file changed, 19 insertions(+)
diff --git a/ui/vnc.c b/ui/vnc.c
index 06abe7360e..cb425f0aed 100644
index e164eb798c..5ebae6f664 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1802,6 +1802,25 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
@@ -1817,6 +1817,25 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
if (down)
vs->modifiers_state[keycode] ^= 1;
break;

View File

@ -1,4 +1,4 @@
From 467310d802cf7790129dbd2f0559da13c08c4718 Mon Sep 17 00:00:00 2001
From 114d411a7af47fc4ccac68c5b38b99684fb0e545 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Thu, 24 Sep 2015 19:21:11 +0200
Subject: [PATCH] string-input-visitor: Fix uint64 parsing

View File

@ -1,4 +1,4 @@
From 33c5e0f025d380144fcd310fc67d69cf57e2100f Mon Sep 17 00:00:00 2001
From 1581fd1dd1caeb73f477a217b5cda182b83d959f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Thu, 24 Sep 2015 19:23:50 +0200
Subject: [PATCH] test-string-input-visitor: Add int test case
@ -14,10 +14,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 8 insertions(+)
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 4f9c36bef1..470f58e0ab 100644
index 88e0e1aa9a..9bbe9c1120 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -55,6 +55,14 @@ static void test_visitor_in_int(TestInputVisitorData *data,
@@ -53,6 +53,14 @@ static void test_visitor_in_int(TestInputVisitorData *data,
v = visitor_input_test_init(data, "-42");

View File

@ -1,4 +1,4 @@
From 5f820fc473f23dc626d0314082072a8fccdb43f6 Mon Sep 17 00:00:00 2001
From c65473ea7a0449452118a1dfcbefc7a8b438a702 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Thu, 24 Sep 2015 19:24:23 +0200
Subject: [PATCH] test-string-input-visitor: Add uint64 test
@ -15,10 +15,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
1 file changed, 23 insertions(+)
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 470f58e0ab..0bf22777cf 100644
index 9bbe9c1120..099ff7f5ab 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -78,6 +78,27 @@ static void test_visitor_in_int(TestInputVisitorData *data,
@@ -76,6 +76,27 @@ static void test_visitor_in_int(TestInputVisitorData *data,
error_free_or_abort(&err);
}
@ -46,7 +46,7 @@ index 470f58e0ab..0bf22777cf 100644
static void check_ilist(Visitor *v, int64_t *expected, size_t n)
{
int64List *res = NULL;
@@ -364,6 +385,8 @@ int main(int argc, char **argv)
@@ -362,6 +383,8 @@ int main(int argc, char **argv)
input_visitor_test_add("/string-visitor/input/int",
&in_visitor_data, test_visitor_in_int);

View File

@ -1,4 +1,4 @@
From 466bf8436ac9720529c5a9baae4a901f4988da0b Mon Sep 17 00:00:00 2001
From fdc0f082c094bd538a56a54e2430a47ab3d98a44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Sun, 6 Sep 2015 20:12:42 +0200
Subject: [PATCH] tests: Add QOM property unit tests
@ -17,10 +17,10 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
create mode 100644 tests/check-qom-props.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 0255113470..7801583a76 100644
index 24b70169bc..97a12a92fa 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1521,6 +1521,7 @@ F: qom/
@@ -1619,6 +1619,7 @@ F: qom/
X: qom/cpu.c
F: tests/check-qom-interface.c
F: tests/check-qom-proplist.c
@ -29,10 +29,10 @@ index 0255113470..7801583a76 100644
QMP
diff --git a/tests/Makefile.include b/tests/Makefile.include
index c002352134..f777533f1a 100644
index 3b9a5e31a2..7dbfe5e4ad 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -116,6 +116,8 @@ check-unit-y += tests/check-qom-interface$(EXESUF)
@@ -127,6 +127,8 @@ check-unit-y += tests/check-qom-interface$(EXESUF)
gcov-files-check-qom-interface-y = qom/object.c
check-unit-y += tests/check-qom-proplist$(EXESUF)
gcov-files-check-qom-proplist-y = qom/object.c
@ -41,7 +41,7 @@ index c002352134..f777533f1a 100644
check-unit-y += tests/test-qemu-opts$(EXESUF)
gcov-files-test-qemu-opts-y = util/qemu-option.c
check-unit-y += tests/test-keyval$(EXESUF)
@@ -586,6 +588,7 @@ tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
@@ -617,6 +619,7 @@ tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)

View File

@ -1,4 +1,4 @@
From e500d6e4a2f964c2718686731113336da7c013c6 Mon Sep 17 00:00:00 2001
From 7de5bd85d7eaa31cd3bc7463da5969dd2a464248 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Fri, 25 Sep 2015 12:31:11 +0200
Subject: [PATCH] tests: Add scsi-disk test
@ -15,15 +15,15 @@ Signed-off-by: Andreas Färber <afaerber@suse.de>
---
MAINTAINERS | 1 +
tests/Makefile.include | 3 ++
tests/scsi-disk-test.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+)
tests/scsi-disk-test.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 87 insertions(+)
create mode 100644 tests/scsi-disk-test.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 7801583a76..e7dbf3c9b2 100644
index 97a12a92fa..3546001872 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1003,6 +1003,7 @@ M: Paolo Bonzini <pbonzini@redhat.com>
@@ -1093,6 +1093,7 @@ R: Fam Zheng <famz@redhat.com>
S: Supported
F: include/hw/scsi/*
F: hw/scsi/*
@ -32,10 +32,10 @@ index 7801583a76..e7dbf3c9b2 100644
T: git git://github.com/bonzini/qemu.git scsi-next
diff --git a/tests/Makefile.include b/tests/Makefile.include
index f777533f1a..199b7bbddd 100644
index 7dbfe5e4ad..0d76624dd5 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -188,6 +188,8 @@ check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
@@ -200,6 +200,8 @@ check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
gcov-files-virtio-y += hw/virtio/virtio-rng.c
check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
@ -44,7 +44,7 @@ index f777533f1a..199b7bbddd 100644
ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
gcov-files-virtio-y += hw/9pfs/virtio-9p.c
@@ -793,6 +795,7 @@ tests/migration-test$(EXESUF): tests/migration-test.o
@@ -821,6 +823,7 @@ tests/migration-test$(EXESUF): tests/migration-test.o
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o $(test-util-obj-y) \
$(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) $(libqos-pc-obj-y) \
$(chardev-obj-y)
@ -54,10 +54,10 @@ index f777533f1a..199b7bbddd 100644
tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
diff --git a/tests/scsi-disk-test.c b/tests/scsi-disk-test.c
new file mode 100644
index 0000000000..5dc7e71417
index 0000000000..cd8c807200
--- /dev/null
+++ b/tests/scsi-disk-test.c
@@ -0,0 +1,82 @@
@@ -0,0 +1,83 @@
+/*
+ * QTest testcase for SCSI disks
+ * See virtio-scsi-test for more integrated tests.
@ -72,6 +72,7 @@ index 0000000000..5dc7e71417
+#include <glib.h>
+#include "libqtest.h"
+#include "qapi/qmp/qnum.h"
+#include "qapi/qmp/qdict.h"
+
+static void test_scsi_disk_common(const char *type, const char *id)
+{
@ -96,7 +97,7 @@ index 0000000000..5dc7e71417
+ path);
+ g_assert(response);
+ g_assert(qdict_haskey(response, "return"));
+ value = qobject_to_qnum(qdict_get(response, "return"));
+ value = qobject_to(QNum, qdict_get(response, "return"));
+ g_assert_cmpint(qnum_get_uint(value), ==, UINT64_MAX);
+
+ response = qmp("{ 'execute': 'qom-get',"
@ -105,7 +106,7 @@ index 0000000000..5dc7e71417
+ path);
+ g_assert(response);
+ g_assert(qdict_haskey(response, "return"));
+ value = qobject_to_qnum(qdict_get(response, "return"));
+ value = qobject_to(QNum, qdict_get(response, "return"));
+ g_assert_cmpint(qnum_get_uint(value), ==, UINT64_C(1) << 63);
+
+ g_free(path);

View File

@ -1,4 +1,4 @@
From df14b8456cc69b8948786a8008840418d5008fa5 Mon Sep 17 00:00:00 2001
From aed2596727a664bc9350d89a6cddc87bdb3ea93d Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Fri, 3 Nov 2017 11:12:40 -0600
Subject: [PATCH] Switch order of libraries for mpath support
@ -10,10 +10,10 @@ Signed-off-by: Bruce Rogers <brogers@suse.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index ab0354c153..4be3366e27 100644
index d71dd5bea4..3c5368382c 100644
--- a/Makefile
+++ b/Makefile
@@ -449,7 +449,7 @@ fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
@@ -544,7 +544,7 @@ fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
ifdef CONFIG_MPATH
@ -23,10 +23,10 @@ index ab0354c153..4be3366e27 100644
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
diff --git a/configure b/configure
index 0c6e7572db..01e1d15fa4 100755
index 0a19b033bc..e84dce857d 100755
--- a/configure
+++ b/configure
@@ -3382,7 +3382,7 @@ int main(void) {
@@ -3486,7 +3486,7 @@ int main(void) {
return 0;
}
EOF

View File

@ -1,4 +1,4 @@
From 8635ebbf94af8dbcd20da8f52e8081f1be8c977c Mon Sep 17 00:00:00 2001
From 9ca3a32b648a48f0f9752310e57cda99b4e4c70c Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Thu, 25 Jan 2018 14:16:10 -0700
Subject: [PATCH] Make installed scripts explicitly python2
@ -14,7 +14,7 @@ Signed-off-by: Bruce Rogers <brogers@suse.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 14553876a2..a512ddc552 100755
index 88ff4adb30..519b600161 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -1,4 +1,4 @@

View File

@ -1,55 +0,0 @@
From 7c2613d2ed9d35c8634248204acdffcf96e1e6b2 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 28 Nov 2017 11:51:27 +0100
Subject: [PATCH] memfd: fix configure test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Recent glibc added memfd_create in sys/mman.h. This conflicts with
the definition in util/memfd.c:
/builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration
Fix the configure test, and remove the sys/memfd.h inclusion since the
file actually does not exist---it is a typo in the memfd_create(2) man
page.
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 75e5b70e6b5dcc4f2219992d7cffa462aa406af0)
[BR: BOO#1081154]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
configure | 2 +-
util/memfd.c | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 01e1d15fa4..71b8b473fc 100755
--- a/configure
+++ b/configure
@@ -3920,7 +3920,7 @@ fi
# check if memfd is supported
memfd=no
cat > $TMPC << EOF
-#include <sys/memfd.h>
+#include <sys/mman.h>
int main(void)
{
diff --git a/util/memfd.c b/util/memfd.c
index 4571d1aba8..412e94a405 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -31,9 +31,7 @@
#include "qemu/memfd.h"
-#ifdef CONFIG_MEMFD
-#include <sys/memfd.h>
-#elif defined CONFIG_LINUX
+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
#include <sys/syscall.h>
#include <asm/unistd.h>

View File

@ -1,4 +1,4 @@
From 555715ac88c361e4c9b262235010c265729738bf Mon Sep 17 00:00:00 2001
From 8697082d1fd625f74e919d697cca2b75f720a04b Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Wed, 21 Feb 2018 14:00:52 -0700
Subject: [PATCH] migration: warn about inconsistent spec_ctrl state
@ -22,10 +22,10 @@ Signed-off-by: Bruce Rogers <brogers@suse.com>
3 files changed, 21 insertions(+)
diff --git a/cpus.c b/cpus.c
index d1e7e28993..1bfdb155dc 100644
index 38eba8bff3..ef39603cf9 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2039,6 +2039,18 @@ exit:
@@ -2312,6 +2312,18 @@ exit:
fclose(f);
}
@ -45,20 +45,20 @@ index d1e7e28993..1bfdb155dc 100644
{
nmi_monitor_handle(monitor_get_cpu_index(), errp);
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index 9910f49b3a..c5803bfacc 100644
index ef7bd16123..c4ecb386fe 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -210,4 +210,5 @@ void qemu_lockcnt_inc_and_unlock(QemuLockCnt *lockcnt);
@@ -240,4 +240,5 @@ void qemu_lockcnt_inc_and_unlock(QemuLockCnt *lockcnt);
*/
unsigned qemu_lockcnt_count(QemuLockCnt *lockcnt);
+bool spec_ctrl_is_inconsistent(void);
#endif
diff --git a/migration/migration.c b/migration/migration.c
index d780601f0c..d39c43c6b7 100644
index 52a5092add..3cf11aadfa 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2121,6 +2121,14 @@ static void migration_completion(MigrationState *s, int current_active_state,
@@ -2163,6 +2163,14 @@ static void migration_completion(MigrationState *s)
migrate_set_state(&s->state, current_active_state,
MIGRATION_STATUS_COMPLETED);
}

View File

@ -1,253 +0,0 @@
From b644653df5e25a922d5bb7d9fb9c86bfe9dda86c Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:05 +0000
Subject: [PATCH] qapi: use items()/values() intead of iteritems()/itervalues()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The iteritems()/itervalues() methods are gone in py3, but the
items()/values() methods are still around. The latter are less
efficient than the former in py2, but this has unmeasurably
small impact on QEMU build time, so taking portability over
efficiency is a net win.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-3-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 2f8480447067d6f42af52a886385284ead052af9)
[BR: BSC#1077564 - note that this patch also includes commit
ef9d9108917d6d5f903bca31602827e512a51c50 squashed in, which is how
I originally included patch. This avoids renaming of the patch queue]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
scripts/qapi.py | 24 ++++++++++++------------
scripts/qapi2texi.py | 11 ++++++-----
tests/qapi-schema/test-qapi.py | 37 +++++++++++++++++++------------------
3 files changed, 37 insertions(+), 35 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 62dc52ed6e..d5ac21ad35 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -11,6 +11,7 @@
# This work is licensed under the terms of the GNU GPL, version 2.
# See the COPYING file in the top-level directory.
+from __future__ import print_function
import errno
import getopt
import os
@@ -252,7 +253,7 @@ class QAPIDoc(object):
"'Returns:' is only valid for commands")
def check(self):
- bogus = [name for name, section in self.args.iteritems()
+ bogus = [name for name, section in self.args.items()
if not section.member]
if bogus:
raise QAPISemError(
@@ -308,7 +309,7 @@ class QAPISchemaParser(object):
if not isinstance(pragma, dict):
raise QAPISemError(
info, "Value of 'pragma' must be a dictionary")
- for name, value in pragma.iteritems():
+ for name, value in pragma.items():
self._pragma(name, value, info)
else:
expr_elem = {'expr': expr,
@@ -1476,7 +1477,7 @@ class QAPISchema(object):
self._def_exprs()
self.check()
except QAPIError as err:
- print >>sys.stderr, err
+ print(err, file=sys.stderr)
exit(1)
def _def_entity(self, ent):
@@ -1574,7 +1575,7 @@ class QAPISchema(object):
def _make_members(self, data, info):
return [self._make_member(key, value, info)
- for (key, value) in data.iteritems()]
+ for (key, value) in data.items()]
def _def_struct_type(self, expr, info, doc):
name = expr['struct']
@@ -1606,11 +1607,11 @@ class QAPISchema(object):
name, info, doc, 'base', self._make_members(base, info)))
if tag_name:
variants = [self._make_variant(key, value)
- for (key, value) in data.iteritems()]
+ for (key, value) in data.items()]
members = []
else:
variants = [self._make_simple_variant(key, value, info)
- for (key, value) in data.iteritems()]
+ for (key, value) in data.items()]
typ = self._make_implicit_enum_type(name, info,
[v.name for v in variants])
tag_member = QAPISchemaObjectTypeMember('type', typ, False)
@@ -1625,7 +1626,7 @@ class QAPISchema(object):
name = expr['alternate']
data = expr['data']
variants = [self._make_variant(key, value)
- for (key, value) in data.iteritems()]
+ for (key, value) in data.items()]
tag_member = QAPISchemaObjectTypeMember('type', 'QType', False)
self._def_entity(
QAPISchemaAlternateType(name, info, doc,
@@ -1940,7 +1941,7 @@ def parse_command_line(extra_options='', extra_long_options=[]):
['source', 'header', 'prefix=',
'output-dir='] + extra_long_options)
except getopt.GetoptError as err:
- print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
+ print("%s: %s" % (sys.argv[0], str(err)), file=sys.stderr)
sys.exit(1)
output_dir = ''
@@ -1954,9 +1955,8 @@ def parse_command_line(extra_options='', extra_long_options=[]):
if o in ('-p', '--prefix'):
match = re.match(r'([A-Za-z_.-][A-Za-z0-9_.-]*)?', a)
if match.end() != len(a):
- print >>sys.stderr, \
- "%s: 'funny character '%s' in argument of --prefix" \
- % (sys.argv[0], a[match.end()])
+ print("%s: 'funny character '%s' in argument of --prefix" \
+ % (sys.argv[0], a[match.end()]), file=sys.stderr)
sys.exit(1)
prefix = a
elif o in ('-o', '--output-dir'):
@@ -1973,7 +1973,7 @@ def parse_command_line(extra_options='', extra_long_options=[]):
do_h = True
if len(args) != 1:
- print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0]
+ print("%s: need exactly one argument" % sys.argv[0], file=sys.stderr)
sys.exit(1)
fname = args[0]
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py
index a317526e51..a61e88934b 100755
--- a/scripts/qapi2texi.py
+++ b/scripts/qapi2texi.py
@@ -4,6 +4,7 @@
# This work is licensed under the terms of the GNU LGPL, version 2+.
# See the COPYING file in the top-level directory.
"""This script produces the documentation of a qapi schema in texinfo format"""
+from __future__ import print_function
import re
import sys
@@ -147,7 +148,7 @@ def texi_member(member, suffix=''):
def texi_members(doc, what, base, variants, member_func):
"""Format the table of members"""
items = ''
- for section in doc.args.itervalues():
+ for section in doc.args.values():
# TODO Drop fallbacks when undocumented members are outlawed
if section.content:
desc = texi_format(str(section))
@@ -285,15 +286,15 @@ def texi_schema(schema):
def main(argv):
"""Takes schema argument, prints result to stdout"""
if len(argv) != 2:
- print >>sys.stderr, "%s: need exactly 1 argument: SCHEMA" % argv[0]
+ print("%s: need exactly 1 argument: SCHEMA" % argv[0], file=sys.stderr)
sys.exit(1)
schema = qapi.QAPISchema(argv[1])
if not qapi.doc_required:
- print >>sys.stderr, ("%s: need pragma 'doc-required' "
- "to generate documentation" % argv[0])
+ print("%s: need pragma 'doc-required' "
+ "to generate documentation" % argv[0], file=sys.stderr)
sys.exit(1)
- print texi_schema(schema)
+ print(texi_schema(schema))
if __name__ == '__main__':
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index c7724d3437..9bbe35daf0 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -10,6 +10,7 @@
# See the COPYING file in the top-level directory.
#
+from __future__ import print_function
from qapi import *
from pprint import pprint
import os
@@ -18,51 +19,51 @@ import sys
class QAPISchemaTestVisitor(QAPISchemaVisitor):
def visit_enum_type(self, name, info, values, prefix):
- print 'enum %s %s' % (name, values)
+ print('enum %s %s' % (name, values))
if prefix:
- print ' prefix %s' % prefix
+ print(' prefix %s' % prefix)
def visit_object_type(self, name, info, base, members, variants):
- print 'object %s' % name
+ print('object %s' % name)
if base:
- print ' base %s' % base.name
+ print(' base %s' % base.name)
for m in members:
- print ' member %s: %s optional=%s' % \
- (m.name, m.type.name, m.optional)
+ print(' member %s: %s optional=%s' % \
+ (m.name, m.type.name, m.optional))
self._print_variants(variants)
def visit_alternate_type(self, name, info, variants):
- print 'alternate %s' % name
+ print('alternate %s' % name)
self._print_variants(variants)
def visit_command(self, name, info, arg_type, ret_type,
gen, success_response, boxed):
- print 'command %s %s -> %s' % \
+ print('command %s %s -> %s' % \)
(name, arg_type and arg_type.name, ret_type and ret_type.name)
- print ' gen=%s success_response=%s boxed=%s' % \
+ print(' gen=%s success_response=%s boxed=%s' % \)
(gen, success_response, boxed)
def visit_event(self, name, info, arg_type, boxed):
- print 'event %s %s' % (name, arg_type and arg_type.name)
- print ' boxed=%s' % boxed
+ print('event %s %s' % (name, arg_type and arg_type.name))
+ print(' boxed=%s' % boxed)
@staticmethod
def _print_variants(variants):
if variants:
- print ' tag %s' % variants.tag_member.name
+ print(' tag %s' % variants.tag_member.name)
for v in variants.variants:
- print ' case %s: %s' % (v.name, v.type.name)
+ print(' case %s: %s' % (v.name, v.type.name))
schema = QAPISchema(sys.argv[1])
schema.visit(QAPISchemaTestVisitor())
for doc in schema.docs:
if doc.symbol:
- print 'doc symbol=%s' % doc.symbol
+ print('doc symbol=%s' % doc.symbol)
else:
- print 'doc freeform'
- print ' body=\n%s' % doc.body
+ print('doc freeform')
+ print(' body=\n%s' % doc.body)
for arg, section in doc.args.iteritems():
- print ' arg=%s\n%s' % (arg, section)
+ print(' arg=%s\n%s' % (arg, section))
for section in doc.sections:
- print ' section=%s\n%s' % (section.name, section)
+ print(' section=%s\n%s' % (section.name, section))

View File

@ -1,39 +0,0 @@
From a1cd35be6c021ebea74d43da4ebb3b92b7064b72 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:06 +0000
Subject: [PATCH] qapi: Use OrderedDict from standard library if available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The OrderedDict class appeared in the 'collections' module
from python 2.7 onwards, so use that in preference to our
local backport if available.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-4-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 38710a8994911d98acbe183a39ec3a53638de510)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
scripts/qapi.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index d5ac21ad35..dba6cd6779 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -18,7 +18,10 @@ import os
import re
import string
import sys
-from ordereddict import OrderedDict
+try:
+ from collections import OrderedDict
+except:
+ from ordereddict import OrderedDict
builtin_types = {
'null': 'QTYPE_QNULL',

View File

@ -1,4 +1,4 @@
From 2327abe59d36fda675560f955923a638fd1eed0d Mon Sep 17 00:00:00 2001
From 82f73214b4bb024153408b121ccb78321093862f Mon Sep 17 00:00:00 2001
From: Lin Ma <lma@suse.com>
Date: Wed, 14 Mar 2018 14:31:26 +0800
Subject: [PATCH] smbios: Add 1 terminator if any string fields defined in
@ -29,10 +29,10 @@ Signed-off-by: Lin Ma <lma@suse.com>
2 files changed, 134 insertions(+)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 5d11f01874..d9f5f1ef70 100644
index 27a07e96f4..b4515ae787 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -954,6 +954,9 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
@@ -955,6 +955,9 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
{
const char *val;
@ -42,7 +42,7 @@ index 5d11f01874..d9f5f1ef70 100644
assert(!smbios_immutable);
val = qemu_opt_get(opts, "file");
@@ -995,7 +998,94 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
@@ -996,7 +999,94 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
smbios_type4_count++;
}
@ -138,10 +138,10 @@ index 5d11f01874..d9f5f1ef70 100644
smbios_table_max = size;
}
diff --git a/include/hw/smbios/smbios.h b/include/hw/smbios/smbios.h
index a83adb93d7..6613f68ad1 100644
index eeb5a4d7b6..2662df995a 100644
--- a/include/hw/smbios/smbios.h
+++ b/include/hw/smbios/smbios.h
@@ -273,4 +273,48 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
@@ -272,4 +272,48 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
const unsigned int mem_array_size,
uint8_t **tables, size_t *tables_len,
uint8_t **anchor, size_t *anchor_len);

View File

@ -1,4 +1,4 @@
From 3c263c86795e5c2325ccdc4ac098a37c60eeb8c4 Mon Sep 17 00:00:00 2001
From 0d10e6cbe3c88323dd478f8bbd13e09358db2ee0 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 20 Dec 2017 15:43:07 -0800
Subject: [PATCH] Remove problematic 'evdev 86' key from en-us keymap

View File

@ -1,44 +0,0 @@
From 474475499831d76f92dcdde71ff2d0a29205f2ff Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:07 +0000
Subject: [PATCH] qapi: adapt to moved location of StringIO module in py3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-5-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 5f90af8e6b34f9e6b60eb05a15707a95a0febbde)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
scripts/qapi.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index dba6cd6779..7882ae77fb 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -22,6 +22,10 @@ try:
from collections import OrderedDict
except:
from ordereddict import OrderedDict
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
builtin_types = {
'null': 'QTYPE_QNULL',
@@ -2004,8 +2008,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file,
if really:
return open(name, opt)
else:
- import StringIO
- return StringIO.StringIO()
+ return StringIO()
fdef = maybe_open(do_c, c_file, 'w')
fdecl = maybe_open(do_h, h_file, 'w')

View File

@ -0,0 +1,26 @@
From 2af288c3c5b915d8a51f62b3b06d9d15b44a806c Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Fri, 6 Apr 2018 09:21:56 -0600
Subject: [PATCH] configure: Modify python used for io tests
Because the block io tests are not yet ported to python3, change
the python env var to explicitly reference python2.
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index e84dce857d..a0e53bffc7 100755
--- a/configure
+++ b/configure
@@ -7188,7 +7188,7 @@ iotests_check="tests/qemu-iotests/check"
echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
echo >> "$iotests_common_env"
-echo "export PYTHON='$python'" >> "$iotests_common_env"
+echo "export PYTHON='/usr/bin/python2 -B'" >> "$iotests_common_env"
if [ ! -e "$iotests_check" ]; then
symlink "$source_path/$iotests_check" "$iotests_check"

View File

@ -1,32 +0,0 @@
From 038a061ce8a984ae6de48ceb247033e7799a72fb Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:08 +0000
Subject: [PATCH] qapi: Adapt to moved location of 'maketrans' function in py3
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-6-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 52c4272c6c916a53cde65b997e1a4e891c14dcef)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
scripts/qapi.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 7882ae77fb..88e854edec 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1743,7 +1743,10 @@ def c_enum_const(type_name, const_name, prefix=None):
type_name = prefix
return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper()
-c_name_trans = string.maketrans('.-', '__')
+if hasattr(str, 'maketrans'):
+ c_name_trans = str.maketrans('.-', '__')
+else:
+ c_name_trans = string.maketrans('.-', '__')
# Map @name to a valid C identifier.

View File

@ -1,40 +0,0 @@
From c3577e33fd92f1d5d3632620f0b74f38b3b23ed8 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:09 +0000
Subject: [PATCH] qapi: remove '-q' arg to diff when comparing QAPI output
When the qapi schema tests fail they merely print that the expected
output didn't match the actual output. This is largely useless when
trying diagnose what went wrong. Removing the '-q' arg to diff
means that it is still silent on successful tests, but when it
fails we'll see details of the incorrect output.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-7-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 46ec4fcea95204a8e5bab9295cbfaa3606d78dc9)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
tests/Makefile.include | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 199b7bbddd..f4a05a82c1 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -909,10 +909,10 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
$^ >$*.test.out 2>$*.test.err; \
echo $$? >$*.test.exit, \
"TEST","$*.out")
- @diff -q $(SRC_PATH)/$*.out $*.test.out
+ @diff $(SRC_PATH)/$*.out $*.test.out
@# Sanitize error messages (make them independent of build directory)
- @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -q $(SRC_PATH)/$*.err -
- @diff -q $(SRC_PATH)/$*.exit $*.test.exit
+ @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff $(SRC_PATH)/$*.err -
+ @diff $(SRC_PATH)/$*.exit $*.test.exit
.PHONY: check-tests/qapi-schema/doc-good.texi
check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi

View File

@ -0,0 +1,46 @@
From fbd6c52b4e0de8376411d8a3f1ff90d26ee35563 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Fri, 6 Apr 2018 13:33:31 -0600
Subject: [PATCH] qemu-io tests: comment out problematic block io tests issues
The following issues are seen:
130 - timeout resulting from failed to get shared "write" lock
153 - failed to get "write" lock
162 - occasional, using nbd, network unreachable
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
tests/qemu-iotests/group | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 52a80f3f9e..16f248fca2 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -136,7 +136,7 @@
127 rw auto backing quick
128 rw auto quick
129 rw auto quick
-130 rw auto quick
+#ISSUES 130 rw auto quick
131 rw auto quick
132 rw auto quick
133 auto quick
@@ -158,7 +158,7 @@
149 rw auto sudo
150 rw auto quick
152 rw auto quick
-153 rw auto quick
+#ISSUES 153 rw auto quick
154 rw auto backing quick
155 rw auto
156 rw auto quick
@@ -166,7 +166,7 @@
158 rw auto quick
159 rw auto quick
160 rw auto quick
-162 auto quick
+#ISSUES 162 auto quick
163 rw auto
165 rw auto quick
169 rw auto quick

View File

@ -1,37 +0,0 @@
From 23ef1eee49f51e6fcae2c1676e9b71b0a9d1436b Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:10 +0000
Subject: [PATCH] qapi: ensure stable sort ordering when checking QAPI entities
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some early python 3.x versions will have different default
ordering when calling the 'values()' method on a dict, compared
to python 2.x and later 3.x versions. Explicitly sort the items
to get a stable ordering.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-8-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit f7a5376d4b667cf6c83c1d640e32d22456d7b5ee)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
scripts/qapi.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 88e854edec..94d52f7eb5 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1687,7 +1687,7 @@ class QAPISchema(object):
assert False
def check(self):
- for ent in self._entity_dict.values():
+ for (name, ent) in sorted(self._entity_dict.items()):
ent.check(self)
def visit(self, visitor):

View File

@ -0,0 +1,42 @@
From 7ddbb37c5a0ae657ff97c221c055cb2e843016f4 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Fri, 13 Apr 2018 11:46:47 -0600
Subject: [PATCH] tests: test-thread-pool is racy - add some barriers
I imagine there is more to be done to fix the memory consistency
races here, but these added barriers at least let it pass on ppc64le,
whereas before it would fail regularly there.
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
tests/test-thread-pool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
index 91b4ec5524..9790200df7 100644
--- a/tests/test-thread-pool.c
+++ b/tests/test-thread-pool.c
@@ -171,6 +171,7 @@ static void do_test_cancel(bool sync)
/* Cancel the jobs that haven't been started yet. */
num_canceled = 0;
for (i = 0; i < 100; i++) {
+ smp_mb();
if (atomic_cmpxchg(&data[i].n, 0, 3) == 0) {
data[i].ret = -ECANCELED;
if (sync) {
@@ -185,6 +186,7 @@ static void do_test_cancel(bool sync)
g_assert_cmpint(num_canceled, <, 100);
for (i = 0; i < 100; i++) {
+ smp_mb();
if (data[i].aiocb && data[i].n != 3) {
if (sync) {
/* Canceling the others will be a blocking operation. */
@@ -201,6 +203,7 @@ static void do_test_cancel(bool sync)
}
g_assert_cmpint(active, ==, 0);
for (i = 0; i < 100; i++) {
+ smp_mb();
if (data[i].n == 3) {
g_assert_cmpint(data[i].ret, ==, -ECANCELED);
g_assert(data[i].aiocb == NULL);

View File

@ -1,131 +0,0 @@
From 178826a44b2d08e69dc7128cb3f47cea32912e37 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:11 +0000
Subject: [PATCH] qapi: force a UTF-8 locale for running Python
Python2 did not validate locale correctness when reading input data, so
would happily read UTF-8 data in non-UTF-8 locales. Python3 is strict so
if you try to read UTF-8 data in the C locale, it will raise an error
for any UTF-8 bytes that aren't representable in 7-bit ascii encoding.
e.g.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 54: ordinal not in range(128)
Traceback (most recent call last):
File "/tmp/qemu-test/src/scripts/qapi-commands.py", line 317, in <module>
schema = QAPISchema(input_file)
File "/tmp/qemu-test/src/scripts/qapi.py", line 1468, in __init__
parser = QAPISchemaParser(open(fname, 'r'))
File "/tmp/qemu-test/src/scripts/qapi.py", line 301, in __init__
previously_included)
File "/tmp/qemu-test/src/scripts/qapi.py", line 348, in _include
exprs_include = QAPISchemaParser(fobj, previously_included, info)
File "/tmp/qemu-test/src/scripts/qapi.py", line 271, in __init__
self.src = fp.read()
File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
More background on this can be seen in
https://www.python.org/dev/peps/pep-0538/
Many distros support a new C.UTF-8 locale that is like the C locale,
but with UTF-8 instead of 7-bit ASCII. That is not entirely portable
though. This patch thus sets the LANG to "C", but overrides LC_CTYPE
to be en_US.UTF-8 locale. This gets us pretty close to C.UTF-8, but
in a way that should be portable to everywhere QEMU builds.
This patch only forces UTF-8 for QAPI scripts, since that is the one
showing the immediate error under Python3 with C locale, but potentially
we ought to force this for all python scripts used in the build process.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-9-berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit d4e5ec877ca698a87dabe68814c6f93668f50c60)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
Makefile | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 4be3366e27..eec3a8d430 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,8 @@ ifneq ($(wildcard config-host.mak),)
all:
include config-host.mak
+PYTHON_UTF8 = LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON)
+
git-submodule-update:
.PHONY: git-submodule-update
@@ -467,17 +469,17 @@ qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-types.py \
$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
"GEN","$@")
qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-visit.py \
$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
"GEN","$@")
qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-commands.py \
$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
"GEN","$@")
@@ -498,27 +500,27 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
qapi-types.c qapi-types.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-types.py \
$(gen-out-type) -o "." -b $<, \
"GEN","$@")
qapi-visit.c qapi-visit.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-visit.py \
$(gen-out-type) -o "." -b $<, \
"GEN","$@")
qapi-event.c qapi-event.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-event.py \
$(gen-out-type) -o "." $<, \
"GEN","$@")
qmp-commands.h qmp-marshal.c :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-commands.py \
$(gen-out-type) -o "." $<, \
"GEN","$@")
qmp-introspect.h qmp-introspect.c :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-introspect.py \
$(gen-out-type) -o "." $<, \
"GEN","$@")
@@ -788,10 +790,10 @@ qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
docs/interop/qemu-qmp-qapi.texi docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py)
docs/interop/qemu-qmp-qapi.texi: $(qapi-modules)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
+ $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
qemu.1: qemu-option-trace.texi

View File

@ -1,41 +0,0 @@
From 93a3811284417987034a0c72387db589760fcaaa Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:12 +0000
Subject: [PATCH] scripts: ensure signrom treats data as bytes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-10-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 31d8f92e646f7d4cfbb4ffab440ab41a3c838fd3)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
scripts/signrom.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/signrom.py b/scripts/signrom.py
index d1dabe0240..0497a1c32e 100644
--- a/scripts/signrom.py
+++ b/scripts/signrom.py
@@ -18,7 +18,7 @@ fin = open(sys.argv[1], 'rb')
fout = open(sys.argv[2], 'wb')
magic = fin.read(2)
-if magic != '\x55\xaa':
+if magic != b'\x55\xaa':
sys.exit("%s: option ROM does not begin with magic 55 aa" % sys.argv[1])
size_byte = ord(fin.read(1))
@@ -33,7 +33,7 @@ elif len(data) < size:
# Add padding if necessary, rounding the whole input to a multiple of
# 512 bytes according to the third byte of the input.
# size-1 because a final byte is added below to store the checksum.
- data = data.ljust(size-1, '\0')
+ data = data.ljust(size-1, b'\0')
else:
if ord(data[-1:]) != 0:
sys.stderr.write('WARNING: ROM includes nonzero checksum\n')

View File

@ -1,32 +0,0 @@
From 9ef8e6f7a53e7790187a810495e428a7556ead6e Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 16 Jan 2018 13:42:13 +0000
Subject: [PATCH] configure: allow use of python 3
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-11-berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit c21965a0c8b979c306e927f158257e5b0fa3a1f9)
[BR: BSC#1077564]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
configure | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 71b8b473fc..62d66a6819 100755
--- a/configure
+++ b/configure
@@ -1573,9 +1573,8 @@ fi
# Note that if the Python conditional here evaluates True we will exit
# with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
- error_exit "Cannot use '$python', Python 2.6 or later is required." \
- "Note that Python 3 or later is not yet supported." \
+if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then
+ error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
"Use --python=/path/to/python to specify a supported Python."
fi

View File

@ -1,63 +0,0 @@
From 47dfdc212f68d2ab3d06db162bff907c4922e67d Mon Sep 17 00:00:00 2001
From: Miika S <miika9764@gmail.com>
Date: Tue, 16 Jan 2018 13:42:14 +0000
Subject: [PATCH] input: add missing JIS keys to virtio input
keycodemapdb updated to add the QKeyCodes muhenkan and katakanahiragana
Signed-off-by: Miika S <miika9764@gmail.com>
Message-Id: <20180116134217.8725-12-berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 280b8da3b842177de538de4f73d3d63db077e39b)
[BR: BSC#1077564 - added changes to hw/input/virtio-input-hid.c which
were in an earlier proposed version of patch, but removed since that
file had become autogenerated. In 2.11, it is not autogenerated so those
previously proposed changes make sense for us.]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/input/virtio-input-hid.c | 7 +++++++
qapi/ui.json | 5 ++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index e78faec0b1..9628d289f9 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -139,6 +139,13 @@ static const unsigned int keymap_qcode[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_META_L] = KEY_LEFTMETA,
[Q_KEY_CODE_META_R] = KEY_RIGHTMETA,
[Q_KEY_CODE_MENU] = KEY_MENU,
+
+ [Q_KEY_CODE_MUHENKAN] = KEY_MUHENKAN,
+ [Q_KEY_CODE_HENKAN] = KEY_HENKAN,
+ [Q_KEY_CODE_KATAKANAHIRAGANA] = KEY_KATAKANAHIRAGANA,
+ [Q_KEY_CODE_COMPOSE] = KEY_COMPOSE,
+ [Q_KEY_CODE_RO] = KEY_RO,
+ [Q_KEY_CODE_YEN] = KEY_YEN,
};
static const unsigned int keymap_button[INPUT_BUTTON__MAX] = {
diff --git a/qapi/ui.json b/qapi/ui.json
index 07b468f625..d6679aa8f5 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -748,6 +748,9 @@
# @ac_bookmarks: since 2.10
# altgr, altgr_r: dropped in 2.10
#
+# @muhenkan: since 2.12
+# @katakanahiragana: since 2.12
+#
# 'sysrq' was mistakenly added to hack around the fact that
# the ps2 driver was not generating correct scancodes sequences
# when 'alt+print' was pressed. This flaw is now fixed and the
@@ -775,7 +778,7 @@
'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
- 'ro', 'hiragana', 'henkan', 'yen',
+ 'ro', 'hiragana', 'henkan', 'yen', 'muhenkan', 'katakanahiragana',
'kp_comma', 'kp_equals', 'power', 'sleep', 'wake',
'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute',
'volumeup', 'volumedown', 'mediaselect',

View File

@ -1,61 +0,0 @@
From 097f317248eb261968efb30755e3c91fd9311cea Mon Sep 17 00:00:00 2001
From: Haozhong Zhang <haozhong.zhang@intel.com>
Date: Fri, 22 Dec 2017 09:51:20 +0800
Subject: [PATCH] pc: fail memory hot-plug/unplug with -no-acpi and Q35 machine
type
When -no-acpi option is used with Q35 machine type, no guest ACPI is
built, but the ACPI device is still created, so only checking the
presence of ACPI device before memory plug/unplug is not enough in
such cases. Check whether ACPI is disabled globally in addition and
fail memory plug/unplug if it's disabled.
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Message-Id: <20171222015120.31730-1-haozhong.zhang@intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 8cd91acec8dfea6065272ca828405333f564a612)
[BR: BSC#1077823]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/i386/pc.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 186545d2a4..e7faf92143 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1694,9 +1694,14 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
align = memory_region_get_alignment(mr);
}
- if (!pcms->acpi_dev) {
+ /*
+ * When -no-acpi is used with Q35 machine type, no ACPI is built,
+ * but pcms->acpi_dev is still created. Check !acpi_enabled in
+ * addition to cover this case.
+ */
+ if (!pcms->acpi_dev || !acpi_enabled) {
error_setg(&local_err,
- "memory hotplug is not enabled: missing acpi device");
+ "memory hotplug is not enabled: missing acpi device or acpi disabled");
goto out;
}
@@ -1728,9 +1733,14 @@ static void pc_dimm_unplug_request(HotplugHandler *hotplug_dev,
Error *local_err = NULL;
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
- if (!pcms->acpi_dev) {
+ /*
+ * When -no-acpi is used with Q35 machine type, no ACPI is built,
+ * but pcms->acpi_dev is still created. Check !acpi_enabled in
+ * addition to cover this case.
+ */
+ if (!pcms->acpi_dev || !acpi_enabled) {
error_setg(&local_err,
- "memory hotplug is not enabled: missing acpi device");
+ "memory hotplug is not enabled: missing acpi device or acpi disabled");
goto out;
}

View File

@ -1,39 +0,0 @@
From 631811d80a534654f23009e86cf9b9b942d53a48 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:19 -0600
Subject: [PATCH] memattrs: add debug attribute
Extend the MemTxAttrs to include 'debug' flag. The flag can be used as
general indicator that operation was triggered by the debugger.
Later in the patch series we set the debug=1 when issuing a memory access
from the gdbstub or HMP commands. This patch is prerequisite to support
debugging the encrypted guest. If we see request with debug=1 then we
will need to use encryption APIs to access the guest memory.
Cc: Alistair Francis <alistair.francis@xilinx.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
include/exec/memattrs.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
index d4a1642098..08099e4f7e 100644
--- a/include/exec/memattrs.h
+++ b/include/exec/memattrs.h
@@ -37,6 +37,8 @@ typedef struct MemTxAttrs {
unsigned int user:1;
/* Requester ID (for MSI for example) */
unsigned int requester_id:16;
+ /* Memory access request from the debugger */
+ unsigned int debug:1;
} MemTxAttrs;
/* Bus masters which don't specify any attributes will get this,

View File

@ -1,204 +0,0 @@
From a8955ac9aa33e2d3edb4ea948d74cf52fc9771a2 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:19 -0600
Subject: [PATCH] exec: add ram_debug_ops support
Currently, the guest memory access for the debug purpose is performed
using the memcpy(). Lets extend the 'struct MemoryRegion' to include
ram_debug_ops callbacks. The ram_debug_ops can be used to override
memcpy() with something else.
The feature can be used by encrypted guest -- which can register
callbacks to override memcpy() with memory encryption/decryption APIs.
a typical usage:
mem_read(uint8_t *dst, uint8_t *src, uint32_t len, MemTxAttrs *attrs);
mem_write(uint8_t *dst, uint8_t *src, uint32_t len, MemTxAttrs *attrs);
MemoryRegionRAMReadWriteOps ops;
ops.read = mem_read;
ops.write = mem_write;
memory_region_init_ram(mem, NULL, "memory", size, NULL);
memory_region_set_ram_debug_ops(mem, ops);
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
exec.c | 43 ++++++++++++++++++++++++++++++++-----------
include/exec/memory.h | 30 +++++++++++++++++++++++++++++-
2 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/exec.c b/exec.c
index 1ca0f9e0ab..fe49807f58 100644
--- a/exec.c
+++ b/exec.c
@@ -2983,7 +2983,11 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
} else {
/* RAM case */
ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
- memcpy(ptr, buf, l);
+ if (attrs.debug && mr->ram_debug_ops) {
+ mr->ram_debug_ops->write(ptr, buf, l, attrs);
+ } else {
+ memcpy(ptr, buf, l);
+ }
invalidate_and_set_dirty(mr, addr1, l);
}
@@ -3081,7 +3085,11 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
} else {
/* RAM case */
ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
- memcpy(buf, ptr, l);
+ if (attrs.debug && mr->ram_debug_ops) {
+ mr->ram_debug_ops->read(buf, ptr, l, attrs);
+ } else {
+ memcpy(buf, ptr, l);
+ }
}
if (release_lock) {
@@ -3155,7 +3163,8 @@ enum write_rom_type {
};
static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as,
- hwaddr addr, const uint8_t *buf, int len, enum write_rom_type type)
+ hwaddr addr, const uint8_t *buf, int len, MemTxAttrs attrs,
+ enum write_rom_type type)
{
hwaddr l;
uint8_t *ptr;
@@ -3175,7 +3184,11 @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as,
ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
switch (type) {
case WRITE_DATA:
- memcpy(ptr, buf, l);
+ if (mr->ram_debug_ops) {
+ mr->ram_debug_ops->write(ptr, buf, l, attrs);
+ } else {
+ memcpy(ptr, buf, l);
+ }
invalidate_and_set_dirty(mr, addr1, l);
break;
case FLUSH_CACHE:
@@ -3194,7 +3207,9 @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as,
void cpu_physical_memory_write_rom(AddressSpace *as, hwaddr addr,
const uint8_t *buf, int len)
{
- cpu_physical_memory_write_rom_internal(as, addr, buf, len, WRITE_DATA);
+ cpu_physical_memory_write_rom_internal(as, addr, buf, len,
+ MEMTXATTRS_UNSPECIFIED,
+ WRITE_DATA);
}
void cpu_flush_icache_range(hwaddr start, int len)
@@ -3209,8 +3224,9 @@ void cpu_flush_icache_range(hwaddr start, int len)
return;
}
- cpu_physical_memory_write_rom_internal(&address_space_memory,
- start, NULL, len, FLUSH_CACHE);
+ cpu_physical_memory_write_rom_internal(&address_space_memory, start, NULL,
+ len, MEMTXATTRS_UNSPECIFIED,
+ FLUSH_CACHE);
}
typedef struct {
@@ -3525,6 +3541,10 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
page = addr & TARGET_PAGE_MASK;
phys_addr = cpu_get_phys_page_attrs_debug(cpu, page, &attrs);
asidx = cpu_asidx_from_attrs(cpu, attrs);
+
+ /* set debug attrs to indicate memory access is from the debugger */
+ attrs.debug = 1;
+
/* if no physical page mapped, return an error */
if (phys_addr == -1)
return -1;
@@ -3533,13 +3553,14 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
l = len;
phys_addr += (addr & ~TARGET_PAGE_MASK);
if (is_write) {
- cpu_physical_memory_write_rom(cpu->cpu_ases[asidx].as,
- phys_addr, buf, l);
+ cpu_physical_memory_write_rom_internal(cpu->cpu_ases[asidx].as,
+ phys_addr, buf, l, attrs,
+ WRITE_DATA);
} else {
address_space_rw(cpu->cpu_ases[asidx].as, phys_addr,
- MEMTXATTRS_UNSPECIFIED,
- buf, l, 0);
+ attrs, buf, l, 0);
}
+
len -= l;
buf += l;
addr += l;
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 5ed4042f87..8d3b99cba8 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -215,6 +215,18 @@ typedef struct IOMMUMemoryRegionClass {
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
+/* Memory Region RAM debug callback */
+typedef struct MemoryRegionRAMReadWriteOps MemoryRegionRAMReadWriteOps;
+
+struct MemoryRegionRAMReadWriteOps {
+ /* Write data into guest memory */
+ int (*write) (uint8_t *dest, const uint8_t *src,
+ uint32_t len, MemTxAttrs attrs);
+ /* Read data from guest memory */
+ int (*read) (uint8_t *dest, const uint8_t *src,
+ uint32_t len, MemTxAttrs attrs);
+};
+
struct MemoryRegion {
Object parent_obj;
@@ -254,6 +266,7 @@ struct MemoryRegion {
const char *name;
unsigned ioeventfd_nb;
MemoryRegionIoeventfd *ioeventfds;
+ const MemoryRegionRAMReadWriteOps *ram_debug_ops;
};
struct IOMMUMemoryRegion {
@@ -620,6 +633,21 @@ void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,
uint64_t size,
Error **errp);
+/**
+ * memory_region_set_ram_debug_ops: Set debug access ops for a given memory
+ * region.
+ *
+ * @mr: the #MemoryRegion to be initialized
+ * @ops: a function that will be used for when accessing @target region during
+ * debug
+ */
+static inline void
+memory_region_set_ram_debug_ops(MemoryRegion *mr,
+ const MemoryRegionRAMReadWriteOps *ops)
+{
+ mr->ram_debug_ops = ops;
+}
+
/**
* memory_region_init_reservation: Initialize a memory region that reserves
* I/O space.
@@ -1928,7 +1956,7 @@ MemTxResult flatview_read(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
void *ptr;
MemoryRegion *mr;
- if (__builtin_constant_p(len)) {
+ if (__builtin_constant_p(len) && !attrs.debug) {
if (len) {
rcu_read_lock();
l = len;

View File

@ -1,106 +0,0 @@
From bb5805ddc9a5bfbf78d4ce81b6395452c783ca77 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:20 -0600
Subject: [PATCH] exec: add debug version of physical memory read and write API
Adds the following new APIs
- cpu_physical_memory_read_debug
- cpu_physical_memory_write_debug
- cpu_physical_memory_rw_debug
- ldl_phys_debug
- ldq_phys_debug
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
exec.c | 40 ++++++++++++++++++++++++++++++++++++++++
include/exec/cpu-common.h | 15 +++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/exec.c b/exec.c
index fe49807f58..2a297de819 100644
--- a/exec.c
+++ b/exec.c
@@ -3525,6 +3525,46 @@ void address_space_cache_destroy(MemoryRegionCache *cache)
#define RCU_READ_UNLOCK() rcu_read_unlock()
#include "memory_ldst.inc.c"
+uint32_t ldl_phys_debug(CPUState *cpu, hwaddr addr)
+{
+ MemTxAttrs attrs;
+ int asidx = cpu_asidx_from_attrs(cpu, attrs);
+ uint32_t val;
+
+ /* set debug attrs to indicate memory access is from the debugger */
+ attrs.debug = 1;
+
+ address_space_rw(cpu->cpu_ases[asidx].as, addr, attrs,
+ (void *) &val, 4, 0);
+
+ return tswap32(val);
+}
+
+uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr)
+{
+ MemTxAttrs attrs;
+ int asidx = cpu_asidx_from_attrs(cpu, attrs);
+ uint64_t val;
+
+ /* set debug attrs to indicate memory access is from the debugger */
+ attrs.debug = 1;
+
+ address_space_rw(cpu->cpu_ases[asidx].as, addr, attrs,
+ (void *) &val, 8, 0);
+ return val;
+}
+
+void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf,
+ int len, int is_write)
+{
+ MemTxAttrs attrs;
+
+ /* set debug attrs to indicate memory access is from the debugger */
+ attrs.debug = 1;
+
+ address_space_rw(&address_space_memory, addr, attrs, buf, len, is_write);
+}
+
/* virtual memory access for debug (includes writing to ROM) */
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
uint8_t *buf, int len, int is_write)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 74341b19d2..fa01385d4f 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -77,11 +77,26 @@ size_t qemu_ram_pagesize_largest(void);
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
int len, int is_write);
+void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf,
+ int len, int is_write);
static inline void cpu_physical_memory_read(hwaddr addr,
void *buf, int len)
{
cpu_physical_memory_rw(addr, buf, len, 0);
}
+static inline void cpu_physical_memory_read_debug(hwaddr addr,
+ void *buf, int len)
+{
+ cpu_physical_memory_rw_debug(addr, buf, len, 0);
+}
+static inline void cpu_physical_memory_write_debug(hwaddr addr,
+ const void *buf, int len)
+{
+ cpu_physical_memory_rw_debug(addr, (void *)buf, len, 1);
+}
+uint32_t ldl_phys_debug(CPUState *cpu, hwaddr addr);
+uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr);
+
static inline void cpu_physical_memory_write(hwaddr addr,
const void *buf, int len)
{

View File

@ -1,366 +0,0 @@
From 6dd6cff79148e79a45da6277fd7f9b5de4f41d20 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:20 -0600
Subject: [PATCH] monitor/i386: use debug APIs when accessing guest memory
Updates HMP commands to use the debug version of APIs when accessing the
guest memory.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
cpus.c | 2 +-
disas.c | 2 +-
monitor.c | 6 +++---
target/i386/helper.c | 14 ++++++------
target/i386/monitor.c | 60 +++++++++++++++++++++++++++------------------------
5 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/cpus.c b/cpus.c
index 114c29b6a0..d1e7e28993 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2026,7 +2026,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
l = sizeof(buf);
if (l > size)
l = size;
- cpu_physical_memory_read(addr, buf, l);
+ cpu_physical_memory_read_debug(addr, buf, l);
if (fwrite(buf, 1, l, f) != l) {
error_setg(errp, QERR_IO_ERROR);
goto exit;
diff --git a/disas.c b/disas.c
index d4ad1089ef..fcedbf2633 100644
--- a/disas.c
+++ b/disas.c
@@ -586,7 +586,7 @@ static int
physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
struct disassemble_info *info)
{
- cpu_physical_memory_read(memaddr, myaddr, length);
+ cpu_physical_memory_read_debug(memaddr, myaddr, length);
return 0;
}
diff --git a/monitor.c b/monitor.c
index e36fb5308d..6b484e3e0d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1359,7 +1359,7 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
if (l > line_size)
l = line_size;
if (is_physical) {
- cpu_physical_memory_read(addr, buf, l);
+ cpu_physical_memory_read_debug(addr, buf, l);
} else {
if (cpu_memory_rw_debug(cs, addr, buf, l, 0) < 0) {
monitor_printf(mon, " Cannot access memory\n");
@@ -1565,8 +1565,8 @@ static void hmp_sum(Monitor *mon, const QDict *qdict)
sum = 0;
for(addr = start; addr < (start + size); addr++) {
- uint8_t val = address_space_ldub(&address_space_memory, addr,
- MEMTXATTRS_UNSPECIFIED, NULL);
+ uint8_t val;
+ cpu_physical_memory_read_debug(addr, &val, 1);
/* BSD sum algorithm ('sum' Unix command) */
sum = (sum >> 1) | (sum << 15);
sum += val;
diff --git a/target/i386/helper.c b/target/i386/helper.c
index f63eb3d3f4..5dc9e8839b 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -757,7 +757,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
if (la57) {
pml5e_addr = ((env->cr[3] & ~0xfff) +
(((addr >> 48) & 0x1ff) << 3)) & a20_mask;
- pml5e = x86_ldq_phys(cs, pml5e_addr);
+ pml5e = ldq_phys_debug(cs, pml5e_addr);
if (!(pml5e & PG_PRESENT_MASK)) {
return -1;
}
@@ -767,7 +767,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
pml4e_addr = ((pml5e & PG_ADDRESS_MASK) +
(((addr >> 39) & 0x1ff) << 3)) & a20_mask;
- pml4e = x86_ldq_phys(cs, pml4e_addr);
+ pml4e = ldq_phys_debug(cs, pml4e_addr);
if (!(pml4e & PG_PRESENT_MASK)) {
return -1;
}
@@ -788,14 +788,14 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
{
pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) &
a20_mask;
- pdpe = x86_ldq_phys(cs, pdpe_addr);
+ pdpe = ldq_phys_debug(cs, pdpe_addr);
if (!(pdpe & PG_PRESENT_MASK))
return -1;
}
pde_addr = ((pdpe & PG_ADDRESS_MASK) +
(((addr >> 21) & 0x1ff) << 3)) & a20_mask;
- pde = x86_ldq_phys(cs, pde_addr);
+ pde = ldq_phys_debug(cs, pde_addr);
if (!(pde & PG_PRESENT_MASK)) {
return -1;
}
@@ -808,7 +808,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
pte_addr = ((pde & PG_ADDRESS_MASK) +
(((addr >> 12) & 0x1ff) << 3)) & a20_mask;
page_size = 4096;
- pte = x86_ldq_phys(cs, pte_addr);
+ pte = ldq_phys_debug(cs, pte_addr);
}
if (!(pte & PG_PRESENT_MASK)) {
return -1;
@@ -818,7 +818,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
/* page directory entry */
pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & a20_mask;
- pde = x86_ldl_phys(cs, pde_addr);
+ pde = ldl_phys_debug(cs, pde_addr);
if (!(pde & PG_PRESENT_MASK))
return -1;
if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
@@ -827,7 +827,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
} else {
/* page directory entry */
pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & a20_mask;
- pte = x86_ldl_phys(cs, pte_addr);
+ pte = ldl_phys_debug(cs, pte_addr);
if (!(pte & PG_PRESENT_MASK)) {
return -1;
}
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 75e155ffb1..63f7125ba8 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -66,7 +66,7 @@ static void tlb_info_32(Monitor *mon, CPUArchState *env)
pgd = env->cr[3] & ~0xfff;
for(l1 = 0; l1 < 1024; l1++) {
- cpu_physical_memory_read(pgd + l1 * 4, &pde, 4);
+ cpu_physical_memory_read_debug(pgd + l1 * 4, &pde, 4);
pde = le32_to_cpu(pde);
if (pde & PG_PRESENT_MASK) {
if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
@@ -74,7 +74,8 @@ static void tlb_info_32(Monitor *mon, CPUArchState *env)
print_pte(mon, env, (l1 << 22), pde, ~((1 << 21) - 1));
} else {
for(l2 = 0; l2 < 1024; l2++) {
- cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, &pte, 4);
+ cpu_physical_memory_read_debug((pde & ~0xfff) + l2 * 4,
+ &pte, 4);
pte = le32_to_cpu(pte);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, env, (l1 << 22) + (l2 << 12),
@@ -95,12 +96,12 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *env)
pdp_addr = env->cr[3] & ~0x1f;
for (l1 = 0; l1 < 4; l1++) {
- cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8);
+ cpu_physical_memory_read_debug(pdp_addr + l1 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
if (pdpe & PG_PRESENT_MASK) {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
- cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8);
+ cpu_physical_memory_read_debug(pd_addr + l2 * 8, &pde, 8);
pde = le64_to_cpu(pde);
if (pde & PG_PRESENT_MASK) {
if (pde & PG_PSE_MASK) {
@@ -110,7 +111,8 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *env)
} else {
pt_addr = pde & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
- cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8);
+ cpu_physical_memory_read_debug(pt_addr + l3 * 8,
+ &pte, 8);
pte = le64_to_cpu(pte);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, env, (l1 << 30) + (l2 << 21)
@@ -135,7 +137,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
uint64_t pdp_addr, pd_addr, pt_addr;
for (l1 = 0; l1 < 512; l1++) {
- cpu_physical_memory_read(pml4_addr + l1 * 8, &pml4e, 8);
+ cpu_physical_memory_read_debug(pml4_addr + l1 * 8, &pml4e, 8);
pml4e = le64_to_cpu(pml4e);
if (!(pml4e & PG_PRESENT_MASK)) {
continue;
@@ -143,7 +145,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
pdp_addr = pml4e & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
- cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8);
+ cpu_physical_memory_read_debug(pdp_addr + l2 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
if (!(pdpe & PG_PRESENT_MASK)) {
continue;
@@ -158,7 +160,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
- cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8);
+ cpu_physical_memory_read_debug(pd_addr + l3 * 8, &pde, 8);
pde = le64_to_cpu(pde);
if (!(pde & PG_PRESENT_MASK)) {
continue;
@@ -173,9 +175,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
pt_addr = pde & 0x3fffffffff000ULL;
for (l4 = 0; l4 < 512; l4++) {
- cpu_physical_memory_read(pt_addr
- + l4 * 8,
- &pte, 8);
+ cpu_physical_memory_read_debug(pt_addr + l4 * 8, &pte, 8);
pte = le64_to_cpu(pte);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, env, (l0 << 48) + (l1 << 39) +
@@ -196,7 +196,7 @@ static void tlb_info_la57(Monitor *mon, CPUArchState *env)
pml5_addr = env->cr[3] & 0x3fffffffff000ULL;
for (l0 = 0; l0 < 512; l0++) {
- cpu_physical_memory_read(pml5_addr + l0 * 8, &pml5e, 8);
+ cpu_physical_memory_read_debug(pml5_addr + l0 * 8, &pml5e, 8);
pml5e = le64_to_cpu(pml5e);
if (pml5e & PG_PRESENT_MASK) {
tlb_info_la48(mon, env, l0, pml5e & 0x3fffffffff000ULL);
@@ -271,7 +271,7 @@ static void mem_info_32(Monitor *mon, CPUArchState *env)
last_prot = 0;
start = -1;
for(l1 = 0; l1 < 1024; l1++) {
- cpu_physical_memory_read(pgd + l1 * 4, &pde, 4);
+ cpu_physical_memory_read_debug(pgd + l1 * 4, &pde, 4);
pde = le32_to_cpu(pde);
end = l1 << 22;
if (pde & PG_PRESENT_MASK) {
@@ -280,7 +280,8 @@ static void mem_info_32(Monitor *mon, CPUArchState *env)
mem_print(mon, &start, &last_prot, end, prot);
} else {
for(l2 = 0; l2 < 1024; l2++) {
- cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, &pte, 4);
+ cpu_physical_memory_read_debug((pde & ~0xfff) + l2 * 4,
+ &pte, 4);
pte = le32_to_cpu(pte);
end = (l1 << 22) + (l2 << 12);
if (pte & PG_PRESENT_MASK) {
@@ -313,13 +314,13 @@ static void mem_info_pae32(Monitor *mon, CPUArchState *env)
last_prot = 0;
start = -1;
for (l1 = 0; l1 < 4; l1++) {
- cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8);
+ cpu_physical_memory_read_debug(pdp_addr + l1 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
end = l1 << 30;
if (pdpe & PG_PRESENT_MASK) {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
- cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8);
+ cpu_physical_memory_read_debug(pd_addr + l2 * 8, &pde, 8);
pde = le64_to_cpu(pde);
end = (l1 << 30) + (l2 << 21);
if (pde & PG_PRESENT_MASK) {
@@ -330,7 +331,8 @@ static void mem_info_pae32(Monitor *mon, CPUArchState *env)
} else {
pt_addr = pde & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
- cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8);
+ cpu_physical_memory_read_debug(pt_addr + l3 * 8,
+ &pte, 8);
pte = le64_to_cpu(pte);
end = (l1 << 30) + (l2 << 21) + (l3 << 12);
if (pte & PG_PRESENT_MASK) {
@@ -369,13 +371,13 @@ static void mem_info_la48(Monitor *mon, CPUArchState *env)
last_prot = 0;
start = -1;
for (l1 = 0; l1 < 512; l1++) {
- cpu_physical_memory_read(pml4_addr + l1 * 8, &pml4e, 8);
+ cpu_physical_memory_read_debug(pml4_addr + l1 * 8, &pml4e, 8);
pml4e = le64_to_cpu(pml4e);
end = l1 << 39;
if (pml4e & PG_PRESENT_MASK) {
pdp_addr = pml4e & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
- cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8);
+ cpu_physical_memory_read_debug(pdp_addr + l2 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
end = (l1 << 39) + (l2 << 30);
if (pdpe & PG_PRESENT_MASK) {
@@ -387,7 +389,8 @@ static void mem_info_la48(Monitor *mon, CPUArchState *env)
} else {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
- cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8);
+ cpu_physical_memory_read_debug(pd_addr + l3 * 8,
+ &pde, 8);
pde = le64_to_cpu(pde);
end = (l1 << 39) + (l2 << 30) + (l3 << 21);
if (pde & PG_PRESENT_MASK) {
@@ -399,9 +402,9 @@ static void mem_info_la48(Monitor *mon, CPUArchState *env)
} else {
pt_addr = pde & 0x3fffffffff000ULL;
for (l4 = 0; l4 < 512; l4++) {
- cpu_physical_memory_read(pt_addr
- + l4 * 8,
- &pte, 8);
+ cpu_physical_memory_read_debug(pt_addr
+ + l4 * 8,
+ &pte, 8);
pte = le64_to_cpu(pte);
end = (l1 << 39) + (l2 << 30) +
(l3 << 21) + (l4 << 12);
@@ -446,7 +449,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
last_prot = 0;
start = -1;
for (l0 = 0; l0 < 512; l0++) {
- cpu_physical_memory_read(pml5_addr + l0 * 8, &pml5e, 8);
+ cpu_physical_memory_read_debug(pml5_addr + l0 * 8, &pml5e, 8);
pml5e = le64_to_cpu(pml5e);
end = l0 << 48;
if (!(pml5e & PG_PRESENT_MASK)) {
@@ -457,7 +460,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pml4_addr = pml5e & 0x3fffffffff000ULL;
for (l1 = 0; l1 < 512; l1++) {
- cpu_physical_memory_read(pml4_addr + l1 * 8, &pml4e, 8);
+ cpu_physical_memory_read_debug(pml4_addr + l1 * 8, &pml4e, 8);
pml4e = le64_to_cpu(pml4e);
end = (l0 << 48) + (l1 << 39);
if (!(pml4e & PG_PRESENT_MASK)) {
@@ -468,7 +471,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pdp_addr = pml4e & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
- cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8);
+ cpu_physical_memory_read_debug(pdp_addr + l2 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
end = (l0 << 48) + (l1 << 39) + (l2 << 30);
if (pdpe & PG_PRESENT_MASK) {
@@ -487,7 +490,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
- cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8);
+ cpu_physical_memory_read_debug(pd_addr + l3 * 8, &pde, 8);
pde = le64_to_cpu(pde);
end = (l0 << 48) + (l1 << 39) + (l2 << 30) + (l3 << 21);
if (pde & PG_PRESENT_MASK) {
@@ -506,7 +509,8 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pt_addr = pde & 0x3fffffffff000ULL;
for (l4 = 0; l4 < 512; l4++) {
- cpu_physical_memory_read(pt_addr + l4 * 8, &pte, 8);
+ cpu_physical_memory_read_debug(pt_addr + l4 * 8,
+ &pte, 8);
pte = le64_to_cpu(pte);
end = (l0 << 48) + (l1 << 39) + (l2 << 30) +
(l3 << 21) + (l4 << 12);

View File

@ -1,86 +0,0 @@
From 969964dd7f15ac507887f58fccbb2623110bd8f6 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:20 -0600
Subject: [PATCH] machine: add -memory-encryption property
When CPU supports memory encryption feature, the property can be used to
specify the encryption object to use when launching an encrypted guest.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/core/machine.c | 22 ++++++++++++++++++++++
include/hw/boards.h | 1 +
qemu-options.hx | 2 ++
3 files changed, 25 insertions(+)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 36c2fb069c..132c57bc51 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -335,6 +335,22 @@ static bool machine_get_enforce_config_section(Object *obj, Error **errp)
return ms->enforce_config_section;
}
+static char *machine_get_memory_encryption(Object *obj, Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ return g_strdup(ms->memory_encryption);
+}
+
+static void machine_set_memory_encryption(Object *obj, const char *value,
+ Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ g_free(ms->memory_encryption);
+ ms->memory_encryption = g_strdup(value);
+}
+
static void error_on_sysbus_device(SysBusDevice *sbdev, void *opaque)
{
error_report("Option '-device %s' cannot be handled by this machine",
@@ -598,6 +614,12 @@ static void machine_class_init(ObjectClass *oc, void *data)
&error_abort);
object_class_property_set_description(oc, "enforce-config-section",
"Set on to enforce configuration section migration", &error_abort);
+
+ object_class_property_add_str(oc, "memory-encryption",
+ machine_get_memory_encryption, machine_set_memory_encryption,
+ &error_abort);
+ object_class_property_set_description(oc, "memory-encryption",
+ "Set memory encyption object to use", &error_abort);
}
static void machine_class_base_init(ObjectClass *oc, void *data)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 156b16f7a6..41fa577955 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -238,6 +238,7 @@ struct MachineState {
bool suppress_vmdesc;
bool enforce_config_section;
bool enable_graphics;
+ char *memory_encryption;
ram_addr_t ram_size;
ram_addr_t maxram_size;
diff --git a/qemu-options.hx b/qemu-options.hx
index 57f2c6a75f..617e5d5c20 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -104,6 +104,8 @@ code to send configuration section even if the machine-type sets the
@option{migration.send-configuration} property to @var{off}.
NOTE: this parameter is deprecated. Please use @option{-global}
@option{migration.send-configuration}=@var{on|off} instead.
+@item memory-encryption=@var{}
+Memory encryption object to use. The default is none.
@end table
ETEXI

View File

@ -1,118 +0,0 @@
From f62e734e8cbb2b31f23b9c0e8cb69ae1500a200b Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:20 -0600
Subject: [PATCH] kvm: update kvm.h to include memory encryption ioctls
Updates kmv.h to include memory encryption ioctls and SEV commands.
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
linux-headers/linux/kvm.h | 90 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index d92c9b2f0e..aed2230995 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -1362,6 +1362,96 @@ struct kvm_s390_ucas_mapping {
/* Available with KVM_CAP_S390_CMMA_MIGRATION */
#define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log)
#define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log)
+/* Memory Encryption Commands */
+#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long)
+
+struct kvm_enc_region {
+ __u64 addr;
+ __u64 size;
+};
+
+#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)
+#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)
+
+/* Secure Encrypted Virtualization command */
+enum sev_cmd_id {
+ /* Guest initialization commands */
+ KVM_SEV_INIT = 0,
+ KVM_SEV_ES_INIT,
+ /* Guest launch commands */
+ KVM_SEV_LAUNCH_START,
+ KVM_SEV_LAUNCH_UPDATE_DATA,
+ KVM_SEV_LAUNCH_UPDATE_VMSA,
+ KVM_SEV_LAUNCH_SECRET,
+ KVM_SEV_LAUNCH_MEASURE,
+ KVM_SEV_LAUNCH_FINISH,
+ /* Guest migration commands (outgoing) */
+ KVM_SEV_SEND_START,
+ KVM_SEV_SEND_UPDATE_DATA,
+ KVM_SEV_SEND_UPDATE_VMSA,
+ KVM_SEV_SEND_FINISH,
+ /* Guest migration commands (incoming) */
+ KVM_SEV_RECEIVE_START,
+ KVM_SEV_RECEIVE_UPDATE_DATA,
+ KVM_SEV_RECEIVE_UPDATE_VMSA,
+ KVM_SEV_RECEIVE_FINISH,
+ /* Guest status and debug commands */
+ KVM_SEV_GUEST_STATUS,
+ KVM_SEV_DBG_DECRYPT,
+ KVM_SEV_DBG_ENCRYPT,
+ /* Guest certificates commands */
+ KVM_SEV_CERT_EXPORT,
+
+ KVM_SEV_NR_MAX,
+};
+
+struct kvm_sev_cmd {
+ __u32 id;
+ __u64 data;
+ __u32 error;
+ __u32 sev_fd;
+};
+
+struct kvm_sev_launch_start {
+ __u32 handle;
+ __u32 policy;
+ __u64 dh_uaddr;
+ __u32 dh_len;
+ __u64 session_uaddr;
+ __u32 session_len;
+};
+
+struct kvm_sev_launch_update_data {
+ __u64 uaddr;
+ __u32 len;
+};
+
+
+struct kvm_sev_launch_secret {
+ __u64 hdr_uaddr;
+ __u32 hdr_len;
+ __u64 guest_uaddr;
+ __u32 guest_len;
+ __u64 trans_uaddr;
+ __u32 trans_len;
+};
+
+struct kvm_sev_launch_measure {
+ __u64 uaddr;
+ __u32 len;
+};
+
+struct kvm_sev_guest_status {
+ __u32 handle;
+ __u32 policy;
+ __u32 state;
+};
+
+struct kvm_sev_dbg {
+ __u64 src_uaddr;
+ __u64 dst_uaddr;
+ __u32 len;
+};
#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)

View File

@ -1,115 +0,0 @@
From 23745abd0c79cea6c85622263a46a33c3a96fefb Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:20 -0600
Subject: [PATCH] docs: add AMD Secure Encrypted Virtualization (SEV)
Create a documentation entry to describe the AMD Secure Encrypted
Virtualization (SEV) feature.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
docs/amd-memory-encryption.txt | 92 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 docs/amd-memory-encryption.txt
diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt
new file mode 100644
index 0000000000..72a92b6c63
--- /dev/null
+++ b/docs/amd-memory-encryption.txt
@@ -0,0 +1,92 @@
+Secure Encrypted Virtualization (SEV) is a feature found on AMD processors.
+
+SEV is an extension to the AMD-V architecture which supports running encrypted
+virtual machine (VMs) under the control of KVM. Encrypted VMs have their pages
+(code and data) secured such that only the guest itself has access to the
+unencrypted version. Each encrypted VM is associated with a unique encryption
+key; if its data is accessed to a different entity using a different key the
+encrypted guests data will be incorrectly decrypted, leading to unintelligible
+data.
+
+The key management of this feature is handled by separate processor known as
+AMD secure processor (AMD-SP) which is present in AMD SOCs. Firmware running
+inside the AMD-SP provide commands to support common VM lifecycle. This
+includes commands for launching, snapshotting, migrating and debugging the
+encrypted guest. Those SEV command can be issued via KVM_MEMORY_ENCRYPT_OP
+ioctls.
+
+Launching
+---------
+Boot images (such as bios) must be encrypted before guest can be booted.
+MEMORY_ENCRYPT_OP ioctl provides commands to encrypt the images :LAUNCH_START,
+LAUNCH_UPDATE_DATA, LAUNCH_MEASURE and LAUNCH_FINISH. These four commands
+together generate a fresh memory encryption key for the VM, encrypt the boot
+images and provide a measurement than can be used as an attestation of the
+successful launch.
+
+LAUNCH_START is called first to create a cryptographic launch context within
+the firmware. To create this context, guest owner must provides guest policy,
+its public Diffie-Hellman key (PDH) and session parameters. These inputs
+should be treated as binary blob and must be passed as-is to the SEV firmware.
+
+The guest policy is passed as plaintext and hypervisor may able to read it
+but should not modify it (any modification of the policy bits will result
+in bad measurement). The guest policy is a 4-byte data structure containing
+several flags that restricts what can be done on running SEV guest.
+See KM Spec section 3 and 6.2 for more details.
+
+Guest owners provided DH certificate and session parameters will be used to
+establish a cryptographic session with the guest owner to negotiate keys used
+for the attestation.
+
+LAUNCH_UPDATE_DATA encrypts the memory region using the cryptographic context
+created via LAUNCH_START command. If required, this command can be called
+multiple times to encrypt different memory regions. The command also calculates
+the measurement of the memory contents as it encrypts.
+
+LAUNCH_MEASURE command can be used to retrieve the measurement of encrypted
+memory. This measurement is a signature of the memory contents that can be
+sent to the guest owner as an attestation that the memory was encrypted
+correctly by the firmware. The guest owner may wait to provide the guest
+confidential information until it can verify the attestation measurement.
+Since the guest owner knows the initial contents of the guest at boot, the
+attestation measurement can be verified by comparing it to what the guest owner
+expects.
+
+LAUNCH_FINISH command finalizes the guest launch and destroy's the cryptographic
+context.
+
+See SEV KM API Spec [1] 'Launching a guest' usage flow (Appendix A) for the
+complete flow chart.
+
+Debugging
+-----------
+Since memory contents of SEV guest is encrypted hence hypervisor access to the
+guest memory will get a cipher text. If guest policy allows debugging, then
+hypervisor can use DEBUG_DECRYPT and DEBUG_ENCRYPT commands access the guest
+memory region for debug purposes.
+
+Snapshot/Restore
+-----------------
+TODO
+
+Live Migration
+----------------
+TODO
+
+References
+-----------------
+
+AMD Memory Encryption whitepaper:
+http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf
+
+Secure Encrypted Virutualization Key Management:
+[1] http://support.amd.com/TechDocs/55766_SEV-KM API_Specification.pdf
+
+KVM Forum slides:
+http://www.linux-kvm.org/images/7/74/02x08A-Thomas_Lendacky-AMDs_Virtualizatoin_Memory_Encryption_Technology.pdf
+
+AMD64 Architecture Programmer's Manual:
+ http://support.amd.com/TechDocs/24593.pdf
+ SME is section 7.10
+ SEV is section 15.34

View File

@ -1,425 +0,0 @@
From 3ab22b287a2ea323cb0b4d6daf9fc2177b6dec1c Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:21 -0600
Subject: [PATCH] target/i386: add Secure Encrypted Virtulization (SEV) object
Add a new memory encryption object 'sev-guest'. The object will be used
to create enrypted VMs on AMD EPYC CPU. The object provides the properties
to pass guest owner's public Diffie-hellman key, guest policy and session
information required to create the memory encryption context within the
SEV firmware.
e.g to launch SEV guest
# $QEMU \
-object sev-guest,id=sev0 \
-machine ....,memory-encryption=sev0
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
docs/amd-memory-encryption.txt | 17 +++
include/sysemu/sev.h | 54 ++++++++++
qemu-options.hx | 36 +++++++
target/i386/Makefile.objs | 2 +-
target/i386/sev.c | 228 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 336 insertions(+), 1 deletion(-)
create mode 100644 include/sysemu/sev.h
create mode 100644 target/i386/sev.c
diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt
index 72a92b6c63..1527f603ea 100644
--- a/docs/amd-memory-encryption.txt
+++ b/docs/amd-memory-encryption.txt
@@ -35,10 +35,21 @@ in bad measurement). The guest policy is a 4-byte data structure containing
several flags that restricts what can be done on running SEV guest.
See KM Spec section 3 and 6.2 for more details.
+The guest policy can be provided via the 'policy' property (see below)
+
+# ${QEMU} \
+ sev-guest,id=sev0,policy=0x1...\
+
Guest owners provided DH certificate and session parameters will be used to
establish a cryptographic session with the guest owner to negotiate keys used
for the attestation.
+The DH certificate and session blob can be provided via 'dh-cert-file' and
+'session-file' property (see below
+
+# ${QEMU} \
+ sev-guest,id=sev0,dh-cert-file=<file1>,session-file=<file2>
+
LAUNCH_UPDATE_DATA encrypts the memory region using the cryptographic context
created via LAUNCH_START command. If required, this command can be called
multiple times to encrypt different memory regions. The command also calculates
@@ -59,6 +70,12 @@ context.
See SEV KM API Spec [1] 'Launching a guest' usage flow (Appendix A) for the
complete flow chart.
+To launch a SEV guest
+
+# ${QEMU} \
+ -machine ...,memory-encryption=sev0 \
+ -object sev-guest,id=sev0
+
Debugging
-----------
Since memory contents of SEV guest is encrypted hence hypervisor access to the
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h
new file mode 100644
index 0000000000..a1936a7a79
--- /dev/null
+++ b/include/sysemu/sev.h
@@ -0,0 +1,54 @@
+/*
+ * QEMU Secure Encrypted Virutualization (SEV) support
+ *
+ * Copyright: Advanced Micro Devices, 2016-2018
+ *
+ * Authors:
+ * Brijesh Singh <brijesh.singh@amd.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_SEV_H
+#define QEMU_SEV_H
+
+#include "qom/object.h"
+#include "qapi/error.h"
+#include "sysemu/kvm.h"
+#include "qemu/error-report.h"
+
+#define TYPE_QSEV_GUEST_INFO "sev-guest"
+#define QSEV_GUEST_INFO(obj) \
+ OBJECT_CHECK(QSevGuestInfo, (obj), TYPE_QSEV_GUEST_INFO)
+
+typedef struct QSevGuestInfo QSevGuestInfo;
+typedef struct QSevGuestInfoClass QSevGuestInfoClass;
+
+/**
+ * QSevGuestInfo:
+ *
+ * The QSevGuestInfo object is used for creating a SEV guest.
+ *
+ * # $QEMU \
+ * -object sev-guest,id=sev0 \
+ * -machine ...,memory-encryption=sev0
+ */
+struct QSevGuestInfo {
+ Object parent_obj;
+
+ char *sev_device;
+ uint32_t policy;
+ uint32_t handle;
+ char *dh_cert_file;
+ char *session_file;
+ uint32_t cbitpos;
+ uint32_t reduced_phys_bits;
+};
+
+struct QSevGuestInfoClass {
+ ObjectClass parent_class;
+};
+
+#endif
diff --git a/qemu-options.hx b/qemu-options.hx
index 617e5d5c20..ab8d089f29 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4471,6 +4471,42 @@ contents of @code{iv.b64} to the second secret
data=$SECRET,iv=$(<iv.b64)
@end example
+@item -object sev-guest,id=@var{id},sev-device=@var{string}[cbitpos=@var{cbitpos},policy=@var{policy},handle=@var{handle},dh-cert-file=@var{file},session-file=@var{file}]
+
+Create a Secure Encrypted Virtualization (SEV) guest object, which can be used
+to provide the guest memory encryption support on AMD processors.
+
+The @option{sev-device} provides the device file to use for communicating with
+the SEV firmware running inside AMD Secure Processor. The default device is
+'/dev/sev'. If hardware supports memory encryption then /dev/sev devices are
+created by CCP driver.
+
+The @option{cbitpos} provide the C-bit location in guest page table entry to use.
+
+The @option{policy} provides the guest policy to be enforced by the SEV firmware
+and restrict what configuration and operational commands can be performed on this
+guest by the hypervisor. The policy should be provided by the guest owner and is
+bound to the guest and cannot be changed throughout the lifetime of the guest.
+The default is 0.
+
+If guest @option{policy} allows sharing the key with another SEV guest then
+@option{handle} can be use to provide handle of the guest from which to share
+the key.
+
+The @option{dh-cert-file} and @option{session-file} provides the guest owner's
+Public Diffie-Hillman key defined in SEV spec. The PDH and session parameters
+are used for establishing a cryptographic session with the guest owner to
+negotiate keys used for attestation. The file must be encoded in base64.
+
+e.g to launch a SEV guest
+@example
+ # $QEMU \
+ ......
+ -object sev-guest,id=sev0 \
+ -machine ...,memory-encryption=sev0
+ .....
+
+@end example
@end table
ETEXI
diff --git a/target/i386/Makefile.objs b/target/i386/Makefile.objs
index 6a26e9d9f0..682f029c45 100644
--- a/target/i386/Makefile.objs
+++ b/target/i386/Makefile.objs
@@ -4,7 +4,7 @@ obj-$(CONFIG_TCG) += bpt_helper.o cc_helper.o excp_helper.o fpu_helper.o
obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o mpx_helper.o
obj-$(CONFIG_TCG) += seg_helper.o smm_helper.o svm_helper.o
obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
-obj-$(CONFIG_KVM) += kvm.o hyperv.o
+obj-$(CONFIG_KVM) += kvm.o hyperv.o sev.o
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
# HAX support
ifdef CONFIG_WIN32
diff --git a/target/i386/sev.c b/target/i386/sev.c
new file mode 100644
index 0000000000..f07c646577
--- /dev/null
+++ b/target/i386/sev.c
@@ -0,0 +1,228 @@
+/*
+ * QEMU SEV support
+ *
+ * Copyright Advanced Micro Devices 2016-2018
+ *
+ * Author:
+ * Brijesh Singh <brijesh.singh@amd.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qom/object_interfaces.h"
+#include "qemu/base64.h"
+#include "sysemu/kvm.h"
+#include "sysemu/sev.h"
+#include "sysemu/sysemu.h"
+
+#define DEFAULT_GUEST_POLICY 0x1 /* disable debug */
+#define DEFAULT_SEV_DEVICE "/dev/sev"
+
+static void
+qsev_guest_finalize(Object *obj)
+{
+}
+
+static char *
+qsev_guest_get_session_file(Object *obj, Error **errp)
+{
+ QSevGuestInfo *s = QSEV_GUEST_INFO(obj);
+
+ return s->session_file ? g_strdup(s->session_file) : NULL;
+}
+
+static void
+qsev_guest_set_session_file(Object *obj, const char *value, Error **errp)
+{
+ QSevGuestInfo *s = QSEV_GUEST_INFO(obj);
+
+ s->session_file = g_strdup(value);
+}
+
+static char *
+qsev_guest_get_dh_cert_file(Object *obj, Error **errp)
+{
+ QSevGuestInfo *s = QSEV_GUEST_INFO(obj);
+
+ return g_strdup(s->dh_cert_file);
+}
+
+static void
+qsev_guest_set_dh_cert_file(Object *obj, const char *value, Error **errp)
+{
+ QSevGuestInfo *s = QSEV_GUEST_INFO(obj);
+
+ s->dh_cert_file = g_strdup(value);
+}
+
+static char *
+qsev_guest_get_sev_device(Object *obj, Error **errp)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ return g_strdup(sev->sev_device);
+}
+
+static void
+qsev_guest_set_sev_device(Object *obj, const char *value, Error **errp)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ sev->sev_device = g_strdup(value);
+}
+
+static void
+qsev_guest_class_init(ObjectClass *oc, void *data)
+{
+ object_class_property_add_str(oc, "sev-device",
+ qsev_guest_get_sev_device,
+ qsev_guest_set_sev_device,
+ NULL);
+ object_class_property_set_description(oc, "sev-device",
+ "SEV device to use", NULL);
+ object_class_property_add_str(oc, "dh-cert-file",
+ qsev_guest_get_dh_cert_file,
+ qsev_guest_set_dh_cert_file,
+ NULL);
+ object_class_property_set_description(oc, "dh-cert-file",
+ "guest owners DH certificate (encoded with base64)", NULL);
+ object_class_property_add_str(oc, "session-file",
+ qsev_guest_get_session_file,
+ qsev_guest_set_session_file,
+ NULL);
+ object_class_property_set_description(oc, "session-file",
+ "guest owners session parameters (encoded with base64)", NULL);
+}
+
+static void
+qsev_guest_set_handle(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+ uint32_t value;
+
+ visit_type_uint32(v, name, &value, errp);
+ sev->handle = value;
+}
+
+static void
+qsev_guest_set_policy(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+ uint32_t value;
+
+ visit_type_uint32(v, name, &value, errp);
+ sev->policy = value;
+}
+
+static void
+qsev_guest_set_cbitpos(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+ uint32_t value;
+
+ visit_type_uint32(v, name, &value, errp);
+ sev->cbitpos = value;
+}
+
+static void
+qsev_guest_set_reduced_phys_bits(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+ uint32_t value;
+
+ visit_type_uint32(v, name, &value, errp);
+ sev->reduced_phys_bits = value;
+}
+
+static void
+qsev_guest_get_policy(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ uint32_t value;
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ value = sev->policy;
+ visit_type_uint32(v, name, &value, errp);
+}
+
+static void
+qsev_guest_get_handle(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ uint32_t value;
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ value = sev->handle;
+ visit_type_uint32(v, name, &value, errp);
+}
+
+static void
+qsev_guest_get_cbitpos(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ uint32_t value;
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ value = sev->cbitpos;
+ visit_type_uint32(v, name, &value, errp);
+}
+
+static void
+qsev_guest_get_reduced_phys_bits(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ uint32_t value;
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ value = sev->reduced_phys_bits;
+ visit_type_uint32(v, name, &value, errp);
+}
+
+static void
+qsev_guest_init(Object *obj)
+{
+ QSevGuestInfo *sev = QSEV_GUEST_INFO(obj);
+
+ sev->sev_device = g_strdup(DEFAULT_SEV_DEVICE);
+ sev->policy = DEFAULT_GUEST_POLICY;
+ object_property_add(obj, "policy", "uint32", qsev_guest_get_policy,
+ qsev_guest_set_policy, NULL, NULL, NULL);
+ object_property_add(obj, "handle", "uint32", qsev_guest_get_handle,
+ qsev_guest_set_handle, NULL, NULL, NULL);
+ object_property_add(obj, "cbitpos", "uint32", qsev_guest_get_cbitpos,
+ qsev_guest_set_cbitpos, NULL, NULL, NULL);
+ object_property_add(obj, "reduced-phys-bits", "uint32",
+ qsev_guest_get_reduced_phys_bits,
+ qsev_guest_set_reduced_phys_bits, NULL, NULL, NULL);
+}
+
+/* sev guest info */
+static const TypeInfo qsev_guest_info = {
+ .parent = TYPE_OBJECT,
+ .name = TYPE_QSEV_GUEST_INFO,
+ .instance_size = sizeof(QSevGuestInfo),
+ .instance_finalize = qsev_guest_finalize,
+ .class_size = sizeof(QSevGuestInfoClass),
+ .class_init = qsev_guest_class_init,
+ .instance_init = qsev_guest_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_USER_CREATABLE },
+ { }
+ }
+};
+
+static void
+sev_register_types(void)
+{
+ type_register_static(&qsev_guest_info);
+}
+
+type_init(sev_register_types);

View File

@ -1,109 +0,0 @@
From 25703182278f403f2d8ff608aadabb5c4f0f3398 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:21 -0600
Subject: [PATCH] qmp: add query-sev command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The QMP query command can used to retrieve the SEV information when
memory encryption is enabled on AMD platform.
Cc: Eric Blake <eblake@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
qapi-schema.json | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
qmp.c | 6 ++++++
2 files changed, 63 insertions(+)
diff --git a/qapi-schema.json b/qapi-schema.json
index 18457954a8..91a8a74f81 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3200,3 +3200,60 @@
# Since: 2.11
##
{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+
+##
+# @SevState:
+#
+# An enumeration of SEV state information used during @query-sev.
+#
+# Since: 2.12
+##
+{ 'enum': 'SevState',
+ 'data': ['uninit', 'lupdate', 'lsecret', 'running', 'supdate', 'rupdate' ] }
+
+##
+# @SevInfo:
+#
+# Information about Secure Encrypted Virtualization (SEV) support
+#
+# @enabled: true if SEV is active
+#
+# @api-major: SEV API major version
+#
+# @api-minor: SEV API minor version
+#
+# @build-id: SEV FW build id
+#
+# @policy: SEV policy value
+#
+# @state: SEV guest state
+#
+# Since: 2.12
+##
+{ 'struct': 'SevInfo',
+ 'data': { 'enabled': 'bool',
+ 'api-major': 'uint8',
+ 'api-minor' : 'uint8',
+ 'build-id' : 'uint8',
+ 'policy' : 'uint32',
+ 'state' : 'SevState'
+ }
+}
+
+##
+# @query-sev:
+#
+# Returns information about SEV
+#
+# Returns: @SevInfo
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev" }
+# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
+# "build-id" : 0, "policy" : 0, "state" : "running" } }
+#
+##
+{ 'command': 'query-sev', 'returns': 'SevInfo' }
diff --git a/qmp.c b/qmp.c
index e8c303116a..75b5a349b0 100644
--- a/qmp.c
+++ b/qmp.c
@@ -37,6 +37,7 @@
#include "qom/object_interfaces.h"
#include "hw/mem/pc-dimm.h"
#include "hw/acpi/acpi_dev_interface.h"
+#include "sysemu/sev.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -722,3 +723,8 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
return mem_info;
}
+
+SevInfo *qmp_query_sev(Error **errp)
+{
+ return NULL;
+}

View File

@ -1,405 +0,0 @@
From dcba83a5b2ba19c6b143734ac392e678e8e710c2 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:21 -0600
Subject: [PATCH] sev/i386: add command to initialize the memory encryption
context
When memory encryption is enabled, KVM_SEV_INIT command is used to
initialize the platform. The command loads the SEV related persistent
data from non-volatile storage and initializes the platform context.
This command should be first issued before invoking any other guest
commands provided by the SEV firmware.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
accel/kvm/kvm-all.c | 15 ++++
include/sysemu/sev.h | 19 +++++
stubs/Makefile.objs | 1 +
stubs/sev.c | 54 ++++++++++++++
target/i386/sev.c | 191 +++++++++++++++++++++++++++++++++++++++++++++++
target/i386/trace-events | 3 +
6 files changed, 283 insertions(+)
create mode 100644 stubs/sev.c
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index f290f487a5..6e5f3fd650 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -38,6 +38,7 @@
#include "qemu/event_notifier.h"
#include "trace.h"
#include "hw/irq.h"
+#include "sysemu/sev.h"
#include "hw/boards.h"
@@ -103,6 +104,9 @@ struct KVMState
#endif
KVMMemoryListener memory_listener;
QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus;
+
+ /* memory encryption */
+ void *memcrypt_handle;
};
KVMState *kvm_state;
@@ -1632,6 +1636,17 @@ static int kvm_init(MachineState *ms)
kvm_state = s;
+ /*
+ * if memory encryption object is specified then initialize the memory
+ * encryption context.
+ */
+ if (ms->memory_encryption) {
+ kvm_state->memcrypt_handle = sev_guest_init(ms->memory_encryption);
+ if (!kvm_state->memcrypt_handle) {
+ goto err;
+ }
+ }
+
ret = kvm_arch_init(ms, s);
if (ret < 0) {
goto err;
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h
index a1936a7a79..5c8c549b68 100644
--- a/include/sysemu/sev.h
+++ b/include/sysemu/sev.h
@@ -14,15 +14,26 @@
#ifndef QEMU_SEV_H
#define QEMU_SEV_H
+#include <linux/kvm.h>
+
#include "qom/object.h"
#include "qapi/error.h"
#include "sysemu/kvm.h"
#include "qemu/error-report.h"
+#include "qapi-types.h"
#define TYPE_QSEV_GUEST_INFO "sev-guest"
#define QSEV_GUEST_INFO(obj) \
OBJECT_CHECK(QSevGuestInfo, (obj), TYPE_QSEV_GUEST_INFO)
+extern bool sev_enabled(void);
+extern uint64_t sev_get_me_mask(void);
+extern SevState sev_get_current_state(void);
+extern void sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build);
+extern void sev_get_policy(uint32_t *policy);
+extern uint32_t sev_get_cbit_position(void);
+extern uint32_t sev_get_reduced_phys_bits(void);
+
typedef struct QSevGuestInfo QSevGuestInfo;
typedef struct QSevGuestInfoClass QSevGuestInfoClass;
@@ -51,4 +62,12 @@ struct QSevGuestInfoClass {
ObjectClass parent_class;
};
+struct SEVState {
+ QSevGuestInfo *sev_info;
+};
+
+typedef struct SEVState SEVState;
+
+void *sev_guest_init(const char *id);
+
#endif
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 8cfe34328a..b3bbbe62c0 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -42,3 +42,4 @@ stub-obj-y += vmgenid.o
stub-obj-y += xen-common.o
stub-obj-y += xen-hvm.o
stub-obj-y += pci-host-piix.o
+stub-obj-y += sev.o
diff --git a/stubs/sev.c b/stubs/sev.c
new file mode 100644
index 0000000000..24c7b0c3e0
--- /dev/null
+++ b/stubs/sev.c
@@ -0,0 +1,54 @@
+/*
+ * QEMU SEV stub
+ *
+ * Copyright Advanced Micro Devices 2018
+ *
+ * Authors:
+ * Brijesh Singh <brijesh.singh@amd.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "sysemu/sev.h"
+
+SevState sev_get_current_state(void)
+{
+ return SEV_STATE_UNINIT;
+}
+
+bool sev_enabled(void)
+{
+ return false;
+}
+
+void *sev_guest_init(const char *id)
+{
+ return NULL;
+}
+
+uint64_t sev_get_me_mask(void)
+{
+ return ~0UL;
+}
+
+uint32_t sev_get_cbit_position(void)
+{
+ return 0;
+}
+
+uint32_t sev_get_reduced_phys_bits(void)
+{
+ return 0;
+}
+
+void sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build)
+{
+}
+
+void sev_get_policy(uint32_t *policy)
+{
+}
diff --git a/target/i386/sev.c b/target/i386/sev.c
index f07c646577..f9a8748d19 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -18,10 +18,76 @@
#include "sysemu/kvm.h"
#include "sysemu/sev.h"
#include "sysemu/sysemu.h"
+#include "trace.h"
#define DEFAULT_GUEST_POLICY 0x1 /* disable debug */
#define DEFAULT_SEV_DEVICE "/dev/sev"
+static uint64_t me_mask;
+static bool sev_active;
+static int sev_fd;
+static uint32_t x86_cbitpos;
+static uint32_t x86_reduced_phys_bits;
+
+static const char *const sev_fw_errlist[] = {
+ "",
+ "Platform state is invalid",
+ "Guest state is invalid",
+ "Platform configuration is invalid",
+ "Buffer too small",
+ "Platform is already owned",
+ "Certificate is invalid",
+ "Policy is not allowed",
+ "Guest is not active",
+ "Invalid address",
+ "Bad signature",
+ "Bad measurement",
+ "Asid is already owned",
+ "Invalid ASID",
+ "WBINVD is required",
+ "DF_FLUSH is required",
+ "Guest handle is invalid",
+ "Invalid command",
+ "Guest is active",
+ "Hardware error",
+ "Hardware unsafe",
+ "Feature not supported",
+ "Invalid parameter"
+};
+
+#define SEV_FW_MAX_ERROR ARRAY_SIZE(sev_fw_errlist)
+
+static int
+sev_ioctl(int cmd, void *data, int *error)
+{
+ int r;
+ struct kvm_sev_cmd input;
+
+ memset(&input, 0x0, sizeof(input));
+
+ input.id = cmd;
+ input.sev_fd = sev_fd;
+ input.data = (__u64)data;
+
+ r = kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, &input);
+
+ if (error) {
+ *error = input.error;
+ }
+
+ return r;
+}
+
+static const char *
+fw_error_to_str(int code)
+{
+ if (code >= SEV_FW_MAX_ERROR) {
+ return "unknown error";
+ }
+
+ return sev_fw_errlist[code];
+}
+
static void
qsev_guest_finalize(Object *obj)
{
@@ -219,6 +285,131 @@ static const TypeInfo qsev_guest_info = {
}
};
+static QSevGuestInfo *
+lookup_sev_guest_info(const char *id)
+{
+ Object *obj;
+ QSevGuestInfo *info;
+
+ obj = object_resolve_path_component(object_get_objects_root(), id);
+ if (!obj) {
+ return NULL;
+ }
+
+ info = (QSevGuestInfo *)
+ object_dynamic_cast(obj, TYPE_QSEV_GUEST_INFO);
+ if (!info) {
+ return NULL;
+ }
+
+ return info;
+}
+
+uint64_t
+sev_get_me_mask(void)
+{
+ return ~me_mask;
+}
+
+uint32_t
+sev_get_cbit_position(void)
+{
+ return x86_cbitpos;
+}
+
+uint32_t
+sev_get_reduced_phys_bits(void)
+{
+ return x86_reduced_phys_bits;
+}
+
+SevState
+sev_get_current_state(void)
+{
+ return SEV_STATE_UNINIT;
+}
+
+bool
+sev_enabled(void)
+{
+ return sev_active;
+}
+
+void
+sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build)
+{
+}
+
+void
+sev_get_policy(uint32_t *policy)
+{
+}
+
+void *
+sev_guest_init(const char *id)
+{
+ SEVState *s;
+ char *devname;
+ int ret, fw_error;
+ uint32_t ebx;
+ uint32_t host_cbitpos, cbitpos;
+ uint32_t host_reduced_phys_bits, reduced_phys_bits;
+
+ s = g_new0(SEVState, 1);
+ s->sev_info = lookup_sev_guest_info(id);
+ if (!s->sev_info) {
+ error_report("%s: '%s' is not a valid '%s' object",
+ __func__, id, TYPE_QSEV_GUEST_INFO);
+ goto err;
+ }
+
+ host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
+ host_cbitpos = ebx & 0x3f;
+ host_reduced_phys_bits = (ebx >> 6) & 0x3f;
+
+ cbitpos = object_property_get_int(OBJECT(s->sev_info), "cbitpos", NULL);
+ if (host_cbitpos != cbitpos) {
+ error_report("%s: cbitpos check failed, host '%d' requested '%d'",
+ __func__, host_cbitpos, cbitpos);
+ goto err;
+ }
+
+ reduced_phys_bits = object_property_get_int(OBJECT(s->sev_info),
+ "reduced-phys-bits", NULL);
+ if (host_reduced_phys_bits != reduced_phys_bits) {
+ error_report("%s: reduced_phys_bits check failed,"
+ "host '%d' requested '%d'", __func__,
+ host_reduced_phys_bits, reduced_phys_bits);
+ goto err;
+ }
+
+ devname = object_property_get_str(OBJECT(s->sev_info), "sev-device", NULL);
+ sev_fd = open(devname, O_RDWR);
+ if (sev_fd < 0) {
+ error_report("%s: Failed to open %s '%s'", __func__,
+ devname, strerror(errno));
+ goto err;
+ }
+ g_free(devname);
+
+ trace_kvm_sev_init();
+ ret = sev_ioctl(KVM_SEV_INIT, NULL, &fw_error);
+ if (ret) {
+ error_report("%s: failed to initialize ret=%d fw_error=%d '%s'",
+ __func__, ret, fw_error, fw_error_to_str(fw_error));
+ goto err;
+ }
+
+ me_mask = (1UL << cbitpos);
+ x86_reduced_phys_bits = reduced_phys_bits;
+ x86_cbitpos = cbitpos;
+ sev_active = true;
+ return s;
+err:
+ g_free(s);
+ return NULL;
+}
+
static void
sev_register_types(void)
{
diff --git a/target/i386/trace-events b/target/i386/trace-events
index 3153fd4454..797b716751 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -5,3 +5,6 @@ kvm_x86_fixup_msi_error(uint32_t gsi) "VT-d failed to remap interrupt for GSI %"
kvm_x86_add_msi_route(int virq) "Adding route entry for virq %d"
kvm_x86_remove_msi_route(int virq) "Removing route entry for virq %d"
kvm_x86_update_msi_routes(int num) "Updated %d MSI routes"
+
+# target/i386/sev.c
+kvm_sev_init(void) ""

View File

@ -1,43 +0,0 @@
From 0b770bea4deaa363b1eff696402057d55d9721b6 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:21 -0600
Subject: [PATCH] qmp: populate SevInfo fields with SEV guest information
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
query-sev command is used to get the SEV guest information, fill the
SevInfo fields with SEV guest information.
Cc: Eric Blake <eblake@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
qmp.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/qmp.c b/qmp.c
index 75b5a349b0..3c2d573384 100644
--- a/qmp.c
+++ b/qmp.c
@@ -726,5 +726,15 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
SevInfo *qmp_query_sev(Error **errp)
{
- return NULL;
+ SevInfo *info = g_malloc0(sizeof(*info));
+
+ info->enabled = sev_enabled();
+ if (info->enabled) {
+ sev_get_fw_version(&info->api_major,
+ &info->api_minor, &info->build_id);
+ sev_get_policy(&info->policy);
+ info->state = sev_get_current_state();
+ }
+
+ return info;
}

View File

@ -1,96 +0,0 @@
From c6101a4c186abcc2d3b78972a534cbe1907bea57 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:21 -0600
Subject: [PATCH] sev/i386: register the guest memory range which may contain
encrypted data
When SEV is enabled, the hardware encryption engine uses a tweak such
that the two identical plaintext at different location will have a
different ciphertexts. So swapping or moving a ciphertexts of two guest
pages will not result in plaintexts being swapped. Hence relocating
a physical backing pages of the SEV guest will require some additional
steps in KVM driver. The KVM_MEMORY_ENCRYPT_{UN,}REG_REGION ioctl can be
used to register/unregister the guest memory region which may contain the
encrypted data. KVM driver will internally handle the relocating physical
backing pages of registered memory regions.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/sev.c | 41 +++++++++++++++++++++++++++++++++++++++++
target/i386/trace-events | 2 ++
2 files changed, 43 insertions(+)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index f9a8748d19..de5c8d4675 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -88,6 +88,45 @@ fw_error_to_str(int code)
return sev_fw_errlist[code];
}
+static void
+sev_ram_block_added(RAMBlockNotifier *n, void *host, size_t size)
+{
+ int r;
+ struct kvm_enc_region range;
+
+ range.addr = (__u64)host;
+ range.size = size;
+
+ trace_kvm_memcrypt_register_region(host, size);
+ r = kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_REG_REGION, &range);
+ if (r) {
+ error_report("%s: failed to register region (%p+%#lx)",
+ __func__, host, size);
+ }
+}
+
+static void
+sev_ram_block_removed(RAMBlockNotifier *n, void *host, size_t size)
+{
+ int r;
+ struct kvm_enc_region range;
+
+ range.addr = (__u64)host;
+ range.size = size;
+
+ trace_kvm_memcrypt_unregister_region(host, size);
+ r = kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_UNREG_REGION, &range);
+ if (r) {
+ error_report("%s: failed to unregister region (%p+%#lx)",
+ __func__, host, size);
+ }
+}
+
+static struct RAMBlockNotifier sev_ram_notifier = {
+ .ram_block_added = sev_ram_block_added,
+ .ram_block_removed = sev_ram_block_removed,
+};
+
static void
qsev_guest_finalize(Object *obj)
{
@@ -404,6 +443,8 @@ sev_guest_init(const char *id)
x86_reduced_phys_bits = reduced_phys_bits;
x86_cbitpos = cbitpos;
sev_active = true;
+ ram_block_notifier_add(&sev_ram_notifier);
+
return s;
err:
g_free(s);
diff --git a/target/i386/trace-events b/target/i386/trace-events
index 797b716751..ffa3d22504 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -8,3 +8,5 @@ kvm_x86_update_msi_routes(int num) "Updated %d MSI routes"
# target/i386/sev.c
kvm_sev_init(void) ""
+kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%lu"
+kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%lu"

View File

@ -1,129 +0,0 @@
From da8eb76eb09a056b7107bc27f790c715fba088d7 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:22 -0600
Subject: [PATCH] kvm: introduce memory encryption APIs
Inorder to integerate the Secure Encryption Virtualization (SEV) support
add few high-level memory encryption APIs which can be used for encrypting
the guest memory region.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
accel/kvm/kvm-all.c | 30 ++++++++++++++++++++++++++++++
accel/stubs/kvm-stub.c | 14 ++++++++++++++
include/sysemu/kvm.h | 25 +++++++++++++++++++++++++
3 files changed, 69 insertions(+)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 6e5f3fd650..f1fb826f06 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -107,6 +107,8 @@ struct KVMState
/* memory encryption */
void *memcrypt_handle;
+ int (*memcrypt_encrypt_data)(void *handle, uint8_t *ptr, uint64_t len);
+ void (*memcrypt_debug_ops)(void *handle, MemoryRegion *mr);
};
KVMState *kvm_state;
@@ -142,6 +144,34 @@ int kvm_get_max_memslots(void)
return s->nr_slots;
}
+bool kvm_memcrypt_enabled(void)
+{
+ if (kvm_state && kvm_state->memcrypt_handle) {
+ return true;
+ }
+
+ return false;
+}
+
+int kvm_memcrypt_encrypt_data(uint8_t *ptr, uint64_t len)
+{
+ if (kvm_state->memcrypt_handle &&
+ kvm_state->memcrypt_encrypt_data) {
+ return kvm_state->memcrypt_encrypt_data(kvm_state->memcrypt_handle,
+ ptr, len);
+ }
+
+ return 1;
+}
+
+void kvm_memcrypt_set_debug_ops(MemoryRegion *mr)
+{
+ if (kvm_state->memcrypt_handle &&
+ kvm_state->memcrypt_debug_ops) {
+ kvm_state->memcrypt_debug_ops(kvm_state->memcrypt_handle, mr);
+ }
+}
+
static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml)
{
KVMState *s = kvm_state;
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index c964af3e1c..5739712a67 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -105,6 +105,20 @@ int kvm_on_sigbus(int code, void *addr)
return 1;
}
+bool kvm_memcrypt_enabled(void)
+{
+ return false;
+}
+
+int kvm_memcrypt_encrypt_data(uint8_t *ptr, uint64_t len)
+{
+ return 1;
+}
+
+void kvm_memcrypt_set_debug_ops(MemoryRegion *mr)
+{
+}
+
#ifndef CONFIG_USER_ONLY
int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
{
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index bbf12a1723..4a5db5dde3 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -231,6 +231,31 @@ int kvm_destroy_vcpu(CPUState *cpu);
*/
bool kvm_arm_supports_user_irq(void);
+/**
+ * kvm_memcrypt_enabled - return boolean indicating whether memory encryption
+ * is enabled
+ * Returns: 1 memory encryption is enabled
+ * 0 memory encryption is disabled
+ */
+bool kvm_memcrypt_enabled(void);
+
+/**
+ * kvm_memcrypt_encrypt_data: encrypt the memory range
+ *
+ * Return: 1 failed to encrypt the range
+ * 0 succesfully encrypted memory region
+ */
+int kvm_memcrypt_encrypt_data(uint8_t *ptr, uint64_t len);
+
+/**
+ * kvm_memcrypt_set_debug_ram_ops: set debug_ram_ops callback
+ *
+ * When debug_ram_ops is set, debug access to this memory region will use
+ * memory encryption APIs.
+ */
+void kvm_memcrypt_set_debug_ops(MemoryRegion *mr);
+
+
#ifdef NEED_CPU_H
#include "cpu.h"

View File

@ -1,87 +0,0 @@
From ae854a2255006d807366a2b2529311b1dcaaed17 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:22 -0600
Subject: [PATCH] hmp: add 'info sev' command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The command can be used to show the SEV information when memory
encryption is enabled on AMD platform.
Cc: Eric Blake <eblake@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hmp-commands-info.hx | 14 ++++++++++++++
hmp.c | 19 +++++++++++++++++++
hmp.h | 1 +
3 files changed, 34 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 54c3e5eac6..83491f84f6 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -865,6 +865,20 @@ STEXI
@findex info memory_size_summary
Display the amount of initially allocated and present hotpluggable (if
enabled) memory in bytes.
+ETEXI
+
+ {
+ .name = "sev",
+ .args_type = "",
+ .params = "",
+ .help = "show SEV information",
+ .cmd = hmp_info_sev,
+ },
+
+STEXI
+@item info sev
+@findex info sev
+Show SEV information.
ETEXI
STEXI
diff --git a/hmp.c b/hmp.c
index 35a7041824..f3898347b8 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2918,3 +2918,22 @@ void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict)
}
hmp_handle_error(mon, &err);
}
+
+void hmp_info_sev(Monitor *mon, const QDict *qdict)
+{
+ SevInfo *info;
+
+ info = qmp_query_sev(NULL);
+ monitor_printf(mon, "sev support: ");
+ monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
+
+ if (info->enabled) {
+ monitor_printf(mon, "state: %s\n", SevState_str(info->state));
+ monitor_printf(mon, "policy: 0x%x\n", info->policy);
+ monitor_printf(mon, "build id: %u\n", info->build_id);
+ monitor_printf(mon, "api version: %u.%u\n",
+ info->api_major, info->api_minor);
+ }
+
+ qapi_free_SevInfo(info);
+}
diff --git a/hmp.h b/hmp.h
index a6f56b1f29..153f106be8 100644
--- a/hmp.h
+++ b/hmp.h
@@ -147,5 +147,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
+void hmp_info_sev(Monitor *mon, const QDict *qdict);
#endif

View File

@ -1,161 +0,0 @@
From 0c5346f2b8f38e938f277c9df91068cbcad12ad2 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:22 -0600
Subject: [PATCH] sev/i386: add command to create launch memory encryption
context
The KVM_SEV_LAUNCH_START command creates a new VM encryption key (VEK).
The encryption key created with the command will be used for encrypting
the bootstrap images (such as guest bios).
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/sev.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++-
target/i386/trace-events | 2 ++
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index de5c8d4675..6f767084fd 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -29,6 +29,8 @@ static int sev_fd;
static uint32_t x86_cbitpos;
static uint32_t x86_reduced_phys_bits;
+static SevState current_sev_guest_state = SEV_STATE_UNINIT;
+
static const char *const sev_fw_errlist[] = {
"",
"Platform state is invalid",
@@ -88,6 +90,16 @@ fw_error_to_str(int code)
return sev_fw_errlist[code];
}
+static void
+sev_set_guest_state(SevState new_state)
+{
+ assert(new_state < SEV_STATE__MAX);
+
+ trace_kvm_sev_change_state(SevState_str(current_sev_guest_state),
+ SevState_str(new_state));
+ current_sev_guest_state = new_state;
+}
+
static void
sev_ram_block_added(RAMBlockNotifier *n, void *host, size_t size)
{
@@ -365,7 +377,7 @@ sev_get_reduced_phys_bits(void)
SevState
sev_get_current_state(void)
{
- return SEV_STATE_UNINIT;
+ return current_sev_guest_state;
}
bool
@@ -384,6 +396,76 @@ sev_get_policy(uint32_t *policy)
{
}
+static int
+sev_read_file_base64(const char *filename, guchar **data, gsize *len)
+{
+ gsize sz;
+ gchar *base64;
+ GError *error = NULL;
+
+ if (!g_file_get_contents(filename, &base64, &sz, &error)) {
+ error_report("failed to read '%s' (%s)", filename, error->message);
+ return -1;
+ }
+
+ *data = g_base64_decode(base64, len);
+ return 0;
+}
+
+static int
+sev_launch_start(SEVState *s)
+{
+ gsize sz;
+ int ret = 1;
+ int fw_error;
+ QSevGuestInfo *sev = s->sev_info;
+ struct kvm_sev_launch_start *start;
+ guchar *session = NULL, *dh_cert = NULL;
+
+ start = g_malloc0(sizeof(*start));
+ if (!start) {
+ return 1;
+ }
+
+ start->handle = object_property_get_int(OBJECT(sev), "handle",
+ &error_abort);
+ start->policy = object_property_get_int(OBJECT(sev), "policy",
+ &error_abort);
+ if (sev->session_file) {
+ if (sev_read_file_base64(sev->session_file, &session, &sz) < 0) {
+ return 1;
+ }
+ start->session_uaddr = (unsigned long)session;
+ start->session_len = sz;
+ }
+
+ if (sev->dh_cert_file) {
+ if (sev_read_file_base64(sev->dh_cert_file, &dh_cert, &sz) < 0) {
+ return 1;
+ }
+ start->dh_uaddr = (unsigned long)dh_cert;
+ start->dh_len = sz;
+ }
+
+ trace_kvm_sev_launch_start(start->policy, session, dh_cert);
+ ret = sev_ioctl(KVM_SEV_LAUNCH_START, start, &fw_error);
+ if (ret < 0) {
+ error_report("%s: LAUNCH_START ret=%d fw_error=%d '%s'",
+ __func__, ret, fw_error, fw_error_to_str(fw_error));
+ return 1;
+ }
+
+ object_property_set_int(OBJECT(sev), start->handle, "handle",
+ &error_abort);
+ sev_set_guest_state(SEV_STATE_LUPDATE);
+
+ g_free(start);
+ g_free(session);
+ g_free(dh_cert);
+
+ return 0;
+}
+
void *
sev_guest_init(const char *id)
{
@@ -439,6 +521,13 @@ sev_guest_init(const char *id)
goto err;
}
+ ret = sev_launch_start(s);
+ if (ret) {
+ error_report("%s: failed to create encryption context", __func__);
+ goto err;
+ }
+
+
me_mask = (1UL << cbitpos);
x86_reduced_phys_bits = reduced_phys_bits;
x86_cbitpos = cbitpos;
diff --git a/target/i386/trace-events b/target/i386/trace-events
index ffa3d22504..9402251e99 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -10,3 +10,5 @@ kvm_x86_update_msi_routes(int num) "Updated %d MSI routes"
kvm_sev_init(void) ""
kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%lu"
kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%lu"
+kvm_sev_change_state(const char *old, const char *new) "%s -> %s"
+kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p"

View File

@ -1,145 +0,0 @@
From b7326c19d0504bb913c80075648a71c9830cda10 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:22 -0600
Subject: [PATCH] sev/i386: add command to encrypt guest memory region
The KVM_SEV_LAUNCH_UPDATE_DATA command is used to encrypt a guest memory
region using the VM Encryption Key created using LAUNCH_START.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
accel/kvm/kvm-all.c | 2 ++
include/sysemu/sev.h | 1 +
stubs/sev.c | 5 +++++
target/i386/sev.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
target/i386/trace-events | 1 +
5 files changed, 58 insertions(+)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index f1fb826f06..37f7c442dc 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1675,6 +1675,8 @@ static int kvm_init(MachineState *ms)
if (!kvm_state->memcrypt_handle) {
goto err;
}
+
+ kvm_state->memcrypt_encrypt_data = sev_encrypt_data;
}
ret = kvm_arch_init(ms, s);
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h
index 5c8c549b68..c16102b05e 100644
--- a/include/sysemu/sev.h
+++ b/include/sysemu/sev.h
@@ -69,5 +69,6 @@ struct SEVState {
typedef struct SEVState SEVState;
void *sev_guest_init(const char *id);
+int sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len);
#endif
diff --git a/stubs/sev.c b/stubs/sev.c
index 24c7b0c3e0..74182bb545 100644
--- a/stubs/sev.c
+++ b/stubs/sev.c
@@ -15,6 +15,11 @@
#include "qemu-common.h"
#include "sysemu/sev.h"
+int sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len)
+{
+ return 1;
+}
+
SevState sev_get_current_state(void)
{
return SEV_STATE_UNINIT;
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 6f767084fd..04a64b5bc6 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -90,6 +90,12 @@ fw_error_to_str(int code)
return sev_fw_errlist[code];
}
+static bool
+sev_check_state(SevState state)
+{
+ return current_sev_guest_state == state ? true : false;
+}
+
static void
sev_set_guest_state(SevState new_state)
{
@@ -466,6 +472,36 @@ sev_launch_start(SEVState *s)
return 0;
}
+static int
+sev_launch_update_data(uint8_t *addr, uint64_t len)
+{
+ int ret, fw_error;
+ struct kvm_sev_launch_update_data *update;
+
+ if (addr == NULL || len <= 0) {
+ return 1;
+ }
+
+ update = g_malloc0(sizeof(*update));
+ if (!update) {
+ return 1;
+ }
+
+ update->uaddr = (__u64)addr;
+ update->len = len;
+ trace_kvm_sev_launch_update_data(addr, len);
+ ret = sev_ioctl(KVM_SEV_LAUNCH_UPDATE_DATA, update, &fw_error);
+ if (ret) {
+ error_report("%s: LAUNCH_UPDATE ret=%d fw_error=%d '%s'",
+ __func__, ret, fw_error, fw_error_to_str(fw_error));
+ goto err;
+ }
+
+err:
+ g_free(update);
+ return ret;
+}
+
void *
sev_guest_init(const char *id)
{
@@ -540,6 +576,19 @@ err:
return NULL;
}
+int
+sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len)
+{
+ assert(handle);
+
+ /* if SEV is in update state then encrypt the data else do nothing */
+ if (sev_check_state(SEV_STATE_LUPDATE)) {
+ return sev_launch_update_data(ptr, len);
+ }
+
+ return 0;
+}
+
static void
sev_register_types(void)
{
diff --git a/target/i386/trace-events b/target/i386/trace-events
index 9402251e99..c0cd8e9321 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -12,3 +12,4 @@ kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%lu"
kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%lu"
kvm_sev_change_state(const char *old, const char *new) "%s -> %s"
kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p"
+kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64

View File

@ -1,49 +0,0 @@
From e6990d56a3b6d4702cec1c3d35c037e906eb39c0 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:22 -0600
Subject: [PATCH] target/i386: encrypt bios rom
SEV requires that guest bios must be encrypted before booting the guest.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/i386/pc_sysfw.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 6b183747fc..8ddbbf74d3 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -112,6 +112,8 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
pflash_t *system_flash;
MemoryRegion *flash_mem;
char name[64];
+ void *flash_ptr;
+ int ret, flash_size;
sector_bits = 12;
sector_size = 1 << sector_bits;
@@ -168,6 +170,17 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
if (unit == 0) {
flash_mem = pflash_cfi01_get_memory(system_flash);
pc_isa_bios_init(rom_memory, flash_mem, size);
+
+ /* Encrypt the pflash boot ROM */
+ if (kvm_memcrypt_enabled()) {
+ flash_ptr = memory_region_get_ram_ptr(flash_mem);
+ flash_size = memory_region_size(flash_mem);
+ ret = kvm_memcrypt_encrypt_data(flash_ptr, flash_size);
+ if (ret) {
+ error_report("failed to encrypt pflash rom");
+ exit(1);
+ }
+ }
}
}
}

View File

@ -1,168 +0,0 @@
From 0bc4fd78361c340ad4ee0c77bfde2d487fb580f5 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:23 -0600
Subject: [PATCH] sev/i386: add support to LAUNCH_MEASURE command
During machine creation we encrypted the guest bios image, the
LAUNCH_MEASURE command can be used to retrieve the measurement of
the encrypted memory region. This measurement is a signature of
the memory contents that can be sent to the guest owner as an
attestation that the memory was encrypted correctly by the firmware.
VM management tools like libvirt can query the measurement using
query-sev-launch-measure QMP command.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
include/sysemu/sev.h | 2 ++
stubs/sev.c | 5 ++++
target/i386/sev.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
target/i386/trace-events | 1 +
4 files changed, 76 insertions(+)
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h
index c16102b05e..ad4a1f1338 100644
--- a/include/sysemu/sev.h
+++ b/include/sysemu/sev.h
@@ -33,6 +33,7 @@ extern void sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build);
extern void sev_get_policy(uint32_t *policy);
extern uint32_t sev_get_cbit_position(void);
extern uint32_t sev_get_reduced_phys_bits(void);
+extern char *sev_get_launch_measurement(void);
typedef struct QSevGuestInfo QSevGuestInfo;
typedef struct QSevGuestInfoClass QSevGuestInfoClass;
@@ -64,6 +65,7 @@ struct QSevGuestInfoClass {
struct SEVState {
QSevGuestInfo *sev_info;
+ gchar *measurement;
};
typedef struct SEVState SEVState;
diff --git a/stubs/sev.c b/stubs/sev.c
index 74182bb545..5420ada7fd 100644
--- a/stubs/sev.c
+++ b/stubs/sev.c
@@ -57,3 +57,8 @@ void sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build)
void sev_get_policy(uint32_t *policy)
{
}
+
+char *sev_get_launch_measurement(void)
+{
+ return NULL;
+}
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 04a64b5bc6..401b2a33d7 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -19,6 +19,7 @@
#include "sysemu/sev.h"
#include "sysemu/sysemu.h"
#include "trace.h"
+#include "qapi-event.h"
#define DEFAULT_GUEST_POLICY 0x1 /* disable debug */
#define DEFAULT_SEV_DEVICE "/dev/sev"
@@ -28,6 +29,7 @@ static bool sev_active;
static int sev_fd;
static uint32_t x86_cbitpos;
static uint32_t x86_reduced_phys_bits;
+static SEVState *sev_state;
static SevState current_sev_guest_state = SEV_STATE_UNINIT;
@@ -502,6 +504,69 @@ err:
return ret;
}
+static void
+sev_launch_get_measure(Notifier *notifier, void *unused)
+{
+ int ret, error;
+ guchar *data;
+ SEVState *s = sev_state;
+ struct kvm_sev_launch_measure *measurement;
+
+ if (!sev_check_state(SEV_STATE_LUPDATE)) {
+ return;
+ }
+
+ measurement = g_malloc0(sizeof(*measurement));
+ if (!measurement) {
+ return;
+ }
+
+ /* query the measurement blob length */
+ ret = sev_ioctl(KVM_SEV_LAUNCH_MEASURE, measurement, &error);
+ if (!measurement->len) {
+ error_report("%s: LAUNCH_MEASURE ret=%d fw_error=%d '%s'",
+ __func__, ret, error, fw_error_to_str(errno));
+ goto free_measurement;
+ }
+
+ data = g_malloc(measurement->len);
+ if (s->measurement) {
+ goto free_data;
+ }
+
+ measurement->uaddr = (unsigned long)data;
+
+ /* get the measurement blob */
+ ret = sev_ioctl(KVM_SEV_LAUNCH_MEASURE, measurement, &error);
+ if (ret) {
+ error_report("%s: LAUNCH_MEASURE ret=%d fw_error=%d '%s'",
+ __func__, ret, error, fw_error_to_str(errno));
+ goto free_data;
+ }
+
+ sev_set_guest_state(SEV_STATE_LSECRET);
+
+ /* encode the measurement value and emit the event */
+ s->measurement = g_base64_encode(data, measurement->len);
+ trace_kvm_sev_launch_measurement(s->measurement);
+
+free_data:
+ g_free(data);
+free_measurement:
+ g_free(measurement);
+}
+
+char *
+sev_get_launch_measurement(void)
+{
+ return current_sev_guest_state >= SEV_STATE_LSECRET ?
+ g_strdup(sev_state->measurement) : NULL;
+}
+
+static Notifier sev_machine_done_notify = {
+ .notify = sev_launch_get_measure,
+};
+
void *
sev_guest_init(const char *id)
{
@@ -569,6 +634,9 @@ sev_guest_init(const char *id)
x86_cbitpos = cbitpos;
sev_active = true;
ram_block_notifier_add(&sev_ram_notifier);
+ qemu_add_machine_init_done_notifier(&sev_machine_done_notify);
+
+ sev_state = s;
return s;
err:
diff --git a/target/i386/trace-events b/target/i386/trace-events
index c0cd8e9321..f7a1a1e6b8 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -13,3 +13,4 @@ kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%lu"
kvm_sev_change_state(const char *old, const char *new) "%s -> %s"
kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p"
kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64
+kvm_sev_launch_measurement(const char *value) "data %s"

View File

@ -1,75 +0,0 @@
From 15ba1a246b2e68d9dbb6d8db3e065f26b33062cc Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:23 -0600
Subject: [PATCH] sev/i386: finalize the SEV guest launch flow
SEV launch flow requires us to issue LAUNCH_FINISH command before guest
is ready to run.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/sev.c | 29 +++++++++++++++++++++++++++++
target/i386/trace-events | 1 +
2 files changed, 30 insertions(+)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 401b2a33d7..305ef65191 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -567,6 +567,34 @@ static Notifier sev_machine_done_notify = {
.notify = sev_launch_get_measure,
};
+static void
+sev_launch_finish(SEVState *s)
+{
+ int ret, error;
+
+ trace_kvm_sev_launch_finish();
+ ret = sev_ioctl(KVM_SEV_LAUNCH_FINISH, 0, &error);
+ if (ret) {
+ error_report("%s: LAUNCH_FINISH ret=%d fw_error=%d '%s'",
+ __func__, ret, error, fw_error_to_str(error));
+ exit(1);
+ }
+
+ sev_set_guest_state(SEV_STATE_RUNNING);
+}
+
+static void
+sev_vm_state_change(void *opaque, int running, RunState state)
+{
+ SEVState *s = opaque;
+
+ if (running) {
+ if (!sev_check_state(SEV_STATE_RUNNING)) {
+ sev_launch_finish(s);
+ }
+ }
+}
+
void *
sev_guest_init(const char *id)
{
@@ -635,6 +663,7 @@ sev_guest_init(const char *id)
sev_active = true;
ram_block_notifier_add(&sev_ram_notifier);
qemu_add_machine_init_done_notifier(&sev_machine_done_notify);
+ qemu_add_vm_change_state_handler(sev_vm_state_change, s);
sev_state = s;
diff --git a/target/i386/trace-events b/target/i386/trace-events
index f7a1a1e6b8..b1fbde6e40 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -14,3 +14,4 @@ kvm_sev_change_state(const char *old, const char *new) "%s -> %s"
kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p"
kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64
kvm_sev_launch_measurement(const char *value) "data %s"
+kvm_sev_launch_finish(void) ""

View File

@ -1,58 +0,0 @@
From 6d17c0a5da11a757f26db7763823fcb53a79d445 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:23 -0600
Subject: [PATCH] hw/i386: set ram_debug_ops when memory encryption is enabled
When memory encryption is enabled, the guest RAM and boot flash ROM will
contain the encrypted data. By setting the debug ops allow us to invoke
encryption APIs when accessing the memory for the debug purposes.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/i386/pc.c | 9 +++++++++
hw/i386/pc_sysfw.c | 6 ++++++
2 files changed, 15 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e7faf92143..c9c91e150b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1355,6 +1355,15 @@ void pc_memory_init(PCMachineState *pcms,
e820_add_entry(0x100000000ULL, pcms->above_4g_mem_size, E820_RAM);
}
+ /*
+ * When memory encryption is enabled, the guest RAM will be encrypted with
+ * a guest unique key. Set the debug ops so that any debug access to the
+ * guest RAM will go through the memory encryption APIs.
+ */
+ if (kvm_memcrypt_enabled()) {
+ kvm_memcrypt_set_debug_ops(ram);
+ }
+
if (!pcmc->has_reserved_memory &&
(machine->ram_slots ||
(machine->maxram_size > machine->ram_size))) {
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 8ddbbf74d3..3d149b1c9f 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -180,6 +180,12 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
error_report("failed to encrypt pflash rom");
exit(1);
}
+
+ /*
+ * The pflash ROM is encrypted, set the debug ops so that any
+ * debug accesses will use memory encryption APIs.
+ */
+ kvm_memcrypt_set_debug_ops(flash_mem);
}
}
}

View File

@ -1,174 +0,0 @@
From 42f8013adf0a5f8ca17212ee54a8009471d6c8f3 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:23 -0600
Subject: [PATCH] sev/i386: add debug encrypt and decrypt commands
KVM_SEV_DBG_DECRYPT and KVM_SEV_DBG_ENCRYPT commands are used for
decrypting and encrypting guest memory region. The command works only if
the guest policy allows the debugging.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
accel/kvm/kvm-all.c | 1 +
include/sysemu/sev.h | 1 +
stubs/sev.c | 4 +++
target/i386/sev.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++
target/i386/trace-events | 1 +
5 files changed, 79 insertions(+)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 37f7c442dc..7d3b7b4107 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1677,6 +1677,7 @@ static int kvm_init(MachineState *ms)
}
kvm_state->memcrypt_encrypt_data = sev_encrypt_data;
+ kvm_state->memcrypt_debug_ops = sev_set_debug_ops;
}
ret = kvm_arch_init(ms, s);
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h
index ad4a1f1338..ac70c7a00b 100644
--- a/include/sysemu/sev.h
+++ b/include/sysemu/sev.h
@@ -72,5 +72,6 @@ typedef struct SEVState SEVState;
void *sev_guest_init(const char *id);
int sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len);
+void sev_set_debug_ops(void *handle, MemoryRegion *mr);
#endif
diff --git a/stubs/sev.c b/stubs/sev.c
index 5420ada7fd..8ea167031e 100644
--- a/stubs/sev.c
+++ b/stubs/sev.c
@@ -15,6 +15,10 @@
#include "qemu-common.h"
#include "sysemu/sev.h"
+void sev_set_debug_ops(void *handle, MemoryRegion *mr)
+{
+}
+
int sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len)
{
return 1;
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 305ef65191..1fbc3beb16 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -23,6 +23,7 @@
#define DEFAULT_GUEST_POLICY 0x1 /* disable debug */
#define DEFAULT_SEV_DEVICE "/dev/sev"
+#define GUEST_POLICY_DBG_BIT 0x1
static uint64_t me_mask;
static bool sev_active;
@@ -30,6 +31,7 @@ static int sev_fd;
static uint32_t x86_cbitpos;
static uint32_t x86_reduced_phys_bits;
static SEVState *sev_state;
+static MemoryRegionRAMReadWriteOps sev_ops;
static SevState current_sev_guest_state = SEV_STATE_UNINIT;
@@ -595,6 +597,51 @@ sev_vm_state_change(void *opaque, int running, RunState state)
}
}
+static int
+sev_dbg_enc_dec(uint8_t *dst, const uint8_t *src, uint32_t len, bool write)
+{
+ int ret, error;
+ struct kvm_sev_dbg *dbg;
+
+ dbg = g_malloc0(sizeof(*dbg));
+ if (!dbg) {
+ return 1;
+ }
+
+ dbg->src_uaddr = (unsigned long)src;
+ dbg->dst_uaddr = (unsigned long)dst;
+ dbg->len = len;
+
+ trace_kvm_sev_debug(write ? "encrypt" : "decrypt", src, dst, len);
+ ret = sev_ioctl(write ? KVM_SEV_DBG_ENCRYPT : KVM_SEV_DBG_DECRYPT,
+ dbg, &error);
+ if (ret) {
+ error_report("%s (%s) %#llx->%#llx+%#x ret=%d fw_error=%d '%s'",
+ __func__, write ? "write" : "read", dbg->src_uaddr,
+ dbg->dst_uaddr, dbg->len, ret, error,
+ fw_error_to_str(error));
+ }
+
+ g_free(dbg);
+ return ret;
+}
+
+static int
+sev_mem_read(uint8_t *dst, const uint8_t *src, uint32_t len, MemTxAttrs attrs)
+{
+ assert(attrs.debug);
+
+ return sev_dbg_enc_dec(dst, src, len, false);
+}
+
+static int
+sev_mem_write(uint8_t *dst, const uint8_t *src, uint32_t len, MemTxAttrs attrs)
+{
+ assert(attrs.debug);
+
+ return sev_dbg_enc_dec(dst, src, len, true);
+}
+
void *
sev_guest_init(const char *id)
{
@@ -686,6 +733,31 @@ sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len)
return 0;
}
+void
+sev_set_debug_ops(void *handle, MemoryRegion *mr)
+{
+ int policy;
+ SEVState *s = (SEVState *)handle;
+
+ policy = object_property_get_int(OBJECT(s->sev_info),
+ "policy", &error_abort);
+
+ /*
+ * Check if guest policy supports debugging
+ * Bit 0 :
+ * 0 - debug allowed
+ * 1 - debug is not allowed
+ */
+ if (policy & GUEST_POLICY_DBG_BIT) {
+ return;
+ }
+
+ sev_ops.read = sev_mem_read;
+ sev_ops.write = sev_mem_write;
+
+ memory_region_set_ram_debug_ops(mr, &sev_ops);
+}
+
static void
sev_register_types(void)
{
diff --git a/target/i386/trace-events b/target/i386/trace-events
index b1fbde6e40..00aa6e98d8 100644
--- a/target/i386/trace-events
+++ b/target/i386/trace-events
@@ -15,3 +15,4 @@ kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session
kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64
kvm_sev_launch_measurement(const char *value) "data %s"
kvm_sev_launch_finish(void) ""
+kvm_sev_debug(const char *op, const uint8_t *src, uint8_t *dst, int len) "(%s) src %p dst %p len %d"

View File

@ -1,361 +0,0 @@
From a8962df0b33d17e6af91ec6c3d0f2bf0e866c84e Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:23 -0600
Subject: [PATCH] target/i386: clear C-bit when walking SEV guest page table
In SEV-enabled guest the pte entry will have C-bit set, we need to
clear the C-bit when walking the page table.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/helper.c | 31 +++++++++++++----------
target/i386/monitor.c | 69 +++++++++++++++++++++++++++++++++------------------
2 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/target/i386/helper.c b/target/i386/helper.c
index 5dc9e8839b..999154e21e 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -21,6 +21,7 @@
#include "cpu.h"
#include "exec/exec-all.h"
#include "sysemu/kvm.h"
+#include "sysemu/sev.h"
#include "kvm_i386.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/sysemu.h"
@@ -732,6 +733,9 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
int32_t a20_mask;
uint32_t page_offset;
int page_size;
+ uint64_t me_mask;
+
+ me_mask = sev_get_me_mask();
a20_mask = x86_get_a20_mask(env);
if (!(env->cr[0] & CR0_PG_MASK)) {
@@ -755,25 +759,25 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
}
if (la57) {
- pml5e_addr = ((env->cr[3] & ~0xfff) +
+ pml5e_addr = ((env->cr[3] & ~0xfff & me_mask) +
(((addr >> 48) & 0x1ff) << 3)) & a20_mask;
- pml5e = ldq_phys_debug(cs, pml5e_addr);
+ pml5e = ldq_phys_debug(cs, pml5e_addr) & me_mask;
if (!(pml5e & PG_PRESENT_MASK)) {
return -1;
}
} else {
- pml5e = env->cr[3];
+ pml5e = env->cr[3] & me_mask;
}
pml4e_addr = ((pml5e & PG_ADDRESS_MASK) +
(((addr >> 39) & 0x1ff) << 3)) & a20_mask;
- pml4e = ldq_phys_debug(cs, pml4e_addr);
+ pml4e = ldq_phys_debug(cs, pml4e_addr) & me_mask;
if (!(pml4e & PG_PRESENT_MASK)) {
return -1;
}
pdpe_addr = ((pml4e & PG_ADDRESS_MASK) +
(((addr >> 30) & 0x1ff) << 3)) & a20_mask;
- pdpe = x86_ldq_phys(cs, pdpe_addr);
+ pdpe = ldq_phys_debug(cs, pdpe_addr) & me_mask;
if (!(pdpe & PG_PRESENT_MASK)) {
return -1;
}
@@ -786,16 +790,16 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
} else
#endif
{
- pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) &
- a20_mask;
- pdpe = ldq_phys_debug(cs, pdpe_addr);
+ pdpe_addr = ((env->cr[3] & ~0x1f & me_mask) + ((addr >> 27) & 0x18))
+ & a20_mask;
+ pdpe = ldq_phys_debug(cs, pdpe_addr) & me_mask;
if (!(pdpe & PG_PRESENT_MASK))
return -1;
}
pde_addr = ((pdpe & PG_ADDRESS_MASK) +
(((addr >> 21) & 0x1ff) << 3)) & a20_mask;
- pde = ldq_phys_debug(cs, pde_addr);
+ pde = ldq_phys_debug(cs, pde_addr) & me_mask;
if (!(pde & PG_PRESENT_MASK)) {
return -1;
}
@@ -808,7 +812,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
pte_addr = ((pde & PG_ADDRESS_MASK) +
(((addr >> 12) & 0x1ff) << 3)) & a20_mask;
page_size = 4096;
- pte = ldq_phys_debug(cs, pte_addr);
+ pte = ldq_phys_debug(cs, pte_addr) & me_mask;
}
if (!(pte & PG_PRESENT_MASK)) {
return -1;
@@ -817,8 +821,9 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
uint32_t pde;
/* page directory entry */
- pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & a20_mask;
- pde = ldl_phys_debug(cs, pde_addr);
+ pde_addr = ((env->cr[3] & ~0xfff & me_mask) + ((addr >> 20) & 0xffc))
+ & a20_mask;
+ pde = ldl_phys_debug(cs, pde_addr) & me_mask;
if (!(pde & PG_PRESENT_MASK))
return -1;
if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
@@ -827,7 +832,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
} else {
/* page directory entry */
pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & a20_mask;
- pte = ldl_phys_debug(cs, pte_addr);
+ pte = ldl_phys_debug(cs, pte_addr) & me_mask;
if (!(pte & PG_PRESENT_MASK)) {
return -1;
}
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 63f7125ba8..44ae31d13b 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -27,6 +27,7 @@
#include "monitor/hmp-target.h"
#include "hw/i386/pc.h"
#include "sysemu/kvm.h"
+#include "sysemu/sev.h"
#include "hmp.h"
@@ -93,16 +94,20 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *env)
unsigned int l1, l2, l3;
uint64_t pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
+ uint64_t me_mask;
+
+ me_mask = sev_get_me_mask();
pdp_addr = env->cr[3] & ~0x1f;
+ pdp_addr &= me_mask;
for (l1 = 0; l1 < 4; l1++) {
cpu_physical_memory_read_debug(pdp_addr + l1 * 8, &pdpe, 8);
- pdpe = le64_to_cpu(pdpe);
+ pdpe = le64_to_cpu(pdpe & me_mask);
if (pdpe & PG_PRESENT_MASK) {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read_debug(pd_addr + l2 * 8, &pde, 8);
- pde = le64_to_cpu(pde);
+ pde = le64_to_cpu(pde & me_mask);
if (pde & PG_PRESENT_MASK) {
if (pde & PG_PSE_MASK) {
/* 2M pages with PAE, CR4.PSE is ignored */
@@ -113,7 +118,7 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *env)
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read_debug(pt_addr + l3 * 8,
&pte, 8);
- pte = le64_to_cpu(pte);
+ pte = le64_to_cpu(pte & me_mask);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, env, (l1 << 30) + (l2 << 21)
+ (l3 << 12),
@@ -135,10 +140,13 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
uint64_t l1, l2, l3, l4;
uint64_t pml4e, pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
+ uint64_t me_mask;
+
+ me_mask = sev_get_me_mask();
for (l1 = 0; l1 < 512; l1++) {
cpu_physical_memory_read_debug(pml4_addr + l1 * 8, &pml4e, 8);
- pml4e = le64_to_cpu(pml4e);
+ pml4e = le64_to_cpu(pml4e & me_mask);
if (!(pml4e & PG_PRESENT_MASK)) {
continue;
}
@@ -146,7 +154,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
pdp_addr = pml4e & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read_debug(pdp_addr + l2 * 8, &pdpe, 8);
- pdpe = le64_to_cpu(pdpe);
+ pdpe = le64_to_cpu(pdpe & me_mask);
if (!(pdpe & PG_PRESENT_MASK)) {
continue;
}
@@ -161,7 +169,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read_debug(pd_addr + l3 * 8, &pde, 8);
- pde = le64_to_cpu(pde);
+ pde = le64_to_cpu(pde & me_mask);
if (!(pde & PG_PRESENT_MASK)) {
continue;
}
@@ -176,7 +184,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *env,
pt_addr = pde & 0x3fffffffff000ULL;
for (l4 = 0; l4 < 512; l4++) {
cpu_physical_memory_read_debug(pt_addr + l4 * 8, &pte, 8);
- pte = le64_to_cpu(pte);
+ pte = le64_to_cpu(pte & me_mask);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, env, (l0 << 48) + (l1 << 39) +
(l2 << 30) + (l3 << 21) + (l4 << 12),
@@ -193,11 +201,14 @@ static void tlb_info_la57(Monitor *mon, CPUArchState *env)
uint64_t l0;
uint64_t pml5e;
uint64_t pml5_addr;
+ uint64_t me_mask;
- pml5_addr = env->cr[3] & 0x3fffffffff000ULL;
+ me_mask = sev_get_me_mask();
+
+ pml5_addr = env->cr[3] & 0x3fffffffff000ULL & me_mask;
for (l0 = 0; l0 < 512; l0++) {
cpu_physical_memory_read_debug(pml5_addr + l0 * 8, &pml5e, 8);
- pml5e = le64_to_cpu(pml5e);
+ pml5e = le64_to_cpu(pml5e & me_mask);
if (pml5e & PG_PRESENT_MASK) {
tlb_info_la48(mon, env, l0, pml5e & 0x3fffffffff000ULL);
}
@@ -225,7 +236,8 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
if (env->cr[4] & CR4_LA57_MASK) {
tlb_info_la57(mon, env);
} else {
- tlb_info_la48(mon, env, 0, env->cr[3] & 0x3fffffffff000ULL);
+ tlb_info_la48(mon, env, 0, env->cr[3] & 0x3fffffffff000ULL &
+ sev_get_me_mask());
}
} else
#endif
@@ -309,19 +321,22 @@ static void mem_info_pae32(Monitor *mon, CPUArchState *env)
uint64_t pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
hwaddr start, end;
+ uint64_t me_mask;
- pdp_addr = env->cr[3] & ~0x1f;
+ me_mask = sev_get_me_mask();
+
+ pdp_addr = env->cr[3] & ~0x1f & me_mask;
last_prot = 0;
start = -1;
for (l1 = 0; l1 < 4; l1++) {
cpu_physical_memory_read_debug(pdp_addr + l1 * 8, &pdpe, 8);
- pdpe = le64_to_cpu(pdpe);
+ pdpe = le64_to_cpu(pdpe & me_mask);
end = l1 << 30;
if (pdpe & PG_PRESENT_MASK) {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read_debug(pd_addr + l2 * 8, &pde, 8);
- pde = le64_to_cpu(pde);
+ pde = le64_to_cpu(pde & me_mask);
end = (l1 << 30) + (l2 << 21);
if (pde & PG_PRESENT_MASK) {
if (pde & PG_PSE_MASK) {
@@ -333,7 +348,7 @@ static void mem_info_pae32(Monitor *mon, CPUArchState *env)
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read_debug(pt_addr + l3 * 8,
&pte, 8);
- pte = le64_to_cpu(pte);
+ pte = le64_to_cpu(pte & me_mask);
end = (l1 << 30) + (l2 << 21) + (l3 << 12);
if (pte & PG_PRESENT_MASK) {
prot = pte & pde & (PG_USER_MASK | PG_RW_MASK |
@@ -366,19 +381,22 @@ static void mem_info_la48(Monitor *mon, CPUArchState *env)
uint64_t l1, l2, l3, l4;
uint64_t pml4e, pdpe, pde, pte;
uint64_t pml4_addr, pdp_addr, pd_addr, pt_addr, start, end;
+ uint64_t me_mask;
+
+ me_mask = sev_get_me_mask();
- pml4_addr = env->cr[3] & 0x3fffffffff000ULL;
+ pml4_addr = env->cr[3] & 0x3fffffffff000ULL & me_mask;
last_prot = 0;
start = -1;
for (l1 = 0; l1 < 512; l1++) {
cpu_physical_memory_read_debug(pml4_addr + l1 * 8, &pml4e, 8);
- pml4e = le64_to_cpu(pml4e);
+ pml4e = le64_to_cpu(pml4e & me_mask);
end = l1 << 39;
if (pml4e & PG_PRESENT_MASK) {
pdp_addr = pml4e & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read_debug(pdp_addr + l2 * 8, &pdpe, 8);
- pdpe = le64_to_cpu(pdpe);
+ pdpe = le64_to_cpu(pdpe & me_mask);
end = (l1 << 39) + (l2 << 30);
if (pdpe & PG_PRESENT_MASK) {
if (pdpe & PG_PSE_MASK) {
@@ -391,7 +409,7 @@ static void mem_info_la48(Monitor *mon, CPUArchState *env)
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read_debug(pd_addr + l3 * 8,
&pde, 8);
- pde = le64_to_cpu(pde);
+ pde = le64_to_cpu(pde & me_mask);
end = (l1 << 39) + (l2 << 30) + (l3 << 21);
if (pde & PG_PRESENT_MASK) {
if (pde & PG_PSE_MASK) {
@@ -405,7 +423,7 @@ static void mem_info_la48(Monitor *mon, CPUArchState *env)
cpu_physical_memory_read_debug(pt_addr
+ l4 * 8,
&pte, 8);
- pte = le64_to_cpu(pte);
+ pte = le64_to_cpu(pte & me_mask);
end = (l1 << 39) + (l2 << 30) +
(l3 << 21) + (l4 << 12);
if (pte & PG_PRESENT_MASK) {
@@ -444,13 +462,16 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
uint64_t l0, l1, l2, l3, l4;
uint64_t pml5e, pml4e, pdpe, pde, pte;
uint64_t pml5_addr, pml4_addr, pdp_addr, pd_addr, pt_addr, start, end;
+ uint64_t me_mask;
+
+ me_mask = sev_get_me_mask();
- pml5_addr = env->cr[3] & 0x3fffffffff000ULL;
+ pml5_addr = env->cr[3] & 0x3fffffffff000ULL & me_mask;
last_prot = 0;
start = -1;
for (l0 = 0; l0 < 512; l0++) {
cpu_physical_memory_read_debug(pml5_addr + l0 * 8, &pml5e, 8);
- pml5e = le64_to_cpu(pml5e);
+ pml5e = le64_to_cpu(pml5e & me_mask);
end = l0 << 48;
if (!(pml5e & PG_PRESENT_MASK)) {
prot = 0;
@@ -461,7 +482,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pml4_addr = pml5e & 0x3fffffffff000ULL;
for (l1 = 0; l1 < 512; l1++) {
cpu_physical_memory_read_debug(pml4_addr + l1 * 8, &pml4e, 8);
- pml4e = le64_to_cpu(pml4e);
+ pml4e = le64_to_cpu(pml4e & me_mask);
end = (l0 << 48) + (l1 << 39);
if (!(pml4e & PG_PRESENT_MASK)) {
prot = 0;
@@ -472,7 +493,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pdp_addr = pml4e & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read_debug(pdp_addr + l2 * 8, &pdpe, 8);
- pdpe = le64_to_cpu(pdpe);
+ pdpe = le64_to_cpu(pdpe & me_mask);
end = (l0 << 48) + (l1 << 39) + (l2 << 30);
if (pdpe & PG_PRESENT_MASK) {
prot = 0;
@@ -491,7 +512,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read_debug(pd_addr + l3 * 8, &pde, 8);
- pde = le64_to_cpu(pde);
+ pde = le64_to_cpu(pde & me_mask);
end = (l0 << 48) + (l1 << 39) + (l2 << 30) + (l3 << 21);
if (pde & PG_PRESENT_MASK) {
prot = 0;

View File

@ -1,167 +0,0 @@
From 8ff5e32ef7eb6d2a9a34dbdf78003a6e1cb9fa42 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:23 -0600
Subject: [PATCH] include: add psp-sev.h header file
The header file provide the ioctl command and structure to communicate
with /dev/sev device.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
linux-headers/linux/psp-sev.h | 142 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 142 insertions(+)
create mode 100644 linux-headers/linux/psp-sev.h
diff --git a/linux-headers/linux/psp-sev.h b/linux-headers/linux/psp-sev.h
new file mode 100644
index 0000000000..33e247471a
--- /dev/null
+++ b/linux-headers/linux/psp-sev.h
@@ -0,0 +1,142 @@
+/*
+ * Userspace interface for AMD Secure Encrypted Virtualization (SEV)
+ * platform management commands.
+ *
+ * Copyright (C) 2016-2017 Advanced Micro Devices, Inc.
+ *
+ * Author: Brijesh Singh <brijesh.singh@amd.com>
+ *
+ * SEV spec 0.14 is available at:
+ * http://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __PSP_SEV_USER_H__
+#define __PSP_SEV_USER_H__
+
+#include <linux/types.h>
+
+/**
+ * SEV platform commands
+ */
+enum {
+ SEV_FACTORY_RESET = 0,
+ SEV_PLATFORM_STATUS,
+ SEV_PEK_GEN,
+ SEV_PEK_CSR,
+ SEV_PDH_GEN,
+ SEV_PDH_CERT_EXPORT,
+ SEV_PEK_CERT_IMPORT,
+
+ SEV_MAX,
+};
+
+/**
+ * SEV Firmware status code
+ */
+typedef enum {
+ SEV_RET_SUCCESS = 0,
+ SEV_RET_INVALID_PLATFORM_STATE,
+ SEV_RET_INVALID_GUEST_STATE,
+ SEV_RET_INAVLID_CONFIG,
+ SEV_RET_INVALID_LEN,
+ SEV_RET_ALREADY_OWNED,
+ SEV_RET_INVALID_CERTIFICATE,
+ SEV_RET_POLICY_FAILURE,
+ SEV_RET_INACTIVE,
+ SEV_RET_INVALID_ADDRESS,
+ SEV_RET_BAD_SIGNATURE,
+ SEV_RET_BAD_MEASUREMENT,
+ SEV_RET_ASID_OWNED,
+ SEV_RET_INVALID_ASID,
+ SEV_RET_WBINVD_REQUIRED,
+ SEV_RET_DFFLUSH_REQUIRED,
+ SEV_RET_INVALID_GUEST,
+ SEV_RET_INVALID_COMMAND,
+ SEV_RET_ACTIVE,
+ SEV_RET_HWSEV_RET_PLATFORM,
+ SEV_RET_HWSEV_RET_UNSAFE,
+ SEV_RET_UNSUPPORTED,
+ SEV_RET_MAX,
+} sev_ret_code;
+
+/**
+ * struct sev_user_data_status - PLATFORM_STATUS command parameters
+ *
+ * @major: major API version
+ * @minor: minor API version
+ * @state: platform state
+ * @flags: platform config flags
+ * @build: firmware build id for API version
+ * @guest_count: number of active guests
+ */
+struct sev_user_data_status {
+ __u8 api_major; /* Out */
+ __u8 api_minor; /* Out */
+ __u8 state; /* Out */
+ __u32 flags; /* Out */
+ __u8 build; /* Out */
+ __u32 guest_count; /* Out */
+} __attribute__((packed));
+
+/**
+ * struct sev_user_data_pek_csr - PEK_CSR command parameters
+ *
+ * @address: PEK certificate chain
+ * @length: length of certificate
+ */
+struct sev_user_data_pek_csr {
+ __u64 address; /* In */
+ __u32 length; /* In/Out */
+} __attribute__((packed));
+
+/**
+ * struct sev_user_data_cert_import - PEK_CERT_IMPORT command parameters
+ *
+ * @pek_address: PEK certificate chain
+ * @pek_len: length of PEK certificate
+ * @oca_address: OCA certificate chain
+ * @oca_len: length of OCA certificate
+ */
+struct sev_user_data_pek_cert_import {
+ __u64 pek_cert_address; /* In */
+ __u32 pek_cert_len; /* In */
+ __u64 oca_cert_address; /* In */
+ __u32 oca_cert_len; /* In */
+} __attribute__((packed));
+
+/**
+ * struct sev_user_data_pdh_cert_export - PDH_CERT_EXPORT command parameters
+ *
+ * @pdh_address: PDH certificate address
+ * @pdh_len: length of PDH certificate
+ * @cert_chain_address: PDH certificate chain
+ * @cert_chain_len: length of PDH certificate chain
+ */
+struct sev_user_data_pdh_cert_export {
+ __u64 pdh_cert_address; /* In */
+ __u32 pdh_cert_len; /* In/Out */
+ __u64 cert_chain_address; /* In */
+ __u32 cert_chain_len; /* In/Out */
+} __attribute__((packed));
+
+/**
+ * struct sev_issue_cmd - SEV ioctl parameters
+ *
+ * @cmd: SEV commands to execute
+ * @opaque: pointer to the command structure
+ * @error: SEV FW return code on failure
+ */
+struct sev_issue_cmd {
+ __u32 cmd; /* In */
+ __u64 data; /* In */
+ __u32 error; /* Out */
+} __attribute__((packed));
+
+#define SEV_IOC_TYPE 'S'
+#define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd)
+
+#endif /* __PSP_USER_SEV_H */

View File

@ -1,75 +0,0 @@
From fea1c51414bedfc61e5ee31b15e58d638acee4fe Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:24 -0600
Subject: [PATCH] sev/i386: add support to query PLATFORM_STATUS command
The command is used to query the SEV API version and build id.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/sev.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 1fbc3beb16..e3236f5bb7 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -21,6 +21,9 @@
#include "trace.h"
#include "qapi-event.h"
+#include <sys/ioctl.h>
+#include <linux/psp-sev.h>
+
#define DEFAULT_GUEST_POLICY 0x1 /* disable debug */
#define DEFAULT_SEV_DEVICE "/dev/sev"
#define GUEST_POLICY_DBG_BIT 0x1
@@ -84,6 +87,22 @@ sev_ioctl(int cmd, void *data, int *error)
return r;
}
+static int
+sev_platform_ioctl(int cmd, void *data, int *error)
+{
+ int r;
+ struct sev_issue_cmd arg;
+
+ arg.cmd = cmd;
+ arg.data = (unsigned long)data;
+ r = ioctl(sev_fd, SEV_ISSUE_CMD, &arg);
+ if (error) {
+ *error = arg.error;
+ }
+
+ return r;
+}
+
static const char *
fw_error_to_str(int code)
{
@@ -399,6 +418,20 @@ sev_enabled(void)
void
sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build)
{
+ struct sev_user_data_status status = {};
+ int r, err;
+
+ r = sev_platform_ioctl(SEV_PLATFORM_STATUS, &status, &err);
+ if (r) {
+ error_report("%s: failed to get platform status ret=%d"
+ "fw_error='%d: %s'", __func__, r, err,
+ fw_error_to_str(err));
+ return;
+ }
+
+ *major = status.api_major;
+ *minor = status.api_minor;
+ *build = status.build;
}
void

View File

@ -1,45 +0,0 @@
From b4998b726af3a1da2dc346cac8796ca8fd6b88cd Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:24 -0600
Subject: [PATCH] sev/i386: add support to KVM_SEV_GUEST_STATUS
The command is used to query the current SEV guest status. We use this
command to query the guest policy for QMP query-sev command.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/sev.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index e3236f5bb7..559881084d 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -437,6 +437,22 @@ sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build)
void
sev_get_policy(uint32_t *policy)
{
+ struct kvm_sev_guest_status status = {};
+ int r, err;
+
+ if (current_sev_guest_state == SEV_STATE_UNINIT) {
+ return;
+ }
+
+ r = sev_ioctl(KVM_SEV_GUEST_STATUS, &status, &err);
+ if (r) {
+ error_report("%s: failed to get platform status ret=%d "
+ "fw_error='%d: %s'", __func__, r, err,
+ fw_error_to_str(err));
+ return;
+ }
+
+ *policy = status.policy;
}
static int

View File

@ -1,85 +0,0 @@
From 53ad8885ec786df6820288255a312e802839ecc4 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:24 -0600
Subject: [PATCH] qmp: add query-sev-launch-measure command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The command can be used by libvirt to retrieve the measurement of SEV guest.
This measurement is a signature of the memory contents that was encrypted
through the LAUNCH_UPDATE_DATA.
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
qapi-schema.json | 29 +++++++++++++++++++++++++++++
qmp.c | 17 +++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/qapi-schema.json b/qapi-schema.json
index 91a8a74f81..215681fbd7 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3257,3 +3257,32 @@
#
##
{ 'command': 'query-sev', 'returns': 'SevInfo' }
+
+##
+# @SevLaunchMeasureInfo:
+#
+# SEV Guest Launch measurement information
+#
+# @data: the measurement value encoded in base64
+#
+# Since: 2.12
+#
+##
+{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} }
+
+##
+# @query-sev-launch-measure:
+#
+# Query the SEV guest launch information.
+#
+# Returns: The @SevLaunchMeasureInfo for the guest
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev-launch-measure" }
+# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
+#
+##
+{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' }
diff --git a/qmp.c b/qmp.c
index 3c2d573384..445c668428 100644
--- a/qmp.c
+++ b/qmp.c
@@ -738,3 +738,20 @@ SevInfo *qmp_query_sev(Error **errp)
return info;
}
+
+SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
+{
+ char *data;
+ SevLaunchMeasureInfo *info;
+
+ data = sev_get_launch_measurement();
+ if (!data) {
+ error_setg(errp, "Measurement is not available");
+ return NULL;
+ }
+
+ info = g_malloc0(sizeof(*info));
+ info->data = data;
+
+ return info;
+}

View File

@ -1,36 +0,0 @@
From 00751496fa11ed34f0849cb969d794ac1a0b1391 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:24 -0600
Subject: [PATCH] tests/qmp-test: blacklist query-sev-launch-measure command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The query-sev-launch-measure command returns a measurement of encrypted
memory when SEV is enabled otherwise it returns an error. Blacklist the
command in qmp-test to fix the 'make check' failure.
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Reviewed-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
tests/qmp-test.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index c5a5c10b41..06fe0b6f7a 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -200,6 +200,8 @@ static bool query_is_blacklisted(const char *cmd)
"query-gic-capabilities", /* arm */
/* Success depends on target-specific build configuration: */
"query-pci", /* CONFIG_PCI */
+ /* Success depends on launching SEV guest */
+ "query-sev-launch-measure",
NULL
};
int i;

View File

@ -1,60 +0,0 @@
From 2957d1d9d2494b2a8582f778e342fb7430fc1406 Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:24 -0600
Subject: [PATCH] sev/i386: add migration blocker
SEV guest migration is not implemented yet.
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/sev.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 559881084d..a4f5a87e9b 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -20,6 +20,7 @@
#include "sysemu/sysemu.h"
#include "trace.h"
#include "qapi-event.h"
+#include "migration/blocker.h"
#include <sys/ioctl.h>
#include <linux/psp-sev.h>
@@ -35,6 +36,7 @@ static uint32_t x86_cbitpos;
static uint32_t x86_reduced_phys_bits;
static SEVState *sev_state;
static MemoryRegionRAMReadWriteOps sev_ops;
+static Error *sev_mig_blocker;
static SevState current_sev_guest_state = SEV_STATE_UNINIT;
@@ -622,6 +624,7 @@ static void
sev_launch_finish(SEVState *s)
{
int ret, error;
+ Error *local_err = NULL;
trace_kvm_sev_launch_finish();
ret = sev_ioctl(KVM_SEV_LAUNCH_FINISH, 0, &error);
@@ -632,6 +635,16 @@ sev_launch_finish(SEVState *s)
}
sev_set_guest_state(SEV_STATE_RUNNING);
+
+ /* add migration blocker */
+ error_setg(&sev_mig_blocker,
+ "SEV: Migration is not implemented");
+ ret = migrate_add_blocker(sev_mig_blocker, &local_err);
+ if (local_err) {
+ error_report_err(local_err);
+ error_free(sev_mig_blocker);
+ exit(1);
+ }
}
static void

View File

@ -1,60 +0,0 @@
From 28839121aa98b7e126a7770200041203acd077bb Mon Sep 17 00:00:00 2001
From: Brijesh Singh <brijesh.singh@amd.com>
Date: Thu, 15 Feb 2018 09:03:25 -0600
Subject: [PATCH] cpu/i386: populate CPUID 0x8000_001F when SEV is active
When SEV is enabled, CPUID 0x8000_001F should provide additional
information regarding the feature (such as which page table bit is used
to mark the pages as encrypted etc).
The details for memory encryption CPUID is available in AMD APM
(https://support.amd.com/TechDocs/24594.pdf) Section E.4.17
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[BR: FATE#322124]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
target/i386/cpu.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 70c8ae82d5..a7e27f3bbf 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -23,6 +23,7 @@
#include "exec/exec-all.h"
#include "sysemu/kvm.h"
#include "sysemu/cpus.h"
+#include "sysemu/sev.h"
#include "kvm_i386.h"
#include "qemu/error-report.h"
@@ -3578,6 +3579,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*ecx = 0;
*edx = 0;
break;
+ case 0x8000001F:
+ *eax = sev_enabled() ? 0x2 : 0;
+ *ebx = sev_get_cbit_position();
+ *ebx |= sev_get_reduced_phys_bits() << 6;
+ *ecx = 0;
+ *edx = 0;
+ break;
default:
/* reserved values: zero */
*eax = 0;
@@ -4000,6 +4008,11 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM) {
x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000000A);
}
+
+ /* SEV requires CPUID[0x8000001F] */
+ if (sev_enabled()) {
+ x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F);
+ }
}
/* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set */

View File

@ -1,215 +0,0 @@
From 3eb1915349b247cd88fd050c0caf37070b5e6977 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Sat, 28 Oct 2017 21:51:36 +0100
Subject: [PATCH] smbios: support setting OEM strings table
The cloud-init program currently allows fetching of its data by repurposing of
the 'system' type 'serial' field. This is a clear abuse of the serial field that
would clash with other valid usage a virt management app might have for that
field.
Fortunately the SMBIOS defines an "OEM Strings" table whose puporse is to allow
exposing of arbitrary vendor specific strings to the operating system. This is
perfect for use with cloud-init, or as a way to pass arguments to OS installers
such as anaconda.
This patch makes it easier to support this with QEMU. e.g.
$QEMU -smbios type=11,value=Hello,value=World,value=Tricky,,value=test
Which results in the guest seeing dmidecode data
Handle 0x0E00, DMI type 11, 5 bytes
OEM Strings
String 1: Hello
String 2: World
String 3: Tricky,value=test
It is suggested that any app wanting to make use of this OEM strings capability
for accepting data from the host mgmt layer should use its name as a string
prefix. e.g. to expose OEM strings targetting both cloud init and anaconda in
parallel the mgmt app could set
$QEMU -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\
value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os
which would appear as
Handle 0x0E00, DMI type 11, 5 bytes
OEM Strings
String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/
String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os
Use of such string prefixes means the app won't have to care which string slot
its data appears in.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd)
[BR: FATE#323624]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/smbios/smbios.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++
hw/smbios/smbios_build.h | 12 ++++++++
include/hw/smbios/smbios.h | 6 ++++
3 files changed, 90 insertions(+)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 1a5437a07d..5d11f01874 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -95,6 +95,11 @@ static struct {
const char *sock_pfx, *manufacturer, *version, *serial, *asset, *part;
} type4;
+static struct {
+ size_t nvalues;
+ const char **values;
+} type11;
+
static struct {
const char *loc_pfx, *bank, *manufacturer, *serial, *asset, *part;
uint16_t speed;
@@ -282,6 +287,14 @@ static const QemuOptDesc qemu_smbios_type4_opts[] = {
{ /* end of list */ }
};
+static const QemuOptDesc qemu_smbios_type11_opts[] = {
+ {
+ .name = "value",
+ .type = QEMU_OPT_STRING,
+ .help = "OEM string data",
+ },
+};
+
static const QemuOptDesc qemu_smbios_type17_opts[] = {
{
.name = "type",
@@ -590,6 +603,27 @@ static void smbios_build_type_4_table(unsigned instance)
smbios_type4_count++;
}
+static void smbios_build_type_11_table(void)
+{
+ char count_str[128];
+ size_t i;
+
+ if (type11.nvalues == 0) {
+ return;
+ }
+
+ SMBIOS_BUILD_TABLE_PRE(11, 0xe00, true); /* required */
+
+ snprintf(count_str, sizeof(count_str), "%zu", type11.nvalues);
+ t->count = type11.nvalues;
+
+ for (i = 0; i < type11.nvalues; i++) {
+ SMBIOS_TABLE_SET_STR_LIST(11, type11.values[i]);
+ }
+
+ SMBIOS_BUILD_TABLE_POST;
+}
+
#define ONE_KB ((ram_addr_t)1 << 10)
#define ONE_MB ((ram_addr_t)1 << 20)
#define ONE_GB ((ram_addr_t)1 << 30)
@@ -832,6 +866,8 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
smbios_build_type_4_table(i);
}
+ smbios_build_type_11_table();
+
#define MAX_DIMM_SZ (16ll * ONE_GB)
#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ \
: ((ram_size - 1) % MAX_DIMM_SZ) + 1)
@@ -882,6 +918,38 @@ static void save_opt(const char **dest, QemuOpts *opts, const char *name)
}
}
+
+struct opt_list {
+ const char *name;
+ size_t *ndest;
+ const char ***dest;
+};
+
+static int save_opt_one(void *opaque,
+ const char *name, const char *value,
+ Error **errp)
+{
+ struct opt_list *opt = opaque;
+
+ if (!g_str_equal(name, opt->name)) {
+ return 0;
+ }
+
+ *opt->dest = g_renew(const char *, *opt->dest, (*opt->ndest) + 1);
+ (*opt->dest)[*opt->ndest] = value;
+ (*opt->ndest)++;
+ return 0;
+}
+
+static void save_opt_list(size_t *ndest, const char ***dest,
+ QemuOpts *opts, const char *name)
+{
+ struct opt_list opt = {
+ name, ndest, dest,
+ };
+ qemu_opt_foreach(opts, save_opt_one, &opt, NULL);
+}
+
void smbios_entry_add(QemuOpts *opts, Error **errp)
{
const char *val;
@@ -1035,6 +1103,10 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
save_opt(&type4.asset, opts, "asset");
save_opt(&type4.part, opts, "part");
return;
+ case 11:
+ qemu_opts_validate(opts, qemu_smbios_type11_opts, &error_fatal);
+ save_opt_list(&type11.nvalues, &type11.values, opts, "value");
+ return;
case 17:
qemu_opts_validate(opts, qemu_smbios_type17_opts, &error_fatal);
save_opt(&type17.loc_pfx, opts, "loc_pfx");
diff --git a/hw/smbios/smbios_build.h b/hw/smbios/smbios_build.h
index 68b8b72e09..93b360d520 100644
--- a/hw/smbios/smbios_build.h
+++ b/hw/smbios/smbios_build.h
@@ -63,6 +63,18 @@ extern unsigned smbios_table_cnt;
} \
} while (0)
+#define SMBIOS_TABLE_SET_STR_LIST(tbl_type, value) \
+ do { \
+ int len = (value != NULL) ? strlen(value) + 1 : 0; \
+ if (len > 1) { \
+ smbios_tables = g_realloc(smbios_tables, \
+ smbios_tables_len + len); \
+ memcpy(smbios_tables + smbios_tables_len, value, len); \
+ smbios_tables_len += len; \
+ ++str_index; \
+ } \
+ } while (0)
+
#define SMBIOS_BUILD_TABLE_POST \
do { \
size_t term_cnt, t_size; \
diff --git a/include/hw/smbios/smbios.h b/include/hw/smbios/smbios.h
index 31e8d5f47e..a83adb93d7 100644
--- a/include/hw/smbios/smbios.h
+++ b/include/hw/smbios/smbios.h
@@ -195,6 +195,12 @@ struct smbios_type_4 {
uint16_t processor_family2;
} QEMU_PACKED;
+/* SMBIOS type 11 - OEM strings */
+struct smbios_type_11 {
+ struct smbios_structure_header header;
+ uint8_t count;
+} QEMU_PACKED;
+
/* SMBIOS type 16 - Physical Memory Array (v2.7) */
struct smbios_type_16 {
struct smbios_structure_header header;

View File

@ -1,52 +0,0 @@
From 9d1099c4ffea481aa803e9cc14a1419f902f52a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Mon, 29 Jan 2018 19:33:04 +0100
Subject: [PATCH] tpm: lookup cancel path under tpm device class
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since Linux commit 313d21eeab9282e, tpm devices have their own device
class "tpm" and the cancel path must be looked up under
/sys/class/tpm/ instead of /sys/class/misc/.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
(cherry picked from commit 05b71fb207ab7f016e067bd2a40fc0804362eb74)
[LY: BSC#1070615]
Signed-off-by: Liang Yan <lyan@suse.com>
---
hw/tpm/tpm_passthrough.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index c440aff4b2..01ecef99aa 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -206,7 +206,8 @@ static TPMVersion tpm_passthrough_get_tpm_version(TPMBackend *tb)
* Unless path or file descriptor set has been provided by user,
* determine the sysfs cancel file following kernel documentation
* in Documentation/ABI/stable/sysfs-class-tpm.
- * From /dev/tpm0 create /sys/class/misc/tpm0/device/cancel
+ * From /dev/tpm0 create /sys/class/tpm/tpm0/device/cancel
+ * before 4.0: /sys/class/misc/tpm0/device/cancel
*/
static int tpm_passthrough_open_sysfs_cancel(TPMPassthruState *tpm_pt)
{
@@ -226,9 +227,14 @@ static int tpm_passthrough_open_sysfs_cancel(TPMPassthruState *tpm_pt)
dev = strrchr(tpm_pt->tpm_dev, '/');
if (dev) {
dev++;
- if (snprintf(path, sizeof(path), "/sys/class/misc/%s/device/cancel",
+ if (snprintf(path, sizeof(path), "/sys/class/tpm/%s/device/cancel",
dev) < sizeof(path)) {
fd = qemu_open(path, O_WRONLY);
+ if (fd < 0) {
+ if (snprintf(path, sizeof(path), "/sys/class/misc/%s/device/cancel", dev) < sizeof(path)) {
+ fd = qemu_open(path, O_WRONLY);
+ }
+ }
if (fd >= 0) {
tpm_pt->options->cancel_path = g_strdup(path);
} else {

View File

@ -1,37 +0,0 @@
From e5bdf248c24feab41fc7b8245e37277f1ae60e3e Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 9 Mar 2018 15:37:04 +0100
Subject: [PATCH] vga: fix region calculation
Typically the scanline length and the line offset are identical. But
in case they are not our calculation for region_end is incorrect. Using
line_offset is fine for all scanlines, except the last one where we have
to use the actual scanline length.
Fixes: CVE-2018-7858
Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Tested-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Message-id: 20180309143704.13420-1-kraxel@redhat.com
(cherry picked from commit 7cdc61becd095b64a786b2625f321624e7111f3d)
[BR: BSC#1084604 CVE-2018-7858 (NOTE: Above CVE reference was modified
by me, because it was incorrect)]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/display/vga.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index d150a3a3eb..1fa66d597d 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1489,6 +1489,8 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
region_start = (s->start_addr * 4);
region_end = region_start + (ram_addr_t)s->line_offset * height;
+ region_end += width * s->get_bpp(s) / 8; /* scanline length */
+ region_end -= s->line_offset;
if (region_end > s->vbe_size) {
/* wraps around (can happen with cirrus vbe modes) */
region_start = 0;

View File

@ -1,26 +1,35 @@
From 239e992583e342b3cca14e809c5ab9469d578072 Mon Sep 17 00:00:00 2001
From 85cf819ab57556851df13a0cd74fff495feceb3c Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Mon, 24 Jul 2017 10:44:24 -0600
Subject: [PATCH] stub out the SAN req's in int13
We need to find some code or data to change so we can make the rom fit
into the legacy size requirements. Comment out SAN support, and
hopefully nobody will be impacted.
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
src/arch/x86/interface/pcbios/int13.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
src/arch/x86/interface/pcbios/int13.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/arch/x86/interface/pcbios/int13.c b/src/arch/x86/interface/pcbios/int13.c
index ca789a0d..bfbe4150 100644
index ca789a0d..40c61419 100644
--- a/src/arch/x86/interface/pcbios/int13.c
+++ b/src/arch/x86/interface/pcbios/int13.c
@@ -23,6 +23,8 @@
@@ -23,6 +23,12 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+#define INCLUDE_SAN_HOOKS 0
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
@@ -1243,6 +1245,7 @@ static void int13_unhook_vector ( void ) {
@@ -1243,6 +1249,7 @@ static void int13_unhook_vector ( void ) {
*/
static int int13_hook ( unsigned int drive, struct uri **uris,
unsigned int count, unsigned int flags ) {
@ -28,7 +37,7 @@ index ca789a0d..bfbe4150 100644
struct san_device *sandev;
struct int13_data *int13;
unsigned int natural_drive;
@@ -1315,6 +1318,9 @@ static int int13_hook ( unsigned int drive, struct uri **uris,
@@ -1315,6 +1322,9 @@ static int int13_hook ( unsigned int drive, struct uri **uris,
sandev_put ( sandev );
err_alloc:
return rc;
@ -38,7 +47,7 @@ index ca789a0d..bfbe4150 100644
}
/**
@@ -1328,6 +1334,7 @@ static int int13_hook ( unsigned int drive, struct uri **uris,
@@ -1328,6 +1338,7 @@ static int int13_hook ( unsigned int drive, struct uri **uris,
*/
static void int13_unhook ( unsigned int drive ) {
struct san_device *sandev;
@ -46,7 +55,7 @@ index ca789a0d..bfbe4150 100644
/* Find drive */
sandev = sandev_find ( drive );
@@ -1353,6 +1360,7 @@ static void int13_unhook ( unsigned int drive ) {
@@ -1353,6 +1364,7 @@ static void int13_unhook ( unsigned int drive ) {
/* Drop reference to drive */
sandev_put ( sandev );
@ -54,7 +63,7 @@ index ca789a0d..bfbe4150 100644
}
/**
@@ -1514,6 +1522,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
@@ -1514,6 +1526,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
* Note that this function can never return success, by definition.
*/
static int int13_boot ( unsigned int drive, const char *filename __unused ) {
@ -62,7 +71,7 @@ index ca789a0d..bfbe4150 100644
struct memory_map memmap;
struct segoff address;
int rc;
@@ -1539,6 +1548,9 @@ static int int13_boot ( unsigned int drive, const char *filename __unused ) {
@@ -1539,6 +1552,9 @@ static int int13_boot ( unsigned int drive, const char *filename __unused ) {
}
return -ECANCELED; /* -EIMPOSSIBLE */
@ -72,7 +81,7 @@ index ca789a0d..bfbe4150 100644
}
/** Maximum size of boot firmware table(s) */
@@ -1605,6 +1617,7 @@ static int int13_install ( struct acpi_header *acpi ) {
@@ -1605,6 +1621,7 @@ static int int13_install ( struct acpi_header *acpi ) {
* @ret rc Return status code
*/
static int int13_describe ( void ) {
@ -80,7 +89,7 @@ index ca789a0d..bfbe4150 100644
int rc;
/* Clear tables */
@@ -1619,6 +1632,9 @@ static int int13_describe ( void ) {
@@ -1619,9 +1636,13 @@ static int int13_describe ( void ) {
}
return 0;
@ -90,6 +99,10 @@ index ca789a0d..bfbe4150 100644
}
PROVIDE_SANBOOT ( pcbios, san_hook, int13_hook );
PROVIDE_SANBOOT ( pcbios, san_unhook, int13_unhook );
PROVIDE_SANBOOT ( pcbios, san_boot, int13_boot );
PROVIDE_SANBOOT ( pcbios, san_describe, int13_describe );
+#pragma GCC diagnostic pop
--
2.13.2
2.16.3

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8a5145d1f8bd2eadc6776f3e13c68cd28d01349e30639bdbcb26ac588d668686
size 28992188

Binary file not shown.

3
qemu-2.12.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e69301f361ff65bf5dabd8a19196aeaa5613c1b5ae1678f0823bdf50e7d5c6fc
size 35405044

BIN
qemu-2.12.0.tar.xz.sig Normal file

Binary file not shown.

View File

@ -1,3 +1,79 @@
-------------------------------------------------------------------
Fri Apr 27 20:54:16 UTC 2018 - brogers@suse.com
- Update to v2.12.0: See http://wiki.qemu.org/ChangeLog/2.12
Some noteworthy changes:
new aarch64_be target
more system calls supported
misc fixes for deadlocks, speed, and signal handling
* Patches dropped:
0033-memfd-fix-configure-test.patch
0034-qapi-use-items-values-intead-of-ite.patch
0035-qapi-Use-OrderedDict-from-standard-.patch
0036-qapi-adapt-to-moved-location-of-Str.patch
0037-qapi-Adapt-to-moved-location-of-mak.patch
0038-qapi-remove-q-arg-to-diff-when-comp.patch
0039-qapi-ensure-stable-sort-ordering-wh.patch
0040-qapi-force-a-UTF-8-locale-for-runni.patch
0041-scripts-ensure-signrom-treats-data-.patch
0042-configure-allow-use-of-python-3.patch
0043-input-add-missing-JIS-keys-to-virti.patch
0045-pc-fail-memory-hot-plug-unplug-with.patch
0046-memattrs-add-debug-attribute.patch
0047-exec-add-ram_debug_ops-support.patch
0048-exec-add-debug-version-of-physical-.patch
0049-monitor-i386-use-debug-APIs-when-ac.patch
0050-machine-add-memory-encryption-prope.patch
0051-kvm-update-kvm.h-to-include-memory-.patch
0052-docs-add-AMD-Secure-Encrypted-Virtu.patch
0053-target-i386-add-Secure-Encrypted-Vi.patch
0054-qmp-add-query-sev-command.patch
0055-sev-i386-add-command-to-initialize-.patch
0056-qmp-populate-SevInfo-fields-with-SE.patch
0057-sev-i386-register-the-guest-memory-.patch
0058-kvm-introduce-memory-encryption-API.patch
0059-hmp-add-info-sev-command.patch
0060-sev-i386-add-command-to-create-laun.patch
0061-sev-i386-add-command-to-encrypt-gue.patch
0062-target-i386-encrypt-bios-rom.patch
0063-sev-i386-add-support-to-LAUNCH_MEAS.patch
0064-sev-i386-finalize-the-SEV-guest-lau.patch
0065-hw-i386-set-ram_debug_ops-when-memo.patch
0066-sev-i386-add-debug-encrypt-and-decr.patch
0067-target-i386-clear-C-bit-when-walkin.patch
0068-include-add-psp-sev.h-header-file.patch
0069-sev-i386-add-support-to-query-PLATF.patch
0070-sev-i386-add-support-to-KVM_SEV_GUE.patch
0071-qmp-add-query-sev-launch-measure-co.patch
0072-tests-qmp-test-blacklist-query-sev-.patch
0073-sev-i386-add-migration-blocker.patch
0074-cpu-i386-populate-CPUID-0x8000_001F.patch
0075-migration-warn-about-inconsistent-s.patch
0076-smbios-support-setting-OEM-strings-.patch
0077-smbios-Add-1-terminator-if-any-stri.patch
0078-Remove-problematic-evdev-86-key-fro.patch
0079-tpm-lookup-cancel-path-under-tpm-de.patch
0080-vga-fix-region-calculation.patch
skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
skiboot-libc-stdio-vsnprintf.c-add-expli.patch
skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
ui-keycodemapdb-Add-missing-QKeyCode-val.patch
ui-keycodemapdb-Fix-compat-with-py3-dict.patch
* Patches renamed:
0044-Make-installed-scripts-explicitly-p.patch
-> 0033-Make-installed-scripts-explicitly-p.patch
0075-migration-warn-about-inconsistent-s.patch
-> 0034-migration-warn-about-inconsistent-s.patch
0077-smbios-Add-1-terminator-if-any-stri.patch
-> 0035-smbios-Add-1-terminator-if-any-stri.patch
0078-Remove-problematic-evdev-86-key-fro.patch
-> 0036-Remove-problematic-evdev-86-key-fro.patch
* Patches added:
0037-configure-Modify-python-used-for-io.patch
0038-qemu-io-tests-comment-out-problemat.patch
0039-tests-test-thread-pool-is-racy-add-.patch
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.12
-------------------------------------------------------------------
Thu Apr 5 21:33:40 UTC 2018 - brogers@suse.com

View File

@ -21,9 +21,9 @@ Url: http://www.qemu.org/
Summary: CPU emulator for user space
License: BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
Group: System/Emulators/PC
Version: 2.11.1
Version: 2.12.0
Release: 0
Source: qemu-2.11.1.tar.xz
Source: qemu-2.12.0.tar.xz
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch
@ -58,54 +58,13 @@ Patch0029: 0029-test-string-input-visitor-Add-uint6.patch
Patch0030: 0030-tests-Add-QOM-property-unit-tests.patch
Patch0031: 0031-tests-Add-scsi-disk-test.patch
Patch0032: 0032-Switch-order-of-libraries-for-mpath.patch
Patch0033: 0033-memfd-fix-configure-test.patch
Patch0034: 0034-qapi-use-items-values-intead-of-ite.patch
Patch0035: 0035-qapi-Use-OrderedDict-from-standard-.patch
Patch0036: 0036-qapi-adapt-to-moved-location-of-Str.patch
Patch0037: 0037-qapi-Adapt-to-moved-location-of-mak.patch
Patch0038: 0038-qapi-remove-q-arg-to-diff-when-comp.patch
Patch0039: 0039-qapi-ensure-stable-sort-ordering-wh.patch
Patch0040: 0040-qapi-force-a-UTF-8-locale-for-runni.patch
Patch0041: 0041-scripts-ensure-signrom-treats-data-.patch
Patch0042: 0042-configure-allow-use-of-python-3.patch
Patch0043: 0043-input-add-missing-JIS-keys-to-virti.patch
Patch0044: 0044-Make-installed-scripts-explicitly-p.patch
Patch0045: 0045-pc-fail-memory-hot-plug-unplug-with.patch
Patch0046: 0046-memattrs-add-debug-attribute.patch
Patch0047: 0047-exec-add-ram_debug_ops-support.patch
Patch0048: 0048-exec-add-debug-version-of-physical-.patch
Patch0049: 0049-monitor-i386-use-debug-APIs-when-ac.patch
Patch0050: 0050-machine-add-memory-encryption-prope.patch
Patch0051: 0051-kvm-update-kvm.h-to-include-memory-.patch
Patch0052: 0052-docs-add-AMD-Secure-Encrypted-Virtu.patch
Patch0053: 0053-target-i386-add-Secure-Encrypted-Vi.patch
Patch0054: 0054-qmp-add-query-sev-command.patch
Patch0055: 0055-sev-i386-add-command-to-initialize-.patch
Patch0056: 0056-qmp-populate-SevInfo-fields-with-SE.patch
Patch0057: 0057-sev-i386-register-the-guest-memory-.patch
Patch0058: 0058-kvm-introduce-memory-encryption-API.patch
Patch0059: 0059-hmp-add-info-sev-command.patch
Patch0060: 0060-sev-i386-add-command-to-create-laun.patch
Patch0061: 0061-sev-i386-add-command-to-encrypt-gue.patch
Patch0062: 0062-target-i386-encrypt-bios-rom.patch
Patch0063: 0063-sev-i386-add-support-to-LAUNCH_MEAS.patch
Patch0064: 0064-sev-i386-finalize-the-SEV-guest-lau.patch
Patch0065: 0065-hw-i386-set-ram_debug_ops-when-memo.patch
Patch0066: 0066-sev-i386-add-debug-encrypt-and-decr.patch
Patch0067: 0067-target-i386-clear-C-bit-when-walkin.patch
Patch0068: 0068-include-add-psp-sev.h-header-file.patch
Patch0069: 0069-sev-i386-add-support-to-query-PLATF.patch
Patch0070: 0070-sev-i386-add-support-to-KVM_SEV_GUE.patch
Patch0071: 0071-qmp-add-query-sev-launch-measure-co.patch
Patch0072: 0072-tests-qmp-test-blacklist-query-sev-.patch
Patch0073: 0073-sev-i386-add-migration-blocker.patch
Patch0074: 0074-cpu-i386-populate-CPUID-0x8000_001F.patch
Patch0075: 0075-migration-warn-about-inconsistent-s.patch
Patch0076: 0076-smbios-support-setting-OEM-strings-.patch
Patch0077: 0077-smbios-Add-1-terminator-if-any-stri.patch
Patch0078: 0078-Remove-problematic-evdev-86-key-fro.patch
Patch0079: 0079-tpm-lookup-cancel-path-under-tpm-de.patch
Patch0080: 0080-vga-fix-region-calculation.patch
Patch0033: 0033-Make-installed-scripts-explicitly-p.patch
Patch0034: 0034-migration-warn-about-inconsistent-s.patch
Patch0035: 0035-smbios-Add-1-terminator-if-any-stri.patch
Patch0036: 0036-Remove-problematic-evdev-86-key-fro.patch
Patch0037: 0037-configure-Modify-python-used-for-io.patch
Patch0038: 0038-qemu-io-tests-comment-out-problemat.patch
Patch0039: 0039-tests-test-thread-pool-is-racy-add-.patch
# Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue.
Source400: update_git.sh
@ -138,7 +97,7 @@ architecture. The syscall interface is intercepted and execution below the
syscall layer occurs on the native hardware and operating system.
%prep
%setup -q -n qemu-2.11.1
%setup -q -n qemu-2.12.0
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
@ -178,47 +137,6 @@ syscall layer occurs on the native hardware and operating system.
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%patch0052 -p1
%patch0053 -p1
%patch0054 -p1
%patch0055 -p1
%patch0056 -p1
%patch0057 -p1
%patch0058 -p1
%patch0059 -p1
%patch0060 -p1
%patch0061 -p1
%patch0062 -p1
%patch0063 -p1
%patch0064 -p1
%patch0065 -p1
%patch0066 -p1
%patch0067 -p1
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%patch0073 -p1
%patch0074 -p1
%patch0075 -p1
%patch0076 -p1
%patch0077 -p1
%patch0078 -p1
%patch0079 -p1
%patch0080 -p1
%build
./configure \
@ -258,11 +176,15 @@ syscall layer occurs on the native hardware and operating system.
--disable-gnutls \
--disable-gtk \
--disable-hax \
--disable-hvf \
--disable-jemalloc \
--disable-kvm \
--disable-libiscsi \
--disable-libxml2 \
--disable-linux-aio \
--disable-lzo \
--disable-malloc-trim \
--enable-membarrier \
--disable-mpath \
--disable-netmap \
--disable-nettle \
@ -271,6 +193,7 @@ syscall layer occurs on the native hardware and operating system.
--disable-rbd \
--disable-rdma \
--disable-replication \
--disable-sanitizers \
--disable-sdl \
--disable-seccomp \
--disable-smartcard \
@ -280,6 +203,7 @@ syscall layer occurs on the native hardware and operating system.
--disable-tpm \
--disable-usb-redir \
--disable-vde \
--disable-vhost-crypto \
--disable-vhost-net \
--disable-virglrenderer \
--disable-virtfs \
@ -288,6 +212,7 @@ syscall layer occurs on the native hardware and operating system.
--disable-vnc-png \
--disable-vnc-sasl \
--disable-vte \
--disable-whpx \
--disable-xen \
--disable-xen-pci-passthrough \
--disable-xen-pv-domain-build \
@ -338,6 +263,7 @@ install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
%defattr(-, root, root)
%doc COPYING COPYING.LIB COPYING.PYTHON Changelog README VERSION LICENSE
%_bindir/qemu-aarch64
%_bindir/qemu-aarch64_be
%_bindir/qemu-alpha
%_bindir/qemu-arm
%_bindir/qemu-armeb
@ -359,6 +285,8 @@ install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
%_bindir/qemu-ppc64
%_bindir/qemu-ppc64le
%_bindir/qemu-ppc
%_bindir/qemu-riscv32
%_bindir/qemu-riscv64
%_bindir/qemu-s390x
%_bindir/qemu-sh4
%_bindir/qemu-sh4eb
@ -367,6 +295,8 @@ install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
%_bindir/qemu-sparc
%_bindir/qemu-tilegx
%_bindir/qemu-x86_64
%_bindir/qemu-xtensa
%_bindir/qemu-xtensaeb
%_bindir/qemu-*-binfmt
%_sbindir/qemu-binfmt-conf.sh

View File

@ -23,7 +23,7 @@ License: BSD-3-Clause AND GPL-2.0 AND GPL-2.0+ AND LGPL-2.1+ AND MIT
Group: System/Emulators/PC
QEMU_VERSION
Release: 0
Source: qemu-2.11.1.tar.xz
Source: qemu-2.12.0.tar.xz
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
PATCH_FILES
@ -59,7 +59,7 @@ architecture. The syscall interface is intercepted and execution below the
syscall layer occurs on the native hardware and operating system.
%prep
%setup -q -n qemu-2.11.1
%setup -q -n qemu-2.12.0
PATCH_EXEC
%build
@ -100,11 +100,15 @@ PATCH_EXEC
--disable-gnutls \
--disable-gtk \
--disable-hax \
--disable-hvf \
--disable-jemalloc \
--disable-kvm \
--disable-libiscsi \
--disable-libxml2 \
--disable-linux-aio \
--disable-lzo \
--disable-malloc-trim \
--enable-membarrier \
--disable-mpath \
--disable-netmap \
--disable-nettle \
@ -113,6 +117,7 @@ PATCH_EXEC
--disable-rbd \
--disable-rdma \
--disable-replication \
--disable-sanitizers \
--disable-sdl \
--disable-seccomp \
--disable-smartcard \
@ -122,6 +127,7 @@ PATCH_EXEC
--disable-tpm \
--disable-usb-redir \
--disable-vde \
--disable-vhost-crypto \
--disable-vhost-net \
--disable-virglrenderer \
--disable-virtfs \
@ -130,6 +136,7 @@ PATCH_EXEC
--disable-vnc-png \
--disable-vnc-sasl \
--disable-vte \
--disable-whpx \
--disable-xen \
--disable-xen-pci-passthrough \
--disable-xen-pv-domain-build \
@ -180,6 +187,7 @@ install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
%defattr(-, root, root)
%doc COPYING COPYING.LIB COPYING.PYTHON Changelog README VERSION LICENSE
%_bindir/qemu-aarch64
%_bindir/qemu-aarch64_be
%_bindir/qemu-alpha
%_bindir/qemu-arm
%_bindir/qemu-armeb
@ -201,6 +209,8 @@ install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
%_bindir/qemu-ppc64
%_bindir/qemu-ppc64le
%_bindir/qemu-ppc
%_bindir/qemu-riscv32
%_bindir/qemu-riscv64
%_bindir/qemu-s390x
%_bindir/qemu-sh4
%_bindir/qemu-sh4eb
@ -209,6 +219,8 @@ install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
%_bindir/qemu-sparc
%_bindir/qemu-tilegx
%_bindir/qemu-x86_64
%_bindir/qemu-xtensa
%_bindir/qemu-xtensaeb
%_bindir/qemu-*-binfmt
%_sbindir/qemu-binfmt-conf.sh

View File

@ -1,3 +1,88 @@
-------------------------------------------------------------------
Fri Apr 27 20:54:01 UTC 2018 - brogers@suse.com
- Update to v2.12.0: See http://wiki.qemu.org/ChangeLog/2.12
Some noteworthy changes:
CLI options removed: -tdf, -no-kvm-pit, -drive boot, -net channel,
-net dump, -hdachs, -drive,if=scsi
HMP commands removed: usb_add, usb_del, host_net_add, host_net_remove
Q35 default nic now e1000e
AMD SEV support
-smbios supports setting data for type 11 tables
audio and display support split out as modules
-nic for simple creation of guest NIC and host back-end
QMP monitor "out-of-band" capability
lots of ARM and s390 improvements
- Include more of upstream's in-tree tests in the qemu-testsuite
package
* Patches dropped:
0033-memfd-fix-configure-test.patch
0034-qapi-use-items-values-intead-of-ite.patch
0035-qapi-Use-OrderedDict-from-standard-.patch
0036-qapi-adapt-to-moved-location-of-Str.patch
0037-qapi-Adapt-to-moved-location-of-mak.patch
0038-qapi-remove-q-arg-to-diff-when-comp.patch
0039-qapi-ensure-stable-sort-ordering-wh.patch
0040-qapi-force-a-UTF-8-locale-for-runni.patch
0041-scripts-ensure-signrom-treats-data-.patch
0042-configure-allow-use-of-python-3.patch
0043-input-add-missing-JIS-keys-to-virti.patch
0045-pc-fail-memory-hot-plug-unplug-with.patch
0046-memattrs-add-debug-attribute.patch
0047-exec-add-ram_debug_ops-support.patch
0048-exec-add-debug-version-of-physical-.patch
0049-monitor-i386-use-debug-APIs-when-ac.patch
0050-machine-add-memory-encryption-prope.patch
0051-kvm-update-kvm.h-to-include-memory-.patch
0052-docs-add-AMD-Secure-Encrypted-Virtu.patch
0053-target-i386-add-Secure-Encrypted-Vi.patch
0054-qmp-add-query-sev-command.patch
0055-sev-i386-add-command-to-initialize-.patch
0056-qmp-populate-SevInfo-fields-with-SE.patch
0057-sev-i386-register-the-guest-memory-.patch
0058-kvm-introduce-memory-encryption-API.patch
0059-hmp-add-info-sev-command.patch
0060-sev-i386-add-command-to-create-laun.patch
0061-sev-i386-add-command-to-encrypt-gue.patch
0062-target-i386-encrypt-bios-rom.patch
0063-sev-i386-add-support-to-LAUNCH_MEAS.patch
0064-sev-i386-finalize-the-SEV-guest-lau.patch
0065-hw-i386-set-ram_debug_ops-when-memo.patch
0066-sev-i386-add-debug-encrypt-and-decr.patch
0067-target-i386-clear-C-bit-when-walkin.patch
0068-include-add-psp-sev.h-header-file.patch
0069-sev-i386-add-support-to-query-PLATF.patch
0070-sev-i386-add-support-to-KVM_SEV_GUE.patch
0071-qmp-add-query-sev-launch-measure-co.patch
0072-tests-qmp-test-blacklist-query-sev-.patch
0073-sev-i386-add-migration-blocker.patch
0074-cpu-i386-populate-CPUID-0x8000_001F.patch
0075-migration-warn-about-inconsistent-s.patch
0076-smbios-support-setting-OEM-strings-.patch
0077-smbios-Add-1-terminator-if-any-stri.patch
0078-Remove-problematic-evdev-86-key-fro.patch
0079-tpm-lookup-cancel-path-under-tpm-de.patch
0080-vga-fix-region-calculation.patch
skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
skiboot-libc-stdio-vsnprintf.c-add-expli.patch
skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
ui-keycodemapdb-Add-missing-QKeyCode-val.patch
ui-keycodemapdb-Fix-compat-with-py3-dict.patch
* Patches renamed:
0044-Make-installed-scripts-explicitly-p.patch
-> 0033-Make-installed-scripts-explicitly-p.patch
0075-migration-warn-about-inconsistent-s.patch
-> 0034-migration-warn-about-inconsistent-s.patch
0077-smbios-Add-1-terminator-if-any-stri.patch
-> 0035-smbios-Add-1-terminator-if-any-stri.patch
0078-Remove-problematic-evdev-86-key-fro.patch
-> 0036-Remove-problematic-evdev-86-key-fro.patch
* Patches added:
0037-configure-Modify-python-used-for-io.patch
0038-qemu-io-tests-comment-out-problemat.patch
0039-tests-test-thread-pool-is-racy-add-.patch
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.12
-------------------------------------------------------------------
Fri Apr 27 20:50:49 UTC 2018 - brogers@suse.com

View File

@ -109,10 +109,10 @@ Url: http://www.qemu.org/
Summary: Machine emulator and virtualizer
License: BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
Group: System/Emulators/PC
Version: 2.11.1
Version: 2.12.0
Release: 0
Source: http://wiki.qemu.org/download/qemu-2.11.1.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.11.1.tar.xz.sig
Source: http://wiki.qemu.org/download/qemu-2.12.0.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.12.0.tar.xz.sig
Source1: 80-kvm.rules
Source2: qemu-ifup
Source3: kvm_stat
@ -162,54 +162,13 @@ Patch0029: 0029-test-string-input-visitor-Add-uint6.patch
Patch0030: 0030-tests-Add-QOM-property-unit-tests.patch
Patch0031: 0031-tests-Add-scsi-disk-test.patch
Patch0032: 0032-Switch-order-of-libraries-for-mpath.patch
Patch0033: 0033-memfd-fix-configure-test.patch
Patch0034: 0034-qapi-use-items-values-intead-of-ite.patch
Patch0035: 0035-qapi-Use-OrderedDict-from-standard-.patch
Patch0036: 0036-qapi-adapt-to-moved-location-of-Str.patch
Patch0037: 0037-qapi-Adapt-to-moved-location-of-mak.patch
Patch0038: 0038-qapi-remove-q-arg-to-diff-when-comp.patch
Patch0039: 0039-qapi-ensure-stable-sort-ordering-wh.patch
Patch0040: 0040-qapi-force-a-UTF-8-locale-for-runni.patch
Patch0041: 0041-scripts-ensure-signrom-treats-data-.patch
Patch0042: 0042-configure-allow-use-of-python-3.patch
Patch0043: 0043-input-add-missing-JIS-keys-to-virti.patch
Patch0044: 0044-Make-installed-scripts-explicitly-p.patch
Patch0045: 0045-pc-fail-memory-hot-plug-unplug-with.patch
Patch0046: 0046-memattrs-add-debug-attribute.patch
Patch0047: 0047-exec-add-ram_debug_ops-support.patch
Patch0048: 0048-exec-add-debug-version-of-physical-.patch
Patch0049: 0049-monitor-i386-use-debug-APIs-when-ac.patch
Patch0050: 0050-machine-add-memory-encryption-prope.patch
Patch0051: 0051-kvm-update-kvm.h-to-include-memory-.patch
Patch0052: 0052-docs-add-AMD-Secure-Encrypted-Virtu.patch
Patch0053: 0053-target-i386-add-Secure-Encrypted-Vi.patch
Patch0054: 0054-qmp-add-query-sev-command.patch
Patch0055: 0055-sev-i386-add-command-to-initialize-.patch
Patch0056: 0056-qmp-populate-SevInfo-fields-with-SE.patch
Patch0057: 0057-sev-i386-register-the-guest-memory-.patch
Patch0058: 0058-kvm-introduce-memory-encryption-API.patch
Patch0059: 0059-hmp-add-info-sev-command.patch
Patch0060: 0060-sev-i386-add-command-to-create-laun.patch
Patch0061: 0061-sev-i386-add-command-to-encrypt-gue.patch
Patch0062: 0062-target-i386-encrypt-bios-rom.patch
Patch0063: 0063-sev-i386-add-support-to-LAUNCH_MEAS.patch
Patch0064: 0064-sev-i386-finalize-the-SEV-guest-lau.patch
Patch0065: 0065-hw-i386-set-ram_debug_ops-when-memo.patch
Patch0066: 0066-sev-i386-add-debug-encrypt-and-decr.patch
Patch0067: 0067-target-i386-clear-C-bit-when-walkin.patch
Patch0068: 0068-include-add-psp-sev.h-header-file.patch
Patch0069: 0069-sev-i386-add-support-to-query-PLATF.patch
Patch0070: 0070-sev-i386-add-support-to-KVM_SEV_GUE.patch
Patch0071: 0071-qmp-add-query-sev-launch-measure-co.patch
Patch0072: 0072-tests-qmp-test-blacklist-query-sev-.patch
Patch0073: 0073-sev-i386-add-migration-blocker.patch
Patch0074: 0074-cpu-i386-populate-CPUID-0x8000_001F.patch
Patch0075: 0075-migration-warn-about-inconsistent-s.patch
Patch0076: 0076-smbios-support-setting-OEM-strings-.patch
Patch0077: 0077-smbios-Add-1-terminator-if-any-stri.patch
Patch0078: 0078-Remove-problematic-evdev-86-key-fro.patch
Patch0079: 0079-tpm-lookup-cancel-path-under-tpm-de.patch
Patch0080: 0080-vga-fix-region-calculation.patch
Patch0033: 0033-Make-installed-scripts-explicitly-p.patch
Patch0034: 0034-migration-warn-about-inconsistent-s.patch
Patch0035: 0035-smbios-Add-1-terminator-if-any-stri.patch
Patch0036: 0036-Remove-problematic-evdev-86-key-fro.patch
Patch0037: 0037-configure-Modify-python-used-for-io.patch
Patch0038: 0038-qemu-io-tests-comment-out-problemat.patch
Patch0039: 0039-tests-test-thread-pool-is-racy-add-.patch
# Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue.
@ -233,14 +192,9 @@ Patch1300: sgabios-stable-buildid.patch
# SLOF (Currently no patches)
# skiboot
Patch1500: skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
Patch1501: skiboot-libc-stdio-vsnprintf.c-add-expli.patch
Patch1502: skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
# skiboot (Currently no patches)
# ui/keycodemapdb
Patch1600: ui-keycodemapdb-Add-missing-QKeyCode-val.patch
Patch1601: ui-keycodemapdb-Fix-compat-with-py3-dict.patch
# ui/keycodemapdb (Currently no patches)
# this is to make lint happy
Source300: qemu-rpmlintrc
@ -384,6 +338,9 @@ BuildRequires: xz-devel
%endif
BuildRequires: zlib-devel
%if "%{name}" == "qemu-testsuite"
%if 0%{?suse_version} > 1320
BuildRequires: python-base
%endif
BuildRequires: bc
BuildRequires: qemu-arm = %version
BuildRequires: qemu-block-curl = %version
@ -393,6 +350,11 @@ BuildRequires: qemu-guest-agent = %version
BuildRequires: qemu-ppc = %version
BuildRequires: qemu-s390 = %version
BuildRequires: qemu-tools = %version
BuildRequires: qemu-ui-curses = %version
BuildRequires: qemu-ui-gtk = %version
%if 0%{?is_opensuse}
BuildRequires: qemu-ui-sdl = %version
%endif
BuildRequires: qemu-x86 = %version
%if 0%{?with_glusterfs}
BuildRequires: qemu-block-gluster = %version
@ -421,6 +383,11 @@ Recommends: python-curses
%endif
Recommends: qemu-block-curl
Recommends: qemu-tools
Recommends: qemu-ui-curses
Recommends: qemu-ui-gtk
%if 0%{?is_opensuse}
Recommends: qemu-ui-sdl
%endif
Recommends: qemu-x86
%ifarch ppc ppc64 ppc64le
Recommends: qemu-ppc
@ -710,6 +677,66 @@ Group: System/Emulators/PC
This package contains a module for accessing network-based image files over an
SSH network connection from qemu-img tool and QEMU system emulation.
%package ui-curses
Summary: Curses based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-curses
This package contains a module for doing curses based UI for QEMU.
%package ui-gtk
Summary: GTK based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-gtk
This package contains a module for doing GTK based UI for QEMU.
%if 0%{?is_opensuse}
%package ui-sdl
Summary: SDL based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-sdl
This package contains a module for doing SDL based UI for QEMU.
%endif
%package audio-alsa
Summary: ALSA based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-alsa
This package contains a module for ALSA based audio support for QEMU.
%package audio-oss
Summary: OSS based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-oss
This package contains a module for OSS based audio support for QEMU.
%package audio-pa
Summary: Pulse Audio based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-pa
This package contains a module for Pulse Audio based audio support for QEMU.
%if 0%{?is_opensuse}
%package audio-sdl
Summary: SDL based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-sdl
This package contains a module for SDL based audio support for QEMU.
%endif
%package tools
Summary: Tools for QEMU
Group: System/Emulators/PC
@ -744,7 +771,7 @@ to provide information and control at the guest OS level.
%package seabios
Summary: x86 Legacy BIOS for QEMU
Group: System/Emulators/PC
Version: 1.11.0
Version: 1.11.1
Release: 0
BuildArch: noarch
Conflicts: qemu < 1.6.0
@ -756,7 +783,7 @@ is the default and legacy BIOS for QEMU.
%package vgabios
Summary: VGA BIOSes for QEMU
Group: System/Emulators/PC
Version: 1.11.0
Version: 1.11.1
Release: 0
BuildArch: noarch
Conflicts: qemu < 1.6.0
@ -809,7 +836,7 @@ This package provides a service file for starting and stopping KSM.
%endif # !qemu-testsuite
%prep
%setup -q -n qemu-2.11.1
%setup -q -n qemu-2.12.0
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
@ -849,47 +876,6 @@ This package provides a service file for starting and stopping KSM.
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%patch0052 -p1
%patch0053 -p1
%patch0054 -p1
%patch0055 -p1
%patch0056 -p1
%patch0057 -p1
%patch0058 -p1
%patch0059 -p1
%patch0060 -p1
%patch0061 -p1
%patch0062 -p1
%patch0063 -p1
%patch0064 -p1
%patch0065 -p1
%patch0066 -p1
%patch0067 -p1
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%patch0073 -p1
%patch0074 -p1
%patch0075 -p1
%patch0076 -p1
%patch0077 -p1
%patch0078 -p1
%patch0079 -p1
%patch0080 -p1
%if 0%{?suse_version} > 1320
%patch1000 -p1
@ -918,14 +904,9 @@ pushd roms/SLOF
popd
pushd roms/skiboot
%patch1500 -p1
%patch1501 -p1
%patch1502 -p1
popd
pushd ui/keycodemapdb
%patch1600 -p1
%patch1601 -p1
popd
# as a safeguard, delete the firmware files that we intend to build
@ -984,6 +965,7 @@ echo '%{version}' > roms/seabios/.version
--enable-gtk \
--with-gtkabi=3.0 \
--disable-hax \
--disable-hvf \
--disable-jemalloc \
%if %{kvm_available}
--enable-kvm \
@ -998,8 +980,11 @@ echo '%{version}' > roms/seabios/.version
--disable-libnfs \
--enable-libssh2 \
--enable-libusb \
--disable-libxml2 \
--enable-linux-aio \
--enable-lzo \
--disable-malloc-trim \
--enable-membarrier \
%if 0%{?suse_version} > 1320
--enable-mpath \
%else
@ -1042,6 +1027,7 @@ echo '%{version}' > roms/seabios/.version
--disable-rdma \
%endif
--enable-replication \
--disable-sanitizers \
%if 0%{?is_opensuse}
--enable-sdl \
%if 0%{?suse_version} >= 1320
@ -1068,6 +1054,7 @@ echo '%{version}' > roms/seabios/.version
--enable-tpm \
--enable-usb-redir \
--enable-vde \
--disable-vhost-crypto \
--enable-vhost-net \
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
--enable-virglrenderer \
@ -1082,6 +1069,7 @@ echo '%{version}' > roms/seabios/.version
%else
--enable-vte \
%endif
--disable-whpx \
%ifarch x86_64
--enable-xen \
--enable-xen-pci-passthrough \
@ -1138,7 +1126,7 @@ make -C roms sgabios
pushd roms/ipxe
patch -p1 < %{SOURCE301}
popd
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 NO_WERROR=1 pxerom
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom
%endif
# enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward
@ -1170,7 +1158,7 @@ done
%endif
%if %{build_skiboot_from_source}
make %{?_smp_mflags} -C roms skiboot SKIBOOT_VERSION=skiboot-5.3.7 CROSS=
make %{?_smp_mflags} -C roms skiboot SKIBOOT_VERSION=skiboot-5.9 CROSS=
%endif
%if %{build_slof_from_source}
@ -1206,21 +1194,14 @@ make check-report.html V=1
%check
%if "%{name}" == "qemu-testsuite"
%ifnarch %ix86 x64_64
export QEMU_PROG=%{_bindir}/qemu-system-x86_64
%endif
export QEMU_IMG_PROG=%{_bindir}/qemu-img
export QEMU_IO_PROG=%{_bindir}/qemu-io
export QEMU_NBD_PROG=%{_bindir}/qemu-nbd
# make check-block would rebuild qemu-img and qemu-io
make tests/qemu-iotests/socket_scm_helper V=1
pushd tests/qemu-iotests
# -qcow 001 seems to hang?
# TODO investigate hangs and failures
#for fmt in -raw -bochs -cloop -parallels -qcow2 -qed -vdi -vpc -vhdx -vmdk; do
# ./check -v -T $fmt -file -g quick || true
#done
popd
# the block tests are not yet 32 bit x86 friendly
%ifnarch %ix86
make check-block V=1
%endif
# Create minimal gzip format file
echo "Test" > test.txt
@ -1243,7 +1224,7 @@ format=`qemu-img info test.tar | grep "file format:" | cut -d ':' -f 2 | tr -d '
touch -r config-host.mak pc-bios
make install DESTDIR=%{buildroot}
%ifnarch %ix86 x86_64
for f in acpi-dsdt.aml %{x86_extra_built_firmware_list} \
for f in %{x86_extra_built_firmware_list} \
%{x86_64_only_extra_built_firmware_list}; do
unlink %{buildroot}%{_datadir}/%name/$f
done
@ -1432,7 +1413,9 @@ fi
%_datadir/%name/slof.bin
%_datadir/%name/spapr-rtas.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/u-boot-sam460-20100605.bin
%_datadir/%name/bamboo.dtb
%_datadir/%name/canyonlands.dtb
%_datadir/%name/petalogix-ml605.dtb
%_datadir/%name/skiboot.lid
%_datadir/%name/qemu_vga.ndrv
@ -1464,6 +1447,7 @@ fi
%defattr(-, root, root)
%_bindir/qemu-system-alpha
%_bindir/qemu-system-cris
%_bindir/qemu-system-hppa
%_bindir/qemu-system-lm32
%_bindir/qemu-system-m68k
%_bindir/qemu-system-microblaze
@ -1475,6 +1459,8 @@ fi
%_bindir/qemu-system-moxie
%_bindir/qemu-system-nios2
%_bindir/qemu-system-or1k
%_bindir/qemu-system-riscv32
%_bindir/qemu-system-riscv64
%_bindir/qemu-system-sh4
%_bindir/qemu-system-sh4eb
%_bindir/qemu-system-sparc
@ -1483,6 +1469,7 @@ fi
%_bindir/qemu-system-unicore32
%_bindir/qemu-system-xtensa
%_bindir/qemu-system-xtensaeb
%_datadir/%name/hppa-firmware.img
%_datadir/%name/palcode-clipper
%_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64
@ -1537,6 +1524,45 @@ fi
%dir %_libdir/%name
%_libdir/%name/block-ssh.so
%files ui-curses
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-curses.so
%files ui-gtk
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-gtk.so
%if 0%{?is_opensuse}
%files ui-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-sdl.so
%endif
%files audio-alsa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-alsa.so
%files audio-oss
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-oss.so
%files audio-pa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-pa.so
%if 0%{?is_opensuse}
%files audio-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-sdl.so
%endif
%files lang -f %name.lang
%defattr(-, root, root)
@ -1546,7 +1572,6 @@ fi
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/acpi-dsdt.aml
%files vgabios
%defattr(-, root, root)

View File

@ -1,3 +1,88 @@
-------------------------------------------------------------------
Fri Apr 27 20:54:01 UTC 2018 - brogers@suse.com
- Update to v2.12.0: See http://wiki.qemu.org/ChangeLog/2.12
Some noteworthy changes:
CLI options removed: -tdf, -no-kvm-pit, -drive boot, -net channel,
-net dump, -hdachs, -drive,if=scsi
HMP commands removed: usb_add, usb_del, host_net_add, host_net_remove
Q35 default nic now e1000e
AMD SEV support
-smbios supports setting data for type 11 tables
audio and display support split out as modules
-nic for simple creation of guest NIC and host back-end
QMP monitor "out-of-band" capability
lots of ARM and s390 improvements
- Include more of upstream's in-tree tests in the qemu-testsuite
package
* Patches dropped:
0033-memfd-fix-configure-test.patch
0034-qapi-use-items-values-intead-of-ite.patch
0035-qapi-Use-OrderedDict-from-standard-.patch
0036-qapi-adapt-to-moved-location-of-Str.patch
0037-qapi-Adapt-to-moved-location-of-mak.patch
0038-qapi-remove-q-arg-to-diff-when-comp.patch
0039-qapi-ensure-stable-sort-ordering-wh.patch
0040-qapi-force-a-UTF-8-locale-for-runni.patch
0041-scripts-ensure-signrom-treats-data-.patch
0042-configure-allow-use-of-python-3.patch
0043-input-add-missing-JIS-keys-to-virti.patch
0045-pc-fail-memory-hot-plug-unplug-with.patch
0046-memattrs-add-debug-attribute.patch
0047-exec-add-ram_debug_ops-support.patch
0048-exec-add-debug-version-of-physical-.patch
0049-monitor-i386-use-debug-APIs-when-ac.patch
0050-machine-add-memory-encryption-prope.patch
0051-kvm-update-kvm.h-to-include-memory-.patch
0052-docs-add-AMD-Secure-Encrypted-Virtu.patch
0053-target-i386-add-Secure-Encrypted-Vi.patch
0054-qmp-add-query-sev-command.patch
0055-sev-i386-add-command-to-initialize-.patch
0056-qmp-populate-SevInfo-fields-with-SE.patch
0057-sev-i386-register-the-guest-memory-.patch
0058-kvm-introduce-memory-encryption-API.patch
0059-hmp-add-info-sev-command.patch
0060-sev-i386-add-command-to-create-laun.patch
0061-sev-i386-add-command-to-encrypt-gue.patch
0062-target-i386-encrypt-bios-rom.patch
0063-sev-i386-add-support-to-LAUNCH_MEAS.patch
0064-sev-i386-finalize-the-SEV-guest-lau.patch
0065-hw-i386-set-ram_debug_ops-when-memo.patch
0066-sev-i386-add-debug-encrypt-and-decr.patch
0067-target-i386-clear-C-bit-when-walkin.patch
0068-include-add-psp-sev.h-header-file.patch
0069-sev-i386-add-support-to-query-PLATF.patch
0070-sev-i386-add-support-to-KVM_SEV_GUE.patch
0071-qmp-add-query-sev-launch-measure-co.patch
0072-tests-qmp-test-blacklist-query-sev-.patch
0073-sev-i386-add-migration-blocker.patch
0074-cpu-i386-populate-CPUID-0x8000_001F.patch
0075-migration-warn-about-inconsistent-s.patch
0076-smbios-support-setting-OEM-strings-.patch
0077-smbios-Add-1-terminator-if-any-stri.patch
0078-Remove-problematic-evdev-86-key-fro.patch
0079-tpm-lookup-cancel-path-under-tpm-de.patch
0080-vga-fix-region-calculation.patch
skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
skiboot-libc-stdio-vsnprintf.c-add-expli.patch
skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
ui-keycodemapdb-Add-missing-QKeyCode-val.patch
ui-keycodemapdb-Fix-compat-with-py3-dict.patch
* Patches renamed:
0044-Make-installed-scripts-explicitly-p.patch
-> 0033-Make-installed-scripts-explicitly-p.patch
0075-migration-warn-about-inconsistent-s.patch
-> 0034-migration-warn-about-inconsistent-s.patch
0077-smbios-Add-1-terminator-if-any-stri.patch
-> 0035-smbios-Add-1-terminator-if-any-stri.patch
0078-Remove-problematic-evdev-86-key-fro.patch
-> 0036-Remove-problematic-evdev-86-key-fro.patch
* Patches added:
0037-configure-Modify-python-used-for-io.patch
0038-qemu-io-tests-comment-out-problemat.patch
0039-tests-test-thread-pool-is-racy-add-.patch
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.12
-------------------------------------------------------------------
Fri Apr 27 20:50:49 UTC 2018 - brogers@suse.com

269
qemu.spec
View File

@ -109,10 +109,10 @@ Url: http://www.qemu.org/
Summary: Machine emulator and virtualizer
License: BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
Group: System/Emulators/PC
Version: 2.11.1
Version: 2.12.0
Release: 0
Source: http://wiki.qemu.org/download/qemu-2.11.1.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.11.1.tar.xz.sig
Source: http://wiki.qemu.org/download/qemu-2.12.0.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.12.0.tar.xz.sig
Source1: 80-kvm.rules
Source2: qemu-ifup
Source3: kvm_stat
@ -162,54 +162,13 @@ Patch0029: 0029-test-string-input-visitor-Add-uint6.patch
Patch0030: 0030-tests-Add-QOM-property-unit-tests.patch
Patch0031: 0031-tests-Add-scsi-disk-test.patch
Patch0032: 0032-Switch-order-of-libraries-for-mpath.patch
Patch0033: 0033-memfd-fix-configure-test.patch
Patch0034: 0034-qapi-use-items-values-intead-of-ite.patch
Patch0035: 0035-qapi-Use-OrderedDict-from-standard-.patch
Patch0036: 0036-qapi-adapt-to-moved-location-of-Str.patch
Patch0037: 0037-qapi-Adapt-to-moved-location-of-mak.patch
Patch0038: 0038-qapi-remove-q-arg-to-diff-when-comp.patch
Patch0039: 0039-qapi-ensure-stable-sort-ordering-wh.patch
Patch0040: 0040-qapi-force-a-UTF-8-locale-for-runni.patch
Patch0041: 0041-scripts-ensure-signrom-treats-data-.patch
Patch0042: 0042-configure-allow-use-of-python-3.patch
Patch0043: 0043-input-add-missing-JIS-keys-to-virti.patch
Patch0044: 0044-Make-installed-scripts-explicitly-p.patch
Patch0045: 0045-pc-fail-memory-hot-plug-unplug-with.patch
Patch0046: 0046-memattrs-add-debug-attribute.patch
Patch0047: 0047-exec-add-ram_debug_ops-support.patch
Patch0048: 0048-exec-add-debug-version-of-physical-.patch
Patch0049: 0049-monitor-i386-use-debug-APIs-when-ac.patch
Patch0050: 0050-machine-add-memory-encryption-prope.patch
Patch0051: 0051-kvm-update-kvm.h-to-include-memory-.patch
Patch0052: 0052-docs-add-AMD-Secure-Encrypted-Virtu.patch
Patch0053: 0053-target-i386-add-Secure-Encrypted-Vi.patch
Patch0054: 0054-qmp-add-query-sev-command.patch
Patch0055: 0055-sev-i386-add-command-to-initialize-.patch
Patch0056: 0056-qmp-populate-SevInfo-fields-with-SE.patch
Patch0057: 0057-sev-i386-register-the-guest-memory-.patch
Patch0058: 0058-kvm-introduce-memory-encryption-API.patch
Patch0059: 0059-hmp-add-info-sev-command.patch
Patch0060: 0060-sev-i386-add-command-to-create-laun.patch
Patch0061: 0061-sev-i386-add-command-to-encrypt-gue.patch
Patch0062: 0062-target-i386-encrypt-bios-rom.patch
Patch0063: 0063-sev-i386-add-support-to-LAUNCH_MEAS.patch
Patch0064: 0064-sev-i386-finalize-the-SEV-guest-lau.patch
Patch0065: 0065-hw-i386-set-ram_debug_ops-when-memo.patch
Patch0066: 0066-sev-i386-add-debug-encrypt-and-decr.patch
Patch0067: 0067-target-i386-clear-C-bit-when-walkin.patch
Patch0068: 0068-include-add-psp-sev.h-header-file.patch
Patch0069: 0069-sev-i386-add-support-to-query-PLATF.patch
Patch0070: 0070-sev-i386-add-support-to-KVM_SEV_GUE.patch
Patch0071: 0071-qmp-add-query-sev-launch-measure-co.patch
Patch0072: 0072-tests-qmp-test-blacklist-query-sev-.patch
Patch0073: 0073-sev-i386-add-migration-blocker.patch
Patch0074: 0074-cpu-i386-populate-CPUID-0x8000_001F.patch
Patch0075: 0075-migration-warn-about-inconsistent-s.patch
Patch0076: 0076-smbios-support-setting-OEM-strings-.patch
Patch0077: 0077-smbios-Add-1-terminator-if-any-stri.patch
Patch0078: 0078-Remove-problematic-evdev-86-key-fro.patch
Patch0079: 0079-tpm-lookup-cancel-path-under-tpm-de.patch
Patch0080: 0080-vga-fix-region-calculation.patch
Patch0033: 0033-Make-installed-scripts-explicitly-p.patch
Patch0034: 0034-migration-warn-about-inconsistent-s.patch
Patch0035: 0035-smbios-Add-1-terminator-if-any-stri.patch
Patch0036: 0036-Remove-problematic-evdev-86-key-fro.patch
Patch0037: 0037-configure-Modify-python-used-for-io.patch
Patch0038: 0038-qemu-io-tests-comment-out-problemat.patch
Patch0039: 0039-tests-test-thread-pool-is-racy-add-.patch
# Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue.
@ -233,14 +192,9 @@ Patch1300: sgabios-stable-buildid.patch
# SLOF (Currently no patches)
# skiboot
Patch1500: skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
Patch1501: skiboot-libc-stdio-vsnprintf.c-add-expli.patch
Patch1502: skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
# skiboot (Currently no patches)
# ui/keycodemapdb
Patch1600: ui-keycodemapdb-Add-missing-QKeyCode-val.patch
Patch1601: ui-keycodemapdb-Fix-compat-with-py3-dict.patch
# ui/keycodemapdb (Currently no patches)
# this is to make lint happy
Source300: qemu-rpmlintrc
@ -384,6 +338,9 @@ BuildRequires: xz-devel
%endif
BuildRequires: zlib-devel
%if "%{name}" == "qemu-testsuite"
%if 0%{?suse_version} > 1320
BuildRequires: python-base
%endif
BuildRequires: bc
BuildRequires: qemu-arm = %version
BuildRequires: qemu-block-curl = %version
@ -393,6 +350,11 @@ BuildRequires: qemu-guest-agent = %version
BuildRequires: qemu-ppc = %version
BuildRequires: qemu-s390 = %version
BuildRequires: qemu-tools = %version
BuildRequires: qemu-ui-curses = %version
BuildRequires: qemu-ui-gtk = %version
%if 0%{?is_opensuse}
BuildRequires: qemu-ui-sdl = %version
%endif
BuildRequires: qemu-x86 = %version
%if 0%{?with_glusterfs}
BuildRequires: qemu-block-gluster = %version
@ -421,6 +383,11 @@ Recommends: python-curses
%endif
Recommends: qemu-block-curl
Recommends: qemu-tools
Recommends: qemu-ui-curses
Recommends: qemu-ui-gtk
%if 0%{?is_opensuse}
Recommends: qemu-ui-sdl
%endif
Recommends: qemu-x86
%ifarch ppc ppc64 ppc64le
Recommends: qemu-ppc
@ -710,6 +677,66 @@ Group: System/Emulators/PC
This package contains a module for accessing network-based image files over an
SSH network connection from qemu-img tool and QEMU system emulation.
%package ui-curses
Summary: Curses based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-curses
This package contains a module for doing curses based UI for QEMU.
%package ui-gtk
Summary: GTK based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-gtk
This package contains a module for doing GTK based UI for QEMU.
%if 0%{?is_opensuse}
%package ui-sdl
Summary: SDL based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-sdl
This package contains a module for doing SDL based UI for QEMU.
%endif
%package audio-alsa
Summary: ALSA based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-alsa
This package contains a module for ALSA based audio support for QEMU.
%package audio-oss
Summary: OSS based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-oss
This package contains a module for OSS based audio support for QEMU.
%package audio-pa
Summary: Pulse Audio based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-pa
This package contains a module for Pulse Audio based audio support for QEMU.
%if 0%{?is_opensuse}
%package audio-sdl
Summary: SDL based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-sdl
This package contains a module for SDL based audio support for QEMU.
%endif
%package tools
Summary: Tools for QEMU
Group: System/Emulators/PC
@ -744,7 +771,7 @@ to provide information and control at the guest OS level.
%package seabios
Summary: x86 Legacy BIOS for QEMU
Group: System/Emulators/PC
Version: 1.11.0
Version: 1.11.1
Release: 0
BuildArch: noarch
Conflicts: qemu < 1.6.0
@ -756,7 +783,7 @@ is the default and legacy BIOS for QEMU.
%package vgabios
Summary: VGA BIOSes for QEMU
Group: System/Emulators/PC
Version: 1.11.0
Version: 1.11.1
Release: 0
BuildArch: noarch
Conflicts: qemu < 1.6.0
@ -809,7 +836,7 @@ This package provides a service file for starting and stopping KSM.
%endif # !qemu-testsuite
%prep
%setup -q -n qemu-2.11.1
%setup -q -n qemu-2.12.0
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
@ -849,47 +876,6 @@ This package provides a service file for starting and stopping KSM.
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%patch0052 -p1
%patch0053 -p1
%patch0054 -p1
%patch0055 -p1
%patch0056 -p1
%patch0057 -p1
%patch0058 -p1
%patch0059 -p1
%patch0060 -p1
%patch0061 -p1
%patch0062 -p1
%patch0063 -p1
%patch0064 -p1
%patch0065 -p1
%patch0066 -p1
%patch0067 -p1
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%patch0073 -p1
%patch0074 -p1
%patch0075 -p1
%patch0076 -p1
%patch0077 -p1
%patch0078 -p1
%patch0079 -p1
%patch0080 -p1
%if 0%{?suse_version} > 1320
%patch1000 -p1
@ -918,14 +904,9 @@ pushd roms/SLOF
popd
pushd roms/skiboot
%patch1500 -p1
%patch1501 -p1
%patch1502 -p1
popd
pushd ui/keycodemapdb
%patch1600 -p1
%patch1601 -p1
popd
# as a safeguard, delete the firmware files that we intend to build
@ -984,6 +965,7 @@ echo '%{version}' > roms/seabios/.version
--enable-gtk \
--with-gtkabi=3.0 \
--disable-hax \
--disable-hvf \
--disable-jemalloc \
%if %{kvm_available}
--enable-kvm \
@ -998,8 +980,11 @@ echo '%{version}' > roms/seabios/.version
--disable-libnfs \
--enable-libssh2 \
--enable-libusb \
--disable-libxml2 \
--enable-linux-aio \
--enable-lzo \
--disable-malloc-trim \
--enable-membarrier \
%if 0%{?suse_version} > 1320
--enable-mpath \
%else
@ -1042,6 +1027,7 @@ echo '%{version}' > roms/seabios/.version
--disable-rdma \
%endif
--enable-replication \
--disable-sanitizers \
%if 0%{?is_opensuse}
--enable-sdl \
%if 0%{?suse_version} >= 1320
@ -1068,6 +1054,7 @@ echo '%{version}' > roms/seabios/.version
--enable-tpm \
--enable-usb-redir \
--enable-vde \
--disable-vhost-crypto \
--enable-vhost-net \
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
--enable-virglrenderer \
@ -1082,6 +1069,7 @@ echo '%{version}' > roms/seabios/.version
%else
--enable-vte \
%endif
--disable-whpx \
%ifarch x86_64
--enable-xen \
--enable-xen-pci-passthrough \
@ -1138,7 +1126,7 @@ make -C roms sgabios
pushd roms/ipxe
patch -p1 < %{SOURCE301}
popd
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 NO_WERROR=1 pxerom
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom
%endif
# enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward
@ -1170,7 +1158,7 @@ done
%endif
%if %{build_skiboot_from_source}
make %{?_smp_mflags} -C roms skiboot SKIBOOT_VERSION=skiboot-5.3.7 CROSS=
make %{?_smp_mflags} -C roms skiboot SKIBOOT_VERSION=skiboot-5.9 CROSS=
%endif
%if %{build_slof_from_source}
@ -1206,21 +1194,14 @@ make check-report.html V=1
%check
%if "%{name}" == "qemu-testsuite"
%ifnarch %ix86 x64_64
export QEMU_PROG=%{_bindir}/qemu-system-x86_64
%endif
export QEMU_IMG_PROG=%{_bindir}/qemu-img
export QEMU_IO_PROG=%{_bindir}/qemu-io
export QEMU_NBD_PROG=%{_bindir}/qemu-nbd
# make check-block would rebuild qemu-img and qemu-io
make tests/qemu-iotests/socket_scm_helper V=1
pushd tests/qemu-iotests
# -qcow 001 seems to hang?
# TODO investigate hangs and failures
#for fmt in -raw -bochs -cloop -parallels -qcow2 -qed -vdi -vpc -vhdx -vmdk; do
# ./check -v -T $fmt -file -g quick || true
#done
popd
# the block tests are not yet 32 bit x86 friendly
%ifnarch %ix86
make check-block V=1
%endif
# Create minimal gzip format file
echo "Test" > test.txt
@ -1243,7 +1224,7 @@ format=`qemu-img info test.tar | grep "file format:" | cut -d ':' -f 2 | tr -d '
touch -r config-host.mak pc-bios
make install DESTDIR=%{buildroot}
%ifnarch %ix86 x86_64
for f in acpi-dsdt.aml %{x86_extra_built_firmware_list} \
for f in %{x86_extra_built_firmware_list} \
%{x86_64_only_extra_built_firmware_list}; do
unlink %{buildroot}%{_datadir}/%name/$f
done
@ -1432,7 +1413,9 @@ fi
%_datadir/%name/slof.bin
%_datadir/%name/spapr-rtas.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/u-boot-sam460-20100605.bin
%_datadir/%name/bamboo.dtb
%_datadir/%name/canyonlands.dtb
%_datadir/%name/petalogix-ml605.dtb
%_datadir/%name/skiboot.lid
%_datadir/%name/qemu_vga.ndrv
@ -1464,6 +1447,7 @@ fi
%defattr(-, root, root)
%_bindir/qemu-system-alpha
%_bindir/qemu-system-cris
%_bindir/qemu-system-hppa
%_bindir/qemu-system-lm32
%_bindir/qemu-system-m68k
%_bindir/qemu-system-microblaze
@ -1475,6 +1459,8 @@ fi
%_bindir/qemu-system-moxie
%_bindir/qemu-system-nios2
%_bindir/qemu-system-or1k
%_bindir/qemu-system-riscv32
%_bindir/qemu-system-riscv64
%_bindir/qemu-system-sh4
%_bindir/qemu-system-sh4eb
%_bindir/qemu-system-sparc
@ -1483,6 +1469,7 @@ fi
%_bindir/qemu-system-unicore32
%_bindir/qemu-system-xtensa
%_bindir/qemu-system-xtensaeb
%_datadir/%name/hppa-firmware.img
%_datadir/%name/palcode-clipper
%_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64
@ -1537,6 +1524,45 @@ fi
%dir %_libdir/%name
%_libdir/%name/block-ssh.so
%files ui-curses
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-curses.so
%files ui-gtk
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-gtk.so
%if 0%{?is_opensuse}
%files ui-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-sdl.so
%endif
%files audio-alsa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-alsa.so
%files audio-oss
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-oss.so
%files audio-pa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-pa.so
%if 0%{?is_opensuse}
%files audio-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-sdl.so
%endif
%files lang -f %name.lang
%defattr(-, root, root)
@ -1546,7 +1572,6 @@ fi
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/acpi-dsdt.aml
%files vgabios
%defattr(-, root, root)

View File

@ -111,8 +111,8 @@ License: BSD-3-Clause AND GPL-2.0 AND GPL-2.0+ AND LGPL-2.1+ AND MIT
Group: System/Emulators/PC
QEMU_VERSION
Release: 0
Source: http://wiki.qemu.org/download/qemu-2.11.1.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.11.1.tar.xz.sig
Source: http://wiki.qemu.org/download/qemu-2.12.0.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.12.0.tar.xz.sig
Source1: 80-kvm.rules
Source2: qemu-ifup
Source3: kvm_stat
@ -147,7 +147,7 @@ Patch1101: seabios-switch-to-python3-as-needed.patch
# PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch brogers@suse.com -- reproducible builds
Patch1200: ipxe-stable-buildid.patch
Patch1201: ipxe-use-gcc6-for-more-compact-code.patch
patch1202: ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch
Patch1202: ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch
# sgabios
# PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch brogers@suse.com -- reproducible builds
@ -155,14 +155,9 @@ Patch1300: sgabios-stable-buildid.patch
# SLOF (Currently no patches)
# skiboot
Patch1500: skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
Patch1501: skiboot-libc-stdio-vsnprintf.c-add-expli.patch
Patch1502: skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
# skiboot (Currently no patches)
# ui/keycodemapdb
Patch1600: ui-keycodemapdb-Add-missing-QKeyCode-val.patch
Patch1601: ui-keycodemapdb-Fix-compat-with-py3-dict.patch
# ui/keycodemapdb (Currently no patches)
# this is to make lint happy
Source300: qemu-rpmlintrc
@ -306,6 +301,9 @@ BuildRequires: xz-devel
%endif
BuildRequires: zlib-devel
%if "%{name}" == "qemu-testsuite"
%if 0%{?suse_version} > 1320
BuildRequires: python-base
%endif
BuildRequires: bc
BuildRequires: qemu-arm = %version
BuildRequires: qemu-block-curl = %version
@ -315,6 +313,11 @@ BuildRequires: qemu-guest-agent = %version
BuildRequires: qemu-ppc = %version
BuildRequires: qemu-s390 = %version
BuildRequires: qemu-tools = %version
BuildRequires: qemu-ui-curses = %version
BuildRequires: qemu-ui-gtk = %version
%if 0%{?is_opensuse}
BuildRequires: qemu-ui-sdl = %version
%endif
BuildRequires: qemu-x86 = %version
%if 0%{?with_glusterfs}
BuildRequires: qemu-block-gluster = %version
@ -343,6 +346,11 @@ Recommends: python-curses
%endif
Recommends: qemu-block-curl
Recommends: qemu-tools
Recommends: qemu-ui-curses
Recommends: qemu-ui-gtk
%if 0%{?is_opensuse}
Recommends: qemu-ui-sdl
%endif
Recommends: qemu-x86
%ifarch ppc ppc64 ppc64le
Recommends: qemu-ppc
@ -632,6 +640,66 @@ Group: System/Emulators/PC
This package contains a module for accessing network-based image files over an
SSH network connection from qemu-img tool and QEMU system emulation.
%package ui-curses
Summary: Curses based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-curses
This package contains a module for doing curses based UI for QEMU.
%package ui-gtk
Summary: GTK based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-gtk
This package contains a module for doing GTK based UI for QEMU.
%if 0%{?is_opensuse}
%package ui-sdl
Summary: SDL based UI support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description ui-sdl
This package contains a module for doing SDL based UI for QEMU.
%endif
%package audio-alsa
Summary: ALSA based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-alsa
This package contains a module for ALSA based audio support for QEMU.
%package audio-oss
Summary: OSS based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-oss
This package contains a module for OSS based audio support for QEMU.
%package audio-pa
Summary: Pulse Audio based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-pa
This package contains a module for Pulse Audio based audio support for QEMU.
%if 0%{?is_opensuse}
%package audio-sdl
Summary: SDL based audio support for QEMU
Group: System/Emulators/PC
%{qemu_module_conflicts}
%description audio-sdl
This package contains a module for SDL based audio support for QEMU.
%endif
%package tools
Summary: Tools for QEMU
Group: System/Emulators/PC
@ -731,7 +799,7 @@ This package provides a service file for starting and stopping KSM.
%endif # !qemu-testsuite
%prep
%setup -q -n qemu-2.11.1
%setup -q -n qemu-2.12.0
PATCH_EXEC
%if 0%{?suse_version} > 1320
@ -761,14 +829,9 @@ pushd roms/SLOF
popd
pushd roms/skiboot
%patch1500 -p1
%patch1501 -p1
%patch1502 -p1
popd
pushd ui/keycodemapdb
%patch1600 -p1
%patch1601 -p1
popd
# as a safeguard, delete the firmware files that we intend to build
@ -827,6 +890,7 @@ echo '%{version}' > roms/seabios/.version
--enable-gtk \
--with-gtkabi=3.0 \
--disable-hax \
--disable-hvf \
--disable-jemalloc \
%if %{kvm_available}
--enable-kvm \
@ -841,8 +905,11 @@ echo '%{version}' > roms/seabios/.version
--disable-libnfs \
--enable-libssh2 \
--enable-libusb \
--disable-libxml2 \
--enable-linux-aio \
--enable-lzo \
--disable-malloc-trim \
--enable-membarrier \
%if 0%{?suse_version} > 1320
--enable-mpath \
%else
@ -885,6 +952,7 @@ echo '%{version}' > roms/seabios/.version
--disable-rdma \
%endif
--enable-replication \
--disable-sanitizers \
%if 0%{?is_opensuse}
--enable-sdl \
%if 0%{?suse_version} >= 1320
@ -911,6 +979,7 @@ echo '%{version}' > roms/seabios/.version
--enable-tpm \
--enable-usb-redir \
--enable-vde \
--disable-vhost-crypto \
--enable-vhost-net \
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
--enable-virglrenderer \
@ -925,6 +994,7 @@ echo '%{version}' > roms/seabios/.version
%else
--enable-vte \
%endif
--disable-whpx \
%ifarch x86_64
--enable-xen \
--enable-xen-pci-passthrough \
@ -981,7 +1051,7 @@ make -C roms sgabios
pushd roms/ipxe
patch -p1 < %{SOURCE301}
popd
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 NO_WERROR=1 pxerom
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom
%endif
# enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward
@ -1013,7 +1083,7 @@ done
%endif
%if %{build_skiboot_from_source}
make %{?_smp_mflags} -C roms skiboot SKIBOOT_VERSION=skiboot-5.3.7 CROSS=
make %{?_smp_mflags} -C roms skiboot SKIBOOT_VERSION=skiboot-5.9 CROSS=
%endif
%if %{build_slof_from_source}
@ -1049,21 +1119,14 @@ make check-report.html V=1
%check
%if "%{name}" == "qemu-testsuite"
%ifnarch %ix86 x64_64
export QEMU_PROG=%{_bindir}/qemu-system-x86_64
%endif
export QEMU_IMG_PROG=%{_bindir}/qemu-img
export QEMU_IO_PROG=%{_bindir}/qemu-io
export QEMU_NBD_PROG=%{_bindir}/qemu-nbd
# make check-block would rebuild qemu-img and qemu-io
make tests/qemu-iotests/socket_scm_helper V=1
pushd tests/qemu-iotests
# -qcow 001 seems to hang?
# TODO investigate hangs and failures
#for fmt in -raw -bochs -cloop -parallels -qcow2 -qed -vdi -vpc -vhdx -vmdk; do
# ./check -v -T $fmt -file -g quick || true
#done
popd
# the block tests are not yet 32 bit x86 friendly
%ifnarch %ix86
make check-block V=1
%endif
# Create minimal gzip format file
echo "Test" > test.txt
@ -1086,7 +1149,7 @@ format=`qemu-img info test.tar | grep "file format:" | cut -d ':' -f 2 | tr -d '
touch -r config-host.mak pc-bios
make install DESTDIR=%{buildroot}
%ifnarch %ix86 x86_64
for f in acpi-dsdt.aml %{x86_extra_built_firmware_list} \
for f in %{x86_extra_built_firmware_list} \
%{x86_64_only_extra_built_firmware_list}; do
unlink %{buildroot}%{_datadir}/%name/$f
done
@ -1275,7 +1338,9 @@ fi
%_datadir/%name/slof.bin
%_datadir/%name/spapr-rtas.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/u-boot-sam460-20100605.bin
%_datadir/%name/bamboo.dtb
%_datadir/%name/canyonlands.dtb
%_datadir/%name/petalogix-ml605.dtb
%_datadir/%name/skiboot.lid
%_datadir/%name/qemu_vga.ndrv
@ -1307,6 +1372,7 @@ fi
%defattr(-, root, root)
%_bindir/qemu-system-alpha
%_bindir/qemu-system-cris
%_bindir/qemu-system-hppa
%_bindir/qemu-system-lm32
%_bindir/qemu-system-m68k
%_bindir/qemu-system-microblaze
@ -1318,6 +1384,8 @@ fi
%_bindir/qemu-system-moxie
%_bindir/qemu-system-nios2
%_bindir/qemu-system-or1k
%_bindir/qemu-system-riscv32
%_bindir/qemu-system-riscv64
%_bindir/qemu-system-sh4
%_bindir/qemu-system-sh4eb
%_bindir/qemu-system-sparc
@ -1326,6 +1394,7 @@ fi
%_bindir/qemu-system-unicore32
%_bindir/qemu-system-xtensa
%_bindir/qemu-system-xtensaeb
%_datadir/%name/hppa-firmware.img
%_datadir/%name/palcode-clipper
%_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64
@ -1380,6 +1449,45 @@ fi
%dir %_libdir/%name
%_libdir/%name/block-ssh.so
%files ui-curses
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-curses.so
%files ui-gtk
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-gtk.so
%if 0%{?is_opensuse}
%files ui-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-sdl.so
%endif
%files audio-alsa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-alsa.so
%files audio-oss
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-oss.so
%files audio-pa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-pa.so
%if 0%{?is_opensuse}
%files audio-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-sdl.so
%endif
%files lang -f %name.lang
%defattr(-, root, root)
@ -1389,7 +1497,6 @@ fi
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/acpi-dsdt.aml
%files vgabios
%defattr(-, root, root)

View File

@ -1,64 +0,0 @@
From d2c3aad5b260f52dbc87dc93e81733daad154051 Mon Sep 17 00:00:00 2001
From: Stewart Smith <stewart@linux.vnet.ibm.com>
Date: Wed, 10 May 2017 19:33:52 +1000
Subject: [PATCH] GCC7: fixes for -Wimplicit-fallthrough expected regexes
It turns out GCC7 adds a useful warning and does fancy things like
parsing your comments to work out that you intended to do the fallthrough.
There's a few places where we don't match the regex. Fix them, as it's
harmless to do so.
Found by building on Fedora Rawhide in Travis.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
core/pcie-slot.c | 3 ++-
hw/fsp/fsp-sysparam.c | 2 +-
platforms/ibm-fsp/firenze-pci.c | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 62933a40..80972a6f 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -383,7 +383,8 @@ static int64_t pcie_slot_sm_freset(struct pci_slot *slot)
PCI_SLOT_STATE_FRESET_POWER_OFF);
return pci_slot_set_sm_timeout(slot, msecs_to_tb(50));
}
- /* No power state change, fall through */
+ /* No power state change, */
+ /* fallthrough */
case PCI_SLOT_STATE_FRESET_POWER_OFF:
PCIE_SLOT_DBG(slot, "FRESET: Power is off, turn on\n");
if (slot->ops.set_power_state)
diff --git a/hw/fsp/fsp-sysparam.c b/hw/fsp/fsp-sysparam.c
index 2dbf05c6..5d7ae91e 100644
--- a/hw/fsp/fsp-sysparam.c
+++ b/hw/fsp/fsp-sysparam.c
@@ -100,7 +100,7 @@ static int fsp_sysparam_process(struct sysparam_req *r)
case 0x00: /* XXX Is that even possible ? */
case 0x11: /* Data in request */
memcpy(r->ubuf, &r->resp.data.words[2], len);
- /* pass through */
+ /* fallthrough */
case 0x12: /* Data in TCE */
stlen = len;
break;
diff --git a/platforms/ibm-fsp/firenze-pci.c b/platforms/ibm-fsp/firenze-pci.c
index fd15e88a..66f6efa9 100644
--- a/platforms/ibm-fsp/firenze-pci.c
+++ b/platforms/ibm-fsp/firenze-pci.c
@@ -507,7 +507,8 @@ static int64_t firenze_pci_slot_freset(struct pci_slot *slot)
msecs_to_tb(FIRENZE_PCI_SLOT_DELAY));
}
- /* Fall through: Power is off, turn it on */
+ /* Power is off, turn it on */
+ /* Fallthrough */
case FIRENZE_PCI_SLOT_FRESET_POWER_OFF:
/* Update last power status */
pval = (uint8_t *)(plat_slot->req->rw_buf);
--
2.14.1

View File

@ -1,36 +0,0 @@
From d150a119e3721e634ca31f0ec255add7b955a56d Mon Sep 17 00:00:00 2001
From: Nicholas Piggin <npiggin@gmail.com>
Date: Tue, 18 Jul 2017 20:40:06 +1000
Subject: [PATCH] build: LDFLAGS pass -pie flag explicitly to ld
When building with some toolchains, the gcc -pie option does not
enable the linker pie without explicitly passing it to ld,
resulting in a non-PIE binary that silently fails (due to
relocation failure). This was observed with the powerpc64le
cross compiler for Debian.
Pass -Wl,-pie explicitly, which allows the powerpc64le toolchain
to create a position independnet binary that boots.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
Makefile.main | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.main b/Makefile.main
index 35d16095..07e143fd 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -85,6 +85,7 @@ CFLAGS += $(call try-cflag,$(CC),-Wjump-misses-init) \
CFLAGS += $(CWARNS) $(OPTS) $(DBG)
LDFLAGS := -m64 -static -nostdlib -pie
+LDFLAGS += -Wl,-pie
LDFLAGS += -Wl,-Ttext-segment,$(LD_TEXT) -Wl,-N -Wl,--build-id=none
LDFLAGS += -Wl,--no-multi-toc
LDFLAGS += -mbig-endian -Wl,--oformat,elf64-powerpc
--
2.15.0

View File

@ -1,28 +0,0 @@
From bfb0e54f493d4003a397d5c1b50fc77195e7ffb5 Mon Sep 17 00:00:00 2001
From: Stewart Smith <stewart@linux.vnet.ibm.com>
Date: Thu, 2 Feb 2017 16:35:40 +1100
Subject: [PATCH] libc/stdio/vsnprintf.c: add explicit fallthrough
silences recent GCC warning
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
libc/stdio/vsnprintf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c
index fbb84a0b..e83cee84 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -164,6 +164,7 @@ print_format(char **buffer, size_t bufsize, const char *format, void *var)
break;
case 'X':
upper = true;
+ /* fallthrough */
case 'x':
sizec[i] = '\0';
value = (unsigned long) var & convert[length_mod];
--
2.14.1

View File

@ -274,6 +274,7 @@ QEMU Command-Line and Monitor Syntax and Support
-net [bridge|l2tpv3|nic|none|tap|user] ... (for model= only e1000, rtl8139,
and virtio are supported)
-netdev [bridge|tap|user] ...
-nic ...
-no-acpi
-nodefaults
-nodefconfig
@ -473,6 +474,7 @@ QEMU Command-Line and Monitor Syntax and Support
query-cpu-model-comparison
query-cpu-model-expansion
query-cpus
query-cpus-fast
query-dump
query-dump-guest-memory-capability
query-events
@ -719,6 +721,7 @@ QEMU Command-Line and Monitor Syntax and Support
query-sev
query-sev-launch-measure
x-blockdev-change
x-blockdev-create
x-blockdev-insert-medium
x-blockdev-remove-medium
x-colo-lost-heartbeat

Some files were not shown because too many files have changed in this diff Show More