app-emulation/qemu: Sync with Gentoo upstream

Link1: 3452fc9c05

Signed-off-by: Sayan Chowdhury <sayan@kinvolk.io>
This commit is contained in:
Sayan Chowdhury 2021-03-17 14:31:54 +05:30 committed by Sayan Chowdhury
parent 818e27951e
commit 45110250e9
21 changed files with 288 additions and 785 deletions

View File

@ -1 +1 @@
DIST qemu-5.0.0.tar.xz 62426192 BLAKE2B 785d02ef79c95b5c4f0556186054885f9893d4e8a9f4b4f2d6199a4e1ae9c31d7c79dd900305469217f85d61bbe74134b601d5c6c1b0eee2b74792d010f1fd63 SHA512 21ef0cbe107c468a40f0fa2635db2a40048c8790b629dfffca5cd62bb1b502ea8eb133bfc40df5ecf1489e2bffe87f6829aee041cb8a380ff04a8afa23b39fcf DIST qemu-5.2.0.tar.xz 106902800 BLAKE2B 4413d5591cbabf80faba5b0b7347ee7749ff0a71af44bdf7f64b1995e17ecf1f3df539fa8e63959e0d50cd0502a41a2921e60cc6d078ed8ab5b09ab4b86d4ed7 SHA512 bddd633ce111471ebc651e03080251515178808556b49a308a724909e55dac0be0cc0c79c536ac12d239678ae94c60100dc124be9b9d9538340c03a2f27177f3

View File

@ -0,0 +1,3 @@
KERNEL=="kvm", GROUP="kvm", MODE="0660"
KERNEL=="vhost-net", GROUP="kvm", MODE="0660", OPTIONS+="static_node=vhost-net"
KERNEL=="vhost-vsock", GROUP="kvm", MODE="0660", OPTIONS+="static_node=vhost-vsock"

View File

@ -1,13 +0,0 @@
--- a/configure
+++ b/configure
@@ -4468,10 +4468,6 @@ fi
if test "$gcov" = "yes" ; then
CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
-elif test "$fortify_source" = "yes" ; then
- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
- CFLAGS="-O2 $CFLAGS"
fi
##########################################

View File

@ -1,15 +0,0 @@
Linux C libs are moving away from implicit header pollution with sys/types.h
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -78,6 +78,10 @@ extern int daemon(int, int);
#include <assert.h>
#include <signal.h>
+#ifdef __linux__
+#include <sys/sysmacros.h>
+#endif
+
#ifdef __OpenBSD__
#include <sys/signal.h>
#endif

View File

@ -1,61 +0,0 @@
From 0fb766134bd97ead71646e13349f93769e536ed9 Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Fri, 17 May 2019 02:21:10 -0500
Subject: [PATCH] Define md-clear bit, expose md-no CPUID
Fixes for CVE-2018-121{26|27|30}, CVE-2019-11091
See related fixes for Ubuntu:
https://launchpad.net/ubuntu/+source/qemu/1:3.1+dfsg-2ubuntu3.1
---
target/i386/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index d6bb57d2..331a364a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1076,7 +1076,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.feat_names = {
NULL, NULL, "avx512-4vnniw", "avx512-4fmaps",
NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
+ NULL, NULL, "md-clear", NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
@@ -1183,7 +1183,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.type = MSR_FEATURE_WORD,
.feat_names = {
"rdctl-no", "ibrs-all", "rsba", "skip-l1dfl-vmentry",
- "ssb-no", NULL, NULL, NULL,
+ "ssb-no", "mds-no", NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 83fb5225..d0bab4d7 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -694,6 +694,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
#define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2) /* AVX512 Neural Network Instructions */
#define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
+#define CPUID_7_0_EDX_MD_CLEAR (1U << 10) /* Microarchitectural Data Clear */
#define CPUID_7_0_EDX_SPEC_CTRL (1U << 26) /* Speculation Control */
#define CPUID_7_0_EDX_ARCH_CAPABILITIES (1U << 29) /*Arch Capabilities*/
#define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31) /* Speculative Store Bypass Disable */
diff --git a/target/i386/hvf/x86_cpuid.c b/target/i386/hvf/x86_cpuid.c
index 4d957fe8..b453552f 100644
--- a/target/i386/hvf/x86_cpuid.c
+++ b/target/i386/hvf/x86_cpuid.c
@@ -90,7 +90,8 @@ uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
}
ecx &= CPUID_7_0_ECX_AVX512BMI | CPUID_7_0_ECX_AVX512_VPOPCNTDQ;
- edx &= CPUID_7_0_EDX_AVX512_4VNNIW | CPUID_7_0_EDX_AVX512_4FMAPS;
+ edx &= CPUID_7_0_EDX_AVX512_4VNNIW | CPUID_7_0_EDX_AVX512_4FMAPS | \
+ CPUID_7_0_EDX_MD_CLEAR;
} else {
ebx = 0;
ecx = 0;

View File

@ -1,12 +0,0 @@
diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
index d1660b64..86715bfd 100644
--- a/hw/rdma/rdma_backend.c
+++ b/hw/rdma/rdma_backend.c
@@ -21,7 +21,6 @@
#include "qapi/qapi-events-rdma.h"
#include <infiniband/verbs.h>
-#include <infiniband/umad_types.h>
#include <infiniband/umad.h>
#include <rdma/rdma_user_cm.h>

View File

@ -1,334 +0,0 @@
From 6d5d5dde9adb5acb32e6b8e3dfbf47fff0f308d2 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Thu, 18 Jul 2019 15:06:41 +0200
Subject: [PATCH] linux-user: fix to handle variably sized SIOCGSTAMP with new
kernels
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
The SIOCGSTAMP symbol was previously defined in the
asm-generic/sockios.h header file. QEMU sees that header
indirectly via sys/socket.h
In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115
the asm-generic/sockios.h header no longer defines SIOCGSTAMP.
Instead it provides only SIOCGSTAMP_OLD, which only uses a
32-bit time_t on 32-bit architectures.
The linux/sockios.h header then defines SIOCGSTAMP using
either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. If
SIOCGSTAMP_NEW is used, then the tv_sec field is 64-bit even
on 32-bit architectures
To cope with this we must now convert the old and new type from
the target to the host one.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Message-Id: <20190718130641.15294-1-laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/ioctls.h | 21 ++++++-
linux-user/syscall.c | 140 ++++++++++++++++++++++++++++++++++++---------
linux-user/syscall_defs.h | 30 +++++++++-
linux-user/syscall_types.h | 6 --
4 files changed, 159 insertions(+), 38 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index ae895162..e6a27ad9 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -219,8 +219,25 @@
IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */
- IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
- IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
+
+ /*
+ * We can't use IOCTL_SPECIAL() because it will set
+ * host_cmd to XXX_OLD and XXX_NEW and these macros
+ * are not defined with kernel prior to 5.2.
+ * We must set host_cmd to the same value as in target_cmd
+ * otherwise the consistency check in syscall_init()
+ * will trigger an error.
+ * host_cmd is ignored by the do_ioctl_XXX() helpers.
+ * FIXME: create a macro to define this kind of entry
+ */
+ { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
+ "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP },
+ { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
+ "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS },
+ { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
+ "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP },
+ { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
+ "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS },
IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 96cd4bf8..6df480e1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -37,6 +37,7 @@
#include <sched.h>
#include <sys/timex.h>
#include <sys/socket.h>
+#include <linux/sockios.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <poll.h>
@@ -1139,8 +1140,9 @@ static inline abi_long copy_from_user_timeval(struct timeval *tv,
{
struct target_timeval *target_tv;
- if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1))
+ if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1)) {
return -TARGET_EFAULT;
+ }
__get_user(tv->tv_sec, &target_tv->tv_sec);
__get_user(tv->tv_usec, &target_tv->tv_usec);
@@ -1155,8 +1157,26 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr,
{
struct target_timeval *target_tv;
- if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0))
+ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) {
+ return -TARGET_EFAULT;
+ }
+
+ __put_user(tv->tv_sec, &target_tv->tv_sec);
+ __put_user(tv->tv_usec, &target_tv->tv_usec);
+
+ unlock_user_struct(target_tv, target_tv_addr, 1);
+
+ return 0;
+}
+
+static inline abi_long copy_to_user_timeval64(abi_ulong target_tv_addr,
+ const struct timeval *tv)
+{
+ struct target__kernel_sock_timeval *target_tv;
+
+ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) {
return -TARGET_EFAULT;
+ }
__put_user(tv->tv_sec, &target_tv->tv_sec);
__put_user(tv->tv_usec, &target_tv->tv_usec);
@@ -1166,6 +1186,48 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr,
return 0;
}
+static inline abi_long target_to_host_timespec(struct timespec *host_ts,
+ abi_ulong target_addr)
+{
+ struct target_timespec *target_ts;
+
+ if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1)) {
+ return -TARGET_EFAULT;
+ }
+ __get_user(host_ts->tv_sec, &target_ts->tv_sec);
+ __get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
+ unlock_user_struct(target_ts, target_addr, 0);
+ return 0;
+}
+
+static inline abi_long host_to_target_timespec(abi_ulong target_addr,
+ struct timespec *host_ts)
+{
+ struct target_timespec *target_ts;
+
+ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) {
+ return -TARGET_EFAULT;
+ }
+ __put_user(host_ts->tv_sec, &target_ts->tv_sec);
+ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
+ unlock_user_struct(target_ts, target_addr, 1);
+ return 0;
+}
+
+static inline abi_long host_to_target_timespec64(abi_ulong target_addr,
+ struct timespec *host_ts)
+{
+ struct target__kernel_timespec *target_ts;
+
+ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) {
+ return -TARGET_EFAULT;
+ }
+ __put_user(host_ts->tv_sec, &target_ts->tv_sec);
+ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
+ unlock_user_struct(target_ts, target_addr, 1);
+ return 0;
+}
+
static inline abi_long copy_from_user_timezone(struct timezone *tz,
abi_ulong target_tz_addr)
{
@@ -4790,6 +4852,54 @@ static abi_long do_ioctl_kdsigaccept(const IOCTLEntry *ie, uint8_t *buf_temp,
return get_errno(safe_ioctl(fd, ie->host_cmd, sig));
}
+static abi_long do_ioctl_SIOCGSTAMP(const IOCTLEntry *ie, uint8_t *buf_temp,
+ int fd, int cmd, abi_long arg)
+{
+ struct timeval tv;
+ abi_long ret;
+
+ ret = get_errno(safe_ioctl(fd, SIOCGSTAMP, &tv));
+ if (is_error(ret)) {
+ return ret;
+ }
+
+ if (cmd == (int)TARGET_SIOCGSTAMP_OLD) {
+ if (copy_to_user_timeval(arg, &tv)) {
+ return -TARGET_EFAULT;
+ }
+ } else {
+ if (copy_to_user_timeval64(arg, &tv)) {
+ return -TARGET_EFAULT;
+ }
+ }
+
+ return ret;
+}
+
+static abi_long do_ioctl_SIOCGSTAMPNS(const IOCTLEntry *ie, uint8_t *buf_temp,
+ int fd, int cmd, abi_long arg)
+{
+ struct timespec ts;
+ abi_long ret;
+
+ ret = get_errno(safe_ioctl(fd, SIOCGSTAMPNS, &ts));
+ if (is_error(ret)) {
+ return ret;
+ }
+
+ if (cmd == (int)TARGET_SIOCGSTAMPNS_OLD) {
+ if (host_to_target_timespec(arg, &ts)) {
+ return -TARGET_EFAULT;
+ }
+ } else{
+ if (host_to_target_timespec64(arg, &ts)) {
+ return -TARGET_EFAULT;
+ }
+ }
+
+ return ret;
+}
+
#ifdef TIOCGPTPEER
static abi_long do_ioctl_tiocgptpeer(const IOCTLEntry *ie, uint8_t *buf_temp,
int fd, int cmd, abi_long arg)
@@ -6160,32 +6270,6 @@ static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1,
}
#endif
-static inline abi_long target_to_host_timespec(struct timespec *host_ts,
- abi_ulong target_addr)
-{
- struct target_timespec *target_ts;
-
- if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1))
- return -TARGET_EFAULT;
- __get_user(host_ts->tv_sec, &target_ts->tv_sec);
- __get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
- unlock_user_struct(target_ts, target_addr, 0);
- return 0;
-}
-
-static inline abi_long host_to_target_timespec(abi_ulong target_addr,
- struct timespec *host_ts)
-{
- struct target_timespec *target_ts;
-
- if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0))
- return -TARGET_EFAULT;
- __put_user(host_ts->tv_sec, &target_ts->tv_sec);
- __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
- unlock_user_struct(target_ts, target_addr, 1);
- return 0;
-}
-
static inline abi_long target_to_host_itimerspec(struct itimerspec *host_itspec,
abi_ulong target_addr)
{
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 12c84071..cfb3eeec 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -208,16 +208,34 @@ struct target_linger {
abi_int l_linger; /* How long to linger for */
};
+#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
+struct target_timeval {
+ abi_long tv_sec;
+ abi_int tv_usec;
+};
+#define target__kernel_sock_timeval target_timeval
+#else
struct target_timeval {
abi_long tv_sec;
abi_long tv_usec;
};
+struct target__kernel_sock_timeval {
+ abi_llong tv_sec;
+ abi_llong tv_usec;
+};
+#endif
+
struct target_timespec {
abi_long tv_sec;
abi_long tv_nsec;
};
+struct target__kernel_timespec {
+ abi_llong tv_sec;
+ abi_llong tv_nsec;
+};
+
struct target_timezone {
abi_int tz_minuteswest;
abi_int tz_dsttime;
@@ -743,8 +761,17 @@ struct target_pollfd {
#define TARGET_SIOCATMARK 0x8905
#define TARGET_SIOCGPGRP 0x8904
#endif
-#define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
-#define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
+
+#if defined(TARGET_SH4)
+#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval)
+#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec)
+#else
+#define TARGET_SIOCGSTAMP_OLD 0x8906
+#define TARGET_SIOCGSTAMPNS_OLD 0x8907
+#endif
+
+#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2])
+#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2])
/* Networking ioctls */
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index b98a23b0..4e369838 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -14,12 +14,6 @@ STRUCT(serial_icounter_struct,
STRUCT(sockaddr,
TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 14))
-STRUCT(timeval,
- MK_ARRAY(TYPE_LONG, 2))
-
-STRUCT(timespec,
- MK_ARRAY(TYPE_LONG, 2))
-
STRUCT(rtentry,
TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr),
TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID,

View File

@ -1,12 +0,0 @@
diff --git a/Makefile b/Makefile
index 04a0d450..e0013a59 100644
--- a/Makefile
+++ b/Makefile
@@ -803,6 +802,7 @@
$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
endif
ifdef CONFIG_TRACE_SYSTEMTAP
+ mkdir -p $(DESTDIR)$(bindir)
$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
endif
ifneq ($(BLOBS),)

View File

@ -1,135 +0,0 @@
Backport of QEMU v4.1 commit for stable v4.0.1 release
commit c87759ce876a7a0b17c2bf4f0b964bd51f0ee871
Author: Alex Williamson <address@hidden>
Date: Tue May 14 14:14:41 2019 -0600
q35: Revert to kernel irqchip
Commit b2fc91db8447 ("q35: set split kernel irqchip as default") changed
the default for the pc-q35-4.0 machine type to use split irqchip, which
turned out to have disasterous effects on vfio-pci INTx support. KVM
resampling irqfds are registered for handling these interrupts, but
these are non-functional in split irqchip mode. We can't simply test
for split irqchip in QEMU as userspace handling of this interrupt is a
significant performance regression versus KVM handling (GeForce GPUs
assigned to Windows VMs are non-functional without forcing MSI mode or
re-enabling kernel irqchip).
The resolution is to revert the change in default irqchip mode in the
pc-q35-4.1 machine and create a pc-q35-4.0.1 machine for the 4.0-stable
branch. The qemu-q35-4.0 machine type should not be used in vfio-pci
configurations for devices requiring legacy INTx support without
explicitly modifying the VM configuration to use kernel irqchip.
Link: https://bugs.launchpad.net/qemu/+bug/1826422
Fixes: b2fc91db8447 ("q35: set split kernel irqchip as default")
Cc: address@hidden
Reviewed-by: Peter Xu <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>
---
Same code as v1, just updating the commit log as a formal backport of
the merged 4.1 commit.
hw/core/machine.c | 3 +++
hw/i386/pc.c | 3 +++
hw/i386/pc_q35.c | 16 ++++++++++++++--
include/hw/boards.h | 3 +++
include/hw/i386/pc.h | 3 +++
5 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 743fef28982c..5d046a43e3d2 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -24,6 +24,9 @@
#include "hw/pci/pci.h"
#include "hw/mem/nvdimm.h"
+GlobalProperty hw_compat_4_0[] = {};
+const size_t hw_compat_4_0_len = G_N_ELEMENTS(hw_compat_4_0);
+
GlobalProperty hw_compat_3_1[] = {
{ "pcie-root-port", "x-speed", "2_5" },
{ "pcie-root-port", "x-width", "1" },
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f2c15bf1f2c3..d98b737b8f3b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -115,6 +115,9 @@ struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
/* Physical Address of PVH entry point read from kernel ELF NOTE */
static size_t pvh_start_addr;
+GlobalProperty pc_compat_4_0[] = {};
+const size_t pc_compat_4_0_len = G_N_ELEMENTS(pc_compat_4_0);
+
GlobalProperty pc_compat_3_1[] = {
{ "intel-iommu", "dma-drain", "off" },
{ "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" },
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 372c6b73bebd..45cc29d1adb7 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -357,7 +357,7 @@ static void pc_q35_machine_options(MachineClass *m)
m->units_per_default_bus = 1;
m->default_machine_opts = "firmware=bios-256k.bin";
m->default_display = "std";
- m->default_kernel_irqchip_split = true;
+ m->default_kernel_irqchip_split = false;
m->no_floppy = 1;
machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
@@ -365,12 +365,24 @@ static void pc_q35_machine_options(MachineClass *m)
m->max_cpus = 288;
}
-static void pc_q35_4_0_machine_options(MachineClass *m)
+static void pc_q35_4_0_1_machine_options(MachineClass *m)
{
pc_q35_machine_options(m);
m->alias = "q35";
}
+DEFINE_Q35_MACHINE(v4_0_1, "pc-q35-4.0.1", NULL,
+ pc_q35_4_0_1_machine_options);
+
+static void pc_q35_4_0_machine_options(MachineClass *m)
+{
+ pc_q35_4_0_1_machine_options(m);
+ m->default_kernel_irqchip_split = true;
+ m->alias = NULL;
+ compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
+ compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
+}
+
DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,
pc_q35_4_0_machine_options);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index e231860666a1..fe1885cbffa0 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -293,6 +293,9 @@ struct MachineState {
} \
type_init(machine_initfn##_register_types)
+extern GlobalProperty hw_compat_4_0[];
+extern const size_t hw_compat_4_0_len;
+
extern GlobalProperty hw_compat_3_1[];
extern const size_t hw_compat_3_1_len;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index ca65ef18afb4..43df7230a22b 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -293,6 +293,9 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
int e820_get_num_entries(void);
bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
+extern GlobalProperty pc_compat_4_0[];
+extern const size_t pc_compat_4_0_len;
+
extern GlobalProperty pc_compat_3_1[];
extern const size_t pc_compat_3_1_len;

View File

@ -1,32 +0,0 @@
linux-user: Sanitize interp_info and, for mips
Sanitize interp_info structure in load_elf_binary() and, for mips only,
init its field fp_abi. This fixes appearances of "Unexpected FPU mode"
message in some MIPS use cases.
Signed-off-by: Daniel Santos <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
---
linux-user/elfload.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index c1a2602..7f09d57 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
char *elf_interpreter = NULL;
char *scratch;
+ memset(&interp_info, 0, sizeof(interp_info));
+#ifdef TARGET_MIPS
+ interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN;
+#endif
+
info->start_mmap = (abi_ulong)ELF_START_MMAP;
load_elf_image(bprm->filename, bprm->fd, info,
--
2.7.4

View File

@ -1,38 +0,0 @@
From cef396dc0b11a09ede85b275ed1ceee71b60a4b3 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sat, 14 Sep 2019 15:47:20 +0100
Subject: [PATCH] configure: Add xkbcommon configure options
This dependency is currently "automagic", which is bad for distributions.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
configure | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configure b/configure
index 30aad233d1..30544f52e6 100755
--- a/configure
+++ b/configure
@@ -1521,6 +1521,10 @@ for opt do
;;
--disable-libpmem) libpmem=no
;;
+ --enable-xkbcommon) xkbcommon=yes
+ ;;
+ --disable-xkbcommon) xkbcommon=no
+ ;;
*)
echo "ERROR: unknown option $opt"
echo "Try '$0 --help' for more information"
@@ -1804,6 +1808,7 @@ disabled with --disable-FEATURE, default is enabled if available:
capstone capstone disassembler support
debug-mutex mutex debugging support
libpmem libpmem support
+ xkbcommon xkbcommon support
NOTE: The object files are built at the place where configure is launched
EOF
--
2.23.0

View File

@ -1,16 +0,0 @@
diff --git i/configure w/configure
index a72a5def57..546d757603 100755
--- i/configure
+++ w/configure
@@ -6093,10 +6093,6 @@ write_c_skeleton
if test "$gcov" = "yes" ; then
QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
-elif test "$fortify_source" = "yes" ; then
- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
- CFLAGS="-O2 $CFLAGS"
fi
if test "$have_asan" = "yes"; then

View File

@ -1,50 +0,0 @@
https://lists.nongnu.org/archive/html/qemu-devel/2020-04/msg02643.html
From 6bce23d8daf96a7faa9288e7414948cda31ddaa2 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Thu, 16 Apr 2020 18:55:49 +0100
Subject: [PATCH] linux-user/strace.list: fix epoll_create{,1} -strace output
Fix syscall name and parameters priinter.
Before the change:
```
$ alpha-linux-user/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ /tmp/a
...
1274697 %s(%d)(2097152,274903156744,274903156760,274905840712,274877908880,274903235616) = 3
1274697 exit_group(0)
```
After the change:
```
$ alpha-linux-user/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ /tmp/a
...
1273719 epoll_create1(2097152) = 3
1273719 exit_group(0)
```
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
linux-user/strace.list | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -125,10 +125,10 @@
{ TARGET_NR_dup3, "dup3" , "%s(%d,%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_create
-{ TARGET_NR_epoll_create, "%s(%d)", NULL, NULL, NULL },
+{ TARGET_NR_epoll_create, "epoll_create", "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_create1
-{ TARGET_NR_epoll_create1, "%s(%d)", NULL, NULL, NULL },
+{ TARGET_NR_epoll_create1, "epoll_create1", "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_ctl
{ TARGET_NR_epoll_ctl, "epoll_ctl" , NULL, NULL, NULL },
--
2.26.2

View File

@ -0,0 +1,40 @@
-Wall -Wextra compains about unused arguments,
causes safe-stack to be mis-detected.
--- a/configure
+++ b/configure
@@ -2293,7 +2293,7 @@ fi
cat > $TMPC << EOF
#include <stdint.h>
#include <stdio.h>
-int main(int argc, char *argv[]) {
+int main(void) {
return printf("%zu", SIZE_MAX);
}
EOF
@@ -4911,7 +4911,7 @@ fi
if test "$safe_stack" = "yes"; then
cat > $TMPC << EOF
-int main(int argc, char *argv[])
+int main(void)
{
#if ! __has_feature(safe_stack)
#error SafeStack Disabled
@@ -4933,7 +4933,7 @@ EOF
fi
else
cat > $TMPC << EOF
-int main(int argc, char *argv[])
+int main(void)
{
#if defined(__has_feature)
#if __has_feature(safe_stack)
@@ -5283,7 +5283,7 @@ static const int Z = 1;
#define TAUT(X) ((X) == Z)
#define PAREN(X, Y) (X == Y)
#define ID(X) (X)
-int main(int argc, char *argv[])
+int main(void)
{
int x = 0, y = 0;
x = ID(x);

View File

@ -0,0 +1,25 @@
Do not use system's 'qemu-keymap' in native case.
--- a/meson.build
+++ b/meson.build
@@ -337,6 +337,8 @@ if 'CONFIG_LIBCAP_NG' in config_host
endif
if get_option('xkbcommon').auto() and not have_system and not have_tools
xkbcommon = not_found
+elif get_option('xkbcommon').disabled()
+ xkbcommon = not_found
else
xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
method: 'pkg-config', static: enable_static)
--- a/pc-bios/keymaps/meson.build
+++ b/pc-bios/keymaps/meson.build
@@ -33,7 +33,9 @@ keymaps = {
'tr': '-l tr',
}
-if meson.is_cross_build() or 'CONFIG_XKBCOMMON' not in config_host
+if meson.is_cross_build()
native_qemu_keymap = find_program('qemu-keymap', required: false, disabler: true)
+elif get_option('xkbcommon').disabled()
+ native_qemu_keymap = not_found
else
native_qemu_keymap = qemu_keymap

View File

@ -0,0 +1,16 @@
Se absolute filename in files like
/usr/share/qemu/firmware/50-edk2-x86_64-secure.json
Bug: https://bugs.gentoo.org/766743
Patch-by: Jannik Glückert
--- a/pc-bios/descriptors/meson.build
+++ b/pc-bios/descriptors/meson.build
@@ -8,7 +8,7 @@ foreach f: [
]
configure_file(input: files(f),
output: f,
- configuration: {'DATADIR': qemu_datadir},
+ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
install: get_option('install_blobs'),
install_dir: qemu_datadir / 'firmware')
endforeach

View File

@ -0,0 +1,73 @@
From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Mon, 14 Dec 2020 16:09:38 +0100
Subject: [PATCH] build: -no-pie is no functional linker flag
Recent binutils changes dropping unsupported options [1] caused a build
issue in regard to the optionroms.
ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
-s -o multiboot.img multiboot.o
ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
This isn't really a regression in ld.bfd, filing the bug upstream
revealed that this never worked as a ld flag [2] - in fact it seems we
were by accident setting --nmagic).
Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
in .mak, therefore we can also remove it from being added there.
[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 3 ---
pc-bios/optionrom/Makefile | 1 -
2 files changed, 4 deletions(-)
--- a/configure
+++ b/configure
@@ -2137,7 +2137,6 @@ EOF
# Check we support --no-pie first; we will need this for building ROMs.
if compile_prog "-Werror -fno-pie" "-no-pie"; then
CFLAGS_NOPIE="-fno-pie"
- LDFLAGS_NOPIE="-no-pie"
fi
if test "$static" = "yes"; then
@@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
fi
elif test "$pie" = "no"; then
CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
- CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
@@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 084fc10f05..30771f8d17 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
LD_I386_EMULATION ?= elf_i386
override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
-override LDFLAGS += $(LDFLAGS_NOPIE)
all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
--
2.30.0

View File

@ -0,0 +1,23 @@
https://bugs.gentoo.org/759310
--- a/configure
+++ b/configure
@@ -521,6 +521,7 @@ ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}"
nm="${NM-${cross_prefix}nm}"
strip="${STRIP-${cross_prefix}strip}"
+strings="${STRINGS-${cross_prefix}strings}"
windres="${WINDRES-${cross_prefix}windres}"
pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
query_pkg_config() {
@@ -2265,9 +2266,9 @@ int main(int argc, char *argv[]) {
EOF
if compile_object ; then
- if strings -a $TMPO | grep -q BiGeNdIaN ; then
+ if $strings -a $TMPO | grep -q BiGeNdIaN ; then
bigendian="yes"
- elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
+ elif $strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
bigendian="no"
else
echo big/little test failed

View File

@ -0,0 +1,17 @@
Set absolute filename in files like
/usr/share/qemu/firmware/50-edk2-x86_64-secure.json
Bug: https://bugs.gentoo.org/766743
Bug: https://bugs.launchpad.net/qemu/+bug/1913012
Patch-by: Jannik Glückert
--- a/pc-bios/descriptors/meson.build
+++ b/pc-bios/descriptors/meson.build
@@ -9,7 +9,7 @@ if install_edk2_blobs
]
configure_file(input: files(f),
output: f,
- configuration: {'DATADIR': qemu_datadir},
+ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
install: get_option('install_blobs'),
install_dir: qemu_datadir / 'firmware')
endforeach

View File

@ -18,7 +18,7 @@
<flag name="aio">Enables support for Linux's Async IO</flag> <flag name="aio">Enables support for Linux's Async IO</flag>
<flag name="alsa">Enable alsa output for sound emulation</flag> <flag name="alsa">Enable alsa output for sound emulation</flag>
<flag name="capstone">Enable disassembly support with <pkg>dev-libs/capstone</pkg></flag> <flag name="capstone">Enable disassembly support with <pkg>dev-libs/capstone</pkg></flag>
<flag name="curl">Support ISOs / -cdrom directives vis HTTP or HTTPS.</flag> <flag name="curl">Support ISOs / -cdrom directives via HTTP or HTTPS.</flag>
<flag name="fdt">Enables firmware device tree support</flag> <flag name="fdt">Enables firmware device tree support</flag>
<flag name="glusterfs">Enables GlusterFS cluster fileystem via <flag name="glusterfs">Enables GlusterFS cluster fileystem via
<pkg>sys-cluster/glusterfs</pkg></flag> <pkg>sys-cluster/glusterfs</pkg></flag>
@ -28,6 +28,9 @@
<flag name="iscsi">Enable direct iSCSI support via <flag name="iscsi">Enable direct iSCSI support via
<pkg>net-libs/libiscsi</pkg> instead of indirectly via the Linux <pkg>net-libs/libiscsi</pkg> instead of indirectly via the Linux
block layer that <pkg>sys-block/open-iscsi</pkg> does.</flag> block layer that <pkg>sys-block/open-iscsi</pkg> does.</flag>
<flag name="io-uring">Enable efficient I/O via <pkg>sys-libs/liburing</pkg>.</flag>
<flag name="multipath">Enable multipath persistent reservation passthrough via
<pkg>sys-fs/multipath-tools</pkg>.</flag>
<flag name="ncurses">Enable the ncurses-based console</flag> <flag name="ncurses">Enable the ncurses-based console</flag>
<flag name="nfs">Enable NFS support</flag> <flag name="nfs">Enable NFS support</flag>
<flag name="numa">Enable NUMA support</flag> <flag name="numa">Enable NUMA support</flag>
@ -39,12 +42,12 @@
<flag name="rbd">Enable rados block device backend support, see http://ceph.newdream.net/wiki/QEMU-RBD</flag> <flag name="rbd">Enable rados block device backend support, see http://ceph.newdream.net/wiki/QEMU-RBD</flag>
<flag name="sdl">Enable the SDL-based console</flag> <flag name="sdl">Enable the SDL-based console</flag>
<flag name="sdl-image">SDL Image support for icons</flag> <flag name="sdl-image">SDL Image support for icons</flag>
<flag name="slirp">Enable TCP/IP in hypervisor via <pkg>net-libs/libslirp</pkg></flag>
<flag name="spice">Enable Spice protocol support via <pkg>app-emulation/spice</pkg></flag> <flag name="spice">Enable Spice protocol support via <pkg>app-emulation/spice</pkg></flag>
<flag name="ssh">Enable SSH based block device support via <pkg>net-libs/libssh2</pkg></flag> <flag name="ssh">Enable SSH based block device support via <pkg>net-libs/libssh2</pkg></flag>
<flag name="static-user">Build the User targets as static binaries</flag> <flag name="static-user">Build the User targets as static binaries</flag>
<flag name="static">Build the User and Software MMU (system) targets as well as tools as static binaries</flag> <flag name="static">Build the User and Software MMU (system) targets as well as tools as static binaries</flag>
<flag name="systemtap">Enable SystemTAP/DTrace tracing</flag> <flag name="systemtap">Enable SystemTAP/DTrace tracing</flag>
<flag name="tci">Enable the TCG Interpreter which can speed up or slowdown workloads depending on the host and guest CPUs being emulated. In the future it will be a runtime option but for now its compile time.</flag>
<flag name="jemalloc">Enable jemalloc allocator support</flag> <flag name="jemalloc">Enable jemalloc allocator support</flag>
<flag name="jpeg">Enable jpeg image support for the VNC console server</flag> <flag name="jpeg">Enable jpeg image support for the VNC console server</flag>
<flag name="png">Enable png image support for the VNC console server</flag> <flag name="png">Enable png image support for the VNC console server</flag>
@ -57,11 +60,9 @@
<flag name="virtfs">Enable VirtFS via virtio-9p-pci / fsdev. See http://wiki.qemu.org/Documentation/9psetup</flag> <flag name="virtfs">Enable VirtFS via virtio-9p-pci / fsdev. See http://wiki.qemu.org/Documentation/9psetup</flag>
<flag name="vte">Enable terminal support (<pkg>x11-libs/vte</pkg>) in the GTK+ interface</flag> <flag name="vte">Enable terminal support (<pkg>x11-libs/vte</pkg>) in the GTK+ interface</flag>
<flag name="xattr">Add support for getting and setting POSIX extended attributes, through <flag name="xattr">Add support for getting and setting POSIX extended attributes, through
<pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend. <pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.</flag>
</flag>
<flag name="xen">Enables support for Xen backends</flag> <flag name="xen">Enables support for Xen backends</flag>
<flag name="xfs">Support xfsctl() notification and syncing for XFS backed <flag name="xfs">Support xfsctl() notification and syncing for XFS backed
virtual disks.</flag> virtual disks.</flag>
<flag name="xkb">Depend on x11-libs/libxkbcommon to build qemu-keymap tool for converting xkb keymaps</flag>
</use> </use>
</pkgmetadata> </pkgmetadata>

View File

@ -1,13 +1,11 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI="7" EAPI="7"
PYTHON_COMPAT=( python{3_6,3_7} ) PYTHON_COMPAT=( python3_{7,8,9} )
PYTHON_REQ_USE="ncurses,readline" PYTHON_REQ_USE="ncurses,readline"
PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
FIRMWARE_ABI_VERSION="4.0.0-r50" FIRMWARE_ABI_VERSION="4.0.0-r50"
inherit eutils linux-info toolchain-funcs multilib python-r1 \ inherit eutils linux-info toolchain-funcs multilib python-r1 \
@ -16,15 +14,16 @@ inherit eutils linux-info toolchain-funcs multilib python-r1 \
if [[ ${PV} = *9999* ]]; then if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://git.qemu.org/git/qemu.git" EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
EGIT_SUBMODULES=( EGIT_SUBMODULES=(
slirp meson
tests/fp/berkeley-{test,soft}float-3 tests/fp/berkeley-softfloat-3
tests/fp/berkeley-testfloat-3
ui/keycodemapdb ui/keycodemapdb
) )
inherit git-r3 inherit git-r3
SRC_URI="" SRC_URI=""
else else
SRC_URI="https://download.qemu.org/${P}.tar.xz" SRC_URI="https://download.qemu.org/${P}.tar.xz"
KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86" KEYWORDS="amd64 arm64 ~ppc ~ppc64 x86"
fi fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@ -35,18 +34,20 @@ SLOT="0"
IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+fdt glusterfs gnutls gtk infiniband iscsi io-uring +fdt glusterfs gnutls gtk infiniband iscsi io-uring
jemalloc +jpeg kernel_linux jack jemalloc +jpeg kernel_linux
kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs kernel_FreeBSD lzo multipath
ncurses nfs nls numa opengl +oss +pin-upstream-blobs
plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
smartcard snappy spice ssh static static-user systemtap tci test usb +slirp
smartcard snappy spice ssh static static-user systemtap test udev usb
usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
xfs +xkb zstd" xfs zstd"
COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb" sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
lm32 moxie rx tricore unicore32" avr lm32 moxie rx tricore unicore32"
IUSE_USER_TARGETS="${COMMON_TARGETS} IUSE_USER_TARGETS="${COMMON_TARGETS}
aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
tilegx" tilegx"
@ -66,10 +67,12 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}
qemu_softmmu_targets_ppc? ( fdt ) qemu_softmmu_targets_ppc? ( fdt )
qemu_softmmu_targets_riscv32? ( fdt ) qemu_softmmu_targets_riscv32? ( fdt )
qemu_softmmu_targets_riscv64? ( fdt ) qemu_softmmu_targets_riscv64? ( fdt )
static? ( static-user !alsa !gtk !opengl !pulseaudio !plugins !rbd !snappy ) static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy )
static-user? ( !plugins ) static-user? ( !plugins )
virtfs? ( xattr ) vhost-user-fs? ( caps seccomp )
virtfs? ( caps xattr )
vte? ( gtk ) vte? ( gtk )
multipath? ( udev )
plugins? ( !static !static-user ) plugins? ( !static !static-user )
" "
@ -92,7 +95,6 @@ ALL_DEPEND="
# softmmu targets (qemu-system-*). # softmmu targets (qemu-system-*).
SOFTMMU_TOOLS_DEPEND=" SOFTMMU_TOOLS_DEPEND="
dev-libs/libxml2[static-libs(+)] dev-libs/libxml2[static-libs(+)]
xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
>=x11-libs/pixman-0.28.0[static-libs(+)] >=x11-libs/pixman-0.28.0[static-libs(+)]
accessibility? ( accessibility? (
app-accessibility/brltty[api] app-accessibility/brltty[api]
@ -120,10 +122,12 @@ SOFTMMU_TOOLS_DEPEND="
sys-fabric/librdmacm:=[static-libs(+)] sys-fabric/librdmacm:=[static-libs(+)]
) )
iscsi? ( net-libs/libiscsi ) iscsi? ( net-libs/libiscsi )
io-uring? ( sys-libs/liburing[static-libs(+)] ) io-uring? ( sys-libs/liburing:=[static-libs(+)] )
jack? ( virtual/jack )
jemalloc? ( dev-libs/jemalloc ) jemalloc? ( dev-libs/jemalloc )
jpeg? ( virtual/jpeg:0=[static-libs(+)] ) jpeg? ( virtual/jpeg:0=[static-libs(+)] )
lzo? ( dev-libs/lzo:2[static-libs(+)] ) lzo? ( dev-libs/lzo:2[static-libs(+)] )
multipath? ( sys-fs/multipath-tools )
ncurses? ( ncurses? (
sys-libs/ncurses:0=[unicode] sys-libs/ncurses:0=[unicode]
sys-libs/ncurses:0=[static-libs(+)] sys-libs/ncurses:0=[static-libs(+)]
@ -146,6 +150,7 @@ SOFTMMU_TOOLS_DEPEND="
) )
sdl-image? ( media-libs/sdl2-image[static-libs(+)] ) sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] ) seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
slirp? ( net-libs/libslirp[static-libs(+)] )
smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] ) smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
snappy? ( app-arch/snappy:= ) snappy? ( app-arch/snappy:= )
spice? ( spice? (
@ -153,6 +158,7 @@ SOFTMMU_TOOLS_DEPEND="
>=app-emulation/spice-0.12.0[static-libs(+)] >=app-emulation/spice-0.12.0[static-libs(+)]
) )
ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] ) ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
udev? ( virtual/libudev[static-libs(+)] )
usb? ( >=virtual/libusb-1-r2[static-libs(+)] ) usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] ) usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
vde? ( net-misc/vde[static-libs(+)] ) vde? ( net-misc/vde[static-libs(+)] )
@ -166,17 +172,17 @@ SOFTMMU_TOOLS_DEPEND="
X86_FIRMWARE_DEPEND=" X86_FIRMWARE_DEPEND="
pin-upstream-blobs? ( pin-upstream-blobs? (
~sys-firmware/edk2-ovmf-201905[binary] ~sys-firmware/edk2-ovmf-201905[binary]
~sys-firmware/ipxe-1.0.0_p20190728[binary] ~sys-firmware/ipxe-1.0.0_p20190728[binary,qemu]
~sys-firmware/seabios-1.12.0[binary,seavgabios] ~sys-firmware/seabios-1.12.0[binary,seavgabios]
~sys-firmware/sgabios-0.1_pre8[binary] ~sys-firmware/sgabios-0.1_pre8[binary]
) )
!pin-upstream-blobs? ( !pin-upstream-blobs? (
sys-firmware/edk2-ovmf sys-firmware/edk2-ovmf
sys-firmware/ipxe sys-firmware/ipxe[qemu]
>=sys-firmware/seabios-1.10.2[seavgabios] >=sys-firmware/seabios-1.10.2[seavgabios]
sys-firmware/sgabios sys-firmware/sgabios
)" )"
PPC64_FIRMWARE_DEPEND=" PPC_FIRMWARE_DEPEND="
pin-upstream-blobs? ( pin-upstream-blobs? (
~sys-firmware/seabios-1.12.0[binary,seavgabios] ~sys-firmware/seabios-1.12.0[binary,seavgabios]
) )
@ -204,7 +210,8 @@ CDEPEND="
) )
qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} ) qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} ) qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} ) qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
" "
DEPEND="${CDEPEND} DEPEND="${CDEPEND}
kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 ) kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
@ -219,9 +226,11 @@ RDEPEND="${CDEPEND}
PATCHES=( PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902 "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-4.2.0-cflags.patch "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-5.0.0-epoll-strace.patch "${FILESDIR}"/${PN}-5.2.0-strings.patch
"${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
"${FILESDIR}"/${PN}-5.2.0-no-pie-ld.patch
) )
QA_PREBUILT=" QA_PREBUILT="
@ -229,10 +238,13 @@ QA_PREBUILT="
usr/share/qemu/openbios-ppc usr/share/qemu/openbios-ppc
usr/share/qemu/openbios-sparc64 usr/share/qemu/openbios-sparc64
usr/share/qemu/openbios-sparc32 usr/share/qemu/openbios-sparc32
usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
usr/share/qemu/palcode-clipper usr/share/qemu/palcode-clipper
usr/share/qemu/s390-ccw.img usr/share/qemu/s390-ccw.img
usr/share/qemu/s390-netboot.img usr/share/qemu/s390-netboot.img
usr/share/qemu/u-boot.e500" usr/share/qemu/u-boot.e500
"
QA_WX_LOAD="usr/bin/qemu-i386 QA_WX_LOAD="usr/bin/qemu-i386
usr/bin/qemu-x86_64 usr/bin/qemu-x86_64
@ -255,7 +267,8 @@ QA_WX_LOAD="usr/bin/qemu-i386
usr/bin/qemu-armeb usr/bin/qemu-armeb
usr/bin/qemu-sparc32plus usr/bin/qemu-sparc32plus
usr/bin/qemu-s390x usr/bin/qemu-s390x
usr/bin/qemu-unicore32" usr/bin/qemu-unicore32
"
DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
kernel module loaded before running kvm. The easiest way to ensure that the kernel module loaded before running kvm. The easiest way to ensure that the
@ -280,7 +293,7 @@ For systemd:
pkg_pretend() { pkg_pretend() {
if use kernel_linux && kernel_is lt 2 6 25; then if use kernel_linux && kernel_is lt 2 6 25; then
eerror "This version of KVM requres a host kernel of 2.6.25 or higher." eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
elif use kernel_linux; then elif use kernel_linux; then
if ! linux_config_exists; then if ! linux_config_exists; then
eerror "Unable to check your kernel for KVM support" eerror "Unable to check your kernel for KVM support"
@ -330,7 +343,7 @@ check_targets() {
local var=$1 mak=$2 local var=$1 mak=$2
local detected sorted local detected sorted
pushd "${S}"/default-configs >/dev/null || die pushd "${S}"/default-configs/targets/ >/dev/null || die
# Force C locale until glibc is updated. #564936 # Force C locale until glibc is updated. #564936
detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u)) detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
@ -345,29 +358,6 @@ check_targets() {
popd >/dev/null popd >/dev/null
} }
handle_locales() {
# Make sure locale list is kept up-to-date.
local detected sorted
detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
if [[ ${sorted} != "${detected}" ]] ; then
eerror "The ebuild needs to be kept in sync."
eerror "PLOCALES: ${sorted}"
eerror " po/*.po: ${detected}"
die "sync PLOCALES"
fi
# Deal with selective install of locales.
if use nls ; then
# Delete locales the user does not want. #577814
rm_loc() { rm po/$1.po || die; }
l10n_for_each_disabled_locale_do rm_loc
else
# Cheap hack to disable gettext .mo generation.
rm -f po/*.po
fi
}
src_prepare() { src_prepare() {
check_targets IUSE_SOFTMMU_TARGETS softmmu check_targets IUSE_SOFTMMU_TARGETS softmmu
check_targets IUSE_USER_TARGETS linux-user check_targets IUSE_USER_TARGETS linux-user
@ -375,15 +365,12 @@ src_prepare() {
default default
# Use correct toolchain to fix cross-compiling # Use correct toolchain to fix cross-compiling
tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
export WINDRES=${CHOST}-windres export WINDRES=${CHOST}-windres
# Verbose builds # Verbose builds
MAKEOPTS+=" V=1" MAKEOPTS+=" V=1"
# Run after we've applied all patches.
handle_locales
# Remove bundled copy of libfdt # Remove bundled copy of libfdt
rm -r dtc || die rm -r dtc || die
} }
@ -408,11 +395,21 @@ qemu_src_configure() {
--datadir=/usr/share --datadir=/usr/share
--docdir=/usr/share/doc/${PF}/html --docdir=/usr/share/doc/${PF}/html
--mandir=/usr/share/man --mandir=/usr/share/man
--with-confsuffix=/qemu
--localstatedir=/var --localstatedir=/var
--disable-bsd-user --disable-bsd-user
--disable-containers # bug #732972
--disable-guest-agent --disable-guest-agent
--disable-strip --disable-strip
# bug #746752: TCG interpreter has a few limitations:
# - it does not support FPU
# - it's generally slower on non-self-modifying code
# It's advantage is support for host architectures
# where native codegeneration is not implemented.
# Gentoo has qemu keyworded only on targets with
# native code generation available. Avoid the interpreter.
--disable-tcg-interpreter
--disable-werror --disable-werror
# We support gnutls/nettle for crypto operations. It is possible # We support gnutls/nettle for crypto operations. It is possible
# to use gcrypt when gnutls/nettle are disabled (but not when they # to use gcrypt when gnutls/nettle are disabled (but not when they
@ -426,8 +423,8 @@ qemu_src_configure() {
$(use_enable debug debug-info) $(use_enable debug debug-info)
$(use_enable debug debug-tcg) $(use_enable debug debug-tcg)
$(use_enable doc docs) $(use_enable doc docs)
$(use_enable nls gettext)
$(use_enable plugins) $(use_enable plugins)
$(use_enable tci tcg-interpreter)
$(use_enable xattr attr) $(use_enable xattr attr)
) )
@ -440,6 +437,22 @@ qemu_src_configure() {
use_enable "$@" use_enable "$@"
fi fi
} }
# Enable option only for softmmu build, but not 'user' or 'tools'
conf_softmmu() {
if [[ ${buildtype} == "softmmu" ]] ; then
use_enable "$@"
else
echo "--disable-${2:-$1}"
fi
}
# Enable option only for tools build, but not 'user' or 'softmmu'
conf_tools() {
if [[ ${buildtype} == "tools" ]] ; then
use_enable "$@"
else
echo "--disable-${2:-$1}"
fi
}
conf_opts+=( conf_opts+=(
$(conf_notuser accessibility brlapi) $(conf_notuser accessibility brlapi)
$(conf_notuser aio linux-aio) $(conf_notuser aio linux-aio)
@ -459,6 +472,7 @@ qemu_src_configure() {
$(conf_notuser jpeg vnc-jpeg) $(conf_notuser jpeg vnc-jpeg)
$(conf_notuser kernel_linux kvm) $(conf_notuser kernel_linux kvm)
$(conf_notuser lzo) $(conf_notuser lzo)
$(conf_notuser multipath mpath)
$(conf_notuser ncurses curses) $(conf_notuser ncurses curses)
$(conf_notuser nfs libnfs) $(conf_notuser nfs libnfs)
$(conf_notuser numa) $(conf_notuser numa)
@ -467,17 +481,20 @@ qemu_src_configure() {
$(conf_notuser rbd) $(conf_notuser rbd)
$(conf_notuser sasl vnc-sasl) $(conf_notuser sasl vnc-sasl)
$(conf_notuser sdl) $(conf_notuser sdl)
$(conf_notuser sdl-image) $(conf_softmmu sdl-image)
$(conf_notuser seccomp) $(conf_notuser seccomp)
$(conf_notuser slirp slirp system)
$(conf_notuser smartcard) $(conf_notuser smartcard)
$(conf_notuser snappy) $(conf_notuser snappy)
$(conf_notuser spice) $(conf_notuser spice)
$(conf_notuser ssh libssh) $(conf_notuser ssh libssh)
$(conf_notuser udev libudev)
$(conf_notuser usb libusb) $(conf_notuser usb libusb)
$(conf_notuser usbredir usb-redir) $(conf_notuser usbredir usb-redir)
$(conf_notuser vde) $(conf_notuser vde)
$(conf_notuser vhost-net) $(conf_notuser vhost-net)
$(conf_notuser vhost-user-fs) $(conf_notuser vhost-user-fs)
$(conf_tools vhost-user-fs virtiofsd)
$(conf_notuser virgl virglrenderer) $(conf_notuser virgl virglrenderer)
$(conf_notuser virtfs) $(conf_notuser virtfs)
$(conf_notuser vnc) $(conf_notuser vnc)
@ -485,7 +502,8 @@ qemu_src_configure() {
$(conf_notuser xen) $(conf_notuser xen)
$(conf_notuser xen xen-pci-passthrough) $(conf_notuser xen xen-pci-passthrough)
$(conf_notuser xfs xfsctl) $(conf_notuser xfs xfsctl)
$(conf_notuser xkb xkbcommon) # use prebuilt keymaps, bug #759604
--disable-xkbcommon
$(conf_notuser zstd) $(conf_notuser zstd)
) )
@ -501,6 +519,7 @@ qemu_src_configure() {
# Note: backend order matters here: #716202 # Note: backend order matters here: #716202
# We iterate from higher-level to lower level. # We iterate from higher-level to lower level.
$(usex pulseaudio pa "") $(usex pulseaudio pa "")
$(usev jack)
$(usev sdl) $(usev sdl)
$(usev alsa) $(usev alsa)
$(usev oss) $(usev oss)
@ -554,6 +573,10 @@ qemu_src_configure() {
tc-enables-pie && conf_opts+=( --enable-pie ) tc-enables-pie && conf_opts+=( --enable-pie )
fi fi
# Plumb through equivalent of EXTRA_ECONF to allow experiments
# like bug #747928.
conf_opts+=( ${EXTRA_CONF_QEMU} )
echo "../configure ${conf_opts[*]}" echo "../configure ${conf_opts[*]}"
cd "${builddir}" cd "${builddir}"
../configure "${conf_opts[@]}" || die "configure failed" ../configure "${conf_opts[@]}" || die "configure failed"
@ -721,7 +744,7 @@ src_install() {
doins "${FILESDIR}/bridge.conf" doins "${FILESDIR}/bridge.conf"
cd "${S}" cd "${S}"
dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt dodoc MAINTAINERS docs/specs/pci-ids.txt
newdoc pc-bios/README README.pc-bios newdoc pc-bios/README README.pc-bios
# Disallow stripping of prebuilt firmware files. # Disallow stripping of prebuilt firmware files.
@ -743,8 +766,8 @@ src_install() {
rm "${ED}/usr/share/qemu/vgabios-stdvga.bin" rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
rm "${ED}/usr/share/qemu/vgabios-virtio.bin" rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
rm "${ED}/usr/share/qemu/vgabios-vmware.bin" rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
# PPC64 loads vgabios-stdvga # PPC/PPC64 loads vgabios-stdvga
if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin