From 22305b524e79c715418022b965f03acb9368697d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 22 Jul 2022 23:54:02 +0000 Subject: [PATCH 01/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 5337582..0958818 100644 --- a/qemu.spec +++ b/qemu.spec @@ -317,7 +317,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 6 +%global baserelease 7 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2716,6 +2716,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Fri Jul 22 2022 Fedora Release Engineering - 2:7.0.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Sat Jun 11 2022 Cole Robinson - 7.0.0-6 - Adjust for Xen dropping 32bit arches From 98276b3e5fae08fe8119d4114b4fd2deff5fa4fe Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 25 Jul 2022 11:10:01 +0200 Subject: [PATCH 02/54] Replace pcre-static dependency with pcre2-static, to adjust for glib switching Signed-off-by: Paolo Bonzini --- qemu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index 0958818..08269b0 100644 --- a/qemu.spec +++ b/qemu.spec @@ -317,7 +317,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 7 +%global baserelease 8 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -502,7 +502,7 @@ BuildRequires: SDL2_image-devel %endif %if %{user_static} -BuildRequires: glibc-static pcre-static glib2-static zlib-static +BuildRequires: glibc-static pcre2-static glib2-static zlib-static %endif # Requires for the Fedora 'qemu' metapackage @@ -2716,6 +2716,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Mon Jul 25 2022 Paolo Bonzini - 2:7.0.0-8 +- Replace pcre-static dependency with pcre2-static, to adjust for glib switching + * Fri Jul 22 2022 Fedora Release Engineering - 2:7.0.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 2abd5d20f1735543fc756293d422a656aa86c46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 2 Aug 2022 15:58:41 +0100 Subject: [PATCH 03/54] Show config.log contents when configure fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make it easier to debug future koji build failures Signed-off-by: Daniel P. Berrangé --- qemu.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu.spec b/qemu.spec index 08269b0..b8c4abe 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1554,7 +1554,8 @@ run_configure() { --with-git=git \ --tls-priority=@QEMU,SYSTEM \ %{disable_everything} \ - "$@" + "$@" \ + || ( cat config.log ; exit 1 ) echo "config-host.mak contents:" echo "===" @@ -1721,8 +1722,7 @@ run_configure \ --enable-xen \ --enable-xen-pci-passthrough \ %endif - --enable-zstd \ - + --enable-zstd %if %{tools_only} %make_build qemu-img From 0eeaeaae15397fa23f0826d3f5e51fc171285739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 2 Aug 2022 17:43:44 +0100 Subject: [PATCH 04/54] Get rid of patch numbering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RPM no longer requires use of numbered patches, a simple 'Patch' is sufficient. Signed-off-by: Daniel P. Berrangé --- qemu.spec | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qemu.spec b/qemu.spec index b8c4abe..dd996e7 100644 --- a/qemu.spec +++ b/qemu.spec @@ -341,17 +341,17 @@ Source31: kvm-x86.conf Source36: README.tests # Fix SGX assert -Patch0001: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch +Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch # Fix virtio-scsi hang (bz #2079347) -Patch0002: 0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch -Patch0003: 0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch -Patch0004: 0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch -Patch0005: 0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch -Patch0006: 0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch -Patch0007: 0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch -Patch0008: 0008-Disable-flakey-dbus-display-test.patch -Patch0009: 0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch -Patch0010: 0010-Skip-iotests-entirely.patch +Patch: 0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch +Patch: 0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch +Patch: 0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch +Patch: 0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch +Patch: 0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch +Patch: 0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch +Patch: 0008-Disable-flakey-dbus-display-test.patch +Patch: 0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch +Patch: 0010-Skip-iotests-entirely.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel From 34254733fe7d319b8edc8a389c736d0539c0cc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 2 Aug 2022 18:37:18 +0100 Subject: [PATCH 05/54] Fix compat with glibc 2.36 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- ...x-compat-with-glibc-2.36-sys-mount.h.patch | 100 ++++++++++++++++++ qemu.spec | 7 +- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch diff --git a/0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch b/0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch new file mode 100644 index 0000000..8718405 --- /dev/null +++ b/0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch @@ -0,0 +1,100 @@ +From a7f14aae85022007a4c77e0792a1abb0509a08eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 2 Aug 2022 12:34:23 -0400 +Subject: [PATCH] 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 + +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é +--- + linux-user/syscall.c | 18 ++++++++++++++++++ + meson.build | 2 ++ + 2 files changed, 20 insertions(+) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index b27a6552aa..52d178afe7 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -95,7 +95,25 @@ + #include + #include + #include ++ ++#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 ++#endif + #include + #if defined(CONFIG_FIEMAP) + #include +diff --git a/meson.build b/meson.build +index 294e9a8f32..30a380752c 100644 +--- 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', +-- +2.37.1 + diff --git a/qemu.spec b/qemu.spec index dd996e7..6949516 100644 --- a/qemu.spec +++ b/qemu.spec @@ -317,7 +317,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 8 +%global baserelease 9 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -352,6 +352,8 @@ Patch: 0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch Patch: 0008-Disable-flakey-dbus-display-test.patch Patch: 0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch Patch: 0010-Skip-iotests-entirely.patch +# Not yet upstream, fix glibc 2.36 compat +Patch: 0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel @@ -2716,6 +2718,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Tue Aug 2 2022 Daniel P. Berrangé - 7.0.0-9 +- Fix compat with glibc 2.36 headers + * Mon Jul 25 2022 Paolo Bonzini - 2:7.0.0-8 - Replace pcre-static dependency with pcre2-static, to adjust for glib switching From 2874d70b6b70e665446cdf3f641dc79724abe88c Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 15 Aug 2022 16:49:40 -0400 Subject: [PATCH 06/54] Fix pcre-static dep on fedora < 37, for virt-preview Signed-off-by: Cole Robinson --- qemu.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 6949516..ff3c093 100644 --- a/qemu.spec +++ b/qemu.spec @@ -504,7 +504,12 @@ BuildRequires: SDL2_image-devel %endif %if %{user_static} -BuildRequires: glibc-static pcre2-static glib2-static zlib-static +BuildRequires: glibc-static glib2-static zlib-static +%if 0%{?fedora} >= 37 +BuildRequires: pcre2-static +%else +BuildRequires: pcre-static +%endif %endif # Requires for the Fedora 'qemu' metapackage From 055837f300540be47bf5b6d926dd6f511b2596c0 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Thu, 1 Sep 2022 08:35:19 -0300 Subject: [PATCH 07/54] qemu-7.1.0-1 Signed-off-by: Eduardo Lima (Etrunko) --- ...sts-Disable-pci_virtio_vga-for-ppc64.patch | 32 ++++ ...ctrl-and-event-handler-functions-in-.patch | 108 ------------ ...t-waste-CPU-polling-the-event-virtqu.patch | 91 ---------- ...clean-up-virtio_scsi_handle_event_vq.patch | 51 ------ ...-clean-up-virtio_scsi_handle_ctrl_vq.patch | 54 ------ ...i-clean-up-virtio_scsi_handle_cmd_vq.patch | 66 -------- ...-request-related-items-from-.h-to-.c.patch | 157 ------------------ 0008-Disable-flakey-dbus-display-test.patch | 36 ---- ...s-with-modules-and-qemu-system-s390x.patch | 32 ---- ...x-compat-with-glibc-2.36-sys-mount.h.patch | 100 ----------- qemu.spec | 81 ++++++--- sources | 2 +- 12 files changed, 92 insertions(+), 718 deletions(-) create mode 100644 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch delete mode 100644 0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch delete mode 100644 0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch delete mode 100644 0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch delete mode 100644 0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch delete mode 100644 0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch delete mode 100644 0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch delete mode 100644 0008-Disable-flakey-dbus-display-test.patch delete mode 100644 0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch delete mode 100644 0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch diff --git a/0001-tests-Disable-pci_virtio_vga-for-ppc64.patch b/0001-tests-Disable-pci_virtio_vga-for-ppc64.patch new file mode 100644 index 0000000..26d8ed7 --- /dev/null +++ b/0001-tests-Disable-pci_virtio_vga-for-ppc64.patch @@ -0,0 +1,32 @@ +From f6d5fd60f54fb9dcdc3733154637a3a214f5d5af Mon Sep 17 00:00:00 2001 +From: "Eduardo Lima (Etrunko)" +Date: Thu, 1 Sep 2022 12:43:49 -0300 +Subject: [PATCH] tests: Disable pci_virtio_vga for ppc64 + +starting QEMU: exec ./qemu-system-ppc64 -qtest unix:/tmp/qtest-2378197.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2378197.qmp,id=char0 -mon chardev=char0,mode=control -display none -vga none -device virtio-vga -accel qtest +stderr: +qemu-system-ppc64: -device virtio-vga: 'virtio-vga' is not a valid device model name +Broken pipe +../tests/qtest/libqtest.c:156: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0) + +Signed-off-by: Eduardo Lima (Etrunko) +--- + tests/qtest/display-vga-test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/qtest/display-vga-test.c b/tests/qtest/display-vga-test.c +index ace3bb28e0..628dad4cf2 100644 +--- a/tests/qtest/display-vga-test.c ++++ b/tests/qtest/display-vga-test.c +@@ -61,7 +61,7 @@ int main(int argc, char **argv) + qtest_add_func("/display/pci/multihead", pci_multihead); + qtest_add_func("/display/pci/virtio-gpu", pci_virtio_gpu); + if (g_str_equal(arch, "i386") || g_str_equal(arch, "x86_64") || +- g_str_equal(arch, "hppa") || g_str_equal(arch, "ppc64")) { ++ g_str_equal(arch, "hppa")) { + qtest_add_func("/display/pci/virtio-vga", pci_virtio_vga); + } + +-- +2.37.2 + diff --git a/0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch b/0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch deleted file mode 100644 index 32c90a1..0000000 --- a/0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch +++ /dev/null @@ -1,108 +0,0 @@ -From: Stefan Hajnoczi -Date: Wed, 27 Apr 2022 15:35:36 +0100 -Subject: [PATCH] virtio-scsi: fix ctrl and event handler functions in - dataplane mode -Content-type: text/plain - -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 -Reviewed-by: Paolo Bonzini -Message-id: 20220427143541.119567-2-stefanha@redhat.com -[Fixed s/by used/be used/ typo pointed out by Michael Tokarev -. ---Stefan] -Signed-off-by: Stefan Hajnoczi -(cherry picked from commit 2f743ef6366c2df4ef51ef3ae318138cdc0125ab) -Signed-off-by: Stefan Hajnoczi ---- - hw/scsi/virtio-scsi.c | 42 +++++++++++++++++++++++++++--------------- - 1 file changed, 27 insertions(+), 15 deletions(-) - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index 34a968ecfb..417fbc71d6 100644 ---- 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); diff --git a/0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch b/0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch deleted file mode 100644 index 03acef6..0000000 --- a/0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch +++ /dev/null @@ -1,91 +0,0 @@ -From: Stefan Hajnoczi -Date: Tue, 17 May 2022 09:27:45 +0100 -Subject: [PATCH] virtio-scsi: don't waste CPU polling the event virtqueue -Content-type: text/plain - -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 -Signed-off-by: Stefan Hajnoczi -Tested-by: Nir Soffer -Message-id: 20220427143541.119567-3-stefanha@redhat.com -Signed-off-by: Stefan Hajnoczi -(cherry picked from commit 38738f7dbbda90fbc161757b7f4be35b52205552) -Signed-off-by: Stefan Hajnoczi ---- - hw/scsi/virtio-scsi-dataplane.c | 2 +- - hw/virtio/virtio.c | 13 +++++++++++++ - include/hw/virtio/virtio.h | 1 + - 3 files changed, 15 insertions(+), 1 deletion(-) - -diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c -index 29575cbaf6..8bb6e6acfc 100644 ---- 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); -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 9d637e043e..67a873f54a 100644 ---- 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); -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index b31c4507f5..b62a35fdca 100644 ---- 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); diff --git a/0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch b/0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch deleted file mode 100644 index d3eff90..0000000 --- a/0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Stefan Hajnoczi -Date: Tue, 17 May 2022 09:28:06 +0100 -Subject: [PATCH] virtio-scsi: clean up virtio_scsi_handle_event_vq() -Content-type: text/plain - -virtio_scsi_handle_event_vq() is only called from hw/scsi/virtio-scsi.c -now and its return value is no longer used. Remove the function -prototype from virtio-scsi.h and drop the return value. - -Signed-off-by: Stefan Hajnoczi -Reviewed-by: Paolo Bonzini -Message-id: 20220427143541.119567-4-stefanha@redhat.com -Signed-off-by: Stefan Hajnoczi -(cherry picked from commit 37ce2de95169dacab3fb53d11bd4509b9c2e3a4c) -Signed-off-by: Stefan Hajnoczi ---- - hw/scsi/virtio-scsi.c | 4 +--- - include/hw/virtio/virtio-scsi.h | 1 - - 2 files changed, 1 insertion(+), 4 deletions(-) - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index 417fbc71d6..aa03a713d8 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -856,13 +856,11 @@ void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, - virtio_scsi_complete_req(req); - } - --bool virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq) -+static void virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq) - { - if (s->events_dropped) { - virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); -- return true; - } -- return false; - } - - static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq) -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index 543681bc18..5957597825 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -151,7 +151,6 @@ void virtio_scsi_common_realize(DeviceState *dev, - Error **errp); - - void virtio_scsi_common_unrealize(DeviceState *dev); --bool virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq); - bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq); - bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq); - void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req); diff --git a/0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch b/0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch deleted file mode 100644 index bde9298..0000000 --- a/0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Stefan Hajnoczi -Date: Tue, 17 May 2022 09:28:12 +0100 -Subject: [PATCH] virtio-scsi: clean up virtio_scsi_handle_ctrl_vq() -Content-type: text/plain - -virtio_scsi_handle_ctrl_vq() is only called from hw/scsi/virtio-scsi.c -now and its return value is no longer used. Remove the function -prototype from virtio-scsi.h and drop the return value. - -Signed-off-by: Stefan Hajnoczi -Reviewed-by: Paolo Bonzini -Message-id: 20220427143541.119567-5-stefanha@redhat.com -Signed-off-by: Stefan Hajnoczi -(cherry picked from commit 73b3b49f1880f236b4d0ffd7efb00280c05a5fab) -Signed-off-by: Stefan Hajnoczi ---- - hw/scsi/virtio-scsi.c | 5 +---- - include/hw/virtio/virtio-scsi.h | 1 - - 2 files changed, 1 insertion(+), 5 deletions(-) - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index aa03a713d8..eefda16e4b 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -460,16 +460,13 @@ static void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s, VirtIOSCSIReq *req) - } - } - --bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq) -+static void virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq) - { - VirtIOSCSIReq *req; -- bool progress = false; - - while ((req = virtio_scsi_pop_req(s, vq))) { -- progress = true; - virtio_scsi_handle_ctrl_req(s, req); - } -- return progress; - } - - /* -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index 5957597825..44dc3b81ec 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -152,7 +152,6 @@ void virtio_scsi_common_realize(DeviceState *dev, - - void virtio_scsi_common_unrealize(DeviceState *dev); - bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq); --bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq); - void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req); - void virtio_scsi_free_req(VirtIOSCSIReq *req); - void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, diff --git a/0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch b/0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch deleted file mode 100644 index 89c5e58..0000000 --- a/0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Stefan Hajnoczi -Date: Tue, 17 May 2022 09:28:19 +0100 -Subject: [PATCH] virtio-scsi: clean up virtio_scsi_handle_cmd_vq() -Content-type: text/plain - -virtio_scsi_handle_cmd_vq() is only called from hw/scsi/virtio-scsi.c -now and its return value is no longer used. Remove the function -prototype from virtio-scsi.h and drop the return value. - -Signed-off-by: Stefan Hajnoczi -Reviewed-by: Paolo Bonzini -Message-id: 20220427143541.119567-6-stefanha@redhat.com -Signed-off-by: Stefan Hajnoczi -(cherry picked from commit ad482b57ef841b2d4883c5079d20ba44ff5e4b3e) -Signed-off-by: Stefan Hajnoczi ---- - hw/scsi/virtio-scsi.c | 5 +---- - include/hw/virtio/virtio-scsi.h | 1 - - 2 files changed, 1 insertion(+), 5 deletions(-) - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index eefda16e4b..12c6a21202 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -685,12 +685,11 @@ static void virtio_scsi_handle_cmd_req_submit(VirtIOSCSI *s, VirtIOSCSIReq *req) - scsi_req_unref(sreq); - } - --bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) -+static void virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) - { - VirtIOSCSIReq *req, *next; - int ret = 0; - bool suppress_notifications = virtio_queue_get_notification(vq); -- bool progress = false; - - QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs); - -@@ -700,7 +699,6 @@ bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) - } - - while ((req = virtio_scsi_pop_req(s, vq))) { -- progress = true; - ret = virtio_scsi_handle_cmd_req_prepare(s, req); - if (!ret) { - QTAILQ_INSERT_TAIL(&reqs, req, next); -@@ -725,7 +723,6 @@ bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) - QTAILQ_FOREACH_SAFE(req, &reqs, next, next) { - virtio_scsi_handle_cmd_req_submit(s, req); - } -- return progress; - } - - static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq) -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index 44dc3b81ec..2497530064 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -151,7 +151,6 @@ void virtio_scsi_common_realize(DeviceState *dev, - Error **errp); - - void virtio_scsi_common_unrealize(DeviceState *dev); --bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq); - void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req); - void virtio_scsi_free_req(VirtIOSCSIReq *req); - void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, diff --git a/0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch b/0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch deleted file mode 100644 index 89377c8..0000000 --- a/0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch +++ /dev/null @@ -1,157 +0,0 @@ -From: Stefan Hajnoczi -Date: Tue, 17 May 2022 09:28:26 +0100 -Subject: [PATCH] virtio-scsi: move request-related items from .h to .c -Content-type: text/plain - -There is no longer a need to expose the request and related APIs in -virtio-scsi.h since there are no callers outside virtio-scsi.c. - -Note the block comment in VirtIOSCSIReq has been adjusted to meet the -coding style. - -Signed-off-by: Stefan Hajnoczi -Reviewed-by: Paolo Bonzini -Message-id: 20220427143541.119567-7-stefanha@redhat.com -Signed-off-by: Stefan Hajnoczi -(cherry picked from commit 3dc584abeef0e1277c2de8c1c1974cb49444eb0a) -Signed-off-by: Stefan Hajnoczi ---- - hw/scsi/virtio-scsi.c | 45 ++++++++++++++++++++++++++++++--- - include/hw/virtio/virtio-scsi.h | 40 ----------------------------- - 2 files changed, 41 insertions(+), 44 deletions(-) - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index 12c6a21202..db54d104be 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -29,6 +29,43 @@ - #include "hw/virtio/virtio-access.h" - #include "trace.h" - -+typedef struct VirtIOSCSIReq { -+ /* -+ * Note: -+ * - fields up to resp_iov are initialized by virtio_scsi_init_req; -+ * - fields starting at vring are zeroed by virtio_scsi_init_req. -+ */ -+ VirtQueueElement elem; -+ -+ VirtIOSCSI *dev; -+ VirtQueue *vq; -+ QEMUSGList qsgl; -+ QEMUIOVector resp_iov; -+ -+ union { -+ /* Used for two-stage request submission */ -+ QTAILQ_ENTRY(VirtIOSCSIReq) next; -+ -+ /* Used for cancellation of request during TMFs */ -+ int remaining; -+ }; -+ -+ SCSIRequest *sreq; -+ size_t resp_size; -+ enum SCSIXferMode mode; -+ union { -+ VirtIOSCSICmdResp cmd; -+ VirtIOSCSICtrlTMFResp tmf; -+ VirtIOSCSICtrlANResp an; -+ VirtIOSCSIEvent event; -+ } resp; -+ union { -+ VirtIOSCSICmdReq cmd; -+ VirtIOSCSICtrlTMFReq tmf; -+ VirtIOSCSICtrlANReq an; -+ } req; -+} VirtIOSCSIReq; -+ - static inline int virtio_scsi_get_lun(uint8_t *lun) - { - return ((lun[2] << 8) | lun[3]) & 0x3FFF; -@@ -45,7 +82,7 @@ static inline SCSIDevice *virtio_scsi_device_get(VirtIOSCSI *s, uint8_t *lun) - return scsi_device_get(&s->bus, 0, lun[1], virtio_scsi_get_lun(lun)); - } - --void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req) -+static void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req) - { - VirtIODevice *vdev = VIRTIO_DEVICE(s); - const size_t zero_skip = -@@ -58,7 +95,7 @@ void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req) - memset((uint8_t *)req + zero_skip, 0, sizeof(*req) - zero_skip); - } - --void virtio_scsi_free_req(VirtIOSCSIReq *req) -+static void virtio_scsi_free_req(VirtIOSCSIReq *req) - { - qemu_iovec_destroy(&req->resp_iov); - qemu_sglist_destroy(&req->qsgl); -@@ -801,8 +838,8 @@ static void virtio_scsi_reset(VirtIODevice *vdev) - s->events_dropped = false; - } - --void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, -- uint32_t event, uint32_t reason) -+static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, -+ uint32_t event, uint32_t reason) - { - VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); - VirtIOSCSIReq *req; -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index 2497530064..abdda2cbd0 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -94,42 +94,6 @@ struct VirtIOSCSI { - uint32_t host_features; - }; - --typedef struct VirtIOSCSIReq { -- /* Note: -- * - fields up to resp_iov are initialized by virtio_scsi_init_req; -- * - fields starting at vring are zeroed by virtio_scsi_init_req. -- * */ -- VirtQueueElement elem; -- -- VirtIOSCSI *dev; -- VirtQueue *vq; -- QEMUSGList qsgl; -- QEMUIOVector resp_iov; -- -- union { -- /* Used for two-stage request submission */ -- QTAILQ_ENTRY(VirtIOSCSIReq) next; -- -- /* Used for cancellation of request during TMFs */ -- int remaining; -- }; -- -- SCSIRequest *sreq; -- size_t resp_size; -- enum SCSIXferMode mode; -- union { -- VirtIOSCSICmdResp cmd; -- VirtIOSCSICtrlTMFResp tmf; -- VirtIOSCSICtrlANResp an; -- VirtIOSCSIEvent event; -- } resp; -- union { -- VirtIOSCSICmdReq cmd; -- VirtIOSCSICtrlTMFReq tmf; -- VirtIOSCSICtrlANReq an; -- } req; --} VirtIOSCSIReq; -- - static inline void virtio_scsi_acquire(VirtIOSCSI *s) - { - if (s->ctx) { -@@ -151,10 +115,6 @@ void virtio_scsi_common_realize(DeviceState *dev, - Error **errp); - - void virtio_scsi_common_unrealize(DeviceState *dev); --void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req); --void virtio_scsi_free_req(VirtIOSCSIReq *req); --void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, -- uint32_t event, uint32_t reason); - - void virtio_scsi_dataplane_setup(VirtIOSCSI *s, Error **errp); - int virtio_scsi_dataplane_start(VirtIODevice *s); diff --git a/0008-Disable-flakey-dbus-display-test.patch b/0008-Disable-flakey-dbus-display-test.patch deleted file mode 100644 index 01bae39..0000000 --- a/0008-Disable-flakey-dbus-display-test.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Cole Robinson -Date: Sat, 4 Jun 2022 20:28:58 -0400 -Subject: [PATCH] Disable flakey dbus-display-test -Content-type: text/plain - -Signed-off-by: Cole Robinson ---- - tests/qtest/meson.build | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build -index d25f82bb5a..d085604727 100644 ---- a/tests/qtest/meson.build -+++ b/tests/qtest/meson.build -@@ -94,10 +94,6 @@ qtests_i386 = \ - 'test-filter-redirector' - ] - --if dbus_display -- qtests_i386 += ['dbus-display-test'] --endif -- - dbus_daemon = find_program('dbus-daemon', required: false) - if dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN') - # Temporarily disabled due to Patchew failures: -@@ -298,10 +294,6 @@ qtests = { - 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), - } - --if dbus_display --qtests += {'dbus-display-test': [dbus_display1, gio]} --endif -- - qtest_executables = {} - foreach dir : target_dirs - if not dir.endswith('-softmmu') diff --git a/0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch b/0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch deleted file mode 100644 index d4f84a0..0000000 --- a/0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Cole Robinson -Date: Sat, 4 Jun 2022 20:29:46 -0400 -Subject: [PATCH] Fix iotests with modules and qemu-system-s390x -Content-type: text/plain - -Signed-off-by: Cole Robinson ---- - tests/qemu-iotests/common.rc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc -index 227e0a5be9..97f8e0a15f 100644 ---- a/tests/qemu-iotests/common.rc -+++ b/tests/qemu-iotests/common.rc -@@ -975,7 +975,7 @@ _require_large_file() - # - _require_devices() - { -- available=$($QEMU -M none -device help | \ -+ available=$($QEMU -M none -device help 2> /dev/null | \ - grep ^name | sed -e 's/^name "//' -e 's/".*$//') - for device - do -@@ -987,7 +987,7 @@ _require_devices() - - _require_one_device_of() - { -- available=$($QEMU -M none -device help | \ -+ available=$($QEMU -M none -device help 2> /dev/null | \ - grep ^name | sed -e 's/^name "//' -e 's/".*$//') - for device - do diff --git a/0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch b/0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch deleted file mode 100644 index 8718405..0000000 --- a/0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch +++ /dev/null @@ -1,100 +0,0 @@ -From a7f14aae85022007a4c77e0792a1abb0509a08eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Tue, 2 Aug 2022 12:34:23 -0400 -Subject: [PATCH] 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 - -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é ---- - linux-user/syscall.c | 18 ++++++++++++++++++ - meson.build | 2 ++ - 2 files changed, 20 insertions(+) - -diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index b27a6552aa..52d178afe7 100644 ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -95,7 +95,25 @@ - #include - #include - #include -+ -+#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 -+#endif - #include - #if defined(CONFIG_FIEMAP) - #include -diff --git a/meson.build b/meson.build -index 294e9a8f32..30a380752c 100644 ---- 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', --- -2.37.1 - diff --git a/qemu.spec b/qemu.spec index ff3c093..432d7c8 100644 --- a/qemu.spec +++ b/qemu.spec @@ -317,11 +317,11 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 9 +%global baserelease 1 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 7.0.0 +Version: 7.1.0 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: GPLv2 and BSD and MIT and CC-BY @@ -342,18 +342,8 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch -# Fix virtio-scsi hang (bz #2079347) -Patch: 0002-virtio-scsi-fix-ctrl-and-event-handler-functions-in-.patch -Patch: 0003-virtio-scsi-don-t-waste-CPU-polling-the-event-virtqu.patch -Patch: 0004-virtio-scsi-clean-up-virtio_scsi_handle_event_vq.patch -Patch: 0005-virtio-scsi-clean-up-virtio_scsi_handle_ctrl_vq.patch -Patch: 0006-virtio-scsi-clean-up-virtio_scsi_handle_cmd_vq.patch -Patch: 0007-virtio-scsi-move-request-related-items-from-.h-to-.c.patch -Patch: 0008-Disable-flakey-dbus-display-test.patch -Patch: 0009-Fix-iotests-with-modules-and-qemu-system-s390x.patch +Patch: 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch Patch: 0010-Skip-iotests-entirely.patch -# Not yet upstream, fix glibc 2.36 compat -Patch: 0011-linux-user-fix-compat-with-glibc-2.36-sys-mount.h.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel @@ -512,6 +502,11 @@ BuildRequires: pcre-static %endif %endif +# vfio-user-server +BuildRequires: pkgconfig(json-c) +BuildRequires: pkgconfig(cmocka) + + # Requires for the Fedora 'qemu' metapackage Requires: %{name}-user = %{epoch}:%{version}-%{release} Requires: %{name}-system-aarch64 = %{epoch}:%{version}-%{release} @@ -519,6 +514,7 @@ Requires: %{name}-system-alpha = %{epoch}:%{version}-%{release} Requires: %{name}-system-arm = %{epoch}:%{version}-%{release} Requires: %{name}-system-avr = %{epoch}:%{version}-%{release} Requires: %{name}-system-cris = %{epoch}:%{version}-%{release} +Requires: %{name}-system-loongarch64 = %{epoch}:%{version}-%{release} Requires: %{name}-system-m68k = %{epoch}:%{version}-%{release} Requires: %{name}-system-microblaze = %{epoch}:%{version}-%{release} Requires: %{name}-system-mips = %{epoch}:%{version}-%{release} @@ -959,6 +955,7 @@ Requires: qemu-user-static-arm Requires: qemu-user-static-cris Requires: qemu-user-static-hexagon Requires: qemu-user-static-hppa +Requires: qemu-user-static-loongarch64 Requires: qemu-user-static-m68k Requires: qemu-user-static-microblaze Requires: qemu-user-static-mips @@ -1012,6 +1009,12 @@ Summary: QEMU user mode emulation of hppa qemu targets static build This package provides the hppa user mode emulation of qemu targets built as static binaries +%package user-static-loongarch64 +Summary: QEMU user mode emulation of loongarch64 qemu targets static build +%description user-static-loongarch64 +This package provides the loongarch64 user mode emulation of qemu targets built as +static binaries + %package user-static-m68k Summary: QEMU user mode emulation of m68k qemu targets static build %description user-static-m68k @@ -1176,6 +1179,20 @@ Requires: %{name}-common = %{epoch}:%{version}-%{release} This package provides the QEMU system emulator for HPPA. +%package system-loongarch64 +Summary: QEMU system emulator for LoongArch (LA64) +Requires: %{name}-system-loongarch64-core = %{epoch}:%{version}-%{release} +%{requires_all_modules} +%description system-loongarch64 +This package provides the QEMU system emulator for Loongson boards. + +%package system-loongarch64-core +Summary: QEMU system emulator for LoongArch (LA64) +Requires: %{name}-common = %{epoch}:%{version}-%{release} +%description system-loongarch64-core +This package provides the QEMU system emulator for Loongson boards. + + %package system-m68k Summary: QEMU system emulator for ColdFire (m68k) Requires: %{name}-system-m68k-core = %{epoch}:%{version}-%{release} @@ -1386,8 +1403,6 @@ Requires: %{name}-common = %{epoch}:%{version}-%{release} This package provides the QEMU system emulator for Xtensa boards. - - %prep %setup -q -n qemu-%{version}%{?rcstr} %autosetup -S git_am @@ -1508,20 +1523,19 @@ mkdir -p %{static_builddir} --disable-user \\\ --disable-vde \\\ --disable-vdi \\\ + --disable-vfio-user-server \\\ --disable-vhost-crypto \\\ --disable-vhost-kernel \\\ --disable-vhost-net \\\ - --disable-vhost-scsi \\\ --disable-vhost-user \\\ --disable-vhost-user-blk-server \\\ --disable-vhost-vdpa \\\ - --disable-vhost-vsock \\\ --disable-virglrenderer \\\ --disable-virtfs \\\ --disable-virtiofsd \\\ --disable-vnc \\\ --disable-vnc-jpeg \\\ - --disable-vnc-png \\\ + --disable-png \\\ --disable-vnc-sasl \\\ --disable-vte \\\ --disable-vvfat \\\ @@ -1589,7 +1603,7 @@ run_configure \ %endif --enable-bpf \ --enable-cap-ng \ - --enable-capstone=auto \ + --enable-capstone \ --enable-coroutine-pool \ --enable-curl \ %if %{have_dbus_display} @@ -1657,9 +1671,8 @@ run_configure \ --enable-vhost-user \ --enable-vhost-user-blk-server \ --enable-vhost-vdpa \ - --enable-vhost-vsock \ --enable-vnc \ - --enable-vnc-png \ + --enable-png \ --enable-vnc-sasl \ %if %{enable_werror} --enable-werror \ @@ -1716,8 +1729,8 @@ run_configure \ %endif --enable-usb-redir \ --enable-vdi \ + --enable-vfio-user-server \ --enable-vhost-crypto \ - --enable-vhost-scsi \ %if %{have_virgl} --enable-virglrenderer \ %endif @@ -2039,6 +2052,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %postun user-static-hppa /bin/systemctl --system try-restart systemd-binfmt.service &>/dev/null || : +%post user-static-loongarch64 +/bin/systemctl --system try-restart systemd-binfmt.service &>/dev/null || : +%postun user-static-loongarch64 +/bin/systemctl --system try-restart systemd-binfmt.service &>/dev/null || : + %post user-static-m68k /bin/systemctl --system try-restart systemd-binfmt.service &>/dev/null || : %postun user-static-m68k @@ -2190,6 +2208,8 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ # Fedora specific %{_datadir}/applications/qemu.desktop %exclude %{_datadir}/%{name}/qemu-nsis.bmp +%{_libdir}/libvfio-user.so* +%exclude %{_includedir}/vfio-user/ %{_libexecdir}/virtfs-proxy-helper %{_mandir}/man1/virtfs-proxy-helper.1* @@ -2325,6 +2345,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{_bindir}/qemu-cris %{_bindir}/qemu-hppa %{_bindir}/qemu-hexagon +%{_bindir}/qemu-loongarch64 %{_bindir}/qemu-m68k %{_bindir}/qemu-microblaze %{_bindir}/qemu-microblazeel @@ -2358,6 +2379,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{_datadir}/systemtap/tapset/qemu-cris*.stp %{_datadir}/systemtap/tapset/qemu-hppa*.stp %{_datadir}/systemtap/tapset/qemu-hexagon*.stp +%{_datadir}/systemtap/tapset/qemu-loongarch64*.stp %{_datadir}/systemtap/tapset/qemu-m68k*.stp %{_datadir}/systemtap/tapset/qemu-microblaze*.stp %{_datadir}/systemtap/tapset/qemu-mips*.stp @@ -2416,6 +2438,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{_datadir}/systemtap/tapset/qemu-hppa-static.stp %{_exec_prefix}/lib/binfmt.d/qemu-hppa-static.conf +%files user-static-loongarch64 +%{_bindir}/qemu-loongarch64-static +%{_datadir}/systemtap/tapset/qemu-loongarch64-static.stp +%{_exec_prefix}/lib/binfmt.d/qemu-loongarch64-static.conf + %files user-static-m68k %{_bindir}/qemu-m68k-static %{_datadir}/systemtap/tapset/qemu-m68k-static.stp @@ -2574,6 +2601,13 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{_datadir}/%{name}/hppa-firmware.img +%files system-loongarch64 +%files system-loongarch64-core +%{_bindir}/qemu-system-loongarch64 +%{_datadir}/systemtap/tapset/qemu-system-loongarch64*.stp +%{_mandir}/man1/qemu-system-loongarch64.1* + + %files system-m68k %files system-m68k-core %{_bindir}/qemu-system-m68k @@ -2723,6 +2757,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Wed Aug 31 2022 Eduardo Lima (Etrunko) - 7.1.0-1 +- Rebase to qemu 7.1.0 + * Tue Aug 2 2022 Daniel P. Berrangé - 7.0.0-9 - Fix compat with glibc 2.36 headers diff --git a/sources b/sources index 9f53caf..9b00967 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-7.0.0.tar.xz) = 44ecd10c018a3763e1bc87d1d35b98890d0d5636acd69fe9b5cadf5024d5af6a31684d60cbe1c3370e02986434c1fb0ad99224e0e6f6fe7eda169992508157b1 +SHA512 (qemu-7.1.0.tar.xz) = c60c5ff8ec99b7552e485768908920658fdd8035ff7a6fa370fb6881957dc8b7e5f18ff1a8f49bd6aa22909ede2a7c084986d8244f12074ccd33ebe40a0c411f From 64fe772650933381e2fdb01ef4001f58fc40c1ed Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Fri, 2 Sep 2022 11:57:58 -0300 Subject: [PATCH 08/54] Disable vfio-user for the moment https://github.com/nutanix/libvfio-user/issues/707 Signed-off-by: Eduardo Lima (Etrunko) --- qemu.spec | 7 ------- 1 file changed, 7 deletions(-) diff --git a/qemu.spec b/qemu.spec index 432d7c8..7de9686 100644 --- a/qemu.spec +++ b/qemu.spec @@ -502,10 +502,6 @@ BuildRequires: pcre-static %endif %endif -# vfio-user-server -BuildRequires: pkgconfig(json-c) -BuildRequires: pkgconfig(cmocka) - # Requires for the Fedora 'qemu' metapackage Requires: %{name}-user = %{epoch}:%{version}-%{release} @@ -1729,7 +1725,6 @@ run_configure \ %endif --enable-usb-redir \ --enable-vdi \ - --enable-vfio-user-server \ --enable-vhost-crypto \ %if %{have_virgl} --enable-virglrenderer \ @@ -2208,8 +2203,6 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ # Fedora specific %{_datadir}/applications/qemu.desktop %exclude %{_datadir}/%{name}/qemu-nsis.bmp -%{_libdir}/libvfio-user.so* -%exclude %{_includedir}/vfio-user/ %{_libexecdir}/virtfs-proxy-helper %{_mandir}/man1/virtfs-proxy-helper.1* From bd46f9571e3eb504faebaac255801436c1cae0a9 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 7 Sep 2022 12:12:58 -0400 Subject: [PATCH 09/54] Add .rpmlintrc to exclude some .spec lint Signed-off-by: Cole Robinson --- .rpmlintrc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .rpmlintrc diff --git a/.rpmlintrc b/.rpmlintrc new file mode 100644 index 0000000..805036e --- /dev/null +++ b/.rpmlintrc @@ -0,0 +1,6 @@ +# Using _sourcedir makes the spec much more readable IMO. +# The Fedora wiki complaint is pretty obscure too. +addFilter(r'use-of-RPM_SOURCE_DIR') + +# This is a virtual Provides: that should not contain any version info +addFilter(r'unversioned-explicit-provides vhostuser-backend\(fs\)') From 795912844a2df89aa51e1e3c7e6fbb1c99440489 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Thu, 8 Sep 2022 14:12:47 +0100 Subject: [PATCH 10/54] Bump required meson version --- qemu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index 7de9686..1fb47c3 100644 --- a/qemu.spec +++ b/qemu.spec @@ -6,7 +6,7 @@ %global libfdt_version 1.6.0 %global libseccomp_version 2.4.0 %global libusbx_version 1.0.23 -%global meson_version 0.58.2 +%global meson_version 0.59.3 %global usbredir_version 0.7.1 %global ipxe_version 20200823-5.git4bd064de @@ -317,7 +317,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 1 +%global baserelease 2 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2750,6 +2750,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +- Thu Sep 08 2022 Davide Cavalca - 7.1.0-2 +- Bump required meson version + * Wed Aug 31 2022 Eduardo Lima (Etrunko) - 7.1.0-1 - Rebase to qemu 7.1.0 From 92a87311fd2b58a3159326ada8557230cadc6342 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Thu, 8 Sep 2022 16:42:15 +0100 Subject: [PATCH 11/54] Unconditionally enable capstone-devel --- qemu.spec | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/qemu.spec b/qemu.spec index 1fb47c3..f0845fc 100644 --- a/qemu.spec +++ b/qemu.spec @@ -144,13 +144,6 @@ %define have_block_nfs 1 %endif -%define have_capstone_devel 0 -%if 0%{?fedora} -# capstone-devel is only on Fedora. Use it if it's available, but -# if not, use the internal qemu submodule copy -%define have_capstone_devel 1 -%endif - %define have_librdma 1 %ifarch %{arm} %define have_librdma 0 @@ -317,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 2 +%global baserelease 3 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -464,10 +457,8 @@ BuildRequires: libcacard-devel # virgl 3d support BuildRequires: virglrenderer-devel %endif -%if %{have_capstone_devel} # preferred disassembler for TCG BuildRequires: capstone-devel -%endif # qemu-ga BuildRequires: libudev-devel # qauth infrastructure @@ -2750,6 +2741,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +- Thu Sep 08 2022 Davide Cavalca - 7.1.0-3 +- Unconditionally enable capstone-devel + - Thu Sep 08 2022 Davide Cavalca - 7.1.0-2 - Bump required meson version From 7539983f1edd6122894964212d5327aa445ac71e Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Tue, 27 Sep 2022 11:47:54 -0300 Subject: [PATCH 12/54] Fix changelog entries --- qemu.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index f0845fc..c564584 100644 --- a/qemu.spec +++ b/qemu.spec @@ -2741,10 +2741,10 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog -- Thu Sep 08 2022 Davide Cavalca - 7.1.0-3 +* Thu Sep 08 2022 Davide Cavalca - 7.1.0-3 - Unconditionally enable capstone-devel -- Thu Sep 08 2022 Davide Cavalca - 7.1.0-2 +* Thu Sep 08 2022 Davide Cavalca - 7.1.0-2 - Bump required meson version * Wed Aug 31 2022 Eduardo Lima (Etrunko) - 7.1.0-1 From d09d3961a3b1d6f8f03e1701af19dca4415a916d Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Fri, 11 Nov 2022 15:02:07 -0300 Subject: [PATCH 13/54] Rebuild for libbpf 1.0.0 --- qemu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index c564584..38b7b7f 100644 --- a/qemu.spec +++ b/qemu.spec @@ -310,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 3 +%global baserelease 4 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -399,7 +399,7 @@ BuildRequires: pkgconfig(gbm) %endif BuildRequires: perl-Test-Harness BuildRequires: libslirp-devel -BuildRequires: libbpf-devel +BuildRequires: libbpf-devel >= 1.0.0 # Fedora specific @@ -2741,6 +2741,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Fri Nov 11 2022 Eduardo Lima (Etrunko) - 7.1.0-4 +- Update libbpf dependency + * Thu Sep 08 2022 Davide Cavalca - 7.1.0-3 - Unconditionally enable capstone-devel From 3ce4eaa6a20ac915fb75a872eaaee71b70758b3f Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Tue, 20 Dec 2022 14:52:36 -0300 Subject: [PATCH 14/54] qemu-7.2.0-1 --- qemu.spec | 14 ++++++++++---- sources | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qemu.spec b/qemu.spec index 38b7b7f..b517668 100644 --- a/qemu.spec +++ b/qemu.spec @@ -6,7 +6,7 @@ %global libfdt_version 1.6.0 %global libseccomp_version 2.4.0 %global libusbx_version 1.0.23 -%global meson_version 0.59.3 +%global meson_version 0.61.3 %global usbredir_version 0.7.1 %global ipxe_version 20200823-5.git4bd064de @@ -310,11 +310,11 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 4 +%global baserelease 1 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 7.1.0 +Version: 7.2.0 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: GPLv2 and BSD and MIT and CC-BY @@ -1409,6 +1409,7 @@ mkdir -p %{static_builddir} --disable-auth-pam \\\ --disable-avx2 \\\ --disable-avx512f \\\ + --disable-blkio \\\ --disable-block-drv-whitelist-in-tools \\\ --disable-bochs \\\ --disable-bpf \\\ @@ -1442,6 +1443,7 @@ mkdir -p %{static_builddir} --disable-glusterfs \\\ --disable-gnutls \\\ --disable-gtk \\\ + --disable-gtk-clipboard \\\ --disable-guest-agent \\\ --disable-guest-agent-msi \\\ --disable-hax \\\ @@ -1497,6 +1499,7 @@ mkdir -p %{static_builddir} --disable-slirp-smbd \\\ --disable-smartcard \\\ --disable-snappy \\\ + --disable-sndio \\\ --disable-sparse \\\ --disable-spice \\\ --disable-spice-protocol \\\ @@ -1642,7 +1645,7 @@ run_configure \ %endif --enable-seccomp \ --enable-selinux \ - --enable-slirp=system \ + --enable-slirp \ --enable-slirp-smbd \ --enable-snappy \ --enable-system \ @@ -2741,6 +2744,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Mon Dec 19 2022 Eduardo Lima (Etrunko) - 7.2.0-1 +- Rebase to qemu 7.2.0 + * Fri Nov 11 2022 Eduardo Lima (Etrunko) - 7.1.0-4 - Update libbpf dependency diff --git a/sources b/sources index 9b00967..c45f059 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-7.1.0.tar.xz) = c60c5ff8ec99b7552e485768908920658fdd8035ff7a6fa370fb6881957dc8b7e5f18ff1a8f49bd6aa22909ede2a7c084986d8244f12074ccd33ebe40a0c411f +SHA512 (qemu-7.2.0.tar.xz) = f3cfa00da739ba819a218d7e6e95c77fb79a8e0f487b024ddd281602e785249b81144595e3f8c746c32a4f5c4d1a88c6aebae3c162603edfbb50ae3722d7ed13 From 6a1d35e9123aeb9aef7ef3e4b90e930ce594eea7 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 3 Jan 2023 08:24:36 +0000 Subject: [PATCH 15/54] Rebuild for xen-4.17.0 --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index b517668..ecc45e2 100644 --- a/qemu.spec +++ b/qemu.spec @@ -310,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 1 +%global baserelease 2 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2744,6 +2744,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Tue Jan 03 2023 Richard W.M. Jones - 2:7.2.0-2 +- Rebuild for xen-4.17.0 + * Mon Dec 19 2022 Eduardo Lima (Etrunko) - 7.2.0-1 - Rebase to qemu 7.2.0 From b47d99db35c2b2e496c0846128384791ce4c4c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Mon, 9 Jan 2023 10:43:01 +0000 Subject: [PATCH 16/54] Trim changelogs older than 2 years MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- qemu.spec | 122 ------------------------------------------------------ 1 file changed, 122 deletions(-) diff --git a/qemu.spec b/qemu.spec index ecc45e2..2f6d242 100644 --- a/qemu.spec +++ b/qemu.spec @@ -2948,125 +2948,3 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ * Mon Jan 11 2021 Paolo Bonzini - 2:5.2.0-5 - Use symlink for qemu-kvm. - Fix make check on bash 5.1. - -* Fri Dec 11 2020 Richard W.M. Jones - 2:5.2.0-4 -- qemu-char-spice not qemu-chardev-spice. - -* Thu Dec 10 2020 Mohan Boddu - 5.2.0-2 -- Fixing the ISA Dependencies - -* Wed Dec 09 2020 Cole Robinson - 5.2.0-1 -- Rebase to qemu-5.2.0 GA -- Fix spice and GL UI module deps (bz 1904603) - -* Thu Dec 03 2020 Richard W.M. Jones - 5.2.0-0.9.rc4 -- Enable qemu-kvm-core package on riscv64. - -* Thu Dec 03 2020 Cole Robinson - 5.2.0-0.8.rc4 -- Rebase to qemu-5.2.0-rc4 - -* Tue Nov 24 2020 Cole Robinson - 5.2.0-0.7.rc2 -- Fix running 9p tests in copr - -* Thu Nov 19 2020 Paolo Bonzini - 5.2.0-0.6.rc2 -- Remove --python=... to force use of system meson - -* Thu Nov 19 2020 Daniel P. Berrangé - 5.2.0-0.5.rc2 -- Re-enable systemtap tracing - -* Wed Nov 18 2020 Cole Robinson - 5.2.0-0.4.rc2 -- Rebase to qemu-5.2.0-rc2 - -* Fri Nov 13 2020 Daniel P. Berrangé - 5.2.0-0.3.rc1 -- Disable user mode static builds in ELN - -* Wed Nov 11 2020 Cole Robinson - 5.2.0-0.2.rc1 -- Rebase to qemu-5.2.0-rc1 - -* Sun Nov 08 2020 Cole Robinson - 5.2.0-0.1.rc0 -- Rebase to qemu-5.2.0-rc0 - -* Thu Nov 5 2020 Daniel P. Berrangé - 5.1.0-7 -- Disable LTO again. Tests were not passing, we were ignoring failures. - -* Mon Oct 26 2020 Daniel P. Berrangé - 5.1.0-6 -- Re-enable LTO since tests now pass without asserts - -* Fri Sep 4 2020 Daniel P. Berrangé - 5.1.0-5 -- Drop conditions for ppc, ppc64, mips64 and s390 arches -- Fix host qemu binary path for aarch64 -- Re-enable kernel BR for QEMU sanity check -- Fix conditionals for enabling QEMU sanity check -- Check whether emulator works before doing sanity check -- Provide explicit kernel path for QEMU sanity check -- Make QEMU sanity check a build blocker - -* Thu Sep 3 2020 Daniel P. Berrangé - 5.1.0-4 -- Add btrfs ioctls to linux-user (rhbz #1872918) - -* Tue Aug 18 2020 Tom Stellard - 5.1.0-3 -- Add BuildRequires: gcc -- https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B#BuildRequires_and_Requires - -* Mon Aug 17 2020 Cole Robinson - 5.1.0-2 -- Disable dtrace generation to fix use of modules (bz 1869339) - -* Tue Aug 11 2020 Cole Robinson - 5.1.0-1 -- Update to version 5.1.0 - -* Fri Aug 07 2020 Cole Robinson - 5.1.0-0.3.rc3 -- Update to version 5.1.0-rc3 - -* Thu Aug 06 2020 Merlin Mathesius - 5.1.0-0.2.rc2 -- Use new %%{kernel_arches} macro to determine when a full kernel is available - -* Wed Aug 05 2020 Cole Robinson - 5.1.0-0.2.rc2 -- Pull in new modules by default, like we do for others - -* Tue Aug 04 2020 Cole Robinson - 5.1.0-0.1.rc2 -- Update to qemu 5.1.0 rc2 - -* Fri Jul 31 2020 Daniel P. Berrangé - 5.0.0-6 -- Remove obsolete Fedora conditionals (PR#9) - -* Thu Jul 30 2020 Richard W.M. Jones - 5.0.0-5 -- Disable LTO as it caused many strange assert failures. - -* Wed Jul 29 2020 Richard W.M. Jones - 5.0.0-4 -- Backport Dan's upstream patch to fix insecure cert in test suite. - -* Mon Jul 27 2020 Kevin Fenzi - 5.0.0-3 -- Rebuild for new xen - -* Wed May 13 2020 Cole Robinson - 5.0.0-2 -- Fix iouring hang (bz #1823751) - -* Wed May 06 2020 Cole Robinson - 5.0.0-1 -- Update to version 5.0.0 - -* Thu Apr 16 2020 Cole Robinson - 5.0.0-0.3.rc3 -- Update to qemu 5.0.0 rc3 - -* Thu Apr 09 2020 Cole Robinson - 5.0.0-0.3.rc2 -- Update to qemu 5.0.0 rc2 - -* Wed Apr 08 2020 Adam Williamson - 2:5.0.0-0.2.rc0 -- Rebuild for new brltty - -* Wed Mar 25 2020 Cole Robinson - 2:5.0.0-0.1.rc0 -- Update to qemu-5.0.0-rc0 - -* Tue Mar 17 2020 Fabiano Fidêncio - 2:4.2.0-7 -- Fix segfault with SR-IOV hot-{plug,unplug} (bz #1814017) - -* Tue Feb 25 2020 Cole Robinson - 2:4.2.0-6 -- Rebuild for libiscsi soname bump - -* Sat Feb 15 2020 Cole Robinson - 2:4.2.0-5 -- Fix ppc shutdown issue (bz #1784961) - -* Tue Jan 28 2020 Cole Robinson - 2:4.2.0-4 -- virtio-fs support - -* Sat Jan 25 2020 Richard W.M. Jones - 4.2.0-3 -- Add miscellaneous fixes for RISC-V (RHBZ#1794902). From c59732e734abe4f9d56442be1903f022c50602ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 13:03:55 -0500 Subject: [PATCH 17/54] Fix compat with linux > 6.1 headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from /usr/include/linux/btrfs.h:29, from ../linux-user/syscall.c:163: /usr/include/linux/fs.h:50:8: error: redefinition of 'struct file_clone_range' 50 | struct file_clone_range { | ^~~~~~~~~~~~~~~~ ../linux-user/syscall.c:129:8: note: originally defined here 129 | struct file_clone_range { | ^~~~~~~~~~~~~~~~ was caused by btrfs.h gaining an include of linux/fs.h, which clashed with QEMU's workaround for glibc compat with linux/mount.h. GLibc huas fixed their sys/mount.h so we can drop the QEMU workaround, thus fixing the btrfs.h problem. Signed-off-by: Daniel P. Berrangé --- ...er-add-more-compat-ioctl-definitions.patch | 67 ++++++++++++++++ ...r-fix-compat-with-glibc-2.36-sys-mou.patch | 76 +++++++++++++++++++ qemu.spec | 8 +- 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch create mode 100644 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch diff --git a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch new file mode 100644 index 0000000..e263067 --- /dev/null +++ b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch @@ -0,0 +1,67 @@ +From ebff02a43374c1138d4f8b2c07d2088a3921c288 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 10 Jan 2023 12:37:14 -0500 +Subject: [PATCH 1/2] 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é +--- + linux-user/syscall.c | 25 ------------------------- + 1 file changed, 25 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 1f8c10f8ef..9c1e9555e1 100644 +--- 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 + #endif +-- +2.38.1 + diff --git a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch new file mode 100644 index 0000000..08f5180 --- /dev/null +++ b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch @@ -0,0 +1,76 @@ +From f0f11a1435802b5c8ee8337a7b0c0f337d8f9936 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 10 Jan 2023 12:37:25 -0500 +Subject: [PATCH 2/2] 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é +--- + linux-user/syscall.c | 18 ------------------ + meson.build | 2 -- + 2 files changed, 20 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 9c1e9555e1..f2b7634f5e 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -95,25 +95,7 @@ + #include + #include + #include +- +-#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 +-#endif + #include + #if defined(CONFIG_FIEMAP) + #include +diff --git a/meson.build b/meson.build +index 175517eafd..32fed7ea6e 100644 +--- a/meson.build ++++ b/meson.build +@@ -2039,8 +2039,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', +-- +2.38.1 + diff --git a/qemu.spec b/qemu.spec index 2f6d242..49c0aa5 100644 --- a/qemu.spec +++ b/qemu.spec @@ -310,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 2 +%global baserelease 3 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -336,6 +336,9 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch Patch: 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch +# Fix compat with kernel-headers >= 6.1 +Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch +Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch Patch: 0010-Skip-iotests-entirely.patch BuildRequires: meson >= %{meson_version} @@ -2744,6 +2747,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Tue Jan 10 2023 Daniel P. Berrangé - 7.2.0-3 +- Fix compat with linux > 6.1 headers + * Tue Jan 03 2023 Richard W.M. Jones - 2:7.2.0-2 - Rebuild for xen-4.17.0 From fcf47181da6df2cc690e1681120e4b7b85999ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 13:05:30 -0500 Subject: [PATCH 18/54] Re-enable running of iotests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6 months and 2 QEMU release later, we want to test if they are more reliable now. At least we'll get better diagnostic of which test is hanging since the patch in https://www.mail-archive.com/qemu-devel@nongnu.org/msg887683.html is included in this QEMU Signed-off-by: Daniel P. Berrangé --- 0010-Skip-iotests-entirely.patch | 26 -------------------------- qemu.spec | 2 +- 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 0010-Skip-iotests-entirely.patch diff --git a/0010-Skip-iotests-entirely.patch b/0010-Skip-iotests-entirely.patch deleted file mode 100644 index 8586d6f..0000000 --- a/0010-Skip-iotests-entirely.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Cole Robinson -Date: Sun, 5 Jun 2022 12:48:29 -0400 -Subject: [PATCH] Skip iotests entirely -Content-type: text/plain - -Getting sporadic failures like described here: -https://www.mail-archive.com/qemu-devel@nongnu.org/msg887683.html - -Signed-off-by: Cole Robinson ---- - tests/check-block.sh | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tests/check-block.sh b/tests/check-block.sh -index f59496396c..09cc735da4 100755 ---- a/tests/check-block.sh -+++ b/tests/check-block.sh -@@ -50,6 +50,8 @@ fi - - cd tests/qemu-iotests - -+exit 0 -+ - # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests - export QEMU_CHECK_BLOCK_AUTO=1 - export PYTHONUTF8=1 diff --git a/qemu.spec b/qemu.spec index 49c0aa5..6bbeef4 100644 --- a/qemu.spec +++ b/qemu.spec @@ -339,7 +339,6 @@ Patch: 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch # Fix compat with kernel-headers >= 6.1 Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch -Patch: 0010-Skip-iotests-entirely.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel @@ -2749,6 +2748,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog * Tue Jan 10 2023 Daniel P. Berrangé - 7.2.0-3 - Fix compat with linux > 6.1 headers +- Re-enable iotests * Tue Jan 03 2023 Richard W.M. Jones - 2:7.2.0-2 - Rebuild for xen-4.17.0 From 3f79a68361106b6ba3c802b99605f8517ee8577c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 11 Jan 2023 22:16:19 +0000 Subject: [PATCH 19/54] Rebuild for xen-4.17.0, second attempt --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 6bbeef4..9d2af8e 100644 --- a/qemu.spec +++ b/qemu.spec @@ -310,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 3 +%global baserelease 4 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2746,6 +2746,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Wed Jan 11 2023 Richard W.M. Jones - 2:7.2.0-4 +- Rebuild for xen-4.17.0, second attempt + * Tue Jan 10 2023 Daniel P. Berrangé - 7.2.0-3 - Fix compat with linux > 6.1 headers - Re-enable iotests From 8f629c7e0fc3dbbf84639e80d8f764028417016b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 20 Jan 2023 18:52:09 +0000 Subject: [PATCH 20/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 9d2af8e..45b52bb 100644 --- a/qemu.spec +++ b/qemu.spec @@ -310,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 4 +%global baserelease 5 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2746,6 +2746,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Fri Jan 20 2023 Fedora Release Engineering - 2:7.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Wed Jan 11 2023 Richard W.M. Jones - 2:7.2.0-4 - Rebuild for xen-4.17.0, second attempt From 4eb8ef11c187c1146e624dfdd7eaf99a5e9dda97 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 31 Jan 2023 10:05:33 -0500 Subject: [PATCH 21/54] Enable libblkio The libblkio package was added to Fedora. It is now possible to enable the blkio block driver in QEMU. Signed-off-by: Stefan Hajnoczi --- qemu.spec | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/qemu.spec b/qemu.spec index 45b52bb..d09ead2 100644 --- a/qemu.spec +++ b/qemu.spec @@ -163,6 +163,7 @@ %global qemudocdir %{_docdir}/%{name} %define evr %{epoch}:%{version}-%{release} +%define requires_block_blkio Requires: %{name}-block-blkio = %{evr} %define requires_block_curl Requires: %{name}-block-curl = %{evr} %define requires_block_dmg Requires: %{name}-block-dmg = %{evr} %if %{have_block_gluster} @@ -252,6 +253,7 @@ %endif %global requires_all_modules \ +%{requires_block_blkio} \ %{requires_block_curl} \ %{requires_block_dmg} \ %{requires_block_gluster} \ @@ -402,6 +404,7 @@ BuildRequires: pkgconfig(gbm) BuildRequires: perl-Test-Harness BuildRequires: libslirp-devel BuildRequires: libbpf-devel >= 1.0.0 +BuildRequires: libblkio-devel # Fedora specific @@ -608,6 +611,16 @@ Install this package if you want access to the avocado_qemu tests, or qemu-iotests. +%package block-blkio +Summary: QEMU blkio block driver +Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} +%description block-blkio +This package provides the additional blkio block driver for QEMU. + +Install this package if you want to access disks over vhost-user-blk, vdpa-blk, +and other transports using the libblkio library. + + %package block-curl Summary: QEMU CURL block driver Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} @@ -1593,6 +1606,7 @@ run_configure \ %ifarch %{ix86} x86_64 --enable-avx2 \ %endif + --enable-blkio \ --enable-bpf \ --enable-cap-ng \ --enable-capstone \ @@ -2207,6 +2221,8 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{testsdir} %{_libdir}/%{name}/accel-qtest-*.so +%files block-blkio +%{_libdir}/%{name}/block-blkio.so %files block-curl %{_libdir}/%{name}/block-curl.so %files block-iscsi @@ -2746,6 +2762,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Tue Jan 31 2023 Stefan Hajnoczi - 7.2.0-6 +- Enable libblkio + * Fri Jan 20 2023 Fedora Release Engineering - 2:7.2.0-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 8d94f851ece4970bfeca66a88f24d39b62737ce9 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Wed, 1 Feb 2023 08:54:00 -0300 Subject: [PATCH 22/54] qemu-7.2.0-6 --- qemu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index d09ead2..a051a0a 100644 --- a/qemu.spec +++ b/qemu.spec @@ -312,7 +312,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 5 +%global baserelease 6 Summary: QEMU is a FAST! processor emulator Name: qemu From 650c8272f694506bce9ae7914868bf9260a018e2 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 14 Feb 2023 10:25:18 -0500 Subject: [PATCH 23/54] Handle missing libblkio on fedora < 37 Signed-off-by: Cole Robinson --- qemu.spec | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qemu.spec b/qemu.spec index a051a0a..d2ee4d3 100644 --- a/qemu.spec +++ b/qemu.spec @@ -114,6 +114,11 @@ %global have_dbus_display 0 %endif +%global have_libblkio 0 +%if 0%{?fedora} >= 37 +%global have_libblkio 1 +%endif + %global have_sdl_image %{defined fedora} %global have_fdt 1 %global have_opengl 1 @@ -163,7 +168,11 @@ %global qemudocdir %{_docdir}/%{name} %define evr %{epoch}:%{version}-%{release} +%if %{have_libblkio} %define requires_block_blkio Requires: %{name}-block-blkio = %{evr} +%else +%define requires_block_blkio %{nil} +%endif %define requires_block_curl Requires: %{name}-block-curl = %{evr} %define requires_block_dmg Requires: %{name}-block-dmg = %{evr} %if %{have_block_gluster} @@ -404,7 +413,9 @@ BuildRequires: pkgconfig(gbm) BuildRequires: perl-Test-Harness BuildRequires: libslirp-devel BuildRequires: libbpf-devel >= 1.0.0 +%if %{have_libblkio} BuildRequires: libblkio-devel +%endif # Fedora specific @@ -611,6 +622,7 @@ Install this package if you want access to the avocado_qemu tests, or qemu-iotests. +%if %{have_libblkio} %package block-blkio Summary: QEMU blkio block driver Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} @@ -619,6 +631,7 @@ This package provides the additional blkio block driver for QEMU. Install this package if you want to access disks over vhost-user-blk, vdpa-blk, and other transports using the libblkio library. +%endif %package block-curl @@ -1606,7 +1619,9 @@ run_configure \ %ifarch %{ix86} x86_64 --enable-avx2 \ %endif +%if %{have_libblkio} --enable-blkio \ +%endif --enable-bpf \ --enable-cap-ng \ --enable-capstone \ @@ -2221,8 +2236,10 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{testsdir} %{_libdir}/%{name}/accel-qtest-*.so +%if %{have_libblkio} %files block-blkio %{_libdir}/%{name}/block-blkio.so +%endif %files block-curl %{_libdir}/%{name}/block-curl.so %files block-iscsi From fb1517ca3f5287a9d23c219b06f2abce6a51230a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 27 Feb 2023 11:47:44 +0000 Subject: [PATCH 24/54] Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) --- ...sgx_epc_get_section-stub-is-reachabl.patch | 7 ++- ...sts-Disable-pci_virtio_vga-for-ppc64.patch | 6 +-- ...er-add-more-compat-ioctl-definitions.patch | 8 ++-- ...r-fix-compat-with-glibc-2.36-sys-mou.patch | 12 ++--- ...-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch | 45 +++++++++++++++++++ qemu.spec | 9 +++- 6 files changed, 70 insertions(+), 17 deletions(-) rename 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch => 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch (90%) create mode 100644 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch diff --git a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch index cc5ada9..92a74eb 100644 --- a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch +++ b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch @@ -1,10 +1,10 @@ +From e54512fe75f85640c0c73e53e6f8bd0b9d193529 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 1 Feb 2022 20:09:37 +0100 -Subject: [PATCH] target/i386: the sgx_epc_get_section stub is reachable +Subject: [PATCH 1/5] target/i386: the sgx_epc_get_section stub is reachable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Content-type: text/plain The sgx_epc_get_section stub is reachable from cpu_x86_cpuid. It should not assert, instead it should just return true just like @@ -28,3 +28,6 @@ index 26833eb233..16b1dfd90b 100644 - g_assert_not_reached(); + return true; } +-- +2.37.3 + diff --git a/0001-tests-Disable-pci_virtio_vga-for-ppc64.patch b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch similarity index 90% rename from 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch rename to 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch index 26d8ed7..2172c4d 100644 --- a/0001-tests-Disable-pci_virtio_vga-for-ppc64.patch +++ b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch @@ -1,7 +1,7 @@ -From f6d5fd60f54fb9dcdc3733154637a3a214f5d5af Mon Sep 17 00:00:00 2001 +From 2f0a0afbf915d36c39c5cfac1e31c6edc7f47bef Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Thu, 1 Sep 2022 12:43:49 -0300 -Subject: [PATCH] tests: Disable pci_virtio_vga for ppc64 +Subject: [PATCH 2/5] tests: Disable pci_virtio_vga for ppc64 starting QEMU: exec ./qemu-system-ppc64 -qtest unix:/tmp/qtest-2378197.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2378197.qmp,id=char0 -mon chardev=char0,mode=control -display none -vga none -device virtio-vga -accel qtest stderr: @@ -28,5 +28,5 @@ index ace3bb28e0..628dad4cf2 100644 } -- -2.37.2 +2.37.3 diff --git a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch index e263067..7a7ec1c 100644 --- a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch +++ b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch @@ -1,7 +1,7 @@ -From ebff02a43374c1138d4f8b2c07d2088a3921c288 Mon Sep 17 00:00:00 2001 +From 5c1d2f920c14d6e8f4ac7abc62714eadaa60f228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 12:37:14 -0500 -Subject: [PATCH 1/2] Revert "linux-user: add more compat ioctl definitions" +Subject: [PATCH 3/5] Revert "linux-user: add more compat ioctl definitions" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -27,7 +27,7 @@ Signed-off-by: Daniel P. Berrangé 1 file changed, 25 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 1f8c10f8ef..9c1e9555e1 100644 +index 24b25759be..10af5e0d8e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -111,31 +111,6 @@ @@ -63,5 +63,5 @@ index 1f8c10f8ef..9c1e9555e1 100644 #include #endif -- -2.38.1 +2.37.3 diff --git a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch index 08f5180..43b10c7 100644 --- a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch +++ b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch @@ -1,7 +1,7 @@ -From f0f11a1435802b5c8ee8337a7b0c0f337d8f9936 Mon Sep 17 00:00:00 2001 +From b40cf0a490c28d5b79e05382d061983b92a7b2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 12:37:25 -0500 -Subject: [PATCH 2/2] Revert "linux-user: fix compat with glibc >= 2.36 +Subject: [PATCH 4/5] Revert "linux-user: fix compat with glibc >= 2.36 sys/mount.h" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -29,7 +29,7 @@ Signed-off-by: Daniel P. Berrangé 2 files changed, 20 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 9c1e9555e1..f2b7634f5e 100644 +index 10af5e0d8e..d974c76b60 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -95,25 +95,7 @@ @@ -59,10 +59,10 @@ index 9c1e9555e1..f2b7634f5e 100644 #if defined(CONFIG_FIEMAP) #include diff --git a/meson.build b/meson.build -index 175517eafd..32fed7ea6e 100644 +index 5c6b5a1c75..3172b01089 100644 --- a/meson.build +++ b/meson.build -@@ -2039,8 +2039,6 @@ config_host_data.set('HAVE_OPTRESET', +@@ -2032,8 +2032,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')) @@ -72,5 +72,5 @@ index 175517eafd..32fed7ea6e 100644 # has_member config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID', -- -2.38.1 +2.37.3 diff --git a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch new file mode 100644 index 0000000..989e7eb --- /dev/null +++ b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch @@ -0,0 +1,45 @@ +From db788c896eb1378ebc1f20dcc4954616a7631919 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Feb 2023 15:37:16 -0500 +Subject: [PATCH 5/5] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF + +When a write request is converted into a write zeroes request by the +detect-zeroes= feature, it is no longer associated with an I/O buffer. +The BDRV_REQ_REGISTERED_BUF flag doesn't make sense without an I/O +buffer and must be cleared because bdrv_co_do_pwrite_zeroes() fails with +-EINVAL when it's set. + +Fiona Ebner bisected and diagnosed this QEMU 7.2 +regression where writes containing zeroes to a blockdev with +discard=unmap,detect-zeroes=unmap fail. + +Buglink: https://gitlab.com/qemu-project/qemu/-/issues/1404 +Fixes: e8b6535533be ("block: add BDRV_REQ_REGISTERED_BUF request flag") +Tested-by: Fiona Ebner +Cc: qemu-stable@nongnu.org +Reviewed-by: Eric Blake +Reviewed-by: Hanna Czenczek +Signed-off-by: Stefan Hajnoczi +Message-Id: <20230207203719.242926-2-stefanha@redhat.com> +(cherry picked from commit 3c5867156eb81c7c71611d078b2c5c2c863f884a) +--- + block/io.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/block/io.c b/block/io.c +index b9424024f9..bbaa0d1b2d 100644 +--- a/block/io.c ++++ b/block/io.c +@@ -2087,6 +2087,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, + if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) { + flags |= BDRV_REQ_MAY_UNMAP; + } ++ ++ /* Can't use optimization hint with bufferless zero write */ ++ flags &= ~BDRV_REQ_REGISTERED_BUF; + } + + if (ret < 0) { +-- +2.37.3 + diff --git a/qemu.spec b/qemu.spec index d2ee4d3..7e1924e 100644 --- a/qemu.spec +++ b/qemu.spec @@ -321,7 +321,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 6 +%global baserelease 7 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -346,10 +346,12 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch -Patch: 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch +Patch: 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch # Fix compat with kernel-headers >= 6.1 Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch +# Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) +Patch: 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel @@ -2779,6 +2781,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Mon Feb 27 2023 Richard W.M. Jones - 7.2.0-7 +- Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) + * Tue Jan 31 2023 Stefan Hajnoczi - 7.2.0-6 - Enable libblkio From d8ea841ee85896ba6f3acf5123816c76c32103f9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 27 Feb 2023 16:09:52 +0000 Subject: [PATCH 25/54] Fix build with glib2 2.75.3 (RHBZ#2173639) --- ...sgx_epc_get_section-stub-is-reachabl.patch | 2 +- ...sts-Disable-pci_virtio_vga-for-ppc64.patch | 2 +- ...er-add-more-compat-ioctl-definitions.patch | 2 +- ...r-fix-compat-with-glibc-2.36-sys-mou.patch | 2 +- ...-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch | 2 +- ...te-fix-bad-GTree-usage-use-after-fre.patch | 43 +++++++++++++++++++ qemu.spec | 6 +++ 7 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch diff --git a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch index 92a74eb..3f0bae7 100644 --- a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch +++ b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch @@ -1,7 +1,7 @@ From e54512fe75f85640c0c73e53e6f8bd0b9d193529 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 1 Feb 2022 20:09:37 +0100 -Subject: [PATCH 1/5] target/i386: the sgx_epc_get_section stub is reachable +Subject: [PATCH 1/6] target/i386: the sgx_epc_get_section stub is reachable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch index 2172c4d..c940f0d 100644 --- a/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch +++ b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch @@ -1,7 +1,7 @@ From 2f0a0afbf915d36c39c5cfac1e31c6edc7f47bef Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Thu, 1 Sep 2022 12:43:49 -0300 -Subject: [PATCH 2/5] tests: Disable pci_virtio_vga for ppc64 +Subject: [PATCH 2/6] tests: Disable pci_virtio_vga for ppc64 starting QEMU: exec ./qemu-system-ppc64 -qtest unix:/tmp/qtest-2378197.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2378197.qmp,id=char0 -mon chardev=char0,mode=control -display none -vga none -device virtio-vga -accel qtest stderr: diff --git a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch index 7a7ec1c..e0c2b92 100644 --- a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch +++ b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch @@ -1,7 +1,7 @@ From 5c1d2f920c14d6e8f4ac7abc62714eadaa60f228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 12:37:14 -0500 -Subject: [PATCH 3/5] Revert "linux-user: add more compat ioctl definitions" +Subject: [PATCH 3/6] Revert "linux-user: add more compat ioctl definitions" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch index 43b10c7..b872587 100644 --- a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch +++ b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch @@ -1,7 +1,7 @@ From b40cf0a490c28d5b79e05382d061983b92a7b2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 12:37:25 -0500 -Subject: [PATCH 4/5] Revert "linux-user: fix compat with glibc >= 2.36 +Subject: [PATCH 4/6] Revert "linux-user: fix compat with glibc >= 2.36 sys/mount.h" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 diff --git a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch index 989e7eb..54ea7bd 100644 --- a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch +++ b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch @@ -1,7 +1,7 @@ From db788c896eb1378ebc1f20dcc4954616a7631919 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 7 Feb 2023 15:37:16 -0500 -Subject: [PATCH 5/5] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF +Subject: [PATCH 5/6] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF When a write request is converted into a write zeroes request by the detect-zeroes= feature, it is no longer associated with an I/O buffer. diff --git a/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch b/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch new file mode 100644 index 0000000..f4ff87f --- /dev/null +++ b/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch @@ -0,0 +1,43 @@ +From 930def8769940600dd7dd587ec2accd4a8b6e1f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Mon, 27 Feb 2023 16:02:51 +0000 +Subject: [PATCH 6/6] [PATCH] test-vmstate: fix bad GTree usage, use-after-free +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +According to g_tree_foreach() documentation: +"The tree may not be modified while iterating over it (you can't +add/remove items)." + +Fixes: 9a85e4b8f6 ("migration: Support gtree migration") +Cc: Eric Auger +Signed-off-by: Marc-André Lureau +--- + tests/unit/test-vmstate.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c +index 541bb4f63e..36b253eb67 100644 +--- a/tests/unit/test-vmstate.c ++++ b/tests/unit/test-vmstate.c +@@ -1074,7 +1074,6 @@ static gboolean diff_tree(gpointer key, gpointer value, gpointer data) + struct match_node_data d = {tp->tree2, key, value}; + + g_tree_foreach(tp->tree2, tp->match_node, &d); +- g_tree_remove(tp->tree1, key); + return false; + } + +@@ -1084,7 +1083,7 @@ static void compare_trees(GTree *tree1, GTree *tree2, + struct tree_cmp_data tp = {tree1, tree2, function}; + + g_tree_foreach(tree1, diff_tree, &tp); +- assert(g_tree_nnodes(tree1) == 0); ++ g_tree_destroy(g_tree_ref(tree1)); + assert(g_tree_nnodes(tree2) == 0); + } + +-- +2.37.3 + diff --git a/qemu.spec b/qemu.spec index 7e1924e..2ed7574 100644 --- a/qemu.spec +++ b/qemu.spec @@ -352,6 +352,11 @@ Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch # Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) Patch: 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch +# Fix build with glib2 2.75.3 +# https://bugzilla.redhat.com/show_bug.cgi?id=2173639 +# https://gitlab.com/qemu-project/qemu/-/issues/1518 +# Patch is NOT UPSTREAM. +Patch: 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel @@ -2783,6 +2788,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog * Mon Feb 27 2023 Richard W.M. Jones - 7.2.0-7 - Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) +- Fix build with glib2 2.75.3 (RHBZ#2173639) * Tue Jan 31 2023 Stefan Hajnoczi - 7.2.0-6 - Enable libblkio From f48e9e218ccd66c593e9eabf5db70e65b265c294 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 27 Feb 2023 17:43:05 +0000 Subject: [PATCH 26/54] Fix rtl8139-test Patch sent upstream 2023-02-27. --- ...sgx_epc_get_section-stub-is-reachabl.patch | 2 +- ...sts-Disable-pci_virtio_vga-for-ppc64.patch | 2 +- ...er-add-more-compat-ioctl-definitions.patch | 2 +- ...r-fix-compat-with-glibc-2.36-sys-mou.patch | 2 +- ...-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch | 2 +- ...te-fix-bad-GTree-usage-use-after-fre.patch | 2 +- ...-version-is-printed-before-other-mes.patch | 42 +++++++++++++++++++ qemu.spec | 2 + 8 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch diff --git a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch index 3f0bae7..5245b0f 100644 --- a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch +++ b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch @@ -1,7 +1,7 @@ From e54512fe75f85640c0c73e53e6f8bd0b9d193529 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 1 Feb 2022 20:09:37 +0100 -Subject: [PATCH 1/6] target/i386: the sgx_epc_get_section stub is reachable +Subject: [PATCH 1/7] target/i386: the sgx_epc_get_section stub is reachable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch index c940f0d..48c4203 100644 --- a/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch +++ b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch @@ -1,7 +1,7 @@ From 2f0a0afbf915d36c39c5cfac1e31c6edc7f47bef Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Thu, 1 Sep 2022 12:43:49 -0300 -Subject: [PATCH 2/6] tests: Disable pci_virtio_vga for ppc64 +Subject: [PATCH 2/7] tests: Disable pci_virtio_vga for ppc64 starting QEMU: exec ./qemu-system-ppc64 -qtest unix:/tmp/qtest-2378197.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2378197.qmp,id=char0 -mon chardev=char0,mode=control -display none -vga none -device virtio-vga -accel qtest stderr: diff --git a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch index e0c2b92..f69907e 100644 --- a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch +++ b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch @@ -1,7 +1,7 @@ From 5c1d2f920c14d6e8f4ac7abc62714eadaa60f228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 12:37:14 -0500 -Subject: [PATCH 3/6] Revert "linux-user: add more compat ioctl definitions" +Subject: [PATCH 3/7] Revert "linux-user: add more compat ioctl definitions" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch index b872587..6487990 100644 --- a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch +++ b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch @@ -1,7 +1,7 @@ From b40cf0a490c28d5b79e05382d061983b92a7b2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jan 2023 12:37:25 -0500 -Subject: [PATCH 4/6] Revert "linux-user: fix compat with glibc >= 2.36 +Subject: [PATCH 4/7] Revert "linux-user: fix compat with glibc >= 2.36 sys/mount.h" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 diff --git a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch index 54ea7bd..419a284 100644 --- a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch +++ b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch @@ -1,7 +1,7 @@ From db788c896eb1378ebc1f20dcc4954616a7631919 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 7 Feb 2023 15:37:16 -0500 -Subject: [PATCH 5/6] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF +Subject: [PATCH 5/7] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF When a write request is converted into a write zeroes request by the detect-zeroes= feature, it is no longer associated with an I/O buffer. diff --git a/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch b/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch index f4ff87f..7ad17be 100644 --- a/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch +++ b/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch @@ -1,7 +1,7 @@ From 930def8769940600dd7dd587ec2accd4a8b6e1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 27 Feb 2023 16:02:51 +0000 -Subject: [PATCH 6/6] [PATCH] test-vmstate: fix bad GTree usage, use-after-free +Subject: [PATCH 6/7] [PATCH] test-vmstate: fix bad GTree usage, use-after-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch b/0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch new file mode 100644 index 0000000..c142e77 --- /dev/null +++ b/0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch @@ -0,0 +1,42 @@ +From 4021e0a116b568c312b864dfc27dfeed3317538a Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 27 Feb 2023 17:37:10 +0000 +Subject: [PATCH 7/7] tests: Ensure TAP version is printed before other + messages + +These two tests were failing with this error: + + stderr: + TAP parsing error: version number must be on the first line + [...] + Unknown TAP version. The first line MUST be `TAP version `. Assuming version 12. + +This can be fixed by ensuring we always call g_test_init first in the +body of main. + +Thanks: Daniel Berrange, for diagnosing the problem +Signed-off-by: Richard W.M. Jones +--- + tests/qtest/rtl8139-test.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c +index 8fa3313cc3..90bb616974 100644 +--- a/tests/qtest/rtl8139-test.c ++++ b/tests/qtest/rtl8139-test.c +@@ -196,9 +196,10 @@ int main(int argc, char **argv) + { + int ret; + +- qtest_start("-device rtl8139"); +- + g_test_init(&argc, &argv, NULL); ++ ++ qtest_start("-device rtl8139"); ++ + qtest_add_func("/rtl8139/nop", nop); + qtest_add_func("/rtl8139/timer", test_init); + +-- +2.37.3 + diff --git a/qemu.spec b/qemu.spec index 2ed7574..4a135ad 100644 --- a/qemu.spec +++ b/qemu.spec @@ -357,6 +357,8 @@ Patch: 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch # https://gitlab.com/qemu-project/qemu/-/issues/1518 # Patch is NOT UPSTREAM. Patch: 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch +# Fix one of the tests. Sent upstream 2023-02-27. +Patch: 0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel From 0ef68abd71ff6a65cf1e9dbb1c57653b048f8328 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 27 Feb 2023 19:55:33 +0000 Subject: [PATCH 27/54] Disable the tests on i686 --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 4a135ad..c55e6c4 100644 --- a/qemu.spec +++ b/qemu.spec @@ -2011,8 +2011,10 @@ rm -rf %{static_buildroot} pushd %{qemu_kvm_build} echo "Testing %{name}-build" +# i686: we propose to drop qemu, for now just disable the tests, see: +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/C2U5RBADZB2ZUMR74PLNV73C3AIPSLWH/ # 2022-06: ppc64le random qtest segfaults with no discernable pattern -%ifnarch %{power64} +%ifnarch %{ix86} %{power64} %make_build check %endif @@ -2791,6 +2793,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ * Mon Feb 27 2023 Richard W.M. Jones - 7.2.0-7 - Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) - Fix build with glib2 2.75.3 (RHBZ#2173639) +- Disable the tests on i686 * Tue Jan 31 2023 Stefan Hajnoczi - 7.2.0-6 - Enable libblkio From bd635cd85ed29e7de235c309953bef4dbd0ef38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 2 Mar 2023 17:50:22 +0000 Subject: [PATCH 28/54] Re-enable tests on i686. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The broken GNUTLS ABI has been fixed https://bugzilla.redhat.com/show_bug.cgi?id=2174758 https://src.fedoraproject.org/rpms/gnutls/pull-request/78 Signed-off-by: Daniel P. Berrangé --- qemu.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qemu.spec b/qemu.spec index c55e6c4..218aee5 100644 --- a/qemu.spec +++ b/qemu.spec @@ -2011,10 +2011,8 @@ rm -rf %{static_buildroot} pushd %{qemu_kvm_build} echo "Testing %{name}-build" -# i686: we propose to drop qemu, for now just disable the tests, see: -# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/C2U5RBADZB2ZUMR74PLNV73C3AIPSLWH/ # 2022-06: ppc64le random qtest segfaults with no discernable pattern -%ifnarch %{ix86} %{power64} +%ifnarch %{power64} %make_build check %endif From b5541eb631a3ecb5f0097d2efb1cd8578c933211 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Mon, 19 Sep 2022 16:13:01 -0300 Subject: [PATCH 29/54] Enable libvfio-user --- 0001-fix-compilation-on-i386-and-ppc64.patch | 1588 ++++++++++++++++++ qemu.spec | 11 + 2 files changed, 1599 insertions(+) create mode 100644 0001-fix-compilation-on-i386-and-ppc64.patch diff --git a/0001-fix-compilation-on-i386-and-ppc64.patch b/0001-fix-compilation-on-i386-and-ppc64.patch new file mode 100644 index 0000000..dfe5725 --- /dev/null +++ b/0001-fix-compilation-on-i386-and-ppc64.patch @@ -0,0 +1,1588 @@ +From 5693c8f2110e236772bf7abe7b3ea390f029c697 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Thu, 22 Sep 2022 16:08:55 -0300 +Subject: [PATCH] fix compilation on i386 and ppc64 + +Signed-off-by: Thanos Makatos +Reported-by: Eduardo Lima +Signed-off-by: rpm-build +--- + subprojects/libvfio-user/lib/dma.c | 28 +++-- + subprojects/libvfio-user/lib/dma.h | 3 +- + subprojects/libvfio-user/lib/libvfio-user.c | 81 ++++++++----- + subprojects/libvfio-user/lib/migration.c | 18 +-- + subprojects/libvfio-user/lib/pci.c | 12 +- + subprojects/libvfio-user/lib/pci_caps.c | 12 +- + subprojects/libvfio-user/lib/private.h | 4 + + subprojects/libvfio-user/lib/tran.c | 2 +- + subprojects/libvfio-user/lib/tran_pipe.c | 2 +- + subprojects/libvfio-user/samples/client.c | 77 +++++++----- + subprojects/libvfio-user/samples/server.c | 15 ++- + subprojects/libvfio-user/test/mocks.c | 4 +- + .../libvfio-user/test/py/libvfio_user.py | 29 +++-- + .../test/py/test_device_get_region_info.py | 18 +-- + .../libvfio-user/test/py/test_dirty_pages.py | 110 ++++++++++-------- + .../libvfio-user/test/py/test_dma_map.py | 28 ++--- + .../libvfio-user/test/py/test_dma_unmap.py | 41 ++++--- + .../libvfio-user/test/py/test_migration.py | 4 +- + .../libvfio-user/test/py/test_pci_caps.py | 7 +- + .../libvfio-user/test/py/test_pci_ext_caps.py | 9 ++ + .../test/py/test_request_errors.py | 6 +- + subprojects/libvfio-user/test/unit-tests.c | 10 +- + 22 files changed, 316 insertions(+), 204 deletions(-) + +diff --git a/subprojects/libvfio-user/lib/dma.c b/subprojects/libvfio-user/lib/dma.c +index ac3ddfe..1ee8704 100644 +--- a/subprojects/libvfio-user/lib/dma.c ++++ b/subprojects/libvfio-user/lib/dma.c +@@ -249,7 +249,7 @@ dma_map_region(dma_controller_t *dma, dma_memory_region_t *region) + region->info.vaddr = mmap_base + (region->offset - offset); + + vfu_log(dma->vfu_ctx, LOG_DEBUG, "mapped DMA region iova=[%p, %p) " +- "vaddr=%p page_size=%#lx mapping=[%p, %p)", ++ "vaddr=%p page_size=%zx mapping=[%p, %p)", + region->info.iova.iov_base, iov_end(®ion->info.iova), + region->info.vaddr, region->info.page_size, + region->info.mapping.iov_base, iov_end(®ion->info.mapping)); +@@ -290,7 +290,7 @@ dirty_page_logging_start_on_region(dma_memory_region_t *region, size_t pgsize) + + int + MOCK_DEFINE(dma_controller_add_region)(dma_controller_t *dma, +- vfu_dma_addr_t dma_addr, size_t size, ++ vfu_dma_addr_t dma_addr, uint64_t size, + int fd, off_t offset, uint32_t prot) + { + dma_memory_region_t *region; +@@ -300,12 +300,12 @@ MOCK_DEFINE(dma_controller_add_region)(dma_controller_t *dma, + + assert(dma != NULL); + +- snprintf(rstr, sizeof(rstr), "[%p, %p) fd=%d offset=%#lx prot=%#x", +- dma_addr, (char *)dma_addr + size, fd, offset, prot); ++ snprintf(rstr, sizeof(rstr), "[%p, %p) fd=%d offset=%#llx prot=%#x", ++ dma_addr, dma_addr + size, fd, (unsigned long long)offset, prot); + + if (size > dma->max_size) { +- vfu_log(dma->vfu_ctx, LOG_ERR, "DMA region size %zu > max %zu", +- size, dma->max_size); ++ vfu_log(dma->vfu_ctx, LOG_ERR, "DMA region size %llu > max %zu", ++ (unsigned long long)size, dma->max_size); + return ERROR_INT(ENOSPC); + } + +@@ -317,7 +317,8 @@ MOCK_DEFINE(dma_controller_add_region)(dma_controller_t *dma, + region->info.iova.iov_len == size) { + if (offset != region->offset) { + vfu_log(dma->vfu_ctx, LOG_ERR, "bad offset for new DMA region " +- "%s; existing=%#lx", rstr, region->offset); ++ "%s; existing=%#llx", rstr, ++ (unsigned long long)region->offset); + return ERROR_INT(EINVAL); + } + if (!fds_are_same_file(region->fd, fd)) { +@@ -568,12 +569,19 @@ dma_controller_dirty_page_get(dma_controller_t *dma, vfu_dma_addr_t addr, + * IOVAs. + */ + ret = dma_addr_to_sgl(dma, addr, len, &sg, 1, PROT_NONE); +- if (ret != 1 || sg.dma_addr != addr || sg.length != len) { ++ if (unlikely(ret != 1)) { ++ vfu_log(dma->vfu_ctx, LOG_DEBUG, "failed to translate %#llx-%#llx: %m", ++ (unsigned long long)(uintptr_t)addr, ++ (unsigned long long)(uintptr_t)addr + len - 1); ++ return ret; ++ } ++ ++ if (unlikely(sg.dma_addr != addr || sg.length != len)) { + return ERROR_INT(ENOTSUP); + } + + if (pgsize != dma->dirty_pgsize) { +- vfu_log(dma->vfu_ctx, LOG_ERR, "bad page size %ld", pgsize); ++ vfu_log(dma->vfu_ctx, LOG_ERR, "bad page size %zu", pgsize); + return ERROR_INT(EINVAL); + } + +@@ -588,7 +596,7 @@ dma_controller_dirty_page_get(dma_controller_t *dma, vfu_dma_addr_t addr, + * receive. + */ + if (size != (size_t)bitmap_size) { +- vfu_log(dma->vfu_ctx, LOG_ERR, "bad bitmap size %ld != %ld", size, ++ vfu_log(dma->vfu_ctx, LOG_ERR, "bad bitmap size %zu != %zu", size, + bitmap_size); + return ERROR_INT(EINVAL); + } +diff --git a/subprojects/libvfio-user/lib/dma.h b/subprojects/libvfio-user/lib/dma.h +index 089f973..e59c5ad 100644 +--- a/subprojects/libvfio-user/lib/dma.h ++++ b/subprojects/libvfio-user/lib/dma.h +@@ -125,7 +125,7 @@ dma_controller_destroy(dma_controller_t *dma); + * - On failure, -1 with errno set. + */ + MOCK_DECLARE(int, dma_controller_add_region, dma_controller_t *dma, +- vfu_dma_addr_t dma_addr, size_t size, int fd, off_t offset, ++ vfu_dma_addr_t dma_addr, uint64_t size, int fd, off_t offset, + uint32_t prot); + + MOCK_DECLARE(int, dma_controller_remove_region, dma_controller_t *dma, +@@ -209,6 +209,7 @@ dma_init_sg(const dma_controller_t *dma, dma_sg_t *sg, vfu_dma_addr_t dma_addr, + const dma_memory_region_t *const region = &dma->regions[region_index]; + + if ((prot & PROT_WRITE) && !(region->info.prot & PROT_WRITE)) { ++ vfu_log(dma->vfu_ctx, LOG_DEBUG, "read-only region"); + return ERROR_INT(EACCES); + } + +diff --git a/subprojects/libvfio-user/lib/libvfio-user.c b/subprojects/libvfio-user/lib/libvfio-user.c +index ac04d3b..bc49618 100644 +--- a/subprojects/libvfio-user/lib/libvfio-user.c ++++ b/subprojects/libvfio-user/lib/libvfio-user.c +@@ -47,7 +47,7 @@ + #include + #include + #include +- ++#include + #include + + #include "dma.h" +@@ -183,17 +183,19 @@ debug_region_access(vfu_ctx_t *vfu_ctx, size_t region, char *buf, + case 2: val = *((uint16_t *)buf); break; + case 1: val = *((uint8_t *)buf); break; + default: +- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s %zu bytes at %#lx", +- region, verb, count, offset); ++ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s %zu bytes at %#llx", ++ region, verb, count, (unsigned long long)offset); + return; + } + + if (is_write) { +- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: wrote %#zx to (%#lx:%zu)", +- region, val, offset, count); ++ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: wrote %#llx to (%#llx:%zu)", ++ region, (unsigned long long)val, (unsigned long long)offset, ++ count); + } else { +- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: read %#zx from (%#lx:%zu)", +- region, val, offset, count); ++ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: read %#llx from (%#llx:%zu)", ++ region, (unsigned long long)val, (unsigned long long)offset, ++ count); + } + } + +@@ -235,8 +237,8 @@ region_access(vfu_ctx_t *vfu_ctx, size_t region, char *buf, + + out: + if (ret != (ssize_t)count) { +- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s (%#lx:%zu) failed: %m", +- region, verb, offset, count); ++ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s (%#llx:%zu) failed: %m", ++ region, verb, (unsigned long long)offset, count); + } else { + debug_region_access(vfu_ctx, region, buf, count, offset, is_write); + } +@@ -266,7 +268,7 @@ is_valid_region_access(vfu_ctx_t *vfu_ctx, size_t size, uint16_t cmd, + + if (cmd == VFIO_USER_REGION_WRITE && size - sizeof(*ra) != ra->count) { + vfu_log(vfu_ctx, LOG_ERR, "region write count too small: " +- "expected %lu, got %u", size - sizeof(*ra), ra->count); ++ "expected %zu, got %u", size - sizeof(*ra), ra->count); + return false; + } + +@@ -278,8 +280,10 @@ is_valid_region_access(vfu_ctx_t *vfu_ctx, size_t size, uint16_t cmd, + } + + if (satadd_u64(ra->offset, ra->count) > vfu_ctx->reg_info[index].size) { +- vfu_log(vfu_ctx, LOG_ERR, "out of bounds region access %#lx-%#lx " +- "(size %u)", ra->offset, ra->offset + ra->count, ++ vfu_log(vfu_ctx, LOG_ERR, ++ "out of bounds region access %#llx-%#llx (size %u)", ++ (unsigned long long)ra->offset, ++ (unsigned long long)(ra->offset + ra->count), + vfu_ctx->reg_info[index].size); + + return false; +@@ -337,7 +341,7 @@ handle_region_access(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) + + ret = region_access(vfu_ctx, in_ra->region, buf, in_ra->count, + in_ra->offset, msg->hdr.cmd == VFIO_USER_REGION_WRITE); +- if (ret != in_ra->count) { ++ if (ret != (ssize_t)in_ra->count) { + /* FIXME we should return whatever has been accessed, not an error */ + if (ret >= 0) { + ret = ERROR_INT(EINVAL); +@@ -458,8 +462,10 @@ handle_device_get_region_info(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) + } + + vfu_log(vfu_ctx, LOG_DEBUG, "region_info[%d] offset %#llx flags %#x " +- "size %llu " "argsz %u", out_info->index, out_info->offset, +- out_info->flags, out_info->size, out_info->argsz); ++ "size %llu argsz %u", out_info->index, ++ (unsigned long long)out_info->offset, ++ out_info->flags, (unsigned long long)out_info->size, ++ out_info->argsz); + + return 0; + } +@@ -671,8 +677,10 @@ handle_dma_map(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + return ERROR_INT(EINVAL); + } + +- snprintf(rstr, sizeof(rstr), "[%#lx, %#lx) offset=%#lx flags=%#x", +- dma_map->addr, dma_map->addr + dma_map->size, dma_map->offset, ++ snprintf(rstr, sizeof(rstr), "[%#llx, %#llx) offset=%#llx flags=%#x", ++ (unsigned long long)dma_map->addr, ++ (unsigned long long)(dma_map->addr + dma_map->size), ++ (unsigned long long)dma_map->offset, + dma_map->flags); + + vfu_log(vfu_ctx, LOG_DEBUG, "adding DMA region %s", rstr); +@@ -700,7 +708,8 @@ handle_dma_map(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + } + } + +- ret = dma_controller_add_region(vfu_ctx->dma, (void *)dma_map->addr, ++ ret = dma_controller_add_region(vfu_ctx->dma, ++ (vfu_dma_addr_t)(uintptr_t)dma_map->addr, + dma_map->size, fd, dma_map->offset, + prot); + if (ret < 0) { +@@ -747,8 +756,9 @@ is_valid_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + + case VFIO_DMA_UNMAP_FLAG_ALL: + if (dma_unmap->addr || dma_unmap->size) { +- vfu_log(vfu_ctx, LOG_ERR, "bad addr=%#lx or size=%#lx, expected " +- "both to be zero", dma_unmap->addr, dma_unmap->size); ++ vfu_log(vfu_ctx, LOG_ERR, "bad addr=%#llx or size=%#llx, expected " ++ "both to be zero", (unsigned long long)dma_unmap->addr, ++ (unsigned long long)dma_unmap->size); + errno = EINVAL; + return false; + } +@@ -791,8 +801,10 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + return -1; + } + +- snprintf(rstr, sizeof(rstr), "[%#lx, %#lx) flags=%#x", +- dma_unmap->addr, dma_unmap->addr + dma_unmap->size, dma_unmap->flags); ++ snprintf(rstr, sizeof(rstr), "[%#llx, %#llx) flags=%#x", ++ (unsigned long long)dma_unmap->addr, ++ (unsigned long long)(dma_unmap->addr + dma_unmap->size), ++ dma_unmap->flags); + + vfu_log(vfu_ctx, LOG_DEBUG, "removing DMA region %s", rstr); + +@@ -817,7 +829,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + if (dma_unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) { + memcpy(msg->out.iov.iov_base + sizeof(*dma_unmap), dma_unmap->bitmap, sizeof(*dma_unmap->bitmap)); + ret = dma_controller_dirty_page_get(vfu_ctx->dma, +- (vfu_dma_addr_t)dma_unmap->addr, ++ (vfu_dma_addr_t)(uintptr_t)dma_unmap->addr, + dma_unmap->size, + dma_unmap->bitmap->pgsize, + dma_unmap->bitmap->size, +@@ -829,7 +841,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + } + + ret = dma_controller_remove_region(vfu_ctx->dma, +- (void *)dma_unmap->addr, ++ (vfu_dma_addr_t)(uintptr_t)dma_unmap->addr, + dma_unmap->size, + vfu_ctx->dma_unregister, + vfu_ctx); +@@ -924,7 +936,7 @@ handle_dirty_pages_get(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) + range_out = msg->out.iov.iov_base + sizeof(*dirty_pages_out); + memcpy(range_out, range_in, sizeof(*range_out)); + ret = dma_controller_dirty_page_get(vfu_ctx->dma, +- (vfu_dma_addr_t)range_in->iova, ++ (vfu_dma_addr_t)(uintptr_t)range_in->iova, + range_in->size, + range_in->bitmap.pgsize, + range_in->bitmap.size, bitmap_out); +@@ -939,8 +951,8 @@ handle_dirty_pages_get(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) + } + } else { + vfu_log(vfu_ctx, LOG_ERR, +- "dirty pages: get [%#lx, %#lx): buffer too small (%u < %lu)", +- range_in->iova, range_in->iova + range_in->size, ++ "dirty pages: get [%#llx, %#llx): buffer too small (%u < %zu)", ++ (unsigned long long)range_in->iova, (unsigned long long)range_in->iova + range_in->size, + dirty_pages_in->argsz, argsz); + } + +@@ -1873,6 +1885,10 @@ vfu_setup_region(vfu_ctx_t *vfu_ctx, int region_idx, size_t size, + for (i = 0; i < nr_mmap_areas; i++) { + struct iovec *iov = &mmap_areas[i]; + if ((size_t)iov_end(iov) > size) { ++ vfu_log(vfu_ctx, LOG_ERR, "mmap area #%zu %#llx-%#llx exceeds region size of %#llx\n", ++ i, (unsigned long long)(uintptr_t)iov->iov_base, ++ (unsigned long long)(uintptr_t)(iov->iov_base) + iov->iov_len - 1, ++ (unsigned long long)size); + return ERROR_INT(EINVAL); + } + } +@@ -2124,7 +2140,7 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enum vfio_user_command cmd, + while (remaining > 0) { + int ret; + +- dma_req->addr = (uint64_t)sg->dma_addr + count; ++ dma_req->addr = (uintptr_t)sg->dma_addr + count; + dma_req->count = MIN(remaining, vfu_ctx->client_max_data_xfer_size); + + if (cmd == VFIO_USER_DMA_WRITE) { +@@ -2153,10 +2169,13 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enum vfio_user_command cmd, + + if (dma_reply->addr != dma_req->addr || + dma_reply->count != dma_req->count) { ++ /* TODO shouldn't we use %#llx for both and also use the range format? */ + vfu_log(vfu_ctx, LOG_ERR, "bad reply to DMA transfer: " +- "request:%#lx,%lu reply:%#lx,%lu", +- dma_req->addr, dma_req->count, +- dma_reply->addr, dma_reply->count); ++ "request:%#llx,%llu reply:%#llx,%llu", ++ (unsigned long long)dma_req->addr, ++ (unsigned long long)dma_req->count, ++ (unsigned long long)dma_reply->addr, ++ (unsigned long long)dma_reply->count); + free(rbuf); + return ERROR_INT(EINVAL); + } +diff --git a/subprojects/libvfio-user/lib/migration.c b/subprojects/libvfio-user/lib/migration.c +index 2936768..62ac082 100644 +--- a/subprojects/libvfio-user/lib/migration.c ++++ b/subprojects/libvfio-user/lib/migration.c +@@ -413,7 +413,7 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, + case offsetof(struct vfio_user_migration_info, device_state): + if (count != sizeof(migr->info.device_state)) { + vfu_log(vfu_ctx, LOG_ERR, +- "bad device_state access size %ld", count); ++ "bad device_state access size %zu", count); + return ERROR_INT(EINVAL); + } + device_state = (uint32_t *)buf; +@@ -443,7 +443,7 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, + case offsetof(struct vfio_user_migration_info, pending_bytes): + if (count != sizeof(migr->info.pending_bytes)) { + vfu_log(vfu_ctx, LOG_ERR, +- "bad pending_bytes access size %ld", count); ++ "bad pending_bytes access size %zu", count); + return ERROR_INT(EINVAL); + } + ret = handle_pending_bytes(vfu_ctx, migr, (uint64_t *)buf, is_write); +@@ -451,7 +451,7 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, + case offsetof(struct vfio_user_migration_info, data_offset): + if (count != sizeof(migr->info.data_offset)) { + vfu_log(vfu_ctx, LOG_ERR, +- "bad data_offset access size %ld", count); ++ "bad data_offset access size %zu", count); + return ERROR_INT(EINVAL); + } + ret = handle_data_offset(vfu_ctx, migr, (uint64_t *)buf, is_write); +@@ -459,14 +459,15 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, + case offsetof(struct vfio_user_migration_info, data_size): + if (count != sizeof(migr->info.data_size)) { + vfu_log(vfu_ctx, LOG_ERR, +- "bad data_size access size %ld", count); ++ "bad data_size access size %zu", count); + return ERROR_INT(EINVAL); + } + ret = handle_data_size(vfu_ctx, migr, (uint64_t *)buf, is_write); + break; + default: +- vfu_log(vfu_ctx, LOG_ERR, "bad migration region register offset %#lx", +- pos); ++ vfu_log(vfu_ctx, LOG_ERR, ++ "bad migration region register offset %#llx", ++ (unsigned long long)pos); + return ERROR_INT(EINVAL); + } + return ret; +@@ -502,8 +503,9 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, + * any access to the data region properly. + */ + vfu_log(vfu_ctx, LOG_WARNING, +- "bad access to dead space %#lx-%#lx in migration region", +- pos, pos + count - 1); ++ "bad access to dead space %#llx - %#llx in migration region", ++ (unsigned long long)pos, ++ (unsigned long long)(pos + count - 1)); + return ERROR_INT(EINVAL); + } + +diff --git a/subprojects/libvfio-user/lib/pci.c b/subprojects/libvfio-user/lib/pci.c +index 21db6e4..beacd5c 100644 +--- a/subprojects/libvfio-user/lib/pci.c ++++ b/subprojects/libvfio-user/lib/pci.c +@@ -264,8 +264,8 @@ pci_hdr_write(vfu_ctx_t *vfu_ctx, const char *buf, loff_t offset) + ret = handle_erom_write(vfu_ctx, cfg_space, buf); + break; + default: +- vfu_log(vfu_ctx, LOG_ERR, "PCI config write %#lx not handled", +- offset); ++ vfu_log(vfu_ctx, LOG_ERR, "PCI config write %#llx not handled", ++ (unsigned long long)offset); + ret = ERROR_INT(EINVAL); + } + +@@ -315,7 +315,7 @@ pci_nonstd_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, + + if (is_write) { + vfu_log(vfu_ctx, LOG_ERR, "no callback for write to config space " +- "offset %lu size %zu", offset, count); ++ "offset %#llx size %zu", (unsigned long long)offset, count); + return ERROR_INT(EINVAL); + } + +@@ -429,8 +429,10 @@ pci_config_space_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, + size = pci_config_space_next_segment(vfu_ctx, count, offset, is_write, + &cb); + if (cb == NULL) { +- vfu_log(vfu_ctx, LOG_ERR, "bad write to PCI config space %#lx-%#lx", +- offset, offset + count - 1); ++ vfu_log(vfu_ctx, LOG_ERR, ++ "bad write to PCI config space %#llx-%#llx", ++ (unsigned long long)offset, ++ (unsigned long long)(offset + count - 1)); + return size; + } + +diff --git a/subprojects/libvfio-user/lib/pci_caps.c b/subprojects/libvfio-user/lib/pci_caps.c +index e9dc5ac..50eb29b 100644 +--- a/subprojects/libvfio-user/lib/pci_caps.c ++++ b/subprojects/libvfio-user/lib/pci_caps.c +@@ -483,7 +483,7 @@ cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) + + if (cap->off != 0) { + if (cap->off < PCI_STD_HEADER_SIZEOF) { +- vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#lx for capability " ++ vfu_log(vfu_ctx, LOG_ERR, "invalid offset %zx for capability " + "%u (%s)", cap->off, cap->id, cap->name); + return ERROR_INT(EINVAL); + } +@@ -516,11 +516,11 @@ cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) + + if (cap->off + cap->size > pci_config_space_size(vfu_ctx)) { + vfu_log(vfu_ctx, LOG_ERR, "no config space left for capability " +- "%u (%s) of size %zu bytes at offset %#lx", cap->id, ++ "%u (%s) of size %zu bytes at offset %zx", cap->id, + cap->name, cap->size, cap->off); + return ERROR_INT(ENOSPC); + } +- ++ + memcpy(cap_data(vfu_ctx, cap), data, cap->size); + /* Make sure the previous cap's PCI_CAP_LIST_NEXT points to us. */ + *prevp = cap->off; +@@ -547,7 +547,7 @@ ext_cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) + + if (cap->off != 0) { + if (cap->off < PCI_CFG_SPACE_SIZE) { +- vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#lx for capability " ++ vfu_log(vfu_ctx, LOG_ERR, "invalid offset %zx for capability " + "%u (%s)", cap->off, cap->id, cap->name); + return ERROR_INT(EINVAL); + } +@@ -581,7 +581,7 @@ ext_cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) + + if (cap->off + cap->size > pci_config_space_size(vfu_ctx)) { + vfu_log(vfu_ctx, LOG_ERR, "no config space left for capability " +- "%u (%s) of size %zu bytes at offset %#lx", cap->id, ++ "%u (%s) of size %zu bytes at offset %zu", cap->id, + cap->name, cap->size, cap->off); + return ERROR_INT(ENOSPC); + } +@@ -700,7 +700,7 @@ vfu_pci_add_capability(vfu_ctx_t *vfu_ctx, size_t pos, int flags, void *data) + + if (cap.off + cap.size >= pci_config_space_size(vfu_ctx)) { + vfu_log(vfu_ctx, LOG_DEBUG, +- "PCI capability past end of config space, %#lx >= %#lx", ++ "PCI capability past end of config space, %zx >= %zx", + cap.off + cap.size, pci_config_space_size(vfu_ctx)); + return ERROR_INT(EINVAL); + } +diff --git a/subprojects/libvfio-user/lib/private.h b/subprojects/libvfio-user/lib/private.h +index 7ffd6be..7c18c95 100644 +--- a/subprojects/libvfio-user/lib/private.h ++++ b/subprojects/libvfio-user/lib/private.h +@@ -45,7 +45,11 @@ + * is to limit the size of the dirty bitmaps: this corresponds to 256MB at a 4K + * page size. + */ ++#if defined(__x86_64__) || defined(__ppc64__) + #define MAX_DMA_SIZE (8 * ONE_TB) ++#else ++#define MAX_DMA_SIZE UINT32_MAX /* FIXME check for __i386__ etc? */ ++#endif + #define MAX_DMA_REGIONS 16 + + #define SERVER_MAX_DATA_XFER_SIZE (VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE) +diff --git a/subprojects/libvfio-user/lib/tran.c b/subprojects/libvfio-user/lib/tran.c +index ba49fd6..a183877 100644 +--- a/subprojects/libvfio-user/lib/tran.c ++++ b/subprojects/libvfio-user/lib/tran.c +@@ -176,7 +176,7 @@ recv_version(vfu_ctx_t *vfu_ctx, uint16_t *msg_idp, + + if (msg.in.iov.iov_len < sizeof(*cversion)) { + vfu_log(vfu_ctx, LOG_ERR, +- "msg%#hx: VFIO_USER_VERSION: invalid size %lu", ++ "msg%#hx: VFIO_USER_VERSION: invalid size %zu", + *msg_idp, msg.in.iov.iov_len); + ret = EINVAL; + goto out; +diff --git a/subprojects/libvfio-user/lib/tran_pipe.c b/subprojects/libvfio-user/lib/tran_pipe.c +index dea2c3c..d1428ab 100644 +--- a/subprojects/libvfio-user/lib/tran_pipe.c ++++ b/subprojects/libvfio-user/lib/tran_pipe.c +@@ -83,7 +83,7 @@ tran_pipe_send_iovec(int fd, uint16_t msg_id, bool is_reply, + return ERROR_INT(ECONNRESET); + } + return -1; +- } else if (ret < hdr.msg_size) { ++ } else if (ret < (ssize_t)hdr.msg_size) { + return ERROR_INT(ECONNRESET); + } + +diff --git a/subprojects/libvfio-user/samples/client.c b/subprojects/libvfio-user/samples/client.c +index da211b8..e65bb61 100644 +--- a/subprojects/libvfio-user/samples/client.c ++++ b/subprojects/libvfio-user/samples/client.c +@@ -110,7 +110,7 @@ send_version(int sock) + "\"max_msg_fds\":%u," + "\"max_data_xfer_size\":%u," + "\"migration\":{" +- "\"pgsize\":%zu" ++ "\"pgsize\":%ld" + "}" + "}" + "}", CLIENT_MAX_FDS, CLIENT_MAX_DATA_XFER_SIZE, sysconf(_SC_PAGESIZE)); +@@ -155,7 +155,7 @@ recv_version(int sock, int *server_max_fds, size_t *server_max_data_xfer_size, + } + + if (vlen < sizeof(*sversion)) { +- errx(EXIT_FAILURE, "VFIO_USER_VERSION: invalid size %lu", vlen); ++ errx(EXIT_FAILURE, "VFIO_USER_VERSION: invalid size %zu", vlen); + } + + if (sversion->major != LIB_VFIO_USER_MAJOR) { +@@ -229,8 +229,9 @@ get_region_vfio_caps(struct vfio_info_cap_header *header, + (*sparse)->nr_areas); + for (i = 0; i < (*sparse)->nr_areas; i++) { + printf("client: %s: area %d offset %#llx size %llu\n", +- __func__, i, (*sparse)->areas[i].offset, +- (*sparse)->areas[i].size); ++ __func__, i, ++ (unsigned long long)(*sparse)->areas[i].offset, ++ (unsigned long long)(*sparse)->areas[i].size); + } + break; + case VFIO_REGION_INFO_CAP_TYPE: +@@ -290,9 +291,9 @@ mmap_sparse_areas(int *fds, struct vfio_region_info *region_info, + sparse->areas[i].offset); + if (addr == MAP_FAILED) { + err(EXIT_FAILURE, +- "failed to mmap sparse region #%lu in %s (%#llx-%#llx)", +- i, buf, sparse->areas[i].offset, +- sparse->areas[i].offset + sparse->areas[i].size - 1); ++ "failed to mmap sparse region %zu in %s (%#llx-%#llx)", ++ i, buf, (unsigned long long)sparse->areas[i].offset, ++ (unsigned long long)sparse->areas[i].offset + sparse->areas[i].size - 1); + } + + ret = munmap(addr, sparse->areas[i].size); +@@ -310,7 +311,11 @@ get_device_region_info(int sock, uint32_t index) + size_t nr_fds = ARRAY_SIZE(fds); + + +- region_info = alloca(size); ++ region_info = malloc(size); ++ if (region_info == NULL) { ++ err(EXIT_FAILURE, "%m\n"); ++ } ++ + memset(region_info, 0, size); + region_info->argsz = size; + region_info->index = index; +@@ -318,7 +323,10 @@ get_device_region_info(int sock, uint32_t index) + do_get_device_region_info(sock, region_info, NULL, 0); + if (region_info->argsz > size) { + size = region_info->argsz; +- region_info = alloca(size); ++ region_info = malloc(size); ++ if (region_info == NULL) { ++ err(EXIT_FAILURE, "%m\n"); ++ } + memset(region_info, 0, size); + region_info->argsz = size; + region_info->index = index; +@@ -329,9 +337,11 @@ get_device_region_info(int sock, uint32_t index) + } + + cap_sz = region_info->argsz - sizeof(struct vfio_region_info); +- printf("client: %s: region_info[%d] offset %#llx flags %#x size %llu " +- "cap_sz %lu #FDs %lu\n", __func__, index, region_info->offset, +- region_info->flags, region_info->size, cap_sz, nr_fds); ++ printf("client: %s: region_info[%d] offset %#llx flags %#x " ++ "size %llu cap_sz %zu #FDs %zu\n", __func__, index, ++ (unsigned long long)region_info->offset, region_info->flags, ++ (unsigned long long)region_info->size, cap_sz, ++ nr_fds); + if (cap_sz) { + struct vfio_region_info_cap_sparse_mmap *sparse = NULL; + if (get_region_vfio_caps((struct vfio_info_cap_header*)(region_info + 1), +@@ -343,7 +353,9 @@ get_device_region_info(int sock, uint32_t index) + mmap_sparse_areas(fds, region_info, sparse); + } + } ++ + } ++ free(region_info); + } + + static void +@@ -487,14 +499,15 @@ access_region(int sock, int region, bool is_write, uint64_t offset, + recv_data, recv_data_len, NULL, 0); + pthread_mutex_unlock(&mutex); + if (ret != 0) { +- warn("failed to %s region %d %#lx-%#lx", +- is_write ? "write to" : "read from", region, offset, +- offset + data_len - 1); ++ warn("failed to %s region %d %#llx-%#llx", ++ is_write ? "write to" : "read from", region, ++ (unsigned long long)offset, ++ (unsigned long long)(offset + data_len - 1)); + free(recv_data); + return ret; + } + if (recv_data->count != data_len) { +- warnx("bad %s data count, expected=%lu, actual=%d", ++ warnx("bad %s data count, expected=%zu, actual=%d", + is_write ? "write" : "read", data_len, + recv_data->count); + free(recv_data); +@@ -585,8 +598,9 @@ handle_dma_write(int sock, struct vfio_user_dma_map *dma_regions, + c = pwrite(dma_region_fds[i], data, dma_access.count, offset); + + if (c != (ssize_t)dma_access.count) { +- err(EXIT_FAILURE, "failed to write to fd=%d at [%#lx-%#lx)", +- dma_region_fds[i], offset, offset + dma_access.count); ++ err(EXIT_FAILURE, "failed to write to fd=%d at [%#llx-%#llx)", ++ dma_region_fds[i], (unsigned long long)offset, ++ (unsigned long long)(offset + dma_access.count)); + } + break; + } +@@ -640,8 +654,9 @@ handle_dma_read(int sock, struct vfio_user_dma_map *dma_regions, + c = pread(dma_region_fds[i], data, dma_access.count, offset); + + if (c != (ssize_t)dma_access.count) { +- err(EXIT_FAILURE, "failed to read from fd=%d at [%#lx-%#lx)", +- dma_region_fds[i], offset, offset + dma_access.count); ++ err(EXIT_FAILURE, "failed to read from fd=%d at [%#llx-%#llx)", ++ dma_region_fds[i], (unsigned long long)offset, ++ (unsigned long long)offset + dma_access.count); + } + break; + } +@@ -706,8 +721,9 @@ get_dirty_bitmap(int sock, struct vfio_user_dma_map *dma_region) + err(EXIT_FAILURE, "failed to get dirty page bitmap"); + } + +- printf("client: %s: %#lx-%#lx\t%#x\n", __func__, range->iova, +- range->iova + range->size - 1, bitmap[0]); ++ printf("client: %s: %#llx-%#llx\t%#x\n", __func__, ++ (unsigned long long)range->iova, ++ (unsigned long long)(range->iova + range->size - 1), bitmap[0]); + + free(data); + } +@@ -900,7 +916,7 @@ migrate_from(int sock, size_t *nr_iters, struct iovec **migr_iters, + _nr_iters += do_migrate(sock, 1, (*migr_iters) + _nr_iters); + if (_nr_iters != 2) { + errx(EXIT_FAILURE, +- "expected 2 iterations instead of %ld while in stop-and-copy state", ++ "expected 2 iterations instead of %zu while in stop-and-copy state", + _nr_iters); + } + +@@ -1000,8 +1016,9 @@ migrate_to(char *old_sock_path, int *server_max_fds, + * TODO write half of migration data via regular write and other half via + * memopy map. + */ +- printf("client: writing migration device data %#lx-%#lx\n", +- data_offset, data_offset + migr_iters[i].iov_len - 1); ++ printf("client: writing migration device data %#llx-%#llx\n", ++ (unsigned long long)data_offset, ++ (unsigned long long)(data_offset + migr_iters[i].iov_len - 1)); + ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true, + data_offset, migr_iters[i].iov_base, + migr_iters[i].iov_len); +@@ -1162,8 +1179,11 @@ int main(int argc, char *argv[]) + + unlink(template); + +- dma_regions = alloca(sizeof(*dma_regions) * nr_dma_regions); +- dma_region_fds = alloca(sizeof(*dma_region_fds) * nr_dma_regions); ++ dma_regions = calloc(nr_dma_regions, sizeof(*dma_regions)); ++ dma_region_fds = calloc(nr_dma_regions, sizeof(*dma_region_fds)); ++ if (dma_regions == NULL || dma_region_fds == NULL) { ++ err(EXIT_FAILURE, "%m\n"); ++ } + + for (i = 0; i < nr_dma_regions; i++) { + dma_regions[i].argsz = sizeof(struct vfio_user_dma_map); +@@ -1310,6 +1330,9 @@ int main(int argc, char *argv[]) + err(EXIT_FAILURE, "failed to unmap all DMA regions"); + } + ++ free(dma_regions); ++ free(dma_region_fds); ++ + return 0; + } + +diff --git a/subprojects/libvfio-user/samples/server.c b/subprojects/libvfio-user/samples/server.c +index e994ac1..e059d9c 100644 +--- a/subprojects/libvfio-user/samples/server.c ++++ b/subprojects/libvfio-user/samples/server.c +@@ -93,8 +93,9 @@ bar0_access(vfu_ctx_t *vfu_ctx, char * const buf, size_t count, loff_t offset, + struct server_data *server_data = vfu_get_private(vfu_ctx); + + if (count != sizeof(time_t) || offset != 0) { +- vfu_log(vfu_ctx, LOG_ERR, "bad BAR0 access %#lx-%#lx", +- offset, offset + count - 1); ++ vfu_log(vfu_ctx, LOG_ERR, "bad BAR0 access %#llx-%#llx", ++ (unsigned long long)offset, ++ (unsigned long long)offset + count - 1); + errno = EINVAL; + return -1; + } +@@ -123,8 +124,9 @@ bar1_access(vfu_ctx_t *vfu_ctx, char * const buf, + struct server_data *server_data = vfu_get_private(vfu_ctx); + + if (offset + count > server_data->bar1_size) { +- vfu_log(vfu_ctx, LOG_ERR, "bad BAR1 access %#lx-%#lx", +- offset, offset + count - 1); ++ vfu_log(vfu_ctx, LOG_ERR, "bad BAR1 access %#llx-%#llx", ++ (unsigned long long)offset, ++ (unsigned long long)offset + count - 1); + errno = EINVAL; + return -1; + } +@@ -353,8 +355,9 @@ migration_write_data(vfu_ctx_t *vfu_ctx, void *data, + assert(data != NULL); + + if (offset != 0 || size < server_data->bar1_size) { +- vfu_log(vfu_ctx, LOG_DEBUG, "XXX bad migration data write %#lx-%#lx", +- offset, offset + size - 1); ++ vfu_log(vfu_ctx, LOG_DEBUG, "XXX bad migration data write %#llx-%#llx", ++ (unsigned long long)offset, ++ (unsigned long long)offset + size - 1); + errno = EINVAL; + return -1; + } +diff --git a/subprojects/libvfio-user/test/mocks.c b/subprojects/libvfio-user/test/mocks.c +index 619ccf9..2ae14b4 100644 +--- a/subprojects/libvfio-user/test/mocks.c ++++ b/subprojects/libvfio-user/test/mocks.c +@@ -113,7 +113,7 @@ unpatch_all(void) + + int + dma_controller_add_region(dma_controller_t *dma, void *dma_addr, +- size_t size, int fd, off_t offset, ++ uint64_t size, int fd, off_t offset, + uint32_t prot) + { + if (!is_patched("dma_controller_add_region")) { +@@ -122,7 +122,7 @@ dma_controller_add_region(dma_controller_t *dma, void *dma_addr, + } + + check_expected_ptr(dma); +- check_expected(dma_addr); ++ check_expected_ptr(dma_addr); + check_expected(size); + check_expected(fd); + check_expected(offset); +diff --git a/subprojects/libvfio-user/test/py/libvfio_user.py b/subprojects/libvfio-user/test/py/libvfio_user.py +index 0ebf773..a63296c 100644 +--- a/subprojects/libvfio-user/test/py/libvfio_user.py ++++ b/subprojects/libvfio-user/test/py/libvfio_user.py +@@ -43,6 +43,12 @@ + import syslog + import copy + import tempfile ++import sys ++from resource import getpagesize ++from math import log2 ++ ++PAGE_SIZE = getpagesize() ++PAGE_SHIFT = int(log2(PAGE_SIZE)) + + UINT64_MAX = 18446744073709551615 + +@@ -140,8 +146,14 @@ + SERVER_MAX_DATA_XFER_SIZE = VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE + SERVER_MAX_MSG_SIZE = SERVER_MAX_DATA_XFER_SIZE + 16 + 16 + ++ ++def is_32bit(): ++ return (1 << 31) - 1 == sys.maxsize ++ ++ + MAX_DMA_REGIONS = 16 +-MAX_DMA_SIZE = (8 * ONE_TB) ++# FIXME get from libvfio-user.h ++MAX_DMA_SIZE = sys.maxsize << 1 if is_32bit() else (8 * ONE_TB) + + # enum vfio_user_command + VFIO_USER_VERSION = 1 +@@ -583,7 +595,7 @@ class vfio_user_migration_info(Structure): + c.c_ulong, c.c_long, c.c_bool) + lib.vfu_setup_region.argtypes = (c.c_void_p, c.c_int, c.c_ulong, + vfu_region_access_cb_t, c.c_int, c.c_void_p, +- c.c_uint32, c.c_int, c.c_ulong) ++ c.c_uint32, c.c_int, c.c_uint64) + vfu_reset_cb_t = c.CFUNCTYPE(c.c_int, c.c_void_p, c.c_int) + lib.vfu_setup_device_reset_cb.argtypes = (c.c_void_p, vfu_reset_cb_t) + lib.vfu_pci_get_config_space.argtypes = (c.c_void_p,) +@@ -769,7 +781,6 @@ def get_pci_ext_cfg_space(ctx): + + def read_pci_cfg_space(ctx, buf, count, offset, extended=False): + space = get_pci_ext_cfg_space(ctx) if extended else get_pci_cfg_space(ctx) +- + for i in range(count): + buf[i] = space[offset+i] + return count +@@ -783,6 +794,8 @@ def write_pci_cfg_space(ctx, buf, count, offset, extended=False): + space = c.cast(lib.vfu_pci_get_config_space(ctx), c.POINTER(c.c_char)) + + for i in range(count): ++ # FIXME this assignment doesn't update the actual config space, it ++ # works fine on x86_64 + space[offset+i] = buf[i] + return count + +@@ -897,11 +910,13 @@ def prepare_ctx_for_dma(dma_register=__dma_register, + assert ret == 0 + + f = tempfile.TemporaryFile() +- f.truncate(0x2000) ++ migr_region_size = 2 << PAGE_SHIFT ++ f.truncate(migr_region_size) + +- mmap_areas = [(0x1000, 0x1000)] ++ mmap_areas = [(PAGE_SIZE, PAGE_SIZE)] + +- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, ++ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, ++ size=migr_region_size, + flags=VFU_REGION_FLAG_RW, mmap_areas=mmap_areas, + fd=f.fileno()) + assert ret == 0 +@@ -1146,7 +1161,7 @@ def __migr_data_written_cb(ctx, count): + return migr_data_written_cb(ctx, count) + + +-def vfu_setup_device_migration_callbacks(ctx, cbs=None, offset=0x4000): ++def vfu_setup_device_migration_callbacks(ctx, cbs=None, offset=PAGE_SIZE): + assert ctx is not None + + if not cbs: +diff --git a/subprojects/libvfio-user/test/py/test_device_get_region_info.py b/subprojects/libvfio-user/test/py/test_device_get_region_info.py +index c439eaa..3260193 100644 +--- a/subprojects/libvfio-user/test/py/test_device_get_region_info.py ++++ b/subprojects/libvfio-user/test/py/test_device_get_region_info.py +@@ -35,6 +35,8 @@ + sock = None + + argsz = len(vfio_region_info()) ++migr_region_size = 2 << PAGE_SHIFT ++migr_mmap_areas = [(PAGE_SIZE, PAGE_SIZE)] + + + def test_device_get_region_info_setup(): +@@ -77,13 +79,11 @@ def test_device_get_region_info_setup(): + assert ret == 0 + + f = tempfile.TemporaryFile() +- f.truncate(0x2000) ++ f.truncate(migr_region_size) + +- mmap_areas = [(0x1000, 0x1000)] +- +- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, +- flags=VFU_REGION_FLAG_RW, mmap_areas=mmap_areas, +- fd=f.fileno()) ++ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, ++ size=migr_region_size, flags=VFU_REGION_FLAG_RW, ++ mmap_areas=migr_mmap_areas, fd=f.fileno()) + assert ret == 0 + + ret = vfu_realize_ctx(ctx) +@@ -246,10 +246,10 @@ def test_device_get_region_info_migr(): + assert cap.id == VFIO_REGION_INFO_CAP_SPARSE_MMAP + assert cap.version == 1 + assert cap.next == 0 +- assert cap.nr_areas == 1 ++ assert cap.nr_areas == len(migr_mmap_areas) == 1 + +- assert area.offset == 0x1000 +- assert area.size == 0x1000 ++ assert area.offset == migr_mmap_areas[0][0] ++ assert area.size == migr_mmap_areas[0][1] + + # skip reading the SCM_RIGHTS + disconnect_client(ctx, sock) +diff --git a/subprojects/libvfio-user/test/py/test_dirty_pages.py b/subprojects/libvfio-user/test/py/test_dirty_pages.py +index 8b4e3dc..687a6ce 100644 +--- a/subprojects/libvfio-user/test/py/test_dirty_pages.py ++++ b/subprojects/libvfio-user/test/py/test_dirty_pages.py +@@ -70,13 +70,13 @@ def test_dirty_pages_setup(): + assert ret == 0 + + f = tempfile.TemporaryFile() +- f.truncate(0x2000) ++ f.truncate(2 << PAGE_SHIFT) + +- mmap_areas = [(0x1000, 0x1000)] ++ mmap_areas = [(PAGE_SIZE, PAGE_SIZE)] + +- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, +- flags=VFU_REGION_FLAG_RW, mmap_areas=mmap_areas, +- fd=f.fileno()) ++ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, ++ size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW, ++ mmap_areas=mmap_areas, fd=f.fileno()) + assert ret == 0 + + ret = vfu_realize_ctx(ctx) +@@ -85,17 +85,17 @@ def test_dirty_pages_setup(): + sock = connect_client(ctx) + + f = tempfile.TemporaryFile() +- f.truncate(0x10000) ++ f.truncate(0x10 << PAGE_SHIFT) + + payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x10000, size=0x20000) ++ offset=0, addr=0x10 << PAGE_SHIFT, size=0x20 << PAGE_SHIFT) + + msg(ctx, sock, VFIO_USER_DMA_MAP, payload, fds=[f.fileno()]) + + payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x40000, size=0x10000) ++ offset=0, addr=0x40 << PAGE_SHIFT, size=0x10 << PAGE_SHIFT) + + msg(ctx, sock, VFIO_USER_DMA_MAP, payload) + +@@ -123,13 +123,16 @@ def test_dirty_pages_start_no_migration(): + expect=errno.ENOTSUP) + + ++def test_setup_migr_region(): ++ ret = vfu_setup_device_migration_callbacks(ctx, offset=PAGE_SIZE) ++ assert ret == 0 ++ ++ + def test_dirty_pages_start_bad_flags(): + # + # This is a little cheeky, after vfu_realize_ctx(), but it works at the + # moment. + # +- vfu_setup_device_migration_callbacks(ctx, offset=0x1000) +- + payload = vfio_user_dirty_pages(argsz=len(vfio_user_dirty_pages()), + flags=(VFIO_IOMMU_DIRTY_PAGES_FLAG_START | + VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP)) +@@ -173,8 +176,9 @@ def test_dirty_pages_get_sub_range(): + argsz = len(vfio_user_dirty_pages()) + len(vfio_user_bitmap_range()) + 8 + dirty_pages = vfio_user_dirty_pages(argsz=argsz, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) +- br = vfio_user_bitmap_range(iova=0x11000, size=0x1000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) ++ br = vfio_user_bitmap_range(iova=0x11 << PAGE_SHIFT, size=PAGE_SIZE, ++ bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -186,8 +190,9 @@ def test_dirty_pages_get_bad_page_size(): + argsz = len(vfio_user_dirty_pages()) + len(vfio_user_bitmap_range()) + 8 + dirty_pages = vfio_user_dirty_pages(argsz=argsz, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x2000, size=8) +- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=2 << PAGE_SHIFT, size=8) ++ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -199,8 +204,9 @@ def test_dirty_pages_get_bad_bitmap_size(): + argsz = len(vfio_user_dirty_pages()) + len(vfio_user_bitmap_range()) + 8 + dirty_pages = vfio_user_dirty_pages(argsz=argsz, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, size=1) +- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=1) ++ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -211,9 +217,10 @@ def test_dirty_pages_get_bad_bitmap_size(): + def test_dirty_pages_get_bad_argsz(): + dirty_pages = vfio_user_dirty_pages(argsz=SERVER_MAX_DATA_XFER_SIZE + 8, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, + size=SERVER_MAX_DATA_XFER_SIZE + 8) +- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) ++ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -224,8 +231,9 @@ def test_dirty_pages_get_bad_argsz(): + def test_dirty_pages_get_short_reply(): + dirty_pages = vfio_user_dirty_pages(argsz=len(vfio_user_dirty_pages()), + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) +- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) ++ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -246,8 +254,9 @@ def test_get_dirty_page_bitmap_unmapped(): + + dirty_pages = vfio_user_dirty_pages(argsz=argsz, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) +- br = vfio_user_bitmap_range(iova=0x40000, size=0x10000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) ++ br = vfio_user_bitmap_range(iova=0x40 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -260,8 +269,9 @@ def test_dirty_pages_get_unmodified(): + + dirty_pages = vfio_user_dirty_pages(argsz=argsz, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) +- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) ++ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -276,10 +286,10 @@ def test_dirty_pages_get_unmodified(): + + br, result = vfio_user_bitmap_range.pop_from_buffer(result) + +- assert br.iova == 0x10000 +- assert br.size == 0x10000 ++ assert br.iova == 0x10 << PAGE_SHIFT ++ assert br.size == 0x10 << PAGE_SHIFT + +- assert br.bitmap.pgsize == 0x1000 ++ assert br.bitmap.pgsize == PAGE_SIZE + assert br.bitmap.size == 8 + + +@@ -288,8 +298,9 @@ def get_dirty_page_bitmap(): + + dirty_pages = vfio_user_dirty_pages(argsz=argsz, + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) +- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) +- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) ++ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, ++ size=0x10 << PAGE_SHIFT, bitmap=bitmap) + + payload = bytes(dirty_pages) + bytes(br) + +@@ -307,9 +318,10 @@ def get_dirty_page_bitmap(): + iovec3 = None + + +-def write_to_addr(ctx, addr, size, get_bitmap=True): ++def write_to_page(ctx, page, nr_pages, get_bitmap=True): + """Simulate a write to the given address and size.""" +- ret, sg = vfu_addr_to_sgl(ctx, dma_addr=addr, length=size) ++ ret, sg = vfu_addr_to_sgl(ctx, dma_addr=page << PAGE_SHIFT, ++ length=nr_pages << PAGE_SHIFT) + assert ret == 1 + iovec = iovec_t() + ret = vfu_sgl_get(ctx, sg, iovec) +@@ -321,29 +333,32 @@ def write_to_addr(ctx, addr, size, get_bitmap=True): + + + def test_dirty_pages_get_modified(): +- ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10000, length=0x1000) ++ ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10 << PAGE_SHIFT, ++ length=PAGE_SIZE) + assert ret == 1 + iovec1 = iovec_t() + ret = vfu_sgl_get(ctx, sg1, iovec1) + assert ret == 0 + + # read only +- ret, sg2 = vfu_addr_to_sgl(ctx, dma_addr=0x11000, length=0x1000, +- prot=mmap.PROT_READ) ++ ret, sg2 = vfu_addr_to_sgl(ctx, dma_addr=0x11 << PAGE_SHIFT, ++ length=PAGE_SIZE, prot=mmap.PROT_READ) + assert ret == 1 + iovec2 = iovec_t() + ret = vfu_sgl_get(ctx, sg2, iovec2) + assert ret == 0 + + # simple single bitmap entry map +- ret, sg3 = vfu_addr_to_sgl(ctx, dma_addr=0x12000, length=0x1000) ++ ret, sg3 = vfu_addr_to_sgl(ctx, dma_addr=0x12 << PAGE_SHIFT, ++ length=PAGE_SIZE) + assert ret == 1 + iovec3 = iovec_t() + ret = vfu_sgl_get(ctx, sg3, iovec3) + assert ret == 0 + + # write that spans bytes in bitmap +- ret, sg4 = vfu_addr_to_sgl(ctx, dma_addr=0x16000, length=0x4000) ++ ret, sg4 = vfu_addr_to_sgl(ctx, dma_addr=0x16 << PAGE_SHIFT, ++ length=0x4 << PAGE_SHIFT) + assert ret == 1 + iovec4 = iovec_t() + ret = vfu_sgl_get(ctx, sg4, iovec4) +@@ -374,40 +389,40 @@ def test_dirty_pages_get_modified(): + # + + # very first bit +- bitmap = write_to_addr(ctx, 0x10000, 0x1000) ++ bitmap = write_to_page(ctx, 0x10, 1) + assert bitmap == 0b0000000000000001 + + # top bit of first byte +- bitmap = write_to_addr(ctx, 0x17000, 0x1000) ++ bitmap = write_to_page(ctx, 0x17, 1) + assert bitmap == 0b0000000010000000 + + # all bits except top one of first byte +- bitmap = write_to_addr(ctx, 0x10000, 0x7000) ++ bitmap = write_to_page(ctx, 0x10, 7) + assert bitmap == 0b0000000001111111 + + # all bits of first byte +- bitmap = write_to_addr(ctx, 0x10000, 0x8000) ++ bitmap = write_to_page(ctx, 0x10, 8) + assert bitmap == 0b0000000011111111 + + # all bits of first byte plus bottom bit of next +- bitmap = write_to_addr(ctx, 0x10000, 0x9000) ++ bitmap = write_to_page(ctx, 0x10, 9) + assert bitmap == 0b0000000111111111 + + # straddle top/bottom bit +- bitmap = write_to_addr(ctx, 0x17000, 0x2000) ++ bitmap = write_to_page(ctx, 0x17, 2) + assert bitmap == 0b0000000110000000 + + # top bit of second byte +- bitmap = write_to_addr(ctx, 0x1f000, 0x1000) ++ bitmap = write_to_page(ctx, 0x1f, 1) + assert bitmap == 0b1000000000000000 + + # top bit of third byte +- bitmap = write_to_addr(ctx, 0x27000, 0x1000) ++ bitmap = write_to_page(ctx, 0x27, 1) + assert bitmap == 0b100000000000000000000000 + + # bits in third and first byte +- write_to_addr(ctx, 0x26000, 0x1000, get_bitmap=False) +- write_to_addr(ctx, 0x12000, 0x2000, get_bitmap=False) ++ write_to_page(ctx, 0x26, 1, get_bitmap=False) ++ write_to_page(ctx, 0x12, 2, get_bitmap=False) + bitmap = get_dirty_page_bitmap() + assert bitmap == 0b010000000000000000001100 + +@@ -445,7 +460,8 @@ def test_dirty_pages_bitmap_with_quiesce(): + + quiesce_errno = errno.EBUSY + +- ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10000, length=0x1000) ++ ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10 << PAGE_SHIFT, ++ length=PAGE_SIZE) + assert ret == 1 + iovec1 = iovec_t() + ret = vfu_sgl_get(ctx, sg1, iovec1) +diff --git a/subprojects/libvfio-user/test/py/test_dma_map.py b/subprojects/libvfio-user/test/py/test_dma_map.py +index e8ce8f2..12d1f6d 100644 +--- a/subprojects/libvfio-user/test/py/test_dma_map.py ++++ b/subprojects/libvfio-user/test/py/test_dma_map.py +@@ -60,7 +60,7 @@ def test_dma_region_too_big(): + payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | + VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x10000, size=MAX_DMA_SIZE + 4096) ++ offset=0, addr=0x10 << PAGE_SHIFT, size=MAX_DMA_SIZE + PAGE_SIZE) + + msg(ctx, sock, VFIO_USER_DMA_MAP, payload, expect=errno.ENOSPC) + +@@ -72,7 +72,7 @@ def test_dma_region_too_many(): + payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | + VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x1000 * i, size=4096) ++ offset=0, addr=PAGE_SIZE * i, size=PAGE_SIZE) + + if i == MAX_DMA_REGIONS + 1: + expect = errno.EINVAL +@@ -95,7 +95,7 @@ def test_dma_map_busy(mock_dma_register, mock_quiesce): + payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | + VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x10000, size=0x1000) ++ offset=0, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) + + msg(ctx, sock, VFIO_USER_DMA_MAP, payload, rsp=False, + busy=True) +@@ -106,8 +106,9 @@ def test_dma_map_busy(mock_dma_register, mock_quiesce): + assert ret == 0 + + # check that DMA register callback got called +- dma_info = vfu_dma_info_t(iovec_t(iov_base=0x10000, iov_len=0x1000), +- None, iovec_t(None, 0), 0x1000, mmap.PROT_READ | mmap.PROT_WRITE) ++ iov = iovec_t(iov_base=0x10 << PAGE_SHIFT, iov_len=PAGE_SIZE) ++ dma_info = vfu_dma_info_t(iov, None, iovec_t(None, 0), PAGE_SIZE, ++ mmap.PROT_READ | mmap.PROT_WRITE) + mock_dma_register.assert_called_once_with(ctx, dma_info) + + get_reply(sock) +@@ -119,11 +120,11 @@ def test_dma_map_busy(mock_dma_register, mock_quiesce): + mock_dma_register.assert_called_once() + + # check that the DMA region has been added +- count, sgs = vfu_addr_to_sgl(ctx, 0x10000, 0x1000) ++ count, sgs = vfu_addr_to_sgl(ctx, 0x10 << PAGE_SHIFT, PAGE_SIZE) + assert len(sgs) == 1 + sg = sgs[0] +- assert sg.dma_addr == 0x10000 and sg.region == 0 and sg.length == 0x1000 \ +- and sg.offset == 0 and sg.writeable ++ assert sg.dma_addr == 0x10 << PAGE_SHIFT and sg.region == 0 \ ++ and sg.length == PAGE_SIZE and sg.offset == 0 and sg.writeable + + + # FIXME better move this test and the following to test_request_errors +@@ -153,7 +154,7 @@ def side_effect(ctx, info): + argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | + VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x10000, size=0x1000) ++ offset=0, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) + + msg(ctx, sock, VFIO_USER_DMA_MAP, payload, rsp=False) + +@@ -192,7 +193,7 @@ def test_dma_map_busy_reply_fail(mock_dma_register, mock_quiesce, mock_reset): + argsz=len(vfio_user_dma_map()), + flags=(VFIO_USER_F_DMA_REGION_READ | + VFIO_USER_F_DMA_REGION_WRITE), +- offset=0, addr=0x10000, size=0x1000) ++ offset=0, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) + + msg(ctx, sock, VFIO_USER_DMA_MAP, payload, rsp=False, + busy=True) +@@ -209,8 +210,9 @@ def test_dma_map_busy_reply_fail(mock_dma_register, mock_quiesce, mock_reset): + ret = vfu_device_quiesced(ctx, 0) + assert ret == 0 + +- dma_info = vfu_dma_info_t(iovec_t(iov_base=0x10000, iov_len=0x1000), +- None, iovec_t(None, 0), 0x1000, mmap.PROT_READ | mmap.PROT_WRITE) ++ iov = iovec_t(iov_base=0x10 << PAGE_SHIFT, iov_len=PAGE_SIZE) ++ dma_info = vfu_dma_info_t(iov, None, iovec_t(None, 0), PAGE_SIZE, ++ mmap.PROT_READ | mmap.PROT_WRITE) + mock_dma_register.assert_called_once_with(ctx, dma_info) + + # device reset callback should be called (by do_reply) +@@ -224,7 +226,7 @@ def test_dma_map_busy_reply_fail(mock_dma_register, mock_quiesce, mock_reset): + mock_reset.assert_called_once() + + # check that the DMA region was NOT added +- count, sgs = vfu_addr_to_sgl(ctx, 0x10000, 0x1000) ++ count, sgs = vfu_addr_to_sgl(ctx, 0x10 << PAGE_SHIFT, PAGE_SIZE) + assert count == -1 + assert c.get_errno() == errno.ENOENT + +diff --git a/subprojects/libvfio-user/test/py/test_dma_unmap.py b/subprojects/libvfio-user/test/py/test_dma_unmap.py +index 7f207ea..063dedc 100644 +--- a/subprojects/libvfio-user/test/py/test_dma_unmap.py ++++ b/subprojects/libvfio-user/test/py/test_dma_unmap.py +@@ -53,7 +53,7 @@ def teardown_function(function): + vfu_destroy_ctx(ctx) + + +-def setup_dma_regions(dma_regions=[(0x0, 0x1000)]): ++def setup_dma_regions(dma_regions=[(0x0, PAGE_SIZE)]): + global ctx, sock + for dma_region in dma_regions: + payload = struct.pack("II", 0, 0) +@@ -72,7 +72,8 @@ def test_dma_unmap_short_write(): + + def test_dma_unmap_bad_argsz(): + +- payload = vfio_user_dma_unmap(argsz=8, flags=0, addr=0x1000, size=4096) ++ payload = vfio_user_dma_unmap(argsz=8, flags=0, addr=PAGE_SIZE, ++ size=PAGE_SIZE) + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, + expect=errno.EINVAL) + +@@ -80,7 +81,7 @@ def test_dma_unmap_bad_argsz(): + def test_dma_unmap_bad_argsz2(): + + payload = vfio_user_dma_unmap(argsz=SERVER_MAX_DATA_XFER_SIZE + 8, flags=0, +- addr=0x1000, size=4096) ++ addr=PAGE_SIZE, size=PAGE_SIZE) + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, + expect=errno.EINVAL) + +@@ -89,8 +90,9 @@ def test_dma_unmap_dirty_bad_argsz(): + + argsz = len(vfio_user_dma_unmap()) + len(vfio_user_bitmap()) + unmap = vfio_user_dma_unmap(argsz=argsz, +- flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=0x1000, size=4096) +- bitmap = vfio_user_bitmap(pgsize=4096, size=(UINT64_MAX - argsz) + 8) ++ flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=PAGE_SIZE, ++ size=PAGE_SIZE) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=(UINT64_MAX - argsz) + 8) + payload = bytes(unmap) + bytes(bitmap) + + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, +@@ -99,11 +101,12 @@ def test_dma_unmap_dirty_bad_argsz(): + + def test_dma_unmap_dirty_not_tracking(): + +- setup_dma_regions([(0x1000, 4096)]) ++ setup_dma_regions([(PAGE_SIZE, PAGE_SIZE)]) + argsz = len(vfio_user_dma_unmap()) + len(vfio_user_bitmap()) + 8 + unmap = vfio_user_dma_unmap(argsz=argsz, +- flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=0x1000, size=4096) +- bitmap = vfio_user_bitmap(pgsize=4096, size=8) ++ flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=PAGE_SIZE, ++ size=PAGE_SIZE) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) + payload = bytes(unmap) + bytes(bitmap) + bytes(8) + + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, +@@ -112,8 +115,8 @@ def test_dma_unmap_dirty_not_tracking(): + + def test_dma_unmap_dirty_not_mapped(): + +- setup_dma_regions([(0x1000, 4096)]) +- vfu_setup_device_migration_callbacks(ctx, offset=0x1000) ++ setup_dma_regions([(PAGE_SIZE, PAGE_SIZE)]) ++ vfu_setup_device_migration_callbacks(ctx, offset=PAGE_SIZE) + payload = vfio_user_dirty_pages(argsz=len(vfio_user_dirty_pages()), + flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_START) + +@@ -121,8 +124,9 @@ def test_dma_unmap_dirty_not_mapped(): + + argsz = len(vfio_user_dma_unmap()) + len(vfio_user_bitmap()) + 8 + unmap = vfio_user_dma_unmap(argsz=argsz, +- flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=0x1000, size=4096) +- bitmap = vfio_user_bitmap(pgsize=4096, size=8) ++ flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=PAGE_SIZE, ++ size=PAGE_SIZE) ++ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) + payload = bytes(unmap) + bytes(bitmap) + bytes(8) + + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, +@@ -133,7 +137,7 @@ def test_dma_unmap_invalid_flags(): + + setup_dma_regions() + payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), +- flags=0x4, addr=0x1000, size=4096) ++ flags=0x4, addr=PAGE_SIZE, size=PAGE_SIZE) + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, + expect=errno.EINVAL) + +@@ -142,7 +146,7 @@ def test_dma_unmap(): + + setup_dma_regions() + payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), +- flags=0, addr=0x0, size=0x1000) ++ flags=0, addr=0x0, size=PAGE_SIZE) + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload) + + +@@ -150,7 +154,7 @@ def test_dma_unmap_invalid_addr(): + + setup_dma_regions() + payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), +- addr=0x10000, size=4096) ++ addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) + + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, + expect=errno.ENOENT) +@@ -162,7 +166,7 @@ def test_dma_unmap_async(mock_quiesce): + setup_dma_regions() + mock_quiesce.side_effect = fail_with_errno(errno.EBUSY) + payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), +- flags=0, addr=0x0, size=0x1000) ++ flags=0, addr=0x0, size=PAGE_SIZE) + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, rsp=False, + busy=True) + +@@ -177,7 +181,8 @@ def test_dma_unmap_async(mock_quiesce): + + def test_dma_unmap_all(): + +- setup_dma_regions((0x1000*i, 0x1000) for i in range(MAX_DMA_REGIONS)) ++ dma_regions = [(PAGE_SIZE * i, PAGE_SIZE) for i in range(MAX_DMA_REGIONS)] ++ setup_dma_regions(dma_regions) + payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), + flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0, size=0) + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload) +@@ -186,7 +191,7 @@ def test_dma_unmap_all(): + def test_dma_unmap_all_invalid_addr(): + + payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), +- flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0x10000, size=4096) ++ flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) + + msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, + expect=errno.EINVAL) +diff --git a/subprojects/libvfio-user/test/py/test_migration.py b/subprojects/libvfio-user/test/py/test_migration.py +index c5da94f..614a615 100644 +--- a/subprojects/libvfio-user/test/py/test_migration.py ++++ b/subprojects/libvfio-user/test/py/test_migration.py +@@ -42,8 +42,8 @@ def setup_function(function): + ctx = vfu_create_ctx(flags=LIBVFIO_USER_FLAG_ATTACH_NB) + assert ctx is not None + +- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, +- flags=VFU_REGION_FLAG_RW) ++ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, ++ size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW) + assert ret == 0 + + ret = vfu_setup_device_migration_callbacks(ctx) +diff --git a/subprojects/libvfio-user/test/py/test_pci_caps.py b/subprojects/libvfio-user/test/py/test_pci_caps.py +index b83c06c..5875d22 100644 +--- a/subprojects/libvfio-user/test/py/test_pci_caps.py ++++ b/subprojects/libvfio-user/test/py/test_pci_caps.py +@@ -157,7 +157,11 @@ def test_add_caps(mock_pci_region_cb): + + __test_pci_cap_write_hdr(sock) + __test_pci_cap_readonly(sock) +- __test_pci_cap_callback(sock) ++ # FIXME assignment to PCI config space from callback is ignored ++ # Ideally we should ignore this test via pytest command line but this isn't ++ # and individual test, and making it one requires a bit of effort. ++ if not is_32bit(): ++ __test_pci_cap_callback(sock) + __test_pci_cap_write_pmcs(sock) + + +@@ -246,7 +250,6 @@ def __test_pci_cap_callback(sock): + # offsetof(struct vsc, data) + offset = cap_offsets[2] + 3 + data = b"Hello world." +- + payload = read_region(ctx, sock, VFU_PCI_DEV_CFG_REGION_IDX, offset=offset, + count=len(data)) + assert payload == data +diff --git a/subprojects/libvfio-user/test/py/test_pci_ext_caps.py b/subprojects/libvfio-user/test/py/test_pci_ext_caps.py +index 8fcadf6..c425c8b 100644 +--- a/subprojects/libvfio-user/test/py/test_pci_ext_caps.py ++++ b/subprojects/libvfio-user/test/py/test_pci_ext_caps.py +@@ -258,6 +258,10 @@ def test_pci_ext_cap_readonly(): + + + def test_pci_ext_cap_callback(): ++ ++ # FIXME assignment to PCI config space from callback is ignored ++ if is_32bit(): ++ return + sock = connect_client(ctx) + + # start of vendor payload +@@ -297,6 +301,11 @@ def test_pci_ext_cap_write_dsn(): + + + def test_pci_ext_cap_write_vendor(): ++ ++ # FIXME assignment to PCI config space from callback is ignored ++ if is_32bit(): ++ return ++ + sock = connect_client(ctx) + + data = struct.pack("II", 0x1, 0x2) +diff --git a/subprojects/libvfio-user/test/py/test_request_errors.py b/subprojects/libvfio-user/test/py/test_request_errors.py +index 2615352..79af0f2 100644 +--- a/subprojects/libvfio-user/test/py/test_request_errors.py ++++ b/subprojects/libvfio-user/test/py/test_request_errors.py +@@ -54,11 +54,11 @@ def setup_function(function): + ret = vfu_setup_device_reset_cb(ctx) + assert ret == 0 + +- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, +- flags=VFU_REGION_FLAG_RW) ++ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, ++ size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW) + assert ret == 0 + +- ret = vfu_setup_device_migration_callbacks(ctx, offset=0x4000) ++ ret = vfu_setup_device_migration_callbacks(ctx) + assert ret == 0 + + ret = vfu_realize_ctx(ctx) +diff --git a/subprojects/libvfio-user/test/unit-tests.c b/subprojects/libvfio-user/test/unit-tests.c +index cdb88a2..26ad304 100644 +--- a/subprojects/libvfio-user/test/unit-tests.c ++++ b/subprojects/libvfio-user/test/unit-tests.c +@@ -161,8 +161,8 @@ static int + check_dma_info(const LargestIntegralType value, + const LargestIntegralType cvalue) + { +- vfu_dma_info_t *info = (vfu_dma_info_t *)value; +- vfu_dma_info_t *cinfo = (vfu_dma_info_t *)cvalue; ++ vfu_dma_info_t *info = (vfu_dma_info_t *)(long)value; ++ vfu_dma_info_t *cinfo = (vfu_dma_info_t *)(long)cvalue; + + return info->iova.iov_base == cinfo->iova.iov_base && + info->iova.iov_len == cinfo->iova.iov_len && +@@ -188,7 +188,7 @@ test_dma_map_return_value(void **state UNUSED) + }; + + patch("dma_controller_add_region"); +- expect_value(dma_controller_add_region, dma, vfu_ctx.dma); ++ expect_value(dma_controller_add_region, dma, (uintptr_t)vfu_ctx.dma); + expect_value(dma_controller_add_region, dma_addr, dma_map.addr); + expect_value(dma_controller_add_region, size, dma_map.size); + expect_value(dma_controller_add_region, fd, -1); +@@ -264,7 +264,7 @@ test_dma_controller_add_region_no_fd(void **state UNUSED) + assert_int_equal(0, r->info.mapping.iov_len); + assert_ptr_equal(dma_addr, r->info.iova.iov_base); + assert_int_equal(size, r->info.iova.iov_len); +- assert_int_equal(0x1000, r->info.page_size); ++ assert_int_equal(sysconf(_SC_PAGE_SIZE), r->info.page_size); + assert_int_equal(offset, r->offset); + assert_int_equal(fd, r->fd); + assert_int_equal(PROT_NONE, r->info.prot); +@@ -330,7 +330,7 @@ test_dma_addr_to_sgl(void **state UNUSED) + assert_int_equal(1, ret); + assert_int_equal(r->info.iova.iov_base, sg[0].dma_addr); + assert_int_equal(0, sg[0].region); +- assert_int_equal(0x2000 - (unsigned long long)r->info.iova.iov_base, ++ assert_int_equal(0x2000 - (long)r->info.iova.iov_base, + sg[0].offset); + assert_int_equal(0x400, sg[0].length); + assert_true(vfu_sg_is_mappable(&vfu_ctx, &sg[0])); +-- +2.37.3 + diff --git a/qemu.spec b/qemu.spec index 218aee5..c1c8f80 100644 --- a/qemu.spec +++ b/qemu.spec @@ -360,6 +360,10 @@ Patch: 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch # Fix one of the tests. Sent upstream 2023-02-27. Patch: 0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch +# vfio-user fixes for i386 and ppc64le +Patch: 0001-fix-compilation-on-i386-and-ppc64.patch + + BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel BuildRequires: glib2-devel @@ -518,6 +522,10 @@ BuildRequires: pcre-static %endif %endif +# vfio-user-server +BuildRequires: pkgconfig(json-c) +BuildRequires: pkgconfig(cmocka) + # Requires for the Fedora 'qemu' metapackage Requires: %{name}-user = %{epoch}:%{version}-%{release} @@ -1759,6 +1767,7 @@ run_configure \ %endif --enable-usb-redir \ --enable-vdi \ + --enable-vfio-user-server \ --enable-vhost-crypto \ %if %{have_virgl} --enable-virglrenderer \ @@ -2237,6 +2246,8 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ # Fedora specific %{_datadir}/applications/qemu.desktop %exclude %{_datadir}/%{name}/qemu-nsis.bmp +%{_libdir}/libvfio-user.so* +%exclude %{_includedir}/vfio-user/ %{_libexecdir}/virtfs-proxy-helper %{_mandir}/man1/virtfs-proxy-helper.1* From d58272f92e602685728a200a4ddead9c8f51ccea Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Wed, 19 Apr 2023 12:35:07 -0300 Subject: [PATCH 30/54] Revert "Enable libvfio-user" Build is still broken with 7.2.0. https://gitlab.com/qemu-project/qemu/-/issues/1384 This reverts commit b5541eb631a3ecb5f0097d2efb1cd8578c933211. --- 0001-fix-compilation-on-i386-and-ppc64.patch | 1588 ------------------ qemu.spec | 11 - 2 files changed, 1599 deletions(-) delete mode 100644 0001-fix-compilation-on-i386-and-ppc64.patch diff --git a/0001-fix-compilation-on-i386-and-ppc64.patch b/0001-fix-compilation-on-i386-and-ppc64.patch deleted file mode 100644 index dfe5725..0000000 --- a/0001-fix-compilation-on-i386-and-ppc64.patch +++ /dev/null @@ -1,1588 +0,0 @@ -From 5693c8f2110e236772bf7abe7b3ea390f029c697 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Thu, 22 Sep 2022 16:08:55 -0300 -Subject: [PATCH] fix compilation on i386 and ppc64 - -Signed-off-by: Thanos Makatos -Reported-by: Eduardo Lima -Signed-off-by: rpm-build ---- - subprojects/libvfio-user/lib/dma.c | 28 +++-- - subprojects/libvfio-user/lib/dma.h | 3 +- - subprojects/libvfio-user/lib/libvfio-user.c | 81 ++++++++----- - subprojects/libvfio-user/lib/migration.c | 18 +-- - subprojects/libvfio-user/lib/pci.c | 12 +- - subprojects/libvfio-user/lib/pci_caps.c | 12 +- - subprojects/libvfio-user/lib/private.h | 4 + - subprojects/libvfio-user/lib/tran.c | 2 +- - subprojects/libvfio-user/lib/tran_pipe.c | 2 +- - subprojects/libvfio-user/samples/client.c | 77 +++++++----- - subprojects/libvfio-user/samples/server.c | 15 ++- - subprojects/libvfio-user/test/mocks.c | 4 +- - .../libvfio-user/test/py/libvfio_user.py | 29 +++-- - .../test/py/test_device_get_region_info.py | 18 +-- - .../libvfio-user/test/py/test_dirty_pages.py | 110 ++++++++++-------- - .../libvfio-user/test/py/test_dma_map.py | 28 ++--- - .../libvfio-user/test/py/test_dma_unmap.py | 41 ++++--- - .../libvfio-user/test/py/test_migration.py | 4 +- - .../libvfio-user/test/py/test_pci_caps.py | 7 +- - .../libvfio-user/test/py/test_pci_ext_caps.py | 9 ++ - .../test/py/test_request_errors.py | 6 +- - subprojects/libvfio-user/test/unit-tests.c | 10 +- - 22 files changed, 316 insertions(+), 204 deletions(-) - -diff --git a/subprojects/libvfio-user/lib/dma.c b/subprojects/libvfio-user/lib/dma.c -index ac3ddfe..1ee8704 100644 ---- a/subprojects/libvfio-user/lib/dma.c -+++ b/subprojects/libvfio-user/lib/dma.c -@@ -249,7 +249,7 @@ dma_map_region(dma_controller_t *dma, dma_memory_region_t *region) - region->info.vaddr = mmap_base + (region->offset - offset); - - vfu_log(dma->vfu_ctx, LOG_DEBUG, "mapped DMA region iova=[%p, %p) " -- "vaddr=%p page_size=%#lx mapping=[%p, %p)", -+ "vaddr=%p page_size=%zx mapping=[%p, %p)", - region->info.iova.iov_base, iov_end(®ion->info.iova), - region->info.vaddr, region->info.page_size, - region->info.mapping.iov_base, iov_end(®ion->info.mapping)); -@@ -290,7 +290,7 @@ dirty_page_logging_start_on_region(dma_memory_region_t *region, size_t pgsize) - - int - MOCK_DEFINE(dma_controller_add_region)(dma_controller_t *dma, -- vfu_dma_addr_t dma_addr, size_t size, -+ vfu_dma_addr_t dma_addr, uint64_t size, - int fd, off_t offset, uint32_t prot) - { - dma_memory_region_t *region; -@@ -300,12 +300,12 @@ MOCK_DEFINE(dma_controller_add_region)(dma_controller_t *dma, - - assert(dma != NULL); - -- snprintf(rstr, sizeof(rstr), "[%p, %p) fd=%d offset=%#lx prot=%#x", -- dma_addr, (char *)dma_addr + size, fd, offset, prot); -+ snprintf(rstr, sizeof(rstr), "[%p, %p) fd=%d offset=%#llx prot=%#x", -+ dma_addr, dma_addr + size, fd, (unsigned long long)offset, prot); - - if (size > dma->max_size) { -- vfu_log(dma->vfu_ctx, LOG_ERR, "DMA region size %zu > max %zu", -- size, dma->max_size); -+ vfu_log(dma->vfu_ctx, LOG_ERR, "DMA region size %llu > max %zu", -+ (unsigned long long)size, dma->max_size); - return ERROR_INT(ENOSPC); - } - -@@ -317,7 +317,8 @@ MOCK_DEFINE(dma_controller_add_region)(dma_controller_t *dma, - region->info.iova.iov_len == size) { - if (offset != region->offset) { - vfu_log(dma->vfu_ctx, LOG_ERR, "bad offset for new DMA region " -- "%s; existing=%#lx", rstr, region->offset); -+ "%s; existing=%#llx", rstr, -+ (unsigned long long)region->offset); - return ERROR_INT(EINVAL); - } - if (!fds_are_same_file(region->fd, fd)) { -@@ -568,12 +569,19 @@ dma_controller_dirty_page_get(dma_controller_t *dma, vfu_dma_addr_t addr, - * IOVAs. - */ - ret = dma_addr_to_sgl(dma, addr, len, &sg, 1, PROT_NONE); -- if (ret != 1 || sg.dma_addr != addr || sg.length != len) { -+ if (unlikely(ret != 1)) { -+ vfu_log(dma->vfu_ctx, LOG_DEBUG, "failed to translate %#llx-%#llx: %m", -+ (unsigned long long)(uintptr_t)addr, -+ (unsigned long long)(uintptr_t)addr + len - 1); -+ return ret; -+ } -+ -+ if (unlikely(sg.dma_addr != addr || sg.length != len)) { - return ERROR_INT(ENOTSUP); - } - - if (pgsize != dma->dirty_pgsize) { -- vfu_log(dma->vfu_ctx, LOG_ERR, "bad page size %ld", pgsize); -+ vfu_log(dma->vfu_ctx, LOG_ERR, "bad page size %zu", pgsize); - return ERROR_INT(EINVAL); - } - -@@ -588,7 +596,7 @@ dma_controller_dirty_page_get(dma_controller_t *dma, vfu_dma_addr_t addr, - * receive. - */ - if (size != (size_t)bitmap_size) { -- vfu_log(dma->vfu_ctx, LOG_ERR, "bad bitmap size %ld != %ld", size, -+ vfu_log(dma->vfu_ctx, LOG_ERR, "bad bitmap size %zu != %zu", size, - bitmap_size); - return ERROR_INT(EINVAL); - } -diff --git a/subprojects/libvfio-user/lib/dma.h b/subprojects/libvfio-user/lib/dma.h -index 089f973..e59c5ad 100644 ---- a/subprojects/libvfio-user/lib/dma.h -+++ b/subprojects/libvfio-user/lib/dma.h -@@ -125,7 +125,7 @@ dma_controller_destroy(dma_controller_t *dma); - * - On failure, -1 with errno set. - */ - MOCK_DECLARE(int, dma_controller_add_region, dma_controller_t *dma, -- vfu_dma_addr_t dma_addr, size_t size, int fd, off_t offset, -+ vfu_dma_addr_t dma_addr, uint64_t size, int fd, off_t offset, - uint32_t prot); - - MOCK_DECLARE(int, dma_controller_remove_region, dma_controller_t *dma, -@@ -209,6 +209,7 @@ dma_init_sg(const dma_controller_t *dma, dma_sg_t *sg, vfu_dma_addr_t dma_addr, - const dma_memory_region_t *const region = &dma->regions[region_index]; - - if ((prot & PROT_WRITE) && !(region->info.prot & PROT_WRITE)) { -+ vfu_log(dma->vfu_ctx, LOG_DEBUG, "read-only region"); - return ERROR_INT(EACCES); - } - -diff --git a/subprojects/libvfio-user/lib/libvfio-user.c b/subprojects/libvfio-user/lib/libvfio-user.c -index ac04d3b..bc49618 100644 ---- a/subprojects/libvfio-user/lib/libvfio-user.c -+++ b/subprojects/libvfio-user/lib/libvfio-user.c -@@ -47,7 +47,7 @@ - #include - #include - #include -- -+#include - #include - - #include "dma.h" -@@ -183,17 +183,19 @@ debug_region_access(vfu_ctx_t *vfu_ctx, size_t region, char *buf, - case 2: val = *((uint16_t *)buf); break; - case 1: val = *((uint8_t *)buf); break; - default: -- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s %zu bytes at %#lx", -- region, verb, count, offset); -+ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s %zu bytes at %#llx", -+ region, verb, count, (unsigned long long)offset); - return; - } - - if (is_write) { -- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: wrote %#zx to (%#lx:%zu)", -- region, val, offset, count); -+ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: wrote %#llx to (%#llx:%zu)", -+ region, (unsigned long long)val, (unsigned long long)offset, -+ count); - } else { -- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: read %#zx from (%#lx:%zu)", -- region, val, offset, count); -+ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: read %#llx from (%#llx:%zu)", -+ region, (unsigned long long)val, (unsigned long long)offset, -+ count); - } - } - -@@ -235,8 +237,8 @@ region_access(vfu_ctx_t *vfu_ctx, size_t region, char *buf, - - out: - if (ret != (ssize_t)count) { -- vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s (%#lx:%zu) failed: %m", -- region, verb, offset, count); -+ vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s (%#llx:%zu) failed: %m", -+ region, verb, (unsigned long long)offset, count); - } else { - debug_region_access(vfu_ctx, region, buf, count, offset, is_write); - } -@@ -266,7 +268,7 @@ is_valid_region_access(vfu_ctx_t *vfu_ctx, size_t size, uint16_t cmd, - - if (cmd == VFIO_USER_REGION_WRITE && size - sizeof(*ra) != ra->count) { - vfu_log(vfu_ctx, LOG_ERR, "region write count too small: " -- "expected %lu, got %u", size - sizeof(*ra), ra->count); -+ "expected %zu, got %u", size - sizeof(*ra), ra->count); - return false; - } - -@@ -278,8 +280,10 @@ is_valid_region_access(vfu_ctx_t *vfu_ctx, size_t size, uint16_t cmd, - } - - if (satadd_u64(ra->offset, ra->count) > vfu_ctx->reg_info[index].size) { -- vfu_log(vfu_ctx, LOG_ERR, "out of bounds region access %#lx-%#lx " -- "(size %u)", ra->offset, ra->offset + ra->count, -+ vfu_log(vfu_ctx, LOG_ERR, -+ "out of bounds region access %#llx-%#llx (size %u)", -+ (unsigned long long)ra->offset, -+ (unsigned long long)(ra->offset + ra->count), - vfu_ctx->reg_info[index].size); - - return false; -@@ -337,7 +341,7 @@ handle_region_access(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) - - ret = region_access(vfu_ctx, in_ra->region, buf, in_ra->count, - in_ra->offset, msg->hdr.cmd == VFIO_USER_REGION_WRITE); -- if (ret != in_ra->count) { -+ if (ret != (ssize_t)in_ra->count) { - /* FIXME we should return whatever has been accessed, not an error */ - if (ret >= 0) { - ret = ERROR_INT(EINVAL); -@@ -458,8 +462,10 @@ handle_device_get_region_info(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) - } - - vfu_log(vfu_ctx, LOG_DEBUG, "region_info[%d] offset %#llx flags %#x " -- "size %llu " "argsz %u", out_info->index, out_info->offset, -- out_info->flags, out_info->size, out_info->argsz); -+ "size %llu argsz %u", out_info->index, -+ (unsigned long long)out_info->offset, -+ out_info->flags, (unsigned long long)out_info->size, -+ out_info->argsz); - - return 0; - } -@@ -671,8 +677,10 @@ handle_dma_map(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, - return ERROR_INT(EINVAL); - } - -- snprintf(rstr, sizeof(rstr), "[%#lx, %#lx) offset=%#lx flags=%#x", -- dma_map->addr, dma_map->addr + dma_map->size, dma_map->offset, -+ snprintf(rstr, sizeof(rstr), "[%#llx, %#llx) offset=%#llx flags=%#x", -+ (unsigned long long)dma_map->addr, -+ (unsigned long long)(dma_map->addr + dma_map->size), -+ (unsigned long long)dma_map->offset, - dma_map->flags); - - vfu_log(vfu_ctx, LOG_DEBUG, "adding DMA region %s", rstr); -@@ -700,7 +708,8 @@ handle_dma_map(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, - } - } - -- ret = dma_controller_add_region(vfu_ctx->dma, (void *)dma_map->addr, -+ ret = dma_controller_add_region(vfu_ctx->dma, -+ (vfu_dma_addr_t)(uintptr_t)dma_map->addr, - dma_map->size, fd, dma_map->offset, - prot); - if (ret < 0) { -@@ -747,8 +756,9 @@ is_valid_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, - - case VFIO_DMA_UNMAP_FLAG_ALL: - if (dma_unmap->addr || dma_unmap->size) { -- vfu_log(vfu_ctx, LOG_ERR, "bad addr=%#lx or size=%#lx, expected " -- "both to be zero", dma_unmap->addr, dma_unmap->size); -+ vfu_log(vfu_ctx, LOG_ERR, "bad addr=%#llx or size=%#llx, expected " -+ "both to be zero", (unsigned long long)dma_unmap->addr, -+ (unsigned long long)dma_unmap->size); - errno = EINVAL; - return false; - } -@@ -791,8 +801,10 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, - return -1; - } - -- snprintf(rstr, sizeof(rstr), "[%#lx, %#lx) flags=%#x", -- dma_unmap->addr, dma_unmap->addr + dma_unmap->size, dma_unmap->flags); -+ snprintf(rstr, sizeof(rstr), "[%#llx, %#llx) flags=%#x", -+ (unsigned long long)dma_unmap->addr, -+ (unsigned long long)(dma_unmap->addr + dma_unmap->size), -+ dma_unmap->flags); - - vfu_log(vfu_ctx, LOG_DEBUG, "removing DMA region %s", rstr); - -@@ -817,7 +829,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, - if (dma_unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) { - memcpy(msg->out.iov.iov_base + sizeof(*dma_unmap), dma_unmap->bitmap, sizeof(*dma_unmap->bitmap)); - ret = dma_controller_dirty_page_get(vfu_ctx->dma, -- (vfu_dma_addr_t)dma_unmap->addr, -+ (vfu_dma_addr_t)(uintptr_t)dma_unmap->addr, - dma_unmap->size, - dma_unmap->bitmap->pgsize, - dma_unmap->bitmap->size, -@@ -829,7 +841,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, - } - - ret = dma_controller_remove_region(vfu_ctx->dma, -- (void *)dma_unmap->addr, -+ (vfu_dma_addr_t)(uintptr_t)dma_unmap->addr, - dma_unmap->size, - vfu_ctx->dma_unregister, - vfu_ctx); -@@ -924,7 +936,7 @@ handle_dirty_pages_get(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) - range_out = msg->out.iov.iov_base + sizeof(*dirty_pages_out); - memcpy(range_out, range_in, sizeof(*range_out)); - ret = dma_controller_dirty_page_get(vfu_ctx->dma, -- (vfu_dma_addr_t)range_in->iova, -+ (vfu_dma_addr_t)(uintptr_t)range_in->iova, - range_in->size, - range_in->bitmap.pgsize, - range_in->bitmap.size, bitmap_out); -@@ -939,8 +951,8 @@ handle_dirty_pages_get(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) - } - } else { - vfu_log(vfu_ctx, LOG_ERR, -- "dirty pages: get [%#lx, %#lx): buffer too small (%u < %lu)", -- range_in->iova, range_in->iova + range_in->size, -+ "dirty pages: get [%#llx, %#llx): buffer too small (%u < %zu)", -+ (unsigned long long)range_in->iova, (unsigned long long)range_in->iova + range_in->size, - dirty_pages_in->argsz, argsz); - } - -@@ -1873,6 +1885,10 @@ vfu_setup_region(vfu_ctx_t *vfu_ctx, int region_idx, size_t size, - for (i = 0; i < nr_mmap_areas; i++) { - struct iovec *iov = &mmap_areas[i]; - if ((size_t)iov_end(iov) > size) { -+ vfu_log(vfu_ctx, LOG_ERR, "mmap area #%zu %#llx-%#llx exceeds region size of %#llx\n", -+ i, (unsigned long long)(uintptr_t)iov->iov_base, -+ (unsigned long long)(uintptr_t)(iov->iov_base) + iov->iov_len - 1, -+ (unsigned long long)size); - return ERROR_INT(EINVAL); - } - } -@@ -2124,7 +2140,7 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enum vfio_user_command cmd, - while (remaining > 0) { - int ret; - -- dma_req->addr = (uint64_t)sg->dma_addr + count; -+ dma_req->addr = (uintptr_t)sg->dma_addr + count; - dma_req->count = MIN(remaining, vfu_ctx->client_max_data_xfer_size); - - if (cmd == VFIO_USER_DMA_WRITE) { -@@ -2153,10 +2169,13 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enum vfio_user_command cmd, - - if (dma_reply->addr != dma_req->addr || - dma_reply->count != dma_req->count) { -+ /* TODO shouldn't we use %#llx for both and also use the range format? */ - vfu_log(vfu_ctx, LOG_ERR, "bad reply to DMA transfer: " -- "request:%#lx,%lu reply:%#lx,%lu", -- dma_req->addr, dma_req->count, -- dma_reply->addr, dma_reply->count); -+ "request:%#llx,%llu reply:%#llx,%llu", -+ (unsigned long long)dma_req->addr, -+ (unsigned long long)dma_req->count, -+ (unsigned long long)dma_reply->addr, -+ (unsigned long long)dma_reply->count); - free(rbuf); - return ERROR_INT(EINVAL); - } -diff --git a/subprojects/libvfio-user/lib/migration.c b/subprojects/libvfio-user/lib/migration.c -index 2936768..62ac082 100644 ---- a/subprojects/libvfio-user/lib/migration.c -+++ b/subprojects/libvfio-user/lib/migration.c -@@ -413,7 +413,7 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, - case offsetof(struct vfio_user_migration_info, device_state): - if (count != sizeof(migr->info.device_state)) { - vfu_log(vfu_ctx, LOG_ERR, -- "bad device_state access size %ld", count); -+ "bad device_state access size %zu", count); - return ERROR_INT(EINVAL); - } - device_state = (uint32_t *)buf; -@@ -443,7 +443,7 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, - case offsetof(struct vfio_user_migration_info, pending_bytes): - if (count != sizeof(migr->info.pending_bytes)) { - vfu_log(vfu_ctx, LOG_ERR, -- "bad pending_bytes access size %ld", count); -+ "bad pending_bytes access size %zu", count); - return ERROR_INT(EINVAL); - } - ret = handle_pending_bytes(vfu_ctx, migr, (uint64_t *)buf, is_write); -@@ -451,7 +451,7 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, - case offsetof(struct vfio_user_migration_info, data_offset): - if (count != sizeof(migr->info.data_offset)) { - vfu_log(vfu_ctx, LOG_ERR, -- "bad data_offset access size %ld", count); -+ "bad data_offset access size %zu", count); - return ERROR_INT(EINVAL); - } - ret = handle_data_offset(vfu_ctx, migr, (uint64_t *)buf, is_write); -@@ -459,14 +459,15 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, - case offsetof(struct vfio_user_migration_info, data_size): - if (count != sizeof(migr->info.data_size)) { - vfu_log(vfu_ctx, LOG_ERR, -- "bad data_size access size %ld", count); -+ "bad data_size access size %zu", count); - return ERROR_INT(EINVAL); - } - ret = handle_data_size(vfu_ctx, migr, (uint64_t *)buf, is_write); - break; - default: -- vfu_log(vfu_ctx, LOG_ERR, "bad migration region register offset %#lx", -- pos); -+ vfu_log(vfu_ctx, LOG_ERR, -+ "bad migration region register offset %#llx", -+ (unsigned long long)pos); - return ERROR_INT(EINVAL); - } - return ret; -@@ -502,8 +503,9 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, - * any access to the data region properly. - */ - vfu_log(vfu_ctx, LOG_WARNING, -- "bad access to dead space %#lx-%#lx in migration region", -- pos, pos + count - 1); -+ "bad access to dead space %#llx - %#llx in migration region", -+ (unsigned long long)pos, -+ (unsigned long long)(pos + count - 1)); - return ERROR_INT(EINVAL); - } - -diff --git a/subprojects/libvfio-user/lib/pci.c b/subprojects/libvfio-user/lib/pci.c -index 21db6e4..beacd5c 100644 ---- a/subprojects/libvfio-user/lib/pci.c -+++ b/subprojects/libvfio-user/lib/pci.c -@@ -264,8 +264,8 @@ pci_hdr_write(vfu_ctx_t *vfu_ctx, const char *buf, loff_t offset) - ret = handle_erom_write(vfu_ctx, cfg_space, buf); - break; - default: -- vfu_log(vfu_ctx, LOG_ERR, "PCI config write %#lx not handled", -- offset); -+ vfu_log(vfu_ctx, LOG_ERR, "PCI config write %#llx not handled", -+ (unsigned long long)offset); - ret = ERROR_INT(EINVAL); - } - -@@ -315,7 +315,7 @@ pci_nonstd_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, - - if (is_write) { - vfu_log(vfu_ctx, LOG_ERR, "no callback for write to config space " -- "offset %lu size %zu", offset, count); -+ "offset %#llx size %zu", (unsigned long long)offset, count); - return ERROR_INT(EINVAL); - } - -@@ -429,8 +429,10 @@ pci_config_space_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, - size = pci_config_space_next_segment(vfu_ctx, count, offset, is_write, - &cb); - if (cb == NULL) { -- vfu_log(vfu_ctx, LOG_ERR, "bad write to PCI config space %#lx-%#lx", -- offset, offset + count - 1); -+ vfu_log(vfu_ctx, LOG_ERR, -+ "bad write to PCI config space %#llx-%#llx", -+ (unsigned long long)offset, -+ (unsigned long long)(offset + count - 1)); - return size; - } - -diff --git a/subprojects/libvfio-user/lib/pci_caps.c b/subprojects/libvfio-user/lib/pci_caps.c -index e9dc5ac..50eb29b 100644 ---- a/subprojects/libvfio-user/lib/pci_caps.c -+++ b/subprojects/libvfio-user/lib/pci_caps.c -@@ -483,7 +483,7 @@ cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) - - if (cap->off != 0) { - if (cap->off < PCI_STD_HEADER_SIZEOF) { -- vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#lx for capability " -+ vfu_log(vfu_ctx, LOG_ERR, "invalid offset %zx for capability " - "%u (%s)", cap->off, cap->id, cap->name); - return ERROR_INT(EINVAL); - } -@@ -516,11 +516,11 @@ cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) - - if (cap->off + cap->size > pci_config_space_size(vfu_ctx)) { - vfu_log(vfu_ctx, LOG_ERR, "no config space left for capability " -- "%u (%s) of size %zu bytes at offset %#lx", cap->id, -+ "%u (%s) of size %zu bytes at offset %zx", cap->id, - cap->name, cap->size, cap->off); - return ERROR_INT(ENOSPC); - } -- -+ - memcpy(cap_data(vfu_ctx, cap), data, cap->size); - /* Make sure the previous cap's PCI_CAP_LIST_NEXT points to us. */ - *prevp = cap->off; -@@ -547,7 +547,7 @@ ext_cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) - - if (cap->off != 0) { - if (cap->off < PCI_CFG_SPACE_SIZE) { -- vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#lx for capability " -+ vfu_log(vfu_ctx, LOG_ERR, "invalid offset %zx for capability " - "%u (%s)", cap->off, cap->id, cap->name); - return ERROR_INT(EINVAL); - } -@@ -581,7 +581,7 @@ ext_cap_place(vfu_ctx_t *vfu_ctx, struct pci_cap *cap, void *data) - - if (cap->off + cap->size > pci_config_space_size(vfu_ctx)) { - vfu_log(vfu_ctx, LOG_ERR, "no config space left for capability " -- "%u (%s) of size %zu bytes at offset %#lx", cap->id, -+ "%u (%s) of size %zu bytes at offset %zu", cap->id, - cap->name, cap->size, cap->off); - return ERROR_INT(ENOSPC); - } -@@ -700,7 +700,7 @@ vfu_pci_add_capability(vfu_ctx_t *vfu_ctx, size_t pos, int flags, void *data) - - if (cap.off + cap.size >= pci_config_space_size(vfu_ctx)) { - vfu_log(vfu_ctx, LOG_DEBUG, -- "PCI capability past end of config space, %#lx >= %#lx", -+ "PCI capability past end of config space, %zx >= %zx", - cap.off + cap.size, pci_config_space_size(vfu_ctx)); - return ERROR_INT(EINVAL); - } -diff --git a/subprojects/libvfio-user/lib/private.h b/subprojects/libvfio-user/lib/private.h -index 7ffd6be..7c18c95 100644 ---- a/subprojects/libvfio-user/lib/private.h -+++ b/subprojects/libvfio-user/lib/private.h -@@ -45,7 +45,11 @@ - * is to limit the size of the dirty bitmaps: this corresponds to 256MB at a 4K - * page size. - */ -+#if defined(__x86_64__) || defined(__ppc64__) - #define MAX_DMA_SIZE (8 * ONE_TB) -+#else -+#define MAX_DMA_SIZE UINT32_MAX /* FIXME check for __i386__ etc? */ -+#endif - #define MAX_DMA_REGIONS 16 - - #define SERVER_MAX_DATA_XFER_SIZE (VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE) -diff --git a/subprojects/libvfio-user/lib/tran.c b/subprojects/libvfio-user/lib/tran.c -index ba49fd6..a183877 100644 ---- a/subprojects/libvfio-user/lib/tran.c -+++ b/subprojects/libvfio-user/lib/tran.c -@@ -176,7 +176,7 @@ recv_version(vfu_ctx_t *vfu_ctx, uint16_t *msg_idp, - - if (msg.in.iov.iov_len < sizeof(*cversion)) { - vfu_log(vfu_ctx, LOG_ERR, -- "msg%#hx: VFIO_USER_VERSION: invalid size %lu", -+ "msg%#hx: VFIO_USER_VERSION: invalid size %zu", - *msg_idp, msg.in.iov.iov_len); - ret = EINVAL; - goto out; -diff --git a/subprojects/libvfio-user/lib/tran_pipe.c b/subprojects/libvfio-user/lib/tran_pipe.c -index dea2c3c..d1428ab 100644 ---- a/subprojects/libvfio-user/lib/tran_pipe.c -+++ b/subprojects/libvfio-user/lib/tran_pipe.c -@@ -83,7 +83,7 @@ tran_pipe_send_iovec(int fd, uint16_t msg_id, bool is_reply, - return ERROR_INT(ECONNRESET); - } - return -1; -- } else if (ret < hdr.msg_size) { -+ } else if (ret < (ssize_t)hdr.msg_size) { - return ERROR_INT(ECONNRESET); - } - -diff --git a/subprojects/libvfio-user/samples/client.c b/subprojects/libvfio-user/samples/client.c -index da211b8..e65bb61 100644 ---- a/subprojects/libvfio-user/samples/client.c -+++ b/subprojects/libvfio-user/samples/client.c -@@ -110,7 +110,7 @@ send_version(int sock) - "\"max_msg_fds\":%u," - "\"max_data_xfer_size\":%u," - "\"migration\":{" -- "\"pgsize\":%zu" -+ "\"pgsize\":%ld" - "}" - "}" - "}", CLIENT_MAX_FDS, CLIENT_MAX_DATA_XFER_SIZE, sysconf(_SC_PAGESIZE)); -@@ -155,7 +155,7 @@ recv_version(int sock, int *server_max_fds, size_t *server_max_data_xfer_size, - } - - if (vlen < sizeof(*sversion)) { -- errx(EXIT_FAILURE, "VFIO_USER_VERSION: invalid size %lu", vlen); -+ errx(EXIT_FAILURE, "VFIO_USER_VERSION: invalid size %zu", vlen); - } - - if (sversion->major != LIB_VFIO_USER_MAJOR) { -@@ -229,8 +229,9 @@ get_region_vfio_caps(struct vfio_info_cap_header *header, - (*sparse)->nr_areas); - for (i = 0; i < (*sparse)->nr_areas; i++) { - printf("client: %s: area %d offset %#llx size %llu\n", -- __func__, i, (*sparse)->areas[i].offset, -- (*sparse)->areas[i].size); -+ __func__, i, -+ (unsigned long long)(*sparse)->areas[i].offset, -+ (unsigned long long)(*sparse)->areas[i].size); - } - break; - case VFIO_REGION_INFO_CAP_TYPE: -@@ -290,9 +291,9 @@ mmap_sparse_areas(int *fds, struct vfio_region_info *region_info, - sparse->areas[i].offset); - if (addr == MAP_FAILED) { - err(EXIT_FAILURE, -- "failed to mmap sparse region #%lu in %s (%#llx-%#llx)", -- i, buf, sparse->areas[i].offset, -- sparse->areas[i].offset + sparse->areas[i].size - 1); -+ "failed to mmap sparse region %zu in %s (%#llx-%#llx)", -+ i, buf, (unsigned long long)sparse->areas[i].offset, -+ (unsigned long long)sparse->areas[i].offset + sparse->areas[i].size - 1); - } - - ret = munmap(addr, sparse->areas[i].size); -@@ -310,7 +311,11 @@ get_device_region_info(int sock, uint32_t index) - size_t nr_fds = ARRAY_SIZE(fds); - - -- region_info = alloca(size); -+ region_info = malloc(size); -+ if (region_info == NULL) { -+ err(EXIT_FAILURE, "%m\n"); -+ } -+ - memset(region_info, 0, size); - region_info->argsz = size; - region_info->index = index; -@@ -318,7 +323,10 @@ get_device_region_info(int sock, uint32_t index) - do_get_device_region_info(sock, region_info, NULL, 0); - if (region_info->argsz > size) { - size = region_info->argsz; -- region_info = alloca(size); -+ region_info = malloc(size); -+ if (region_info == NULL) { -+ err(EXIT_FAILURE, "%m\n"); -+ } - memset(region_info, 0, size); - region_info->argsz = size; - region_info->index = index; -@@ -329,9 +337,11 @@ get_device_region_info(int sock, uint32_t index) - } - - cap_sz = region_info->argsz - sizeof(struct vfio_region_info); -- printf("client: %s: region_info[%d] offset %#llx flags %#x size %llu " -- "cap_sz %lu #FDs %lu\n", __func__, index, region_info->offset, -- region_info->flags, region_info->size, cap_sz, nr_fds); -+ printf("client: %s: region_info[%d] offset %#llx flags %#x " -+ "size %llu cap_sz %zu #FDs %zu\n", __func__, index, -+ (unsigned long long)region_info->offset, region_info->flags, -+ (unsigned long long)region_info->size, cap_sz, -+ nr_fds); - if (cap_sz) { - struct vfio_region_info_cap_sparse_mmap *sparse = NULL; - if (get_region_vfio_caps((struct vfio_info_cap_header*)(region_info + 1), -@@ -343,7 +353,9 @@ get_device_region_info(int sock, uint32_t index) - mmap_sparse_areas(fds, region_info, sparse); - } - } -+ - } -+ free(region_info); - } - - static void -@@ -487,14 +499,15 @@ access_region(int sock, int region, bool is_write, uint64_t offset, - recv_data, recv_data_len, NULL, 0); - pthread_mutex_unlock(&mutex); - if (ret != 0) { -- warn("failed to %s region %d %#lx-%#lx", -- is_write ? "write to" : "read from", region, offset, -- offset + data_len - 1); -+ warn("failed to %s region %d %#llx-%#llx", -+ is_write ? "write to" : "read from", region, -+ (unsigned long long)offset, -+ (unsigned long long)(offset + data_len - 1)); - free(recv_data); - return ret; - } - if (recv_data->count != data_len) { -- warnx("bad %s data count, expected=%lu, actual=%d", -+ warnx("bad %s data count, expected=%zu, actual=%d", - is_write ? "write" : "read", data_len, - recv_data->count); - free(recv_data); -@@ -585,8 +598,9 @@ handle_dma_write(int sock, struct vfio_user_dma_map *dma_regions, - c = pwrite(dma_region_fds[i], data, dma_access.count, offset); - - if (c != (ssize_t)dma_access.count) { -- err(EXIT_FAILURE, "failed to write to fd=%d at [%#lx-%#lx)", -- dma_region_fds[i], offset, offset + dma_access.count); -+ err(EXIT_FAILURE, "failed to write to fd=%d at [%#llx-%#llx)", -+ dma_region_fds[i], (unsigned long long)offset, -+ (unsigned long long)(offset + dma_access.count)); - } - break; - } -@@ -640,8 +654,9 @@ handle_dma_read(int sock, struct vfio_user_dma_map *dma_regions, - c = pread(dma_region_fds[i], data, dma_access.count, offset); - - if (c != (ssize_t)dma_access.count) { -- err(EXIT_FAILURE, "failed to read from fd=%d at [%#lx-%#lx)", -- dma_region_fds[i], offset, offset + dma_access.count); -+ err(EXIT_FAILURE, "failed to read from fd=%d at [%#llx-%#llx)", -+ dma_region_fds[i], (unsigned long long)offset, -+ (unsigned long long)offset + dma_access.count); - } - break; - } -@@ -706,8 +721,9 @@ get_dirty_bitmap(int sock, struct vfio_user_dma_map *dma_region) - err(EXIT_FAILURE, "failed to get dirty page bitmap"); - } - -- printf("client: %s: %#lx-%#lx\t%#x\n", __func__, range->iova, -- range->iova + range->size - 1, bitmap[0]); -+ printf("client: %s: %#llx-%#llx\t%#x\n", __func__, -+ (unsigned long long)range->iova, -+ (unsigned long long)(range->iova + range->size - 1), bitmap[0]); - - free(data); - } -@@ -900,7 +916,7 @@ migrate_from(int sock, size_t *nr_iters, struct iovec **migr_iters, - _nr_iters += do_migrate(sock, 1, (*migr_iters) + _nr_iters); - if (_nr_iters != 2) { - errx(EXIT_FAILURE, -- "expected 2 iterations instead of %ld while in stop-and-copy state", -+ "expected 2 iterations instead of %zu while in stop-and-copy state", - _nr_iters); - } - -@@ -1000,8 +1016,9 @@ migrate_to(char *old_sock_path, int *server_max_fds, - * TODO write half of migration data via regular write and other half via - * memopy map. - */ -- printf("client: writing migration device data %#lx-%#lx\n", -- data_offset, data_offset + migr_iters[i].iov_len - 1); -+ printf("client: writing migration device data %#llx-%#llx\n", -+ (unsigned long long)data_offset, -+ (unsigned long long)(data_offset + migr_iters[i].iov_len - 1)); - ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true, - data_offset, migr_iters[i].iov_base, - migr_iters[i].iov_len); -@@ -1162,8 +1179,11 @@ int main(int argc, char *argv[]) - - unlink(template); - -- dma_regions = alloca(sizeof(*dma_regions) * nr_dma_regions); -- dma_region_fds = alloca(sizeof(*dma_region_fds) * nr_dma_regions); -+ dma_regions = calloc(nr_dma_regions, sizeof(*dma_regions)); -+ dma_region_fds = calloc(nr_dma_regions, sizeof(*dma_region_fds)); -+ if (dma_regions == NULL || dma_region_fds == NULL) { -+ err(EXIT_FAILURE, "%m\n"); -+ } - - for (i = 0; i < nr_dma_regions; i++) { - dma_regions[i].argsz = sizeof(struct vfio_user_dma_map); -@@ -1310,6 +1330,9 @@ int main(int argc, char *argv[]) - err(EXIT_FAILURE, "failed to unmap all DMA regions"); - } - -+ free(dma_regions); -+ free(dma_region_fds); -+ - return 0; - } - -diff --git a/subprojects/libvfio-user/samples/server.c b/subprojects/libvfio-user/samples/server.c -index e994ac1..e059d9c 100644 ---- a/subprojects/libvfio-user/samples/server.c -+++ b/subprojects/libvfio-user/samples/server.c -@@ -93,8 +93,9 @@ bar0_access(vfu_ctx_t *vfu_ctx, char * const buf, size_t count, loff_t offset, - struct server_data *server_data = vfu_get_private(vfu_ctx); - - if (count != sizeof(time_t) || offset != 0) { -- vfu_log(vfu_ctx, LOG_ERR, "bad BAR0 access %#lx-%#lx", -- offset, offset + count - 1); -+ vfu_log(vfu_ctx, LOG_ERR, "bad BAR0 access %#llx-%#llx", -+ (unsigned long long)offset, -+ (unsigned long long)offset + count - 1); - errno = EINVAL; - return -1; - } -@@ -123,8 +124,9 @@ bar1_access(vfu_ctx_t *vfu_ctx, char * const buf, - struct server_data *server_data = vfu_get_private(vfu_ctx); - - if (offset + count > server_data->bar1_size) { -- vfu_log(vfu_ctx, LOG_ERR, "bad BAR1 access %#lx-%#lx", -- offset, offset + count - 1); -+ vfu_log(vfu_ctx, LOG_ERR, "bad BAR1 access %#llx-%#llx", -+ (unsigned long long)offset, -+ (unsigned long long)offset + count - 1); - errno = EINVAL; - return -1; - } -@@ -353,8 +355,9 @@ migration_write_data(vfu_ctx_t *vfu_ctx, void *data, - assert(data != NULL); - - if (offset != 0 || size < server_data->bar1_size) { -- vfu_log(vfu_ctx, LOG_DEBUG, "XXX bad migration data write %#lx-%#lx", -- offset, offset + size - 1); -+ vfu_log(vfu_ctx, LOG_DEBUG, "XXX bad migration data write %#llx-%#llx", -+ (unsigned long long)offset, -+ (unsigned long long)offset + size - 1); - errno = EINVAL; - return -1; - } -diff --git a/subprojects/libvfio-user/test/mocks.c b/subprojects/libvfio-user/test/mocks.c -index 619ccf9..2ae14b4 100644 ---- a/subprojects/libvfio-user/test/mocks.c -+++ b/subprojects/libvfio-user/test/mocks.c -@@ -113,7 +113,7 @@ unpatch_all(void) - - int - dma_controller_add_region(dma_controller_t *dma, void *dma_addr, -- size_t size, int fd, off_t offset, -+ uint64_t size, int fd, off_t offset, - uint32_t prot) - { - if (!is_patched("dma_controller_add_region")) { -@@ -122,7 +122,7 @@ dma_controller_add_region(dma_controller_t *dma, void *dma_addr, - } - - check_expected_ptr(dma); -- check_expected(dma_addr); -+ check_expected_ptr(dma_addr); - check_expected(size); - check_expected(fd); - check_expected(offset); -diff --git a/subprojects/libvfio-user/test/py/libvfio_user.py b/subprojects/libvfio-user/test/py/libvfio_user.py -index 0ebf773..a63296c 100644 ---- a/subprojects/libvfio-user/test/py/libvfio_user.py -+++ b/subprojects/libvfio-user/test/py/libvfio_user.py -@@ -43,6 +43,12 @@ - import syslog - import copy - import tempfile -+import sys -+from resource import getpagesize -+from math import log2 -+ -+PAGE_SIZE = getpagesize() -+PAGE_SHIFT = int(log2(PAGE_SIZE)) - - UINT64_MAX = 18446744073709551615 - -@@ -140,8 +146,14 @@ - SERVER_MAX_DATA_XFER_SIZE = VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE - SERVER_MAX_MSG_SIZE = SERVER_MAX_DATA_XFER_SIZE + 16 + 16 - -+ -+def is_32bit(): -+ return (1 << 31) - 1 == sys.maxsize -+ -+ - MAX_DMA_REGIONS = 16 --MAX_DMA_SIZE = (8 * ONE_TB) -+# FIXME get from libvfio-user.h -+MAX_DMA_SIZE = sys.maxsize << 1 if is_32bit() else (8 * ONE_TB) - - # enum vfio_user_command - VFIO_USER_VERSION = 1 -@@ -583,7 +595,7 @@ class vfio_user_migration_info(Structure): - c.c_ulong, c.c_long, c.c_bool) - lib.vfu_setup_region.argtypes = (c.c_void_p, c.c_int, c.c_ulong, - vfu_region_access_cb_t, c.c_int, c.c_void_p, -- c.c_uint32, c.c_int, c.c_ulong) -+ c.c_uint32, c.c_int, c.c_uint64) - vfu_reset_cb_t = c.CFUNCTYPE(c.c_int, c.c_void_p, c.c_int) - lib.vfu_setup_device_reset_cb.argtypes = (c.c_void_p, vfu_reset_cb_t) - lib.vfu_pci_get_config_space.argtypes = (c.c_void_p,) -@@ -769,7 +781,6 @@ def get_pci_ext_cfg_space(ctx): - - def read_pci_cfg_space(ctx, buf, count, offset, extended=False): - space = get_pci_ext_cfg_space(ctx) if extended else get_pci_cfg_space(ctx) -- - for i in range(count): - buf[i] = space[offset+i] - return count -@@ -783,6 +794,8 @@ def write_pci_cfg_space(ctx, buf, count, offset, extended=False): - space = c.cast(lib.vfu_pci_get_config_space(ctx), c.POINTER(c.c_char)) - - for i in range(count): -+ # FIXME this assignment doesn't update the actual config space, it -+ # works fine on x86_64 - space[offset+i] = buf[i] - return count - -@@ -897,11 +910,13 @@ def prepare_ctx_for_dma(dma_register=__dma_register, - assert ret == 0 - - f = tempfile.TemporaryFile() -- f.truncate(0x2000) -+ migr_region_size = 2 << PAGE_SHIFT -+ f.truncate(migr_region_size) - -- mmap_areas = [(0x1000, 0x1000)] -+ mmap_areas = [(PAGE_SIZE, PAGE_SIZE)] - -- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, -+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, -+ size=migr_region_size, - flags=VFU_REGION_FLAG_RW, mmap_areas=mmap_areas, - fd=f.fileno()) - assert ret == 0 -@@ -1146,7 +1161,7 @@ def __migr_data_written_cb(ctx, count): - return migr_data_written_cb(ctx, count) - - --def vfu_setup_device_migration_callbacks(ctx, cbs=None, offset=0x4000): -+def vfu_setup_device_migration_callbacks(ctx, cbs=None, offset=PAGE_SIZE): - assert ctx is not None - - if not cbs: -diff --git a/subprojects/libvfio-user/test/py/test_device_get_region_info.py b/subprojects/libvfio-user/test/py/test_device_get_region_info.py -index c439eaa..3260193 100644 ---- a/subprojects/libvfio-user/test/py/test_device_get_region_info.py -+++ b/subprojects/libvfio-user/test/py/test_device_get_region_info.py -@@ -35,6 +35,8 @@ - sock = None - - argsz = len(vfio_region_info()) -+migr_region_size = 2 << PAGE_SHIFT -+migr_mmap_areas = [(PAGE_SIZE, PAGE_SIZE)] - - - def test_device_get_region_info_setup(): -@@ -77,13 +79,11 @@ def test_device_get_region_info_setup(): - assert ret == 0 - - f = tempfile.TemporaryFile() -- f.truncate(0x2000) -+ f.truncate(migr_region_size) - -- mmap_areas = [(0x1000, 0x1000)] -- -- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, -- flags=VFU_REGION_FLAG_RW, mmap_areas=mmap_areas, -- fd=f.fileno()) -+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, -+ size=migr_region_size, flags=VFU_REGION_FLAG_RW, -+ mmap_areas=migr_mmap_areas, fd=f.fileno()) - assert ret == 0 - - ret = vfu_realize_ctx(ctx) -@@ -246,10 +246,10 @@ def test_device_get_region_info_migr(): - assert cap.id == VFIO_REGION_INFO_CAP_SPARSE_MMAP - assert cap.version == 1 - assert cap.next == 0 -- assert cap.nr_areas == 1 -+ assert cap.nr_areas == len(migr_mmap_areas) == 1 - -- assert area.offset == 0x1000 -- assert area.size == 0x1000 -+ assert area.offset == migr_mmap_areas[0][0] -+ assert area.size == migr_mmap_areas[0][1] - - # skip reading the SCM_RIGHTS - disconnect_client(ctx, sock) -diff --git a/subprojects/libvfio-user/test/py/test_dirty_pages.py b/subprojects/libvfio-user/test/py/test_dirty_pages.py -index 8b4e3dc..687a6ce 100644 ---- a/subprojects/libvfio-user/test/py/test_dirty_pages.py -+++ b/subprojects/libvfio-user/test/py/test_dirty_pages.py -@@ -70,13 +70,13 @@ def test_dirty_pages_setup(): - assert ret == 0 - - f = tempfile.TemporaryFile() -- f.truncate(0x2000) -+ f.truncate(2 << PAGE_SHIFT) - -- mmap_areas = [(0x1000, 0x1000)] -+ mmap_areas = [(PAGE_SIZE, PAGE_SIZE)] - -- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, -- flags=VFU_REGION_FLAG_RW, mmap_areas=mmap_areas, -- fd=f.fileno()) -+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, -+ size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW, -+ mmap_areas=mmap_areas, fd=f.fileno()) - assert ret == 0 - - ret = vfu_realize_ctx(ctx) -@@ -85,17 +85,17 @@ def test_dirty_pages_setup(): - sock = connect_client(ctx) - - f = tempfile.TemporaryFile() -- f.truncate(0x10000) -+ f.truncate(0x10 << PAGE_SHIFT) - - payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x10000, size=0x20000) -+ offset=0, addr=0x10 << PAGE_SHIFT, size=0x20 << PAGE_SHIFT) - - msg(ctx, sock, VFIO_USER_DMA_MAP, payload, fds=[f.fileno()]) - - payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x40000, size=0x10000) -+ offset=0, addr=0x40 << PAGE_SHIFT, size=0x10 << PAGE_SHIFT) - - msg(ctx, sock, VFIO_USER_DMA_MAP, payload) - -@@ -123,13 +123,16 @@ def test_dirty_pages_start_no_migration(): - expect=errno.ENOTSUP) - - -+def test_setup_migr_region(): -+ ret = vfu_setup_device_migration_callbacks(ctx, offset=PAGE_SIZE) -+ assert ret == 0 -+ -+ - def test_dirty_pages_start_bad_flags(): - # - # This is a little cheeky, after vfu_realize_ctx(), but it works at the - # moment. - # -- vfu_setup_device_migration_callbacks(ctx, offset=0x1000) -- - payload = vfio_user_dirty_pages(argsz=len(vfio_user_dirty_pages()), - flags=(VFIO_IOMMU_DIRTY_PAGES_FLAG_START | - VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP)) -@@ -173,8 +176,9 @@ def test_dirty_pages_get_sub_range(): - argsz = len(vfio_user_dirty_pages()) + len(vfio_user_bitmap_range()) + 8 - dirty_pages = vfio_user_dirty_pages(argsz=argsz, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) -- br = vfio_user_bitmap_range(iova=0x11000, size=0x1000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) -+ br = vfio_user_bitmap_range(iova=0x11 << PAGE_SHIFT, size=PAGE_SIZE, -+ bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -186,8 +190,9 @@ def test_dirty_pages_get_bad_page_size(): - argsz = len(vfio_user_dirty_pages()) + len(vfio_user_bitmap_range()) + 8 - dirty_pages = vfio_user_dirty_pages(argsz=argsz, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x2000, size=8) -- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=2 << PAGE_SHIFT, size=8) -+ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -199,8 +204,9 @@ def test_dirty_pages_get_bad_bitmap_size(): - argsz = len(vfio_user_dirty_pages()) + len(vfio_user_bitmap_range()) + 8 - dirty_pages = vfio_user_dirty_pages(argsz=argsz, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, size=1) -- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=1) -+ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -211,9 +217,10 @@ def test_dirty_pages_get_bad_bitmap_size(): - def test_dirty_pages_get_bad_argsz(): - dirty_pages = vfio_user_dirty_pages(argsz=SERVER_MAX_DATA_XFER_SIZE + 8, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, - size=SERVER_MAX_DATA_XFER_SIZE + 8) -- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) -+ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -224,8 +231,9 @@ def test_dirty_pages_get_bad_argsz(): - def test_dirty_pages_get_short_reply(): - dirty_pages = vfio_user_dirty_pages(argsz=len(vfio_user_dirty_pages()), - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) -- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) -+ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -246,8 +254,9 @@ def test_get_dirty_page_bitmap_unmapped(): - - dirty_pages = vfio_user_dirty_pages(argsz=argsz, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) -- br = vfio_user_bitmap_range(iova=0x40000, size=0x10000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) -+ br = vfio_user_bitmap_range(iova=0x40 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -260,8 +269,9 @@ def test_dirty_pages_get_unmodified(): - - dirty_pages = vfio_user_dirty_pages(argsz=argsz, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) -- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) -+ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -276,10 +286,10 @@ def test_dirty_pages_get_unmodified(): - - br, result = vfio_user_bitmap_range.pop_from_buffer(result) - -- assert br.iova == 0x10000 -- assert br.size == 0x10000 -+ assert br.iova == 0x10 << PAGE_SHIFT -+ assert br.size == 0x10 << PAGE_SHIFT - -- assert br.bitmap.pgsize == 0x1000 -+ assert br.bitmap.pgsize == PAGE_SIZE - assert br.bitmap.size == 8 - - -@@ -288,8 +298,9 @@ def get_dirty_page_bitmap(): - - dirty_pages = vfio_user_dirty_pages(argsz=argsz, - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP) -- bitmap = vfio_user_bitmap(pgsize=0x1000, size=8) -- br = vfio_user_bitmap_range(iova=0x10000, size=0x10000, bitmap=bitmap) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) -+ br = vfio_user_bitmap_range(iova=0x10 << PAGE_SHIFT, -+ size=0x10 << PAGE_SHIFT, bitmap=bitmap) - - payload = bytes(dirty_pages) + bytes(br) - -@@ -307,9 +318,10 @@ def get_dirty_page_bitmap(): - iovec3 = None - - --def write_to_addr(ctx, addr, size, get_bitmap=True): -+def write_to_page(ctx, page, nr_pages, get_bitmap=True): - """Simulate a write to the given address and size.""" -- ret, sg = vfu_addr_to_sgl(ctx, dma_addr=addr, length=size) -+ ret, sg = vfu_addr_to_sgl(ctx, dma_addr=page << PAGE_SHIFT, -+ length=nr_pages << PAGE_SHIFT) - assert ret == 1 - iovec = iovec_t() - ret = vfu_sgl_get(ctx, sg, iovec) -@@ -321,29 +333,32 @@ def write_to_addr(ctx, addr, size, get_bitmap=True): - - - def test_dirty_pages_get_modified(): -- ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10000, length=0x1000) -+ ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10 << PAGE_SHIFT, -+ length=PAGE_SIZE) - assert ret == 1 - iovec1 = iovec_t() - ret = vfu_sgl_get(ctx, sg1, iovec1) - assert ret == 0 - - # read only -- ret, sg2 = vfu_addr_to_sgl(ctx, dma_addr=0x11000, length=0x1000, -- prot=mmap.PROT_READ) -+ ret, sg2 = vfu_addr_to_sgl(ctx, dma_addr=0x11 << PAGE_SHIFT, -+ length=PAGE_SIZE, prot=mmap.PROT_READ) - assert ret == 1 - iovec2 = iovec_t() - ret = vfu_sgl_get(ctx, sg2, iovec2) - assert ret == 0 - - # simple single bitmap entry map -- ret, sg3 = vfu_addr_to_sgl(ctx, dma_addr=0x12000, length=0x1000) -+ ret, sg3 = vfu_addr_to_sgl(ctx, dma_addr=0x12 << PAGE_SHIFT, -+ length=PAGE_SIZE) - assert ret == 1 - iovec3 = iovec_t() - ret = vfu_sgl_get(ctx, sg3, iovec3) - assert ret == 0 - - # write that spans bytes in bitmap -- ret, sg4 = vfu_addr_to_sgl(ctx, dma_addr=0x16000, length=0x4000) -+ ret, sg4 = vfu_addr_to_sgl(ctx, dma_addr=0x16 << PAGE_SHIFT, -+ length=0x4 << PAGE_SHIFT) - assert ret == 1 - iovec4 = iovec_t() - ret = vfu_sgl_get(ctx, sg4, iovec4) -@@ -374,40 +389,40 @@ def test_dirty_pages_get_modified(): - # - - # very first bit -- bitmap = write_to_addr(ctx, 0x10000, 0x1000) -+ bitmap = write_to_page(ctx, 0x10, 1) - assert bitmap == 0b0000000000000001 - - # top bit of first byte -- bitmap = write_to_addr(ctx, 0x17000, 0x1000) -+ bitmap = write_to_page(ctx, 0x17, 1) - assert bitmap == 0b0000000010000000 - - # all bits except top one of first byte -- bitmap = write_to_addr(ctx, 0x10000, 0x7000) -+ bitmap = write_to_page(ctx, 0x10, 7) - assert bitmap == 0b0000000001111111 - - # all bits of first byte -- bitmap = write_to_addr(ctx, 0x10000, 0x8000) -+ bitmap = write_to_page(ctx, 0x10, 8) - assert bitmap == 0b0000000011111111 - - # all bits of first byte plus bottom bit of next -- bitmap = write_to_addr(ctx, 0x10000, 0x9000) -+ bitmap = write_to_page(ctx, 0x10, 9) - assert bitmap == 0b0000000111111111 - - # straddle top/bottom bit -- bitmap = write_to_addr(ctx, 0x17000, 0x2000) -+ bitmap = write_to_page(ctx, 0x17, 2) - assert bitmap == 0b0000000110000000 - - # top bit of second byte -- bitmap = write_to_addr(ctx, 0x1f000, 0x1000) -+ bitmap = write_to_page(ctx, 0x1f, 1) - assert bitmap == 0b1000000000000000 - - # top bit of third byte -- bitmap = write_to_addr(ctx, 0x27000, 0x1000) -+ bitmap = write_to_page(ctx, 0x27, 1) - assert bitmap == 0b100000000000000000000000 - - # bits in third and first byte -- write_to_addr(ctx, 0x26000, 0x1000, get_bitmap=False) -- write_to_addr(ctx, 0x12000, 0x2000, get_bitmap=False) -+ write_to_page(ctx, 0x26, 1, get_bitmap=False) -+ write_to_page(ctx, 0x12, 2, get_bitmap=False) - bitmap = get_dirty_page_bitmap() - assert bitmap == 0b010000000000000000001100 - -@@ -445,7 +460,8 @@ def test_dirty_pages_bitmap_with_quiesce(): - - quiesce_errno = errno.EBUSY - -- ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10000, length=0x1000) -+ ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10 << PAGE_SHIFT, -+ length=PAGE_SIZE) - assert ret == 1 - iovec1 = iovec_t() - ret = vfu_sgl_get(ctx, sg1, iovec1) -diff --git a/subprojects/libvfio-user/test/py/test_dma_map.py b/subprojects/libvfio-user/test/py/test_dma_map.py -index e8ce8f2..12d1f6d 100644 ---- a/subprojects/libvfio-user/test/py/test_dma_map.py -+++ b/subprojects/libvfio-user/test/py/test_dma_map.py -@@ -60,7 +60,7 @@ def test_dma_region_too_big(): - payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | - VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x10000, size=MAX_DMA_SIZE + 4096) -+ offset=0, addr=0x10 << PAGE_SHIFT, size=MAX_DMA_SIZE + PAGE_SIZE) - - msg(ctx, sock, VFIO_USER_DMA_MAP, payload, expect=errno.ENOSPC) - -@@ -72,7 +72,7 @@ def test_dma_region_too_many(): - payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | - VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x1000 * i, size=4096) -+ offset=0, addr=PAGE_SIZE * i, size=PAGE_SIZE) - - if i == MAX_DMA_REGIONS + 1: - expect = errno.EINVAL -@@ -95,7 +95,7 @@ def test_dma_map_busy(mock_dma_register, mock_quiesce): - payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | - VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x10000, size=0x1000) -+ offset=0, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) - - msg(ctx, sock, VFIO_USER_DMA_MAP, payload, rsp=False, - busy=True) -@@ -106,8 +106,9 @@ def test_dma_map_busy(mock_dma_register, mock_quiesce): - assert ret == 0 - - # check that DMA register callback got called -- dma_info = vfu_dma_info_t(iovec_t(iov_base=0x10000, iov_len=0x1000), -- None, iovec_t(None, 0), 0x1000, mmap.PROT_READ | mmap.PROT_WRITE) -+ iov = iovec_t(iov_base=0x10 << PAGE_SHIFT, iov_len=PAGE_SIZE) -+ dma_info = vfu_dma_info_t(iov, None, iovec_t(None, 0), PAGE_SIZE, -+ mmap.PROT_READ | mmap.PROT_WRITE) - mock_dma_register.assert_called_once_with(ctx, dma_info) - - get_reply(sock) -@@ -119,11 +120,11 @@ def test_dma_map_busy(mock_dma_register, mock_quiesce): - mock_dma_register.assert_called_once() - - # check that the DMA region has been added -- count, sgs = vfu_addr_to_sgl(ctx, 0x10000, 0x1000) -+ count, sgs = vfu_addr_to_sgl(ctx, 0x10 << PAGE_SHIFT, PAGE_SIZE) - assert len(sgs) == 1 - sg = sgs[0] -- assert sg.dma_addr == 0x10000 and sg.region == 0 and sg.length == 0x1000 \ -- and sg.offset == 0 and sg.writeable -+ assert sg.dma_addr == 0x10 << PAGE_SHIFT and sg.region == 0 \ -+ and sg.length == PAGE_SIZE and sg.offset == 0 and sg.writeable - - - # FIXME better move this test and the following to test_request_errors -@@ -153,7 +154,7 @@ def side_effect(ctx, info): - argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | - VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x10000, size=0x1000) -+ offset=0, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) - - msg(ctx, sock, VFIO_USER_DMA_MAP, payload, rsp=False) - -@@ -192,7 +193,7 @@ def test_dma_map_busy_reply_fail(mock_dma_register, mock_quiesce, mock_reset): - argsz=len(vfio_user_dma_map()), - flags=(VFIO_USER_F_DMA_REGION_READ | - VFIO_USER_F_DMA_REGION_WRITE), -- offset=0, addr=0x10000, size=0x1000) -+ offset=0, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) - - msg(ctx, sock, VFIO_USER_DMA_MAP, payload, rsp=False, - busy=True) -@@ -209,8 +210,9 @@ def test_dma_map_busy_reply_fail(mock_dma_register, mock_quiesce, mock_reset): - ret = vfu_device_quiesced(ctx, 0) - assert ret == 0 - -- dma_info = vfu_dma_info_t(iovec_t(iov_base=0x10000, iov_len=0x1000), -- None, iovec_t(None, 0), 0x1000, mmap.PROT_READ | mmap.PROT_WRITE) -+ iov = iovec_t(iov_base=0x10 << PAGE_SHIFT, iov_len=PAGE_SIZE) -+ dma_info = vfu_dma_info_t(iov, None, iovec_t(None, 0), PAGE_SIZE, -+ mmap.PROT_READ | mmap.PROT_WRITE) - mock_dma_register.assert_called_once_with(ctx, dma_info) - - # device reset callback should be called (by do_reply) -@@ -224,7 +226,7 @@ def test_dma_map_busy_reply_fail(mock_dma_register, mock_quiesce, mock_reset): - mock_reset.assert_called_once() - - # check that the DMA region was NOT added -- count, sgs = vfu_addr_to_sgl(ctx, 0x10000, 0x1000) -+ count, sgs = vfu_addr_to_sgl(ctx, 0x10 << PAGE_SHIFT, PAGE_SIZE) - assert count == -1 - assert c.get_errno() == errno.ENOENT - -diff --git a/subprojects/libvfio-user/test/py/test_dma_unmap.py b/subprojects/libvfio-user/test/py/test_dma_unmap.py -index 7f207ea..063dedc 100644 ---- a/subprojects/libvfio-user/test/py/test_dma_unmap.py -+++ b/subprojects/libvfio-user/test/py/test_dma_unmap.py -@@ -53,7 +53,7 @@ def teardown_function(function): - vfu_destroy_ctx(ctx) - - --def setup_dma_regions(dma_regions=[(0x0, 0x1000)]): -+def setup_dma_regions(dma_regions=[(0x0, PAGE_SIZE)]): - global ctx, sock - for dma_region in dma_regions: - payload = struct.pack("II", 0, 0) -@@ -72,7 +72,8 @@ def test_dma_unmap_short_write(): - - def test_dma_unmap_bad_argsz(): - -- payload = vfio_user_dma_unmap(argsz=8, flags=0, addr=0x1000, size=4096) -+ payload = vfio_user_dma_unmap(argsz=8, flags=0, addr=PAGE_SIZE, -+ size=PAGE_SIZE) - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, - expect=errno.EINVAL) - -@@ -80,7 +81,7 @@ def test_dma_unmap_bad_argsz(): - def test_dma_unmap_bad_argsz2(): - - payload = vfio_user_dma_unmap(argsz=SERVER_MAX_DATA_XFER_SIZE + 8, flags=0, -- addr=0x1000, size=4096) -+ addr=PAGE_SIZE, size=PAGE_SIZE) - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, - expect=errno.EINVAL) - -@@ -89,8 +90,9 @@ def test_dma_unmap_dirty_bad_argsz(): - - argsz = len(vfio_user_dma_unmap()) + len(vfio_user_bitmap()) - unmap = vfio_user_dma_unmap(argsz=argsz, -- flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=0x1000, size=4096) -- bitmap = vfio_user_bitmap(pgsize=4096, size=(UINT64_MAX - argsz) + 8) -+ flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=PAGE_SIZE, -+ size=PAGE_SIZE) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=(UINT64_MAX - argsz) + 8) - payload = bytes(unmap) + bytes(bitmap) - - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, -@@ -99,11 +101,12 @@ def test_dma_unmap_dirty_bad_argsz(): - - def test_dma_unmap_dirty_not_tracking(): - -- setup_dma_regions([(0x1000, 4096)]) -+ setup_dma_regions([(PAGE_SIZE, PAGE_SIZE)]) - argsz = len(vfio_user_dma_unmap()) + len(vfio_user_bitmap()) + 8 - unmap = vfio_user_dma_unmap(argsz=argsz, -- flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=0x1000, size=4096) -- bitmap = vfio_user_bitmap(pgsize=4096, size=8) -+ flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=PAGE_SIZE, -+ size=PAGE_SIZE) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) - payload = bytes(unmap) + bytes(bitmap) + bytes(8) - - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, -@@ -112,8 +115,8 @@ def test_dma_unmap_dirty_not_tracking(): - - def test_dma_unmap_dirty_not_mapped(): - -- setup_dma_regions([(0x1000, 4096)]) -- vfu_setup_device_migration_callbacks(ctx, offset=0x1000) -+ setup_dma_regions([(PAGE_SIZE, PAGE_SIZE)]) -+ vfu_setup_device_migration_callbacks(ctx, offset=PAGE_SIZE) - payload = vfio_user_dirty_pages(argsz=len(vfio_user_dirty_pages()), - flags=VFIO_IOMMU_DIRTY_PAGES_FLAG_START) - -@@ -121,8 +124,9 @@ def test_dma_unmap_dirty_not_mapped(): - - argsz = len(vfio_user_dma_unmap()) + len(vfio_user_bitmap()) + 8 - unmap = vfio_user_dma_unmap(argsz=argsz, -- flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=0x1000, size=4096) -- bitmap = vfio_user_bitmap(pgsize=4096, size=8) -+ flags=VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP, addr=PAGE_SIZE, -+ size=PAGE_SIZE) -+ bitmap = vfio_user_bitmap(pgsize=PAGE_SIZE, size=8) - payload = bytes(unmap) + bytes(bitmap) + bytes(8) - - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, -@@ -133,7 +137,7 @@ def test_dma_unmap_invalid_flags(): - - setup_dma_regions() - payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), -- flags=0x4, addr=0x1000, size=4096) -+ flags=0x4, addr=PAGE_SIZE, size=PAGE_SIZE) - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, - expect=errno.EINVAL) - -@@ -142,7 +146,7 @@ def test_dma_unmap(): - - setup_dma_regions() - payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), -- flags=0, addr=0x0, size=0x1000) -+ flags=0, addr=0x0, size=PAGE_SIZE) - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload) - - -@@ -150,7 +154,7 @@ def test_dma_unmap_invalid_addr(): - - setup_dma_regions() - payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), -- addr=0x10000, size=4096) -+ addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) - - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, - expect=errno.ENOENT) -@@ -162,7 +166,7 @@ def test_dma_unmap_async(mock_quiesce): - setup_dma_regions() - mock_quiesce.side_effect = fail_with_errno(errno.EBUSY) - payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), -- flags=0, addr=0x0, size=0x1000) -+ flags=0, addr=0x0, size=PAGE_SIZE) - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, rsp=False, - busy=True) - -@@ -177,7 +181,8 @@ def test_dma_unmap_async(mock_quiesce): - - def test_dma_unmap_all(): - -- setup_dma_regions((0x1000*i, 0x1000) for i in range(MAX_DMA_REGIONS)) -+ dma_regions = [(PAGE_SIZE * i, PAGE_SIZE) for i in range(MAX_DMA_REGIONS)] -+ setup_dma_regions(dma_regions) - payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), - flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0, size=0) - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload) -@@ -186,7 +191,7 @@ def test_dma_unmap_all(): - def test_dma_unmap_all_invalid_addr(): - - payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()), -- flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0x10000, size=4096) -+ flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0x10 << PAGE_SHIFT, size=PAGE_SIZE) - - msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, - expect=errno.EINVAL) -diff --git a/subprojects/libvfio-user/test/py/test_migration.py b/subprojects/libvfio-user/test/py/test_migration.py -index c5da94f..614a615 100644 ---- a/subprojects/libvfio-user/test/py/test_migration.py -+++ b/subprojects/libvfio-user/test/py/test_migration.py -@@ -42,8 +42,8 @@ def setup_function(function): - ctx = vfu_create_ctx(flags=LIBVFIO_USER_FLAG_ATTACH_NB) - assert ctx is not None - -- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, -- flags=VFU_REGION_FLAG_RW) -+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, -+ size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW) - assert ret == 0 - - ret = vfu_setup_device_migration_callbacks(ctx) -diff --git a/subprojects/libvfio-user/test/py/test_pci_caps.py b/subprojects/libvfio-user/test/py/test_pci_caps.py -index b83c06c..5875d22 100644 ---- a/subprojects/libvfio-user/test/py/test_pci_caps.py -+++ b/subprojects/libvfio-user/test/py/test_pci_caps.py -@@ -157,7 +157,11 @@ def test_add_caps(mock_pci_region_cb): - - __test_pci_cap_write_hdr(sock) - __test_pci_cap_readonly(sock) -- __test_pci_cap_callback(sock) -+ # FIXME assignment to PCI config space from callback is ignored -+ # Ideally we should ignore this test via pytest command line but this isn't -+ # and individual test, and making it one requires a bit of effort. -+ if not is_32bit(): -+ __test_pci_cap_callback(sock) - __test_pci_cap_write_pmcs(sock) - - -@@ -246,7 +250,6 @@ def __test_pci_cap_callback(sock): - # offsetof(struct vsc, data) - offset = cap_offsets[2] + 3 - data = b"Hello world." -- - payload = read_region(ctx, sock, VFU_PCI_DEV_CFG_REGION_IDX, offset=offset, - count=len(data)) - assert payload == data -diff --git a/subprojects/libvfio-user/test/py/test_pci_ext_caps.py b/subprojects/libvfio-user/test/py/test_pci_ext_caps.py -index 8fcadf6..c425c8b 100644 ---- a/subprojects/libvfio-user/test/py/test_pci_ext_caps.py -+++ b/subprojects/libvfio-user/test/py/test_pci_ext_caps.py -@@ -258,6 +258,10 @@ def test_pci_ext_cap_readonly(): - - - def test_pci_ext_cap_callback(): -+ -+ # FIXME assignment to PCI config space from callback is ignored -+ if is_32bit(): -+ return - sock = connect_client(ctx) - - # start of vendor payload -@@ -297,6 +301,11 @@ def test_pci_ext_cap_write_dsn(): - - - def test_pci_ext_cap_write_vendor(): -+ -+ # FIXME assignment to PCI config space from callback is ignored -+ if is_32bit(): -+ return -+ - sock = connect_client(ctx) - - data = struct.pack("II", 0x1, 0x2) -diff --git a/subprojects/libvfio-user/test/py/test_request_errors.py b/subprojects/libvfio-user/test/py/test_request_errors.py -index 2615352..79af0f2 100644 ---- a/subprojects/libvfio-user/test/py/test_request_errors.py -+++ b/subprojects/libvfio-user/test/py/test_request_errors.py -@@ -54,11 +54,11 @@ def setup_function(function): - ret = vfu_setup_device_reset_cb(ctx) - assert ret == 0 - -- ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, size=0x2000, -- flags=VFU_REGION_FLAG_RW) -+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, -+ size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW) - assert ret == 0 - -- ret = vfu_setup_device_migration_callbacks(ctx, offset=0x4000) -+ ret = vfu_setup_device_migration_callbacks(ctx) - assert ret == 0 - - ret = vfu_realize_ctx(ctx) -diff --git a/subprojects/libvfio-user/test/unit-tests.c b/subprojects/libvfio-user/test/unit-tests.c -index cdb88a2..26ad304 100644 ---- a/subprojects/libvfio-user/test/unit-tests.c -+++ b/subprojects/libvfio-user/test/unit-tests.c -@@ -161,8 +161,8 @@ static int - check_dma_info(const LargestIntegralType value, - const LargestIntegralType cvalue) - { -- vfu_dma_info_t *info = (vfu_dma_info_t *)value; -- vfu_dma_info_t *cinfo = (vfu_dma_info_t *)cvalue; -+ vfu_dma_info_t *info = (vfu_dma_info_t *)(long)value; -+ vfu_dma_info_t *cinfo = (vfu_dma_info_t *)(long)cvalue; - - return info->iova.iov_base == cinfo->iova.iov_base && - info->iova.iov_len == cinfo->iova.iov_len && -@@ -188,7 +188,7 @@ test_dma_map_return_value(void **state UNUSED) - }; - - patch("dma_controller_add_region"); -- expect_value(dma_controller_add_region, dma, vfu_ctx.dma); -+ expect_value(dma_controller_add_region, dma, (uintptr_t)vfu_ctx.dma); - expect_value(dma_controller_add_region, dma_addr, dma_map.addr); - expect_value(dma_controller_add_region, size, dma_map.size); - expect_value(dma_controller_add_region, fd, -1); -@@ -264,7 +264,7 @@ test_dma_controller_add_region_no_fd(void **state UNUSED) - assert_int_equal(0, r->info.mapping.iov_len); - assert_ptr_equal(dma_addr, r->info.iova.iov_base); - assert_int_equal(size, r->info.iova.iov_len); -- assert_int_equal(0x1000, r->info.page_size); -+ assert_int_equal(sysconf(_SC_PAGE_SIZE), r->info.page_size); - assert_int_equal(offset, r->offset); - assert_int_equal(fd, r->fd); - assert_int_equal(PROT_NONE, r->info.prot); -@@ -330,7 +330,7 @@ test_dma_addr_to_sgl(void **state UNUSED) - assert_int_equal(1, ret); - assert_int_equal(r->info.iova.iov_base, sg[0].dma_addr); - assert_int_equal(0, sg[0].region); -- assert_int_equal(0x2000 - (unsigned long long)r->info.iova.iov_base, -+ assert_int_equal(0x2000 - (long)r->info.iova.iov_base, - sg[0].offset); - assert_int_equal(0x400, sg[0].length); - assert_true(vfu_sg_is_mappable(&vfu_ctx, &sg[0])); --- -2.37.3 - diff --git a/qemu.spec b/qemu.spec index c1c8f80..218aee5 100644 --- a/qemu.spec +++ b/qemu.spec @@ -360,10 +360,6 @@ Patch: 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch # Fix one of the tests. Sent upstream 2023-02-27. Patch: 0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch -# vfio-user fixes for i386 and ppc64le -Patch: 0001-fix-compilation-on-i386-and-ppc64.patch - - BuildRequires: meson >= %{meson_version} BuildRequires: zlib-devel BuildRequires: glib2-devel @@ -522,10 +518,6 @@ BuildRequires: pcre-static %endif %endif -# vfio-user-server -BuildRequires: pkgconfig(json-c) -BuildRequires: pkgconfig(cmocka) - # Requires for the Fedora 'qemu' metapackage Requires: %{name}-user = %{epoch}:%{version}-%{release} @@ -1767,7 +1759,6 @@ run_configure \ %endif --enable-usb-redir \ --enable-vdi \ - --enable-vfio-user-server \ --enable-vhost-crypto \ %if %{have_virgl} --enable-virglrenderer \ @@ -2246,8 +2237,6 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ # Fedora specific %{_datadir}/applications/qemu.desktop %exclude %{_datadir}/%{name}/qemu-nsis.bmp -%{_libdir}/libvfio-user.so* -%exclude %{_includedir}/vfio-user/ %{_libexecdir}/virtfs-proxy-helper %{_mandir}/man1/virtfs-proxy-helper.1* From 27bca4038cb9c76aea625a94851ae18f77f64193 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Wed, 19 Apr 2023 11:12:17 -0300 Subject: [PATCH 31/54] qemu-7.2.1-1 - Update to QEMU upstream release 7.2.1 --- ...-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch | 45 ------------------- qemu.spec | 9 ++-- sources | 2 +- 3 files changed, 6 insertions(+), 50 deletions(-) delete mode 100644 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch diff --git a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch b/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch deleted file mode 100644 index 419a284..0000000 --- a/0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch +++ /dev/null @@ -1,45 +0,0 @@ -From db788c896eb1378ebc1f20dcc4954616a7631919 Mon Sep 17 00:00:00 2001 -From: Stefan Hajnoczi -Date: Tue, 7 Feb 2023 15:37:16 -0500 -Subject: [PATCH 5/7] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF - -When a write request is converted into a write zeroes request by the -detect-zeroes= feature, it is no longer associated with an I/O buffer. -The BDRV_REQ_REGISTERED_BUF flag doesn't make sense without an I/O -buffer and must be cleared because bdrv_co_do_pwrite_zeroes() fails with --EINVAL when it's set. - -Fiona Ebner bisected and diagnosed this QEMU 7.2 -regression where writes containing zeroes to a blockdev with -discard=unmap,detect-zeroes=unmap fail. - -Buglink: https://gitlab.com/qemu-project/qemu/-/issues/1404 -Fixes: e8b6535533be ("block: add BDRV_REQ_REGISTERED_BUF request flag") -Tested-by: Fiona Ebner -Cc: qemu-stable@nongnu.org -Reviewed-by: Eric Blake -Reviewed-by: Hanna Czenczek -Signed-off-by: Stefan Hajnoczi -Message-Id: <20230207203719.242926-2-stefanha@redhat.com> -(cherry picked from commit 3c5867156eb81c7c71611d078b2c5c2c863f884a) ---- - block/io.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/block/io.c b/block/io.c -index b9424024f9..bbaa0d1b2d 100644 ---- a/block/io.c -+++ b/block/io.c -@@ -2087,6 +2087,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, - if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) { - flags |= BDRV_REQ_MAY_UNMAP; - } -+ -+ /* Can't use optimization hint with bufferless zero write */ -+ flags &= ~BDRV_REQ_REGISTERED_BUF; - } - - if (ret < 0) { --- -2.37.3 - diff --git a/qemu.spec b/qemu.spec index 218aee5..ee9747e 100644 --- a/qemu.spec +++ b/qemu.spec @@ -321,11 +321,11 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 7 +%global baserelease 1 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 7.2.0 +Version: 7.2.1 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: GPLv2 and BSD and MIT and CC-BY @@ -350,8 +350,6 @@ Patch: 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch # Fix compat with kernel-headers >= 6.1 Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch -# Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) -Patch: 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch # Fix build with glib2 2.75.3 # https://bugzilla.redhat.com/show_bug.cgi?id=2173639 # https://gitlab.com/qemu-project/qemu/-/issues/1518 @@ -2788,6 +2786,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Wed Apr 19 2023 Eduardo Lima (Etrunko) - 7.2.1-1 +- Rebase to qemu 7.2.1 + * Mon Feb 27 2023 Richard W.M. Jones - 7.2.0-7 - Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357) - Fix build with glib2 2.75.3 (RHBZ#2173639) diff --git a/sources b/sources index c45f059..c94b8cd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-7.2.0.tar.xz) = f3cfa00da739ba819a218d7e6e95c77fb79a8e0f487b024ddd281602e785249b81144595e3f8c746c32a4f5c4d1a88c6aebae3c162603edfbb50ae3722d7ed13 +SHA512 (qemu-7.2.1.tar.xz) = e286dc66c923a5df77eb02d69235d048e80a7cced638fae52fbed385b4c3cd736cfea66bb3c9843bebf0a33e81ea141fc015e0bd82108df304f148ce59d9ae8a From 493beb6043c8a12fdf6432ede2ad2d3199f0d672 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Thu, 20 Apr 2023 17:01:59 -0300 Subject: [PATCH 32/54] qemu-8.0.0-1 Update to latest QEMU upstream release, 8.0.0 --- ...i_expander_bridge-fix-type-in-pxb_cx.patch | 43 +++ ...ke-PCIe-and-CXL-PXB-Devices-inherit-.patch | 325 ++++++++++++++++++ ...sts-Disable-pci_virtio_vga-for-ppc64.patch | 32 -- ...er-add-more-compat-ioctl-definitions.patch | 67 ---- ...r-fix-compat-with-glibc-2.36-sys-mou.patch | 76 ---- ...te-fix-bad-GTree-usage-use-after-fre.patch | 43 --- ...-version-is-printed-before-other-mes.patch | 42 --- qemu.spec | 45 +-- sources | 2 +- 9 files changed, 385 insertions(+), 290 deletions(-) create mode 100644 0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch create mode 100644 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch delete mode 100644 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch delete mode 100644 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch delete mode 100644 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch delete mode 100644 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch delete mode 100644 0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch diff --git a/0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch b/0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch new file mode 100644 index 0000000..7b31654 --- /dev/null +++ b/0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch @@ -0,0 +1,43 @@ +From 692764e5310a7d1f5f819cbb2c4fb70405b4b119 Mon Sep 17 00:00:00 2001 +From: Jonathan Cameron via +Date: Thu, 20 Apr 2023 15:27:49 +0100 +Subject: [PATCH 1/2] hw/pci-bridge: pci_expander_bridge fix type in + pxb_cxl_dev_reset() + +Reproduce issue with + +configure --enable-qom-cast-debug ... + +qemu-system-x86_64 -display none -machine q35,cxl=on -device pxb-cxl,bus=pcie.0 + + hw/pci-bridge/pci_expander_bridge.c:54:PXB_DEV: Object 0x5570e0b1ada0 is not an instance of type pxb + Aborted + +The type conversion results in the right state structure, but PXB_DEV is +not a parent of PXB_CXL_DEV hence the error. Rather than directly +cleaning up the inheritance, this is the minimal fix which will be +followed by the cleanup. + +Fixes: 154070eaf6 ("hw/pxb-cxl: Support passthrough HDM Decoders unless overridden") +Reported-by: Peter Maydell +Signed-off-by: Jonathan Cameron +--- + hw/pci-bridge/pci_expander_bridge.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c +index ead33f0c05..a78327b5f2 100644 +--- a/hw/pci-bridge/pci_expander_bridge.c ++++ b/hw/pci-bridge/pci_expander_bridge.c +@@ -311,7 +311,7 @@ static void pxb_cxl_dev_reset(DeviceState *dev) + * The CXL specification allows for host bridges with no HDM decoders + * if they only have a single root port. + */ +- if (!PXB_DEV(dev)->hdm_for_passthrough) { ++ if (!PXB_CXL_DEV(dev)->hdm_for_passthrough) { + dsp_count = pcie_count_ds_ports(hb->bus); + } + /* Initial reset will have 0 dsp so wait until > 0 */ +-- +2.40.0 + diff --git a/0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch b/0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch new file mode 100644 index 0000000..514bc75 --- /dev/null +++ b/0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch @@ -0,0 +1,325 @@ +From 736ef0dcc04348bd478cc69d772a6b44fe660831 Mon Sep 17 00:00:00 2001 +From: Jonathan Cameron via +Date: Thu, 20 Apr 2023 15:27:50 +0100 +Subject: [PATCH 2/2] hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from + TYPE_PXB_DEV + +Previously, PXB_CXL_DEVICE, PXB_PCIE_DEVICE and PXB_DEVICE all +have PCI_DEVICE as their direct parent but share a common state +struct PXBDev. convert_to_pxb() is used to get the PXBDev +instance from which ever of these types it is called on. + +This patch switches to an explicit heirarchy based on shared +functionality. To allow use of OBJECT_DECLARE_SIMPLE_TYPE() +whilst minimizing code changes, all types are renamed to have +the postfix _DEV rather than _DEVICE. The new heirarchy +has PXB_CXL_DEV with parent PXB_PCIE_DEV which in turn +has parent PXB_DEV which continues to have parent PCI_DEVICE. + +This allows simple use of PXB_DEV() etc rather than a custom function ++ removal of duplicated properties and moving the CXL specific +elements out of struct PXBDev. + +Signed-off-by: Jonathan Cameron +--- + hw/acpi/cxl.c | 11 +++--- + hw/cxl/cxl-host.c | 4 +- + hw/pci-bridge/pci_expander_bridge.c | 59 ++++++++++------------------- + include/hw/cxl/cxl.h | 4 +- + include/hw/pci/pci_bridge.h | 28 ++++++++++---- + 5 files changed, 49 insertions(+), 57 deletions(-) + +diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c +index 2bf8c07993..92b46bc932 100644 +--- a/hw/acpi/cxl.c ++++ b/hw/acpi/cxl.c +@@ -30,9 +30,10 @@ + #include "qapi/error.h" + #include "qemu/uuid.h" + +-static void cedt_build_chbs(GArray *table_data, PXBDev *cxl) ++static void cedt_build_chbs(GArray *table_data, PXBCXLDev *cxl) + { +- SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl.cxl_host_bridge); ++ PXBDev *pxb = PXB_DEV(cxl); ++ SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl_host_bridge); + struct MemoryRegion *mr = sbd->mmio[0].memory; + + /* Type */ +@@ -45,7 +46,7 @@ static void cedt_build_chbs(GArray *table_data, PXBDev *cxl) + build_append_int_noprefix(table_data, 32, 2); + + /* UID - currently equal to bus number */ +- build_append_int_noprefix(table_data, cxl->bus_nr, 4); ++ build_append_int_noprefix(table_data, pxb->bus_nr, 4); + + /* Version */ + build_append_int_noprefix(table_data, 1, 4); +@@ -112,7 +113,7 @@ static void cedt_build_cfmws(GArray *table_data, CXLState *cxls) + /* Host Bridge List (list of UIDs - currently bus_nr) */ + for (i = 0; i < fw->num_targets; i++) { + g_assert(fw->target_hbs[i]); +- build_append_int_noprefix(table_data, fw->target_hbs[i]->bus_nr, 4); ++ build_append_int_noprefix(table_data, PXB_DEV(fw->target_hbs[i])->bus_nr, 4); + } + } + } +@@ -121,7 +122,7 @@ static int cxl_foreach_pxb_hb(Object *obj, void *opaque) + { + Aml *cedt = opaque; + +- if (object_dynamic_cast(obj, TYPE_PXB_CXL_DEVICE)) { ++ if (object_dynamic_cast(obj, TYPE_PXB_CXL_DEV)) { + cedt_build_chbs(cedt->buf, PXB_CXL_DEV(obj)); + } + +diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c +index 6e923ceeaf..034c7805b3 100644 +--- a/hw/cxl/cxl-host.c ++++ b/hw/cxl/cxl-host.c +@@ -84,7 +84,7 @@ void cxl_fmws_link_targets(CXLState *cxl_state, Error **errp) + bool ambig; + + o = object_resolve_path_type(fw->targets[i], +- TYPE_PXB_CXL_DEVICE, ++ TYPE_PXB_CXL_DEV, + &ambig); + if (!o) { + error_setg(errp, "Could not resolve CXLFM target %s", +@@ -141,7 +141,7 @@ static PCIDevice *cxl_cfmws_find_device(CXLFixedWindow *fw, hwaddr addr) + addr += fw->base; + + rb_index = (addr / cxl_decode_ig(fw->enc_int_gran)) % fw->num_targets; +- hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl.cxl_host_bridge); ++ hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl_host_bridge); + if (!hb || !hb->bus || !pci_bus_is_cxl(hb->bus)) { + return NULL; + } +diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c +index a78327b5f2..613857b601 100644 +--- a/hw/pci-bridge/pci_expander_bridge.c ++++ b/hw/pci-bridge/pci_expander_bridge.c +@@ -50,24 +50,8 @@ struct PXBBus { + char bus_path[8]; + }; + +-#define TYPE_PXB_DEVICE "pxb" +-DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV, +- TYPE_PXB_DEVICE) +- +-#define TYPE_PXB_PCIE_DEVICE "pxb-pcie" +-DECLARE_INSTANCE_CHECKER(PXBDev, PXB_PCIE_DEV, +- TYPE_PXB_PCIE_DEVICE) +- +-static PXBDev *convert_to_pxb(PCIDevice *dev) +-{ +- /* A CXL PXB's parent bus is PCIe, so the normal check won't work */ +- if (object_dynamic_cast(OBJECT(dev), TYPE_PXB_CXL_DEVICE)) { +- return PXB_CXL_DEV(dev); +- } +- +- return pci_bus_is_express(pci_get_bus(dev)) +- ? PXB_PCIE_DEV(dev) : PXB_DEV(dev); +-} ++#define TYPE_PXB_PCIE_DEV "pxb-pcie" ++OBJECT_DECLARE_SIMPLE_TYPE(PXBPCIEDev, PXB_PCIE_DEV) + + static GList *pxb_dev_list; + +@@ -89,14 +73,14 @@ bool cxl_get_hb_passthrough(PCIHostState *hb) + + static int pxb_bus_num(PCIBus *bus) + { +- PXBDev *pxb = convert_to_pxb(bus->parent_dev); ++ PXBDev *pxb = PXB_DEV(bus->parent_dev); + + return pxb->bus_nr; + } + + static uint16_t pxb_bus_numa_node(PCIBus *bus) + { +- PXBDev *pxb = convert_to_pxb(bus->parent_dev); ++ PXBDev *pxb = PXB_DEV(bus->parent_dev); + + return pxb->numa_node; + } +@@ -154,7 +138,7 @@ static char *pxb_host_ofw_unit_address(const SysBusDevice *dev) + + pxb_host = PCI_HOST_BRIDGE(dev); + pxb_bus = pxb_host->bus; +- pxb_dev = convert_to_pxb(pxb_bus->parent_dev); ++ pxb_dev = PXB_DEV(pxb_bus->parent_dev); + position = g_list_index(pxb_dev_list, pxb_dev); + assert(position >= 0); + +@@ -212,8 +196,8 @@ static void pxb_cxl_realize(DeviceState *dev, Error **errp) + */ + void pxb_cxl_hook_up_registers(CXLState *cxl_state, PCIBus *bus, Error **errp) + { +- PXBDev *pxb = PXB_CXL_DEV(pci_bridge_get_device(bus)); +- CXLHost *cxl = pxb->cxl.cxl_host_bridge; ++ PXBCXLDev *pxb = PXB_CXL_DEV(pci_bridge_get_device(bus)); ++ CXLHost *cxl = pxb->cxl_host_bridge; + CXLComponentState *cxl_cstate = &cxl->cxl_cstate; + struct MemoryRegion *mr = &cxl_cstate->crb.component_registers; + hwaddr offset; +@@ -299,7 +283,7 @@ static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin) + + static void pxb_cxl_dev_reset(DeviceState *dev) + { +- CXLHost *cxl = PXB_CXL_DEV(dev)->cxl.cxl_host_bridge; ++ CXLHost *cxl = PXB_CXL_DEV(dev)->cxl_host_bridge; + CXLComponentState *cxl_cstate = &cxl->cxl_cstate; + PCIHostState *hb = PCI_HOST_BRIDGE(cxl); + uint32_t *reg_state = cxl_cstate->crb.cache_mem_registers; +@@ -337,7 +321,7 @@ static gint pxb_compare(gconstpointer a, gconstpointer b) + static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type, + Error **errp) + { +- PXBDev *pxb = convert_to_pxb(dev); ++ PXBDev *pxb = PXB_DEV(dev); + DeviceState *ds, *bds = NULL; + PCIBus *bus; + const char *dev_name = NULL; +@@ -365,7 +349,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type, + } else if (type == CXL) { + bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS); + bus->flags |= PCI_BUS_CXL; +- PXB_CXL_DEV(dev)->cxl.cxl_host_bridge = PXB_CXL_HOST(ds); ++ PXB_CXL_DEV(dev)->cxl_host_bridge = PXB_CXL_HOST(ds); + } else { + bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS); + bds = qdev_new("pci-bridge"); +@@ -418,7 +402,7 @@ static void pxb_dev_realize(PCIDevice *dev, Error **errp) + + static void pxb_dev_exitfn(PCIDevice *pci_dev) + { +- PXBDev *pxb = convert_to_pxb(pci_dev); ++ PXBDev *pxb = PXB_DEV(pci_dev); + + pxb_dev_list = g_list_remove(pxb_dev_list, pxb); + } +@@ -449,7 +433,7 @@ static void pxb_dev_class_init(ObjectClass *klass, void *data) + } + + static const TypeInfo pxb_dev_info = { +- .name = TYPE_PXB_DEVICE, ++ .name = TYPE_PXB_DEV, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PXBDev), + .class_init = pxb_dev_class_init, +@@ -481,15 +465,14 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data) + k->class_id = PCI_CLASS_BRIDGE_HOST; + + dc->desc = "PCI Express Expander Bridge"; +- device_class_set_props(dc, pxb_dev_properties); + dc->hotpluggable = false; + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); + } + + static const TypeInfo pxb_pcie_dev_info = { +- .name = TYPE_PXB_PCIE_DEVICE, +- .parent = TYPE_PCI_DEVICE, +- .instance_size = sizeof(PXBDev), ++ .name = TYPE_PXB_PCIE_DEV, ++ .parent = TYPE_PXB_DEV, ++ .instance_size = sizeof(PXBPCIEDev), + .class_init = pxb_pcie_dev_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, +@@ -510,11 +493,7 @@ static void pxb_cxl_dev_realize(PCIDevice *dev, Error **errp) + } + + static Property pxb_cxl_dev_properties[] = { +- /* Note: 0 is not a legal PXB bus number. */ +- DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0), +- DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED), +- DEFINE_PROP_BOOL("bypass_iommu", PXBDev, bypass_iommu, false), +- DEFINE_PROP_BOOL("hdm_for_passthrough", PXBDev, hdm_for_passthrough, false), ++ DEFINE_PROP_BOOL("hdm_for_passthrough", PXBCXLDev, hdm_for_passthrough, false), + DEFINE_PROP_END_OF_LIST(), + }; + +@@ -540,9 +519,9 @@ static void pxb_cxl_dev_class_init(ObjectClass *klass, void *data) + } + + static const TypeInfo pxb_cxl_dev_info = { +- .name = TYPE_PXB_CXL_DEVICE, +- .parent = TYPE_PCI_DEVICE, +- .instance_size = sizeof(PXBDev), ++ .name = TYPE_PXB_CXL_DEV, ++ .parent = TYPE_PXB_PCIE_DEV, ++ .instance_size = sizeof(PXBCXLDev), + .class_init = pxb_cxl_dev_class_init, + .interfaces = + (InterfaceInfo[]){ +diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h +index b2cffbb364..c453983e83 100644 +--- a/include/hw/cxl/cxl.h ++++ b/include/hw/cxl/cxl.h +@@ -23,12 +23,12 @@ + + #define CXL_WINDOW_MAX 10 + +-typedef struct PXBDev PXBDev; ++typedef struct PXBCXLDev PXBCXLDev; + + typedef struct CXLFixedWindow { + uint64_t size; + char **targets; +- PXBDev *target_hbs[8]; ++ PXBCXLDev *target_hbs[8]; + uint8_t num_targets; + uint8_t enc_int_ways; + uint8_t enc_int_gran; +diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h +index 1677176b2a..01670e9e65 100644 +--- a/include/hw/pci/pci_bridge.h ++++ b/include/hw/pci/pci_bridge.h +@@ -84,7 +84,7 @@ struct PCIBridge { + #define PCI_BRIDGE_DEV_PROP_SHPC "shpc" + typedef struct CXLHost CXLHost; + +-struct PXBDev { ++typedef struct PXBDev { + /*< private >*/ + PCIDevice parent_obj; + /*< public >*/ +@@ -92,15 +92,27 @@ struct PXBDev { + uint8_t bus_nr; + uint16_t numa_node; + bool bypass_iommu; ++} PXBDev; ++ ++typedef struct PXBPCIEDev { ++ /*< private >*/ ++ PXBDev parent_obj; ++} PXBPCIEDev; ++ ++#define TYPE_PXB_DEV "pxb" ++OBJECT_DECLARE_SIMPLE_TYPE(PXBDev, PXB_DEV) ++ ++typedef struct PXBCXLDev { ++ /*< private >*/ ++ PXBPCIEDev parent_obj; ++ /*< public >*/ ++ + bool hdm_for_passthrough; +- struct cxl_dev { +- CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */ +- } cxl; +-}; ++ CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */ ++} PXBCXLDev; + +-#define TYPE_PXB_CXL_DEVICE "pxb-cxl" +-DECLARE_INSTANCE_CHECKER(PXBDev, PXB_CXL_DEV, +- TYPE_PXB_CXL_DEVICE) ++#define TYPE_PXB_CXL_DEV "pxb-cxl" ++OBJECT_DECLARE_SIMPLE_TYPE(PXBCXLDev, PXB_CXL_DEV) + + int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset, + uint16_t svid, uint16_t ssid, +-- +2.40.0 + diff --git a/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch b/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch deleted file mode 100644 index 48c4203..0000000 --- a/0002-tests-Disable-pci_virtio_vga-for-ppc64.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 2f0a0afbf915d36c39c5cfac1e31c6edc7f47bef Mon Sep 17 00:00:00 2001 -From: "Eduardo Lima (Etrunko)" -Date: Thu, 1 Sep 2022 12:43:49 -0300 -Subject: [PATCH 2/7] tests: Disable pci_virtio_vga for ppc64 - -starting QEMU: exec ./qemu-system-ppc64 -qtest unix:/tmp/qtest-2378197.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2378197.qmp,id=char0 -mon chardev=char0,mode=control -display none -vga none -device virtio-vga -accel qtest -stderr: -qemu-system-ppc64: -device virtio-vga: 'virtio-vga' is not a valid device model name -Broken pipe -../tests/qtest/libqtest.c:156: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0) - -Signed-off-by: Eduardo Lima (Etrunko) ---- - tests/qtest/display-vga-test.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/qtest/display-vga-test.c b/tests/qtest/display-vga-test.c -index ace3bb28e0..628dad4cf2 100644 ---- a/tests/qtest/display-vga-test.c -+++ b/tests/qtest/display-vga-test.c -@@ -61,7 +61,7 @@ int main(int argc, char **argv) - qtest_add_func("/display/pci/multihead", pci_multihead); - qtest_add_func("/display/pci/virtio-gpu", pci_virtio_gpu); - if (g_str_equal(arch, "i386") || g_str_equal(arch, "x86_64") || -- g_str_equal(arch, "hppa") || g_str_equal(arch, "ppc64")) { -+ g_str_equal(arch, "hppa")) { - qtest_add_func("/display/pci/virtio-vga", pci_virtio_vga); - } - --- -2.37.3 - diff --git a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch deleted file mode 100644 index f69907e..0000000 --- a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 5c1d2f920c14d6e8f4ac7abc62714eadaa60f228 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Tue, 10 Jan 2023 12:37:14 -0500 -Subject: [PATCH 3/7] 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é ---- - linux-user/syscall.c | 25 ------------------------- - 1 file changed, 25 deletions(-) - -diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 24b25759be..10af5e0d8e 100644 ---- 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 - #endif --- -2.37.3 - diff --git a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch deleted file mode 100644 index 6487990..0000000 --- a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch +++ /dev/null @@ -1,76 +0,0 @@ -From b40cf0a490c28d5b79e05382d061983b92a7b2b3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Tue, 10 Jan 2023 12:37:25 -0500 -Subject: [PATCH 4/7] 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é ---- - linux-user/syscall.c | 18 ------------------ - meson.build | 2 -- - 2 files changed, 20 deletions(-) - -diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 10af5e0d8e..d974c76b60 100644 ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -95,25 +95,7 @@ - #include - #include - #include -- --#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 --#endif - #include - #if defined(CONFIG_FIEMAP) - #include -diff --git a/meson.build b/meson.build -index 5c6b5a1c75..3172b01089 100644 ---- a/meson.build -+++ b/meson.build -@@ -2032,8 +2032,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', --- -2.37.3 - diff --git a/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch b/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch deleted file mode 100644 index 7ad17be..0000000 --- a/0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 930def8769940600dd7dd587ec2accd4a8b6e1f8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= -Date: Mon, 27 Feb 2023 16:02:51 +0000 -Subject: [PATCH 6/7] [PATCH] test-vmstate: fix bad GTree usage, use-after-free -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -According to g_tree_foreach() documentation: -"The tree may not be modified while iterating over it (you can't -add/remove items)." - -Fixes: 9a85e4b8f6 ("migration: Support gtree migration") -Cc: Eric Auger -Signed-off-by: Marc-André Lureau ---- - tests/unit/test-vmstate.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c -index 541bb4f63e..36b253eb67 100644 ---- a/tests/unit/test-vmstate.c -+++ b/tests/unit/test-vmstate.c -@@ -1074,7 +1074,6 @@ static gboolean diff_tree(gpointer key, gpointer value, gpointer data) - struct match_node_data d = {tp->tree2, key, value}; - - g_tree_foreach(tp->tree2, tp->match_node, &d); -- g_tree_remove(tp->tree1, key); - return false; - } - -@@ -1084,7 +1083,7 @@ static void compare_trees(GTree *tree1, GTree *tree2, - struct tree_cmp_data tp = {tree1, tree2, function}; - - g_tree_foreach(tree1, diff_tree, &tp); -- assert(g_tree_nnodes(tree1) == 0); -+ g_tree_destroy(g_tree_ref(tree1)); - assert(g_tree_nnodes(tree2) == 0); - } - --- -2.37.3 - diff --git a/0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch b/0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch deleted file mode 100644 index c142e77..0000000 --- a/0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 4021e0a116b568c312b864dfc27dfeed3317538a Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 27 Feb 2023 17:37:10 +0000 -Subject: [PATCH 7/7] tests: Ensure TAP version is printed before other - messages - -These two tests were failing with this error: - - stderr: - TAP parsing error: version number must be on the first line - [...] - Unknown TAP version. The first line MUST be `TAP version `. Assuming version 12. - -This can be fixed by ensuring we always call g_test_init first in the -body of main. - -Thanks: Daniel Berrange, for diagnosing the problem -Signed-off-by: Richard W.M. Jones ---- - tests/qtest/rtl8139-test.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c -index 8fa3313cc3..90bb616974 100644 ---- a/tests/qtest/rtl8139-test.c -+++ b/tests/qtest/rtl8139-test.c -@@ -196,9 +196,10 @@ int main(int argc, char **argv) - { - int ret; - -- qtest_start("-device rtl8139"); -- - g_test_init(&argc, &argv, NULL); -+ -+ qtest_start("-device rtl8139"); -+ - qtest_add_func("/rtl8139/nop", nop); - qtest_add_func("/rtl8139/timer", test_init); - --- -2.37.3 - diff --git a/qemu.spec b/qemu.spec index ee9747e..662c8ac 100644 --- a/qemu.spec +++ b/qemu.spec @@ -325,7 +325,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 7.2.1 +Version: 8.0.0 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: GPLv2 and BSD and MIT and CC-BY @@ -346,19 +346,13 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch -Patch: 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch -# Fix compat with kernel-headers >= 6.1 -Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch -Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch -# Fix build with glib2 2.75.3 -# https://bugzilla.redhat.com/show_bug.cgi?id=2173639 -# https://gitlab.com/qemu-project/qemu/-/issues/1518 -# Patch is NOT UPSTREAM. -Patch: 0006-PATCH-test-vmstate-fix-bad-GTree-usage-use-after-fre.patch -# Fix one of the tests. Sent upstream 2023-02-27. -Patch: 0007-tests-Ensure-TAP-version-is-printed-before-other-mes.patch +# Fix wrong type and rework inheritance. +Patch: 0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch +Patch: 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch BuildRequires: meson >= %{meson_version} +BuildRequires: bison +BuildRequires: flex BuildRequires: zlib-devel BuildRequires: glib2-devel BuildRequires: gnutls-devel @@ -506,6 +500,8 @@ BuildRequires: fuse3-devel %if %{have_sdl_image} BuildRequires: SDL2_image-devel %endif +# gvnc used by vnc-display-test +BuildRequires: pkgconfig(gvnc-1.0) %if %{user_static} BuildRequires: glibc-static glib2-static zlib-static @@ -606,15 +602,6 @@ This package provides the qemu-pr-helper utility that is required for certain SCSI features. -%package -n qemu-virtiofsd -Summary: QEMU virtio-fs shared file system daemon -Provides: vhostuser-backend(fs) -%description -n qemu-virtiofsd -This package provides virtiofsd daemon. This program is a vhost-user backend -that implements the virtio-fs device that is used for sharing a host directory -tree with a guest. - - %package tests Summary: tests for the %{name} package Requires: %{name} = %{epoch}:%{version}-%{release} @@ -1444,6 +1431,7 @@ mkdir -p %{static_builddir} --disable-auth-pam \\\ --disable-avx2 \\\ --disable-avx512f \\\ + --disable-avx512bw \\\ --disable-blkio \\\ --disable-block-drv-whitelist-in-tools \\\ --disable-bochs \\\ @@ -1488,6 +1476,7 @@ mkdir -p %{static_builddir} --disable-kvm \\\ --disable-l2tpv3 \\\ --disable-libdaxctl \\\ + --disable-libdw \\\ --disable-libiscsi \\\ --disable-libnfs \\\ --disable-libpmem \\\ @@ -1557,7 +1546,6 @@ mkdir -p %{static_builddir} --disable-vhost-vdpa \\\ --disable-virglrenderer \\\ --disable-virtfs \\\ - --disable-virtiofsd \\\ --disable-vnc \\\ --disable-vnc-jpeg \\\ --disable-png \\\ @@ -1625,6 +1613,8 @@ run_configure \ --enable-attr \ %ifarch %{ix86} x86_64 --enable-avx2 \ + --enable-avx512f \ + --enable-avx512bw \ %endif %if %{have_libblkio} --enable-blkio \ @@ -1693,7 +1683,6 @@ run_configure \ %if %{have_usbredir} --enable-usb-redir \ %endif - --enable-virtiofsd \ --enable-vhost-kernel \ --enable-vhost-net \ --enable-vhost-user \ @@ -1725,6 +1714,7 @@ run_configure \ %endif --enable-gtk \ --enable-libdaxctl \ + --enable-libdw \ %if %{have_block_nfs} --enable-libnfs \ %endif @@ -2185,12 +2175,6 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{_mandir}/man8/qemu-pr-helper.8* -%files -n qemu-virtiofsd -%{_mandir}/man1/virtiofsd.1* -%{_libexecdir}/virtiofsd -%{_datadir}/qemu/vhost-user/50-qemu-virtiofsd.json - - %files tools %{_bindir}/qemu-keymap %{_bindir}/qemu-edid @@ -2786,6 +2770,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Thu Apr 20 2023 Eduardo Lima (Etrunko) - 8.0.0-1 +- Rebase to qemu 8.0.0 + * Wed Apr 19 2023 Eduardo Lima (Etrunko) - 7.2.1-1 - Rebase to qemu 7.2.1 diff --git a/sources b/sources index c94b8cd..b5ace58 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-7.2.1.tar.xz) = e286dc66c923a5df77eb02d69235d048e80a7cced638fae52fbed385b4c3cd736cfea66bb3c9843bebf0a33e81ea141fc015e0bd82108df304f148ce59d9ae8a +SHA512 (qemu-8.0.0.tar.xz) = 1f31d1e653dec2d35f1b7a5468ee3f471553b48eca8c8afafffcf9243c6b2260e78a5b73da3fe567f9b85d4133573eebd397747b3aec501fb24076263eb07b27 From f3752caa8497b0c67d2c409716e0f907368dcc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 25 Apr 2023 09:22:42 +0100 Subject: [PATCH 33/54] Remove repeated configure options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- qemu.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/qemu.spec b/qemu.spec index 662c8ac..49212c0 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1718,14 +1718,12 @@ run_configure \ %if %{have_block_nfs} --enable-libnfs \ %endif - --enable-libudev \ %if %{have_liburing} --enable-linux-io-uring \ %endif --enable-linux-user \ --enable-live-block-migration \ --enable-multiprocess \ - --enable-vnc-jpeg \ --enable-parallels \ %if %{have_librdma} --enable-pvrdma \ @@ -1745,7 +1743,6 @@ run_configure \ --enable-spice \ --enable-spice-protocol \ %endif - --enable-usb-redir \ --enable-vdi \ --enable-vhost-crypto \ %if %{have_virgl} From 2b6515981a8f3be9cbe0bcbd184148ffd5cc60a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 25 Apr 2023 09:28:10 +0100 Subject: [PATCH 34/54] Remove duplicated obsoletes for RBD package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- qemu.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 49212c0..7145077 100644 --- a/qemu.spec +++ b/qemu.spec @@ -305,7 +305,6 @@ %global obsoletes_some_modules \ %{obsoletes_block_gluster} \ %{obsoletes_block_rbd} \ -%{obsoletes_block_rbd} \ Obsoletes: %{name}-system-lm32 <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-lm32-core <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-moxie <= %{epoch}:%{version}-%{release} \ From f2cb56a43cfeb660682837ccd90b58c276d2add2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 25 Apr 2023 09:28:57 +0100 Subject: [PATCH 35/54] Obsolete qemu-virtiofsd on x86 arch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2189368 Signed-off-by: Daniel P. Berrangé --- qemu.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 7145077..005f498 100644 --- a/qemu.spec +++ b/qemu.spec @@ -218,7 +218,13 @@ %define requires_device_display_virtio_vga Requires: %{name}-device-display-virtio-vga = %{evr} %define requires_device_display_virtio_vga_gl Requires: %{name}-device-display-virtio-vga-gl = %{evr} %define requires_package_qemu_pr_helper Requires: qemu-pr-helper +%ifnarch %{ix86} %define requires_package_virtiofsd Requires: vhostuser-backend(fs) +%define obsoletes_package_virtiofsd %{nil} +%else +%define requires_package_virtiofsd %{nil} +%define obsoletes_package_virtiofsd Obsoletes: %{name}-virtiofsd < %{evr} +%endif %if %{have_virgl} %define requires_device_display_vhost_user_gpu Requires: %{name}-device-display-vhost-user-gpu = %{evr} @@ -305,6 +311,7 @@ %global obsoletes_some_modules \ %{obsoletes_block_gluster} \ %{obsoletes_block_rbd} \ +%{obsoletes_package_virtiofsd} \ Obsoletes: %{name}-system-lm32 <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-lm32-core <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-moxie <= %{epoch}:%{version}-%{release} \ @@ -320,7 +327,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 1 +%global baserelease 2 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2766,6 +2773,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Tue Apr 25 2023 Daniel P. Berrangé - 8.0.0-2 +- Obsolete qemu-virtiofsd on i686 (rhbz #2189368) + * Thu Apr 20 2023 Eduardo Lima (Etrunko) - 8.0.0-1 - Rebase to qemu 8.0.0 From cef9ee51c534ff518dd5fec963f9186fd88ee6d6 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 26 Apr 2023 10:14:02 -0400 Subject: [PATCH 36/54] Fix virgl conditionals These changes are needed to fix the build when built without virgl (as in RHEL/ELN). --- qemu.spec | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index 005f498..537eeb0 100644 --- a/qemu.spec +++ b/qemu.spec @@ -211,9 +211,7 @@ %define requires_ui_egl_headless Requires: %{name}-ui-egl-headless = %{evr} %define requires_ui_opengl Requires: %{name}-ui-opengl = %{evr} %define requires_device_display_virtio_gpu Requires: %{name}-device-display-virtio-gpu = %{evr} -%define requires_device_display_virtio_gpu_gl Requires: %{name}-device-display-virtio-gpu-gl = %{evr} %define requires_device_display_virtio_gpu_pci Requires: %{name}-device-display-virtio-gpu-pci = %{evr} -%define requires_device_display_virtio_gpu_pci_gl Requires: %{name}-device-display-virtio-gpu-pci-gl = %{evr} %define requires_device_display_virtio_gpu_ccw Requires: %{name}-device-display-virtio-gpu-ccw = %{evr} %define requires_device_display_virtio_vga Requires: %{name}-device-display-virtio-vga = %{evr} %define requires_device_display_virtio_vga_gl Requires: %{name}-device-display-virtio-vga-gl = %{evr} @@ -228,8 +226,12 @@ %if %{have_virgl} %define requires_device_display_vhost_user_gpu Requires: %{name}-device-display-vhost-user-gpu = %{evr} +%define requires_device_display_virtio_gpu_gl Requires: %{name}-device-display-virtio-gpu-gl = %{evr} +%define requires_device_display_virtio_gpu_pci_gl Requires: %{name}-device-display-virtio-gpu-pci-gl = %{evr} %else %define requires_device_display_vhost_user_gpu %{nil} +%define requires_device_display_virtio_gpu_gl %{nil} +%define requires_device_display_virtio_gpu_pci_gl %{nil} %endif %if %{have_jack} @@ -810,11 +812,13 @@ Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} %description device-display-virtio-gpu This package provides the virtio-gpu display device for QEMU. +%if %{have_virgl} %package device-display-virtio-gpu-gl Summary: QEMU virtio-gpu-gl display device Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} %description device-display-virtio-gpu-gl This package provides the virtio-gpu-gl display device for QEMU. +%endif %package device-display-virtio-gpu-pci Summary: QEMU virtio-gpu-pci display device @@ -822,11 +826,13 @@ Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} %description device-display-virtio-gpu-pci This package provides the virtio-gpu-pci display device for QEMU. +%if %{have_virgl} %package device-display-virtio-gpu-pci-gl Summary: QEMU virtio-gpu-pci-gl display device Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} %description device-display-virtio-gpu-pci-gl This package provides the virtio-gpu-pci-gl display device for QEMU. +%endif %package device-display-virtio-gpu-ccw Summary: QEMU virtio-gpu-ccw display device @@ -1874,6 +1880,8 @@ install -m 0644 -t %{buildroot}%{_datadir}/%{name}/tracetool/backend scripts/tra mkdir -p %{buildroot}%{_datadir}/%{name}/tracetool/format install -m 0644 -t %{buildroot}%{_datadir}/%{name}/tracetool/format scripts/tracetool/format/*.py +# Ensure vhost-user directory is present even if built without virgl +mkdir -p %{buildroot}%{_datadir}/%{name}/vhost-user # Create new directories and put them all under tests-src mkdir -p %{buildroot}%{testsdir}/python @@ -2299,12 +2307,16 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %files device-display-virtio-gpu %{_libdir}/%{name}/hw-display-virtio-gpu.so +%if %{have_virgl} %files device-display-virtio-gpu-gl %{_libdir}/%{name}/hw-display-virtio-gpu-gl.so +%endif %files device-display-virtio-gpu-pci %{_libdir}/%{name}/hw-display-virtio-gpu-pci.so +%if %{have_virgl} %files device-display-virtio-gpu-pci-gl %{_libdir}/%{name}/hw-display-virtio-gpu-pci-gl.so +%endif %files device-display-virtio-gpu-ccw %{_libdir}/%{name}/hw-s390x-virtio-gpu-ccw.so %files device-display-virtio-vga From 589d3530fb61ea2ed7a22e7c8d137359dd13533c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 27 Apr 2023 08:10:33 +0100 Subject: [PATCH 37/54] Obsolete sgabios from qemu-common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QEMU deleted the sga device several releases ago, but sgabios has only just been retired in F39. An obsoletes from qemu-common will ensure that it gets erased when someone tries to upgrade from < F39. Signed-off-by: Daniel P. Berrangé --- qemu.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 537eeb0..d1112a0 100644 --- a/qemu.spec +++ b/qemu.spec @@ -319,7 +319,8 @@ Obsoletes: %{name}-system-lm32-core <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-moxie <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-moxie-core <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-unicore32 <= %{epoch}:%{version}-%{release} \ -Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} +Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} \ +Obsoletes: sgabios <= 1:0.20180715git-10.fc38 # Release candidate version tracking # global rcver rc4 From 9061c9345e176d3fbc8cfafb1919ef788630b093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 27 Apr 2023 08:54:32 +0100 Subject: [PATCH 38/54] Fix sgabios binary RPM name & clean up related cruft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- qemu.spec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/qemu.spec b/qemu.spec index d1112a0..c69dede 100644 --- a/qemu.spec +++ b/qemu.spec @@ -163,7 +163,7 @@ # https://bugzilla.redhat.com/show_bug.cgi?id=1952483 %global _lto_cflags %{nil} -%global firmwaredirs "%{_datadir}/qemu-firmware:%{_datadir}/ipxe/qemu:%{_datadir}/seavgabios:%{_datadir}/seabios:%{_datadir}/sgabios" +%global firmwaredirs "%{_datadir}/qemu-firmware:%{_datadir}/ipxe/qemu:%{_datadir}/seavgabios:%{_datadir}/seabios" %global qemudocdir %{_docdir}/%{name} %define evr %{epoch}:%{version}-%{release} @@ -320,7 +320,7 @@ Obsoletes: %{name}-system-moxie <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-moxie-core <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-unicore32 <= %{epoch}:%{version}-%{release} \ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} \ -Obsoletes: sgabios <= 1:0.20180715git-10.fc38 +Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 # Release candidate version tracking # global rcver rc4 @@ -1400,7 +1400,6 @@ platform. Summary: QEMU system emulator for x86 Requires: %{name}-common = %{epoch}:%{version}-%{release} Requires: seabios-bin -Requires: sgabios-bin Requires: seavgabios-bin %if %{have_edk2} Requires: edk2-ovmf @@ -1935,8 +1934,6 @@ rm -rf %{buildroot}%{_datadir}/%{name}/efi*rom rm -rf %{buildroot}%{_datadir}/%{name}/vgabios*bin # Provided by package seabios rm -rf %{buildroot}%{_datadir}/%{name}/bios*.bin -# Provided by package sgabios -rm -rf %{buildroot}%{_datadir}/%{name}/sgabios.bin # Provided by edk2 rm -rf %{buildroot}%{_datadir}/%{name}/edk2* rm -rf %{buildroot}%{_datadir}/%{name}/firmware From ef665a7199833f7f69751140dc137bc889902b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 27 Apr 2023 08:56:20 +0100 Subject: [PATCH 39/54] Bump release for new build to remove sgabios-bin requirement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index c69dede..5b49d84 100644 --- a/qemu.spec +++ b/qemu.spec @@ -330,7 +330,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 2 +%global baserelease 3 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2783,6 +2783,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Thu Apr 27 2023 Daniel P. Berrangé - 8.0.0-3 +- Drop sgabios-bin requirement and related baggage + * Tue Apr 25 2023 Daniel P. Berrangé - 8.0.0-2 - Obsolete qemu-virtiofsd on i686 (rhbz #2189368) From f53d48ae75ce4f33c86c98b74dd824e5c6c3176c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 27 Apr 2023 12:09:17 +0100 Subject: [PATCH 40/54] Convert license to SPDX format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This new expression is a result of * Running 'licensecheck -r .' across the QEMU code base * Ignoring results not applicable to Fedora platform * Ignoring stuff only used in test cases * Adding missing logo license * Considering upstream default license for non-annotated files Note license expression simplication is no longer to be performed in Fedora, so the new expression is unavoidably much larger than before. Signed-off-by: Daniel P. Berrangé --- qemu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 5b49d84..578e225 100644 --- a/qemu.spec +++ b/qemu.spec @@ -337,7 +337,7 @@ Name: qemu Version: 8.0.0 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 -License: GPLv2 and BSD and MIT and CC-BY +License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later with GCC-exception-2.0 exception AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only and LGPL-2.1-or-later AND MIT and public-domain and CC-BY-3.0 URL: http://www.qemu.org/ Source0: http://wiki.qemu-project.org/download/%{name}-%{version}%{?rcstr}.tar.xz From 2ce5ca73a8243aa0aa5e5b7fe222301bd41f269c Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 19 May 2023 08:00:00 +0000 Subject: [PATCH 41/54] 99-qemu-guest-agent.rules: fix warning reported by udevadm verify Fix the following warning reported by udevadm verify: 99-qemu-guest-agent.rules:2 A comma between tokens is expected. 99-qemu-guest-agent.rules: udev rules check failed --- 99-qemu-guest-agent.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/99-qemu-guest-agent.rules b/99-qemu-guest-agent.rules index 8a290ab..4709705 100644 --- a/99-qemu-guest-agent.rules +++ b/99-qemu-guest-agent.rules @@ -1,2 +1,2 @@ SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \ - TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" + TAG+="systemd", ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" From bc72c799c7ec542c01d209be9520e6cf92313a95 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jun 2023 08:30:49 +0100 Subject: [PATCH 42/54] Rebuild for libnfs soname bump --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 578e225..704b8cc 100644 --- a/qemu.spec +++ b/qemu.spec @@ -330,7 +330,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 3 +%global baserelease 4 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2783,6 +2783,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Thu Jun 01 2023 Richard W.M. Jones - 2:8.0.0-4 +- Rebuild for libnfs soname bump + * Thu Apr 27 2023 Daniel P. Berrangé - 8.0.0-3 - Drop sgabios-bin requirement and related baggage From 44034e55c100083976320cf5e32a567e3fb1f6a5 Mon Sep 17 00:00:00 2001 From: Sandro Bonazzola Date: Fri, 9 Jun 2023 09:57:20 +0200 Subject: [PATCH 43/54] avoid double setup in %prep in %prep both %setup and %autosetup were called resulting in doubling the %prep execution time. Signed-off-by: Sandro Bonazzola --- qemu.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index 704b8cc..4a2f0aa 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1425,8 +1425,7 @@ This package provides the QEMU system emulator for Xtensa boards. %prep -%setup -q -n qemu-%{version}%{?rcstr} -%autosetup -S git_am +%autosetup -n qemu-%{version}%{?rcstr} -S git_am %global qemu_kvm_build qemu_kvm_build mkdir -p %{qemu_kvm_build} From fe9446c8aaf637cbb27dc3f55b664bc45f55f006 Mon Sep 17 00:00:00 2001 From: Sandro Bonazzola Date: Fri, 9 Jun 2023 09:48:51 +0200 Subject: [PATCH 44/54] fix typo in pulseaudio subpkg description Signed-off-by: Sandro Bonazzola --- qemu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 4a2f0aa..8994dcb 100644 --- a/qemu.spec +++ b/qemu.spec @@ -747,7 +747,7 @@ This package provides the additional OSS audio driver for QEMU. Summary: QEMU PulseAudio audio driver Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} %description audio-pa -This package provides the additional PulseAudi audio driver for QEMU. +This package provides the additional PulseAudio audio driver for QEMU. %package audio-sdl Summary: QEMU SDL audio driver From 9bdf4d356ad02637a8134c7ce9f27e62e4d3718b Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 5 Jul 2023 14:11:41 -0400 Subject: [PATCH 45/54] spec: Drop gvnc-devel dep on rhel It's not available in centos stream 9 repos. Fixes virt-preview builds for centos stream 9 chroots Signed-off-by: Cole Robinson --- qemu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 8994dcb..13bc47d 100644 --- a/qemu.spec +++ b/qemu.spec @@ -119,6 +119,7 @@ %global have_libblkio 1 %endif +%global have_gvnc_devel %{defined fedora} %global have_sdl_image %{defined fedora} %global have_fdt 1 %global have_opengl 1 @@ -509,8 +510,10 @@ BuildRequires: fuse3-devel %if %{have_sdl_image} BuildRequires: SDL2_image-devel %endif -# gvnc used by vnc-display-test +%if %{have_gvnc_devel} +# Used by vnc-display-test BuildRequires: pkgconfig(gvnc-1.0) +%endif %if %{user_static} BuildRequires: glibc-static glib2-static zlib-static From 9ce3d1e3ca124963e8d97d4cb9be0d49d597277b Mon Sep 17 00:00:00 2001 From: Camilla Conte Date: Mon, 3 Jul 2023 14:19:57 +0100 Subject: [PATCH 46/54] New upstream release 8.0.2 --- ...i_expander_bridge-fix-type-in-pxb_cx.patch | 43 ------------------- qemu.spec | 7 +-- sources | 2 +- 3 files changed, 5 insertions(+), 47 deletions(-) delete mode 100644 0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch diff --git a/0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch b/0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch deleted file mode 100644 index 7b31654..0000000 --- a/0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 692764e5310a7d1f5f819cbb2c4fb70405b4b119 Mon Sep 17 00:00:00 2001 -From: Jonathan Cameron via -Date: Thu, 20 Apr 2023 15:27:49 +0100 -Subject: [PATCH 1/2] hw/pci-bridge: pci_expander_bridge fix type in - pxb_cxl_dev_reset() - -Reproduce issue with - -configure --enable-qom-cast-debug ... - -qemu-system-x86_64 -display none -machine q35,cxl=on -device pxb-cxl,bus=pcie.0 - - hw/pci-bridge/pci_expander_bridge.c:54:PXB_DEV: Object 0x5570e0b1ada0 is not an instance of type pxb - Aborted - -The type conversion results in the right state structure, but PXB_DEV is -not a parent of PXB_CXL_DEV hence the error. Rather than directly -cleaning up the inheritance, this is the minimal fix which will be -followed by the cleanup. - -Fixes: 154070eaf6 ("hw/pxb-cxl: Support passthrough HDM Decoders unless overridden") -Reported-by: Peter Maydell -Signed-off-by: Jonathan Cameron ---- - hw/pci-bridge/pci_expander_bridge.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c -index ead33f0c05..a78327b5f2 100644 ---- a/hw/pci-bridge/pci_expander_bridge.c -+++ b/hw/pci-bridge/pci_expander_bridge.c -@@ -311,7 +311,7 @@ static void pxb_cxl_dev_reset(DeviceState *dev) - * The CXL specification allows for host bridges with no HDM decoders - * if they only have a single root port. - */ -- if (!PXB_DEV(dev)->hdm_for_passthrough) { -+ if (!PXB_CXL_DEV(dev)->hdm_for_passthrough) { - dsp_count = pcie_count_ds_ports(hb->bus); - } - /* Initial reset will have 0 dsp so wait until > 0 */ --- -2.40.0 - diff --git a/qemu.spec b/qemu.spec index 13bc47d..b2ce8fd 100644 --- a/qemu.spec +++ b/qemu.spec @@ -335,7 +335,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 8.0.0 +Version: 8.0.2 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later with GCC-exception-2.0 exception AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only and LGPL-2.1-or-later AND MIT and public-domain and CC-BY-3.0 @@ -356,8 +356,6 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch -# Fix wrong type and rework inheritance. -Patch: 0001-hw-pci-bridge-pci_expander_bridge-fix-type-in-pxb_cx.patch Patch: 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch BuildRequires: meson >= %{meson_version} @@ -2785,6 +2783,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Mon Jul 03 2023 Camilla Conte - 2:8.0.2-1 +- New upstream release 8.0.2 + * Thu Jun 01 2023 Richard W.M. Jones - 2:8.0.0-4 - Rebuild for libnfs soname bump diff --git a/sources b/sources index b5ace58..061d5f5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-8.0.0.tar.xz) = 1f31d1e653dec2d35f1b7a5468ee3f471553b48eca8c8afafffcf9243c6b2260e78a5b73da3fe567f9b85d4133573eebd397747b3aec501fb24076263eb07b27 +SHA512 (qemu-8.0.2.tar.xz) = 4e915d33a662bf55b09247fb85150be376c92270d3764e3d6470c452cb70cc558f54e84de5610dd60a9eb3ea02d5d4277b1ec75c9804967d278fa8361c7f9b9a From 66ae407ce2195a08e632167e091bc65a93000ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 6 Jul 2023 14:40:01 +0100 Subject: [PATCH 47/54] Fix arabic keyboard layout name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- ...Use-the-official-xkb-name-for-Arabic.patch | 62 +++++++++++++++++++ qemu.spec | 2 + 2 files changed, 64 insertions(+) create mode 100644 0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch diff --git a/0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch b/0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch new file mode 100644 index 0000000..b25aeb4 --- /dev/null +++ b/0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch @@ -0,0 +1,62 @@ +From 4ace54be1d671fb67795368001f2628facd49418 Mon Sep 17 00:00:00 2001 +From: Peter Maydell +Date: Tue, 20 Jun 2023 17:20:24 +0100 +Subject: [PATCH] pc-bios/keymaps: Use the official xkb name for Arabic layout, + not the legacy synonym +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The xkb official name for the Arabic keyboard layout is 'ara'. +However xkb has for at least the past 15 years also permitted it to +be named via the legacy synonym 'ar'. In xkeyboard-config 2.39 this +synoynm was removed, which breaks compilation of QEMU: + +FAILED: pc-bios/keymaps/ar +/home/fred/qemu-git/src/qemu/build-full/qemu-keymap -f pc-bios/keymaps/ar -l ar +xkbcommon: ERROR: Couldn't find file "symbols/ar" in include paths +xkbcommon: ERROR: 1 include paths searched: +xkbcommon: ERROR: /usr/share/X11/xkb +xkbcommon: ERROR: 3 include paths could not be added: +xkbcommon: ERROR: /home/fred/.config/xkb +xkbcommon: ERROR: /home/fred/.xkb +xkbcommon: ERROR: /etc/xkb +xkbcommon: ERROR: Abandoning symbols file "(unnamed)" +xkbcommon: ERROR: Failed to compile xkb_symbols +xkbcommon: ERROR: Failed to compile keymap + +The upstream xkeyboard-config change removing the compat +mapping is: +https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/470ad2cd8fea84d7210377161d86b31999bb5ea6 + +Make QEMU always ask for the 'ara' xkb layout, which should work on +both older and newer xkeyboard-config. We leave the QEMU name for +this keyboard layout as 'ar'; it is not the only one where our name +for it deviates from the xkb standard name. + +Cc: qemu-stable@nongnu.org +Signed-off-by: Peter Maydell +Reviewed-by: Richard Henderson +Reviewed-by: Philippe Mathieu-Daudé +Reviewed-by: Daniel P. Berrangé +Message-id: 20230620162024.1132013-1-peter.maydell@linaro.org +Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709 +(cherry picked from commit 497fad38979c16b6412388927401e577eba43d26) +--- + pc-bios/keymaps/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build +index 158a3b410c..1cbcdebefa 100644 +--- a/pc-bios/keymaps/meson.build ++++ b/pc-bios/keymaps/meson.build +@@ -1,5 +1,5 @@ + keymaps = { +- 'ar': '-l ar', ++ 'ar': '-l ara', + 'bepo': '-l fr -v dvorak', + 'cz': '-l cz', + 'da': '-l dk', +-- +2.41.0 + diff --git a/qemu.spec b/qemu.spec index b2ce8fd..6fb3211 100644 --- a/qemu.spec +++ b/qemu.spec @@ -357,6 +357,7 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch Patch: 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch +Patch: 0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch BuildRequires: meson >= %{meson_version} BuildRequires: bison @@ -2785,6 +2786,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog * Mon Jul 03 2023 Camilla Conte - 2:8.0.2-1 - New upstream release 8.0.2 +- Fix arabic keyboard layout name * Thu Jun 01 2023 Richard W.M. Jones - 2:8.0.0-4 - Rebuild for libnfs soname bump From 9d0cc42919ea2f21f0e7860669c5df8cec499a3d Mon Sep 17 00:00:00 2001 From: Camilla Conte Date: Thu, 20 Jul 2023 10:46:25 +0100 Subject: [PATCH 48/54] New upstream release 8.0.3 --- ...Use-the-official-xkb-name-for-Arabic.patch | 62 ------------------- qemu.spec | 6 +- sources | 2 +- 3 files changed, 5 insertions(+), 65 deletions(-) delete mode 100644 0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch diff --git a/0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch b/0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch deleted file mode 100644 index b25aeb4..0000000 --- a/0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 4ace54be1d671fb67795368001f2628facd49418 Mon Sep 17 00:00:00 2001 -From: Peter Maydell -Date: Tue, 20 Jun 2023 17:20:24 +0100 -Subject: [PATCH] pc-bios/keymaps: Use the official xkb name for Arabic layout, - not the legacy synonym -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The xkb official name for the Arabic keyboard layout is 'ara'. -However xkb has for at least the past 15 years also permitted it to -be named via the legacy synonym 'ar'. In xkeyboard-config 2.39 this -synoynm was removed, which breaks compilation of QEMU: - -FAILED: pc-bios/keymaps/ar -/home/fred/qemu-git/src/qemu/build-full/qemu-keymap -f pc-bios/keymaps/ar -l ar -xkbcommon: ERROR: Couldn't find file "symbols/ar" in include paths -xkbcommon: ERROR: 1 include paths searched: -xkbcommon: ERROR: /usr/share/X11/xkb -xkbcommon: ERROR: 3 include paths could not be added: -xkbcommon: ERROR: /home/fred/.config/xkb -xkbcommon: ERROR: /home/fred/.xkb -xkbcommon: ERROR: /etc/xkb -xkbcommon: ERROR: Abandoning symbols file "(unnamed)" -xkbcommon: ERROR: Failed to compile xkb_symbols -xkbcommon: ERROR: Failed to compile keymap - -The upstream xkeyboard-config change removing the compat -mapping is: -https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/470ad2cd8fea84d7210377161d86b31999bb5ea6 - -Make QEMU always ask for the 'ara' xkb layout, which should work on -both older and newer xkeyboard-config. We leave the QEMU name for -this keyboard layout as 'ar'; it is not the only one where our name -for it deviates from the xkb standard name. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Peter Maydell -Reviewed-by: Richard Henderson -Reviewed-by: Philippe Mathieu-Daudé -Reviewed-by: Daniel P. Berrangé -Message-id: 20230620162024.1132013-1-peter.maydell@linaro.org -Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709 -(cherry picked from commit 497fad38979c16b6412388927401e577eba43d26) ---- - pc-bios/keymaps/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build -index 158a3b410c..1cbcdebefa 100644 ---- a/pc-bios/keymaps/meson.build -+++ b/pc-bios/keymaps/meson.build -@@ -1,5 +1,5 @@ - keymaps = { -- 'ar': '-l ar', -+ 'ar': '-l ara', - 'bepo': '-l fr -v dvorak', - 'cz': '-l cz', - 'da': '-l dk', --- -2.41.0 - diff --git a/qemu.spec b/qemu.spec index 6fb3211..69bd473 100644 --- a/qemu.spec +++ b/qemu.spec @@ -335,7 +335,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 8.0.2 +Version: 8.0.3 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later with GCC-exception-2.0 exception AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only and LGPL-2.1-or-later AND MIT and public-domain and CC-BY-3.0 @@ -357,7 +357,6 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch Patch: 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch -Patch: 0001-pc-bios-keymaps-Use-the-official-xkb-name-for-Arabic.patch BuildRequires: meson >= %{meson_version} BuildRequires: bison @@ -2784,6 +2783,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Thu Jul 20 2023 Camilla Conte - 2:8.0.3-1 +- New upstream release 8.0.3 + * Mon Jul 03 2023 Camilla Conte - 2:8.0.2-1 - New upstream release 8.0.2 - Fix arabic keyboard layout name diff --git a/sources b/sources index 061d5f5..d8621aa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-8.0.2.tar.xz) = 4e915d33a662bf55b09247fb85150be376c92270d3764e3d6470c452cb70cc558f54e84de5610dd60a9eb3ea02d5d4277b1ec75c9804967d278fa8361c7f9b9a +SHA512 (qemu-8.0.3.tar.xz) = 18b2ccb65f7ec2ae92f0e04406539620c881e2b75f63816588c86043a07464bb99d16a83e792ed9508de393f4b694c46d52f4d07edf52741e85224c8b8d5d5c3 From f36b5bbd6fd14da93551e1383e657fe5321999aa Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 20 Aug 2023 08:14:47 -0400 Subject: [PATCH 49/54] Rebase to qemu-8.1.0-rc4 Signed-off-by: Cole Robinson --- ...sgx_epc_get_section-stub-is-reachabl.patch | 33 -- ...tests-Disable-iotests-like-RHEL-does.patch | 58 ++++ ...ke-PCIe-and-CXL-PXB-Devices-inherit-.patch | 325 ------------------ qemu.spec | 45 ++- sources | 2 +- 5 files changed, 93 insertions(+), 370 deletions(-) delete mode 100644 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch create mode 100644 0001-tests-Disable-iotests-like-RHEL-does.patch delete mode 100644 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch diff --git a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch b/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch deleted file mode 100644 index 5245b0f..0000000 --- a/0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e54512fe75f85640c0c73e53e6f8bd0b9d193529 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Tue, 1 Feb 2022 20:09:37 +0100 -Subject: [PATCH 1/7] target/i386: the sgx_epc_get_section stub is reachable -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The sgx_epc_get_section stub is reachable from cpu_x86_cpuid. It -should not assert, instead it should just return true just like -the "real" sgx_epc_get_section does when SGX is disabled. - -Reported-by: Vladimír Beneš -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/i386/sgx-stub.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c -index 26833eb233..16b1dfd90b 100644 ---- a/hw/i386/sgx-stub.c -+++ b/hw/i386/sgx-stub.c -@@ -34,5 +34,5 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) - - bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) - { -- g_assert_not_reached(); -+ return true; - } --- -2.37.3 - diff --git a/0001-tests-Disable-iotests-like-RHEL-does.patch b/0001-tests-Disable-iotests-like-RHEL-does.patch new file mode 100644 index 0000000..09706e5 --- /dev/null +++ b/0001-tests-Disable-iotests-like-RHEL-does.patch @@ -0,0 +1,58 @@ +From e4a112c75a02a789e7710e805f66211426087d55 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Cole Robinson +Date: Sun, 20 Aug 2023 10:49:12 -0400 +Subject: [PATCH] tests: Disable iotests, like RHEL does +Content-type: text/plain + +Signed-off-by: Cole Robinson +--- + tests/qemu-iotests/meson.build | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build +index 44761e1e4d..78c5836325 100644 +--- a/tests/qemu-iotests/meson.build ++++ b/tests/qemu-iotests/meson.build +@@ -51,21 +51,21 @@ foreach format, speed: qemu_iotests_formats + check: true, + ) + +- foreach item: rc.stdout().strip().split() +- args = [qemu_iotests_check_cmd, +- '-tap', '-' + format, item, +- '--source-dir', meson.current_source_dir(), +- '--build-dir', meson.current_build_dir()] +- # Some individual tests take as long as 45 seconds +- # Bump the timeout to 3 minutes for some headroom +- # on slow machines to minimize spurious failures +- test('io-' + format + '-' + item, +- python, +- args: args, +- depends: qemu_iotests_binaries, +- env: qemu_iotests_env, +- protocol: 'tap', +- timeout: 180, +- suite: suites) +- endforeach ++# foreach item: rc.stdout().strip().split() ++# args = [qemu_iotests_check_cmd, ++# '-tap', '-' + format, item, ++# '--source-dir', meson.current_source_dir(), ++# '--build-dir', meson.current_build_dir()] ++# # Some individual tests take as long as 45 seconds ++# # Bump the timeout to 3 minutes for some headroom ++# # on slow machines to minimize spurious failures ++# test('io-' + format + '-' + item, ++# python, ++# args: args, ++# depends: qemu_iotests_binaries, ++# env: qemu_iotests_env, ++# protocol: 'tap', ++# timeout: 180, ++# suite: suites) ++# endforeach + endforeach +-- +2.41.0 + diff --git a/0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch b/0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch deleted file mode 100644 index 514bc75..0000000 --- a/0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch +++ /dev/null @@ -1,325 +0,0 @@ -From 736ef0dcc04348bd478cc69d772a6b44fe660831 Mon Sep 17 00:00:00 2001 -From: Jonathan Cameron via -Date: Thu, 20 Apr 2023 15:27:50 +0100 -Subject: [PATCH 2/2] hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from - TYPE_PXB_DEV - -Previously, PXB_CXL_DEVICE, PXB_PCIE_DEVICE and PXB_DEVICE all -have PCI_DEVICE as their direct parent but share a common state -struct PXBDev. convert_to_pxb() is used to get the PXBDev -instance from which ever of these types it is called on. - -This patch switches to an explicit heirarchy based on shared -functionality. To allow use of OBJECT_DECLARE_SIMPLE_TYPE() -whilst minimizing code changes, all types are renamed to have -the postfix _DEV rather than _DEVICE. The new heirarchy -has PXB_CXL_DEV with parent PXB_PCIE_DEV which in turn -has parent PXB_DEV which continues to have parent PCI_DEVICE. - -This allows simple use of PXB_DEV() etc rather than a custom function -+ removal of duplicated properties and moving the CXL specific -elements out of struct PXBDev. - -Signed-off-by: Jonathan Cameron ---- - hw/acpi/cxl.c | 11 +++--- - hw/cxl/cxl-host.c | 4 +- - hw/pci-bridge/pci_expander_bridge.c | 59 ++++++++++------------------- - include/hw/cxl/cxl.h | 4 +- - include/hw/pci/pci_bridge.h | 28 ++++++++++---- - 5 files changed, 49 insertions(+), 57 deletions(-) - -diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c -index 2bf8c07993..92b46bc932 100644 ---- a/hw/acpi/cxl.c -+++ b/hw/acpi/cxl.c -@@ -30,9 +30,10 @@ - #include "qapi/error.h" - #include "qemu/uuid.h" - --static void cedt_build_chbs(GArray *table_data, PXBDev *cxl) -+static void cedt_build_chbs(GArray *table_data, PXBCXLDev *cxl) - { -- SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl.cxl_host_bridge); -+ PXBDev *pxb = PXB_DEV(cxl); -+ SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl_host_bridge); - struct MemoryRegion *mr = sbd->mmio[0].memory; - - /* Type */ -@@ -45,7 +46,7 @@ static void cedt_build_chbs(GArray *table_data, PXBDev *cxl) - build_append_int_noprefix(table_data, 32, 2); - - /* UID - currently equal to bus number */ -- build_append_int_noprefix(table_data, cxl->bus_nr, 4); -+ build_append_int_noprefix(table_data, pxb->bus_nr, 4); - - /* Version */ - build_append_int_noprefix(table_data, 1, 4); -@@ -112,7 +113,7 @@ static void cedt_build_cfmws(GArray *table_data, CXLState *cxls) - /* Host Bridge List (list of UIDs - currently bus_nr) */ - for (i = 0; i < fw->num_targets; i++) { - g_assert(fw->target_hbs[i]); -- build_append_int_noprefix(table_data, fw->target_hbs[i]->bus_nr, 4); -+ build_append_int_noprefix(table_data, PXB_DEV(fw->target_hbs[i])->bus_nr, 4); - } - } - } -@@ -121,7 +122,7 @@ static int cxl_foreach_pxb_hb(Object *obj, void *opaque) - { - Aml *cedt = opaque; - -- if (object_dynamic_cast(obj, TYPE_PXB_CXL_DEVICE)) { -+ if (object_dynamic_cast(obj, TYPE_PXB_CXL_DEV)) { - cedt_build_chbs(cedt->buf, PXB_CXL_DEV(obj)); - } - -diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c -index 6e923ceeaf..034c7805b3 100644 ---- a/hw/cxl/cxl-host.c -+++ b/hw/cxl/cxl-host.c -@@ -84,7 +84,7 @@ void cxl_fmws_link_targets(CXLState *cxl_state, Error **errp) - bool ambig; - - o = object_resolve_path_type(fw->targets[i], -- TYPE_PXB_CXL_DEVICE, -+ TYPE_PXB_CXL_DEV, - &ambig); - if (!o) { - error_setg(errp, "Could not resolve CXLFM target %s", -@@ -141,7 +141,7 @@ static PCIDevice *cxl_cfmws_find_device(CXLFixedWindow *fw, hwaddr addr) - addr += fw->base; - - rb_index = (addr / cxl_decode_ig(fw->enc_int_gran)) % fw->num_targets; -- hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl.cxl_host_bridge); -+ hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl_host_bridge); - if (!hb || !hb->bus || !pci_bus_is_cxl(hb->bus)) { - return NULL; - } -diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c -index a78327b5f2..613857b601 100644 ---- a/hw/pci-bridge/pci_expander_bridge.c -+++ b/hw/pci-bridge/pci_expander_bridge.c -@@ -50,24 +50,8 @@ struct PXBBus { - char bus_path[8]; - }; - --#define TYPE_PXB_DEVICE "pxb" --DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV, -- TYPE_PXB_DEVICE) -- --#define TYPE_PXB_PCIE_DEVICE "pxb-pcie" --DECLARE_INSTANCE_CHECKER(PXBDev, PXB_PCIE_DEV, -- TYPE_PXB_PCIE_DEVICE) -- --static PXBDev *convert_to_pxb(PCIDevice *dev) --{ -- /* A CXL PXB's parent bus is PCIe, so the normal check won't work */ -- if (object_dynamic_cast(OBJECT(dev), TYPE_PXB_CXL_DEVICE)) { -- return PXB_CXL_DEV(dev); -- } -- -- return pci_bus_is_express(pci_get_bus(dev)) -- ? PXB_PCIE_DEV(dev) : PXB_DEV(dev); --} -+#define TYPE_PXB_PCIE_DEV "pxb-pcie" -+OBJECT_DECLARE_SIMPLE_TYPE(PXBPCIEDev, PXB_PCIE_DEV) - - static GList *pxb_dev_list; - -@@ -89,14 +73,14 @@ bool cxl_get_hb_passthrough(PCIHostState *hb) - - static int pxb_bus_num(PCIBus *bus) - { -- PXBDev *pxb = convert_to_pxb(bus->parent_dev); -+ PXBDev *pxb = PXB_DEV(bus->parent_dev); - - return pxb->bus_nr; - } - - static uint16_t pxb_bus_numa_node(PCIBus *bus) - { -- PXBDev *pxb = convert_to_pxb(bus->parent_dev); -+ PXBDev *pxb = PXB_DEV(bus->parent_dev); - - return pxb->numa_node; - } -@@ -154,7 +138,7 @@ static char *pxb_host_ofw_unit_address(const SysBusDevice *dev) - - pxb_host = PCI_HOST_BRIDGE(dev); - pxb_bus = pxb_host->bus; -- pxb_dev = convert_to_pxb(pxb_bus->parent_dev); -+ pxb_dev = PXB_DEV(pxb_bus->parent_dev); - position = g_list_index(pxb_dev_list, pxb_dev); - assert(position >= 0); - -@@ -212,8 +196,8 @@ static void pxb_cxl_realize(DeviceState *dev, Error **errp) - */ - void pxb_cxl_hook_up_registers(CXLState *cxl_state, PCIBus *bus, Error **errp) - { -- PXBDev *pxb = PXB_CXL_DEV(pci_bridge_get_device(bus)); -- CXLHost *cxl = pxb->cxl.cxl_host_bridge; -+ PXBCXLDev *pxb = PXB_CXL_DEV(pci_bridge_get_device(bus)); -+ CXLHost *cxl = pxb->cxl_host_bridge; - CXLComponentState *cxl_cstate = &cxl->cxl_cstate; - struct MemoryRegion *mr = &cxl_cstate->crb.component_registers; - hwaddr offset; -@@ -299,7 +283,7 @@ static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin) - - static void pxb_cxl_dev_reset(DeviceState *dev) - { -- CXLHost *cxl = PXB_CXL_DEV(dev)->cxl.cxl_host_bridge; -+ CXLHost *cxl = PXB_CXL_DEV(dev)->cxl_host_bridge; - CXLComponentState *cxl_cstate = &cxl->cxl_cstate; - PCIHostState *hb = PCI_HOST_BRIDGE(cxl); - uint32_t *reg_state = cxl_cstate->crb.cache_mem_registers; -@@ -337,7 +321,7 @@ static gint pxb_compare(gconstpointer a, gconstpointer b) - static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type, - Error **errp) - { -- PXBDev *pxb = convert_to_pxb(dev); -+ PXBDev *pxb = PXB_DEV(dev); - DeviceState *ds, *bds = NULL; - PCIBus *bus; - const char *dev_name = NULL; -@@ -365,7 +349,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type, - } else if (type == CXL) { - bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS); - bus->flags |= PCI_BUS_CXL; -- PXB_CXL_DEV(dev)->cxl.cxl_host_bridge = PXB_CXL_HOST(ds); -+ PXB_CXL_DEV(dev)->cxl_host_bridge = PXB_CXL_HOST(ds); - } else { - bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS); - bds = qdev_new("pci-bridge"); -@@ -418,7 +402,7 @@ static void pxb_dev_realize(PCIDevice *dev, Error **errp) - - static void pxb_dev_exitfn(PCIDevice *pci_dev) - { -- PXBDev *pxb = convert_to_pxb(pci_dev); -+ PXBDev *pxb = PXB_DEV(pci_dev); - - pxb_dev_list = g_list_remove(pxb_dev_list, pxb); - } -@@ -449,7 +433,7 @@ static void pxb_dev_class_init(ObjectClass *klass, void *data) - } - - static const TypeInfo pxb_dev_info = { -- .name = TYPE_PXB_DEVICE, -+ .name = TYPE_PXB_DEV, - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PXBDev), - .class_init = pxb_dev_class_init, -@@ -481,15 +465,14 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data) - k->class_id = PCI_CLASS_BRIDGE_HOST; - - dc->desc = "PCI Express Expander Bridge"; -- device_class_set_props(dc, pxb_dev_properties); - dc->hotpluggable = false; - set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - } - - static const TypeInfo pxb_pcie_dev_info = { -- .name = TYPE_PXB_PCIE_DEVICE, -- .parent = TYPE_PCI_DEVICE, -- .instance_size = sizeof(PXBDev), -+ .name = TYPE_PXB_PCIE_DEV, -+ .parent = TYPE_PXB_DEV, -+ .instance_size = sizeof(PXBPCIEDev), - .class_init = pxb_pcie_dev_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, -@@ -510,11 +493,7 @@ static void pxb_cxl_dev_realize(PCIDevice *dev, Error **errp) - } - - static Property pxb_cxl_dev_properties[] = { -- /* Note: 0 is not a legal PXB bus number. */ -- DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0), -- DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED), -- DEFINE_PROP_BOOL("bypass_iommu", PXBDev, bypass_iommu, false), -- DEFINE_PROP_BOOL("hdm_for_passthrough", PXBDev, hdm_for_passthrough, false), -+ DEFINE_PROP_BOOL("hdm_for_passthrough", PXBCXLDev, hdm_for_passthrough, false), - DEFINE_PROP_END_OF_LIST(), - }; - -@@ -540,9 +519,9 @@ static void pxb_cxl_dev_class_init(ObjectClass *klass, void *data) - } - - static const TypeInfo pxb_cxl_dev_info = { -- .name = TYPE_PXB_CXL_DEVICE, -- .parent = TYPE_PCI_DEVICE, -- .instance_size = sizeof(PXBDev), -+ .name = TYPE_PXB_CXL_DEV, -+ .parent = TYPE_PXB_PCIE_DEV, -+ .instance_size = sizeof(PXBCXLDev), - .class_init = pxb_cxl_dev_class_init, - .interfaces = - (InterfaceInfo[]){ -diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h -index b2cffbb364..c453983e83 100644 ---- a/include/hw/cxl/cxl.h -+++ b/include/hw/cxl/cxl.h -@@ -23,12 +23,12 @@ - - #define CXL_WINDOW_MAX 10 - --typedef struct PXBDev PXBDev; -+typedef struct PXBCXLDev PXBCXLDev; - - typedef struct CXLFixedWindow { - uint64_t size; - char **targets; -- PXBDev *target_hbs[8]; -+ PXBCXLDev *target_hbs[8]; - uint8_t num_targets; - uint8_t enc_int_ways; - uint8_t enc_int_gran; -diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h -index 1677176b2a..01670e9e65 100644 ---- a/include/hw/pci/pci_bridge.h -+++ b/include/hw/pci/pci_bridge.h -@@ -84,7 +84,7 @@ struct PCIBridge { - #define PCI_BRIDGE_DEV_PROP_SHPC "shpc" - typedef struct CXLHost CXLHost; - --struct PXBDev { -+typedef struct PXBDev { - /*< private >*/ - PCIDevice parent_obj; - /*< public >*/ -@@ -92,15 +92,27 @@ struct PXBDev { - uint8_t bus_nr; - uint16_t numa_node; - bool bypass_iommu; -+} PXBDev; -+ -+typedef struct PXBPCIEDev { -+ /*< private >*/ -+ PXBDev parent_obj; -+} PXBPCIEDev; -+ -+#define TYPE_PXB_DEV "pxb" -+OBJECT_DECLARE_SIMPLE_TYPE(PXBDev, PXB_DEV) -+ -+typedef struct PXBCXLDev { -+ /*< private >*/ -+ PXBPCIEDev parent_obj; -+ /*< public >*/ -+ - bool hdm_for_passthrough; -- struct cxl_dev { -- CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */ -- } cxl; --}; -+ CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */ -+} PXBCXLDev; - --#define TYPE_PXB_CXL_DEVICE "pxb-cxl" --DECLARE_INSTANCE_CHECKER(PXBDev, PXB_CXL_DEV, -- TYPE_PXB_CXL_DEVICE) -+#define TYPE_PXB_CXL_DEV "pxb-cxl" -+OBJECT_DECLARE_SIMPLE_TYPE(PXBCXLDev, PXB_CXL_DEV) - - int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset, - uint16_t svid, uint16_t ssid, --- -2.40.0 - diff --git a/qemu.spec b/qemu.spec index 69bd473..97db249 100644 --- a/qemu.spec +++ b/qemu.spec @@ -202,6 +202,7 @@ %define requires_audio_alsa Requires: %{name}-audio-alsa = %{evr} %define requires_audio_oss Requires: %{name}-audio-oss = %{evr} %define requires_audio_pa Requires: %{name}-audio-pa = %{evr} +%define requires_audio_pipewire Requires: %{name}-audio-pipewire = %{evr} %define requires_audio_sdl Requires: %{name}-audio-sdl = %{evr} %define requires_char_baum Requires: %{name}-char-baum = %{evr} %define requires_device_usb_host Requires: %{name}-device-usb-host = %{evr} @@ -283,6 +284,7 @@ %{requires_audio_dbus} \ %{requires_audio_oss} \ %{requires_audio_pa} \ +%{requires_audio_pipewire} \ %{requires_audio_sdl} \ %{requires_audio_jack} \ %{requires_audio_spice} \ @@ -324,18 +326,18 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} \ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 # Release candidate version tracking -# global rcver rc4 +%global rcver rc4 %if 0%{?rcver:1} %global rcrel .%{rcver} %global rcstr -%{rcver} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 4 +%global baserelease 0.1 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 8.0.3 +Version: 8.1.0 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later with GCC-exception-2.0 exception AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only and LGPL-2.1-or-later AND MIT and public-domain and CC-BY-3.0 @@ -354,9 +356,7 @@ Source30: kvm-s390x.conf Source31: kvm-x86.conf Source36: README.tests -# Fix SGX assert -Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch -Patch: 0002-hw-pci-bridge-Make-PCIe-and-CXL-PXB-Devices-inherit-.patch +Patch0001: 0001-tests-Disable-iotests-like-RHEL-does.patch BuildRequires: meson >= %{meson_version} BuildRequires: bison @@ -512,6 +512,7 @@ BuildRequires: SDL2_image-devel # Used by vnc-display-test BuildRequires: pkgconfig(gvnc-1.0) %endif +BuildRequires: pipewire-devel %if %{user_static} BuildRequires: glibc-static glib2-static zlib-static @@ -750,6 +751,12 @@ Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} %description audio-pa This package provides the additional PulseAudio audio driver for QEMU. +%package audio-pipewire +Summary: QEMU Pipewire audio driver +Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} +%description audio-pipewire +This package provides the additional Pipewire audio driver for QEMU. + %package audio-sdl Summary: QEMU SDL audio driver Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} @@ -1457,17 +1464,20 @@ mkdir -p %{static_builddir} --disable-cfi-debug \\\ --disable-cloop \\\ --disable-cocoa \\\ + --disable-colo-proxy \\\ --disable-coreaudio \\\ --disable-coroutine-pool \\\ --disable-crypto-afalg \\\ --disable-curl \\\ --disable-curses \\\ --disable-dbus-display \\\ + --disable-debug-graph-lock \\\ --disable-debug-info \\\ --disable-debug-mutex \\\ --disable-debug-tcg \\\ --disable-dmg \\\ --disable-docs \\\ + --disable-download \\\ --disable-dsound \\\ --disable-fdt \\\ --disable-fuse \\\ @@ -1517,6 +1527,7 @@ mkdir -p %{static_builddir} --disable-pa \\\ --disable-parallels \\\ --disable-pie \\\ + --disable-pipewire \\\ --disable-pvrdma \\\ --disable-qcow1 \\\ --disable-qed \\\ @@ -1544,12 +1555,15 @@ mkdir -p %{static_builddir} --disable-tcg \\\ --disable-tools \\\ --disable-tpm \\\ + --disable-tsan \\\ --disable-u2f \\\ --disable-usb-redir \\\ --disable-user \\\ + --disable-vpc \\\ --disable-vde \\\ --disable-vdi \\\ --disable-vfio-user-server \\\ + --disable-vhdx \\\ --disable-vhost-crypto \\\ --disable-vhost-kernel \\\ --disable-vhost-net \\\ @@ -1570,9 +1584,9 @@ mkdir -p %{static_builddir} --disable-xen-pci-passthrough \\\ --disable-xkbcommon \\\ --disable-zstd \\\ - --with-git-submodules=ignore \\\ --without-default-devices + run_configure() { ../configure \ --cc=%{__cc} \ @@ -1594,10 +1608,8 @@ run_configure() { --with-pkgversion="%{name}-%{version}-%{release}" \ --with-suffix="%{name}" \ --firmwarepath="%firmwaredirs" \ - --meson="%{__meson}" \ --enable-trace-backends=dtrace \ --with-coroutine=ucontext \ - --with-git=git \ --tls-priority=@QEMU,SYSTEM \ %{disable_everything} \ "$@" \ @@ -1677,6 +1689,7 @@ run_configure \ --enable-oss \ --enable-pa \ --enable-pie \ + --enable-pipewire \ %if %{have_block_rbd} --enable-rbd \ %endif @@ -1709,7 +1722,7 @@ run_configure \ --enable-xkbcommon \ \ \ - --audio-drv-list=pa,sdl,alsa,%{?jack_drv}oss \ + --audio-drv-list=pipewire,pa,sdl,alsa,%{?jack_drv}oss \ --target-list-exclude=moxie-softmmu \ --with-default-devices \ --enable-auth-pam \ @@ -1760,13 +1773,18 @@ run_configure \ %if %{have_virgl} --enable-virglrenderer \ %endif + --enable-vhdx \ --enable-virtfs \ + --enable-virtfs-proxy-helper \ + --enable-vpc \ --enable-vnc-jpeg \ --enable-vte \ --enable-vvfat \ %if %{have_xen} --enable-xen \ +%ifarch x86_64 --enable-xen-pci-passthrough \ +%endif %endif --enable-zstd @@ -1865,7 +1883,7 @@ install -D -p -m 0644 %{modprobe_kvm_conf} %{buildroot}%{_sysconfdir}/modprobe.d %endif # Copy some static data into place -install -D -p -m 0644 -t %{buildroot}%{qemudocdir} README.rst COPYING COPYING.LIB LICENSE docs/interop/qmp-spec.txt +install -D -p -m 0644 -t %{buildroot}%{qemudocdir} README.rst COPYING COPYING.LIB LICENSE docs/interop/qmp-spec.rst install -D -p -m 0644 qemu.sasl %{buildroot}%{_sysconfdir}/sasl2/%{name}.conf install -m 0644 scripts/dump-guest-memory.py %{buildroot}%{_datadir}/%{name} @@ -2278,6 +2296,8 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %{_libdir}/%{name}/audio-oss.so %files audio-pa %{_libdir}/%{name}/audio-pa.so +%files audio-pipewire +%{_libdir}/%{name}/audio-pipewire.so %files audio-sdl %{_libdir}/%{name}/audio-sdl.so %if %{have_jack} @@ -2783,6 +2803,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Sun Aug 20 2023 Cole Robinson - 8.1.0-0.1-rc4 +- Rebase to qemu 8.1.0-rc4 + * Thu Jul 20 2023 Camilla Conte - 2:8.0.3-1 - New upstream release 8.0.3 diff --git a/sources b/sources index d8621aa..8a6f596 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-8.0.3.tar.xz) = 18b2ccb65f7ec2ae92f0e04406539620c881e2b75f63816588c86043a07464bb99d16a83e792ed9508de393f4b694c46d52f4d07edf52741e85224c8b8d5d5c3 +SHA512 (qemu-8.1.0-rc4.tar.xz) = 26b8d1516436fd49b513dda41822888d3d9a15ea03f0470db7f4509a235d71397fd296af0dcb629cba1b9042ab5077628b20046e559a96f18cff67bb0d354bcf From 28fd87d26ae0801a3fc0f7f741bad8c95c9803b8 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Fri, 18 Aug 2023 09:18:38 -0700 Subject: [PATCH 50/54] Adjust virtiofsd requires for el9 and older --- qemu.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 97db249..b4d22ec 100644 --- a/qemu.spec +++ b/qemu.spec @@ -219,7 +219,11 @@ %define requires_device_display_virtio_vga_gl Requires: %{name}-device-display-virtio-vga-gl = %{evr} %define requires_package_qemu_pr_helper Requires: qemu-pr-helper %ifnarch %{ix86} +%if 0%{?fedora} || 0%{?rhel} > 9 %define requires_package_virtiofsd Requires: vhostuser-backend(fs) +%else +%define requires_package_virtiofsd Requires: virtiofsd +%endif %define obsoletes_package_virtiofsd %{nil} %else %define requires_package_virtiofsd %{nil} @@ -333,7 +337,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 0.1 +%global baserelease 0.2 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2803,6 +2807,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Mon Aug 21 2023 Davide Cavalca - 8.1.0-0.2-rc4 +- Adjust virtiofsd requires for el9 and older + * Sun Aug 20 2023 Cole Robinson - 8.1.0-0.1-rc4 - Rebase to qemu 8.1.0-rc4 From 1ece14f33e6ac5cf1893c004f15265b05fa16deb Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 23 Aug 2023 10:18:10 -0400 Subject: [PATCH 51/54] Rebase to qemu 8.1.0 GA Signed-off-by: Cole Robinson --- qemu.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qemu.spec b/qemu.spec index b4d22ec..ce4a7f6 100644 --- a/qemu.spec +++ b/qemu.spec @@ -330,14 +330,14 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} \ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 # Release candidate version tracking -%global rcver rc4 +# global rcver rc4 %if 0%{?rcver:1} %global rcrel .%{rcver} %global rcstr -%{rcver} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 0.2 +%global baserelease 1 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -2807,6 +2807,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Wed Aug 23 2023 Cole Robinson - 8.1.0-1 +- Rebase to qemu 8.1.0 GA + * Mon Aug 21 2023 Davide Cavalca - 8.1.0-0.2-rc4 - Adjust virtiofsd requires for el9 and older diff --git a/sources b/sources index 8a6f596..6b76115 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (qemu-8.1.0-rc4.tar.xz) = 26b8d1516436fd49b513dda41822888d3d9a15ea03f0470db7f4509a235d71397fd296af0dcb629cba1b9042ab5077628b20046e559a96f18cff67bb0d354bcf +SHA512 (qemu-8.1.0.tar.xz) = c5f5e7ce2d8e3c93a02012b136c866e8577df07da4705a0045916c71caeaa21fa1b2d59a4b22a660789a4159b192e12a443e7cbb0724ee85fea258251731724c From 98762f53f6939b8ca008bd627b2ed70570f6c88a Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 24 Aug 2023 10:03:16 -0400 Subject: [PATCH 52/54] spec: texinfo is no longer a build dependency Signed-off-by: Cole Robinson --- qemu.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index ce4a7f6..69c6392 100644 --- a/qemu.spec +++ b/qemu.spec @@ -378,7 +378,6 @@ BuildRequires: libusbx-devel >= %{libusbx_version} %if %{have_usbredir} BuildRequires: usbredir-devel >= %{usbredir_version} %endif -BuildRequires: texinfo BuildRequires: python3-sphinx BuildRequires: python3-sphinx_rtd_theme BuildRequires: libseccomp-devel >= %{libseccomp_version} From f51053d48adddcce068f680e3ca92fb8fd30abf6 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 24 Aug 2023 10:53:15 -0400 Subject: [PATCH 53/54] spec: Make qemu-docs noarch Signed-off-by: Cole Robinson --- qemu.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 69c6392..0472a1b 100644 --- a/qemu.spec +++ b/qemu.spec @@ -337,7 +337,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 1 +%global baserelease 2 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -578,6 +578,7 @@ This package provides documentation and auxiliary programs used with %{name}. %package docs Summary: %{name} documentation +BuildArch: noarch %description docs %{name}-docs provides documentation files regarding %{name}. @@ -2806,6 +2807,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Thu Aug 24 2023 Cole Robinson - 8.1.0-2 +- Make qemu-docs noarch + * Wed Aug 23 2023 Cole Robinson - 8.1.0-1 - Rebase to qemu 8.1.0 GA From e4bc25c09b77f647f285df3502e478d20abc4291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 25 Aug 2023 14:27:36 +0100 Subject: [PATCH 54/54] SPDX license operands must be uppercase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- qemu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 0472a1b..02ddf62 100644 --- a/qemu.spec +++ b/qemu.spec @@ -344,7 +344,7 @@ Name: qemu Version: 8.1.0 Release: %{baserelease}%{?rcrel}%{?dist} Epoch: 2 -License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later with GCC-exception-2.0 exception AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only and LGPL-2.1-or-later AND MIT and public-domain and CC-BY-3.0 +License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later with GCC-exception-2.0 exception AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND MIT AND public-domain AND CC-BY-3.0 URL: http://www.qemu.org/ Source0: http://wiki.qemu-project.org/download/%{name}-%{version}%{?rcstr}.tar.xz