summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/qemu/files')
-rw-r--r--app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch11
-rw-r--r--app-emulation/qemu/files/qemu-6.1.0-strings.patch26
-rw-r--r--app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch90
-rw-r--r--app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch94
-rw-r--r--app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch182
-rw-r--r--app-emulation/qemu/files/qemu-7.1.0-capstone-include-path.patch31
-rw-r--r--app-emulation/qemu/files/qemu-7.1.0-strings.patch26
-rw-r--r--app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch45
-rw-r--r--app-emulation/qemu/files/qemu-7.2.0-linux-headers-6.2-glibc-2.36.patch137
-rw-r--r--app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch29
-rw-r--r--app-emulation/qemu/files/qemu-8.0.0-make.patch13
-rw-r--r--app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch40
-rw-r--r--app-emulation/qemu/files/qemu-8.1.0-also-build-virtfs-proxy-helper.patch (renamed from app-emulation/qemu/files/qemu-7.0.0-also-build-virtfs-proxy-helper.patch)18
-rw-r--r--app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch10
-rw-r--r--app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch64
-rw-r--r--app-emulation/qemu/files/qemu-9.0.0-also-build-virtfs-proxy-helper.patch35
-rw-r--r--app-emulation/qemu/files/qemu-9.0.0-capstone-include-path.patch42
-rw-r--r--app-emulation/qemu/files/qemu-9.0.0-disable-keymap.patch44
18 files changed, 499 insertions, 438 deletions
diff --git a/app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch b/app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch
deleted file mode 100644
index d79570ebb8aa..000000000000
--- a/app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- qemu-2.11.1/include/disas/capstone.h 2018-02-14 22:53:22.000000000 +0100
-+++ qemu-2.11.1/include/disas/capstone.h 2018-02-17 20:12:12.754703951 +0100
-@@ -3,7 +3,7 @@
-
- #ifdef CONFIG_CAPSTONE
-
--#include <capstone.h>
-+#include <capstone/capstone.h>
-
- #else
-
diff --git a/app-emulation/qemu/files/qemu-6.1.0-strings.patch b/app-emulation/qemu/files/qemu-6.1.0-strings.patch
deleted file mode 100644
index 2efe7b29330a..000000000000
--- a/app-emulation/qemu/files/qemu-6.1.0-strings.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Forward-ported from original patch for 5.2.0.
-
-diff --git a/configure b/configure
-index da2501489f..4660ee3ee5 100755
---- a/configure
-+++ b/configure
-@@ -516,6 +516,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() {
-@@ -2380,9 +2381,9 @@ int main(int argc, char *argv[])
- EOF
-
- if compile_prog ; then
-- if strings -a $TMPE | grep -q BiGeNdIaN ; then
-+ if $strings -a $TMPE | grep -q BiGeNdIaN ; then
- bigendian="yes"
-- elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then
-+ elif $strings -a $TMPE | grep -q LiTtLeEnDiAn ; then
- bigendian="no"
- else
- echo big/little test failed
diff --git a/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch b/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch
deleted file mode 100644
index 85343c4d00e7..000000000000
--- a/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-https://lore.kernel.org/all/20220802183409.GB2040@redhat.com/T/
-https://bugs.gentoo.org/863443
-
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-To: qemu-devel@nongnu.org
-Cc: Laurent Vivier <laurent@vivier.eu>,
- =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Subject: [PATCH for 7.1] linux-user: fix compat with glibc >= 2.36 sys/mount.h
-Date: Tue, 2 Aug 2022 12:41:34 -0400
-
-The latest glibc 2.36 has extended sys/mount.h so that it
-defines the FSCONFIG_* enum constants. These are historically
-defined in linux/mount.h, and thus if you include both headers
-the compiler complains:
-
-In file included from /usr/include/linux/fs.h:19,
- from ../linux-user/syscall.c:98:
-/usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command'
- 95 | enum fsconfig_command {
- | ^~~~~~~~~~~~~~~~
-In file included from ../linux-user/syscall.c:31:
-/usr/include/sys/mount.h:189:6: note: originally defined here
- 189 | enum fsconfig_command
- | ^~~~~~~~~~~~~~~~
-/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG'
- 96 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
- | ^~~~~~~~~~~~~~~~~
-/usr/include/sys/mount.h:191:3: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command'
- 191 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
- | ^~~~~~~~~~~~~~~~~
-...snip...
-
-QEMU doesn't include linux/mount.h, but it does use
-linux/fs.h and thus gets linux/mount.h indirectly.
-
-glibc acknowledges this problem but does not appear to
-be intending to fix it in the forseeable future, simply
-documenting it as a known incompatibility with no
-workaround:
-
- https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
- https://sourceware.org/glibc/wiki/Synchronizing_Headers
-
-To address this requires either removing use of sys/mount.h
-or linux/fs.h, despite QEMU needing declarations from
-both.
-
-This patch removes linux/fs.h, meaning we have to define
-various FS_IOC constants that are now unavailable.
-
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -95,7 +95,25 @@
- #include <linux/soundcard.h>
- #include <linux/kd.h>
- #include <linux/mtio.h>
-+
-+#ifdef HAVE_SYS_MOUNT_FSCONFIG
-+/*
-+ * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h,
-+ * which in turn prevents use of linux/fs.h. So we have to
-+ * define the constants ourselves for now.
-+ */
-+#define FS_IOC_GETFLAGS _IOR('f', 1, long)
-+#define FS_IOC_SETFLAGS _IOW('f', 2, long)
-+#define FS_IOC_GETVERSION _IOR('v', 1, long)
-+#define FS_IOC_SETVERSION _IOW('v', 2, long)
-+#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
-+#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
-+#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
-+#define FS_IOC32_GETVERSION _IOR('v', 1, int)
-+#define FS_IOC32_SETVERSION _IOW('v', 2, int)
-+#else
- #include <linux/fs.h>
-+#endif
- #include <linux/fd.h>
- #if defined(CONFIG_FIEMAP)
- #include <linux/fiemap.h>
---- a/meson.build
-+++ b/meson.build
-@@ -1963,6 +1963,8 @@ config_host_data.set('HAVE_OPTRESET',
- cc.has_header_symbol('getopt.h', 'optreset'))
- config_host_data.set('HAVE_IPPROTO_MPTCP',
- cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
-+config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG',
-+ cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG'))
-
- # has_member
- config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
diff --git a/app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch b/app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch
deleted file mode 100644
index 767f66243fcc..000000000000
--- a/app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-https://bugs.gentoo.org/849587
-https://bugzilla.opensuse.org/show_bug.cgi?id=1199924
-https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg06183.html
-
-From qemu-devel Tue May 31 11:47:07 2022
-From: Claudio Fontana <cfontana () suse ! de>
-Date: Tue, 31 May 2022 11:47:07 +0000
-To: qemu-devel
-Subject: [PATCH] pci: fix overflow in snprintf string formatting
-Message-Id: <20220531114707.18830-1-cfontana () suse ! de>
-X-MARC-Message: https://marc.info/?l=qemu-devel&m=165399772310578
-
-the code in pcibus_get_fw_dev_path contained the potential for a
-stack buffer overflow of 1 byte, potentially writing to the stack an
-extra NUL byte.
-
-This overflow could happen if the PCI slot is >= 0x10000000,
-and the PCI function is >= 0x10000000, due to the size parameter
-of snprintf being incorrectly calculated in the call:
-
- if (PCI_FUNC(d->devfn))
- snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn));
-
-since the off obtained from a previous call to snprintf is added
-instead of subtracted from the total available size of the buffer.
-
-Without the accurate size guard from snprintf, we end up writing in the
-worst case:
-
-name (32) + "@" (1) + SLOT (8) + "," (1) + FUNC (8) + term NUL (1) = 51 bytes
-
-In order to provide something more robust, replace all of the code in
-pcibus_get_fw_dev_path with a single call to g_strdup_printf,
-so there is no need to rely on manual calculations.
-
-Found by compiling QEMU with FORTIFY_SOURCE=3 as the error:
-
-*** buffer overflow detected ***: terminated
-
-Thread 1 "qemu-system-x86" received signal SIGABRT, Aborted.
-[Switching to Thread 0x7ffff642c380 (LWP 121307)]
-0x00007ffff71ff55c in __pthread_kill_implementation () from /lib64/libc.so.6
-(gdb) bt
- #0 0x00007ffff71ff55c in __pthread_kill_implementation () at /lib64/libc.so.6
- #1 0x00007ffff71ac6f6 in raise () at /lib64/libc.so.6
- #2 0x00007ffff7195814 in abort () at /lib64/libc.so.6
- #3 0x00007ffff71f279e in __libc_message () at /lib64/libc.so.6
- #4 0x00007ffff729767a in __fortify_fail () at /lib64/libc.so.6
- #5 0x00007ffff7295c36 in () at /lib64/libc.so.6
- #6 0x00007ffff72957f5 in __snprintf_chk () at /lib64/libc.so.6
- #7 0x0000555555b1c1fd in pcibus_get_fw_dev_path ()
- #8 0x0000555555f2bde4 in qdev_get_fw_dev_path_helper.constprop ()
- #9 0x0000555555f2bd86 in qdev_get_fw_dev_path_helper.constprop ()
- #10 0x00005555559a6e5d in get_boot_device_path ()
- #11 0x00005555559a712c in get_boot_devices_list ()
- #12 0x0000555555b1a3d0 in fw_cfg_machine_reset ()
- #13 0x0000555555bf4c2d in pc_machine_reset ()
- #14 0x0000555555c66988 in qemu_system_reset ()
- #15 0x0000555555a6dff6 in qdev_machine_creation_done ()
- #16 0x0000555555c79186 in qmp_x_exit_preconfig.part ()
- #17 0x0000555555c7b459 in qemu_init ()
- #18 0x0000555555960a29 in main ()
-
-Found-by: Dario Faggioli <Dario Faggioli <dfaggioli@suse.com>
-Found-by: Martin Liška <martin.liska@suse.com>
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Claudio Fontana <cfontana@suse.de>
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -2640,15 +2640,15 @@ static char *pci_dev_fw_name(DeviceState *dev, char *buf, int len)
- static char *pcibus_get_fw_dev_path(DeviceState *dev)
- {
- PCIDevice *d = (PCIDevice *)dev;
-- char path[50], name[33];
-- int off;
--
-- off = snprintf(path, sizeof(path), "%s@%x",
-- pci_dev_fw_name(dev, name, sizeof name),
-- PCI_SLOT(d->devfn));
-- if (PCI_FUNC(d->devfn))
-- snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn));
-- return g_strdup(path);
-+ char name[33];
-+ int has_func = !!PCI_FUNC(d->devfn);
-+
-+ return g_strdup_printf("%s@%x%s%.*x",
-+ pci_dev_fw_name(dev, name, sizeof(name)),
-+ PCI_SLOT(d->devfn),
-+ has_func ? "," : "",
-+ has_func,
-+ PCI_FUNC(d->devfn));
- }
-
- static char *pcibus_get_dev_path(DeviceState *dev)
diff --git a/app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch b/app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch
deleted file mode 100644
index 9ec6ede80896..000000000000
--- a/app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-https://bugs.gentoo.org/849500
-https://gitlab.com/qemu-project/qemu/-/commit/2f743ef6366c2df4ef51ef3ae318138cdc0125ab.patch
-https://gitlab.com/qemu-project/qemu/-/commit/38738f7dbbda90fbc161757b7f4be35b52205552.patch
-
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 27 Apr 2022 15:35:36 +0100
-Subject: [PATCH] virtio-scsi: fix ctrl and event handler functions in
- dataplane mode
-
-Commit f34e8d8b8d48d73f36a67b6d5e492ef9784b5012 ("virtio-scsi: prepare
-virtio_scsi_handle_cmd for dataplane") prepared the virtio-scsi cmd
-virtqueue handler function to be used in both the dataplane and
-non-datpalane code paths.
-
-It failed to convert the ctrl and event virtqueue handler functions,
-which are not designed to be called from the dataplane code path but
-will be since the ioeventfd is set up for those virtqueues when
-dataplane starts.
-
-Convert the ctrl and event virtqueue handler functions now so they
-operate correctly when called from the dataplane code path. Avoid code
-duplication by extracting this code into a helper function.
-
-Fixes: f34e8d8b8d48d73f36a67b6d5e492ef9784b5012 ("virtio-scsi: prepare virtio_scsi_handle_cmd for dataplane")
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Message-id: 20220427143541.119567-2-stefanha@redhat.com
-[Fixed s/by used/be used/ typo pointed out by Michael Tokarev
-<mjt@tls.msk.ru>.
---Stefan]
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---- a/hw/scsi/virtio-scsi.c
-+++ b/hw/scsi/virtio-scsi.c
-@@ -472,16 +472,32 @@ bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq)
- return progress;
- }
-
-+/*
-+ * If dataplane is configured but not yet started, do so now and return true on
-+ * success.
-+ *
-+ * Dataplane is started by the core virtio code but virtqueue handler functions
-+ * can also be invoked when a guest kicks before DRIVER_OK, so this helper
-+ * function helps us deal with manually starting ioeventfd in that case.
-+ */
-+static bool virtio_scsi_defer_to_dataplane(VirtIOSCSI *s)
-+{
-+ if (!s->ctx || s->dataplane_started) {
-+ return false;
-+ }
-+
-+ virtio_device_start_ioeventfd(&s->parent_obj.parent_obj);
-+ return !s->dataplane_fenced;
-+}
-+
- static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
- {
- VirtIOSCSI *s = (VirtIOSCSI *)vdev;
-
-- if (s->ctx) {
-- virtio_device_start_ioeventfd(vdev);
-- if (!s->dataplane_fenced) {
-- return;
-- }
-+ if (virtio_scsi_defer_to_dataplane(s)) {
-+ return;
- }
-+
- virtio_scsi_acquire(s);
- virtio_scsi_handle_ctrl_vq(s, vq);
- virtio_scsi_release(s);
-@@ -720,12 +736,10 @@ static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq)
- /* use non-QOM casts in the data path */
- VirtIOSCSI *s = (VirtIOSCSI *)vdev;
-
-- if (s->ctx && !s->dataplane_started) {
-- virtio_device_start_ioeventfd(vdev);
-- if (!s->dataplane_fenced) {
-- return;
-- }
-+ if (virtio_scsi_defer_to_dataplane(s)) {
-+ return;
- }
-+
- virtio_scsi_acquire(s);
- virtio_scsi_handle_cmd_vq(s, vq);
- virtio_scsi_release(s);
-@@ -855,12 +869,10 @@ static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)
- {
- VirtIOSCSI *s = VIRTIO_SCSI(vdev);
-
-- if (s->ctx) {
-- virtio_device_start_ioeventfd(vdev);
-- if (!s->dataplane_fenced) {
-- return;
-- }
-+ if (virtio_scsi_defer_to_dataplane(s)) {
-+ return;
- }
-+
- virtio_scsi_acquire(s);
- virtio_scsi_handle_event_vq(s, vq);
- virtio_scsi_release(s);
-GitLab
-
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 27 Apr 2022 15:35:37 +0100
-Subject: [PATCH] virtio-scsi: don't waste CPU polling the event virtqueue
-
-The virtio-scsi event virtqueue is not emptied by its handler function.
-This is typical for rx virtqueues where the device uses buffers when
-some event occurs (e.g. a packet is received, an error condition
-happens, etc).
-
-Polling non-empty virtqueues wastes CPU cycles. We are not waiting for
-new buffers to become available, we are waiting for an event to occur,
-so it's a misuse of CPU resources to poll for buffers.
-
-Introduce the new virtio_queue_aio_attach_host_notifier_no_poll() API,
-which is identical to virtio_queue_aio_attach_host_notifier() except
-that it does not poll the virtqueue.
-
-Before this patch the following command-line consumed 100% CPU in the
-IOThread polling and calling virtio_scsi_handle_event():
-
- $ qemu-system-x86_64 -M accel=kvm -m 1G -cpu host \
- --object iothread,id=iothread0 \
- --device virtio-scsi-pci,iothread=iothread0 \
- --blockdev file,filename=test.img,aio=native,cache.direct=on,node-name=drive0 \
- --device scsi-hd,drive=drive0
-
-After this patch CPU is no longer wasted.
-
-Reported-by: Nir Soffer <nsoffer@redhat.com>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Tested-by: Nir Soffer <nsoffer@redhat.com>
-Message-id: 20220427143541.119567-3-stefanha@redhat.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---- a/hw/scsi/virtio-scsi-dataplane.c
-+++ b/hw/scsi/virtio-scsi-dataplane.c
-@@ -138,7 +138,7 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev)
-
- aio_context_acquire(s->ctx);
- virtio_queue_aio_attach_host_notifier(vs->ctrl_vq, s->ctx);
-- virtio_queue_aio_attach_host_notifier(vs->event_vq, s->ctx);
-+ virtio_queue_aio_attach_host_notifier_no_poll(vs->event_vq, s->ctx);
-
- for (i = 0; i < vs->conf.num_queues; i++) {
- virtio_queue_aio_attach_host_notifier(vs->cmd_vqs[i], s->ctx);
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -3534,6 +3534,19 @@ void virtio_queue_aio_attach_host_notifier(VirtQueue *vq, AioContext *ctx)
- virtio_queue_host_notifier_aio_poll_end);
- }
-
-+/*
-+ * Same as virtio_queue_aio_attach_host_notifier() but without polling. Use
-+ * this for rx virtqueues and similar cases where the virtqueue handler
-+ * function does not pop all elements. When the virtqueue is left non-empty
-+ * polling consumes CPU cycles and should not be used.
-+ */
-+void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioContext *ctx)
-+{
-+ aio_set_event_notifier(ctx, &vq->host_notifier, true,
-+ virtio_queue_host_notifier_read,
-+ NULL, NULL);
-+}
-+
- void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx)
- {
- aio_set_event_notifier(ctx, &vq->host_notifier, true, NULL, NULL, NULL);
---- a/include/hw/virtio/virtio.h
-+++ b/include/hw/virtio/virtio.h
-@@ -317,6 +317,7 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq);
- void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled);
- void virtio_queue_host_notifier_read(EventNotifier *n);
- void virtio_queue_aio_attach_host_notifier(VirtQueue *vq, AioContext *ctx);
-+void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioContext *ctx);
- void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx);
- VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector);
- VirtQueue *virtio_vector_next_queue(VirtQueue *vq);
-GitLab
diff --git a/app-emulation/qemu/files/qemu-7.1.0-capstone-include-path.patch b/app-emulation/qemu/files/qemu-7.1.0-capstone-include-path.patch
new file mode 100644
index 000000000000..585e798345f4
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.1.0-capstone-include-path.patch
@@ -0,0 +1,31 @@
+Forward ported from qemu-2.11.1-capstone_include_path.patch.
+This time also fix the capstone.h header check to use the path we're
+already patching in.
+
+Bug: https://bugs.gentoo.org/873157
+diff --git a/include/disas/capstone.h b/include/disas/capstone.h
+index e29068dd97..d8fdc5d537 100644
+--- a/include/disas/capstone.h
++++ b/include/disas/capstone.h
+@@ -3,7 +3,7 @@
+
+ #ifdef CONFIG_CAPSTONE
+
+-#include <capstone.h>
++#include <capstone/capstone.h>
+
+ #else
+
+diff --git a/meson.build b/meson.build
+index 20fddbd707..50ce96bbd1 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2605,7 +2605,7 @@ if not get_option('capstone').auto() or have_system or have_user
+ # that reports a wrong -I path, causing the #include to
+ # fail later. If the system has such a broken version
+ # do not use it.
+- if capstone.found() and not cc.compiles('#include <capstone.h>',
++ if capstone.found() and not cc.compiles('#include <capstone/capstone.h>',
+ dependencies: [capstone])
+ capstone = not_found
+ if get_option('capstone').enabled()
diff --git a/app-emulation/qemu/files/qemu-7.1.0-strings.patch b/app-emulation/qemu/files/qemu-7.1.0-strings.patch
deleted file mode 100644
index 01f235b9a33c..000000000000
--- a/app-emulation/qemu/files/qemu-7.1.0-strings.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Forward-ported from original patch for 5.2.0.
-
-diff --git a/configure b/configure
-index da2501489f..4660ee3ee5 100755
---- a/configure
-+++ b/configure
-@@ -400,6 +400,7 @@ ld="${LD-${cross_prefix}ld}"
- nm="${NM-${cross_prefix}nm}"
- smbd="$SMBD"
- strip="${STRIP-${cross_prefix}strip}"
-+strings="${STRINGS-${cross_prefix}strings}"
- widl="${WIDL-${cross_prefix}widl}"
- windres="${WINDRES-${cross_prefix}windres}"
- pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
-@@ -1466,9 +1467,9 @@ int main(int argc, char *argv[])
- EOF
-
- if compile_prog ; then
-- if strings -a $TMPE | grep -q BiGeNdIaN ; then
-+ if $strings -a $TMPE | grep -q BiGeNdIaN ; then
- bigendian="yes"
-- elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then
-+ elif $strings -a $TMPE | grep -q LiTtLeEnDiAn ; then
- bigendian="no"
- else
- echo big/little test failed
diff --git a/app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch b/app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch
new file mode 100644
index 000000000000..3050228b4e0c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch
@@ -0,0 +1,45 @@
+commit 433c2acd1b9c3f7f5903273e85fed9a7f9157b23
+Author: John Helmert III <ajak@gentoo.org>
+Date: Wed Jan 4 12:25:08 2023 -0600
+
+ meson.build: disable gmp
+
+ gmp isn't required, and we want to avoid linking to it automatigcally
+ in Gentoo.
+
+ Bug: https://bugs.gentoo.org/886207
+ Signed-off-by: John Helmert III <ajak@gentoo.org>
+
+diff --git a/meson.build b/meson.build
+index 5c6b5a1c75..2f9550362d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1234,15 +1234,6 @@ if not gnutls_crypto.found()
+ endif
+ endif
+
+-gmp = dependency('gmp', required: false, method: 'pkg-config', kwargs: static_kwargs)
+-if nettle.found() and gmp.found()
+- hogweed = dependency('hogweed', version: '>=3.4',
+- method: 'pkg-config',
+- required: get_option('nettle'),
+- kwargs: static_kwargs)
+-endif
+-
+-
+ gtk = not_found
+ gtkx11 = not_found
+ vte = not_found
+diff --git a/meson_options.txt b/meson_options.txt
+index 4b749ca549..e06b274960 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -277,6 +277,8 @@ option('vduse_blk_export', type: 'feature', value: 'auto',
+
+ option('capstone', type: 'feature', value: 'auto',
+ description: 'Whether and how to find the capstone library')
++option('gmp', type: 'feature', value: 'auto',
++ description: 'Whether or not to find the gmp library')
+ option('fdt', type: 'combo', value: 'auto',
+ choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
+ description: 'Whether and how to find the libfdt library')
diff --git a/app-emulation/qemu/files/qemu-7.2.0-linux-headers-6.2-glibc-2.36.patch b/app-emulation/qemu/files/qemu-7.2.0-linux-headers-6.2-glibc-2.36.patch
new file mode 100644
index 000000000000..2a58ca1ad735
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.2.0-linux-headers-6.2-glibc-2.36.patch
@@ -0,0 +1,137 @@
+https://bugs.gentoo.org/895662
+https://gitlab.com/qemu-project/qemu/-/commit/9f0246539ae84a5e21efd1cc4516fc343f08115a
+https://gitlab.com/qemu-project/qemu/-/commit/6003159ce18faad4e1bc7bf9c85669019cd4950e
+
+From 9f0246539ae84a5e21efd1cc4516fc343f08115a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
+Date: Tue, 10 Jan 2023 12:49:00 -0500
+Subject: [PATCH] Revert "linux-user: add more compat ioctl definitions"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This reverts commit c5495f4ecb0cdaaf2e9dddeb48f1689cdb520ca0.
+
+glibc has fixed (in 2.36.9000-40-g774058d729) the problem
+that caused a clash when both sys/mount.h annd linux/mount.h
+are included, and backported this to the 2.36 stable release
+too:
+
+ https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
+
+It is saner for QEMU to remove the workaround it applied for
+glibc 2.36 and expect distros to ship the 2.36 maint release
+with the fix. This avoids needing to add a further workaround
+to QEMU to deal with the fact that linux/brtfs.h now also pulls
+in linux/mount.h via linux/fs.h since Linux 6.1
+
+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
+Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
+Message-Id: <20230110174901.2580297-2-berrange@redhat.com>
+Signed-off-by: Laurent Vivier <laurent@vivier.eu>
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -111,31 +111,6 @@
+ #define FS_IOC32_SETFLAGS _IOW('f', 2, int)
+ #define FS_IOC32_GETVERSION _IOR('v', 1, int)
+ #define FS_IOC32_SETVERSION _IOW('v', 2, int)
+-
+-#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+-#define BLKDISCARD _IO(0x12,119)
+-#define BLKIOMIN _IO(0x12,120)
+-#define BLKIOOPT _IO(0x12,121)
+-#define BLKALIGNOFF _IO(0x12,122)
+-#define BLKPBSZGET _IO(0x12,123)
+-#define BLKDISCARDZEROES _IO(0x12,124)
+-#define BLKSECDISCARD _IO(0x12,125)
+-#define BLKROTATIONAL _IO(0x12,126)
+-#define BLKZEROOUT _IO(0x12,127)
+-
+-#define FIBMAP _IO(0x00,1)
+-#define FIGETBSZ _IO(0x00,2)
+-
+-struct file_clone_range {
+- __s64 src_fd;
+- __u64 src_offset;
+- __u64 src_length;
+- __u64 dest_offset;
+-};
+-
+-#define FICLONE _IOW(0x94, 9, int)
+-#define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
+-
+ #else
+ #include <linux/fs.h>
+ #endif
+--
+GitLab
+
+From 6003159ce18faad4e1bc7bf9c85669019cd4950e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
+Date: Tue, 10 Jan 2023 12:49:01 -0500
+Subject: [PATCH] Revert "linux-user: fix compat with glibc >= 2.36
+ sys/mount.h"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This reverts commit 3cd3df2a9584e6f753bb62a0028bd67124ab5532.
+
+glibc has fixed (in 2.36.9000-40-g774058d729) the problem
+that caused a clash when both sys/mount.h annd linux/mount.h
+are included, and backported this to the 2.36 stable release
+too:
+
+ https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
+
+It is saner for QEMU to remove the workaround it applied for
+glibc 2.36 and expect distros to ship the 2.36 maint release
+with the fix. This avoids needing to add a further workaround
+to QEMU to deal with the fact that linux/brtfs.h now also pulls
+in linux/mount.h via linux/fs.h since Linux 6.1
+
+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
+Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
+Message-Id: <20230110174901.2580297-3-berrange@redhat.com>
+Signed-off-by: Laurent Vivier <laurent@vivier.eu>
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -95,25 +95,7 @@
+ #include <linux/soundcard.h>
+ #include <linux/kd.h>
+ #include <linux/mtio.h>
+-
+-#ifdef HAVE_SYS_MOUNT_FSCONFIG
+-/*
+- * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h,
+- * which in turn prevents use of linux/fs.h. So we have to
+- * define the constants ourselves for now.
+- */
+-#define FS_IOC_GETFLAGS _IOR('f', 1, long)
+-#define FS_IOC_SETFLAGS _IOW('f', 2, long)
+-#define FS_IOC_GETVERSION _IOR('v', 1, long)
+-#define FS_IOC_SETVERSION _IOW('v', 2, long)
+-#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
+-#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
+-#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
+-#define FS_IOC32_GETVERSION _IOR('v', 1, int)
+-#define FS_IOC32_SETVERSION _IOW('v', 2, int)
+-#else
+ #include <linux/fs.h>
+-#endif
+ #include <linux/fd.h>
+ #if defined(CONFIG_FIEMAP)
+ #include <linux/fiemap.h>
+--- a/meson.build
++++ b/meson.build
+@@ -2046,8 +2046,6 @@ config_host_data.set('HAVE_OPTRESET',
+ cc.has_header_symbol('getopt.h', 'optreset'))
+ config_host_data.set('HAVE_IPPROTO_MPTCP',
+ cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
+-config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG',
+- cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG'))
+
+ # has_member
+ config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
+--
+GitLab
diff --git a/app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch b/app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch
new file mode 100644
index 000000000000..6a5437056e6f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch
@@ -0,0 +1,29 @@
+diff --git a/meson.build b/meson.build
+index c44d05a13..5c5c09894 100644
+--- a/meson.build
++++ b/meson.build
+@@ -671,6 +671,8 @@ 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', kwargs: static_kwargs)
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index 158a3b410..3bb318a23 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -33,8 +33,10 @@ keymaps = {
+ 'tr': '-l tr',
+ }
+
+-if meson.is_cross_build() or not xkbcommon.found()
++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
+ endif
diff --git a/app-emulation/qemu/files/qemu-8.0.0-make.patch b/app-emulation/qemu/files/qemu-8.0.0-make.patch
new file mode 100644
index 000000000000..40bafd490052
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.0.0-make.patch
@@ -0,0 +1,13 @@
+diff --git a/configure b/configure
+index 800b5850f..331e8950d 100755
+--- a/configure
++++ b/configure
+@@ -1069,7 +1069,7 @@ then
+ fi
+ fi
+
+-if ! has "$make"
++if ! has $make
+ then
+ error_exit "GNU make ($make) not found"
+ fi
diff --git a/app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch b/app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch
new file mode 100644
index 000000000000..07d3836c57e4
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch
@@ -0,0 +1,40 @@
+diff --git a/configure b/configure
+index 4369fa5..7807ad5 100755
+--- a/configure
++++ b/configure
+@@ -1095,34 +1095,7 @@ has_meson() {
+ fi
+ }
+
+-if test -z "$meson"; then
+- if test "$explicit_python" = no && has_meson && version_ge "$(meson --version)" 0.61.5; then
+- meson=meson
+- elif test "$git_submodules_action" != 'ignore' ; then
+- meson=git
+- elif test -e "${source_path}/meson/meson.py" ; then
+- meson=internal
+- else
+- if test "$explicit_python" = yes; then
+- error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found."
+- else
+- error_exit "Meson not found. Use --meson=/path/to/meson"
+- fi
+- fi
+-else
+- # Meson uses its own Python interpreter to invoke other Python scripts,
+- # but the user wants to use the one they specified with --python.
+- #
+- # We do not want to override the distro Python interpreter (and sometimes
+- # cannot: for example in Homebrew /usr/bin/meson is a bash script), so
+- # just require --meson=git|internal together with --python.
+- if test "$explicit_python" = yes; then
+- case "$meson" in
+- git | internal) ;;
+- *) error_exit "--python requires using QEMU's embedded Meson distribution." ;;
+- esac
+- fi
+-fi
++meson=meson
+
+ if test "$meson" = git; then
+ git_submodules="${git_submodules} meson"
diff --git a/app-emulation/qemu/files/qemu-7.0.0-also-build-virtfs-proxy-helper.patch b/app-emulation/qemu/files/qemu-8.1.0-also-build-virtfs-proxy-helper.patch
index ca2e9433792c..61ea0f36d90a 100644
--- a/app-emulation/qemu/files/qemu-7.0.0-also-build-virtfs-proxy-helper.patch
+++ b/app-emulation/qemu/files/qemu-8.1.0-also-build-virtfs-proxy-helper.patch
@@ -1,4 +1,4 @@
-From c1093041466772f4b62961bcc5a354801d41355d Mon Sep 17 00:00:00 2001
+From d02ea89239768c93651a161d057f2bf04d56a024 Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Mon, 4 Apr 2022 12:56:59 +0200
Subject: [PATCH] also build virtfs-proxy-helper
@@ -15,18 +15,18 @@ all, it is a tiny executable
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
-index 861de93c4f..a8d29be3aa 100644
+index 063c736aee..fda8639293 100644
--- a/meson.build
+++ b/meson.build
-@@ -1474,7 +1474,7 @@ have_virtfs = get_option('virtfs') \
- .disable_auto_if(not have_tools and not have_system) \
+@@ -2008,8 +2008,6 @@ have_virtfs = get_option('virtfs') \
.allowed()
--have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools
-+have_virtfs_proxy_helper = have_tools and libattr.found() and libcap_ng.found()
-
- foreach k : get_option('trace_backends')
- config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
+ have_virtfs_proxy_helper = get_option('virtfs_proxy_helper') \
+- .require(targetos != 'darwin', error_message: 'the virtfs proxy helper is incompatible with macOS') \
+- .require(have_virtfs, error_message: 'the virtfs proxy helper requires that virtfs is enabled') \
+ .disable_auto_if(not have_tools) \
+ .require(libcap_ng.found(), error_message: 'the virtfs proxy helper requires libcap-ng') \
+ .allowed()
--
2.35.1
diff --git a/app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch b/app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch
new file mode 100644
index 000000000000..b6ef6214af55
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch
@@ -0,0 +1,10 @@
+This gets confused by python-any-r1 and tries to find sphinx-build in ${T}.
+--- a/docs/meson.build
++++ b/docs/meson.build
+@@ -1,5 +1,4 @@
+-sphinx_build = find_program(fs.parent(python.full_path()) / 'sphinx-build',
+- required: get_option('docs'))
++sphinx_build = find_program('sphinx-build', required: get_option('docs'))
+
+ # Check if tools are available to build documentation.
+ build_docs = false
diff --git a/app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch b/app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch
new file mode 100644
index 000000000000..f668584e8d4b
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch
@@ -0,0 +1,64 @@
+* netdev-socket.c
+qtest-i386/netdev-socket fails with:
+```
+stderr:
+qemu-system-i386: -netdev dgram,id=st0,remote.type=inet,remote.host=230.0.0.1,remote.port=1234: can't add socket to multicast group 230.0.0.1: No such device
+Broken pipe
+../tests/qtest/libqtest.c:191: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
+```
+
+* vhost-user-test.c
+qtest-x86_64/qos-test fails with a timeout:
+```
+qemu-system-x86_64: Failed to set msg fds.
+qemu-system-x86_64: vhost VQ 0 ring restore failed: -22: Invalid argument (22)
+qemu-system-x86_64: Failed to set msg fds.
+qemu-system-x86_64: vhost VQ 1 ring restore failed: -22: Invalid argument (22)
+**
+ERROR:../tests/qtest/vhost-user-test.c:892:wait_for_rings_started: assertion failed (ctpop64(s->rings) == count): (1 == 2)
+**
+ERROR:../tests/qtest/qos-test.c:191:subprocess_run_one_test: child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-net-pci/virtio-net/virtio-net-tests/vhost-user/reconnect/subprocess [6082]) failed unexpectedl
+```
+
+--- a/tests/qtest/netdev-socket.c
++++ b/tests/qtest/netdev-socket.c
+@@ -498,6 +498,10 @@ int main(int argc, char **argv)
+ socket_init();
+ g_test_init(&argc, &argv, NULL);
+
++ /* XXX: Skip test for now on Gentoo, fails with "No such device" */
++ g_test_skip("Skipping test known to fail on Gentoo");
++ return 0;
++
+ if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) {
+ g_error("socket_check_protocol_support() failed\n");
+ }
+--- a/tests/qtest/vhost-user-test.c
++++ b/tests/qtest/vhost-user-test.c
+@@ -243,7 +243,7 @@ static bool wait_for_fds(TestServer *s)
+
+ g_mutex_lock(&s->data_mutex);
+
+- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
++ end_time = g_get_monotonic_time() + 30 * G_TIME_SPAN_SECOND;
+ while (!s->fds_num) {
+ if (!g_cond_wait_until(&s->data_cond, &s->data_mutex, end_time)) {
+ /* timeout has passed */
+@@ -672,7 +672,7 @@ static void wait_for_log_fd(TestServer *s)
+ gint64 end_time;
+
+ g_mutex_lock(&s->data_mutex);
+- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
++ end_time = g_get_monotonic_time() + 30 * G_TIME_SPAN_SECOND;
+ while (s->log_fd == -1) {
+ if (!g_cond_wait_until(&s->data_cond, &s->data_mutex, end_time)) {
+ /* timeout has passed */
+@@ -885,7 +885,7 @@ static void wait_for_rings_started(TestServer *s, size_t count)
+ gint64 end_time;
+
+ g_mutex_lock(&s->data_mutex);
+- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
++ end_time = g_get_monotonic_time() + 30 * G_TIME_SPAN_SECOND;
+ while (ctpop64(s->rings) != count) {
+ if (!g_cond_wait_until(&s->data_cond, &s->data_mutex, end_time)) {
+ /* timeout has passed */
diff --git a/app-emulation/qemu/files/qemu-9.0.0-also-build-virtfs-proxy-helper.patch b/app-emulation/qemu/files/qemu-9.0.0-also-build-virtfs-proxy-helper.patch
new file mode 100644
index 000000000000..603d20c42fc8
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9.0.0-also-build-virtfs-proxy-helper.patch
@@ -0,0 +1,35 @@
+From 951325a0c9519d4910d80cc6c7a5728c0dbc4946 Mon Sep 17 00:00:00 2001
+Message-ID: <951325a0c9519d4910d80cc6c7a5728c0dbc4946.1714317553.git.mprivozn@redhat.com>
+From: Matthias Maier <tamiko@43-1.org>
+Date: Mon, 4 Apr 2022 12:56:59 +0200
+Subject: [PATCH] also build virtfs-proxy-helper
+
+The Gentoo ebuild splits the qemu build into a softmmu, user and tool
+phase in order to be able to build and link some of the qemu emulators
+statically. This unfortunately has the consequence that we never
+configure with "have_virtfs" and "have_tools" at the same time.
+
+As a workaround, simply build the virtfs userland unconditionally. After
+all, it is a tiny executable.
+
+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
+---
+ meson.build | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index c3a2be7b2d..50a5cfcf4e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2116,8 +2116,6 @@ have_virtfs = get_option('virtfs') \
+ .allowed()
+
+ have_virtfs_proxy_helper = get_option('virtfs_proxy_helper') \
+- .require(host_os != 'darwin', error_message: 'the virtfs proxy helper is incompatible with macOS') \
+- .require(have_virtfs, error_message: 'the virtfs proxy helper requires that virtfs is enabled') \
+ .disable_auto_if(not have_tools) \
+ .require(libcap_ng.found(), error_message: 'the virtfs proxy helper requires libcap-ng') \
+ .allowed()
+--
+2.43.2
+
diff --git a/app-emulation/qemu/files/qemu-9.0.0-capstone-include-path.patch b/app-emulation/qemu/files/qemu-9.0.0-capstone-include-path.patch
new file mode 100644
index 000000000000..3e0408d6b213
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9.0.0-capstone-include-path.patch
@@ -0,0 +1,42 @@
+From 67a8b35e98f5c0853f7cdf26db0ebc6ce20b929c Mon Sep 17 00:00:00 2001
+Message-ID: <67a8b35e98f5c0853f7cdf26db0ebc6ce20b929c.1714317553.git.mprivozn@redhat.com>
+From: Michal Privoznik <mprivozn@redhat.com>
+Date: Sun, 28 Apr 2024 17:10:46 +0200
+Subject: [PATCH] Forward ported from qemu-7.1.0-capstone-include-path.patch.
+
+Bug: https://bugs.gentoo.org/873157
+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
+---
+ include/disas/capstone.h | 2 +-
+ meson.build | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/disas/capstone.h b/include/disas/capstone.h
+index e29068dd97..d8fdc5d537 100644
+--- a/include/disas/capstone.h
++++ b/include/disas/capstone.h
+@@ -3,7 +3,7 @@
+
+ #ifdef CONFIG_CAPSTONE
+
+-#include <capstone.h>
++#include <capstone/capstone.h>
+
+ #else
+
+diff --git a/meson.build b/meson.build
+index ea3ccff968..c3a2be7b2d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1712,7 +1712,7 @@ if not get_option('capstone').auto() or have_system or have_user
+ # that reports a wrong -I path, causing the #include to
+ # fail later. If the system has such a broken version
+ # do not use it.
+- if capstone.found() and not cc.compiles('#include <capstone.h>',
++ if capstone.found() and not cc.compiles('#include <capstone/capstone.h>',
+ dependencies: [capstone])
+ capstone = not_found
+ if get_option('capstone').enabled()
+--
+2.43.2
+
diff --git a/app-emulation/qemu/files/qemu-9.0.0-disable-keymap.patch b/app-emulation/qemu/files/qemu-9.0.0-disable-keymap.patch
new file mode 100644
index 000000000000..c85d213626e2
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9.0.0-disable-keymap.patch
@@ -0,0 +1,44 @@
+From 8cca781563e89facd312d622a69af124eb2757c6 Mon Sep 17 00:00:00 2001
+Message-ID: <8cca781563e89facd312d622a69af124eb2757c6.1714317553.git.mprivozn@redhat.com>
+From: Michal Privoznik <mprivozn@redhat.com>
+Date: Sun, 28 Apr 2024 17:10:13 +0200
+Subject: [PATCH] 8.0.0-disable-keymap.patch
+
+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
+---
+ meson.build | 2 ++
+ pc-bios/keymaps/meson.build | 4 +++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 5db2dbc12e..ea3ccff968 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1098,6 +1098,8 @@ 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')
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index 0bd8ce0077..3888f4c64f 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -33,8 +33,10 @@ keymaps = {
+ 'tr': '-l tr',
+ }
+
+-if meson.is_cross_build() or not xkbcommon.found()
++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
+ endif
+--
+2.43.2
+