From 5a11d17157ceea3ad31a1a4ba1e021004002cef1ef8b07798b77e978b0ba4e67 Mon Sep 17 00:00:00 2001 From: Dario Faggioli Date: Thu, 26 May 2022 17:31:38 +0000 Subject: [PATCH] Accepting request 979381 from home:dfaggioli:experimental:Virtualization - Substantial rework of the spec file: * the 'make check' testsuite now runs in the %check section of the main package, not in a subpackage * switched from %setup to %autosetup * rearranged the content in order to minimize the use of %if, %ifarch, etc - Some tests are having issues when run in OBS. They seem to be due to race conditions, triggered by resource constraints on the OBS workers. Let's disable them for now, while we investigate and try to fix them. * Patches added: Disable-some-tests-that-have-problems-in.patch - Revert an upstream commit that add some qtests that are problematic for GCC12+LTO * Patches added: Revert-8dcb404bff6d9147765d7dd3e9c849337.patch - _multibuild: disable the build of qemu-testsuite. We are going to run 'make check' as part of the %check phase of the main (qemu) package, so we do not need a dedicated build any longer. - Get rid of downstream patches breaking s390 modules. Replace them with the upstream proposed and Acked (but never committed) solution (bsc#1199015) * Patches added: modules-generates-per-target-modinfo.patch modules-introduces-module_kconfig-direct.patch * Patches dropped: Fix-the-module-building-problem-for-s390.patch modules-quick-fix-a-fundamental-error-in.patch - backport patches for having coroutine work well when LTO is used * Patches added: coroutine-ucontext-use-QEMU_DEFINE_STATI.patch coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch - seabios: drop patch that changes python in python2. Just go to python3 directly. * Patches dropped: seabios-use-python2-explicitly-as-needed.patch - Make temp dir (for update_git.sh) configurable - Added new subpackages (audio-dbus, ui-dbus) - Update to v7.0.0. For full release notese, see: * https://wiki.qemu.org/ChangeLog/7.0 Be sure to also check the following pages: * https://qemu-project.gitlab.io/qemu/about/removed-features.html * https://qemu-project.gitlab.io/qemu/about/deprecated.html Some notable changes: * [ARM] The virt board has gained a new control knob to disable passing a RNG seed in the DTB (dtb-kaslr-seed) * [ARM] The AST2600 SoC now supports a dummy version of the i3c device * [ARM] The virt board can now run guests with KVM on hosts with restricted IPA ranges * [ARM] The virt board now supports virtio-mem-pci * [ARM] The virt board now supports specifying the guest CPU topology * [ARM] On the virt board, we now enable PAuth when using KVM or hvf and the host CPU supports it * [RISC-V] Add support for ratified 1.0 Vector extension * [RISC-V] Support for the Zve64f and Zve32f extensions * [RISC-V] Drop support for draft 0.7.1 Vector extension * [RISC-V] Support Zfhmin and Zfh extensions * [RISC-V] RISC-V KVM support * [RISC-V] Mark Hypervisor extension as non experimental * [RISC-V] Enable Hypervisor extension by default * [x86] Support for Intel AMX. * [PCI/PCIe] Q35: fix PCIe device becoming disabled after migration when ACPI based PCI hotplug is used (6b0969f1ec) * [PCI/PCIe] initial bits of SR/IOV support (250346169) * [PCI/PCIe] arm/virt: fixed PXB interrupt routing (e609301b45) * [PCI/PCIe] arm/virt: support for virtio-mem-pci (b1b87327a9) * [virtiofs] Fix for CVE-2022-0358 - behaviour with supplementary groups and SGID directories * [virtiofs] Improved security label support * [virtiofs] The virtiofsd in qemu is now starting to be deprecated; please start using and contributing to Rust virtiofsd * Patches Added: intc-exynos4210_gic-replace-snprintf-wit.patch * Patches dropped: Python-aqmp-fix-type-definitions-for-myp.patch acpi-validate-hotplug-selector-on-access.patch block-backend-Retain-permissions-after-m.patch brotli-fix-actual-variable-array-paramet.patch doc-Add-the-SGX-numa-description.patch hw-i386-amd_iommu-Fix-maybe-uninitialize.patch hw-intc-exynos4210_gic-provide-more-room.patch hw-nvme-fix-CVE-2021-3929.patch hw-nvram-at24-return-0xff-if-1-byte-addr.patch iotest-065-explicit-compression-type.patch iotest-214-explicit-compression-type.patch iotest-302-use-img_info_log-helper.patch iotest-303-explicit-compression-type.patch iotest-39-use-_qcow2_dump_header.patch iotests-60-more-accurate-set-dirty-bit-i.patch iotests-MRCE-Write-data-to-source.patch iotests-bash-tests-filter-compression-ty.patch iotests-common.rc-introduce-_qcow2_dump_.patch iotests-declare-lack-of-support-for-comp.patch iotests-drop-qemu_img_verbose-helper.patch iotests-massive-use-_qcow2_dump_header.patch iotests-specify-some-unsupported_imgopts.patch iotests.py-filter-out-successful-output-.patch iotests.py-img_info_log-rename-imgopts-a.patch iotests.py-implement-unsupported_imgopts.patch iotests.py-qemu_img-create-support-IMGOP.patch iotests.py-rewrite-default-luks-support-.patch meson-build-all-modules-by-default.patch numa-Enable-numa-for-SGX-EPC-sections.patch numa-Support-SGX-numa-in-the-monitor-and.patch python-aqmp-Fix-negotiation-with-pre-oob.patch python-aqmp-add-SocketAddrT-to-package-r.patch python-aqmp-add-__del__-method-to-legacy.patch python-aqmp-add-_session_guard.patch python-aqmp-add-socket-bind-step-to-lega.patch python-aqmp-add-start_server-and-accept-.patch python-aqmp-copy-type-definitions-from-q.patch python-aqmp-drop-_bind_hack.patch python-aqmp-fix-docstring-typo.patch python-aqmp-fix-race-condition-in-legacy.patch python-aqmp-handle-asyncio.TimeoutError-.patch python-aqmp-refactor-_do_accept-into-two.patch python-aqmp-remove-_new_session-and-_est.patch python-aqmp-rename-AQMPError-to-QMPError.patch python-aqmp-rename-accept-to-start_serve.patch python-aqmp-split-_client_connected_cb-o.patch python-aqmp-squelch-pylint-warning-for-t.patch python-aqmp-stop-the-server-during-disco.patch python-introduce-qmp-shell-wrap-convenie.patch python-machine-raise-VMLaunchFailure-exc.patch python-move-qmp-shell-under-the-AQMP-pac.patch python-move-qmp-utilities-to-python-qemu.patch python-qmp-switch-qmp-shell-to-AQMP.patch python-support-recording-QMP-session-to-.patch python-upgrade-mypy-to-0.780.patch qcow2-simple-case-support-for-downgradin.patch qemu-binfmt-conf.sh-should-use-F-as-shor.patch tests-qemu-iotests-040-Skip-TestCommitWi.patch tests-qemu-iotests-Fix-051-for-binaries-.patch tests-qemu-iotests-testrunner-Quote-case.patch tools-virtiofsd-Add-rseq-syscall-to-the-.patch virtiofsd-Drop-membership-of-all-supplem.patch block-qdict-Fix-Werror-maybe-uninitializ.patch OBS-URL: https://build.opensuse.org/request/show/979381 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=717 --- DSDT.pcie | Bin 0 -> 3023 bytes ...ble-some-tests-that-have-problems-in.patch | 83 + ...the-module-building-problem-for-s390.patch | 31 - Ignore-spurious-GCC-12-warning.patch | 10 +- ...file-Don-t-check-pc-bios-as-pre-requ.patch | 2 +- Makefile-fix-build-with-binutils-2.38.patch | 16 +- PPC-KVM-Disable-mmu-notifier-check.patch | 4 +- ...on-aqmp-fix-type-definitions-for-myp.patch | 48 - ...e-soft-address-space-limit-to-hard-l.patch | 6 +- ...rt-8dcb404bff6d9147765d7dd3e9c849337.patch | 55 + Revert-qht-constify-qht_statistics_init.patch | 6 +- ...rt-roms-efirom-tests-uefi-test-tools.patch | 2 +- XXX-dont-dump-core-on-sigabort.patch | 8 +- _multibuild | 1 - ...-validate-hotplug-selector-on-access.patch | 41 - acpi_piix4-Fix-migration-from-SLE11-SP2.patch | 4 +- ...k-backend-Retain-permissions-after-m.patch | 72 - ...li-fix-actual-variable-array-paramet.patch | 49 - bundles.tar.xz | 4 +- config.sh | 21 +- configure-only-populate-roms-if-softmmu.patch | 4 +- ...igure-remove-pkgversion-from-CONFIG_.patch | 4 +- ...utine-ucontext-use-QEMU_DEFINE_STATI.patch | 122 + coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch | 124 + ...utine-win32-use-QEMU_DEFINE_STATIC_C.patch | 89 + doc-Add-the-SGX-numa-description.patch | 67 - ...add-our-support-doc-to-the-main-proj.patch | 2 + ...386-amd_iommu-Fix-maybe-uninitialize.patch | 64 - ...ntc-exynos4210_gic-provide-more-room.patch | 57 - hw-nvme-fix-CVE-2021-3929.patch | 65 - ...vram-at24-return-0xff-if-1-byte-addr.patch | 52 - ...csi-megasas-check-for-NULL-frame-in-.patch | 6 +- ...mbios-handle-both-file-formats-regar.patch | 10 +- increase-x86_64-physical-bits-to-42.patch | 41 + ...-exynos4210_gic-replace-snprintf-wit.patch | 58 + iotest-065-explicit-compression-type.patch | 78 - iotest-214-explicit-compression-type.patch | 32 - iotest-302-use-img_info_log-helper.patch | 82 - iotest-303-explicit-compression-type.patch | 101 - iotest-39-use-_qcow2_dump_header.patch | 31 - ...sts-60-more-accurate-set-dirty-bit-i.patch | 31 - iotests-MRCE-Write-data-to-source.patch | 61 - ...sts-bash-tests-filter-compression-ty.patch | 288 -- ...sts-common.rc-introduce-_qcow2_dump_.patch | 38 - ...sts-declare-lack-of-support-for-comp.patch | 98 - iotests-drop-qemu_img_verbose-helper.patch | 112 - iotests-massive-use-_qcow2_dump_header.patch | 408 -- ...sts-specify-some-unsupported_imgopts.patch | 222 -- ...sts.py-filter-out-successful-output-.patch | 447 --- ...sts.py-img_info_log-rename-imgopts-a.patch | 75 - ...sts.py-implement-unsupported_imgopts.patch | 64 - ...sts.py-qemu_img-create-support-IMGOP.patch | 91 - ...sts.py-rewrite-default-luks-support-.patch | 83 - linux-user-Fake-proc-cpuinfo.patch | 6 +- ...x-user-add-binfmt-wrapper-for-argv-0.patch | 4 +- ...x-user-lseek-explicitly-cast-non-set.patch | 4 +- linux-user-use-target_ulong.patch | 38 +- meson-build-all-modules-by-default.patch | 54 - ...n-install-ivshmem-client-and-ivshmem.patch | 8 +- modules-generates-per-target-modinfo.patch | 134 + ...les-introduces-module_kconfig-direct.patch | 266 ++ ...les-quick-fix-a-fundamental-error-in.patch | 88 - numa-Enable-numa-for-SGX-EPC-sections.patch | 277 -- ...-Support-SGX-numa-in-the-monitor-and.patch | 199 - ...on-aqmp-Fix-negotiation-with-pre-oob.patch | 36 - ...on-aqmp-add-SocketAddrT-to-package-r.patch | 42 - ...on-aqmp-add-__del__-method-to-legacy.patch | 64 - python-aqmp-add-_session_guard.patch | 140 - ...on-aqmp-add-socket-bind-step-to-lega.patch | 135 - ...on-aqmp-add-start_server-and-accept-.patch | 158 - ...on-aqmp-copy-type-definitions-from-q.patch | 134 - python-aqmp-drop-_bind_hack.patch | 132 - python-aqmp-fix-docstring-typo.patch | 27 - ...on-aqmp-fix-race-condition-in-legacy.patch | 59 - ...on-aqmp-handle-asyncio.TimeoutError-.patch | 46 - ...on-aqmp-refactor-_do_accept-into-two.patch | 102 - ...on-aqmp-remove-_new_session-and-_est.patch | 231 -- ...on-aqmp-rename-AQMPError-to-QMPError.patch | 221 -- ...on-aqmp-rename-accept-to-start_serve.patch | 163 - ...on-aqmp-split-_client_connected_cb-o.patch | 149 - ...on-aqmp-squelch-pylint-warning-for-t.patch | 37 - ...on-aqmp-stop-the-server-during-disco.patch | 54 - ...on-introduce-qmp-shell-wrap-convenie.patch | 167 - ...on-machine-raise-VMLaunchFailure-exc.patch | 126 - ...on-move-qmp-shell-under-the-AQMP-pac.patch | 1143 ------ ...on-move-qmp-utilities-to-python-qemu.patch | 2153 ----------- python-qmp-switch-qmp-shell-to-AQMP.patch | 121 - ...on-support-recording-QMP-session-to-.patch | 184 - python-upgrade-mypy-to-0.780.patch | 232 -- ...2-simple-case-support-for-downgradin.patch | 108 - qemu-6.2.0.tar.xz | 3 - qemu-6.2.0.tar.xz.sig | Bin 310 -> 0 bytes qemu-7.0.0.tar.xz | 3 + qemu-7.0.0.tar.xz.sig | Bin 0 -> 310 bytes qemu-binfmt-conf-Modify-default-path.patch | 2 +- ...-binfmt-conf.sh-should-use-F-as-shor.patch | 27 - qemu-cvs-gettimeofday.patch | 4 +- qemu-cvs-ioctl_debug.patch | 4 +- qemu-cvs-ioctl_nodirection.patch | 6 +- qemu.changes | 165 + qemu.spec | 3404 ++++++++--------- qemu.spec.in | 3187 ++++++++------- qht-Revert-some-constification-in-qht.c.patch | 10 +- ...handle-case-of-chardev-spice-module-.patch | 4 +- ...-Makefile-add-cross-file-to-qboot-me.patch | 4 +- ...-Makefile-pass-a-packaging-timestamp.patch | 2 +- ...-generic-check-for-additional-SG_IO-.patch | 1 + seabios-switch-to-python3-as-needed.patch | 12 +- ...ios-use-python2-explicitly-as-needed.patch | 48 - ...s-Fix-block-tests-to-be-compatible-w.patch | 2 +- ...s-qemu-iotests-040-Skip-TestCommitWi.patch | 33 - ...s-qemu-iotests-Fix-051-for-binaries-.patch | 34 - ...s-qemu-iotests-testrunner-Quote-case.patch | 43 - ...s-virtiofsd-Add-rseq-syscall-to-the-.patch | 57 - update_git.sh | 51 +- ...Help-compiler-out-to-avoid-a-warning.patch | 8 +- ...iofsd-Drop-membership-of-all-supplem.patch | 101 - ...ignore-live-parameter-from-xen-save-.patch | 4 +- 118 files changed, 4427 insertions(+), 13604 deletions(-) create mode 100644 DSDT.pcie create mode 100644 Disable-some-tests-that-have-problems-in.patch delete mode 100644 Fix-the-module-building-problem-for-s390.patch delete mode 100644 Python-aqmp-fix-type-definitions-for-myp.patch create mode 100644 Revert-8dcb404bff6d9147765d7dd3e9c849337.patch delete mode 100644 acpi-validate-hotplug-selector-on-access.patch delete mode 100644 block-backend-Retain-permissions-after-m.patch delete mode 100644 brotli-fix-actual-variable-array-paramet.patch create mode 100644 coroutine-ucontext-use-QEMU_DEFINE_STATI.patch create mode 100644 coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch create mode 100644 coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch delete mode 100644 doc-Add-the-SGX-numa-description.patch delete mode 100644 hw-i386-amd_iommu-Fix-maybe-uninitialize.patch delete mode 100644 hw-intc-exynos4210_gic-provide-more-room.patch delete mode 100644 hw-nvme-fix-CVE-2021-3929.patch delete mode 100644 hw-nvram-at24-return-0xff-if-1-byte-addr.patch create mode 100644 intc-exynos4210_gic-replace-snprintf-wit.patch delete mode 100644 iotest-065-explicit-compression-type.patch delete mode 100644 iotest-214-explicit-compression-type.patch delete mode 100644 iotest-302-use-img_info_log-helper.patch delete mode 100644 iotest-303-explicit-compression-type.patch delete mode 100644 iotest-39-use-_qcow2_dump_header.patch delete mode 100644 iotests-60-more-accurate-set-dirty-bit-i.patch delete mode 100644 iotests-MRCE-Write-data-to-source.patch delete mode 100644 iotests-bash-tests-filter-compression-ty.patch delete mode 100644 iotests-common.rc-introduce-_qcow2_dump_.patch delete mode 100644 iotests-declare-lack-of-support-for-comp.patch delete mode 100644 iotests-drop-qemu_img_verbose-helper.patch delete mode 100644 iotests-massive-use-_qcow2_dump_header.patch delete mode 100644 iotests-specify-some-unsupported_imgopts.patch delete mode 100644 iotests.py-filter-out-successful-output-.patch delete mode 100644 iotests.py-img_info_log-rename-imgopts-a.patch delete mode 100644 iotests.py-implement-unsupported_imgopts.patch delete mode 100644 iotests.py-qemu_img-create-support-IMGOP.patch delete mode 100644 iotests.py-rewrite-default-luks-support-.patch delete mode 100644 meson-build-all-modules-by-default.patch create mode 100644 modules-generates-per-target-modinfo.patch create mode 100644 modules-introduces-module_kconfig-direct.patch delete mode 100644 modules-quick-fix-a-fundamental-error-in.patch delete mode 100644 numa-Enable-numa-for-SGX-EPC-sections.patch delete mode 100644 numa-Support-SGX-numa-in-the-monitor-and.patch delete mode 100644 python-aqmp-Fix-negotiation-with-pre-oob.patch delete mode 100644 python-aqmp-add-SocketAddrT-to-package-r.patch delete mode 100644 python-aqmp-add-__del__-method-to-legacy.patch delete mode 100644 python-aqmp-add-_session_guard.patch delete mode 100644 python-aqmp-add-socket-bind-step-to-lega.patch delete mode 100644 python-aqmp-add-start_server-and-accept-.patch delete mode 100644 python-aqmp-copy-type-definitions-from-q.patch delete mode 100644 python-aqmp-drop-_bind_hack.patch delete mode 100644 python-aqmp-fix-docstring-typo.patch delete mode 100644 python-aqmp-fix-race-condition-in-legacy.patch delete mode 100644 python-aqmp-handle-asyncio.TimeoutError-.patch delete mode 100644 python-aqmp-refactor-_do_accept-into-two.patch delete mode 100644 python-aqmp-remove-_new_session-and-_est.patch delete mode 100644 python-aqmp-rename-AQMPError-to-QMPError.patch delete mode 100644 python-aqmp-rename-accept-to-start_serve.patch delete mode 100644 python-aqmp-split-_client_connected_cb-o.patch delete mode 100644 python-aqmp-squelch-pylint-warning-for-t.patch delete mode 100644 python-aqmp-stop-the-server-during-disco.patch delete mode 100644 python-introduce-qmp-shell-wrap-convenie.patch delete mode 100644 python-machine-raise-VMLaunchFailure-exc.patch delete mode 100644 python-move-qmp-shell-under-the-AQMP-pac.patch delete mode 100644 python-move-qmp-utilities-to-python-qemu.patch delete mode 100644 python-qmp-switch-qmp-shell-to-AQMP.patch delete mode 100644 python-support-recording-QMP-session-to-.patch delete mode 100644 python-upgrade-mypy-to-0.780.patch delete mode 100644 qcow2-simple-case-support-for-downgradin.patch delete mode 100644 qemu-6.2.0.tar.xz delete mode 100644 qemu-6.2.0.tar.xz.sig create mode 100644 qemu-7.0.0.tar.xz create mode 100644 qemu-7.0.0.tar.xz.sig delete mode 100644 qemu-binfmt-conf.sh-should-use-F-as-shor.patch delete mode 100644 seabios-use-python2-explicitly-as-needed.patch delete mode 100644 tests-qemu-iotests-040-Skip-TestCommitWi.patch delete mode 100644 tests-qemu-iotests-Fix-051-for-binaries-.patch delete mode 100644 tests-qemu-iotests-testrunner-Quote-case.patch delete mode 100644 tools-virtiofsd-Add-rseq-syscall-to-the-.patch delete mode 100644 virtiofsd-Drop-membership-of-all-supplem.patch diff --git a/DSDT.pcie b/DSDT.pcie new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..21afcd4aec3cc99d7eb079d126f400dff0f4c99122991850a8a62efd6e6f0e67 GIT binary patch literal 3023 zcmZveJ!~UY5XWcjb-aH5$l7t@d^mBSMWA)8=xC76UOS0VoGf1Ff-usagg_i=B7u;O z6H-WVKswG6wUHufTDp^{s5mML3a+7{q2#JF|Jj$#y;07Rci;cLnR)Y@wck!R?2dlR z6QzFd9Qu3VX6N0&-^9lvA|CVI?f)EwooIai#?G<7<3xM?ZtP{ZqRVh-bhr#i%qt3?XD?HGf1qXrWd%oTaiFE8cL+_Se+dmi{f_7Uk zsw}eb+aTdwR#oj`jw~wu^qf*e$jh>7IN;!u>Yw#tK{wcY(~3b-y=P?Fm6(% z!1F2vv6YB4M2jj#yD*#K@oKv(#a=Kh>9yDorio-v#E)%(s%@_ndnTq_Vr?3GLb4~a ziEY!dXOcmh*b`A>)3o-4X(HJZ8O5G$DWC)tv!?EAx+MV;LOCHiD^cACdosZ zoO6N`4;T3)rgM@L(&Wqv&aB|fN=`_V(-EAG;B+J>q{)dtgi&eyEOqtbV&)_#q{*oS zrxKh>azdJ%I6ZVt;%Af>oO#I!X>#Hp3(w?v76fNOazdJ%MZsAVoJGkAX>yhXXGw6D zBqyZFIWIWp1?Rlvgfux_!RZQ4S8_s{oMpjT7Mx|t32Aax1ZPEXRwO5+$+;jn7X;^m zoJ)dpNpLPnPDqmzhqUp#tqIPWf9{kz* zuTj7K{qbk*$8Y`d(Zz|fVX%d}gL~_g1;^n*i$gu&i)!$7>OPv>v%bViGq!F{mmW3HB|XoZG%ru8uSeZ*U{7Ds**v-R>)+w_7lZF={|r`s@dwk~GqueIL%@c2vpQ3Ox?}58cY6 A9{>OV literal 0 HcmV?d00001 diff --git a/Disable-some-tests-that-have-problems-in.patch b/Disable-some-tests-that-have-problems-in.patch new file mode 100644 index 00000000..f582b049 --- /dev/null +++ b/Disable-some-tests-that-have-problems-in.patch @@ -0,0 +1,83 @@ +From: Dario Faggioli +Date: Thu, 26 May 2022 04:03:03 +0200 +Subject: Disable some tests that have problems in OBS + +Git-commit: 0000000000000000000000000000000000000000 + +We are disabling the following tests: + +qemu-system-i386 / hd-geo-test +qemu-system-x86_64 / hd-geo-test +qemu-system-ppc64 / display-vga-test + +They are failing due to some memory corruption errors. We believe that +this might be due to the combination of the compiler version and of LTO, +and will take up the investigation within the upstream community. + +We are also skipping the following test: + + qemu-system-x86_64 / dbus-display-test + +The test seems to suffer from some kind of race condition. In fact, +under some runtime circumnstances (i.e., when running inside an OBS +worker), it fails because a connection to the dbus daemon cannot be +established. When Running the test locally (with 'osc build +--vm-type=kvm ...'), it is a lot harder to reproduce the problem. + +Also, if running the test manually with additional logging (--debug-log) +in OBS, the test has an higher success rate... Which is why we suspect a +race to be the issue. + +Since it cannot be reproduced locally, this is quite hard to debug. +Investigation will continue upstream. + +Signed-off-by: Dario Faggioli +--- + tests/qtest/meson.build | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build +index d25f82bb5ac0be9befb3e98de169..58a61b5f56d9e96fb3c0045b918d 100644 +--- a/tests/qtest/meson.build ++++ b/tests/qtest/meson.build +@@ -41,6 +41,12 @@ qtests_pci = \ + (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \ + (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : []) + ++# display-vga-test currently fails in OBS, for ppc64 ++qtests_pci_novga = \ ++ (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : []) ++ ++# This currently fails on OBS with qemu-system-i386|x86_64 ++#'hd-geo-test', + qtests_i386 = \ + (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ +@@ -77,7 +83,6 @@ qtests_i386 = \ + qtests_pci + \ + ['fdc-test', + 'ide-test', +- 'hd-geo-test', + 'boot-order-test', + 'rtc-test', + 'i440fx-test', +@@ -94,8 +99,9 @@ qtests_i386 = \ + 'test-filter-redirector' + ] + ++# Temporrily disabling due to races when running in OBS + if dbus_display +- qtests_i386 += ['dbus-display-test'] ++# qtests_i386 += ['dbus-display-test'] + endif + + dbus_daemon = find_program('dbus-daemon', required: false) +@@ -172,7 +178,7 @@ qtests_ppc64 = \ + (slirp.found() ? ['pxe-test'] : []) + \ + (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ + (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ +- qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test'] ++ qtests_pci_novga + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test'] + + qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) diff --git a/Fix-the-module-building-problem-for-s390.patch b/Fix-the-module-building-problem-for-s390.patch deleted file mode 100644 index a8497bb0..00000000 --- a/Fix-the-module-building-problem-for-s390.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Li Zhang -Date: Thu, 24 Mar 2022 11:47:08 +0100 -Subject: Fix the module building problem for s390 - -When building the testsuit for s390, it reports errors as the following: - -hw-display-virtio-gpu.so: undefined symbol: virtio_vmstate_info -hw-display-virtio-gpu-gl.so: undefined symbol: virtio_gpu_ctrl_response -hw-display-virtio-gpu-pci.so: undefined symbol: virtio_pci_types_register -hw-display-virtio-gpu-pci-gl.so: undefined symbol: virtio_pci_types_register - -Signed-off-by: Li Zhang ---- - util/module.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/util/module.c b/util/module.c -index 8370d4c6209eda4319342b202f6b..03896b7c469dedc5a80695aa7dee 100644 ---- a/util/module.c -+++ b/util/module.c -@@ -125,6 +125,10 @@ bool s390x_blocklist(const char *name) - "hw-display-qxl", - "hw-display-virtio-vga", - "hw-display-virtio-vga-gl", -+ "hw-display-virtio-gpu", -+ "hw-display-virtio-gpu-gl", -+ "hw-display-virtio-gpu-pci", -+ "hw-display-virtio-gpu-pci-gl", - "hw-usb-host", - "hw-usb-redirect", - "hw-usb-smartcard" diff --git a/Ignore-spurious-GCC-12-warning.patch b/Ignore-spurious-GCC-12-warning.patch index 53aebc6a..918969c5 100644 --- a/Ignore-spurious-GCC-12-warning.patch +++ b/Ignore-spurious-GCC-12-warning.patch @@ -51,7 +51,7 @@ index 2ffefa8ceeeff9a1d0504ad71918..c9fb4329843a8fc34e596b506571 100644 // Template for an end-of-device path node. // diff --git a/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c b/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c -index fcb911f4fc34e560fd06001f91dd..589ffe94982ccfa3651216d0571f 100644 +index 949025c333251bc5776159a6c535..be55a529743494677f8515906c6c 100644 --- a/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c @@ -36,6 +36,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent @@ -81,12 +81,12 @@ index d54a4f9e0a7d67b7c8494ab37011..fb40ad36584c1cd53cc7ca4a9d4f 100644 NULL, // 0x00 - reserved "EFI_SECTION_COMPRESSION", // 0x01 diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c -index e281716fee1bfb5eb236c9e38dbd..773114584add6e1f0f6e966e26e5 100644 +index 4e9b499f8d80dc4d6bc13515e794..ab9b7cc34f69bceb74c454ce5032 100644 --- a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c +++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c -@@ -38,6 +38,10 @@ static unsigned g_STAT_OFFSET = 0; - #define kNumBitPriceShiftBits 4 - #define kBitPrice (1 << kNumBitPriceShiftBits) +@@ -40,6 +40,10 @@ static unsigned g_STAT_OFFSET = 0; + + #define REP_LEN_COUNT 64 +#if __GNUC__ >= 12 +# pragma GCC diagnostic ignored "-Wdangling-pointer" diff --git a/Makefile-Don-t-check-pc-bios-as-pre-requ.patch b/Makefile-Don-t-check-pc-bios-as-pre-requ.patch index 4c0acdc1..80e5d109 100644 --- a/Makefile-Don-t-check-pc-bios-as-pre-requ.patch +++ b/Makefile-Don-t-check-pc-bios-as-pre-requ.patch @@ -13,7 +13,7 @@ Signed-off-by: Dario Faggioli 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 74c5b46d38b501f9dd25f447ed08..87ae3ba6efe74e6c48d2a6db970f 100644 +index e5fd1ebdf6199c4cb15780e90236..e5881a951fc05d479b032c0b56d8 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ x := $(shell rm -rf meson-private meson-info meson-logs) diff --git a/Makefile-fix-build-with-binutils-2.38.patch b/Makefile-fix-build-with-binutils-2.38.patch index 9b16faae..18fd7721 100644 --- a/Makefile-fix-build-with-binutils-2.38.patch +++ b/Makefile-fix-build-with-binutils-2.38.patch @@ -29,20 +29,20 @@ Signed-off-by: Dario Faggioli 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roms/opensbi/Makefile b/roms/opensbi/Makefile -index d6f097d30af78c0fba92eeeec523..a294f46fa8e16caec64d5a88c2a2 100644 +index 062883e9695fb4447d2e61d7f282..fc1ea13e519a702e8b09d9006a2c 100644 --- a/roms/opensbi/Makefile +++ b/roms/opensbi/Makefile -@@ -106,6 +106,9 @@ ifndef PLATFORM_RISCV_XLEN - endif - endif +@@ -153,6 +153,9 @@ OPENSBI_LD_PIE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) $(USE_LD_FLAG) -fP + # Check whether the compiler supports -m(no-)save-restore + CC_SUPPORT_SAVE_RESTORE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -mno-save-restore -x c /dev/null -o /dev/null 2>&1 | grep "\-save\-restore" >/dev/null && echo n || echo y) +# Check whether the assembler and the compiler support the Zicsr and Zifencei extensions +CC_SUPPORT_ZICSR_ZIFENCEI := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -march=rv$(OPENSBI_CC_XLEN)imafd_zicsr_zifencei -x c /dev/null -o /dev/null 2>&1 | grep "zicsr\|zifencei" > /dev/null && echo n || echo y) + - # Setup list of objects.mk files - ifdef PLATFORM - platform-object-mks=$(shell if [ -d $(platform_src_dir)/ ]; then find $(platform_src_dir) -iname "objects.mk" | sort -r; fi) -@@ -157,7 +160,11 @@ ifndef PLATFORM_RISCV_ABI + # Build Info: + # OPENSBI_BUILD_TIME_STAMP -- the compilation time stamp + # OPENSBI_BUILD_COMPILER_VERSION -- the compiler version info +@@ -223,7 +226,11 @@ ifndef PLATFORM_RISCV_ABI endif ifndef PLATFORM_RISCV_ISA ifneq ($(PLATFORM_RISCV_TOOLCHAIN_DEFAULT), 1) diff --git a/PPC-KVM-Disable-mmu-notifier-check.patch b/PPC-KVM-Disable-mmu-notifier-check.patch index 560a61b8..daf4cd60 100644 --- a/PPC-KVM-Disable-mmu-notifier-check.patch +++ b/PPC-KVM-Disable-mmu-notifier-check.patch @@ -14,10 +14,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 2 insertions(+) diff --git a/softmmu/physmem.c b/softmmu/physmem.c -index 3524c04c2a162b717c3975cc15da..f69d6b00467f8b53614171fa17a9 100644 +index 4e1b27a20eccca027515aee6f78f..02aa7205a4992a678414111f625c 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c -@@ -2064,11 +2064,13 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, +@@ -2066,11 +2066,13 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, return NULL; } diff --git a/Python-aqmp-fix-type-definitions-for-myp.patch b/Python-aqmp-fix-type-definitions-for-myp.patch deleted file mode 100644 index dfca8007..00000000 --- a/Python-aqmp-fix-type-definitions-for-myp.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 14:13:48 -0500 -Subject: Python/aqmp: fix type definitions for mypy 0.920 - -Git-commit: 42d73f2894ea1855df5a25d58e0d9eac6023dcc3 - -0.920 (Released 2021-12-15) is not entirely happy with the -way that I was defining _FutureT: - -qemu/aqmp/protocol.py:601: error: Item "object" of the upper bound -"Optional[Future[Any]]" of type variable "_FutureT" has no attribute -"done" - -Update it with something a little mechanically simpler that works better -across a wider array of mypy versions. - -Signed-off-by: John Snow -Message-id: 20220110191349.1841027-3-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 5190b33b13df24fc2ca4aed934ed..c4fbe35a0e41c589059ec4fa37a8 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -43,8 +43,8 @@ from .util import ( - - - T = TypeVar('T') -+_U = TypeVar('_U') - _TaskFN = Callable[[], Awaitable[None]] # aka ``async def func() -> None`` --_FutureT = TypeVar('_FutureT', bound=Optional['asyncio.Future[Any]']) - - - class Runstate(Enum): -@@ -591,7 +591,8 @@ class AsyncProtocol(Generic[T]): - """ - Fully reset this object to a clean state and return to `IDLE`. - """ -- def _paranoid_task_erase(task: _FutureT) -> Optional[_FutureT]: -+ def _paranoid_task_erase(task: Optional['asyncio.Future[_U]'] -+ ) -> Optional['asyncio.Future[_U]']: - # Help to erase a task, ENSURING it is fully quiesced first. - assert (task is None) or task.done() - return None if (task and task.done()) else task diff --git a/Raise-soft-address-space-limit-to-hard-l.patch b/Raise-soft-address-space-limit-to-hard-l.patch index 1c5d7ea5..8657eab9 100644 --- a/Raise-soft-address-space-limit-to-hard-l.patch +++ b/Raise-soft-address-space-limit-to-hard-l.patch @@ -16,10 +16,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 12 insertions(+) diff --git a/softmmu/vl.c b/softmmu/vl.c -index 620a1f1367e2b033bfec541619d3..527e1d91859b19351d397ef64930 100644 +index 6f646531a0aeb6ff2dd3fc8a5cd8..f0f2f190a4a84af95ccaac353bb1 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c -@@ -40,6 +40,7 @@ +@@ -41,6 +41,7 @@ #include "sysemu/reset.h" #include "sysemu/runstate.h" #include "sysemu/runstate-action.h" @@ -27,7 +27,7 @@ index 620a1f1367e2b033bfec541619d3..527e1d91859b19351d397ef64930 100644 #include "sysemu/seccomp.h" #include "sysemu/tcg.h" #include "sysemu/xen.h" -@@ -2772,6 +2773,17 @@ void qemu_init(int argc, char **argv, char **envp) +@@ -2778,6 +2779,17 @@ void qemu_init(int argc, char **argv, char **envp) MachineClass *machine_class; bool userconfig = true; FILE *vmstate_dump_file = NULL; diff --git a/Revert-8dcb404bff6d9147765d7dd3e9c849337.patch b/Revert-8dcb404bff6d9147765d7dd3e9c849337.patch new file mode 100644 index 00000000..dbd656df --- /dev/null +++ b/Revert-8dcb404bff6d9147765d7dd3e9c849337.patch @@ -0,0 +1,55 @@ +From: Dario Faggioli +Date: Tue, 24 May 2022 20:52:17 +0200 +Subject: Revert 8dcb404bff6d9147765d7dd3e9c8493372186420 + +Git-commit: 0000000000000000000000000000000000000000 + +Revert commit "tests/qtest: enable more vhost-user tests by default" +(8dcb404bff6d9), as it causes prooblem when building with GCC 12 and LTO +enabled. + +This should be considered temporary, until the actual reason why the +code of the tests that are added in that commit breaks. + +It has been reported upstream, and will be (hopefully) solved there: +https://lore.kernel.org/qemu-devel/1d3bbff9e92e7c8a24db9e140dcf3f428c2df103.camel@suse.com/ + +Signed-off-by: Dario Faggioli +--- + tests/qtest/vhost-user-test.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c +index ee30f54796485e1fb2cab1fe7641..6e79935c47e6f7fab9741cdf9e50 100644 +--- a/tests/qtest/vhost-user-test.c ++++ b/tests/qtest/vhost-user-test.c +@@ -995,17 +995,20 @@ static void register_vhost_user_test(void) + "virtio-net", + test_migrate, &opts); + +- opts.before = vhost_user_test_setup_reconnect; +- qos_add_test("vhost-user/reconnect", "virtio-net", +- test_reconnect, &opts); ++ /* keeps failing on build-system since Aug 15 2017 */ ++ if (getenv("QTEST_VHOST_USER_FIXME")) { ++ opts.before = vhost_user_test_setup_reconnect; ++ qos_add_test("vhost-user/reconnect", "virtio-net", ++ test_reconnect, &opts); + +- opts.before = vhost_user_test_setup_connect_fail; +- qos_add_test("vhost-user/connect-fail", "virtio-net", +- test_vhost_user_started, &opts); ++ opts.before = vhost_user_test_setup_connect_fail; ++ qos_add_test("vhost-user/connect-fail", "virtio-net", ++ test_vhost_user_started, &opts); + +- opts.before = vhost_user_test_setup_flags_mismatch; +- qos_add_test("vhost-user/flags-mismatch", "virtio-net", +- test_vhost_user_started, &opts); ++ opts.before = vhost_user_test_setup_flags_mismatch; ++ qos_add_test("vhost-user/flags-mismatch", "virtio-net", ++ test_vhost_user_started, &opts); ++ } + + opts.before = vhost_user_test_setup_multiqueue; + opts.edge.extra_device_opts = "mq=on"; diff --git a/Revert-qht-constify-qht_statistics_init.patch b/Revert-qht-constify-qht_statistics_init.patch index 34d78525..523ac9f4 100644 --- a/Revert-qht-constify-qht_statistics_init.patch +++ b/Revert-qht-constify-qht_statistics_init.patch @@ -27,10 +27,10 @@ index 758c7ac6c89978ee762e9d946584..2e2d6bca932c83bea993850b60f8 100644 /** * qht_statistics_destroy - Destroy a &struct qht_stats diff --git a/util/qht.c b/util/qht.c -index 079605121b1452dac9937b0e6137..cfc2c60639af8f7905aae51c53bb 100644 +index 065fc501f44c46dffac74134ee2c..0803c194d10b5cdafdc8b18ec083 100644 --- a/util/qht.c +++ b/util/qht.c -@@ -901,9 +901,9 @@ bool qht_resize(struct qht *ht, size_t n_elems) +@@ -902,9 +902,9 @@ bool qht_resize(struct qht *ht, size_t n_elems) } /* pass @stats to qht_statistics_destroy() when done */ @@ -42,7 +42,7 @@ index 079605121b1452dac9937b0e6137..cfc2c60639af8f7905aae51c53bb 100644 int i; map = qatomic_rcu_read(&ht->map); -@@ -920,8 +920,8 @@ void qht_statistics_init(const struct qht *ht, struct qht_stats *stats) +@@ -921,8 +921,8 @@ void qht_statistics_init(const struct qht *ht, struct qht_stats *stats) stats->head_buckets = map->n_buckets; for (i = 0; i < map->n_buckets; i++) { diff --git a/Revert-roms-efirom-tests-uefi-test-tools.patch b/Revert-roms-efirom-tests-uefi-test-tools.patch index 37c3473d..c253db00 100644 --- a/Revert-roms-efirom-tests-uefi-test-tools.patch +++ b/Revert-roms-efirom-tests-uefi-test-tools.patch @@ -15,7 +15,7 @@ Signed-off-by: Bruce Rogers 2 files changed, 3 deletions(-) diff --git a/roms/Makefile b/roms/Makefile -index 66d06f5831303c3d41e943290389..6ea8edd9fcf6bb0cdc1f1602f241 100644 +index 3d53bd528666b594ab3d6b631450..c7c6e973db59572e8b8bee74e969 100644 --- a/roms/Makefile +++ b/roms/Makefile @@ -151,8 +151,6 @@ build-efi-roms: build-pxe-roms diff --git a/XXX-dont-dump-core-on-sigabort.patch b/XXX-dont-dump-core-on-sigabort.patch index 61e8d5be..4f2a9458 100644 --- a/XXX-dont-dump-core-on-sigabort.patch +++ b/XXX-dont-dump-core-on-sigabort.patch @@ -8,11 +8,11 @@ Signed-off-by: Bruce Rogers 1 file changed, 6 insertions(+) diff --git a/linux-user/signal.c b/linux-user/signal.c -index 6d5e5b698cc827416b4fdf78aac3..41ec78926582729c91f486f1fb15 100644 +index 092e70b80c6ffb83fc52ff6d6a0a..b918084cc769c9bc1d15fbfad792 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c -@@ -734,6 +734,10 @@ static void QEMU_NORETURN dump_core_and_abort(int target_sig) - trace_user_force_sig(env, target_sig, host_sig); +@@ -737,6 +737,10 @@ static void QEMU_NORETURN dump_core_and_abort(int target_sig) + trace_user_dump_core_and_abort(env, target_sig, host_sig); gdb_signalled(env, target_sig); + if (target_sig == 6) { @@ -22,7 +22,7 @@ index 6d5e5b698cc827416b4fdf78aac3..41ec78926582729c91f486f1fb15 100644 /* dump core if supported by target binary format */ if (core_dump_signal(target_sig) && (ts->bprm->core_dump != NULL)) { stop_all_tasks(); -@@ -751,6 +755,8 @@ static void QEMU_NORETURN dump_core_and_abort(int target_sig) +@@ -754,6 +758,8 @@ static void QEMU_NORETURN dump_core_and_abort(int target_sig) target_sig, strsignal(host_sig), "core dumped" ); } diff --git a/_multibuild b/_multibuild index 1d350a8b..ffbdb22f 100644 --- a/_multibuild +++ b/_multibuild @@ -1,4 +1,3 @@ linux-user - testsuite diff --git a/acpi-validate-hotplug-selector-on-access.patch b/acpi-validate-hotplug-selector-on-access.patch deleted file mode 100644 index 53b40f32..00000000 --- a/acpi-validate-hotplug-selector-on-access.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: "Michael S. Tsirkin" -Date: Tue, 21 Dec 2021 09:45:44 -0500 -Subject: acpi: validate hotplug selector on access -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 9bd6565ccee68f72d5012e24646e12a1c662827e -References: bsc#1194063 - -When bus is looked up on a pci write, we didn't -validate that the lookup succeeded. -Fuzzers thus can trigger QEMU crash by dereferencing the NULL -bus pointer. - -Fixes: b32bd763a1 ("pci: introduce acpi-index property for PCI device") -Fixes: CVE-2021-4158 -Cc: "Igor Mammedov" -Fixes: https://gitlab.com/qemu-project/qemu/-/issues/770 -Signed-off-by: Michael S. Tsirkin -Reviewed-by: Philippe Mathieu-Daudé -Reviewed-by: Ani Sinha -Signed-off-by: Li Zhang ---- - hw/acpi/pcihp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c -index 30405b5113d7fb5a259a9d9cbd76..a5e182dd3a372fee2805923a314c 100644 ---- a/hw/acpi/pcihp.c -+++ b/hw/acpi/pcihp.c -@@ -491,6 +491,9 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data, - } - - bus = acpi_pcihp_find_hotplug_bus(s, s->hotplug_select); -+ if (!bus) { -+ break; -+ } - QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { - Object *o = OBJECT(kid->child); - PCIDevice *dev = PCI_DEVICE(o); diff --git a/acpi_piix4-Fix-migration-from-SLE11-SP2.patch b/acpi_piix4-Fix-migration-from-SLE11-SP2.patch index a8962c0a..aaa0629f 100644 --- a/acpi_piix4-Fix-migration-from-SLE11-SP2.patch +++ b/acpi_piix4-Fix-migration-from-SLE11-SP2.patch @@ -16,10 +16,10 @@ Signed-off-by: Andreas Färber 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c -index f0b5fac44a14279ac3c66834bfb1..42c1a7a816cbdb22b16876dc6f8c 100644 +index fe5625d07a289800831170f7e41f..dd005ff2fc097f72947a62d91b96 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c -@@ -278,7 +278,7 @@ static bool piix4_vmstate_need_smbus(void *opaque, int version_id) +@@ -287,7 +287,7 @@ static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id) static const VMStateDescription vmstate_acpi = { .name = "piix4_pm", .version_id = 3, diff --git a/block-backend-Retain-permissions-after-m.patch b/block-backend-Retain-permissions-after-m.patch deleted file mode 100644 index 8faba25d..00000000 --- a/block-backend-Retain-permissions-after-m.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Hanna Reitz -Date: Thu, 25 Nov 2021 14:53:16 +0100 -Subject: block-backend: Retain permissions after migration -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 492a119610129f65217580790971fa038e5492d3 - -After migration, the permissions the guest device wants to impose on its -BlockBackend are stored in blk->perm and blk->shared_perm. In -blk_root_activate(), we take our permissions, but keep all shared -permissions open by calling `blk_set_perm(blk->perm, BLK_PERM_ALL)`. - -Only afterwards (immediately or later, depending on the runstate) do we -restrict the shared permissions by calling -`blk_set_perm(blk->perm, blk->shared_perm)`. Unfortunately, our first -call with shared_perm=BLK_PERM_ALL has overwritten blk->shared_perm to -be BLK_PERM_ALL, so this is a no-op and the set of shared permissions is -not restricted. - -Fix this bug by saving the set of shared permissions before invoking -blk_set_perm() with BLK_PERM_ALL and restoring it afterwards. - -Fixes: 5f7772c4d0cf32f4e779fcd5a69ae4dae24aeebf - ("block-backend: Defer shared_perm tightening migration - completion") -Reported-by: Peng Liang -Signed-off-by: Hanna Reitz -Message-Id: <20211125135317.186576-2-hreitz@redhat.com> -Reviewed-by: Philippe Mathieu-Daudé -Tested-by: Peng Liang -Signed-off-by: Li Zhang ---- - block/block-backend.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/block/block-backend.c b/block/block-backend.c -index 12ef80ea170c04a15500b42bc5e7..41e388fe1f30af8f3cf6a872b37a 100644 ---- a/block/block-backend.c -+++ b/block/block-backend.c -@@ -190,6 +190,7 @@ static void blk_root_activate(BdrvChild *child, Error **errp) - { - BlockBackend *blk = child->opaque; - Error *local_err = NULL; -+ uint64_t saved_shared_perm; - - if (!blk->disable_perm) { - return; -@@ -197,12 +198,22 @@ static void blk_root_activate(BdrvChild *child, Error **errp) - - blk->disable_perm = false; - -+ /* -+ * blk->shared_perm contains the permissions we want to share once -+ * migration is really completely done. For now, we need to share -+ * all; but we also need to retain blk->shared_perm, which is -+ * overwritten by a successful blk_set_perm() call. Save it and -+ * restore it below. -+ */ -+ saved_shared_perm = blk->shared_perm; -+ - blk_set_perm(blk, blk->perm, BLK_PERM_ALL, &local_err); - if (local_err) { - error_propagate(errp, local_err); - blk->disable_perm = true; - return; - } -+ blk->shared_perm = saved_shared_perm; - - if (runstate_check(RUN_STATE_INMIGRATE)) { - /* Activation can happen when migration process is still active, for diff --git a/brotli-fix-actual-variable-array-paramet.patch b/brotli-fix-actual-variable-array-paramet.patch deleted file mode 100644 index 83d2695d..00000000 --- a/brotli-fix-actual-variable-array-paramet.patch +++ /dev/null @@ -1,49 +0,0 @@ -From: Bruce Rogers -Date: Fri, 5 Mar 2021 13:25:44 -0700 -Subject: brotli: fix actual variable-array parameters to match declaration - -References: boo#1181922 - -GCC 11 complains about the mismatch between the variable-array -parameters not being defined as such in the actual function definition. -Make them match. - -Signed-off-by: Bruce Rogers ---- - c/dec/decode.c | 6 ++++-- - c/enc/encode.c | 5 +++-- - 2 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c -index 114c5057d7d91f5a634167e00d84..bb6f1ab6cc42f54720fd07f665e3 100644 ---- a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c -+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c -@@ -2030,8 +2030,10 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands( - } - - BrotliDecoderResult BrotliDecoderDecompress( -- size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, -- uint8_t* decoded_buffer) { -+ size_t encoded_size, -+ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], -+ size_t* decoded_size, -+ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) { - BrotliDecoderState s; - BrotliDecoderResult result; - size_t total_out = 0; -diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c -index 68548ef55af8036d6f0fe720e721..ab0a4906060c98461102d45ab61d 100644 ---- a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c -+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c -@@ -1470,8 +1470,9 @@ static size_t MakeUncompressedStream( - - BROTLI_BOOL BrotliEncoderCompress( - int quality, int lgwin, BrotliEncoderMode mode, size_t input_size, -- const uint8_t* input_buffer, size_t* encoded_size, -- uint8_t* encoded_buffer) { -+ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)], -+ size_t* encoded_size, -+ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) { - BrotliEncoderState* s; - size_t out_size = *encoded_size; - const uint8_t* input_start = input_buffer; diff --git a/bundles.tar.xz b/bundles.tar.xz index 23016b2f..ac3bb3a9 100644 --- a/bundles.tar.xz +++ b/bundles.tar.xz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ecf0e91f78b91cabf0df72e0dd9c54c9d2d016e581abd8364eea6cc6103df94 -size 135948 +oid sha256:2a9a85da3441aa692c1ba535a417d4b04ad870ae0b2ecf640dec6dc61461ba07 +size 58240 diff --git a/config.sh b/config.sh index 2ad96aef..eff75d02 100644 --- a/config.sh +++ b/config.sh @@ -18,12 +18,12 @@ UPSTREAM_GIT_REPO=https://gitlab.com/qemu-project/qemu.git # The following specifies the upstream tag or commit upon which our patchqueue # gets rebased. The special value LATEST may be used to "automatically" track # the upstream development tree in the master branch -GIT_UPSTREAM_COMMIT_ISH=v6.2.0 +GIT_UPSTREAM_COMMIT_ISH=v7.0.0 # WARNING: If transitioning from using LATEST to not, MANUALLY re-set the # tarball present. If transitioning TO LATEST, make sure that # NEXT_RELEASE_IS_MAJOR is set correctly # This is used to choose the version number when LATEST processing is active -NEXT_RELEASE_IS_MAJOR=1 +NEXT_RELEASE_IS_MAJOR=0 # Unfortunately, SeaBIOS doesn't always follow an "always increasing" version # model, so there may be times we should overide the automated version setting. @@ -38,6 +38,11 @@ PATCH_RANGE=1000 # For compatibility with old packages, we include this option OVERRIDE_FIVE_DIGIT_NUMBERING=0 +# Path to be used for temporary files, directories, repositories, etc. +# Default is /dev/shm. An alternative could be /tmp (e.g., when building +# in containers, or whatever). +TMPDIR=/dev/shm + # This array tracks all git submodule paths within the superproject (1st entry) PATCH_PATH_MAP=( "" @@ -63,6 +68,7 @@ PATCH_PATH_MAP=( "meson/" "tests/fp/berkeley-softfloat-3/" "tests/fp/berkeley-testfloat-3/" + "tests/lcitool/libvirt-ci" "roms/edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3/" "roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/" "roms/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5/" @@ -72,10 +78,7 @@ PATCH_PATH_MAP=( "roms/edk2/MdeModulePkg/Universal/RegularExpressionDxe/oniguruma/" "roms/edk2/UnitTestFrameworkPkg/Library/CmockaLib/cmocka/" "roms/vbootrom/" - "roms/edk2/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/research/esaxx/" - "roms/edk2/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/research/libdivsufsort/" - "roms/edk2/MdeModulePkg/Library/BrotliCompress/brotli/research/esaxx/" - "roms/edk2/MdeModulePkg/Library/BrotliCompress/brotli/research/libdivsufsort/" + "roms/edk2/RedfishPkg/Library/JsonLib/jansson" ) # (order and count must correspond to PATCH_PATH_MAP) @@ -103,6 +106,7 @@ LOCAL_REPO_MAP=( ~/git/qemu-meson ~/git/qemu-tests-berkeley-softfloat-3 ~/git/qemu-tests-berkeley-testfloat-3 + ~/git/qemu-tests-lcitool-libvirt-ci ~/git/qemu-edk2-berkeley-softfloat-3 ~/git/qemu-edk2-openssl-boringssl ~/git/qemu-edk2-openssl-krb5 @@ -112,8 +116,5 @@ LOCAL_REPO_MAP=( ~/git/qemu-edk2-oniguruma ~/git/qemu-edk2-cmocka ~/git/qemu-vbootrom - ~/git/qemu-edk2-BrotliCustomDecompressLib-brotli-research-esaxx - ~/git/qemu-edk2-BrotliCustomDecompressLib-brotli-research-libdivsufsort - ~/git/qemu-edk2-BrotliCompress-brotli-research-esaxx - ~/git/qemu-edk2-BrotliCompress-brotli-research-libdivsufsort + ~/git/qemu-edk2-jansson ) diff --git a/configure-only-populate-roms-if-softmmu.patch b/configure-only-populate-roms-if-softmmu.patch index 429bb6c3..8e8eb1d0 100644 --- a/configure-only-populate-roms-if-softmmu.patch +++ b/configure-only-populate-roms-if-softmmu.patch @@ -12,10 +12,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure -index 48c21775f3a90c91631d90bd6e3e..e53fc9b91a69870e354ba2f27475 100755 +index 7c08c18358becf49779c876b0f3d..a35b63b2106900e6f7ff46d2b8da 100755 --- a/configure +++ b/configure -@@ -3373,7 +3373,7 @@ fi +@@ -2725,7 +2725,7 @@ fi # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 # or -march=z10 (which is the lowest architecture level that Clang supports) diff --git a/configure-remove-pkgversion-from-CONFIG_.patch b/configure-remove-pkgversion-from-CONFIG_.patch index 2a5d088a..7b6f677c 100644 --- a/configure-remove-pkgversion-from-CONFIG_.patch +++ b/configure-remove-pkgversion-from-CONFIG_.patch @@ -18,10 +18,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure -index e53fc9b91a69870e354ba2f27475..5312dc66dd293857ef916f3dde44 100755 +index a35b63b2106900e6f7ff46d2b8da..b031106ff395bf5092348780dbb6 100755 --- a/configure +++ b/configure -@@ -3509,7 +3509,7 @@ echo "TARGET_DIRS=$target_list" >> $config_host_mak +@@ -2823,7 +2823,7 @@ echo "TARGET_DIRS=$target_list" >> $config_host_mak if test "$modules" = "yes"; then # $shacmd can generate a hash started with digit, which the compiler doesn't # like as an symbol. So prefix it with an underscore diff --git a/coroutine-ucontext-use-QEMU_DEFINE_STATI.patch b/coroutine-ucontext-use-QEMU_DEFINE_STATI.patch new file mode 100644 index 00000000..ff69b94c --- /dev/null +++ b/coroutine-ucontext-use-QEMU_DEFINE_STATI.patch @@ -0,0 +1,122 @@ +From: Stefan Hajnoczi +Date: Mon, 7 Mar 2022 15:38:51 +0000 +Subject: coroutine-ucontext: use QEMU_DEFINE_STATIC_CO_TLS() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Git-commit: 34145a307d849d0b6734d0222a7aa0bb9eef7407 + +Thread-Local Storage variables cannot be used directly from coroutine +code because the compiler may optimize TLS variable accesses across +qemu_coroutine_yield() calls. When the coroutine is re-entered from +another thread the TLS variables from the old thread must no longer be +used. + +Use QEMU_DEFINE_STATIC_CO_TLS() for the current and leader variables. + +Signed-off-by: Stefan Hajnoczi +Message-Id: <20220307153853.602859-2-stefanha@redhat.com> +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Kevin Wolf +[DF: see: https://bugzilla.redhat.com/show_bug.cgi?id=1952483] +Signed-off-by: Dario Faggioli +--- + util/coroutine-ucontext.c | 38 ++++++++++++++++++++++++-------------- + 1 file changed, 24 insertions(+), 14 deletions(-) + +diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c +index 904b375192cab6d24c2bdea46d8c..127d5a13c8e77cae82cbb7cb5129 100644 +--- a/util/coroutine-ucontext.c ++++ b/util/coroutine-ucontext.c +@@ -25,6 +25,7 @@ + #include "qemu/osdep.h" + #include + #include "qemu/coroutine_int.h" ++#include "qemu/coroutine-tls.h" + + #ifdef CONFIG_VALGRIND_H + #include +@@ -66,8 +67,8 @@ typedef struct { + /** + * Per-thread coroutine bookkeeping + */ +-static __thread CoroutineUContext leader; +-static __thread Coroutine *current; ++QEMU_DEFINE_STATIC_CO_TLS(Coroutine *, current); ++QEMU_DEFINE_STATIC_CO_TLS(CoroutineUContext, leader); + + /* + * va_args to makecontext() must be type 'int', so passing +@@ -97,14 +98,15 @@ static inline __attribute__((always_inline)) + void finish_switch_fiber(void *fake_stack_save) + { + #ifdef CONFIG_ASAN ++ CoroutineUContext *leaderp = get_ptr_leader(); + const void *bottom_old; + size_t size_old; + + __sanitizer_finish_switch_fiber(fake_stack_save, &bottom_old, &size_old); + +- if (!leader.stack) { +- leader.stack = (void *)bottom_old; +- leader.stack_size = size_old; ++ if (!leaderp->stack) { ++ leaderp->stack = (void *)bottom_old; ++ leaderp->stack_size = size_old; + } + #endif + #ifdef CONFIG_TSAN +@@ -161,8 +163,10 @@ static void coroutine_trampoline(int i0, int i1) + + /* Initialize longjmp environment and switch back the caller */ + if (!sigsetjmp(self->env, 0)) { +- start_switch_fiber_asan(COROUTINE_YIELD, &fake_stack_save, leader.stack, +- leader.stack_size); ++ CoroutineUContext *leaderp = get_ptr_leader(); ++ ++ start_switch_fiber_asan(COROUTINE_YIELD, &fake_stack_save, ++ leaderp->stack, leaderp->stack_size); + start_switch_fiber_tsan(&fake_stack_save, self, true); /* true=caller */ + siglongjmp(*(sigjmp_buf *)co->entry_arg, 1); + } +@@ -297,7 +301,7 @@ qemu_coroutine_switch(Coroutine *from_, Coroutine *to_, + int ret; + void *fake_stack_save = NULL; + +- current = to_; ++ set_current(to_); + + ret = sigsetjmp(from->env, 0); + if (ret == 0) { +@@ -315,18 +319,24 @@ qemu_coroutine_switch(Coroutine *from_, Coroutine *to_, + + Coroutine *qemu_coroutine_self(void) + { +- if (!current) { +- current = &leader.base; ++ Coroutine *self = get_current(); ++ CoroutineUContext *leaderp = get_ptr_leader(); ++ ++ if (!self) { ++ self = &leaderp->base; ++ set_current(self); + } + #ifdef CONFIG_TSAN +- if (!leader.tsan_co_fiber) { +- leader.tsan_co_fiber = __tsan_get_current_fiber(); ++ if (!leaderp->tsan_co_fiber) { ++ leaderp->tsan_co_fiber = __tsan_get_current_fiber(); + } + #endif +- return current; ++ return self; + } + + bool qemu_in_coroutine(void) + { +- return current && current->caller; ++ Coroutine *self = get_current(); ++ ++ return self && self->caller; + } diff --git a/coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch b/coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch new file mode 100644 index 00000000..2d2eeced --- /dev/null +++ b/coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch @@ -0,0 +1,124 @@ +From: Stefan Hajnoczi +Date: Mon, 7 Mar 2022 15:38:52 +0000 +Subject: coroutine: use QEMU_DEFINE_STATIC_CO_TLS() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Git-commit: ac387a08a9c9f6b36757da912f0339c25f421f90 + +Thread-Local Storage variables cannot be used directly from coroutine +code because the compiler may optimize TLS variable accesses across +qemu_coroutine_yield() calls. When the coroutine is re-entered from +another thread the TLS variables from the old thread must no longer be +used. + +Use QEMU_DEFINE_STATIC_CO_TLS() for the current and leader variables. +The alloc_pool QSLIST needs a typedef so the return value of +get_ptr_alloc_pool() can be stored in a local variable. + +One example of why this code is necessary: a coroutine that yields +before calling qemu_coroutine_create() to create another coroutine is +affected by the TLS issue. + +Signed-off-by: Stefan Hajnoczi +Message-Id: <20220307153853.602859-3-stefanha@redhat.com> +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Kevin Wolf +[DF: see: https://bugzilla.redhat.com/show_bug.cgi?id=1952483] +Signed-off-by: Dario Faggioli +--- + util/qemu-coroutine.c | 41 ++++++++++++++++++++++++----------------- + 1 file changed, 24 insertions(+), 17 deletions(-) + +diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c +index c03b2422ff686e7138bf7bf0abba..f3e8300c8d2ec64fc16fa562a518 100644 +--- a/util/qemu-coroutine.c ++++ b/util/qemu-coroutine.c +@@ -18,6 +18,7 @@ + #include "qemu/atomic.h" + #include "qemu/coroutine.h" + #include "qemu/coroutine_int.h" ++#include "qemu/coroutine-tls.h" + #include "block/aio.h" + + /** Initial batch size is 64, and is increased on demand */ +@@ -29,17 +30,20 @@ enum { + static QSLIST_HEAD(, Coroutine) release_pool = QSLIST_HEAD_INITIALIZER(pool); + static unsigned int pool_batch_size = POOL_INITIAL_BATCH_SIZE; + static unsigned int release_pool_size; +-static __thread QSLIST_HEAD(, Coroutine) alloc_pool = QSLIST_HEAD_INITIALIZER(pool); +-static __thread unsigned int alloc_pool_size; +-static __thread Notifier coroutine_pool_cleanup_notifier; ++ ++typedef QSLIST_HEAD(, Coroutine) CoroutineQSList; ++QEMU_DEFINE_STATIC_CO_TLS(CoroutineQSList, alloc_pool); ++QEMU_DEFINE_STATIC_CO_TLS(unsigned int, alloc_pool_size); ++QEMU_DEFINE_STATIC_CO_TLS(Notifier, coroutine_pool_cleanup_notifier); + + static void coroutine_pool_cleanup(Notifier *n, void *value) + { + Coroutine *co; + Coroutine *tmp; ++ CoroutineQSList *alloc_pool = get_ptr_alloc_pool(); + +- QSLIST_FOREACH_SAFE(co, &alloc_pool, pool_next, tmp) { +- QSLIST_REMOVE_HEAD(&alloc_pool, pool_next); ++ QSLIST_FOREACH_SAFE(co, alloc_pool, pool_next, tmp) { ++ QSLIST_REMOVE_HEAD(alloc_pool, pool_next); + qemu_coroutine_delete(co); + } + } +@@ -49,27 +53,30 @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque) + Coroutine *co = NULL; + + if (CONFIG_COROUTINE_POOL) { +- co = QSLIST_FIRST(&alloc_pool); ++ CoroutineQSList *alloc_pool = get_ptr_alloc_pool(); ++ ++ co = QSLIST_FIRST(alloc_pool); + if (!co) { + if (release_pool_size > qatomic_read(&pool_batch_size)) { + /* Slow path; a good place to register the destructor, too. */ +- if (!coroutine_pool_cleanup_notifier.notify) { +- coroutine_pool_cleanup_notifier.notify = coroutine_pool_cleanup; +- qemu_thread_atexit_add(&coroutine_pool_cleanup_notifier); ++ Notifier *notifier = get_ptr_coroutine_pool_cleanup_notifier(); ++ if (!notifier->notify) { ++ notifier->notify = coroutine_pool_cleanup; ++ qemu_thread_atexit_add(notifier); + } + + /* This is not exact; there could be a little skew between + * release_pool_size and the actual size of release_pool. But + * it is just a heuristic, it does not need to be perfect. + */ +- alloc_pool_size = qatomic_xchg(&release_pool_size, 0); +- QSLIST_MOVE_ATOMIC(&alloc_pool, &release_pool); +- co = QSLIST_FIRST(&alloc_pool); ++ set_alloc_pool_size(qatomic_xchg(&release_pool_size, 0)); ++ QSLIST_MOVE_ATOMIC(alloc_pool, &release_pool); ++ co = QSLIST_FIRST(alloc_pool); + } + } + if (co) { +- QSLIST_REMOVE_HEAD(&alloc_pool, pool_next); +- alloc_pool_size--; ++ QSLIST_REMOVE_HEAD(alloc_pool, pool_next); ++ set_alloc_pool_size(get_alloc_pool_size() - 1); + } + } + +@@ -93,9 +100,9 @@ static void coroutine_delete(Coroutine *co) + qatomic_inc(&release_pool_size); + return; + } +- if (alloc_pool_size < qatomic_read(&pool_batch_size)) { +- QSLIST_INSERT_HEAD(&alloc_pool, co, pool_next); +- alloc_pool_size++; ++ if (get_alloc_pool_size() < qatomic_read(&pool_batch_size)) { ++ QSLIST_INSERT_HEAD(get_ptr_alloc_pool(), co, pool_next); ++ set_alloc_pool_size(get_alloc_pool_size() + 1); + return; + } + } diff --git a/coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch b/coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch new file mode 100644 index 00000000..9a381a5a --- /dev/null +++ b/coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch @@ -0,0 +1,89 @@ +From: Stefan Hajnoczi +Date: Mon, 7 Mar 2022 15:38:53 +0000 +Subject: coroutine-win32: use QEMU_DEFINE_STATIC_CO_TLS() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Git-commit: c1fe694357a328c807ae3cc6961c19e923448fcc + +Thread-Local Storage variables cannot be used directly from coroutine +code because the compiler may optimize TLS variable accesses across +qemu_coroutine_yield() calls. When the coroutine is re-entered from +another thread the TLS variables from the old thread must no longer be +used. + +Use QEMU_DEFINE_STATIC_CO_TLS() for the current and leader variables. + +I think coroutine-win32.c could get away with __thread because the +variables are only used in situations where either the stale value is +correct (current) or outside coroutine context (loading leader when +current is NULL). Due to the difficulty of being sure that this is +really safe in all scenarios it seems worth converting it anyway. + +Signed-off-by: Stefan Hajnoczi +Message-Id: <20220307153853.602859-4-stefanha@redhat.com> +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Kevin Wolf +[DF: see: https://bugzilla.redhat.com/show_bug.cgi?id=1952483] +Signed-off-by: Dario Faggioli +--- + util/coroutine-win32.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/util/coroutine-win32.c b/util/coroutine-win32.c +index de6bd4fd3e4e9747b08348e2a5f7..c02a62c896908162160440cbc8ba 100644 +--- a/util/coroutine-win32.c ++++ b/util/coroutine-win32.c +@@ -25,6 +25,7 @@ + #include "qemu/osdep.h" + #include "qemu-common.h" + #include "qemu/coroutine_int.h" ++#include "qemu/coroutine-tls.h" + + typedef struct + { +@@ -34,8 +35,8 @@ typedef struct + CoroutineAction action; + } CoroutineWin32; + +-static __thread CoroutineWin32 leader; +-static __thread Coroutine *current; ++QEMU_DEFINE_STATIC_CO_TLS(CoroutineWin32, leader); ++QEMU_DEFINE_STATIC_CO_TLS(Coroutine *, current); + + /* This function is marked noinline to prevent GCC from inlining it + * into coroutine_trampoline(). If we allow it to do that then it +@@ -52,7 +53,7 @@ qemu_coroutine_switch(Coroutine *from_, Coroutine *to_, + CoroutineWin32 *from = DO_UPCAST(CoroutineWin32, base, from_); + CoroutineWin32 *to = DO_UPCAST(CoroutineWin32, base, to_); + +- current = to_; ++ set_current(to_); + + to->action = action; + SwitchToFiber(to->fiber); +@@ -89,14 +90,21 @@ void qemu_coroutine_delete(Coroutine *co_) + + Coroutine *qemu_coroutine_self(void) + { ++ Coroutine *current = get_current(); ++ + if (!current) { +- current = &leader.base; +- leader.fiber = ConvertThreadToFiber(NULL); ++ CoroutineWin32 *leader = get_ptr_leader(); ++ ++ current = &leader->base; ++ set_current(current); ++ leader->fiber = ConvertThreadToFiber(NULL); + } + return current; + } + + bool qemu_in_coroutine(void) + { ++ Coroutine *current = get_current(); ++ + return current && current->caller; + } diff --git a/doc-Add-the-SGX-numa-description.patch b/doc-Add-the-SGX-numa-description.patch deleted file mode 100644 index 3b5bd48f..00000000 --- a/doc-Add-the-SGX-numa-description.patch +++ /dev/null @@ -1,67 +0,0 @@ -From: Yang Zhong -Date: Mon, 1 Nov 2021 12:20:08 -0400 -Subject: doc: Add the SGX numa description - -Git-commit: d1889b36098c79e2e6ac90faf3d0dc5ec0057677 -References: bsc#1197807 - -Add the SGX numa reference command and how to check if -SGX numa is support or not with multiple EPC sections. - -Signed-off-by: Yang Zhong -Message-Id: <20211101162009.62161-5-yang.zhong@intel.com> -Signed-off-by: Paolo Bonzini -Signed-off-by: Li Zhang ---- - docs/system/i386/sgx.rst | 31 +++++++++++++++++++++++++++---- - 1 file changed, 27 insertions(+), 4 deletions(-) - -diff --git a/docs/system/i386/sgx.rst b/docs/system/i386/sgx.rst -index f8fade5ac2d44b7378a87e8da14d..0f0a73f7587c44e69e028f061fed 100644 ---- a/docs/system/i386/sgx.rst -+++ b/docs/system/i386/sgx.rst -@@ -141,8 +141,7 @@ To launch a SGX guest: - |qemu_system_x86| \\ - -cpu host,+sgx-provisionkey \\ - -object memory-backend-epc,id=mem1,size=64M,prealloc=on \\ -- -object memory-backend-epc,id=mem2,size=28M \\ -- -M sgx-epc.0.memdev=mem1,sgx-epc.1.memdev=mem2 -+ -M sgx-epc.0.memdev=mem1,sgx-epc.0.node=0 - - Utilizing SGX in the guest requires a kernel/OS with SGX support. - The support can be determined in guest by:: -@@ -152,8 +151,32 @@ The support can be determined in guest by:: - and SGX epc info by:: - - $ dmesg | grep sgx -- [ 1.242142] sgx: EPC section 0x180000000-0x181bfffff -- [ 1.242319] sgx: EPC section 0x181c00000-0x1837fffff -+ [ 0.182807] sgx: EPC section 0x140000000-0x143ffffff -+ [ 0.183695] sgx: [Firmware Bug]: Unable to map EPC section to online node. Fallback to the NUMA node 0. -+ -+To launch a SGX numa guest: -+ -+.. parsed-literal:: -+ -+ |qemu_system_x86| \\ -+ -cpu host,+sgx-provisionkey \\ -+ -object memory-backend-ram,size=2G,host-nodes=0,policy=bind,id=node0 \\ -+ -object memory-backend-epc,id=mem0,size=64M,prealloc=on,host-nodes=0,policy=bind \\ -+ -numa node,nodeid=0,cpus=0-1,memdev=node0 \\ -+ -object memory-backend-ram,size=2G,host-nodes=1,policy=bind,id=node1 \\ -+ -object memory-backend-epc,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \\ -+ -numa node,nodeid=1,cpus=2-3,memdev=node1 \\ -+ -M sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1 -+ -+and SGX epc numa info by:: -+ -+ $ dmesg | grep sgx -+ [ 0.369937] sgx: EPC section 0x180000000-0x183ffffff -+ [ 0.370259] sgx: EPC section 0x184000000-0x185bfffff -+ -+ $ dmesg | grep SRAT -+ [ 0.009981] ACPI: SRAT: Node 0 PXM 0 [mem 0x180000000-0x183ffffff] -+ [ 0.009982] ACPI: SRAT: Node 1 PXM 1 [mem 0x184000000-0x185bfffff] - - References - ---------- diff --git a/doc-add-our-support-doc-to-the-main-proj.patch b/doc-add-our-support-doc-to-the-main-proj.patch index 5abfbef8..5ddfcb9b 100644 --- a/doc-add-our-support-doc-to-the-main-proj.patch +++ b/doc-add-our-support-doc-to-the-main-proj.patch @@ -2,6 +2,8 @@ From: Bruce Rogers Date: Fri, 29 Jan 2021 20:06:16 -0700 Subject: doc: add our support doc to the main project doc for x86 and s390x +Git-commit: 0000000000000000000000000000000000000000 + Include-If: %if %{legacy_qemu_kvm} Signed-off-by: Bruce Rogers diff --git a/hw-i386-amd_iommu-Fix-maybe-uninitialize.patch b/hw-i386-amd_iommu-Fix-maybe-uninitialize.patch deleted file mode 100644 index 9f8a40e1..00000000 --- a/hw-i386-amd_iommu-Fix-maybe-uninitialize.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Paolo Bonzini -Date: Mon, 21 Mar 2022 15:33:46 +0100 -Subject: hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 00000000000000000000000000000000000000000000 -References: bsc#1197018 - -Be more explicit that the loop must roll at least once. Avoids the -following warning: - - FAILED: libqemu-x86_64-softmmu.fa.p/hw_i386_amd_iommu.c.o - In function 'pte_get_page_mask', - inlined from 'amdvi_page_walk' at hw/i386/amd_iommu.c:945:25, - inlined from 'amdvi_do_translate' at hw/i386/amd_iommu.c:989:5, - inlined from 'amdvi_translate' at hw/i386/amd_iommu.c:1038:5: - hw/i386/amd_iommu.c:877:38: error: 'oldlevel' may be used uninitialized [-Werror=maybe-uninitialized] - 877 | return ~((1UL << ((oldlevel * 9) + 3)) - 1); - | ~~~~~~~~~~~~~~~~^~~~ - hw/i386/amd_iommu.c: In function 'amdvi_translate': - hw/i386/amd_iommu.c:906:41: note: 'oldlevel' was declared here - 906 | unsigned level, present, pte_perms, oldlevel; - | ^~~~~~~~ - cc1: all warnings being treated as errors - -Having: - - $ gcc --version - gcc (Debian 12-20220313-1) 12.0.1 20220314 (experimental) - -Reported-by: Philippe Mathieu-Daudé -Signed-off-by: Paolo Bonzini -Signed-off-by: Dario Faggioli ---- - hw/i386/amd_iommu.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c -index 91fe34ae5899339e4114a6e0cac6..f2960a0f381298c8c64009043ab2 100644 ---- a/hw/i386/amd_iommu.c -+++ b/hw/i386/amd_iommu.c -@@ -911,7 +911,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte, - } - - /* we are at the leaf page table or page table encodes a huge page */ -- while (level > 0) { -+ do { - pte_perms = amdvi_get_perms(pte); - present = pte & 1; - if (!present || perms != (perms & pte_perms)) { -@@ -930,10 +930,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte, - } - oldlevel = level; - level = get_pte_translation_mode(pte); -- if (level == 0x7) { -- break; -- } -- } -+ } while (level > 0 && level < 7); - - if (level == 0x7) { - page_mask = pte_override_page_mask(pte); diff --git a/hw-intc-exynos4210_gic-provide-more-room.patch b/hw-intc-exynos4210_gic-provide-more-room.patch deleted file mode 100644 index 44f2a1b2..00000000 --- a/hw-intc-exynos4210_gic-provide-more-room.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Bruce Rogers -Date: Wed, 15 May 2019 13:32:01 -0600 -Subject: hw/intc/exynos4210_gic: provide more room when formatting alias names - -sprintf related parameter validation complains about the size of the -buffer being written to in exynos4210_gic_realize(). Provide a bit more -space to avoid the following warning: -/home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c: In function 'exynos4210_gic_realize': -/home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c:316:36: error: '%x' directive writing between 1 and 7 bytes into a region of size between 4 and 28 [-Werror=format-overflow=] - 316 | sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); - | ^~ -/home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c:316:33: note: directive argument in the range [0, 29020050] - 316 | sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); - | ^~~~~~ -In file included from /usr/include/stdio.h:867, - from /home/abuild/rpmbuild/BUILD/qemu-4.0.0/include/qemu/osdep.h:99, - from /home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c:23: -/usr/include/bits/stdio2.h:36:10: note: '__builtin___sprintf_chk' output between 2 and 32 bytes into a destination of size 28 - 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 37 | __bos (__s), __fmt, __va_arg_pack ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c:326:37: error: '%x' directive writing between 1 and 7 bytes into a region of size between 3 and 28 [-Werror=format-overflow=] - 326 | sprintf(dist_alias_name, "%s%x", dist_prefix, i); - | ^~ -/home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c:326:34: note: directive argument in the range [0, 29020050] - 326 | sprintf(dist_alias_name, "%s%x", dist_prefix, i); - | ^~~~~~ -In file included from /usr/include/stdio.h:867, - from /home/abuild/rpmbuild/BUILD/qemu-4.0.0/include/qemu/osdep.h:99, - from /home/abuild/rpmbuild/BUILD/qemu-4.0.0/hw/intc/exynos4210_gic.c:23: -/usr/include/bits/stdio2.h:36:10: note: '__builtin___sprintf_chk' output between 2 and 33 bytes into a destination of size 28 - 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 37 | __bos (__s), __fmt, __va_arg_pack ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Signed-off-by: Bruce Rogers ---- - hw/intc/exynos4210_gic.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c -index bc73d1f1152438de04c252a2ec84..db58021ef62cdf8554d7e00e0761 100644 ---- a/hw/intc/exynos4210_gic.c -+++ b/hw/intc/exynos4210_gic.c -@@ -291,8 +291,8 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp) - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); - const char cpu_prefix[] = "exynos4210-gic-alias_cpu"; - const char dist_prefix[] = "exynos4210-gic-alias_dist"; -- char cpu_alias_name[sizeof(cpu_prefix) + 3]; -- char dist_alias_name[sizeof(cpu_prefix) + 3]; -+ char cpu_alias_name[sizeof(cpu_prefix) + 7]; -+ char dist_alias_name[sizeof(cpu_prefix) + 8]; - SysBusDevice *gicbusdev; - uint32_t n = s->num_cpu; - uint32_t i; diff --git a/hw-nvme-fix-CVE-2021-3929.patch b/hw-nvme-fix-CVE-2021-3929.patch deleted file mode 100644 index 7370a06a..00000000 --- a/hw-nvme-fix-CVE-2021-3929.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Klaus Jensen -Date: Fri, 17 Dec 2021 10:44:01 +0100 -Subject: hw/nvme: fix CVE-2021-3929 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 736b01642d85be832385063f278fe7cd4ffb5221 -Refrences: bsc#1193880 CVE-2021-3929 - -This fixes CVE-2021-3929 "locally" by denying DMA to the iomem of the -device itself. This still allows DMA to MMIO regions of other devices -(e.g. doing P2P DMA to the controller memory buffer of another NVMe -device). - -Fixes: CVE-2021-3929 -Reported-by: Qiuhao Li -Reviewed-by: Keith Busch -Reviewed-by: Philippe Mathieu-Daudé -Signed-off-by: Klaus Jensen -Signed-off-by: Li Zhang ---- - hw/nvme/ctrl.c | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c -index 5f573c417b3d66c30814a74b192a..eda52c6ac74b3419ca4b656d0ee0 100644 ---- a/hw/nvme/ctrl.c -+++ b/hw/nvme/ctrl.c -@@ -357,6 +357,24 @@ static inline void *nvme_addr_to_pmr(NvmeCtrl *n, hwaddr addr) - return memory_region_get_ram_ptr(&n->pmr.dev->mr) + (addr - n->pmr.cba); - } - -+static inline bool nvme_addr_is_iomem(NvmeCtrl *n, hwaddr addr) -+{ -+ hwaddr hi, lo; -+ -+ /* -+ * The purpose of this check is to guard against invalid "local" access to -+ * the iomem (i.e. controller registers). Thus, we check against the range -+ * covered by the 'bar0' MemoryRegion since that is currently composed of -+ * two subregions (the NVMe "MBAR" and the MSI-X table/pba). Note, however, -+ * that if the device model is ever changed to allow the CMB to be located -+ * in BAR0 as well, then this must be changed. -+ */ -+ lo = n->bar0.addr; -+ hi = lo + int128_get64(n->bar0.size); -+ -+ return addr >= lo && addr < hi; -+} -+ - static int nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size) - { - hwaddr hi = addr + size - 1; -@@ -614,6 +632,10 @@ static uint16_t nvme_map_addr(NvmeCtrl *n, NvmeSg *sg, hwaddr addr, size_t len) - - trace_pci_nvme_map_addr(addr, len); - -+ if (nvme_addr_is_iomem(n, addr)) { -+ return NVME_DATA_TRAS_ERROR; -+ } -+ - if (nvme_addr_is_cmb(n, addr)) { - cmb = true; - } else if (nvme_addr_is_pmr(n, addr)) { diff --git a/hw-nvram-at24-return-0xff-if-1-byte-addr.patch b/hw-nvram-at24-return-0xff-if-1-byte-addr.patch deleted file mode 100644 index 6fa8a175..00000000 --- a/hw-nvram-at24-return-0xff-if-1-byte-addr.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Patrick Venture -Date: Mon, 20 Dec 2021 13:21:37 -0800 -Subject: hw/nvram: at24 return 0xff if 1 byte address -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 1cbab82e9d1bdb2c7b9ef46a396fdc03ea3fa04c - -The at24 eeproms are 2 byte devices that return 0xff when they are read -from with a partial (1-byte) address written. This distinction was -found comparing model behavior to real hardware testing. - -Tested: `i2ctransfer -f -y 45 w1@85 0 r1` returns 0xff instead of next -byte - -Signed-off-by: Patrick Venture -Reviewed-by: Philippe Mathieu-Daudé -Message-Id: <20211220212137.1244511-1-venture@google.com> -Signed-off-by: Philippe Mathieu-Daudé -Signed-off-by: Li Zhang ---- - hw/nvram/eeprom_at24c.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c -index af6f5dbb998475871b4defb59c47..b956b8e2b2d9d74a1bc61bc16eb9 100644 ---- a/hw/nvram/eeprom_at24c.c -+++ b/hw/nvram/eeprom_at24c.c -@@ -58,9 +58,10 @@ int at24c_eeprom_event(I2CSlave *s, enum i2c_event event) - - switch (event) { - case I2C_START_SEND: -- case I2C_START_RECV: - case I2C_FINISH: - ee->haveaddr = 0; -+ /* fallthrough */ -+ case I2C_START_RECV: - DPRINTK("clear\n"); - if (ee->blk && ee->changed) { - int len = blk_pwrite(ee->blk, 0, ee->mem, ee->rsize, 0); -@@ -84,6 +85,10 @@ uint8_t at24c_eeprom_recv(I2CSlave *s) - EEPROMState *ee = AT24C_EE(s); - uint8_t ret; - -+ if (ee->haveaddr == 1) { -+ return 0xff; -+ } -+ - ret = ee->mem[ee->cur]; - - ee->cur = (ee->cur + 1u) % ee->rsize; diff --git a/hw-scsi-megasas-check-for-NULL-frame-in-.patch b/hw-scsi-megasas-check-for-NULL-frame-in-.patch index 9c62c48a..63cc33a5 100644 --- a/hw-scsi-megasas-check-for-NULL-frame-in-.patch +++ b/hw-scsi-megasas-check-for-NULL-frame-in-.patch @@ -2,7 +2,7 @@ From: Mauro Matteo Cascella Date: Mon, 7 Mar 2022 16:22:01 +0100 Subject: hw/scsi/megasas: check for NULL frame in megasas_command_cancelled() -Git-commit: 00000000000000000000000000000000000000000000 +Git-commit: 0000000000000000000000000000000000000000 References: bsc#1180432, CVE-2020-35503 Ensure that 'cmd->frame' is not NULL before accessing the 'header' field. @@ -17,10 +17,10 @@ Signed-off-by: Dario Faggioli 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c -index 4ff51221d4cd0952d9394b8f66b1..07b2b08bf2866907acf0a2b4450c 100644 +index d5dfb412bac4251c9fa06eb416b4..cf97b4d2db5bf91a0e18908e900d 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c -@@ -1891,7 +1891,7 @@ static void megasas_command_cancelled(SCSIRequest *req) +@@ -1927,7 +1927,7 @@ static void megasas_command_cancelled(SCSIRequest *req) { MegasasCmd *cmd = req->hba_private; diff --git a/hw-smbios-handle-both-file-formats-regar.patch b/hw-smbios-handle-both-file-formats-regar.patch index abb847f3..d6dbb173 100644 --- a/hw-smbios-handle-both-file-formats-regar.patch +++ b/hw-smbios-handle-both-file-formats-regar.patch @@ -16,10 +16,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c -index 7397e567373b2dbfabae8fe10a5f..61b7546a6dd7010bdc248f969100 100644 +index 60349ee402719d55896658bf203c..59091c8454bf6d8d05c4c8313753 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c -@@ -1138,6 +1138,7 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) +@@ -1180,6 +1180,7 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) struct smbios_structure_header *header; int size; struct smbios_table *table; /* legacy mode only */ @@ -27,7 +27,7 @@ index 7397e567373b2dbfabae8fe10a5f..61b7546a6dd7010bdc248f969100 100644 if (!qemu_opts_validate(opts, qemu_smbios_file_opts, errp)) { return; -@@ -1150,11 +1151,21 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) +@@ -1192,11 +1193,21 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) } /* @@ -53,7 +53,7 @@ index 7397e567373b2dbfabae8fe10a5f..61b7546a6dd7010bdc248f969100 100644 header = (struct smbios_structure_header *)(smbios_tables + smbios_tables_len); -@@ -1169,6 +1180,19 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) +@@ -1211,6 +1222,19 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) header->type); return; } @@ -73,7 +73,7 @@ index 7397e567373b2dbfabae8fe10a5f..61b7546a6dd7010bdc248f969100 100644 set_bit(header->type, have_binfile_bitmap); if (header->type == 4) { -@@ -1189,6 +1213,17 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) +@@ -1231,6 +1255,17 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) * delete the one we don't need from smbios_set_defaults(), * once we know which machine version has been requested. */ diff --git a/increase-x86_64-physical-bits-to-42.patch b/increase-x86_64-physical-bits-to-42.patch index 4c7d2a92..4a6251d1 100644 --- a/increase-x86_64-physical-bits-to-42.patch +++ b/increase-x86_64-physical-bits-to-42.patch @@ -13,6 +13,47 @@ memory hole. Signed-off-by: Bruce Rogers Signed-off-by: Andreas Färber + +The DSDT needs to be updated as well, or tests will fail. + +The necessary changes are the following ones: + +@@ -5,13 +5,13 @@ + * + * Disassembling to symbolic ASL+ operators + * +- * Disassembly of /tmp/aml-ML87L1, Thu May 19 16:20:30 2022 ++ * Disassembly of tests/data/acpi/microvm/DSDT.pcie, Thu May 19 16:20:30 2022 + * + * Original Table Header: + * Signature "DSDT" + * Length 0x00000BCF (3023) + * Revision 0x02 +- * Checksum 0xD1 ++ * Checksum 0xD8 + * OEM ID "BOCHS " + * OEM Table ID "BXPC " + * OEM Revision 0x00000001 (1) +@@ -1256,10 +1256,10 @@ + ,, , AddressRangeMemory, TypeStatic) + QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite, + 0x0000000000000000, // Granularity +- 0x0000030000000000, // Range Minimum +- 0x000003FFFFFFFFFF, // Range Maximum ++ 0x000000C000000000, // Range Minimum ++ 0x000000FFFFFFFFFF, // Range Maximum + 0x0000000000000000, // Translation Offset +- 0x0000010000000000, // Length ++ 0x0000004000000000, // Length + ,, , AddressRangeMemory, TypeStatic) + }) + Name (SUPP, Zero) + +We cannot, however, commit the modified binary as part of this patch, +will not apply it. The binary is instead put in the package, and copied +in place in the spec file, just before 'make check'. + +Signed-off-by: Dario Faggioli --- target/i386/tcg/helper-tcg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intc-exynos4210_gic-replace-snprintf-wit.patch b/intc-exynos4210_gic-replace-snprintf-wit.patch new file mode 100644 index 00000000..ca7ab7c5 --- /dev/null +++ b/intc-exynos4210_gic-replace-snprintf-wit.patch @@ -0,0 +1,58 @@ +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Wed, 20 Apr 2022 17:25:58 +0400 +Subject: intc/exynos4210_gic: replace snprintf() with g_strdup_printf() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Git-commit: a0e04317f3ef86d7b18ec6e6459d8aa66f787d12 + +While at it, replace '%x' with '%u' as suggested by Philippe Mathieu-Daudé. + +Also fixes a GCC 12.0.1 -Wformat-overflow false-positive. + +Signed-off-by: Marc-André Lureau +Reviewed-by: Peter Maydell +Reviewed-by: Daniel P. Berrangé +Message-Id: <20220420132624.2439741-16-marcandre.lureau@redhat.com> +[DF: Replaces downstream patch: hw-intc-exynos4210_gic-provide-more-room.patch] +Signed-off-by: Dario Faggioli +--- + hw/intc/exynos4210_gic.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c +index bc73d1f1152438de04c252a2ec84..f8dd719caa1e598a32ab6cc6ee7a 100644 +--- a/hw/intc/exynos4210_gic.c ++++ b/hw/intc/exynos4210_gic.c +@@ -289,10 +289,6 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp) + Object *obj = OBJECT(dev); + Exynos4210GicState *s = EXYNOS4210_GIC(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); +- const char cpu_prefix[] = "exynos4210-gic-alias_cpu"; +- const char dist_prefix[] = "exynos4210-gic-alias_dist"; +- char cpu_alias_name[sizeof(cpu_prefix) + 3]; +- char dist_alias_name[sizeof(cpu_prefix) + 3]; + SysBusDevice *gicbusdev; + uint32_t n = s->num_cpu; + uint32_t i; +@@ -322,8 +318,10 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp) + */ + assert(n <= EXYNOS4210_NCPUS); + for (i = 0; i < n; i++) { ++ g_autofree char *cpu_alias_name = g_strdup_printf("exynos4210-gic-alias_cpu%u", i); ++ g_autofree char *dist_alias_name = g_strdup_printf("exynos4210-gic-alias_dist%u", i); ++ + /* Map CPU interface per SMP Core */ +- sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); + memory_region_init_alias(&s->cpu_alias[i], obj, + cpu_alias_name, + sysbus_mmio_get_region(gicbusdev, 1), +@@ -333,7 +331,6 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp) + EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]); + + /* Map Distributor per SMP Core */ +- sprintf(dist_alias_name, "%s%x", dist_prefix, i); + memory_region_init_alias(&s->dist_alias[i], obj, + dist_alias_name, + sysbus_mmio_get_region(gicbusdev, 0), diff --git a/iotest-065-explicit-compression-type.patch b/iotest-065-explicit-compression-type.patch deleted file mode 100644 index 22a20f0a..00000000 --- a/iotest-065-explicit-compression-type.patch +++ /dev/null @@ -1,78 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:33 +0100 -Subject: iotest 065: explicit compression type - -Git-commit: 12a936171d71f839dc907fff7887358a05ac20f8 - -The test checks different options. It of course fails if set -IMGOPTS='compression_type=zstd'. So, let's be explicit in what -compression type we want and independent of IMGOPTS. Test both existing -compression types. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-9-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/065 | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 -index dc7716275f0d5e8b6aeb572244fb..f7c1b68dadbaf151781dfc031166 100755 ---- a/tests/qemu-iotests/065 -+++ b/tests/qemu-iotests/065 -@@ -88,7 +88,7 @@ class TestQMP(TestImageInfoSpecific): - - class TestQCow2(TestQemuImgInfo): - '''Testing a qcow2 version 2 image''' -- img_options = 'compat=0.10' -+ img_options = 'compat=0.10,compression_type=zlib' - json_compare = { 'compat': '0.10', 'refcount-bits': 16, - 'compression-type': 'zlib' } - human_compare = [ 'compat: 0.10', 'compression type: zlib', -@@ -96,17 +96,17 @@ class TestQCow2(TestQemuImgInfo): - - class TestQCow3NotLazy(TestQemuImgInfo): - '''Testing a qcow2 version 3 image with lazy refcounts disabled''' -- img_options = 'compat=1.1,lazy_refcounts=off' -+ img_options = 'compat=1.1,lazy_refcounts=off,compression_type=zstd' - json_compare = { 'compat': '1.1', 'lazy-refcounts': False, - 'refcount-bits': 16, 'corrupt': False, -- 'compression-type': 'zlib', 'extended-l2': False } -- human_compare = [ 'compat: 1.1', 'compression type: zlib', -+ 'compression-type': 'zstd', 'extended-l2': False } -+ human_compare = [ 'compat: 1.1', 'compression type: zstd', - 'lazy refcounts: false', 'refcount bits: 16', - 'corrupt: false', 'extended l2: false' ] - - class TestQCow3Lazy(TestQemuImgInfo): - '''Testing a qcow2 version 3 image with lazy refcounts enabled''' -- img_options = 'compat=1.1,lazy_refcounts=on' -+ img_options = 'compat=1.1,lazy_refcounts=on,compression_type=zlib' - json_compare = { 'compat': '1.1', 'lazy-refcounts': True, - 'refcount-bits': 16, 'corrupt': False, - 'compression-type': 'zlib', 'extended-l2': False } -@@ -117,7 +117,7 @@ class TestQCow3Lazy(TestQemuImgInfo): - class TestQCow3NotLazyQMP(TestQMP): - '''Testing a qcow2 version 3 image with lazy refcounts disabled, opening - with lazy refcounts enabled''' -- img_options = 'compat=1.1,lazy_refcounts=off' -+ img_options = 'compat=1.1,lazy_refcounts=off,compression_type=zlib' - qemu_options = 'lazy-refcounts=on' - compare = { 'compat': '1.1', 'lazy-refcounts': False, - 'refcount-bits': 16, 'corrupt': False, -@@ -127,11 +127,11 @@ class TestQCow3NotLazyQMP(TestQMP): - class TestQCow3LazyQMP(TestQMP): - '''Testing a qcow2 version 3 image with lazy refcounts enabled, opening - with lazy refcounts disabled''' -- img_options = 'compat=1.1,lazy_refcounts=on' -+ img_options = 'compat=1.1,lazy_refcounts=on,compression_type=zstd' - qemu_options = 'lazy-refcounts=off' - compare = { 'compat': '1.1', 'lazy-refcounts': True, - 'refcount-bits': 16, 'corrupt': False, -- 'compression-type': 'zlib', 'extended-l2': False } -+ 'compression-type': 'zstd', 'extended-l2': False } - - TestImageInfoSpecific = None - TestQemuImgInfo = None diff --git a/iotest-214-explicit-compression-type.patch b/iotest-214-explicit-compression-type.patch deleted file mode 100644 index 150d6469..00000000 --- a/iotest-214-explicit-compression-type.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:43 +0100 -Subject: iotest 214: explicit compression type - -Git-commit: da87d5f83a23dd9b252fabc7787383ce6d2454a3 - -The test-case "Corrupted size field in compressed cluster descriptor" -heavily depends on zlib compression type. So, make it explicit. This -way test passes with IMGOPTS='compression_type=zstd'. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-19-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/214 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214 -index 0889089d81cfa9375b5f4d30bfd5..c66e246ba248e221e59743b247e3 100755 ---- a/tests/qemu-iotests/214 -+++ b/tests/qemu-iotests/214 -@@ -51,7 +51,7 @@ echo - # The L2 entries of the two compressed clusters are located at - # 0x800000 and 0x800008, their original values are 0x4008000000a00000 - # and 0x4008000000a00802 (5 sectors for compressed data each). --_make_test_img 8M -o cluster_size=2M -+_make_test_img 8M -o cluster_size=2M,compression_type=zlib - $QEMU_IO -c "write -c -P 0x11 0 2M" -c "write -c -P 0x11 2M 2M" "$TEST_IMG" \ - 2>&1 | _filter_qemu_io | _filter_testdir - diff --git a/iotest-302-use-img_info_log-helper.patch b/iotest-302-use-img_info_log-helper.patch deleted file mode 100644 index 21495f12..00000000 --- a/iotest-302-use-img_info_log-helper.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:36 +0100 -Subject: iotest 302: use img_info_log() helper - -Git-commit: c30175d6fbc73a86a8013da195471d1a3490178f - -Instead of qemu_img_log("info", ..) use generic helper img_info_log(). - -img_info_log() has smarter logic. For example it use filter_img_info() -to filter output, which in turns filter a compression type. So it will -help us in future when we implement a possibility to use zstd -compression by default (with help of some runtime config file or maybe -build option). For now to test you should recompile qemu with a small -addition into block/qcow2.c before -"if (qcow2_opts->has_compression_type": - - if (!qcow2_opts->has_compression_type && version >= 3) { - qcow2_opts->has_compression_type = true; - qcow2_opts->compression_type = QCOW2_COMPRESSION_TYPE_ZSTD; - } - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-12-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/302 | 4 +++- - tests/qemu-iotests/302.out | 7 +++---- - 2 files changed, 6 insertions(+), 5 deletions(-) - -diff --git a/tests/qemu-iotests/302 b/tests/qemu-iotests/302 -index 5695af4914654f2a434391b6d31c..a6d79e727b55dd2d0d0e6fb28650 100755 ---- a/tests/qemu-iotests/302 -+++ b/tests/qemu-iotests/302 -@@ -34,6 +34,7 @@ from iotests import ( - qemu_img_measure, - qemu_io, - qemu_nbd_popen, -+ img_info_log, - ) - - iotests.script_initialize(supported_fmts=["qcow2"]) -@@ -88,6 +89,7 @@ with tarfile.open(tar_file, "w") as tar: - tar_file): - - iotests.log("=== Target image info ===") -+ # Not img_info_log as it enforces imgfmt, but now we print info on raw - qemu_img_log("info", nbd_uri) - - qemu_img( -@@ -99,7 +101,7 @@ with tarfile.open(tar_file, "w") as tar: - nbd_uri) - - iotests.log("=== Converted image info ===") -- qemu_img_log("info", nbd_uri) -+ img_info_log(nbd_uri) - - iotests.log("=== Converted image check ===") - qemu_img_log("check", nbd_uri) -diff --git a/tests/qemu-iotests/302.out b/tests/qemu-iotests/302.out -index e2f6077e8330854905882a9175a8..3e7c281b9116e4b54a4d6834d9ef 100644 ---- a/tests/qemu-iotests/302.out -+++ b/tests/qemu-iotests/302.out -@@ -6,14 +6,13 @@ virtual size: 448 KiB (458752 bytes) - disk size: unavailable - - === Converted image info === --image: nbd+unix:///exp?socket=SOCK_DIR/PID-nbd-sock --file format: qcow2 -+image: TEST_IMG -+file format: IMGFMT - virtual size: 1 GiB (1073741824 bytes) --disk size: unavailable - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - corrupt: false diff --git a/iotest-303-explicit-compression-type.patch b/iotest-303-explicit-compression-type.patch deleted file mode 100644 index ecda77ab..00000000 --- a/iotest-303-explicit-compression-type.patch +++ /dev/null @@ -1,101 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:32 +0100 -Subject: iotest 303: explicit compression type - -Git-commit: 677e0bae686e7c670a71d1f6a491a7f06f77de73 - -The test prints qcow2 header fields which depends on chosen compression -type. So, let's be explicit in what compression type we want and -independent of IMGOPTS. Test both existing compression types. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-8-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/303 | 25 ++++++++++++++++--------- - tests/qemu-iotests/303.out | 30 +++++++++++++++++++++++++++++- - 2 files changed, 45 insertions(+), 10 deletions(-) - -diff --git a/tests/qemu-iotests/303 b/tests/qemu-iotests/303 -index 475cb5428db4f047b7db63776ca0..16c2e1082768f67c14c8665b2b2c 100755 ---- a/tests/qemu-iotests/303 -+++ b/tests/qemu-iotests/303 -@@ -54,12 +54,19 @@ def add_bitmap(num, begin, end, disabled): - log('') - - --qemu_img_create('-f', iotests.imgfmt, disk, '10M') -- --add_bitmap(1, 0, 6, False) --add_bitmap(2, 6, 8, True) --dump = ['./qcow2.py', disk, 'dump-header'] --subprocess.run(dump) --# Dump the metadata in JSON format --dump.append('-j') --subprocess.run(dump) -+def test(compression_type: str, json_output: bool) -> None: -+ qemu_img_create('-f', iotests.imgfmt, -+ '-o', f'compression_type={compression_type}', -+ disk, '10M') -+ add_bitmap(1, 0, 6, False) -+ add_bitmap(2, 6, 8, True) -+ -+ cmd = ['./qcow2.py', disk, 'dump-header'] -+ if json_output: -+ cmd.append('-j') -+ -+ subprocess.run(cmd) -+ -+ -+test('zlib', False) -+test('zstd', True) -diff --git a/tests/qemu-iotests/303.out b/tests/qemu-iotests/303.out -index 7c16998587840607918fd777fb99..b3c70827b74a253209527106a4a9 100644 ---- a/tests/qemu-iotests/303.out -+++ b/tests/qemu-iotests/303.out -@@ -80,6 +80,34 @@ extra_data_size 0 - Bitmap table type size offset - 0 all-zeroes 0 0 - -+Add bitmap 1 -+wrote 1048576/1048576 bytes at offset 0 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+wrote 1048576/1048576 bytes at offset 1048576 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+wrote 1048576/1048576 bytes at offset 2097152 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+wrote 1048576/1048576 bytes at offset 3145728 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+wrote 1048576/1048576 bytes at offset 4194304 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+wrote 1048576/1048576 bytes at offset 5242880 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+ -+Add bitmap 2 -+wrote 1048576/1048576 bytes at offset 6291456 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+wrote 1048576/1048576 bytes at offset 7340032 -+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+ - { - "magic": 1363560955, - "version": 3, -@@ -94,7 +122,7 @@ Bitmap table type size offset - "refcount_table_clusters": 1, - "nb_snapshots": 0, - "snapshot_offset": 0, -- "incompatible_features": 0, -+ "incompatible_features": 8, - "compatible_features": 0, - "autoclear_features": 1, - "refcount_order": 4, diff --git a/iotest-39-use-_qcow2_dump_header.patch b/iotest-39-use-_qcow2_dump_header.patch deleted file mode 100644 index 74ba2f58..00000000 --- a/iotest-39-use-_qcow2_dump_header.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:40 +0100 -Subject: iotest 39: use _qcow2_dump_header - -Git-commit: 72be51ddb3d10974da5128ad20ee5ca7a13ddd54 - -_qcow2_dump_header has filter for compression type, so this change -makes test pass with IMGOPTS='compression_type=zstd'. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-16-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/039 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 -index 8e783a8380666f26d237c7233602..00d379cde259d64a46e2a49d9f20 100755 ---- a/tests/qemu-iotests/039 -+++ b/tests/qemu-iotests/039 -@@ -142,7 +142,7 @@ $QEMU_IMG commit "$TEST_IMG" - - # The dirty bit must not be set - _qcow2_dump_header | grep incompatible_features --$PYTHON qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features -+_qcow2_dump_header "$TEST_IMG".base | grep incompatible_features - - _check_test_img - TEST_IMG="$TEST_IMG".base _check_test_img diff --git a/iotests-60-more-accurate-set-dirty-bit-i.patch b/iotests-60-more-accurate-set-dirty-bit-i.patch deleted file mode 100644 index 9f5072f3..00000000 --- a/iotests-60-more-accurate-set-dirty-bit-i.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:42 +0100 -Subject: iotests 60: more accurate set dirty bit in qcow2 header - -Git-commit: 3a0e60a065ee32027684314a0d886d43bc6ce34b - -Don't touch other incompatible bits, like compression-type. This makes -the test pass with IMGOPTS='compression_type=zstd'. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-18-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/060 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 -index d1e3204d4ea42002263486eebafd..df87d600f761d254cff3f371794e 100755 ---- a/tests/qemu-iotests/060 -+++ b/tests/qemu-iotests/060 -@@ -326,7 +326,7 @@ _make_test_img 64M - # Let the refblock appear unaligned - poke_file "$TEST_IMG" "$rt_offset" "\x00\x00\x00\x00\xff\xff\x2a\x00" - # Mark the image dirty, thus forcing an automatic check when opening it --poke_file "$TEST_IMG" 72 "\x00\x00\x00\x00\x00\x00\x00\x01" -+$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 0 - # Open the image (qemu should refuse to do so) - $QEMU_IO -c close "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt - diff --git a/iotests-MRCE-Write-data-to-source.patch b/iotests-MRCE-Write-data-to-source.patch deleted file mode 100644 index b3dc9584..00000000 --- a/iotests-MRCE-Write-data-to-source.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Hanna Reitz -Date: Thu, 23 Dec 2021 17:53:08 +0100 -Subject: iotests/MRCE: Write data to source - -Git-commit: fc2c3996a59683685a663deb3af12183ad24e4a7 - -This test assumes that mirror flushes the source when entering the READY -state, and that the format level will pass that flush on to the protocol -level (where we intercept it with blkdebug). - -However, apparently that does not happen when using a VMDK image with -zeroed_grain=on, which actually is the default set by testenv.py. Right -now, Python tests ignore IMGOPTS, though, so this has no effect; but -Vladimir has a series that will change this, so we need to fix this test -before that series lands. - -We can fix it by writing data to the source before we start the mirror -job; apparently that makes the (VMDK) format layer change its mind and -pass on the pre-READY flush to the protocol level, so the test passes -again. (I presume, without any data written, mirror just does a 64M -zero write on the target, which VMDK with zeroed_grain=on basically just -ignores.) - -Without this, we do not get a flush, and so blkdebug only sees a single -flush at the end of the job instead of two, and therefore does not -inject an error, which makes the block job complete instead of raising -an error. - -Signed-off-by: Hanna Reitz -Message-Id: <20211223165308.103793-1-hreitz@redhat.com> -Reviewed-by: Vladimir Sementsov-Ogievskiy -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/tests/mirror-ready-cancel-error | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/tests/mirror-ready-cancel-error b/tests/qemu-iotests/tests/mirror-ready-cancel-error -index f2dc88881f9e530db250d78e6f41..770ffca37930faf779b67166a806 100755 ---- a/tests/qemu-iotests/tests/mirror-ready-cancel-error -+++ b/tests/qemu-iotests/tests/mirror-ready-cancel-error -@@ -36,6 +36,11 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): - assert iotests.qemu_img_create('-f', iotests.imgfmt, target, - str(image_size)) == 0 - -+ # Ensure that mirror will copy something before READY so the -+ # target format layer will forward the pre-READY flush to its -+ # file child -+ assert iotests.qemu_io_silent('-c', 'write -P 1 0 64k', source) == 0 -+ - self.vm = iotests.VM() - self.vm.launch() - -@@ -97,7 +102,7 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): - # Write something so will not leave the job immediately, but - # flush first (which will fail, thanks to blkdebug) - res = self.vm.qmp('human-monitor-command', -- command_line='qemu-io mirror-top "write 0 64k"') -+ command_line='qemu-io mirror-top "write -P 2 0 64k"') - self.assert_qmp(res, 'return', '') - - # Drain status change events diff --git a/iotests-bash-tests-filter-compression-ty.patch b/iotests-bash-tests-filter-compression-ty.patch deleted file mode 100644 index 3818daa9..00000000 --- a/iotests-bash-tests-filter-compression-ty.patch +++ /dev/null @@ -1,288 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:41 +0100 -Subject: iotests: bash tests: filter compression type - -Git-commit: dba5aee4da9ce0a81e5a870c22a19926212dc87e - -We want iotests pass with both the default zlib compression and with -IMGOPTS='compression_type=zstd'. - -Actually the only test that is interested in real compression type in -test output is 287 (test for qcow2 compression type), so implement -specific option for it. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-17-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/060.out | 2 +- - tests/qemu-iotests/061.out | 12 ++++++------ - tests/qemu-iotests/082.out | 14 +++++++------- - tests/qemu-iotests/198.out | 4 ++-- - tests/qemu-iotests/287 | 8 ++++---- - tests/qemu-iotests/common.filter | 8 ++++++++ - tests/qemu-iotests/common.rc | 14 +++++++++++++- - 7 files changed, 41 insertions(+), 21 deletions(-) - -diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out -index b74540bafbe84ff721fc0197d21c..329977d9b9b9fb4ec94615fff0a8 100644 ---- a/tests/qemu-iotests/060.out -+++ b/tests/qemu-iotests/060.out -@@ -17,7 +17,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - corrupt: true -diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out -index 7ecbd4dea875ea26e0b131ec2922..139fc68177de57e33567094b84d6 100644 ---- a/tests/qemu-iotests/061.out -+++ b/tests/qemu-iotests/061.out -@@ -525,7 +525,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - data file: TEST_DIR/t.IMGFMT.data -@@ -552,7 +552,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - data file: foo -@@ -567,7 +567,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - data file raw: false -@@ -583,7 +583,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - data file: TEST_DIR/t.IMGFMT.data -@@ -597,7 +597,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - data file: TEST_DIR/t.IMGFMT.data -@@ -612,7 +612,7 @@ virtual size: 64 MiB (67108864 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - data file: TEST_DIR/t.IMGFMT.data -diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out -index 077ed0f2c7d933034a50c50c5de6..d0dd333117a571063a035d7d5c31 100644 ---- a/tests/qemu-iotests/082.out -+++ b/tests/qemu-iotests/082.out -@@ -17,7 +17,7 @@ virtual size: 128 MiB (134217728 bytes) - cluster_size: 4096 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: true - refcount bits: 16 - corrupt: false -@@ -31,7 +31,7 @@ virtual size: 128 MiB (134217728 bytes) - cluster_size: 8192 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: true - refcount bits: 16 - corrupt: false -@@ -329,7 +329,7 @@ virtual size: 128 MiB (134217728 bytes) - cluster_size: 4096 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: true - refcount bits: 16 - corrupt: false -@@ -342,7 +342,7 @@ virtual size: 128 MiB (134217728 bytes) - cluster_size: 8192 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: true - refcount bits: 16 - corrupt: false -@@ -639,7 +639,7 @@ virtual size: 128 MiB (134217728 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: true - refcount bits: 16 - corrupt: false -@@ -652,7 +652,7 @@ virtual size: 130 MiB (136314880 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - corrupt: false -@@ -665,7 +665,7 @@ virtual size: 132 MiB (138412032 bytes) - cluster_size: 65536 - Format specific information: - compat: 1.1 -- compression type: zlib -+ compression type: COMPRESSION_TYPE - lazy refcounts: true - refcount bits: 16 - corrupt: false -diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out -index 3952708444799fede03c45cce0b7..805494916f102694a38729b8a217 100644 ---- a/tests/qemu-iotests/198.out -+++ b/tests/qemu-iotests/198.out -@@ -36,7 +36,7 @@ image: json:{ /* filtered */ } - file format: IMGFMT - virtual size: 16 MiB (16777216 bytes) - Format specific information: -- compression type: zlib -+ compression type: COMPRESSION_TYPE - encrypt: - ivgen alg: plain64 - hash alg: sha256 -@@ -81,7 +81,7 @@ virtual size: 16 MiB (16777216 bytes) - backing file: TEST_DIR/t.IMGFMT.base - backing file format: IMGFMT - Format specific information: -- compression type: zlib -+ compression type: COMPRESSION_TYPE - encrypt: - ivgen alg: plain64 - hash alg: sha256 -diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287 -index 5427ad5456aba89d04e573758679..6414640b2121d6511d7dcb11cda1 100755 ---- a/tests/qemu-iotests/287 -+++ b/tests/qemu-iotests/287 -@@ -61,13 +61,13 @@ echo - echo "=== Testing compression type incompatible bit setting for zlib ===" - echo - _make_test_img -o compression_type=zlib 64M --_qcow2_dump_header | grep incompatible_features -+_qcow2_dump_header --no-filter-compression | grep incompatible_features - - echo - echo "=== Testing compression type incompatible bit setting for zstd ===" - echo - _make_test_img -o compression_type=zstd 64M --_qcow2_dump_header | grep incompatible_features -+_qcow2_dump_header --no-filter-compression | grep incompatible_features - - echo - echo "=== Testing zlib with incompatible bit set ===" -@@ -75,7 +75,7 @@ echo - _make_test_img -o compression_type=zlib 64M - $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 3 - # to make sure the bit was actually set --_qcow2_dump_header | grep incompatible_features -+_qcow2_dump_header --no-filter-compression | grep incompatible_features - - if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then - echo "Error: The image opened successfully. The image must not be opened." -@@ -87,7 +87,7 @@ echo - _make_test_img -o compression_type=zstd 64M - $PYTHON qcow2.py "$TEST_IMG" set-header incompatible_features 0 - # to make sure the bit was actually unset --_qcow2_dump_header | grep incompatible_features -+_qcow2_dump_header --no-filter-compression | grep incompatible_features - - if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then - echo "Error: The image opened successfully. The image must not be opened." -diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter -index 2b2b53946c65d698c71520a163a8..75cc241580d0289c70d7761e9758 100644 ---- a/tests/qemu-iotests/common.filter -+++ b/tests/qemu-iotests/common.filter -@@ -247,6 +247,7 @@ _filter_img_info() - -e "/block_state_zero: \\(on\\|off\\)/d" \ - -e "/log_size: [0-9]\\+/d" \ - -e "s/iters: [0-9]\\+/iters: 1024/" \ -+ -e 's/\(compression type: \)\(zlib\|zstd\)/\1COMPRESSION_TYPE/' \ - -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-000000000000/" | \ - while IFS='' read -r line; do - if [[ $format_specific == 1 ]]; then -@@ -337,5 +338,12 @@ _filter_authz_check_tls() - $SED -e 's/TLS x509 authz check for .* is denied/TLS x509 authz check for DISTINGUISHED-NAME is denied/' - } - -+_filter_qcow2_compression_type_bit() -+{ -+ $SED -e 's/\(incompatible_features\s\+\)\[3\(, \)\?/\1[/' \ -+ -e 's/\(incompatible_features.*\), 3\]/\1]/' \ -+ -e 's/\(incompatible_features.*\), 3\(,.*\)/\1\2/' -+} -+ - # make sure this script returns success - true -diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc -index 5dea310ea08c2bca65a6e21cbb66..9885030b43c953bf073aa84a3df1 100644 ---- a/tests/qemu-iotests/common.rc -+++ b/tests/qemu-iotests/common.rc -@@ -699,6 +699,7 @@ _img_info() - -e "s#$TEST_DIR#TEST_DIR#g" \ - -e "s#$SOCK_DIR/fuse-#TEST_DIR/#g" \ - -e "s#$IMGFMT#IMGFMT#g" \ -+ -e 's/\(compression type: \)\(zlib\|zstd\)/\1COMPRESSION_TYPE/' \ - -e "/^disk size:/ D" \ - -e "/actual-size/ D" | \ - while IFS='' read -r line; do -@@ -998,12 +999,23 @@ _require_one_device_of() - - _qcow2_dump_header() - { -+ if [[ "$1" == "--no-filter-compression" ]]; then -+ local filter_compression=0 -+ shift -+ else -+ local filter_compression=1 -+ fi -+ - img="$1" - if [ -z "$img" ]; then - img="$TEST_IMG" - fi - -- $PYTHON qcow2.py "$img" dump-header -+ if [[ $filter_compression == 0 ]]; then -+ $PYTHON qcow2.py "$img" dump-header -+ else -+ $PYTHON qcow2.py "$img" dump-header | _filter_qcow2_compression_type_bit -+ fi - } - - # make sure this script returns success diff --git a/iotests-common.rc-introduce-_qcow2_dump_.patch b/iotests-common.rc-introduce-_qcow2_dump_.patch deleted file mode 100644 index 45a59d32..00000000 --- a/iotests-common.rc-introduce-_qcow2_dump_.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:38 +0100 -Subject: iotests/common.rc: introduce _qcow2_dump_header helper - -Git-commit: c5e627a6ecdccea64a1b600857ed671a83377847 - -We'll use it in tests instead of explicit qcow2.py. Then we are going -to add some filtering in _qcow2_dump_header. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-14-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/common.rc | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc -index d8582454de0aa4c2c9cfba0f0ce4..5dea310ea08c2bca65a6e21cbb66 100644 ---- a/tests/qemu-iotests/common.rc -+++ b/tests/qemu-iotests/common.rc -@@ -996,5 +996,15 @@ _require_one_device_of() - _notrun "$* not available" - } - -+_qcow2_dump_header() -+{ -+ img="$1" -+ if [ -z "$img" ]; then -+ img="$TEST_IMG" -+ fi -+ -+ $PYTHON qcow2.py "$img" dump-header -+} -+ - # make sure this script returns success - true diff --git a/iotests-declare-lack-of-support-for-comp.patch b/iotests-declare-lack-of-support-for-comp.patch deleted file mode 100644 index 871edfaf..00000000 --- a/iotests-declare-lack-of-support-for-comp.patch +++ /dev/null @@ -1,98 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:44 +0100 -Subject: iotests: declare lack of support for compresion_type in IMGOPTS - -Git-commit: e287a351db13f3f6670f4a3f2896f2dde47d07d1 - -compression_type can't be used if we want to create image with -compat=0.10. So, skip these tests, not many of them. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-20-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/031 | 5 +++-- - tests/qemu-iotests/051 | 5 +++-- - tests/qemu-iotests/061 | 6 +++++- - tests/qemu-iotests/112 | 3 ++- - tests/qemu-iotests/290 | 2 +- - 5 files changed, 14 insertions(+), 7 deletions(-) - -diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 -index 648112f7960e909e81fbc4c1be13..ee587b1606fd1b9c8ba1bf6a50b2 100755 ---- a/tests/qemu-iotests/031 -+++ b/tests/qemu-iotests/031 -@@ -42,8 +42,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 - _supported_fmt qcow2 - _supported_proto file fuse - # We want to test compat=0.10, which does not support external data --# files or refcount widths other than 16 --_unsupported_imgopts data_file 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' -+# files or refcount widths other than 16 or compression type -+_unsupported_imgopts data_file compression_type \ -+ 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' - - CLUSTER_SIZE=65536 - -diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 -index e9042a621420332ac288060cbec2..f1a506518b981fe28cc498af43bb 100755 ---- a/tests/qemu-iotests/051 -+++ b/tests/qemu-iotests/051 -@@ -41,8 +41,9 @@ _supported_fmt qcow2 - _supported_proto file - # A compat=0.10 image is created in this test which does not support anything - # other than refcount_bits=16; --# it also will not support an external data file --_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file -+# it also will not support an external data file and compression type -+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file \ -+ compression_type - _require_drivers nbd - - if [ "$QEMU_DEFAULT_MACHINE" = "pc" ]; then -diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061 -index 70edf1a1635e1e5df529e130d314..513fbec14cc2bcfbd085b0f092e4 100755 ---- a/tests/qemu-iotests/061 -+++ b/tests/qemu-iotests/061 -@@ -48,7 +48,11 @@ _supported_os Linux - # not work with it; - # we have explicit tests for various cluster sizes, the remaining tests - # require the default 64k cluster --_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file cluster_size -+# we don't have explicit tests for zstd qcow2 compression type, as zstd may be -+# not compiled in. And we can't create compat images with comression type -+# extension -+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file \ -+ cluster_size compression_type - - echo - echo "=== Testing version downgrade with zero expansion ===" -diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112 -index 07ac74fb2c184c0580ebbedd70f9..53332129931fa67416893b3b2eaf 100755 ---- a/tests/qemu-iotests/112 -+++ b/tests/qemu-iotests/112 -@@ -43,7 +43,8 @@ _supported_proto file fuse - # This test will set refcount_bits on its own which would conflict with the - # manual setting; compat will be overridden as well; - # and external data files do not work well with our refcount testing --_unsupported_imgopts refcount_bits 'compat=0.10' data_file -+# also, compression type is not supported with compat=0.10 used in test -+_unsupported_imgopts refcount_bits 'compat=0.10' data_file compression_type - - print_refcount_bits() - { -diff --git a/tests/qemu-iotests/290 b/tests/qemu-iotests/290 -index ed80da2685e5ed094985e71c1e30..776b59de1bc8da4bbc67195231c4 100755 ---- a/tests/qemu-iotests/290 -+++ b/tests/qemu-iotests/290 -@@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 - _supported_fmt qcow2 - _supported_proto file fuse - _supported_os Linux --_unsupported_imgopts 'compat=0.10' refcount_bits data_file -+_unsupported_imgopts 'compat=0.10' refcount_bits data_file compression_type - - echo - echo "### Test 'qemu-io -c discard' on a QCOW2 image without a backing file" diff --git a/iotests-drop-qemu_img_verbose-helper.patch b/iotests-drop-qemu_img_verbose-helper.patch deleted file mode 100644 index 97d9200e..00000000 --- a/iotests-drop-qemu_img_verbose-helper.patch +++ /dev/null @@ -1,112 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:30 +0100 -Subject: iotests: drop qemu_img_verbose() helper - -Git-commit: 8f9e54ccfd047cbef09fe10fa75d59333052fb78 - -qemu_img_verbose() has a drawback of not going through generic -qemu_img_pipe_and_status(). qemu_img_verbose() is not very popular, so -update the only two users to qemu_img_log() and drop qemu_img_verbose() -at all. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-6-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/044 | 5 +++-- - tests/qemu-iotests/044.out | 1 + - tests/qemu-iotests/209 | 7 ++++--- - tests/qemu-iotests/209.out | 2 ++ - tests/qemu-iotests/iotests.py | 8 -------- - 5 files changed, 10 insertions(+), 13 deletions(-) - -diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044 -index d696e6442ad5b595d16a61f5c0dd..a5ee9a7ded3bf1f734322db80689 100755 ---- a/tests/qemu-iotests/044 -+++ b/tests/qemu-iotests/044 -@@ -24,7 +24,7 @@ import os - import qcow2 - from qcow2 import QcowHeader - import iotests --from iotests import qemu_img, qemu_img_verbose, qemu_io -+from iotests import qemu_img, qemu_img_log, qemu_io - import struct - import subprocess - import sys -@@ -112,10 +112,11 @@ class TestRefcountTableGrowth(iotests.QMPTestCase): - - def test_grow_refcount_table(self): - qemu_io('-c', 'write 3800M 1M', test_img) -- qemu_img_verbose('check' , test_img) -+ qemu_img_log('check' , test_img) - pass - - if __name__ == '__main__': -+ iotests.activate_logging() - iotests.main(supported_fmts=['qcow2'], - supported_protocols=['file'], - unsupported_imgopts=['refcount_bits']) -diff --git a/tests/qemu-iotests/044.out b/tests/qemu-iotests/044.out -index 703cf3dee186906c6b7b0104f142..ff663b17d71f96d1d9ade8b45bdd 100644 ---- a/tests/qemu-iotests/044.out -+++ b/tests/qemu-iotests/044.out -@@ -1,6 +1,7 @@ - No errors were found on the image. - 7292415/33554432 = 21.73% allocated, 0.00% fragmented, 0.00% compressed clusters - Image end offset: 4296217088 -+ - . - ---------------------------------------------------------------------- - Ran 1 tests -diff --git a/tests/qemu-iotests/209 b/tests/qemu-iotests/209 -index ff7efea11bc69d64ed3ba41c586d..f6ad08ec42a7055634adfcd263d1 100755 ---- a/tests/qemu-iotests/209 -+++ b/tests/qemu-iotests/209 -@@ -20,8 +20,8 @@ - # - - import iotests --from iotests import qemu_img_create, qemu_io, qemu_img_verbose, qemu_nbd, \ -- file_path -+from iotests import qemu_img_create, qemu_io, qemu_img_log, qemu_nbd, \ -+ file_path, log - - iotests.script_initialize(supported_fmts=['qcow2']) - -@@ -33,4 +33,5 @@ qemu_img_create('-f', iotests.imgfmt, disk, '1M') - qemu_io('-f', iotests.imgfmt, '-c', 'write 0 512K', disk) - - qemu_nbd('-k', nbd_sock, '-x', 'exp', '-f', iotests.imgfmt, disk) --qemu_img_verbose('map', '-f', 'raw', '--output=json', nbd_uri) -+qemu_img_log('map', '-f', 'raw', '--output=json', nbd_uri) -+log('done.') # avoid new line at the end of output file -diff --git a/tests/qemu-iotests/209.out b/tests/qemu-iotests/209.out -index f27be3fa7b0bf619ae5ff0a308fb..515906ac7a1962b78ef3787a4a7c 100644 ---- a/tests/qemu-iotests/209.out -+++ b/tests/qemu-iotests/209.out -@@ -1,2 +1,4 @@ - [{ "start": 0, "length": 524288, "depth": 0, "present": true, "zero": false, "data": true, "offset": 0}, - { "start": 524288, "length": 524288, "depth": 0, "present": true, "zero": true, "data": false, "offset": 524288}] -+ -+done. -diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py -index f0370b520651aa4ccc1cdb0cf28e..5a6bfcbb6adbb84d412e37966360 100644 ---- a/tests/qemu-iotests/iotests.py -+++ b/tests/qemu-iotests/iotests.py -@@ -227,14 +227,6 @@ def qemu_img_measure(*args): - def qemu_img_check(*args): - return json.loads(qemu_img_pipe("check", "--output", "json", *args)) - --def qemu_img_verbose(*args): -- '''Run qemu-img without suppressing its output and return the exit code''' -- exitcode = subprocess.call(qemu_img_args + list(args)) -- if exitcode < 0: -- sys.stderr.write('qemu-img received signal %i: %s\n' -- % (-exitcode, ' '.join(qemu_img_args + list(args)))) -- return exitcode -- - def qemu_img_pipe(*args: str) -> str: - '''Run qemu-img and return its output''' - return qemu_img_pipe_and_status(*args)[0] diff --git a/iotests-massive-use-_qcow2_dump_header.patch b/iotests-massive-use-_qcow2_dump_header.patch deleted file mode 100644 index d7d039d4..00000000 --- a/iotests-massive-use-_qcow2_dump_header.patch +++ /dev/null @@ -1,408 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:39 +0100 -Subject: iotests: massive use _qcow2_dump_header - -Git-commit: 984d7a52d5ca33a79e09f2617fe43e368dce4068 - -We are going to add filtering in _qcow2_dump_header and want all tests -use it. - -The patch is generated by commands: - cd tests/qemu-iotests - sed -ie 's/$PYTHON qcow2.py "$TEST_IMG" dump-header\($\| \)/_qcow2_dump_header\1/' ??? tests/* - -(the difficulty is to avoid converting dump-header-exts) - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-15-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -(cherry picked from commit 984d7a52d5ca33a79e09f2617fe43e368dce4068) -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/031 | 6 +++--- - tests/qemu-iotests/036 | 6 +++--- - tests/qemu-iotests/039 | 20 ++++++++++---------- - tests/qemu-iotests/060 | 20 ++++++++++---------- - tests/qemu-iotests/061 | 36 ++++++++++++++++++------------------ - tests/qemu-iotests/137 | 2 +- - tests/qemu-iotests/287 | 8 ++++---- - 7 files changed, 49 insertions(+), 49 deletions(-) - -diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 -index 58b57a0ef2c0973b6f595102802d..648112f7960e909e81fbc4c1be13 100755 ---- a/tests/qemu-iotests/031 -+++ b/tests/qemu-iotests/031 -@@ -58,21 +58,21 @@ for compat in "compat=0.10" "compat=1.1"; do - echo - _make_test_img -o $compat 64M - $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension" -- $PYTHON qcow2.py "$TEST_IMG" dump-header -+ _qcow2_dump_header - _check_test_img - - echo - echo === Rewrite header with no backing file === - echo - $QEMU_IMG rebase -u -b "" "$TEST_IMG" -- $PYTHON qcow2.py "$TEST_IMG" dump-header -+ _qcow2_dump_header - _check_test_img - - echo - echo === Add a backing file and format === - echo - $QEMU_IMG rebase -u -b "/some/backing/file/path" -F host_device "$TEST_IMG" -- $PYTHON qcow2.py "$TEST_IMG" dump-header -+ _qcow2_dump_header - done - - # success, all done -diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036 -index 5e567012a8203e38b609fd863736..f703605e44412b70e3f2aa9ea33f 100755 ---- a/tests/qemu-iotests/036 -+++ b/tests/qemu-iotests/036 -@@ -58,7 +58,7 @@ $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63 - - # Without feature table - $PYTHON qcow2.py "$TEST_IMG" del-header-ext 0x6803f857 --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features -+_qcow2_dump_header | grep features - $PYTHON qcow2.py "$TEST_IMG" dump-header-exts - _img_info - -@@ -107,7 +107,7 @@ echo === Create image with unknown autoclear feature bit === - echo - _make_test_img 64M - $PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63 --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features -+_qcow2_dump_header | grep features - $PYTHON qcow2.py "$TEST_IMG" dump-header-exts - - echo -@@ -115,7 +115,7 @@ echo === Repair image === - echo - _check_test_img -r all - --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features -+_qcow2_dump_header | grep features - $PYTHON qcow2.py "$TEST_IMG" dump-header-exts - - # success, all done -diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 -index 12b2c7fa7b87d87db9c5f5688dfe..8e783a8380666f26d237c7233602 100755 ---- a/tests/qemu-iotests/039 -+++ b/tests/qemu-iotests/039 -@@ -59,7 +59,7 @@ _make_test_img -o "compat=1.1,lazy_refcounts=on" $size - $QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io - - # The dirty bit must not be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - _check_test_img - - echo -@@ -73,7 +73,7 @@ $QEMU_IO -c "write -P 0x5a 0 512" \ - | _filter_qemu_io - - # The dirty bit must be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - _check_test_img - - echo -@@ -82,7 +82,7 @@ echo "== Read-only access must still work ==" - $QEMU_IO -r -c "read -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io - - # The dirty bit must be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - echo - echo "== Repairing the image file must succeed ==" -@@ -90,7 +90,7 @@ echo "== Repairing the image file must succeed ==" - _check_test_img -r all - - # The dirty bit must not be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - echo - echo "== Data should still be accessible after repair ==" -@@ -108,12 +108,12 @@ $QEMU_IO -c "write -P 0x5a 0 512" \ - | _filter_qemu_io - - # The dirty bit must be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io - - # The dirty bit must not be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - echo - echo "== Creating an image file with lazy_refcounts=off ==" -@@ -126,7 +126,7 @@ $QEMU_IO -c "write -P 0x5a 0 512" \ - | _filter_qemu_io - - # The dirty bit must not be set since lazy_refcounts=off --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - _check_test_img - - echo -@@ -141,7 +141,7 @@ $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io - $QEMU_IMG commit "$TEST_IMG" - - # The dirty bit must not be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - $PYTHON qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features - - _check_test_img -@@ -159,7 +159,7 @@ $QEMU_IO -c "reopen -o lazy-refcounts=on" \ - | _filter_qemu_io - - # The dirty bit must be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - _check_test_img - - _make_test_img -o "compat=1.1,lazy_refcounts=on" $size -@@ -171,7 +171,7 @@ $QEMU_IO -c "reopen -o lazy-refcounts=off" \ - | _filter_qemu_io - - # The dirty bit must not be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - _check_test_img - - -diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 -index db26c6b246cda94e9258c51b0b6c..d1e3204d4ea42002263486eebafd 100755 ---- a/tests/qemu-iotests/060 -+++ b/tests/qemu-iotests/060 -@@ -80,13 +80,13 @@ poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x03\x00\x00" - _check_test_img - - # The corrupt bit should not be set anyway --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - # Try to write something, thereby forcing the corrupt bit to be set - $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io - - # The corrupt bit must now be set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - # This information should be available through qemu-img info - _img_info --format-specific -@@ -114,19 +114,19 @@ poke_file "$TEST_IMG" "$(($rb_offset+8))" "\x00\x01" - # Redirect new data cluster onto refcount block - poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x02\x00\x00" - _check_test_img --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - # Try to fix it - _check_test_img -r all - - # The corrupt bit should be cleared --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - # Look if it's really really fixed - $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - echo - echo "=== Testing cluster data reference into inactive L2 table ===" -@@ -139,13 +139,13 @@ $QEMU_IO -c "$OPEN_RW" -c "write -P 2 0 512" | _filter_qemu_io - poke_file "$TEST_IMG" "$l2_offset_after_snapshot" \ - "\x80\x00\x00\x00\x00\x04\x00\x00" - _check_test_img --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - $QEMU_IO -c "$OPEN_RW" -c "write -P 3 0 512" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - _check_test_img -r all --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - $QEMU_IO -c "$OPEN_RW" -c "write -P 4 0 512" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - # Check data - $QEMU_IO -c "$OPEN_RO" -c "read -P 4 0 512" | _filter_qemu_io -diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061 -index 9507c223bda41067797dd19be095..70edf1a1635e1e5df529e130d314 100755 ---- a/tests/qemu-iotests/061 -+++ b/tests/qemu-iotests/061 -@@ -55,9 +55,9 @@ echo "=== Testing version downgrade with zero expansion ===" - echo - _make_test_img -o "compat=1.1,lazy_refcounts=on" 64M - $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG" --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io - _check_test_img - -@@ -68,10 +68,10 @@ _make_test_img -o "compat=1.1,lazy_refcounts=on" 64M - $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io - $QEMU_IO -c "write -z 32M 128k" "$TEST_IMG" | _filter_qemu_io - $QEMU_IO -c map "$TEST_IMG" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IMG amend -o "compat=0.10" --image-opts \ - driver=qcow2,file.filename=$TEST_IMG,l2-cache-entry-size=4096 --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io - $QEMU_IO -c "read -P 0 32M 128k" "$TEST_IMG" | _filter_qemu_io - $QEMU_IO -c map "$TEST_IMG" | _filter_qemu_io -@@ -84,9 +84,9 @@ _make_test_img -o "compat=1.1,lazy_refcounts=on" 64M - _NO_VALGRIND \ - $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \ - -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG" --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io - _check_test_img - -@@ -96,9 +96,9 @@ echo - _make_test_img -o "compat=1.1" 64M - $PYTHON qcow2.py "$TEST_IMG" set-feature-bit compatible 42 - $PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 42 --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG" --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - _check_test_img - - echo -@@ -106,9 +106,9 @@ echo "=== Testing version upgrade and resize ===" - echo - _make_test_img -o "compat=0.10" 64M - $QEMU_IO -c "write -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IMG amend -o "compat=1.1,lazy_refcounts=on,size=128M" "$TEST_IMG" --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IO -c "read -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io - _check_test_img - -@@ -120,29 +120,29 @@ $QEMU_IO -c "write -P 0x2a 24M 64k" "$TEST_IMG" | _filter_qemu_io - $QEMU_IMG snapshot -c foo "$TEST_IMG" - $QEMU_IMG resize "$TEST_IMG" 64M && - echo "unexpected pass" --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep '^\(version\|size\|nb_snap\)' -+_qcow2_dump_header | grep '^\(version\|size\|nb_snap\)' - - $QEMU_IMG amend -o "compat=1.1,size=128M" "$TEST_IMG" || - echo "unexpected fail" --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep '^\(version\|size\|nb_snap\)' -+_qcow2_dump_header | grep '^\(version\|size\|nb_snap\)' - - $QEMU_IMG snapshot -c bar "$TEST_IMG" - $QEMU_IMG resize --shrink "$TEST_IMG" 64M || - echo "unexpected fail" --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep '^\(version\|size\|nb_snap\)' -+_qcow2_dump_header | grep '^\(version\|size\|nb_snap\)' - - $QEMU_IMG amend -o "compat=0.10,size=32M" "$TEST_IMG" && - echo "unexpected pass" --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep '^\(version\|size\|nb_snap\)' -+_qcow2_dump_header | grep '^\(version\|size\|nb_snap\)' - - $QEMU_IMG snapshot -a bar "$TEST_IMG" || - echo "unexpected fail" --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep '^\(version\|size\|nb_snap\)' -+_qcow2_dump_header | grep '^\(version\|size\|nb_snap\)' - - $QEMU_IMG snapshot -d bar "$TEST_IMG" - $QEMU_IMG amend -o "compat=0.10,size=32M" "$TEST_IMG" || - echo "unexpected fail" --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep '^\(version\|size\|nb_snap\)' -+_qcow2_dump_header | grep '^\(version\|size\|nb_snap\)' - - _check_test_img - -@@ -154,9 +154,9 @@ _make_test_img -o "compat=1.1,lazy_refcounts=on" 64M - _NO_VALGRIND \ - $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \ - -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IMG amend -o "lazy_refcounts=off" "$TEST_IMG" --$PYTHON qcow2.py "$TEST_IMG" dump-header -+_qcow2_dump_header - $QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io - _check_test_img - -diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137 -index 4680d5df3d0fe8be4041f4df3833..52ee135184011e8e1655efd063f9 100755 ---- a/tests/qemu-iotests/137 -+++ b/tests/qemu-iotests/137 -@@ -140,7 +140,7 @@ $QEMU_IO \ - - # The dirty bit must not be set - # (Filter the external data file bit) --if $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features \ -+if _qcow2_dump_header | grep incompatible_features \ - | grep -q '\<0\>' - then - echo 'ERROR: Dirty bit set' -diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287 -index 2d5334e8bfb72dc88a3ddd958994..5427ad5456aba89d04e573758679 100755 ---- a/tests/qemu-iotests/287 -+++ b/tests/qemu-iotests/287 -@@ -61,13 +61,13 @@ echo - echo "=== Testing compression type incompatible bit setting for zlib ===" - echo - _make_test_img -o compression_type=zlib 64M --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - echo - echo "=== Testing compression type incompatible bit setting for zstd ===" - echo - _make_test_img -o compression_type=zstd 64M --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - echo - echo "=== Testing zlib with incompatible bit set ===" -@@ -75,7 +75,7 @@ echo - _make_test_img -o compression_type=zlib 64M - $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 3 - # to make sure the bit was actually set --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then - echo "Error: The image opened successfully. The image must not be opened." -@@ -87,7 +87,7 @@ echo - _make_test_img -o compression_type=zstd 64M - $PYTHON qcow2.py "$TEST_IMG" set-header incompatible_features 0 - # to make sure the bit was actually unset --$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features -+_qcow2_dump_header | grep incompatible_features - - if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then - echo "Error: The image opened successfully. The image must not be opened." diff --git a/iotests-specify-some-unsupported_imgopts.patch b/iotests-specify-some-unsupported_imgopts.patch deleted file mode 100644 index 92c71075..00000000 --- a/iotests-specify-some-unsupported_imgopts.patch +++ /dev/null @@ -1,222 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:28 +0100 -Subject: iotests: specify some unsupported_imgopts for python iotests - -Git-commit: b30b8077243ea5dc93a540eedfecee3c74b19fa2 - -We are going to support IMGOPTS for python iotests. Still some iotests -will not work with common IMGOPTS used with bash iotests like -specifying refcount_bits and compat qcow2 options. So we -should define corresponding unsupported_imgopts for now. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Message-Id: <20211223160144.1097696-4-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/044 | 3 ++- - tests/qemu-iotests/065 | 3 ++- - tests/qemu-iotests/163 | 3 ++- - tests/qemu-iotests/165 | 3 ++- - tests/qemu-iotests/196 | 3 ++- - tests/qemu-iotests/242 | 3 ++- - tests/qemu-iotests/246 | 3 ++- - tests/qemu-iotests/254 | 3 ++- - tests/qemu-iotests/260 | 3 ++- - tests/qemu-iotests/274 | 3 ++- - tests/qemu-iotests/281 | 3 ++- - tests/qemu-iotests/303 | 3 ++- - tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test | 3 ++- - tests/qemu-iotests/tests/migrate-bitmaps-test | 3 ++- - tests/qemu-iotests/tests/remove-bitmap-from-backing | 3 ++- - 15 files changed, 30 insertions(+), 15 deletions(-) - -diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044 -index 64b18eb7c89f49c8fc7192dbb0e8..d696e6442ad5b595d16a61f5c0dd 100755 ---- a/tests/qemu-iotests/044 -+++ b/tests/qemu-iotests/044 -@@ -117,4 +117,5 @@ class TestRefcountTableGrowth(iotests.QMPTestCase): - - if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['refcount_bits']) -diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 -index 3c2ca27627f0d6343ba04c857b38..dc7716275f0d5e8b6aeb572244fb 100755 ---- a/tests/qemu-iotests/065 -+++ b/tests/qemu-iotests/065 -@@ -139,4 +139,5 @@ TestQMP = None - - if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['refcount_bits']) -diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163 -index dedce8ef4322d3cec0303049b280..b8bfc95358e4652c199655030c8a 100755 ---- a/tests/qemu-iotests/163 -+++ b/tests/qemu-iotests/163 -@@ -169,4 +169,5 @@ ShrinkBaseClass = None - - if __name__ == '__main__': - iotests.main(supported_fmts=['raw', 'qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['compat']) -diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 -index ce499946b842e71f45c7b24ca162..e3ef28e2ee84277ff7bbe65d5fff 100755 ---- a/tests/qemu-iotests/165 -+++ b/tests/qemu-iotests/165 -@@ -157,4 +157,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): - - if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['compat']) -diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 -index 2451515094f2e582dc8dbe838e60..76509a5ad1c541f572ab9c918046 100755 ---- a/tests/qemu-iotests/196 -+++ b/tests/qemu-iotests/196 -@@ -65,4 +65,5 @@ class TestInvalidateAutoclear(iotests.QMPTestCase): - - if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['compat']) -diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242 -index a9b27668c2757711fc3f21db87d4..96a30152b04a8fba7eed2514a48c 100755 ---- a/tests/qemu-iotests/242 -+++ b/tests/qemu-iotests/242 -@@ -26,7 +26,8 @@ from iotests import qemu_img_create, qemu_io, qemu_img_pipe, \ - file_path, img_info_log, log, filter_qemu_io - - iotests.script_initialize(supported_fmts=['qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['refcount_bits', 'compat']) - - disk = file_path('disk') - chunk = 256 * 1024 -diff --git a/tests/qemu-iotests/246 b/tests/qemu-iotests/246 -index 5932a0e8a97bdd5975a4bc0813f9..b009a78397752bdd60bf2ec34af5 100755 ---- a/tests/qemu-iotests/246 -+++ b/tests/qemu-iotests/246 -@@ -23,7 +23,8 @@ - import iotests - from iotests import log - --iotests.script_initialize(supported_fmts=['qcow2']) -+iotests.script_initialize(supported_fmts=['qcow2'], -+ unsupported_imgopts=['compat']) - size = 64 * 1024 * 1024 * 1024 - gran_small = 32 * 1024 - gran_large = 128 * 1024 -diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 -index 108bf5f894c6b3328c144a5de1ee..7ea098818cf0a39c0a624989cdc8 100755 ---- a/tests/qemu-iotests/254 -+++ b/tests/qemu-iotests/254 -@@ -22,7 +22,8 @@ - import iotests - from iotests import qemu_img_create, file_path, log - --iotests.script_initialize(supported_fmts=['qcow2']) -+iotests.script_initialize(supported_fmts=['qcow2'], -+ unsupported_imgopts=['compat']) - - disk, top = file_path('disk', 'top') - size = 1024 * 1024 -diff --git a/tests/qemu-iotests/260 b/tests/qemu-iotests/260 -index 2ec64a9b9952cd26ac7c795fca36..c2133f998010bef3111abb98f0be 100755 ---- a/tests/qemu-iotests/260 -+++ b/tests/qemu-iotests/260 -@@ -23,7 +23,8 @@ import iotests - from iotests import qemu_img_create, file_path, log, filter_qmp_event - - iotests.script_initialize( -- supported_fmts=['qcow2'] -+ supported_fmts=['qcow2'], -+ unsupported_imgopts=['compat'] - ) - - base, top = file_path('base', 'top') -diff --git a/tests/qemu-iotests/274 b/tests/qemu-iotests/274 -index caab008e0737ba5d88e2ae46bc11..080a90f10f7af42c09e380b5953b 100755 ---- a/tests/qemu-iotests/274 -+++ b/tests/qemu-iotests/274 -@@ -23,7 +23,8 @@ - import iotests - - iotests.script_initialize(supported_fmts=['qcow2'], -- supported_platforms=['linux']) -+ supported_platforms=['linux'], -+ unsupported_imgopts=['refcount_bits', 'compat']) - - size_short = 1 * 1024 * 1024 - size_long = 2 * 1024 * 1024 -diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281 -index 956698083f03a7d80f2076cc18c1..318e33393919f2b89295700bbf05 100755 ---- a/tests/qemu-iotests/281 -+++ b/tests/qemu-iotests/281 -@@ -245,4 +245,5 @@ class TestBlockdevBackupAbort(iotests.QMPTestCase): - - if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], -- supported_protocols=['file']) -+ supported_protocols=['file'], -+ unsupported_imgopts=['compat']) -diff --git a/tests/qemu-iotests/303 b/tests/qemu-iotests/303 -index 425544c064d247af86925696bf6d..475cb5428db4f047b7db63776ca0 100755 ---- a/tests/qemu-iotests/303 -+++ b/tests/qemu-iotests/303 -@@ -23,7 +23,8 @@ import iotests - import subprocess - from iotests import qemu_img_create, qemu_io, file_path, log, filter_qemu_io - --iotests.script_initialize(supported_fmts=['qcow2']) -+iotests.script_initialize(supported_fmts=['qcow2'], -+ unsupported_imgopts=['refcount_bits', 'compat']) - - disk = file_path('disk') - chunk = 1024 * 1024 -diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test -index 00ebb5c2516fb7a6b9ee5c7cceaa..fc9c4b4ef411dc93e1abba0e58d2 100755 ---- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test -+++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test -@@ -272,4 +272,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): - - - if __name__ == '__main__': -- iotests.main(supported_fmts=['qcow2']) -+ iotests.main(supported_fmts=['qcow2'], -+ unsupported_imgopts=['compat']) -diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iotests/tests/migrate-bitmaps-test -index c23df3d75c7fd0efc5a4c79aa1f2..59f33575805c79a2ea24157fdb03 100755 ---- a/tests/qemu-iotests/tests/migrate-bitmaps-test -+++ b/tests/qemu-iotests/tests/migrate-bitmaps-test -@@ -307,7 +307,8 @@ def main() -> None: - - iotests.main( - supported_fmts=['qcow2'], -- supported_protocols=['file'] -+ supported_protocols=['file'], -+ unsupported_imgopts=['compat'] - ) - - -diff --git a/tests/qemu-iotests/tests/remove-bitmap-from-backing b/tests/qemu-iotests/tests/remove-bitmap-from-backing -index 8d48fc0f3ce158182733d744b365..3c397b08ea439d6d4c9da76374c0 100755 ---- a/tests/qemu-iotests/tests/remove-bitmap-from-backing -+++ b/tests/qemu-iotests/tests/remove-bitmap-from-backing -@@ -21,7 +21,8 @@ - import iotests - from iotests import log, qemu_img_create, qemu_img, qemu_img_pipe - --iotests.script_initialize(supported_fmts=['qcow2']) -+iotests.script_initialize(supported_fmts=['qcow2'], -+ unsupported_imgopts=['compat']) - - top, base = iotests.file_path('top', 'base') - size = '1M' diff --git a/iotests.py-filter-out-successful-output-.patch b/iotests.py-filter-out-successful-output-.patch deleted file mode 100644 index 1e30bc99..00000000 --- a/iotests.py-filter-out-successful-output-.patch +++ /dev/null @@ -1,447 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:34 +0100 -Subject: iotests.py: filter out successful output of qemu-img create - -Git-commit: e877bba308c38033f73f444395b3cdcde48a3393 - -The only "feature" of this "Formatting ..." line is that we have to -update it every time we add new option. Let's drop it. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-10-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/149.out | 21 --------------------- - tests/qemu-iotests/237.out | 3 --- - tests/qemu-iotests/255.out | 4 ---- - tests/qemu-iotests/274.out | 29 ----------------------------- - tests/qemu-iotests/280.out | 1 - - tests/qemu-iotests/296.out | 10 +++------- - tests/qemu-iotests/iotests.py | 10 ++++++++-- - 7 files changed, 11 insertions(+), 67 deletions(-) - -diff --git a/tests/qemu-iotests/149.out b/tests/qemu-iotests/149.out -index 6877ab6c4a4580d31d5565baad49..ab879596ce2f8811e236428afca5 100644 ---- a/tests/qemu-iotests/149.out -+++ b/tests/qemu-iotests/149.out -@@ -61,7 +61,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha1.img - # ================= qemu-img aes-256-xts-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-aes-256-xts-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha1.img qiotest-145-aes-256-xts-plain64-sha1 -@@ -181,7 +180,6 @@ unlink TEST_DIR/luks-twofish-256-xts-plain64-sha1.img - # ================= qemu-img twofish-256-xts-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=twofish-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-twofish-256-xts-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-twofish-256-xts-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=twofish-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-twofish-256-xts-plain64-sha1.img qiotest-145-twofish-256-xts-plain64-sha1 -@@ -301,7 +299,6 @@ unlink TEST_DIR/luks-serpent-256-xts-plain64-sha1.img - # ================= qemu-img serpent-256-xts-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=serpent-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-serpent-256-xts-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-serpent-256-xts-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=serpent-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-serpent-256-xts-plain64-sha1.img qiotest-145-serpent-256-xts-plain64-sha1 -@@ -421,7 +418,6 @@ unlink TEST_DIR/luks-cast5-128-cbc-plain64-sha1.img - # ================= qemu-img cast5-128-cbc-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=cast5-128,cipher-mode=cbc,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-cast5-128-cbc-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-cast5-128-cbc-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=cast5-128 cipher-mode=cbc ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-cast5-128-cbc-plain64-sha1.img qiotest-145-cast5-128-cbc-plain64-sha1 -@@ -542,7 +538,6 @@ unlink TEST_DIR/luks-aes-256-cbc-plain-sha1.img - # ================= qemu-img aes-256-cbc-plain-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=cbc,ivgen-alg=plain,hash-alg=sha1 TEST_DIR/luks-aes-256-cbc-plain-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-cbc-plain-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=cbc ivgen-alg=plain hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-plain-sha1.img qiotest-145-aes-256-cbc-plain-sha1 -@@ -662,7 +657,6 @@ unlink TEST_DIR/luks-aes-256-cbc-plain64-sha1.img - # ================= qemu-img aes-256-cbc-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=cbc,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-aes-256-cbc-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-cbc-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=cbc ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-plain64-sha1.img qiotest-145-aes-256-cbc-plain64-sha1 -@@ -782,7 +776,6 @@ unlink TEST_DIR/luks-aes-256-cbc-essiv-sha256-sha1.img - # ================= qemu-img aes-256-cbc-essiv-sha256-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=cbc,ivgen-alg=essiv,hash-alg=sha1,ivgen-hash-alg=sha256 TEST_DIR/luks-aes-256-cbc-essiv-sha256-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-cbc-essiv-sha256-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=cbc ivgen-alg=essiv ivgen-hash-alg=sha256 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-essiv-sha256-sha1.img qiotest-145-aes-256-cbc-essiv-sha256-sha1 -@@ -902,7 +895,6 @@ unlink TEST_DIR/luks-aes-256-xts-essiv-sha256-sha1.img - # ================= qemu-img aes-256-xts-essiv-sha256-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=essiv,hash-alg=sha1,ivgen-hash-alg=sha256 TEST_DIR/luks-aes-256-xts-essiv-sha256-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-essiv-sha256-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=essiv ivgen-hash-alg=sha256 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-essiv-sha256-sha1.img qiotest-145-aes-256-xts-essiv-sha256-sha1 -@@ -1022,7 +1014,6 @@ unlink TEST_DIR/luks-aes-128-xts-plain64-sha256-sha1.img - # ================= qemu-img aes-128-xts-plain64-sha256-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-128,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-aes-128-xts-plain64-sha256-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-128-xts-plain64-sha256-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-128 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-128-xts-plain64-sha256-sha1.img qiotest-145-aes-128-xts-plain64-sha256-sha1 -@@ -1142,7 +1133,6 @@ unlink TEST_DIR/luks-aes-192-xts-plain64-sha256-sha1.img - # ================= qemu-img aes-192-xts-plain64-sha256-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-192,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-aes-192-xts-plain64-sha256-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-192-xts-plain64-sha256-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-192 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-192-xts-plain64-sha256-sha1.img qiotest-145-aes-192-xts-plain64-sha256-sha1 -@@ -1262,7 +1252,6 @@ unlink TEST_DIR/luks-twofish-128-xts-plain64-sha1.img - # ================= qemu-img twofish-128-xts-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=twofish-128,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-twofish-128-xts-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-twofish-128-xts-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=twofish-128 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-twofish-128-xts-plain64-sha1.img qiotest-145-twofish-128-xts-plain64-sha1 -@@ -1383,7 +1372,6 @@ unlink TEST_DIR/luks-serpent-128-xts-plain64-sha1.img - # ================= qemu-img serpent-128-xts-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=serpent-128,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-serpent-128-xts-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-serpent-128-xts-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=serpent-128 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-serpent-128-xts-plain64-sha1.img qiotest-145-serpent-128-xts-plain64-sha1 -@@ -1503,7 +1491,6 @@ unlink TEST_DIR/luks-serpent-192-xts-plain64-sha1.img - # ================= qemu-img serpent-192-xts-plain64-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=serpent-192,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha1 TEST_DIR/luks-serpent-192-xts-plain64-sha1.img 4194304M --Formatting 'TEST_DIR/luks-serpent-192-xts-plain64-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=serpent-192 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-serpent-192-xts-plain64-sha1.img qiotest-145-serpent-192-xts-plain64-sha1 -@@ -1625,7 +1612,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha224.img - # ================= qemu-img aes-256-xts-plain64-sha224 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha224 TEST_DIR/luks-aes-256-xts-plain64-sha224.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain64-sha224.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha224 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha224.img qiotest-145-aes-256-xts-plain64-sha224 -@@ -1745,7 +1731,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha256.img - # ================= qemu-img aes-256-xts-plain64-sha256 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha256 TEST_DIR/luks-aes-256-xts-plain64-sha256.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain64-sha256.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha256 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha256.img qiotest-145-aes-256-xts-plain64-sha256 -@@ -1865,7 +1850,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha384.img - # ================= qemu-img aes-256-xts-plain64-sha384 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha384 TEST_DIR/luks-aes-256-xts-plain64-sha384.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain64-sha384.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha384 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha384.img qiotest-145-aes-256-xts-plain64-sha384 -@@ -1985,7 +1969,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha512.img - # ================= qemu-img aes-256-xts-plain64-sha512 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=sha512 TEST_DIR/luks-aes-256-xts-plain64-sha512.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain64-sha512.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=sha512 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha512.img qiotest-145-aes-256-xts-plain64-sha512 -@@ -2105,7 +2088,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-ripemd160.img - # ================= qemu-img aes-256-xts-plain64-ripemd160 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain64,hash-alg=ripemd160 TEST_DIR/luks-aes-256-xts-plain64-ripemd160.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain64-ripemd160.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64 hash-alg=ripemd160 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-ripemd160.img qiotest-145-aes-256-xts-plain64-ripemd160 -@@ -2299,7 +2281,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain-sha1-pwallslots.img - # ================= qemu-img aes-256-xts-plain-sha1-pwallslots ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=c2xvdDE=,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=xts,ivgen-alg=plain,hash-alg=sha1 TEST_DIR/luks-aes-256-xts-plain-sha1-pwallslots.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-xts-plain-sha1-pwallslots.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain-sha1-pwallslots.img qiotest-145-aes-256-xts-plain-sha1-pwallslots -@@ -2419,7 +2400,6 @@ unlink TEST_DIR/luks-aes-256-cbc-essiv-auto-sha1.img - # ================= qemu-img aes-256-cbc-essiv-auto-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=cbc,ivgen-alg=essiv,hash-alg=sha1 TEST_DIR/luks-aes-256-cbc-essiv-auto-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-cbc-essiv-auto-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=cbc ivgen-alg=essiv hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-essiv-auto-sha1.img qiotest-145-aes-256-cbc-essiv-auto-sha1 -@@ -2539,7 +2519,6 @@ unlink TEST_DIR/luks-aes-256-cbc-plain64-sha256-sha1.img - # ================= qemu-img aes-256-cbc-plain64-sha256-sha1 ================= - # Create image - qemu-img create -f luks --object secret,id=sec0,data=MTIzNDU2,format=base64 -o key-secret=sec0,iter-time=10,cipher-alg=aes-256,cipher-mode=cbc,ivgen-alg=plain64,hash-alg=sha1,ivgen-hash-alg=sha256 TEST_DIR/luks-aes-256-cbc-plain64-sha256-sha1.img 4194304M --Formatting 'TEST_DIR/luks-aes-256-cbc-plain64-sha256-sha1.img', fmt=luks size=4398046511104 key-secret=sec0 cipher-alg=aes-256 cipher-mode=cbc ivgen-alg=plain64 ivgen-hash-alg=sha256 hash-alg=sha1 iter-time=10 - - # Open dev - sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-plain64-sha256-sha1.img qiotest-145-aes-256-cbc-plain64-sha256-sha1 -diff --git a/tests/qemu-iotests/237.out b/tests/qemu-iotests/237.out -index 2f09ff5512cf7e586280fe37c571..aeb972449289e73ab955b200c2b3 100644 ---- a/tests/qemu-iotests/237.out -+++ b/tests/qemu-iotests/237.out -@@ -129,11 +129,8 @@ Job failed: Cannot find device='this doesn't exist' nor node-name='this doesn't - - === Other subformats === - --Formatting 'TEST_DIR/PID-t.vmdk.1', fmt=vmdk size=0 compat6=off hwversion=undefined - --Formatting 'TEST_DIR/PID-t.vmdk.2', fmt=vmdk size=0 compat6=off hwversion=undefined - --Formatting 'TEST_DIR/PID-t.vmdk.3', fmt=vmdk size=0 compat6=off hwversion=undefined - - == Missing extent == - -diff --git a/tests/qemu-iotests/255.out b/tests/qemu-iotests/255.out -index 33b7f22de3f2eb7ce724c2285a71..11a05a5213e6a66e1ead1fa1abc2 100644 ---- a/tests/qemu-iotests/255.out -+++ b/tests/qemu-iotests/255.out -@@ -3,9 +3,7 @@ Finishing a commit job with background reads - - === Create backing chain and start VM === - --Formatting 'TEST_DIR/PID-t.qcow2.mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 lazy_refcounts=off refcount_bits=16 - - === Start background read requests === - -@@ -23,9 +21,7 @@ Closing the VM while a job is being cancelled - - === Create images and start VM === - --Formatting 'TEST_DIR/PID-src.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-dst.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 lazy_refcounts=off refcount_bits=16 - - wrote 1048576/1048576 bytes at offset 0 - 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -diff --git a/tests/qemu-iotests/274.out b/tests/qemu-iotests/274.out -index 16a95a48508b5c56ba146063a604..1d2928e14daac9aed9df887f566c 100644 ---- a/tests/qemu-iotests/274.out -+++ b/tests/qemu-iotests/274.out -@@ -1,9 +1,6 @@ - == Commit tests == --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 backing_file=TEST_DIR/PID-mid backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 2097152/2097152 bytes at offset 0 - 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -66,11 +63,8 @@ read 1048576/1048576 bytes at offset 1048576 - 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - - === Testing HMP commit (top -> mid) === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 backing_file=TEST_DIR/PID-mid backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 2097152/2097152 bytes at offset 0 - 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -98,11 +92,8 @@ read 1048576/1048576 bytes at offset 1048576 - 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - - === Testing QMP active commit (top -> mid) === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 backing_file=TEST_DIR/PID-mid backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 2097152/2097152 bytes at offset 0 - 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -136,11 +127,8 @@ read 1048576/1048576 bytes at offset 1048576 - 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - - === Testing qemu-img commit (top -> base) === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 backing_file=TEST_DIR/PID-mid backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 2097152/2097152 bytes at offset 0 - 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -166,11 +154,8 @@ read 1048576/1048576 bytes at offset 1048576 - 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - - === Testing QMP active commit (top -> base) === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2097152 backing_file=TEST_DIR/PID-mid backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 2097152/2097152 bytes at offset 0 - 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -205,9 +190,7 @@ read 1048576/1048576 bytes at offset 1048576 - - == Resize tests == - === preallocation=off === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=6442450944 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 5368709120 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -224,9 +207,7 @@ read 65536/65536 bytes at offset 5368709120 - { "start": 1073741824, "length": 7516192768, "depth": 0, "present": true, "zero": true, "data": false}] - - === preallocation=metadata === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=34359738368 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=32212254720 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 33285996544 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -248,9 +229,7 @@ read 65536/65536 bytes at offset 33285996544 - { "start": 34896609280, "length": 536870912, "depth": 0, "present": true, "zero": true, "data": false, "offset": 2685075456}] - - === preallocation=falloc === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10485760 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=5242880 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 9437184 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -267,9 +246,7 @@ read 65536/65536 bytes at offset 9437184 - { "start": 5242880, "length": 10485760, "depth": 0, "present": true, "zero": false, "data": true, "offset": 327680}] - - === preallocation=full === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=16777216 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=8388608 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 11534336 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -286,9 +263,7 @@ read 65536/65536 bytes at offset 11534336 - { "start": 8388608, "length": 4194304, "depth": 0, "present": true, "zero": false, "data": true, "offset": 327680}] - - === preallocation=off === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=393216 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=259072 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 259072 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -306,9 +281,7 @@ read 65536/65536 bytes at offset 259072 - { "start": 262144, "length": 262144, "depth": 0, "present": true, "zero": true, "data": false}] - - === preallocation=off === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=409600 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=262144 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 344064 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -325,9 +298,7 @@ read 65536/65536 bytes at offset 344064 - { "start": 262144, "length": 262144, "depth": 0, "present": true, "zero": true, "data": false}] - - === preallocation=off === --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=524288 lazy_refcounts=off refcount_bits=16 - --Formatting 'TEST_DIR/PID-top', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=262144 backing_file=TEST_DIR/PID-base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 - - wrote 65536/65536 bytes at offset 446464 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out -index 09a0f1a7cb42ff5934e549530e65..e39164c579ff1c1644159e263945 100644 ---- a/tests/qemu-iotests/280.out -+++ b/tests/qemu-iotests/280.out -@@ -1,4 +1,3 @@ --Formatting 'TEST_DIR/PID-base', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 - - === Launch VM === - Enabling migration QMP events on VM... -diff --git a/tests/qemu-iotests/296.out b/tests/qemu-iotests/296.out -index 6c69735604532c161dad12e5d97b..42205cc98141fce2d094755e8224 100644 ---- a/tests/qemu-iotests/296.out -+++ b/tests/qemu-iotests/296.out -@@ -1,4 +1,3 @@ --Formatting 'TEST_DIR/test.img', fmt=luks size=1048576 key-secret=keysec0 iter-time=10 - - {"execute": "job-dismiss", "arguments": {"id": "job0"}} - {"return": {}} -@@ -13,8 +12,7 @@ Job failed: Failed to get shared "consistent read" lock - qemu-img: Failed to get shared "consistent read" lock - Is another process using the image [TEST_DIR/test.img]? - --.Formatting 'TEST_DIR/test.img', fmt=luks size=1048576 key-secret=keysec0 iter-time=10 -- -+. - Job failed: Block node is read-only - {"execute": "job-dismiss", "arguments": {"id": "job0"}} - {"return": {}} -@@ -26,12 +24,10 @@ Job failed: Failed to get shared "consistent read" lock - {"return": {}} - {"execute": "job-dismiss", "arguments": {"id": "job0"}} - {"return": {}} --.Formatting 'TEST_DIR/test.img', fmt=luks size=1048576 key-secret=keysec0 iter-time=10 -- -+. - {"return": {}} - {"error": {"class": "GenericError", "desc": "Failed to get \"write\" lock"}} --.Formatting 'TEST_DIR/test.img', fmt=luks size=1048576 key-secret=keysec0 iter-time=10 -- -+. - {"return": {}} - {"return": {}} - . -diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py -index f424e04573a7f7f07474e5d96f3e..4bb740634df7a0841456aed78c42 100644 ---- a/tests/qemu-iotests/iotests.py -+++ b/tests/qemu-iotests/iotests.py -@@ -140,7 +140,9 @@ def unarchive_sample_image(sample, fname): - - - def qemu_tool_pipe_and_status(tool: str, args: Sequence[str], -- connect_stderr: bool = True) -> Tuple[str, int]: -+ connect_stderr: bool = True, -+ drop_successful_output: bool = False) \ -+ -> Tuple[str, int]: - """ - Run a tool and return both its output and its exit code - """ -@@ -152,6 +154,8 @@ def qemu_tool_pipe_and_status(tool: str, args: Sequence[str], - cmd = ' '.join(args) - sys.stderr.write(f'{tool} received signal \ - {-subp.returncode}: {cmd}\n') -+ if drop_successful_output and subp.returncode == 0: -+ output = '' - return (output, subp.returncode) - - def qemu_img_create_prepare_args(args: List[str]) -> List[str]: -@@ -196,8 +200,10 @@ def qemu_img_pipe_and_status(*args: str) -> Tuple[str, int]: - """ - Run qemu-img and return both its output and its exit code - """ -+ is_create = bool(args and args[0] == 'create') - full_args = qemu_img_args + qemu_img_create_prepare_args(list(args)) -- return qemu_tool_pipe_and_status('qemu-img', full_args) -+ return qemu_tool_pipe_and_status('qemu-img', full_args, -+ drop_successful_output=is_create) - - def qemu_img(*args: str) -> int: - '''Run qemu-img and return the exit code''' diff --git a/iotests.py-img_info_log-rename-imgopts-a.patch b/iotests.py-img_info_log-rename-imgopts-a.patch deleted file mode 100644 index 99caf0c1..00000000 --- a/iotests.py-img_info_log-rename-imgopts-a.patch +++ /dev/null @@ -1,75 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:26 +0100 -Subject: iotests.py: img_info_log(): rename imgopts argument - -Git-commit: 3bd2b942d9a8a10bb7a504a1ecf4a3e70803840e - -We are going to support IMGOPTS environment variable like in bash -tests. Corresponding global variable in iotests.py should be called -imgopts. So to not interfere with function argument, rename it in -advance. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-2-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/210 | 8 ++++---- - tests/qemu-iotests/iotests.py | 5 +++-- - 2 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210 -index a4dcc5fe59d8ec9ec66b9cfe4770..10b0a0b87cd1c38c4f675472f560 100755 ---- a/tests/qemu-iotests/210 -+++ b/tests/qemu-iotests/210 -@@ -62,7 +62,7 @@ with iotests.FilePath('t.luks') as disk_path, \ - 'driver=luks,file.driver=file,file.filename=%s,key-secret=keysec0' % (disk_path), - filter_path=disk_path, - extra_args=['--object', 'secret,id=keysec0,data=foo'], -- imgopts=True) -+ use_image_opts=True) - - # - # Successful image creation (with non-default options) -@@ -96,7 +96,7 @@ with iotests.FilePath('t.luks') as disk_path, \ - 'driver=luks,file.driver=file,file.filename=%s,key-secret=keysec0' % (disk_path), - filter_path=disk_path, - extra_args=['--object', 'secret,id=keysec0,data=foo'], -- imgopts=True) -+ use_image_opts=True) - - # - # Invalid BlockdevRef -@@ -132,7 +132,7 @@ with iotests.FilePath('t.luks') as disk_path, \ - 'driver=luks,file.driver=file,file.filename=%s,key-secret=keysec0' % (disk_path), - filter_path=disk_path, - extra_args=['--object', 'secret,id=keysec0,data=foo'], -- imgopts=True) -+ use_image_opts=True) - - # - # Invalid sizes -@@ -176,4 +176,4 @@ with iotests.FilePath('t.luks') as disk_path, \ - 'driver=luks,file.driver=file,file.filename=%s,key-secret=keysec0' % (disk_path), - filter_path=disk_path, - extra_args=['--object', 'secret,id=keysec0,data=foo'], -- imgopts=True) -+ use_image_opts=True) -diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py -index 83bfedb90201ce96118f62dc2b37..9b374dad3dd063fbcbd10963ce5b 100644 ---- a/tests/qemu-iotests/iotests.py -+++ b/tests/qemu-iotests/iotests.py -@@ -219,9 +219,10 @@ def qemu_img_log(*args): - log(result, filters=[filter_testfiles]) - return result - --def img_info_log(filename, filter_path=None, imgopts=False, extra_args=()): -+def img_info_log(filename, filter_path=None, use_image_opts=False, -+ extra_args=()): - args = ['info'] -- if imgopts: -+ if use_image_opts: - args.append('--image-opts') - else: - args += ['-f', imgfmt] diff --git a/iotests.py-implement-unsupported_imgopts.patch b/iotests.py-implement-unsupported_imgopts.patch deleted file mode 100644 index 7b4be298..00000000 --- a/iotests.py-implement-unsupported_imgopts.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:27 +0100 -Subject: iotests.py: implement unsupported_imgopts - -Git-commit: 7c15400cdd06b7b9b26c86eac1858fb9c0d77c1c - -We are going to support some addition IMGOPTS in python iotests like -in bash iotests. Similarly to bash iotests, we want a way to skip some -tests which can't work with specific IMGOPTS. - -Globally for python iotests we will not support things like -'data_file=$TEST_IMG.ext_data_file' in IMGOPTS, so, forbid this -globally in iotests.py. - -Suggested-by: Hanna Reitz -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-3-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/iotests.py | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py -index 9b374dad3dd063fbcbd10963ce5b..35d92715ccf4defe721a38982788 100644 ---- a/tests/qemu-iotests/iotests.py -+++ b/tests/qemu-iotests/iotests.py -@@ -1215,6 +1215,17 @@ def _verify_virtio_scsi_pci_or_ccw() -> None: - notrun('Missing virtio-scsi-pci or virtio-scsi-ccw in QEMU binary') - - -+def _verify_imgopts(unsupported: Sequence[str] = ()) -> None: -+ imgopts = os.environ.get('IMGOPTS') -+ # One of usage examples for IMGOPTS is "data_file=$TEST_IMG.ext_data_file" -+ # but it supported only for bash tests. We don't have a concept of global -+ # TEST_IMG in iotests.py, not saying about somehow parsing $variables. -+ # So, for simplicity let's just not support any IMGOPTS with '$' inside. -+ unsup = list(unsupported) + ['$'] -+ if imgopts and any(x in imgopts for x in unsup): -+ notrun(f'not suitable for this imgopts: {imgopts}') -+ -+ - def supports_quorum(): - return 'quorum' in qemu_img_pipe('--help') - -@@ -1391,7 +1402,8 @@ def execute_setup_common(supported_fmts: Sequence[str] = (), - unsupported_fmts: Sequence[str] = (), - supported_protocols: Sequence[str] = (), - unsupported_protocols: Sequence[str] = (), -- required_fmts: Sequence[str] = ()) -> bool: -+ required_fmts: Sequence[str] = (), -+ unsupported_imgopts: Sequence[str] = ()) -> bool: - """ - Perform necessary setup for either script-style or unittest-style tests. - -@@ -1411,6 +1423,7 @@ def execute_setup_common(supported_fmts: Sequence[str] = (), - _verify_aio_mode(supported_aio_modes) - _verify_formats(required_fmts) - _verify_virtio_blk() -+ _verify_imgopts(unsupported_imgopts) - - return debug - diff --git a/iotests.py-qemu_img-create-support-IMGOP.patch b/iotests.py-qemu_img-create-support-IMGOP.patch deleted file mode 100644 index ab56c261..00000000 --- a/iotests.py-qemu_img-create-support-IMGOP.patch +++ /dev/null @@ -1,91 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:29 +0100 -Subject: iotests.py: qemu_img*("create"): support - IMGOPTS='compression_type=zstd' - -Git-commit: 22e29bcea12ccf0e127b91917d959c69bebbd952 - -Adding support of IMGOPTS (like in bash tests) allows user to pass a -lot of different options. Still, some may require additional logic. - -Now we want compression_type option, so add some smart logic around it: -ignore compression_type=zstd in IMGOPTS, if test want qcow2 in -compatibility mode. As well, ignore compression_type for non-qcow2 -formats. - -Note that we may instead add support only to qemu_img_create(), but -that works bad: - -1. We'll have to update a lot of tests to use qemu_img_create instead - of qemu_img('create'). (still, we may want do it anyway, but no - reason to create a dependancy between task of supporting IMGOPTS and - updating a lot of tests) - -2. Some tests use qemu_img_pipe('create', ..) - even more work on - updating - -3. Even if we update all tests to go through qemu_img_create, we'll - need a way to avoid creating new tests using qemu_img*('create') - - add assertions.. That doesn't seem good. - -So, let's add support of IMGOPTS to most generic -qemu_img_pipe_and_status(). - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-5-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/iotests.py | 27 ++++++++++++++++++++++++++- - 1 file changed, 26 insertions(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py -index 35d92715ccf4defe721a38982788..f0370b520651aa4ccc1cdb0cf28e 100644 ---- a/tests/qemu-iotests/iotests.py -+++ b/tests/qemu-iotests/iotests.py -@@ -16,6 +16,7 @@ - # along with this program. If not, see . - # - -+import argparse - import atexit - import bz2 - from collections import OrderedDict -@@ -153,11 +154,35 @@ def qemu_tool_pipe_and_status(tool: str, args: Sequence[str], - {-subp.returncode}: {cmd}\n') - return (output, subp.returncode) - -+def qemu_img_create_prepare_args(args: List[str]) -> List[str]: -+ if not args or args[0] != 'create': -+ return list(args) -+ args = args[1:] -+ -+ p = argparse.ArgumentParser(allow_abbrev=False) -+ p.add_argument('-f') -+ parsed, remaining = p.parse_known_args(args) -+ -+ result = ['create'] -+ if parsed.f is not None: -+ result += ['-f', parsed.f] -+ -+ # IMGOPTS most probably contain options specific for the selected format, -+ # like extended_l2 or compression_type for qcow2. Test may want to create -+ # additional images in other formats that doesn't support these options. -+ # So, use IMGOPTS only for images created in imgfmt format. -+ if parsed.f == imgfmt and 'IMGOPTS' in os.environ: -+ result += ['-o', os.environ['IMGOPTS']] -+ -+ result += remaining -+ -+ return result -+ - def qemu_img_pipe_and_status(*args: str) -> Tuple[str, int]: - """ - Run qemu-img and return both its output and its exit code - """ -- full_args = qemu_img_args + list(args) -+ full_args = qemu_img_args + qemu_img_create_prepare_args(list(args)) - return qemu_tool_pipe_and_status('qemu-img', full_args) - - def qemu_img(*args: str) -> int: diff --git a/iotests.py-rewrite-default-luks-support-.patch b/iotests.py-rewrite-default-luks-support-.patch deleted file mode 100644 index 3bb65336..00000000 --- a/iotests.py-rewrite-default-luks-support-.patch +++ /dev/null @@ -1,83 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:31 +0100 -Subject: iotests.py: rewrite default luks support in qemu_img - -Git-commit: 28a5ad93da08ae55c8dfac0db8615936ca14b822 - -Move the logic to more generic qemu_img_pipe_and_status(). Also behave -better when we have several -o options. And reuse argument parser of -course. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Hanna Reitz -Message-Id: <20211223160144.1097696-7-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/iotests.py | 36 +++++++++++++++++------------------ - 1 file changed, 17 insertions(+), 19 deletions(-) - -diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py -index 5a6bfcbb6adbb84d412e37966360..f424e04573a7f7f07474e5d96f3e 100644 ---- a/tests/qemu-iotests/iotests.py -+++ b/tests/qemu-iotests/iotests.py -@@ -160,9 +160,13 @@ def qemu_img_create_prepare_args(args: List[str]) -> List[str]: - args = args[1:] - - p = argparse.ArgumentParser(allow_abbrev=False) -+ # -o option may be specified several times -+ p.add_argument('-o', action='append', default=[]) - p.add_argument('-f') - parsed, remaining = p.parse_known_args(args) - -+ opts_list = parsed.o -+ - result = ['create'] - if parsed.f is not None: - result += ['-f', parsed.f] -@@ -171,8 +175,18 @@ def qemu_img_create_prepare_args(args: List[str]) -> List[str]: - # like extended_l2 or compression_type for qcow2. Test may want to create - # additional images in other formats that doesn't support these options. - # So, use IMGOPTS only for images created in imgfmt format. -- if parsed.f == imgfmt and 'IMGOPTS' in os.environ: -- result += ['-o', os.environ['IMGOPTS']] -+ imgopts = os.environ.get('IMGOPTS') -+ if imgopts and parsed.f == imgfmt: -+ opts_list.insert(0, imgopts) -+ -+ # default luks support -+ if parsed.f == 'luks' and \ -+ all('key-secret' not in opts for opts in opts_list): -+ result += ['--object', luks_default_secret_object] -+ opts_list.append(luks_default_key_secret_opt) -+ -+ for opts in opts_list: -+ result += ['-o', opts] - - result += remaining - -@@ -203,23 +217,7 @@ def ordered_qmp(qmsg, conv_keys=True): - return qmsg - - def qemu_img_create(*args): -- args = list(args) -- -- # default luks support -- if '-f' in args and args[args.index('-f') + 1] == 'luks': -- if '-o' in args: -- i = args.index('-o') -- if 'key-secret' not in args[i + 1]: -- args[i + 1].append(luks_default_key_secret_opt) -- args.insert(i + 2, '--object') -- args.insert(i + 3, luks_default_secret_object) -- else: -- args = ['-o', luks_default_key_secret_opt, -- '--object', luks_default_secret_object] + args -- -- args.insert(0, 'create') -- -- return qemu_img(*args) -+ return qemu_img('create', *args) - - def qemu_img_measure(*args): - return json.loads(qemu_img_pipe("measure", "--output", "json", *args)) diff --git a/linux-user-Fake-proc-cpuinfo.patch b/linux-user-Fake-proc-cpuinfo.patch index ac6673b8..56929e6c 100644 --- a/linux-user-Fake-proc-cpuinfo.patch +++ b/linux-user-Fake-proc-cpuinfo.patch @@ -21,10 +21,10 @@ Signed-off-by: Andreas Färber 1 file changed, 24 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 0a1d99cb44d168d561de4c42e132..d4f3295b9d1837126f35d8357e80 100644 +index c9adb65a2293e9735341a217a68d..8de1bb8d48eeb867a1047d986299 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -7871,6 +7871,27 @@ static int open_self_stat(void *cpu_env, int fd) +@@ -8099,6 +8099,27 @@ static int open_self_stat(void *cpu_env, int fd) return 0; } @@ -52,7 +52,7 @@ index 0a1d99cb44d168d561de4c42e132..d4f3295b9d1837126f35d8357e80 100644 static int open_self_auxv(void *cpu_env, int fd) { CPUState *cpu = env_cpu((CPUArchState *)cpu_env); -@@ -8025,6 +8046,9 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, +@@ -8253,6 +8274,9 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, #if defined(TARGET_SPARC) || defined(TARGET_HPPA) { "/proc/cpuinfo", open_cpuinfo, is_proc }, #endif diff --git a/linux-user-add-binfmt-wrapper-for-argv-0.patch b/linux-user-add-binfmt-wrapper-for-argv-0.patch index 903e6785..e895cc21 100644 --- a/linux-user-add-binfmt-wrapper-for-argv-0.patch +++ b/linux-user-add-binfmt-wrapper-for-argv-0.patch @@ -82,10 +82,10 @@ index 0000000000000000000000000000000000000000..cd1f513b334f3b263d9e4b5adb1981e3 + return execve(new_argv[0], new_argv, envp); +} diff --git a/meson.build b/meson.build -index 96de1a6ef948542aa93bd0324200..612da7167f5c4aafcf77a0e1ce55 100644 +index 861de93c4f58f294f9d353c9674e..05740dd14228fb700ecf6b793cfc 100644 --- a/meson.build +++ b/meson.build -@@ -3043,6 +3043,11 @@ endforeach +@@ -3336,6 +3336,11 @@ endforeach # Other build targets diff --git a/linux-user-lseek-explicitly-cast-non-set.patch b/linux-user-lseek-explicitly-cast-non-set.patch index f9d545b4..d879cd0e 100644 --- a/linux-user-lseek-explicitly-cast-non-set.patch +++ b/linux-user-lseek-explicitly-cast-non-set.patch @@ -15,10 +15,10 @@ Signed-off-by: Alexander Graf 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 381066e788eb36c1d6ca5b872353..7fe3a69c7cd860d7c1a8ea88a48d 100644 +index 5096b1258f6d631b80fb6cca6011..ae26ad25466aca617d272e4c7474 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -8701,8 +8701,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_ulong arg1, +@@ -8929,8 +8929,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_ulong arg1, return ret; #endif #ifdef TARGET_NR_lseek diff --git a/linux-user-use-target_ulong.patch b/linux-user-use-target_ulong.patch index 892902ed..8ef9e66d 100644 --- a/linux-user-use-target_ulong.patch +++ b/linux-user-use-target_ulong.patch @@ -12,16 +12,29 @@ Pass syscall arguments as ulong always. Signed-off-by: Alexander Graf [JRZ: changes from linux-user/qemu.h wass moved to linux-user/user-internals.h] Signed-off-by: Jose R Ziviani +[DF: Forward port, i.e., use ulong for do_prctl too] +Signed-off-by: Dario Faggioli --- - linux-user/syscall.c | 18 +++++++++--------- + linux-user/syscall.c | 20 ++++++++++---------- linux-user/user-internals.h | 8 ++++---- - 2 files changed, 13 insertions(+), 13 deletions(-) + 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index d4f3295b9d1837126f35d8357e80..381066e788eb36c1d6ca5b872353 100644 +index 8de1bb8d48eeb867a1047d986299..5096b1258f6d631b80fb6cca6011 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -8346,10 +8346,10 @@ _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) +@@ -6406,8 +6406,8 @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_long arg2) + #define do_prctl_set_unalign do_prctl_inval1 + #endif + +-static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, +- abi_long arg3, abi_long arg4, abi_long arg5) ++static abi_long do_prctl(CPUArchState *env, abi_ulong option, abi_ulong arg2, ++ abi_ulong arg3, abi_ulong arg4, abi_ulong arg5) + { + abi_long ret; + +@@ -8574,10 +8574,10 @@ _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) * of syscall results, can be performed. * All errnos that do_syscall() returns must be -TARGET_. */ @@ -36,16 +49,7 @@ index d4f3295b9d1837126f35d8357e80..381066e788eb36c1d6ca5b872353 100644 { CPUState *cpu = env_cpu(cpu_env); abi_long ret; -@@ -10807,7 +10807,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, - */ - ret = -TARGET_EINVAL; - if (cpu_isar_feature(aa64_sve, env_archcpu(cpu_env)) -- && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) { -+ && arg2 <= 512 * 16 && !(arg2 & 15)) { - CPUARMState *env = cpu_env; - ARMCPU *cpu = env_archcpu(env); - uint32_t vq, old_vq; -@@ -13176,10 +13176,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, +@@ -13201,10 +13201,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return ret; } @@ -61,10 +65,10 @@ index d4f3295b9d1837126f35d8357e80..381066e788eb36c1d6ca5b872353 100644 CPUState *cpu = env_cpu(cpu_env); abi_long ret; diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h -index 661612a088b5c4e37f8f9fbcb6af..db24553432003b2faa3957d63c3d 100644 +index ee152ccfaa8fdfa33b1e6d36b8ab..7117d8b2c583a16311ef82a0eb60 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h -@@ -60,10 +60,10 @@ int info_is_fdpic(struct image_info *info); +@@ -59,10 +59,10 @@ int info_is_fdpic(struct image_info *info); void target_set_brk(abi_ulong new_brk); void syscall_init(void); @@ -77,5 +81,5 @@ index 661612a088b5c4e37f8f9fbcb6af..db24553432003b2faa3957d63c3d 100644 + abi_ulong arg5, abi_ulong arg6, abi_ulong arg7, + abi_ulong arg8); extern __thread CPUState *thread_cpu; - void cpu_loop(CPUArchState *env); + void QEMU_NORETURN cpu_loop(CPUArchState *env); const char *target_strerror(int err); diff --git a/meson-build-all-modules-by-default.patch b/meson-build-all-modules-by-default.patch deleted file mode 100644 index 316853ba..00000000 --- a/meson-build-all-modules-by-default.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Paolo Bonzini -Date: Fri, 7 Jan 2022 13:00:44 +0100 -Subject: meson: build all modules by default - -Git-commit: fb72176ba64057ce0ee5c1a0a443d9f72e270636 - -With more recent versions of Meson, the build.ninja file is more selective -as to what is built by default, and not building the modules results in test -failures. - -Mark the modules as built-by-default and, to make the dependencies more -precise, also require them to be up-to-date before running tests. - -Resolves: https://gitlab.com/qemu-project/qemu/-/issues/801 -Tested-by: Li Zhang -Signed-off-by: Paolo Bonzini -Signed-off-by: Li Zhang ---- - meson.build | 4 +++- - tests/qtest/meson.build | 3 +-- - 2 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index 612da7167f5c4aafcf77a0e1ce55..4997739df656a10fa1822116102a 100644 ---- a/meson.build -+++ b/meson.build -@@ -2818,8 +2818,10 @@ common_ss.add(hwcore) - # Targets # - ########### - -+emulator_modules = [] - foreach m : block_mods + softmmu_mods -- shared_module(m.name(), -+ emulator_modules += shared_module(m.name(), -+ build_by_default: true, - name_prefix: '', - link_whole: m, - install: true, -diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build -index c9d8458062ff6b88d1c28cb21e8f..6aff75bafa5761da141f27e6b1ee 100644 ---- a/tests/qtest/meson.build -+++ b/tests/qtest/meson.build -@@ -299,10 +299,9 @@ foreach dir : target_dirs - test: executable(test, src, dependencies: deps) - } - endif -- # FIXME: missing dependency on the emulator binary and qemu-img - test('qtest-@0@/@1@'.format(target_base, test), - qtest_executables[test], -- depends: [test_deps, qtest_emulator], -+ depends: [test_deps, qtest_emulator, emulator_modules], - env: qtest_env, - args: ['--tap', '-k'], - protocol: 'tap', diff --git a/meson-install-ivshmem-client-and-ivshmem.patch b/meson-install-ivshmem-client-and-ivshmem.patch index 51ccd979..52ddbb73 100644 --- a/meson-install-ivshmem-client-and-ivshmem.patch +++ b/meson-install-ivshmem-client-and-ivshmem.patch @@ -11,21 +11,21 @@ Signed-off-by: Bruce Rogers 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/ivshmem-client/meson.build b/contrib/ivshmem-client/meson.build -index 1b171efb4f536f608191cd4cba1b..83a559117fd1a2c99f34a43fa38d 100644 +index ce8dcca84ddb23de1d8eaa813f5a..bc77336258302e0f7a962ef47ed6 100644 --- a/contrib/ivshmem-client/meson.build +++ b/contrib/ivshmem-client/meson.build @@ -1,4 +1,4 @@ - executable('ivshmem-client', files('ivshmem-client.c', 'main.c'), + executable('ivshmem-client', files('ivshmem-client.c', 'main.c'), genh, dependencies: glib, build_by_default: targetos == 'linux', - install: false) + install: true) diff --git a/contrib/ivshmem-server/meson.build b/contrib/ivshmem-server/meson.build -index 3a539422017e6dc342e098c3e9c8..a1c39aa3b30e9c56941cbc394f86 100644 +index c6c3c82e89f363e1929bfa08e318..185879a0c6ce71b1272a7ef6ce4d 100644 --- a/contrib/ivshmem-server/meson.build +++ b/contrib/ivshmem-server/meson.build @@ -1,4 +1,4 @@ - executable('ivshmem-server', files('ivshmem-server.c', 'main.c'), + executable('ivshmem-server', files('ivshmem-server.c', 'main.c'), genh, dependencies: [qemuutil, rt], build_by_default: targetos == 'linux', - install: false) diff --git a/modules-generates-per-target-modinfo.patch b/modules-generates-per-target-modinfo.patch new file mode 100644 index 00000000..cd608ff7 --- /dev/null +++ b/modules-generates-per-target-modinfo.patch @@ -0,0 +1,134 @@ +From: "Jose R. Ziviani" +Date: Tue, 28 Sep 2021 17:46:28 -0300 +Subject: modules: generates per-target modinfo + +Git-commit: 0000000000000000000000000000000000000000 +References: bsc#1199015 + +This patch changes the way modinfo is generated and built. Instead of +one modinfo.c it generates one modinfo--softmmu.c per target. It +aims a fine-tune control of modules by configuring Kconfig. + +Signed-off-by: Jose R. Ziviani +Signed-off-by: Dario Faggioli +--- + meson.build | 25 +++++++++++++++------- + scripts/modinfo-generate.py | 42 ++++++++++++++++++++++--------------- + 2 files changed, 42 insertions(+), 25 deletions(-) + +diff --git a/meson.build b/meson.build +index 05740dd14228fb700ecf6b793cfc..eeaa045c90402cee5ba946f321c1 100644 +--- a/meson.build ++++ b/meson.build +@@ -2999,14 +2999,23 @@ foreach d, list : target_modules + endforeach + + if enable_modules +- modinfo_src = custom_target('modinfo.c', +- output: 'modinfo.c', +- input: modinfo_files, +- command: [modinfo_generate, '@INPUT@'], +- capture: true) +- modinfo_lib = static_library('modinfo', modinfo_src) +- modinfo_dep = declare_dependency(link_whole: modinfo_lib) +- softmmu_ss.add(modinfo_dep) ++ foreach target : target_dirs ++ if target.endswith('-softmmu') ++ config_target = config_target_mak[target] ++ config_devices_mak = target + '-config-devices.mak' ++ modinfo_src = custom_target('modinfo-' + target + '.c', ++ output: 'modinfo-' + target + '.c', ++ input: modinfo_files, ++ command: [modinfo_generate, '--devices', config_devices_mak, '@INPUT@'], ++ capture: true) ++ ++ modinfo_lib = static_library('modinfo-' + target + '.c', modinfo_src) ++ modinfo_dep = declare_dependency(link_with: modinfo_lib) ++ ++ arch = config_target['TARGET_NAME'] == 'sparc64' ? 'sparc64' : config_target['TARGET_BASE_ARCH'] ++ hw_arch[arch].add(modinfo_dep) ++ endif ++ endforeach + endif + + nm = find_program('nm') +diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py +index 689f33c0f2919508341712a1cde4..a0c09edae1009bc77964e95d585f 100755 +--- a/scripts/modinfo-generate.py ++++ b/scripts/modinfo-generate.py +@@ -32,7 +32,7 @@ def parse_line(line): + continue + return (kind, data) + +-def generate(name, lines): ++def generate(name, lines, core_modules): + arch = "" + objs = [] + deps = [] +@@ -49,7 +49,13 @@ def generate(name, lines): + elif kind == 'arch': + arch = data; + elif kind == 'kconfig': +- pass # ignore ++ # don't add a module which dependency is not enabled ++ # in kconfig ++ if data.strip() not in core_modules: ++ print(" /* module {} isn't enabled in Kconfig. */" ++ .format(data.strip())) ++ print("/* },{ */") ++ return [] + else: + print("unknown:", kind) + exit(1) +@@ -60,7 +66,7 @@ def generate(name, lines): + print_array("objs", objs) + print_array("deps", deps) + print_array("opts", opts) +- print("},{"); ++ print("},{") + return deps + + def print_pre(): +@@ -74,26 +80,28 @@ def print_post(): + print("}};") + + def main(args): ++ if len(args) < 3 or args[0] != '--devices': ++ print('Expected: modinfo-generate.py --devices ' ++ 'config-device.mak [modinfo files]', file=sys.stderr) ++ exit(1) ++ ++ # get all devices enabled in kconfig, from *-config-device.mak ++ enabled_core_modules = set() ++ with open(args[1]) as file: ++ for line in file.readlines(): ++ config = line.split('=') ++ if config[1].rstrip() == 'y': ++ enabled_core_modules.add(config[0][7:]) # remove CONFIG_ ++ + deps = {} + print_pre() +- for modinfo in args: ++ for modinfo in args[2:]: + with open(modinfo) as f: + lines = f.readlines() + print(" /* %s */" % modinfo) +- (basename, ext) = os.path.splitext(modinfo) +- deps[basename] = generate(basename, lines) ++ (basename, _) = os.path.splitext(modinfo) ++ deps[basename] = generate(basename, lines, enabled_core_modules) + print_post() + +- flattened_deps = {flat.strip('" ') for dep in deps.values() for flat in dep} +- error = False +- for dep in flattened_deps: +- if dep not in deps.keys(): +- print("Dependency {} cannot be satisfied".format(dep), +- file=sys.stderr) +- error = True +- +- if error: +- exit(1) +- + if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/modules-introduces-module_kconfig-direct.patch b/modules-introduces-module_kconfig-direct.patch new file mode 100644 index 00000000..f1ffda04 --- /dev/null +++ b/modules-introduces-module_kconfig-direct.patch @@ -0,0 +1,266 @@ +From: "Jose R. Ziviani" +Date: Tue, 28 Sep 2021 17:46:27 -0300 +Subject: modules: introduces module_kconfig directive + +Git-commit: 0000000000000000000000000000000000000000 +References: bsc#1199015 + +module_kconfig is a new directive that should be used with module_obj +whenever that module depends on the Kconfig to be enabled. + +When the module is enabled in Kconfig we are sure that its dependencies +will be enabled as well, thus the module will be loaded without any +problem. + +The correct way to use module_kconfig is by passing the Kconfig option +to module_kconfig (or the *config-devices.mak without CONFIG_). + +Signed-off-by: Jose R. Ziviani +Signed-off-by: Dario Faggioli +--- + hw/display/qxl.c | 1 + + hw/display/vhost-user-gpu-pci.c | 1 + + hw/display/vhost-user-gpu.c | 1 + + hw/display/vhost-user-vga.c | 1 + + hw/display/virtio-gpu-base.c | 1 + + hw/display/virtio-gpu-gl.c | 1 + + hw/display/virtio-gpu-pci-gl.c | 1 + + hw/display/virtio-gpu-pci.c | 1 + + hw/display/virtio-gpu.c | 1 + + hw/display/virtio-vga-gl.c | 1 + + hw/display/virtio-vga.c | 1 + + hw/s390x/virtio-ccw-gpu.c | 1 + + hw/usb/ccid-card-emulated.c | 1 + + hw/usb/ccid-card-passthru.c | 1 + + hw/usb/host-libusb.c | 1 + + hw/usb/redirect.c | 1 + + include/qemu/module.h | 10 ++++++++++ + scripts/modinfo-generate.py | 2 ++ + 18 files changed, 28 insertions(+) + +diff --git a/hw/display/qxl.c b/hw/display/qxl.c +index adbdbcaeb6121106bfcaee288d4c..092fb36b3a928b062067207d7518 100644 +--- a/hw/display/qxl.c ++++ b/hw/display/qxl.c +@@ -2515,6 +2515,7 @@ static const TypeInfo qxl_primary_info = { + .class_init = qxl_primary_class_init, + }; + module_obj("qxl-vga"); ++module_kconfig(QXL); + + static void qxl_secondary_class_init(ObjectClass *klass, void *data) + { +diff --git a/hw/display/vhost-user-gpu-pci.c b/hw/display/vhost-user-gpu-pci.c +index daefcf7101590cbd3b3681ac6fa9..d119bcae45d48e6eb14afe7d26e6 100644 +--- a/hw/display/vhost-user-gpu-pci.c ++++ b/hw/display/vhost-user-gpu-pci.c +@@ -44,6 +44,7 @@ static const VirtioPCIDeviceTypeInfo vhost_user_gpu_pci_info = { + .instance_init = vhost_user_gpu_pci_initfn, + }; + module_obj(TYPE_VHOST_USER_GPU_PCI); ++module_kconfig(VHOST_USER_GPU); + + static void vhost_user_gpu_pci_register_types(void) + { +diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c +index 09818231bd24a9f8acd7ee3c2e15..5fc192022346dfc7ad5646db069d 100644 +--- a/hw/display/vhost-user-gpu.c ++++ b/hw/display/vhost-user-gpu.c +@@ -599,6 +599,7 @@ static const TypeInfo vhost_user_gpu_info = { + .class_init = vhost_user_gpu_class_init, + }; + module_obj(TYPE_VHOST_USER_GPU); ++module_kconfig(VHOST_USER_GPU); + + static void vhost_user_gpu_register_types(void) + { +diff --git a/hw/display/vhost-user-vga.c b/hw/display/vhost-user-vga.c +index 072c9c65bc754f399bc49a3dbb88..0c146080fd2c15ff9fd86338164e 100644 +--- a/hw/display/vhost-user-vga.c ++++ b/hw/display/vhost-user-vga.c +@@ -45,6 +45,7 @@ static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = { + .instance_init = vhost_user_vga_inst_initfn, + }; + module_obj(TYPE_VHOST_USER_VGA); ++module_kconfig(VHOST_USER_VGA); + + static void vhost_user_vga_register_types(void) + { +diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c +index fff0fb4a828a0814ab5290a17f78..a8a5a8812f331fa56e3ef6a18821 100644 +--- a/hw/display/virtio-gpu-base.c ++++ b/hw/display/virtio-gpu-base.c +@@ -260,6 +260,7 @@ static const TypeInfo virtio_gpu_base_info = { + .abstract = true + }; + module_obj(TYPE_VIRTIO_GPU_BASE); ++module_kconfig(VIRTIO_GPU); + + static void + virtio_register_types(void) +diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c +index 6cc4313b1af2c3fac0011d6b39aa..f7837cc44dc41c665b703d12c79f 100644 +--- a/hw/display/virtio-gpu-gl.c ++++ b/hw/display/virtio-gpu-gl.c +@@ -160,6 +160,7 @@ static const TypeInfo virtio_gpu_gl_info = { + .class_init = virtio_gpu_gl_class_init, + }; + module_obj(TYPE_VIRTIO_GPU_GL); ++module_kconfig(VIRTIO_GPU); + + static void virtio_register_types(void) + { +diff --git a/hw/display/virtio-gpu-pci-gl.c b/hw/display/virtio-gpu-pci-gl.c +index 99b14a07185ea6b3a2a2f99f167f..a2819e1ca93f98022a81b5a14d18 100644 +--- a/hw/display/virtio-gpu-pci-gl.c ++++ b/hw/display/virtio-gpu-pci-gl.c +@@ -47,6 +47,7 @@ static const VirtioPCIDeviceTypeInfo virtio_gpu_gl_pci_info = { + .instance_init = virtio_gpu_gl_initfn, + }; + module_obj(TYPE_VIRTIO_GPU_GL_PCI); ++module_kconfig(VIRTIO_PCI); + + static void virtio_gpu_gl_pci_register_types(void) + { +diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c +index e36eee0c409bb8d3bf7cbec85278..93f214ff58127452d0d56a19c361 100644 +--- a/hw/display/virtio-gpu-pci.c ++++ b/hw/display/virtio-gpu-pci.c +@@ -65,6 +65,7 @@ static const TypeInfo virtio_gpu_pci_base_info = { + .abstract = true + }; + module_obj(TYPE_VIRTIO_GPU_PCI_BASE); ++module_kconfig(VIRTIO_PCI); + + #define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci" + typedef struct VirtIOGPUPCI VirtIOGPUPCI; +diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c +index 529b5246b2b55da16445712e4173..cd4a56056fd9407a904470878318 100644 +--- a/hw/display/virtio-gpu.c ++++ b/hw/display/virtio-gpu.c +@@ -1452,6 +1452,7 @@ static const TypeInfo virtio_gpu_info = { + .class_init = virtio_gpu_class_init, + }; + module_obj(TYPE_VIRTIO_GPU); ++module_kconfig(VIRTIO_GPU); + + static void virtio_register_types(void) + { +diff --git a/hw/display/virtio-vga-gl.c b/hw/display/virtio-vga-gl.c +index f22549097c5e8bb070da6d1c28d4..984faa6b39a80bc786e31ec3d393 100644 +--- a/hw/display/virtio-vga-gl.c ++++ b/hw/display/virtio-vga-gl.c +@@ -37,6 +37,7 @@ static VirtioPCIDeviceTypeInfo virtio_vga_gl_info = { + .instance_init = virtio_vga_gl_inst_initfn, + }; + module_obj(TYPE_VIRTIO_VGA_GL); ++module_kconfig(VIRTIO_VGA); + + static void virtio_vga_register_types(void) + { +diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c +index 7b55c8d0e72390b430fc4ad30f9f..c206b5da384bcc18dd14d3fcf62a 100644 +--- a/hw/display/virtio-vga.c ++++ b/hw/display/virtio-vga.c +@@ -231,6 +231,7 @@ static const TypeInfo virtio_vga_base_info = { + .abstract = true, + }; + module_obj(TYPE_VIRTIO_VGA_BASE); ++module_kconfig(VIRTIO_VGA); + + #define TYPE_VIRTIO_VGA "virtio-vga" + +diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c +index 5868a2a07093f163f93690b9b87b..024e8990f499b0b95f8912da86d5 100644 +--- a/hw/s390x/virtio-ccw-gpu.c ++++ b/hw/s390x/virtio-ccw-gpu.c +@@ -60,6 +60,7 @@ static const TypeInfo virtio_ccw_gpu = { + .class_init = virtio_ccw_gpu_class_init, + }; + module_obj(TYPE_VIRTIO_GPU_CCW); ++module_kconfig(VIRTIO_CCW); + + static void virtio_ccw_gpu_register(void) + { +diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c +index 6c8c0355e099c94a84fdf3b4ab12..1ddf7297f6125d59eae04a2ef5c4 100644 +--- a/hw/usb/ccid-card-emulated.c ++++ b/hw/usb/ccid-card-emulated.c +@@ -613,6 +613,7 @@ static const TypeInfo emulated_card_info = { + .class_init = emulated_class_initfn, + }; + module_obj(TYPE_EMULATED_CCID); ++module_kconfig(USB); + + static void ccid_card_emulated_register_types(void) + { +diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c +index fa3040fb7154419ce9767d55e4ed..748544d170835ca5a1ef99c1faac 100644 +--- a/hw/usb/ccid-card-passthru.c ++++ b/hw/usb/ccid-card-passthru.c +@@ -415,6 +415,7 @@ static const TypeInfo passthru_card_info = { + .class_init = passthru_class_initfn, + }; + module_obj(TYPE_CCID_PASSTHRU); ++module_kconfig(USB); + + static void ccid_card_passthru_register_types(void) + { +diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c +index 2b35cb6cdd3933f2cf98307bcc4e..28f8af8941ff6db20283fcd85d23 100644 +--- a/hw/usb/host-libusb.c ++++ b/hw/usb/host-libusb.c +@@ -1809,6 +1809,7 @@ static const TypeInfo usb_host_dev_info = { + .instance_init = usb_host_instance_init, + }; + module_obj(TYPE_USB_HOST_DEVICE); ++module_kconfig(USB); + + static void usb_host_register_types(void) + { +diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c +index 8692ea256109532acf791bb590bd..b384ad7e73fbea58655324a65fb8 100644 +--- a/hw/usb/redirect.c ++++ b/hw/usb/redirect.c +@@ -2620,6 +2620,7 @@ static const TypeInfo usbredir_dev_info = { + .instance_init = usbredir_instance_init, + }; + module_obj(TYPE_USB_REDIR); ++module_kconfig(USB); + + static void usbredir_register_types(void) + { +diff --git a/include/qemu/module.h b/include/qemu/module.h +index 5fcc323b2a79d5adfdf27fa19bf7..bd73607104c951a34512a156cff0 100644 +--- a/include/qemu/module.h ++++ b/include/qemu/module.h +@@ -135,6 +135,16 @@ void module_allow_arch(const char *arch); + */ + #define module_opts(name) modinfo(opts, name) + ++/** ++ * module_kconfig ++ * ++ * @name: Kconfig requirement necessary to load the module ++ * ++ * This module requires a core module that should be implemented and ++ * enabled in Kconfig. ++ */ ++#define module_kconfig(name) modinfo(kconfig, name) ++ + /* + * module info database + * +diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py +index f559eed0077a22bfd25a26a79c01..689f33c0f2919508341712a1cde4 100755 +--- a/scripts/modinfo-generate.py ++++ b/scripts/modinfo-generate.py +@@ -48,6 +48,8 @@ def generate(name, lines): + opts.append(data) + elif kind == 'arch': + arch = data; ++ elif kind == 'kconfig': ++ pass # ignore + else: + print("unknown:", kind) + exit(1) diff --git a/modules-quick-fix-a-fundamental-error-in.patch b/modules-quick-fix-a-fundamental-error-in.patch deleted file mode 100644 index 87b6b8d9..00000000 --- a/modules-quick-fix-a-fundamental-error-in.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: "Jose R. Ziviani" -Date: Thu, 16 Sep 2021 00:52:34 -0300 -Subject: modules: quick-fix a fundamental error in modules - -Git-commit: 00000000000000000000000000000000000000000 -References: bsc#1190573 - -modinfo.c is generated regarding the arch being built. However, if we -build multiple arch targets at once, modinfo.c will list modules that -might not be supported by all these targets. When trying to run these -targets, errors[1] will appear. - -This patch is a bandaid specific to s390x. It will be removed as soon -as a better approach is fixed upstream. - -[1] -$ qemu-system-s390x -nodefaults -display none -accel qtest -M none -device help -Failed to open module: /home/jose/qemu/build/hw-display-virtio-vga.so: undefined symbol: vmstate_vga_common - -Signed-off-by: Jose R. Ziviani ---- - include/qemu/module.h | 1 + - util/module.c | 33 +++++++++++++++++++++++++++++++++ - 2 files changed, 34 insertions(+) - -diff --git a/include/qemu/module.h b/include/qemu/module.h -index 5fcc323b2a79d5adfdf27fa19bf7..ed051a6c0e7df56015e25936e641 100644 ---- a/include/qemu/module.h -+++ b/include/qemu/module.h -@@ -73,6 +73,7 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail); - void module_load_qom_one(const char *type); - void module_load_qom_all(void); - void module_allow_arch(const char *arch); -+bool s390x_blocklist(const char *name); - - /** - * DOC: module info annotation macros -diff --git a/util/module.c b/util/module.c -index 6bb4ad915a1c86f1601a4913a29c..8370d4c6209eda4319342b202f6b 100644 ---- a/util/module.c -+++ b/util/module.c -@@ -119,6 +119,35 @@ static const QemuModinfo module_info_stub[] = { { - static const QemuModinfo *module_info = module_info_stub; - static const char *module_arch; - -+bool s390x_blocklist(const char *name) -+{ -+ const char *blocklist[] = { -+ "hw-display-qxl", -+ "hw-display-virtio-vga", -+ "hw-display-virtio-vga-gl", -+ "hw-usb-host", -+ "hw-usb-redirect", -+ "hw-usb-smartcard" -+ }; -+ -+ const size_t len = sizeof(blocklist) / sizeof(blocklist[0]); -+ -+ if (strcmp(module_arch, "x86_64") == 0 || -+ strcmp(module_arch, "i386") == 0 || -+ strcmp(module_arch, "arm") == 0 || -+ strcmp(module_arch, "aarch64") == 0) { -+ return false; -+ } -+ -+ for (size_t i = 0; i < len; i++) { -+ if (strcmp(blocklist[i], name) == 0) { -+ return true; -+ } -+ } -+ -+ return false; -+} -+ - void module_init_info(const QemuModinfo *info) - { - module_info = info; -@@ -131,6 +160,10 @@ void module_allow_arch(const char *arch) - - static bool module_check_arch(const QemuModinfo *modinfo) - { -+ if (modinfo->name && s390x_blocklist(modinfo->name)) { -+ return false; -+ } -+ - if (modinfo->arch) { - if (!module_arch) { - /* no arch set -> ignore all */ diff --git a/numa-Enable-numa-for-SGX-EPC-sections.patch b/numa-Enable-numa-for-SGX-EPC-sections.patch deleted file mode 100644 index 84cb795f..00000000 --- a/numa-Enable-numa-for-SGX-EPC-sections.patch +++ /dev/null @@ -1,277 +0,0 @@ -From: Yang Zhong -Date: Mon, 1 Nov 2021 12:20:05 -0400 -Subject: numa: Enable numa for SGX EPC sections - -Git-commit: 1105812382e1126d86dddc16b3700f8c79dc93d1 -References: bsc#1197807 - -The basic SGX did not enable numa for SGX EPC sections, which -result in all EPC sections located in numa node 0. This patch -enable SGX numa function in the guest and the EPC section can -work with RAM as one numa node. - -The Guest kernel related log: -[ 0.009981] ACPI: SRAT: Node 0 PXM 0 [mem 0x180000000-0x183ffffff] -[ 0.009982] ACPI: SRAT: Node 1 PXM 1 [mem 0x184000000-0x185bfffff] -The SRAT table can normally show SGX EPC sections menory info in different -numa nodes. - -The SGX EPC numa related command: - ...... - -m 4G,maxmem=20G \ - -smp sockets=2,cores=2 \ - -cpu host,+sgx-provisionkey \ - -object memory-backend-ram,size=2G,host-nodes=0,policy=bind,id=node0 \ - -object memory-backend-epc,id=mem0,size=64M,prealloc=on,host-nodes=0,policy=bind \ - -numa node,nodeid=0,cpus=0-1,memdev=node0 \ - -object memory-backend-ram,size=2G,host-nodes=1,policy=bind,id=node1 \ - -object memory-backend-epc,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \ - -numa node,nodeid=1,cpus=2-3,memdev=node1 \ - -M sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1 \ - ...... - -Signed-off-by: Yang Zhong -Message-Id: <20211101162009.62161-2-yang.zhong@intel.com> -Signed-off-by: Paolo Bonzini -Signed-off-by: Li Zhang ---- - hw/core/numa.c | 5 ++--- - hw/i386/acpi-build.c | 2 ++ - hw/i386/sgx-epc.c | 3 +++ - hw/i386/sgx-stub.c | 4 ++++ - hw/i386/sgx.c | 44 +++++++++++++++++++++++++++++++++++++++ - include/hw/i386/sgx-epc.h | 3 +++ - monitor/hmp-cmds.c | 1 + - qapi/machine.json | 10 ++++++++- - qemu-options.hx | 4 ++-- - 9 files changed, 70 insertions(+), 6 deletions(-) - -diff --git a/hw/core/numa.c b/hw/core/numa.c -index e6050b22739f44a0c9acbed54599..1aa05dcf425f46eca6ac0468d56a 100644 ---- a/hw/core/numa.c -+++ b/hw/core/numa.c -@@ -784,9 +784,8 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[]) - break; - case MEMORY_DEVICE_INFO_KIND_SGX_EPC: - se = value->u.sgx_epc.data; -- /* TODO: once we support numa, assign to right node */ -- node_mem[0].node_mem += se->size; -- node_mem[0].node_plugged_mem += se->size; -+ node_mem[se->node].node_mem += se->size; -+ node_mem[se->node].node_plugged_mem = 0; - break; - default: - g_assert_not_reached(); -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index a99c6e4fe3fad88da568c9f738d7..8383b83ee36027631356f28aaedd 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -2068,6 +2068,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) - nvdimm_build_srat(table_data); - } - -+ sgx_epc_build_srat(table_data); -+ - /* - * TODO: this part is not in ACPI spec and current linux kernel boots fine - * without these entries. But I recall there were issues the last time I -diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c -index e508827e787b7b7a38cf9785a030..96b2940d75eba983124effc9963f 100644 ---- a/hw/i386/sgx-epc.c -+++ b/hw/i386/sgx-epc.c -@@ -21,6 +21,7 @@ - - static Property sgx_epc_properties[] = { - DEFINE_PROP_UINT64(SGX_EPC_ADDR_PROP, SGXEPCDevice, addr, 0), -+ DEFINE_PROP_UINT32(SGX_EPC_NUMA_NODE_PROP, SGXEPCDevice, node, 0), - DEFINE_PROP_LINK(SGX_EPC_MEMDEV_PROP, SGXEPCDevice, hostmem, - TYPE_MEMORY_BACKEND_EPC, HostMemoryBackendEpc *), - DEFINE_PROP_END_OF_LIST(), -@@ -139,6 +140,8 @@ static void sgx_epc_md_fill_device_info(const MemoryDeviceState *md, - se->memaddr = epc->addr; - se->size = object_property_get_uint(OBJECT(epc), SGX_EPC_SIZE_PROP, - NULL); -+ se->node = object_property_get_uint(OBJECT(epc), SGX_EPC_NUMA_NODE_PROP, -+ NULL); - se->memdev = object_get_canonical_path(OBJECT(epc->hostmem)); - - info->u.sgx_epc.data = se; -diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c -index c9b379e66519210337f039523593..26833eb233c5b6448831c76c3126 100644 ---- a/hw/i386/sgx-stub.c -+++ b/hw/i386/sgx-stub.c -@@ -6,6 +6,10 @@ - #include "qapi/error.h" - #include "qapi/qapi-commands-misc-target.h" - -+void sgx_epc_build_srat(GArray *table_data) -+{ -+} -+ - SGXInfo *qmp_query_sgx(Error **errp) - { - error_setg(errp, "SGX support is not compiled in"); -diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c -index 8fef3dd8fad4c20a4c9a3169f6e3..d04299904a2315308cbaa0ef7dcf 100644 ---- a/hw/i386/sgx.c -+++ b/hw/i386/sgx.c -@@ -23,6 +23,7 @@ - #include "sysemu/hw_accel.h" - #include "sysemu/reset.h" - #include -+#include "hw/acpi/aml-build.h" - - #define SGX_MAX_EPC_SECTIONS 8 - #define SGX_CPUID_EPC_INVALID 0x0 -@@ -36,6 +37,46 @@ - - #define RETRY_NUM 2 - -+static int sgx_epc_device_list(Object *obj, void *opaque) -+{ -+ GSList **list = opaque; -+ -+ if (object_dynamic_cast(obj, TYPE_SGX_EPC)) { -+ *list = g_slist_append(*list, DEVICE(obj)); -+ } -+ -+ object_child_foreach(obj, sgx_epc_device_list, opaque); -+ return 0; -+} -+ -+static GSList *sgx_epc_get_device_list(void) -+{ -+ GSList *list = NULL; -+ -+ object_child_foreach(qdev_get_machine(), sgx_epc_device_list, &list); -+ return list; -+} -+ -+void sgx_epc_build_srat(GArray *table_data) -+{ -+ GSList *device_list = sgx_epc_get_device_list(); -+ -+ for (; device_list; device_list = device_list->next) { -+ DeviceState *dev = device_list->data; -+ Object *obj = OBJECT(dev); -+ uint64_t addr, size; -+ int node; -+ -+ node = object_property_get_uint(obj, SGX_EPC_NUMA_NODE_PROP, -+ &error_abort); -+ addr = object_property_get_uint(obj, SGX_EPC_ADDR_PROP, &error_abort); -+ size = object_property_get_uint(obj, SGX_EPC_SIZE_PROP, &error_abort); -+ -+ build_srat_memory(table_data, addr, size, node, MEM_AFFINITY_ENABLED); -+ } -+ g_slist_free(device_list); -+} -+ - static uint64_t sgx_calc_section_metric(uint64_t low, uint64_t high) - { - return (low & MAKE_64BIT_MASK(12, 20)) + -@@ -226,6 +267,9 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) - /* set the memdev link with memory backend */ - object_property_parse(obj, SGX_EPC_MEMDEV_PROP, list->value->memdev, - &error_fatal); -+ /* set the numa node property for sgx epc object */ -+ object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP, list->value->node, -+ &error_fatal); - object_property_set_bool(obj, "realized", true, &error_fatal); - object_unref(obj); - } -diff --git a/include/hw/i386/sgx-epc.h b/include/hw/i386/sgx-epc.h -index a6a65be854f88db0e0c7b5d565a0..581fac389a630d66bc173d389e51 100644 ---- a/include/hw/i386/sgx-epc.h -+++ b/include/hw/i386/sgx-epc.h -@@ -25,6 +25,7 @@ - #define SGX_EPC_ADDR_PROP "addr" - #define SGX_EPC_SIZE_PROP "size" - #define SGX_EPC_MEMDEV_PROP "memdev" -+#define SGX_EPC_NUMA_NODE_PROP "node" - - /** - * SGXEPCDevice: -@@ -38,6 +39,7 @@ typedef struct SGXEPCDevice { - - /* public */ - uint64_t addr; -+ uint32_t node; - HostMemoryBackendEpc *hostmem; - } SGXEPCDevice; - -@@ -56,6 +58,7 @@ typedef struct SGXEPCState { - } SGXEPCState; - - bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size); -+void sgx_epc_build_srat(GArray *table_data); - - static inline uint64_t sgx_epc_above_4g_end(SGXEPCState *sgx_epc) - { -diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index 9c91bf93e94cda6baccc53e9c0a3..2669156b284868188392a2da75b2 100644 ---- a/monitor/hmp-cmds.c -+++ b/monitor/hmp-cmds.c -@@ -1810,6 +1810,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) - se->id ? se->id : ""); - monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", se->memaddr); - monitor_printf(mon, " size: %" PRIu64 "\n", se->size); -+ monitor_printf(mon, " node: %" PRId64 "\n", se->node); - monitor_printf(mon, " memdev: %s\n", se->memdev); - break; - default: -diff --git a/qapi/machine.json b/qapi/machine.json -index 067e3f53787928d38566e1e26e1c..16e771affcf6d4e085caf7e3d53e 100644 ---- a/qapi/machine.json -+++ b/qapi/machine.json -@@ -1207,12 +1207,15 @@ - # - # @memdev: memory backend linked with device - # -+# @node: the numa node -+# - # Since: 6.2 - ## - { 'struct': 'SgxEPCDeviceInfo', - 'data': { '*id': 'str', - 'memaddr': 'size', - 'size': 'size', -+ 'node': 'int', - 'memdev': 'str' - } - } -@@ -1285,10 +1288,15 @@ - # - # @memdev: memory backend linked with device - # -+# @node: the numa node -+# - # Since: 6.2 - ## - { 'struct': 'SgxEPC', -- 'data': { 'memdev': 'str' } } -+ 'data': { 'memdev': 'str', -+ 'node': 'int' -+ } -+} - - ## - # @SgxEPCProperties: -diff --git a/qemu-options.hx b/qemu-options.hx -index ae2c6dbbfc005c526026604d9886..489b58e15110662382136feaf0ae 100644 ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -127,11 +127,11 @@ SRST - ERST - - DEF("M", HAS_ARG, QEMU_OPTION_M, -- " sgx-epc.0.memdev=memid\n", -+ " sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n", - QEMU_ARCH_ALL) - - SRST --``sgx-epc.0.memdev=@var{memid}`` -+``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}`` - Define an SGX EPC section. - ERST - diff --git a/numa-Support-SGX-numa-in-the-monitor-and.patch b/numa-Support-SGX-numa-in-the-monitor-and.patch deleted file mode 100644 index efea423b..00000000 --- a/numa-Support-SGX-numa-in-the-monitor-and.patch +++ /dev/null @@ -1,199 +0,0 @@ -From: Yang Zhong -Date: Mon, 1 Nov 2021 12:20:07 -0400 -Subject: numa: Support SGX numa in the monitor and Libvirt interfaces - -Git-commit: 4755927ae12547c2e7cb22c5fa1b39038c6c11b1 -References: bsc#1197807 - -Add the SGXEPCSection list into SGXInfo to show the multiple -SGX EPC sections detailed info, not the total size like before. -This patch can enable numa support for 'info sgx' command and -QMP interfaces. The new interfaces show each EPC section info -in one numa node. Libvirt can use QMP interface to get the -detailed host SGX EPC capabilities to decide how to allocate -host EPC sections to guest. - -(qemu) info sgx - SGX support: enabled - SGX1 support: enabled - SGX2 support: enabled - FLC support: enabled - NUMA node #0: size=67108864 - NUMA node #1: size=29360128 - -The QMP interface show: -(QEMU) query-sgx -{"return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \ -[{"node": 0, "size": 67108864}, {"node": 1, "size": 29360128}], "flc": true}} - -(QEMU) query-sgx-capabilities -{"return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \ -[{"node": 0, "size": 17070817280}, {"node": 1, "size": 17079205888}], "flc": true}} - -Signed-off-by: Yang Zhong -Message-Id: <20211101162009.62161-4-yang.zhong@intel.com> -Signed-off-by: Paolo Bonzini -Signed-off-by: Li Zhang ---- - hw/i386/sgx.c | 51 +++++++++++++++++++++++++++++++++++-------- - qapi/misc-target.json | 19 ++++++++++++++-- - 2 files changed, 59 insertions(+), 11 deletions(-) - -diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c -index d04299904a2315308cbaa0ef7dcf..5de5dd08936e10e8966722f5fac8 100644 ---- a/hw/i386/sgx.c -+++ b/hw/i386/sgx.c -@@ -83,11 +83,13 @@ static uint64_t sgx_calc_section_metric(uint64_t low, uint64_t high) - ((high & MAKE_64BIT_MASK(0, 20)) << 32); - } - --static uint64_t sgx_calc_host_epc_section_size(void) -+static SGXEPCSectionList *sgx_calc_host_epc_sections(void) - { -+ SGXEPCSectionList *head = NULL, **tail = &head; -+ SGXEPCSection *section; - uint32_t i, type; - uint32_t eax, ebx, ecx, edx; -- uint64_t size = 0; -+ uint32_t j = 0; - - for (i = 0; i < SGX_MAX_EPC_SECTIONS; i++) { - host_cpuid(0x12, i + 2, &eax, &ebx, &ecx, &edx); -@@ -101,10 +103,13 @@ static uint64_t sgx_calc_host_epc_section_size(void) - break; - } - -- size += sgx_calc_section_metric(ecx, edx); -+ section = g_new0(SGXEPCSection, 1); -+ section->node = j++; -+ section->size = sgx_calc_section_metric(ecx, edx); -+ QAPI_LIST_APPEND(tail, section); - } - -- return size; -+ return head; - } - - static void sgx_epc_reset(void *opaque) -@@ -168,13 +173,35 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp) - info->sgx1 = eax & (1U << 0) ? true : false; - info->sgx2 = eax & (1U << 1) ? true : false; - -- info->section_size = sgx_calc_host_epc_section_size(); -+ info->sections = sgx_calc_host_epc_sections(); - - close(fd); - - return info; - } - -+static SGXEPCSectionList *sgx_get_epc_sections_list(void) -+{ -+ GSList *device_list = sgx_epc_get_device_list(); -+ SGXEPCSectionList *head = NULL, **tail = &head; -+ SGXEPCSection *section; -+ -+ for (; device_list; device_list = device_list->next) { -+ DeviceState *dev = device_list->data; -+ Object *obj = OBJECT(dev); -+ -+ section = g_new0(SGXEPCSection, 1); -+ section->node = object_property_get_uint(obj, SGX_EPC_NUMA_NODE_PROP, -+ &error_abort); -+ section->size = object_property_get_uint(obj, SGX_EPC_SIZE_PROP, -+ &error_abort); -+ QAPI_LIST_APPEND(tail, section); -+ } -+ g_slist_free(device_list); -+ -+ return head; -+} -+ - SGXInfo *qmp_query_sgx(Error **errp) - { - SGXInfo *info = NULL; -@@ -193,14 +220,13 @@ SGXInfo *qmp_query_sgx(Error **errp) - return NULL; - } - -- SGXEPCState *sgx_epc = &pcms->sgx_epc; - info = g_new0(SGXInfo, 1); - - info->sgx = true; - info->sgx1 = true; - info->sgx2 = true; - info->flc = true; -- info->section_size = sgx_epc->size; -+ info->sections = sgx_get_epc_sections_list(); - - return info; - } -@@ -208,6 +234,7 @@ SGXInfo *qmp_query_sgx(Error **errp) - void hmp_info_sgx(Monitor *mon, const QDict *qdict) - { - Error *err = NULL; -+ SGXEPCSectionList *section_list, *section; - g_autoptr(SGXInfo) info = qmp_query_sgx(&err); - - if (err) { -@@ -222,8 +249,14 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict) - info->sgx2 ? "enabled" : "disabled"); - monitor_printf(mon, "FLC support: %s\n", - info->flc ? "enabled" : "disabled"); -- monitor_printf(mon, "size: %" PRIu64 "\n", -- info->section_size); -+ -+ section_list = info->sections; -+ for (section = section_list; section; section = section->next) { -+ monitor_printf(mon, "NUMA node #%" PRId64 ": ", -+ section->value->node); -+ monitor_printf(mon, "size=%" PRIu64 "\n", -+ section->value->size); -+ } - } - - bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) -diff --git a/qapi/misc-target.json b/qapi/misc-target.json -index 5aa2b95b7d4aa09a4b11a9bbabaf..1022aa0184c74a16c8380e310bb3 100644 ---- a/qapi/misc-target.json -+++ b/qapi/misc-target.json -@@ -337,6 +337,21 @@ - 'if': 'TARGET_ARM' } - - -+## -+# @SGXEPCSection: -+# -+# Information about intel SGX EPC section info -+# -+# @node: the numa node -+# -+# @size: the size of epc section -+# -+# Since: 6.2 -+## -+{ 'struct': 'SGXEPCSection', -+ 'data': { 'node': 'int', -+ 'size': 'uint64'}} -+ - ## - # @SGXInfo: - # -@@ -350,7 +365,7 @@ - # - # @flc: true if FLC is supported - # --# @section-size: The EPC section size for guest -+# @sections: The EPC sections info for guest - # - # Since: 6.2 - ## -@@ -359,7 +374,7 @@ - 'sgx1': 'bool', - 'sgx2': 'bool', - 'flc': 'bool', -- 'section-size': 'uint64'}, -+ 'sections': ['SGXEPCSection']}, - 'if': 'TARGET_I386' } - - ## diff --git a/python-aqmp-Fix-negotiation-with-pre-oob.patch b/python-aqmp-Fix-negotiation-with-pre-oob.patch deleted file mode 100644 index ca589640..00000000 --- a/python-aqmp-Fix-negotiation-with-pre-oob.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: John Snow -Date: Mon, 31 Jan 2022 23:11:31 -0500 -Subject: python/aqmp: Fix negotiation with pre-"oob" QEMU - -Git-commit: fa73e6e4ca1a93c5bbf9d05fb2a25736ab810b35 - -QEMU versions prior to the "oob" capability *also* can't accept the -"enable" keyword argument at all. Fix the handshake process with older -QEMU versions. - -Signed-off-by: John Snow -Reviewed-by: Hanna Reitz -Reviewed-by: Kevin Wolf -Message-id: 20220201041134.1237016-2-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/qmp_client.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/aqmp/qmp_client.py -index 8105e29fa8f04297ec9390ec25ea..6b43e1dbbe38eded19fd0115e8bc 100644 ---- a/python/qemu/aqmp/qmp_client.py -+++ b/python/qemu/aqmp/qmp_client.py -@@ -292,9 +292,9 @@ class QMPClient(AsyncProtocol[Message], Events): - """ - self.logger.debug("Negotiating capabilities ...") - -- arguments: Dict[str, List[str]] = {'enable': []} -+ arguments: Dict[str, List[str]] = {} - if self._greeting and 'oob' in self._greeting.QMP.capabilities: -- arguments['enable'].append('oob') -+ arguments.setdefault('enable', []).append('oob') - msg = self.make_execute_msg('qmp_capabilities', arguments=arguments) - - # It's not safe to use execute() here, because the reader/writers diff --git a/python-aqmp-add-SocketAddrT-to-package-r.patch b/python-aqmp-add-SocketAddrT-to-package-r.patch deleted file mode 100644 index c6368c41..00000000 --- a/python-aqmp-add-SocketAddrT-to-package-r.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:48 -0500 -Subject: python/aqmp: add SocketAddrT to package root - -Git-commit: 728dcac5e356ce5b948943f21c0c72a1b2d96122 - -It's a commonly needed definition, it can be re-exported by the root. - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Beraldo Leal -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/__init__.py | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py -index 880d5b6fa7f2c966542b12e25571..c6fa2dda58fdf4f1a867e677eadb 100644 ---- a/python/qemu/aqmp/__init__.py -+++ b/python/qemu/aqmp/__init__.py -@@ -26,7 +26,12 @@ import logging - from .error import AQMPError - from .events import EventListener - from .message import Message --from .protocol import ConnectError, Runstate, StateError -+from .protocol import ( -+ ConnectError, -+ Runstate, -+ SocketAddrT, -+ StateError, -+) - from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient - - -@@ -48,4 +53,7 @@ __all__ = ( - 'ConnectError', - 'ExecuteError', - 'ExecInterruptedError', -+ -+ # Type aliases -+ 'SocketAddrT', - ) diff --git a/python-aqmp-add-__del__-method-to-legacy.patch b/python-aqmp-add-__del__-method-to-legacy.patch deleted file mode 100644 index 1c276329..00000000 --- a/python-aqmp-add-__del__-method-to-legacy.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:45 -0500 -Subject: python/aqmp: add __del__ method to legacy interface - -Git-commit: 3bc72e3aed76e0326703db81964b13f1da075cbf - -asyncio can complain *very* loudly if you forget to back out of things -gracefully before the garbage collector starts destroying objects that -contain live references to asyncio Tasks. - -The usual fix is just to remember to call aqmp.disconnect(), but for the -sake of the legacy wrapper and quick, one-off scripts where a graceful -shutdown is not necessarily of paramount imporance, add a courtesy -cleanup that will trigger prior to seeing screenfuls of confusing -asyncio tracebacks. - -Note that we can't *always* save you from yourself; depending on when -the GC runs, you might just seriously be out of luck. The best we can do -in this case is to gently remind you to clean up after yourself. - -(Still much better than multiple pages of incomprehensible python -warnings for the crime of forgetting to put your toys away.) - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Beraldo Leal -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index 9e7b9fb80b95ad5d442fea0dbbab..2ccb136b02c1fcf586507400c056 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -16,6 +16,8 @@ from typing import ( - import qemu.qmp - from qemu.qmp import QMPMessage, QMPReturnValue, SocketAddrT - -+from .error import AQMPError -+from .protocol import Runstate - from .qmp_client import QMPClient - - -@@ -136,3 +138,19 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - - def send_fd_scm(self, fd: int) -> None: - self._aqmp.send_fd_scm(fd) -+ -+ def __del__(self) -> None: -+ if self._aqmp.runstate == Runstate.IDLE: -+ return -+ -+ if not self._aloop.is_running(): -+ self.close() -+ else: -+ # Garbage collection ran while the event loop was running. -+ # Nothing we can do about it now, but if we don't raise our -+ # own error, the user will be treated to a lot of traceback -+ # they might not understand. -+ raise AQMPError( -+ "QEMUMonitorProtocol.close()" -+ " was not called before object was garbage collected" -+ ) diff --git a/python-aqmp-add-_session_guard.patch b/python-aqmp-add-_session_guard.patch deleted file mode 100644 index f6bb696f..00000000 --- a/python-aqmp-add-_session_guard.patch +++ /dev/null @@ -1,140 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:39 -0500 -Subject: python/aqmp: add _session_guard() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 40196c23939758abc5300e85333e676196e3ba6d - -In _new_session, there's a fairly complex except clause that's used to -give semantic errors to callers of accept() and connect(). We need to -create a new two-step replacement for accept(), so factoring out this -piece of logic will be useful. - -Bolster the comments and docstring here to try and demystify what's -going on in this fairly delicate piece of Python magic. - -(If we were using Python 3.7+, this would be an @asynccontextmanager. We -don't have that very nice piece of magic, however, so this must take an -Awaitable to manage the Exception contexts properly. We pay the price -for platform compatibility.) - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-2-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 89 +++++++++++++++++++++++++----------- - 1 file changed, 62 insertions(+), 27 deletions(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 33358f5cd72b61bd060b8dea6091..009883f64d011e44dd003e9dcde3 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -317,6 +317,62 @@ class AsyncProtocol(Generic[T]): - # Section: Session machinery - # -------------------------- - -+ async def _session_guard(self, coro: Awaitable[None], emsg: str) -> None: -+ """ -+ Async guard function used to roll back to `IDLE` on any error. -+ -+ On any Exception, the state machine will be reset back to -+ `IDLE`. Most Exceptions will be wrapped with `ConnectError`, but -+ `BaseException` events will be left alone (This includes -+ asyncio.CancelledError, even prior to Python 3.8). -+ -+ :param error_message: -+ Human-readable string describing what connection phase failed. -+ -+ :raise BaseException: -+ When `BaseException` occurs in the guarded block. -+ :raise ConnectError: -+ When any other error is encountered in the guarded block. -+ """ -+ # Note: After Python 3.6 support is removed, this should be an -+ # @asynccontextmanager instead of accepting a callback. -+ try: -+ await coro -+ except BaseException as err: -+ self.logger.error("%s: %s", emsg, exception_summary(err)) -+ self.logger.debug("%s:\n%s\n", emsg, pretty_traceback()) -+ try: -+ # Reset the runstate back to IDLE. -+ await self.disconnect() -+ except: -+ # We don't expect any Exceptions from the disconnect function -+ # here, because we failed to connect in the first place. -+ # The disconnect() function is intended to perform -+ # only cannot-fail cleanup here, but you never know. -+ emsg = ( -+ "Unexpected bottom half exception. " -+ "This is a bug in the QMP library. " -+ "Please report it to and " -+ "CC: John Snow ." -+ ) -+ self.logger.critical("%s:\n%s\n", emsg, pretty_traceback()) -+ raise -+ -+ # CancelledError is an Exception with special semantic meaning; -+ # We do NOT want to wrap it up under ConnectError. -+ # NB: CancelledError is not a BaseException before Python 3.8 -+ if isinstance(err, asyncio.CancelledError): -+ raise -+ -+ # Any other kind of error can be treated as some kind of connection -+ # failure broadly. Inspect the 'exc' field to explore the root -+ # cause in greater detail. -+ if isinstance(err, Exception): -+ raise ConnectError(emsg, err) from err -+ -+ # Raise BaseExceptions un-wrapped, they're more important. -+ raise -+ - @property - def _runstate_event(self) -> asyncio.Event: - # asyncio.Event() objects should not be created prior to entrance into -@@ -371,34 +427,13 @@ class AsyncProtocol(Generic[T]): - """ - assert self.runstate == Runstate.IDLE - -- try: -- phase = "connection" -- await self._establish_connection(address, ssl, accept) -- -- phase = "session" -- await self._establish_session() -+ await self._session_guard( -+ self._establish_connection(address, ssl, accept), -+ 'Failed to establish connection') - -- except BaseException as err: -- emsg = f"Failed to establish {phase}" -- self.logger.error("%s: %s", emsg, exception_summary(err)) -- self.logger.debug("%s:\n%s\n", emsg, pretty_traceback()) -- try: -- # Reset from CONNECTING back to IDLE. -- await self.disconnect() -- except: -- emsg = "Unexpected bottom half exception" -- self.logger.critical("%s:\n%s\n", emsg, pretty_traceback()) -- raise -- -- # NB: CancelledError is not a BaseException before Python 3.8 -- if isinstance(err, asyncio.CancelledError): -- raise -- -- if isinstance(err, Exception): -- raise ConnectError(emsg, err) from err -- -- # Raise BaseExceptions un-wrapped, they're more important. -- raise -+ await self._session_guard( -+ self._establish_session(), -+ 'Failed to establish session') - - assert self.runstate == Runstate.RUNNING - diff --git a/python-aqmp-add-socket-bind-step-to-lega.patch b/python-aqmp-add-socket-bind-step-to-lega.patch deleted file mode 100644 index c0a6b792..00000000 --- a/python-aqmp-add-socket-bind-step-to-lega.patch +++ /dev/null @@ -1,135 +0,0 @@ -From: John Snow -Date: Mon, 31 Jan 2022 23:11:34 -0500 -Subject: python/aqmp: add socket bind step to legacy.py - -Git-commit: b0b662bb2b340d63529672b5bdae596a6243c4d0 - -The synchronous QMP library would bind to the server address during -__init__(). The new library delays this to the accept() call, because -binding occurs inside of the call to start_[unix_]server(), which is an -async method -- so it cannot happen during __init__ anymore. - -Python 3.7+ adds the ability to create the server (and thus the bind() -call) and begin the active listening in separate steps, but we don't -have that functionality in 3.6, our current minimum. - -Therefore ... Add a temporary workaround that allows the synchronous -version of the client to bind the socket in advance, guaranteeing that -there will be a UNIX socket in the filesystem ready for the QEMU client -to connect to without a race condition. - -(Yes, it's a bit ugly. Fixing it more nicely will have to wait until our -minimum Python version is 3.7+.) - -Signed-off-by: John Snow -Reviewed-by: Kevin Wolf -Message-id: 20220201041134.1237016-5-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 3 +++ - python/qemu/aqmp/protocol.py | 41 +++++++++++++++++++++++++++++++++--- - 2 files changed, 41 insertions(+), 3 deletions(-) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index 0890f95b16875ecb815ed4560bc7..6baa5f3409a6b459c67097d3c2a0 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -56,6 +56,9 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - self._address = address - self._timeout: Optional[float] = None - -+ if server: -+ self._aqmp._bind_hack(address) # pylint: disable=protected-access -+ - _T = TypeVar('_T') - - def _sync( -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 50e973c2f2dc9c5fa759380ab3e9..33358f5cd72b61bd060b8dea6091 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -15,6 +15,7 @@ from asyncio import StreamReader, StreamWriter - from enum import Enum - from functools import wraps - import logging -+import socket - from ssl import SSLContext - from typing import ( - Any, -@@ -238,6 +239,9 @@ class AsyncProtocol(Generic[T]): - self._runstate = Runstate.IDLE - self._runstate_changed: Optional[asyncio.Event] = None - -+ # Workaround for bind() -+ self._sock: Optional[socket.socket] = None -+ - def __repr__(self) -> str: - cls_name = type(self).__name__ - tokens = [] -@@ -427,6 +431,34 @@ class AsyncProtocol(Generic[T]): - else: - await self._do_connect(address, ssl) - -+ def _bind_hack(self, address: Union[str, Tuple[str, int]]) -> None: -+ """ -+ Used to create a socket in advance of accept(). -+ -+ This is a workaround to ensure that we can guarantee timing of -+ precisely when a socket exists to avoid a connection attempt -+ bouncing off of nothing. -+ -+ Python 3.7+ adds a feature to separate the server creation and -+ listening phases instead, and should be used instead of this -+ hack. -+ """ -+ if isinstance(address, tuple): -+ family = socket.AF_INET -+ else: -+ family = socket.AF_UNIX -+ -+ sock = socket.socket(family, socket.SOCK_STREAM) -+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) -+ -+ try: -+ sock.bind(address) -+ except: -+ sock.close() -+ raise -+ -+ self._sock = sock -+ - @upper_half - async def _do_accept(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: -@@ -464,24 +496,27 @@ class AsyncProtocol(Generic[T]): - if isinstance(address, tuple): - coro = asyncio.start_server( - _client_connected_cb, -- host=address[0], -- port=address[1], -+ host=None if self._sock else address[0], -+ port=None if self._sock else address[1], - ssl=ssl, - backlog=1, - limit=self._limit, -+ sock=self._sock, - ) - else: - coro = asyncio.start_unix_server( - _client_connected_cb, -- path=address, -+ path=None if self._sock else address, - ssl=ssl, - backlog=1, - limit=self._limit, -+ sock=self._sock, - ) - - server = await coro # Starts listening - await connected.wait() # Waits for the callback to fire (and finish) - assert server is None -+ self._sock = None - - self.logger.debug("Connection accepted.") - diff --git a/python-aqmp-add-start_server-and-accept-.patch b/python-aqmp-add-start_server-and-accept-.patch deleted file mode 100644 index ca98d7b2..00000000 --- a/python-aqmp-add-start_server-and-accept-.patch +++ /dev/null @@ -1,158 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:46 -0500 -Subject: python/aqmp: add start_server() and accept() methods -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 481607c7d35de2bc4d9bec7f4734036fc467f330 - -Add start_server() and accept() methods that can be used instead of -start_server_and_accept() to allow more fine-grained control over the -incoming connection process. - -(Eagle-eyed reviewers will surely notice that it's a bit weird that -"CONNECTING" is a state that's shared between both the start_server() -and connect() states. That's absolutely true, and it's very true that -checking on the presence of _accepted as an indicator of state is a -hack. That's also very certainly true. But ... this keeps client code an -awful lot simpler, as it doesn't have to care exactly *how* the -connection is being made, just that it *is*. Is it worth disrupting that -simplicity in order to provide a better state guard on `accept()`? Hm.) - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-9-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 67 +++++++++++++++++++++++++++++++++--- - python/tests/protocol.py | 7 ++++ - 2 files changed, 69 insertions(+), 5 deletions(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index cdbc9cba0d15dea19cc1c60ca3c3..2ecba1455571a35e0e6c565e3641 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -280,6 +280,8 @@ class AsyncProtocol(Generic[T]): - Accept a connection and begin processing message queues. - - If this call fails, `runstate` is guaranteed to be set back to `IDLE`. -+ This method is precisely equivalent to calling `start_server()` -+ followed by `accept()`. - - :param address: - Address to listen on; UNIX socket path or TCP address/port. -@@ -294,9 +296,62 @@ class AsyncProtocol(Generic[T]): - protocol-level failure occurs while establishing a new - session, the wrapped error may also be an `QMPError`. - """ -+ await self.start_server(address, ssl) -+ await self.accept() -+ assert self.runstate == Runstate.RUNNING -+ -+ @upper_half -+ @require(Runstate.IDLE) -+ async def start_server(self, address: SocketAddrT, -+ ssl: Optional[SSLContext] = None) -> None: -+ """ -+ Start listening for an incoming connection, but do not wait for a peer. -+ -+ This method starts listening for an incoming connection, but -+ does not block waiting for a peer. This call will return -+ immediately after binding and listening on a socket. A later -+ call to `accept()` must be made in order to finalize the -+ incoming connection. -+ -+ :param address: -+ Address to listen on; UNIX socket path or TCP address/port. -+ :param ssl: SSL context to use, if any. -+ -+ :raise StateError: When the `Runstate` is not `IDLE`. -+ :raise ConnectError: -+ When the server could not start listening on this address. -+ -+ This exception will wrap a more concrete one. In most cases, -+ the wrapped exception will be `OSError`. -+ """ - await self._session_guard( - self._do_start_server(address, ssl), - 'Failed to establish connection') -+ assert self.runstate == Runstate.CONNECTING -+ -+ @upper_half -+ @require(Runstate.CONNECTING) -+ async def accept(self) -> None: -+ """ -+ Accept an incoming connection and begin processing message queues. -+ -+ If this call fails, `runstate` is guaranteed to be set back to `IDLE`. -+ -+ :raise StateError: When the `Runstate` is not `CONNECTING`. -+ :raise QMPError: When `start_server()` was not called yet. -+ :raise ConnectError: -+ When a connection or session cannot be established. -+ -+ This exception will wrap a more concrete one. In most cases, -+ the wrapped exception will be `OSError` or `EOFError`. If a -+ protocol-level failure occurs while establishing a new -+ session, the wrapped error may also be an `QMPError`. -+ """ -+ if self._accepted is None: -+ raise QMPError("Cannot call accept() before start_server().") -+ await self._session_guard( -+ self._do_accept(), -+ 'Failed to establish connection') - await self._session_guard( - self._establish_session(), - 'Failed to establish session') -@@ -512,7 +567,12 @@ class AsyncProtocol(Generic[T]): - async def _do_start_server(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: - """ -- Acting as the transport server, accept a single connection. -+ Start listening for an incoming connection, but do not wait for a peer. -+ -+ This method starts listening for an incoming connection, but does not -+ block waiting for a peer. This call will return immediately after -+ binding and listening to a socket. A later call to accept() must be -+ made in order to finalize the incoming connection. - - :param address: - Address to listen on; UNIX socket path or TCP address/port. -@@ -554,10 +614,7 @@ class AsyncProtocol(Generic[T]): - # This will start the server (bind(2), listen(2)). It will also - # call accept(2) if we yield, but we don't block on that here. - self._server = await coro -- -- # Just for this one commit, wait for a peer. -- # This gets split out in the next patch. -- await self._do_accept() -+ self.logger.debug("Server listening on %s", address) - - @upper_half - async def _do_accept(self) -> None: -diff --git a/python/tests/protocol.py b/python/tests/protocol.py -index 5e442e1efbd19bf95a95de371060..d6849ad3062081c62b29bf89dd2a 100644 ---- a/python/tests/protocol.py -+++ b/python/tests/protocol.py -@@ -43,11 +43,18 @@ class NullProtocol(AsyncProtocol[None]): - - async def _do_start_server(self, address, ssl=None): - if self.fake_session: -+ self._accepted = asyncio.Event() - self._set_state(Runstate.CONNECTING) - await asyncio.sleep(0) - else: - await super()._do_start_server(address, ssl) - -+ async def _do_accept(self): -+ if self.fake_session: -+ self._accepted = None -+ else: -+ await super()._do_accept() -+ - async def _do_connect(self, address, ssl=None): - if self.fake_session: - self._set_state(Runstate.CONNECTING) diff --git a/python-aqmp-copy-type-definitions-from-q.patch b/python-aqmp-copy-type-definitions-from-q.patch deleted file mode 100644 index f4e837f1..00000000 --- a/python-aqmp-copy-type-definitions-from-q.patch +++ /dev/null @@ -1,134 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:47 -0500 -Subject: python/aqmp: copy type definitions from qmp - -Git-commit: 0e6bfd8b96e407db7b0cb5e8c14cc315a7154f53 - -Copy the remaining type definitions from QMP into the qemu.aqmp.legacy -module. Now, users that require the legacy interface don't need to -import anything else but qemu.aqmp.legacy wrapper. - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Beraldo Leal -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 22 ++++++++++++++++++++-- - python/qemu/aqmp/protocol.py | 16 ++++++++++------ - 2 files changed, 30 insertions(+), 8 deletions(-) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index 2ccb136b02c1fcf586507400c056..9431fe933019b1e1c221ea3ab7bb 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -6,7 +6,9 @@ This class pretends to be qemu.qmp.QEMUMonitorProtocol. - - import asyncio - from typing import ( -+ Any, - Awaitable, -+ Dict, - List, - Optional, - TypeVar, -@@ -14,13 +16,29 @@ from typing import ( - ) - - import qemu.qmp --from qemu.qmp import QMPMessage, QMPReturnValue, SocketAddrT - - from .error import AQMPError --from .protocol import Runstate -+from .protocol import Runstate, SocketAddrT - from .qmp_client import QMPClient - - -+#: QMPMessage is an entire QMP message of any kind. -+QMPMessage = Dict[str, Any] -+ -+#: QMPReturnValue is the 'return' value of a command. -+QMPReturnValue = object -+ -+#: QMPObject is any object in a QMP message. -+QMPObject = Dict[str, object] -+ -+# QMPMessage can be outgoing commands or incoming events/returns. -+# QMPReturnValue is usually a dict/json object, but due to QAPI's -+# 'returns-whitelist', it can actually be anything. -+# -+# {'return': {}} is a QMPMessage, -+# {} is the QMPReturnValue. -+ -+ - # pylint: disable=missing-docstring - - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index c4fbe35a0e41c589059ec4fa37a8..5b4f2f0d0a81a0d2902358e9b799 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -46,6 +46,10 @@ T = TypeVar('T') - _U = TypeVar('_U') - _TaskFN = Callable[[], Awaitable[None]] # aka ``async def func() -> None`` - -+InternetAddrT = Tuple[str, int] -+UnixAddrT = str -+SocketAddrT = Union[UnixAddrT, InternetAddrT] -+ - - class Runstate(Enum): - """Protocol session runstate.""" -@@ -257,7 +261,7 @@ class AsyncProtocol(Generic[T]): - - @upper_half - @require(Runstate.IDLE) -- async def accept(self, address: Union[str, Tuple[str, int]], -+ async def accept(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: - """ - Accept a connection and begin processing message queues. -@@ -275,7 +279,7 @@ class AsyncProtocol(Generic[T]): - - @upper_half - @require(Runstate.IDLE) -- async def connect(self, address: Union[str, Tuple[str, int]], -+ async def connect(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: - """ - Connect to the server and begin processing message queues. -@@ -337,7 +341,7 @@ class AsyncProtocol(Generic[T]): - - @upper_half - async def _new_session(self, -- address: Union[str, Tuple[str, int]], -+ address: SocketAddrT, - ssl: Optional[SSLContext] = None, - accept: bool = False) -> None: - """ -@@ -397,7 +401,7 @@ class AsyncProtocol(Generic[T]): - @upper_half - async def _establish_connection( - self, -- address: Union[str, Tuple[str, int]], -+ address: SocketAddrT, - ssl: Optional[SSLContext] = None, - accept: bool = False - ) -> None: -@@ -424,7 +428,7 @@ class AsyncProtocol(Generic[T]): - await self._do_connect(address, ssl) - - @upper_half -- async def _do_accept(self, address: Union[str, Tuple[str, int]], -+ async def _do_accept(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: - """ - Acting as the transport server, accept a single connection. -@@ -482,7 +486,7 @@ class AsyncProtocol(Generic[T]): - self.logger.debug("Connection accepted.") - - @upper_half -- async def _do_connect(self, address: Union[str, Tuple[str, int]], -+ async def _do_connect(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: - """ - Acting as the transport client, initiate a connection to a server. diff --git a/python-aqmp-drop-_bind_hack.patch b/python-aqmp-drop-_bind_hack.patch deleted file mode 100644 index b0414c02..00000000 --- a/python-aqmp-drop-_bind_hack.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:48 -0500 -Subject: python/aqmp: drop _bind_hack() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 4c1fe7003c9b373acb0791b4356e2285a10365c0 - -_bind_hack() was a quick fix to allow async QMP to call bind(2) prior to -calling listen(2) and accept(2). This wasn't sufficient to fully address -the race condition present in synchronous clients. - -With the race condition in legacy.py fixed (see the previous commit), -there are no longer any users of _bind_hack(). Drop it. - -Fixes: b0b662bb2b3 -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-11-jsnow@redhat.com -[Expanded commit message. --js] -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 2 +- - python/qemu/aqmp/protocol.py | 41 +++--------------------------------- - 2 files changed, 4 insertions(+), 39 deletions(-) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index cb50e60564823fdc0aeeb194c5e3..46026e9fdc6c8859a8c944076c71 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -57,7 +57,7 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - self._timeout: Optional[float] = None - - if server: -- self._sync(self._aqmp.start_server(address)) -+ self._sync(self._aqmp.start_server(self._address)) - - _T = TypeVar('_T') - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 2ecba1455571a35e0e6c565e3641..36fae57f277826d5cd4026e0d079 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -18,7 +18,6 @@ from asyncio import StreamReader, StreamWriter - from enum import Enum - from functools import wraps - import logging --import socket - from ssl import SSLContext - from typing import ( - Any, -@@ -242,9 +241,6 @@ class AsyncProtocol(Generic[T]): - self._runstate = Runstate.IDLE - self._runstate_changed: Optional[asyncio.Event] = None - -- # Workaround for bind() -- self._sock: Optional[socket.socket] = None -- - # Server state for start_server() and _incoming() - self._server: Optional[asyncio.AbstractServer] = None - self._accepted: Optional[asyncio.Event] = None -@@ -535,34 +531,6 @@ class AsyncProtocol(Generic[T]): - self._reader, self._writer = (reader, writer) - self._accepted.set() - -- def _bind_hack(self, address: Union[str, Tuple[str, int]]) -> None: -- """ -- Used to create a socket in advance of accept(). -- -- This is a workaround to ensure that we can guarantee timing of -- precisely when a socket exists to avoid a connection attempt -- bouncing off of nothing. -- -- Python 3.7+ adds a feature to separate the server creation and -- listening phases instead, and should be used instead of this -- hack. -- """ -- if isinstance(address, tuple): -- family = socket.AF_INET -- else: -- family = socket.AF_UNIX -- -- sock = socket.socket(family, socket.SOCK_STREAM) -- sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) -- -- try: -- sock.bind(address) -- except: -- sock.close() -- raise -- -- self._sock = sock -- - @upper_half - async def _do_start_server(self, address: SocketAddrT, - ssl: Optional[SSLContext] = None) -> None: -@@ -589,21 +557,19 @@ class AsyncProtocol(Generic[T]): - if isinstance(address, tuple): - coro = asyncio.start_server( - self._incoming, -- host=None if self._sock else address[0], -- port=None if self._sock else address[1], -+ host=address[0], -+ port=address[1], - ssl=ssl, - backlog=1, - limit=self._limit, -- sock=self._sock, - ) - else: - coro = asyncio.start_unix_server( - self._incoming, -- path=None if self._sock else address, -+ path=address, - ssl=ssl, - backlog=1, - limit=self._limit, -- sock=self._sock, - ) - - # Allow runstate watchers to witness 'CONNECTING' state; some -@@ -630,7 +596,6 @@ class AsyncProtocol(Generic[T]): - await self._accepted.wait() - assert self._server is None - self._accepted = None -- self._sock = None - - self.logger.debug("Connection accepted.") - diff --git a/python-aqmp-fix-docstring-typo.patch b/python-aqmp-fix-docstring-typo.patch deleted file mode 100644 index 3095afa0..00000000 --- a/python-aqmp-fix-docstring-typo.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:44 -0500 -Subject: python/aqmp: fix docstring typo - -Git-commit: dc6877bd2ea04a38700adcea2359d5d20c1082a6 - -Reported-by: Vladimir Sementsov-Ogievskiy -Signed-off-by: John Snow -Reviewed-by: Beraldo Leal -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py -index c6fa2dda58fdf4f1a867e677eadb..05f467c1415360169e9c66c8d27e 100644 ---- a/python/qemu/aqmp/__init__.py -+++ b/python/qemu/aqmp/__init__.py -@@ -6,7 +6,7 @@ asynchronously with QMP protocol servers, as implemented by QEMU, the - QEMU Guest Agent, and the QEMU Storage Daemon. - - `QMPClient` provides the main functionality of this package. All errors --raised by this library dervive from `AQMPError`, see `aqmp.error` for -+raised by this library derive from `AQMPError`, see `aqmp.error` for - additional detail. See `aqmp.events` for an in-depth tutorial on - managing QMP events. - """ diff --git a/python-aqmp-fix-race-condition-in-legacy.patch b/python-aqmp-fix-race-condition-in-legacy.patch deleted file mode 100644 index 11243712..00000000 --- a/python-aqmp-fix-race-condition-in-legacy.patch +++ /dev/null @@ -1,59 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:47 -0500 -Subject: python/aqmp: fix race condition in legacy.py -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 673856f9d889dc50b6a1a7964df960c4f00c7c93 - -legacy.py provides a synchronous model. iotests frequently uses this -paradigm: - - - create QMP client object - - start QEMU process - - await connection from QEMU process - -In the switch from sync to async QMP, the QMP client object stopped -calling bind() and listen() during the QMP object creation step, which -creates a race condition if the QEMU process dials in too quickly. - -With refactoring out of the way, restore the former behavior of calling -bind() and listen() during __init__() to fix this race condition. - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-10-jsnow@redhat.com -[Expanded commit message. --js] -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index dca1e76ed4994959caf542031363..cb50e60564823fdc0aeeb194c5e3 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -57,7 +57,7 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - self._timeout: Optional[float] = None - - if server: -- self._aqmp._bind_hack(address) # pylint: disable=protected-access -+ self._sync(self._aqmp.start_server(address)) - - _T = TypeVar('_T') - -@@ -90,10 +90,7 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - self._aqmp.await_greeting = True - self._aqmp.negotiate = True - -- self._sync( -- self._aqmp.start_server_and_accept(self._address), -- timeout -- ) -+ self._sync(self._aqmp.accept(), timeout) - - ret = self._get_greeting() - assert ret is not None diff --git a/python-aqmp-handle-asyncio.TimeoutError-.patch b/python-aqmp-handle-asyncio.TimeoutError-.patch deleted file mode 100644 index 1a2c21cf..00000000 --- a/python-aqmp-handle-asyncio.TimeoutError-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:46 -0500 -Subject: python/aqmp: handle asyncio.TimeoutError on execute() - -Git-commit: 3b5bf136f5798a4ea2c66875d6337ca3d6b79434 - -This exception can be injected into any await statement. If we are -canceled via timeout, we want to clear the pending execution record on -our way out. - -Signed-off-by: John Snow -Reviewed-by: Beraldo Leal -Reviewed-by: Vladimir Sementsov-Ogievskiy -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/qmp_client.py | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/aqmp/qmp_client.py -index 6b43e1dbbe38eded19fd0115e8bc..45864f288e4fe5a7505c0022ed13 100644 ---- a/python/qemu/aqmp/qmp_client.py -+++ b/python/qemu/aqmp/qmp_client.py -@@ -435,7 +435,11 @@ class QMPClient(AsyncProtocol[Message], Events): - msg_id = msg['id'] - - self._pending[msg_id] = asyncio.Queue(maxsize=1) -- await self._outgoing.put(msg) -+ try: -+ await self._outgoing.put(msg) -+ except: -+ del self._pending[msg_id] -+ raise - - return msg_id - -@@ -452,9 +456,9 @@ class QMPClient(AsyncProtocol[Message], Events): - was lost, or some other problem. - """ - queue = self._pending[msg_id] -- result = await queue.get() - - try: -+ result = await queue.get() - if isinstance(result, ExecInterruptedError): - raise result - return result diff --git a/python-aqmp-refactor-_do_accept-into-two.patch b/python-aqmp-refactor-_do_accept-into-two.patch deleted file mode 100644 index 20770868..00000000 --- a/python-aqmp-refactor-_do_accept-into-two.patch +++ /dev/null @@ -1,102 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:44 -0500 -Subject: python/aqmp: refactor _do_accept() into two distinct steps -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 5e9902a030ab832b0b6577764c65ce6a6f874af6 - -Refactor _do_accept() into _do_start_server() and _do_accept(). As of -this commit, the former calls the latter, but in subsequent commits -they'll be split apart. - -(So please forgive the misnomer for _do_start_server(); it will live up -to its name shortly, and the docstring will be updated then too. I'm -just cutting down on some churn.) - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-7-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 29 ++++++++++++++++++++++++----- - python/tests/protocol.py | 4 ++-- - 2 files changed, 26 insertions(+), 7 deletions(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 631bcdaa554f4a104af4e25a3c61..e2bdad542dc0ef451dd200a1d679 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -295,7 +295,7 @@ class AsyncProtocol(Generic[T]): - session, the wrapped error may also be an `QMPError`. - """ - await self._session_guard( -- self._do_accept(address, ssl), -+ self._do_start_server(address, ssl), - 'Failed to establish connection') - await self._session_guard( - self._establish_session(), -@@ -509,8 +509,8 @@ class AsyncProtocol(Generic[T]): - self._sock = sock - - @upper_half -- async def _do_accept(self, address: SocketAddrT, -- ssl: Optional[SSLContext] = None) -> None: -+ async def _do_start_server(self, address: SocketAddrT, -+ ssl: Optional[SSLContext] = None) -> None: - """ - Acting as the transport server, accept a single connection. - -@@ -551,9 +551,28 @@ class AsyncProtocol(Generic[T]): - # otherwise yield. - await asyncio.sleep(0) - -- self._server = await coro # Starts listening -- await self._accepted.wait() # Waits for the callback to finish -+ # This will start the server (bind(2), listen(2)). It will also -+ # call accept(2) if we yield, but we don't block on that here. -+ self._server = await coro -+ -+ # Just for this one commit, wait for a peer. -+ # This gets split out in the next patch. -+ await self._do_accept() -+ -+ @upper_half -+ async def _do_accept(self) -> None: -+ """ -+ Wait for and accept an incoming connection. -+ -+ Requires that we have not yet accepted an incoming connection -+ from the upper_half, but it's OK if the server is no longer -+ running because the bottom_half has already accepted the -+ connection. -+ """ -+ assert self._accepted is not None -+ await self._accepted.wait() - assert self._server is None -+ self._accepted = None - self._sock = None - - self.logger.debug("Connection accepted.") -diff --git a/python/tests/protocol.py b/python/tests/protocol.py -index 8dd26c4ed1e0973b8058604c2373..5e442e1efbd19bf95a95de371060 100644 ---- a/python/tests/protocol.py -+++ b/python/tests/protocol.py -@@ -41,12 +41,12 @@ class NullProtocol(AsyncProtocol[None]): - self.trigger_input = asyncio.Event() - await super()._establish_session() - -- async def _do_accept(self, address, ssl=None): -+ async def _do_start_server(self, address, ssl=None): - if self.fake_session: - self._set_state(Runstate.CONNECTING) - await asyncio.sleep(0) - else: -- await super()._do_accept(address, ssl) -+ await super()._do_start_server(address, ssl) - - async def _do_connect(self, address, ssl=None): - if self.fake_session: diff --git a/python-aqmp-remove-_new_session-and-_est.patch b/python-aqmp-remove-_new_session-and-_est.patch deleted file mode 100644 index 0558ce78..00000000 --- a/python-aqmp-remove-_new_session-and-_est.patch +++ /dev/null @@ -1,231 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:41 -0500 -Subject: python/aqmp: remove _new_session and _establish_connection -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 68a6cf3ffe3532c0655efbbf5910bd99a1b4a3fa - -These two methods attempted to entirely envelop the logic of -establishing a connection to a peer start to finish. However, we need to -break apart the incoming connection step into more granular steps. We -will no longer be able to reasonably constrain the logic inside of these -helper functions. - -So, remove them - with _session_guard(), they no longer serve a real -purpose. - -Although the public API doesn't change, the internal API does. Now that -there are no intermediary methods between e.g. connect() and -_do_connect(), there's no hook where the runstate is set. As a result, -the test suite changes a little to cope with the new semantics of -_do_accept() and _do_connect(). - -Lastly, take some pieces of the now-deleted docstrings and move -them up to the public interface level. They were a little more detailed, -and it won't hurt to keep them. - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-4-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 117 ++++++++++++++--------------------- - python/tests/protocol.py | 10 ++- - 2 files changed, 53 insertions(+), 74 deletions(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 73719257e058b7e9e4d8a281bcd9..b7e5e635d886db0efc85f829f42e 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -275,13 +275,25 @@ class AsyncProtocol(Generic[T]): - If this call fails, `runstate` is guaranteed to be set back to `IDLE`. - - :param address: -- Address to listen to; UNIX socket path or TCP address/port. -+ Address to listen on; UNIX socket path or TCP address/port. - :param ssl: SSL context to use, if any. - - :raise StateError: When the `Runstate` is not `IDLE`. -- :raise ConnectError: If a connection could not be accepted. -+ :raise ConnectError: -+ When a connection or session cannot be established. -+ -+ This exception will wrap a more concrete one. In most cases, -+ the wrapped exception will be `OSError` or `EOFError`. If a -+ protocol-level failure occurs while establishing a new -+ session, the wrapped error may also be an `QMPError`. - """ -- await self._new_session(address, ssl, accept=True) -+ await self._session_guard( -+ self._do_accept(address, ssl), -+ 'Failed to establish connection') -+ await self._session_guard( -+ self._establish_session(), -+ 'Failed to establish session') -+ assert self.runstate == Runstate.RUNNING - - @upper_half - @require(Runstate.IDLE) -@@ -297,9 +309,21 @@ class AsyncProtocol(Generic[T]): - :param ssl: SSL context to use, if any. - - :raise StateError: When the `Runstate` is not `IDLE`. -- :raise ConnectError: If a connection cannot be made to the server. -+ :raise ConnectError: -+ When a connection or session cannot be established. -+ -+ This exception will wrap a more concrete one. In most cases, -+ the wrapped exception will be `OSError` or `EOFError`. If a -+ protocol-level failure occurs while establishing a new -+ session, the wrapped error may also be an `QMPError`. - """ -- await self._new_session(address, ssl) -+ await self._session_guard( -+ self._do_connect(address, ssl), -+ 'Failed to establish connection') -+ await self._session_guard( -+ self._establish_session(), -+ 'Failed to establish session') -+ assert self.runstate == Runstate.RUNNING - - @upper_half - async def disconnect(self) -> None: -@@ -401,73 +425,6 @@ class AsyncProtocol(Generic[T]): - self._runstate_event.set() - self._runstate_event.clear() - -- @upper_half -- async def _new_session(self, -- address: SocketAddrT, -- ssl: Optional[SSLContext] = None, -- accept: bool = False) -> None: -- """ -- Establish a new connection and initialize the session. -- -- Connect or accept a new connection, then begin the protocol -- session machinery. If this call fails, `runstate` is guaranteed -- to be set back to `IDLE`. -- -- :param address: -- Address to connect to/listen on; -- UNIX socket path or TCP address/port. -- :param ssl: SSL context to use, if any. -- :param accept: Accept a connection instead of connecting when `True`. -- -- :raise ConnectError: -- When a connection or session cannot be established. -- -- This exception will wrap a more concrete one. In most cases, -- the wrapped exception will be `OSError` or `EOFError`. If a -- protocol-level failure occurs while establishing a new -- session, the wrapped error may also be an `QMPError`. -- """ -- assert self.runstate == Runstate.IDLE -- -- await self._session_guard( -- self._establish_connection(address, ssl, accept), -- 'Failed to establish connection') -- -- await self._session_guard( -- self._establish_session(), -- 'Failed to establish session') -- -- assert self.runstate == Runstate.RUNNING -- -- @upper_half -- async def _establish_connection( -- self, -- address: SocketAddrT, -- ssl: Optional[SSLContext] = None, -- accept: bool = False -- ) -> None: -- """ -- Establish a new connection. -- -- :param address: -- Address to connect to/listen on; -- UNIX socket path or TCP address/port. -- :param ssl: SSL context to use, if any. -- :param accept: Accept a connection instead of connecting when `True`. -- """ -- assert self.runstate == Runstate.IDLE -- self._set_state(Runstate.CONNECTING) -- -- # Allow runstate watchers to witness 'CONNECTING' state; some -- # failures in the streaming layer are synchronous and will not -- # otherwise yield. -- await asyncio.sleep(0) -- -- if accept: -- await self._do_accept(address, ssl) -- else: -- await self._do_connect(address, ssl) -- - def _bind_hack(self, address: Union[str, Tuple[str, int]]) -> None: - """ - Used to create a socket in advance of accept(). -@@ -508,6 +465,9 @@ class AsyncProtocol(Generic[T]): - - :raise OSError: For stream-related errors. - """ -+ assert self.runstate == Runstate.IDLE -+ self._set_state(Runstate.CONNECTING) -+ - self.logger.debug("Awaiting connection on %s ...", address) - connected = asyncio.Event() - server: Optional[asyncio.AbstractServer] = None -@@ -550,6 +510,11 @@ class AsyncProtocol(Generic[T]): - sock=self._sock, - ) - -+ # Allow runstate watchers to witness 'CONNECTING' state; some -+ # failures in the streaming layer are synchronous and will not -+ # otherwise yield. -+ await asyncio.sleep(0) -+ - server = await coro # Starts listening - await connected.wait() # Waits for the callback to fire (and finish) - assert server is None -@@ -569,6 +534,14 @@ class AsyncProtocol(Generic[T]): - - :raise OSError: For stream-related errors. - """ -+ assert self.runstate == Runstate.IDLE -+ self._set_state(Runstate.CONNECTING) -+ -+ # Allow runstate watchers to witness 'CONNECTING' state; some -+ # failures in the streaming layer are synchronous and will not -+ # otherwise yield. -+ await asyncio.sleep(0) -+ - self.logger.debug("Connecting to %s ...", address) - - if isinstance(address, tuple): -diff --git a/python/tests/protocol.py b/python/tests/protocol.py -index 354d6559b9d1e3dc3ad29598af3c..8dd26c4ed1e0973b8058604c2373 100644 ---- a/python/tests/protocol.py -+++ b/python/tests/protocol.py -@@ -42,11 +42,17 @@ class NullProtocol(AsyncProtocol[None]): - await super()._establish_session() - - async def _do_accept(self, address, ssl=None): -- if not self.fake_session: -+ if self.fake_session: -+ self._set_state(Runstate.CONNECTING) -+ await asyncio.sleep(0) -+ else: - await super()._do_accept(address, ssl) - - async def _do_connect(self, address, ssl=None): -- if not self.fake_session: -+ if self.fake_session: -+ self._set_state(Runstate.CONNECTING) -+ await asyncio.sleep(0) -+ else: - await super()._do_connect(address, ssl) - - async def _do_recv(self) -> None: diff --git a/python-aqmp-rename-AQMPError-to-QMPError.patch b/python-aqmp-rename-AQMPError-to-QMPError.patch deleted file mode 100644 index 272398f0..00000000 --- a/python-aqmp-rename-AQMPError-to-QMPError.patch +++ /dev/null @@ -1,221 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:49 -0500 -Subject: python/aqmp: rename AQMPError to QMPError - -Git-commit: 6e7751dc388df6daf425db0e245d4d3a10859803 - -This is in preparation for renaming qemu.aqmp to qemu.qmp. I should have -done this from this from the very beginning, but it's a convenient time -to make sure this churn is taken care of. - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/__init__.py | 6 +++--- - python/qemu/aqmp/error.py | 12 ++++++------ - python/qemu/aqmp/events.py | 4 ++-- - python/qemu/aqmp/legacy.py | 4 ++-- - python/qemu/aqmp/protocol.py | 8 ++++---- - python/qemu/aqmp/qmp_client.py | 8 ++++---- - 6 files changed, 21 insertions(+), 21 deletions(-) - -diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py -index 05f467c1415360169e9c66c8d27e..4c22c380790fd0f86402e402628b 100644 ---- a/python/qemu/aqmp/__init__.py -+++ b/python/qemu/aqmp/__init__.py -@@ -6,7 +6,7 @@ asynchronously with QMP protocol servers, as implemented by QEMU, the - QEMU Guest Agent, and the QEMU Storage Daemon. - - `QMPClient` provides the main functionality of this package. All errors --raised by this library derive from `AQMPError`, see `aqmp.error` for -+raised by this library derive from `QMPError`, see `aqmp.error` for - additional detail. See `aqmp.events` for an in-depth tutorial on - managing QMP events. - """ -@@ -23,7 +23,7 @@ managing QMP events. - - import logging - --from .error import AQMPError -+from .error import QMPError - from .events import EventListener - from .message import Message - from .protocol import ( -@@ -48,7 +48,7 @@ __all__ = ( - 'Runstate', - - # Exceptions, most generic to most explicit -- 'AQMPError', -+ 'QMPError', - 'StateError', - 'ConnectError', - 'ExecuteError', -diff --git a/python/qemu/aqmp/error.py b/python/qemu/aqmp/error.py -index 781f49b00877893d7a88f755c67f..24ba4d505410b5fe56390e3d4e02 100644 ---- a/python/qemu/aqmp/error.py -+++ b/python/qemu/aqmp/error.py -@@ -1,21 +1,21 @@ - """ --AQMP Error Classes -+QMP Error Classes - - This package seeks to provide semantic error classes that are intended - to be used directly by clients when they would like to handle particular - semantic failures (e.g. "failed to connect") without needing to know the - enumeration of possible reasons for that failure. - --AQMPError serves as the ancestor for all exceptions raised by this -+QMPError serves as the ancestor for all exceptions raised by this - package, and is suitable for use in handling semantic errors from this - library. In most cases, individual public methods will attempt to catch - and re-encapsulate various exceptions to provide a semantic - error-handling interface. - --.. admonition:: AQMP Exception Hierarchy Reference -+.. admonition:: QMP Exception Hierarchy Reference - - | `Exception` -- | +-- `AQMPError` -+ | +-- `QMPError` - | +-- `ConnectError` - | +-- `StateError` - | +-- `ExecInterruptedError` -@@ -31,11 +31,11 @@ error-handling interface. - """ - - --class AQMPError(Exception): -+class QMPError(Exception): - """Abstract error class for all errors originating from this package.""" - - --class ProtocolError(AQMPError): -+class ProtocolError(QMPError): - """ - Abstract error class for protocol failures. - -diff --git a/python/qemu/aqmp/events.py b/python/qemu/aqmp/events.py -index 5f7150c78d49d9513978103dc9a7..f3d4e2b5e853c39db9e016009db0 100644 ---- a/python/qemu/aqmp/events.py -+++ b/python/qemu/aqmp/events.py -@@ -443,7 +443,7 @@ from typing import ( - Union, - ) - --from .error import AQMPError -+from .error import QMPError - from .message import Message - - -@@ -451,7 +451,7 @@ EventNames = Union[str, Iterable[str], None] - EventFilter = Callable[[Message], bool] - - --class ListenerError(AQMPError): -+class ListenerError(QMPError): - """ - Generic error class for `EventListener`-related problems. - """ -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index 9431fe933019b1e1c221ea3ab7bb..27df22818a76190e872f08c0852e 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -17,7 +17,7 @@ from typing import ( - - import qemu.qmp - --from .error import AQMPError -+from .error import QMPError - from .protocol import Runstate, SocketAddrT - from .qmp_client import QMPClient - -@@ -168,7 +168,7 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - # Nothing we can do about it now, but if we don't raise our - # own error, the user will be treated to a lot of traceback - # they might not understand. -- raise AQMPError( -+ raise QMPError( - "QEMUMonitorProtocol.close()" - " was not called before object was garbage collected" - ) -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 5b4f2f0d0a81a0d2902358e9b799..50e973c2f2dc9c5fa759380ab3e9 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -29,7 +29,7 @@ from typing import ( - cast, - ) - --from .error import AQMPError -+from .error import QMPError - from .util import ( - bottom_half, - create_task, -@@ -65,7 +65,7 @@ class Runstate(Enum): - DISCONNECTING = 3 - - --class ConnectError(AQMPError): -+class ConnectError(QMPError): - """ - Raised when the initial connection process has failed. - -@@ -90,7 +90,7 @@ class ConnectError(AQMPError): - return f"{self.error_message}: {cause}" - - --class StateError(AQMPError): -+class StateError(QMPError): - """ - An API command (connect, execute, etc) was issued at an inappropriate time. - -@@ -363,7 +363,7 @@ class AsyncProtocol(Generic[T]): - This exception will wrap a more concrete one. In most cases, - the wrapped exception will be `OSError` or `EOFError`. If a - protocol-level failure occurs while establishing a new -- session, the wrapped error may also be an `AQMPError`. -+ session, the wrapped error may also be an `QMPError`. - """ - assert self.runstate == Runstate.IDLE - -diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/aqmp/qmp_client.py -index 45864f288e4fe5a7505c0022ed13..90a8737f03a997f6813ee7cbcaac 100644 ---- a/python/qemu/aqmp/qmp_client.py -+++ b/python/qemu/aqmp/qmp_client.py -@@ -20,7 +20,7 @@ from typing import ( - cast, - ) - --from .error import AQMPError, ProtocolError -+from .error import ProtocolError, QMPError - from .events import Events - from .message import Message - from .models import ErrorResponse, Greeting -@@ -66,7 +66,7 @@ class NegotiationError(_WrappedProtocolError): - """ - - --class ExecuteError(AQMPError): -+class ExecuteError(QMPError): - """ - Exception raised by `QMPClient.execute()` on RPC failure. - -@@ -87,7 +87,7 @@ class ExecuteError(AQMPError): - self.error_class: str = error_response.error.class_ - - --class ExecInterruptedError(AQMPError): -+class ExecInterruptedError(QMPError): - """ - Exception raised by `execute()` (et al) when an RPC is interrupted. - -@@ -641,7 +641,7 @@ class QMPClient(AsyncProtocol[Message], Events): - sock = self._writer.transport.get_extra_info('socket') - - if sock.family != socket.AF_UNIX: -- raise AQMPError("Sending file descriptors requires a UNIX socket.") -+ raise QMPError("Sending file descriptors requires a UNIX socket.") - - if not hasattr(sock, 'sendmsg'): - # We need to void the warranty sticker. diff --git a/python-aqmp-rename-accept-to-start_serve.patch b/python-aqmp-rename-accept-to-start_serve.patch deleted file mode 100644 index 47b4ba97..00000000 --- a/python-aqmp-rename-accept-to-start_serve.patch +++ /dev/null @@ -1,163 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:40 -0500 -Subject: python/aqmp: rename 'accept()' to 'start_server_and_accept()' -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 0ba4e76b23fed77d09be7f56da783ab3f0b2d497 - -Previously, I had a method named "accept()" that under-the-hood calls -bind(2), listen(2) *and* accept(2). I meant this as a simplification and -counterpart to the one-shot "connect()" method. - -This is confusing to readers who expect accept() to mean *just* -accept(2). Since I need to split apart the "accept()" method into -multiple methods anyway (one of which strongly resembling accept(2)), it -feels pertinent to rename this method *now*. - -Rename this all-in-one method "start_server_and_accept()" instead. - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-3-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 2 +- - python/qemu/aqmp/protocol.py | 6 ++++-- - python/tests/protocol.py | 24 ++++++++++++------------ - 3 files changed, 17 insertions(+), 15 deletions(-) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index 6baa5f3409a6b459c67097d3c2a0..dca1e76ed4994959caf542031363 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -91,7 +91,7 @@ class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): - self._aqmp.negotiate = True - - self._sync( -- self._aqmp.accept(self._address), -+ self._aqmp.start_server_and_accept(self._address), - timeout - ) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 009883f64d011e44dd003e9dcde3..73719257e058b7e9e4d8a281bcd9 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -265,8 +265,10 @@ class AsyncProtocol(Generic[T]): - - @upper_half - @require(Runstate.IDLE) -- async def accept(self, address: SocketAddrT, -- ssl: Optional[SSLContext] = None) -> None: -+ async def start_server_and_accept( -+ self, address: SocketAddrT, -+ ssl: Optional[SSLContext] = None -+ ) -> None: - """ - Accept a connection and begin processing message queues. - -diff --git a/python/tests/protocol.py b/python/tests/protocol.py -index 5cd7938be35ec61a1d412728f64e..354d6559b9d1e3dc3ad29598af3c 100644 ---- a/python/tests/protocol.py -+++ b/python/tests/protocol.py -@@ -413,14 +413,14 @@ class Accept(Connect): - assert family in ('INET', 'UNIX') - - if family == 'INET': -- await self.proto.accept(('example.com', 1)) -+ await self.proto.start_server_and_accept(('example.com', 1)) - elif family == 'UNIX': -- await self.proto.accept('/dev/null') -+ await self.proto.start_server_and_accept('/dev/null') - - async def _hanging_connection(self): - with TemporaryDirectory(suffix='.aqmp') as tmpdir: - sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock") -- await self.proto.accept(sock) -+ await self.proto.start_server_and_accept(sock) - - - class FakeSession(TestBase): -@@ -449,13 +449,13 @@ class FakeSession(TestBase): - @TestBase.async_test - async def testFakeAccept(self): - """Test the full state lifecycle (via accept) with a no-op session.""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - self.assertEqual(self.proto.runstate, Runstate.RUNNING) - - @TestBase.async_test - async def testFakeRecv(self): - """Test receiving a fake/null message.""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - - logname = self.proto.logger.name - with self.assertLogs(logname, level='DEBUG') as context: -@@ -471,7 +471,7 @@ class FakeSession(TestBase): - @TestBase.async_test - async def testFakeSend(self): - """Test sending a fake/null message.""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - - logname = self.proto.logger.name - with self.assertLogs(logname, level='DEBUG') as context: -@@ -493,7 +493,7 @@ class FakeSession(TestBase): - ): - with self.assertRaises(StateError) as context: - if accept: -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - else: - await self.proto.connect('/not/a/real/path') - -@@ -504,7 +504,7 @@ class FakeSession(TestBase): - @TestBase.async_test - async def testAcceptRequireRunning(self): - """Test that accept() cannot be called when Runstate=RUNNING""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - - await self._prod_session_api( - Runstate.RUNNING, -@@ -515,7 +515,7 @@ class FakeSession(TestBase): - @TestBase.async_test - async def testConnectRequireRunning(self): - """Test that connect() cannot be called when Runstate=RUNNING""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - - await self._prod_session_api( - Runstate.RUNNING, -@@ -526,7 +526,7 @@ class FakeSession(TestBase): - @TestBase.async_test - async def testAcceptRequireDisconnecting(self): - """Test that accept() cannot be called when Runstate=DISCONNECTING""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - - # Cheat: force a disconnect. - await self.proto.simulate_disconnect() -@@ -541,7 +541,7 @@ class FakeSession(TestBase): - @TestBase.async_test - async def testConnectRequireDisconnecting(self): - """Test that connect() cannot be called when Runstate=DISCONNECTING""" -- await self.proto.accept('/not/a/real/path') -+ await self.proto.start_server_and_accept('/not/a/real/path') - - # Cheat: force a disconnect. - await self.proto.simulate_disconnect() -@@ -576,7 +576,7 @@ class SimpleSession(TestBase): - async def testSmoke(self): - with TemporaryDirectory(suffix='.aqmp') as tmpdir: - sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock") -- server_task = create_task(self.server.accept(sock)) -+ server_task = create_task(self.server.start_server_and_accept(sock)) - - # give the server a chance to start listening [...] - await asyncio.sleep(0) diff --git a/python-aqmp-split-_client_connected_cb-o.patch b/python-aqmp-split-_client_connected_cb-o.patch deleted file mode 100644 index 677a35ee..00000000 --- a/python-aqmp-split-_client_connected_cb-o.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:42 -0500 -Subject: python/aqmp: split _client_connected_cb() out as _incoming() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 830e6fd36e2aef37b158a10dea6c3853ce43b20c - -As part of disentangling the monolithic nature of _do_accept(), split -out the incoming callback to prepare for factoring out the "wait for a -peer" step. Namely, this means using an event signal we can wait on from -outside of this method. - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-5-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 83 +++++++++++++++++++++++++----------- - 1 file changed, 58 insertions(+), 25 deletions(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index b7e5e635d886db0efc85f829f42e..56f05b90308c44a86d0978fd2ce6 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -242,6 +242,10 @@ class AsyncProtocol(Generic[T]): - # Workaround for bind() - self._sock: Optional[socket.socket] = None - -+ # Server state for start_server() and _incoming() -+ self._server: Optional[asyncio.AbstractServer] = None -+ self._accepted: Optional[asyncio.Event] = None -+ - def __repr__(self) -> str: - cls_name = type(self).__name__ - tokens = [] -@@ -425,6 +429,54 @@ class AsyncProtocol(Generic[T]): - self._runstate_event.set() - self._runstate_event.clear() - -+ @bottom_half # However, it does not run from the R/W tasks. -+ async def _stop_server(self) -> None: -+ """ -+ Stop listening for / accepting new incoming connections. -+ """ -+ if self._server is None: -+ return -+ -+ try: -+ self.logger.debug("Stopping server.") -+ self._server.close() -+ await self._server.wait_closed() -+ self.logger.debug("Server stopped.") -+ finally: -+ self._server = None -+ -+ @bottom_half # However, it does not run from the R/W tasks. -+ async def _incoming(self, -+ reader: asyncio.StreamReader, -+ writer: asyncio.StreamWriter) -> None: -+ """ -+ Accept an incoming connection and signal the upper_half. -+ -+ This method does the minimum necessary to accept a single -+ incoming connection. It signals back to the upper_half ASAP so -+ that any errors during session initialization can occur -+ naturally in the caller's stack. -+ -+ :param reader: Incoming `asyncio.StreamReader` -+ :param writer: Incoming `asyncio.StreamWriter` -+ """ -+ peer = writer.get_extra_info('peername', 'Unknown peer') -+ self.logger.debug("Incoming connection from %s", peer) -+ -+ if self._reader or self._writer: -+ # Sadly, we can have more than one pending connection -+ # because of https://bugs.python.org/issue46715 -+ # Close any extra connections we don't actually want. -+ self.logger.warning("Extraneous connection inadvertently accepted") -+ writer.close() -+ return -+ -+ # A connection has been accepted; stop listening for new ones. -+ assert self._accepted is not None -+ await self._stop_server() -+ self._reader, self._writer = (reader, writer) -+ self._accepted.set() -+ - def _bind_hack(self, address: Union[str, Tuple[str, int]]) -> None: - """ - Used to create a socket in advance of accept(). -@@ -469,30 +521,11 @@ class AsyncProtocol(Generic[T]): - self._set_state(Runstate.CONNECTING) - - self.logger.debug("Awaiting connection on %s ...", address) -- connected = asyncio.Event() -- server: Optional[asyncio.AbstractServer] = None -- -- async def _client_connected_cb(reader: asyncio.StreamReader, -- writer: asyncio.StreamWriter) -> None: -- """Used to accept a single incoming connection, see below.""" -- nonlocal server -- nonlocal connected -- -- # A connection has been accepted; stop listening for new ones. -- assert server is not None -- server.close() -- await server.wait_closed() -- server = None -- -- # Register this client as being connected -- self._reader, self._writer = (reader, writer) -- -- # Signal back: We've accepted a client! -- connected.set() -+ self._accepted = asyncio.Event() - - if isinstance(address, tuple): - coro = asyncio.start_server( -- _client_connected_cb, -+ self._incoming, - host=None if self._sock else address[0], - port=None if self._sock else address[1], - ssl=ssl, -@@ -502,7 +535,7 @@ class AsyncProtocol(Generic[T]): - ) - else: - coro = asyncio.start_unix_server( -- _client_connected_cb, -+ self._incoming, - path=None if self._sock else address, - ssl=ssl, - backlog=1, -@@ -515,9 +548,9 @@ class AsyncProtocol(Generic[T]): - # otherwise yield. - await asyncio.sleep(0) - -- server = await coro # Starts listening -- await connected.wait() # Waits for the callback to fire (and finish) -- assert server is None -+ self._server = await coro # Starts listening -+ await self._accepted.wait() # Waits for the callback to finish -+ assert self._server is None - self._sock = None - - self.logger.debug("Connection accepted.") diff --git a/python-aqmp-squelch-pylint-warning-for-t.patch b/python-aqmp-squelch-pylint-warning-for-t.patch deleted file mode 100644 index 830c71f3..00000000 --- a/python-aqmp-squelch-pylint-warning-for-t.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:43 -0500 -Subject: python/aqmp: squelch pylint warning for too many lines -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 1b9c8cb6ce6b5c5911eb715b2d5b0a2671999dde - -I would really like to keep this under 1000 lines, I promise. Doesn't -look like it's gonna happen. - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-6-jsnow@redhat.com -Signed-off-by: John Snow -(cherry picked from commit 1b9c8cb6ce6b5c5911eb715b2d5b0a2671999dde) -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index 56f05b90308c44a86d0978fd2ce6..631bcdaa554f4a104af4e25a3c61 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -10,6 +10,9 @@ In this package, it is used as the implementation for the `QMPClient` - class. - """ - -+# It's all the docstrings ... ! It's long for a good reason ^_^; -+# pylint: disable=too-many-lines -+ - import asyncio - from asyncio import StreamReader, StreamWriter - from enum import Enum diff --git a/python-aqmp-stop-the-server-during-disco.patch b/python-aqmp-stop-the-server-during-disco.patch deleted file mode 100644 index d5696264..00000000 --- a/python-aqmp-stop-the-server-during-disco.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: John Snow -Date: Fri, 25 Feb 2022 15:59:45 -0500 -Subject: python/aqmp: stop the server during disconnect() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 32c5abf051d06ff103d9d30eb6a7f3e8bf582334 - -Before we allow the full separation of starting the server and accepting -new connections, make sure that the disconnect cleans up the server and -its new state, too. - -Signed-off-by: John Snow -Acked-by: Kevin Wolf -Reviewed-by: Daniel P. Berrangé -Message-id: 20220225205948.3693480-8-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/protocol.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py -index e2bdad542dc0ef451dd200a1d679..cdbc9cba0d15dea19cc1c60ca3c3 100644 ---- a/python/qemu/aqmp/protocol.py -+++ b/python/qemu/aqmp/protocol.py -@@ -432,7 +432,7 @@ class AsyncProtocol(Generic[T]): - self._runstate_event.set() - self._runstate_event.clear() - -- @bottom_half # However, it does not run from the R/W tasks. -+ @bottom_half - async def _stop_server(self) -> None: - """ - Stop listening for / accepting new incoming connections. -@@ -709,6 +709,7 @@ class AsyncProtocol(Generic[T]): - - self._reader = None - self._writer = None -+ self._accepted = None - - # NB: _runstate_changed cannot be cleared because we still need it to - # send the final runstate changed event ...! -@@ -732,6 +733,9 @@ class AsyncProtocol(Generic[T]): - def _done(task: Optional['asyncio.Future[Any]']) -> bool: - return task is not None and task.done() - -+ # If the server is running, stop it. -+ await self._stop_server() -+ - # Are we already in an error pathway? If either of the tasks are - # already done, or if we have no tasks but a reader/writer; we - # must be. diff --git a/python-introduce-qmp-shell-wrap-convenie.patch b/python-introduce-qmp-shell-wrap-convenie.patch deleted file mode 100644 index 32429819..00000000 --- a/python-introduce-qmp-shell-wrap-convenie.patch +++ /dev/null @@ -1,167 +0,0 @@ -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Fri, 28 Jan 2022 16:11:56 +0000 -Subject: python: introduce qmp-shell-wrap convenience tool -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 439125293cc9cfb684eb4db23db04199f5f435a2 - -With the current 'qmp-shell' tool developers must first spawn QEMU with -a suitable -qmp arg and then spawn qmp-shell in a separate terminal -pointing to the right socket. - -With 'qmp-shell-wrap' developers can ignore QMP sockets entirely and -just pass the QEMU command and arguments they want. The program will -listen on a UNIX socket and tell QEMU to connect QMP to that. - -For example, this: - - # qmp-shell-wrap -- qemu-system-x86_64 -display none - -Is roughly equivalent of running: - - # qemu-system-x86_64 -display none -qmp qmp-shell-1234 & - # qmp-shell qmp-shell-1234 - -Except that 'qmp-shell-wrap' switches the socket peers around so that -it is the UNIX socket server and QEMU is the socket client. This makes -QEMU reliably go away when qmp-shell-wrap exits, closing the server -socket. - -Signed-off-by: Daniel P. Berrangé -Message-id: 20220128161157.36261-2-berrange@redhat.com -[Edited for rebase. --js] -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/qmp_shell.py | 65 ++++++++++++++++++++++++++++++++--- - python/setup.cfg | 1 + - scripts/qmp/qmp-shell-wrap | 11 ++++++ - 3 files changed, 73 insertions(+), 4 deletions(-) - -diff --git a/python/qemu/aqmp/qmp_shell.py b/python/qemu/aqmp/qmp_shell.py -index d11bf54b00e5d56616ae57be0006..c60df787fcd50bf8a0109e5f5cd3 100644 ---- a/python/qemu/aqmp/qmp_shell.py -+++ b/python/qemu/aqmp/qmp_shell.py -@@ -86,6 +86,7 @@ import logging - import os - import re - import readline -+from subprocess import Popen - import sys - from typing import ( - Iterator, -@@ -167,8 +168,10 @@ class QMPShell(QEMUMonitorProtocol): - :param verbose: Echo outgoing QMP messages to console. - """ - def __init__(self, address: SocketAddrT, -- pretty: bool = False, verbose: bool = False): -- super().__init__(address) -+ pretty: bool = False, -+ verbose: bool = False, -+ server: bool = False): -+ super().__init__(address, server=server) - self._greeting: Optional[QMPMessage] = None - self._completer = QMPCompleter() - self._transmode = False -@@ -409,8 +412,10 @@ class HMPShell(QMPShell): - :param verbose: Echo outgoing QMP messages to console. - """ - def __init__(self, address: SocketAddrT, -- pretty: bool = False, verbose: bool = False): -- super().__init__(address, pretty, verbose) -+ pretty: bool = False, -+ verbose: bool = False, -+ server: bool = False): -+ super().__init__(address, pretty, verbose, server) - self._cpu_index = 0 - - def _cmd_completion(self) -> None: -@@ -533,5 +538,57 @@ def main() -> None: - pass - - -+def main_wrap() -> None: -+ """ -+ qmp-shell-wrap entry point: parse command line arguments and -+ start the REPL. -+ """ -+ parser = argparse.ArgumentParser() -+ parser.add_argument('-H', '--hmp', action='store_true', -+ help='Use HMP interface') -+ parser.add_argument('-v', '--verbose', action='store_true', -+ help='Verbose (echo commands sent and received)') -+ parser.add_argument('-p', '--pretty', action='store_true', -+ help='Pretty-print JSON') -+ -+ parser.add_argument('command', nargs=argparse.REMAINDER, -+ help='QEMU command line to invoke') -+ -+ args = parser.parse_args() -+ -+ cmd = args.command -+ if len(cmd) != 0 and cmd[0] == '--': -+ cmd = cmd[1:] -+ if len(cmd) == 0: -+ cmd = ["qemu-system-x86_64"] -+ -+ sockpath = "qmp-shell-wrap-%d" % os.getpid() -+ cmd += ["-qmp", "unix:%s" % sockpath] -+ -+ shell_class = HMPShell if args.hmp else QMPShell -+ -+ try: -+ address = shell_class.parse_address(sockpath) -+ except QMPBadPortError: -+ parser.error(f"Bad port number: {sockpath}") -+ return # pycharm doesn't know error() is noreturn -+ -+ try: -+ with shell_class(address, args.pretty, args.verbose, True) as qemu: -+ with Popen(cmd): -+ -+ try: -+ qemu.accept() -+ except ConnectError as err: -+ if isinstance(err.exc, OSError): -+ die(f"Couldn't connect to {args.qmp_server}: {err!s}") -+ die(str(err)) -+ -+ for _ in qemu.repl(): -+ pass -+ finally: -+ os.unlink(sockpath) -+ -+ - if __name__ == '__main__': - main() -diff --git a/python/setup.cfg b/python/setup.cfg -index 0063c757b78638ef651a362af338..bec54e8b0d663191e2b7afbfa350 100644 ---- a/python/setup.cfg -+++ b/python/setup.cfg -@@ -68,6 +68,7 @@ console_scripts = - qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] - qemu-ga-client = qemu.utils.qemu_ga_client:main - qmp-shell = qemu.aqmp.qmp_shell:main -+ qmp-shell-wrap = qemu.aqmp.qmp_shell:main_wrap - aqmp-tui = qemu.aqmp.aqmp_tui:main [tui] - - [flake8] -diff --git a/scripts/qmp/qmp-shell-wrap b/scripts/qmp/qmp-shell-wrap -new file mode 100755 -index 0000000000000000000000000000000000000000..9e94da114f5f87588639f6b2cc636391e80c3864 ---- /dev/null -+++ b/scripts/qmp/qmp-shell-wrap -@@ -0,0 +1,11 @@ -+#!/usr/bin/env python3 -+ -+import os -+import sys -+ -+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -+from qemu.qmp import qmp_shell -+ -+ -+if __name__ == '__main__': -+ qmp_shell.main_wrap() diff --git a/python-machine-raise-VMLaunchFailure-exc.patch b/python-machine-raise-VMLaunchFailure-exc.patch deleted file mode 100644 index 4d6207cb..00000000 --- a/python-machine-raise-VMLaunchFailure-exc.patch +++ /dev/null @@ -1,126 +0,0 @@ -From: John Snow -Date: Mon, 31 Jan 2022 23:11:32 -0500 -Subject: python/machine: raise VMLaunchFailure exception from launch() - -Git-commit: 50465f94d211beabfbfc80e4f85ec4fad0757570 - -This allows us to pack in some extra information about the failure, -which guarantees that if the caller did not *intentionally* cause a -failure (by capturing this Exception), some pretty good clues will be -printed at the bottom of the traceback information. - -This will help make failures in the event of a non-negative return code -more obvious when they go unhandled; the current behavior in -_post_shutdown() is to print a warning message only in the event of -signal-based terminations (for negative return codes). - -(Note: In Python, catching BaseException instead of Exception catches a -broader array of Exception events, including SystemExit and -KeyboardInterrupt. We do not want to "wrap" such exceptions as a -VMLaunchFailure, because that will 'downgrade' the exception from a -BaseException to a regular Exception. We do, however, want to perform -cleanup in either case, so catch on the broadest scope and -wrap-and-re-raise only in the more targeted scope.) - -Signed-off-by: John Snow -Reviewed-by: Hanna Reitz -Reviewed-by: Kevin Wolf -Message-id: 20220201041134.1237016-3-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/machine/machine.py | 45 ++++++++++++++++++++--- - tests/qemu-iotests/tests/mirror-top-perms | 3 +- - 2 files changed, 40 insertions(+), 8 deletions(-) - -diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py -index 67ab06ca2b6daa531b7c0ad9f7c2..a5972fab4d2b1fddfa2d5a7db882 100644 ---- a/python/qemu/machine/machine.py -+++ b/python/qemu/machine/machine.py -@@ -74,6 +74,35 @@ class QEMUMachineAddDeviceError(QEMUMachineError): - """ - - -+class VMLaunchFailure(QEMUMachineError): -+ """ -+ Exception raised when a VM launch was attempted, but failed. -+ """ -+ def __init__(self, exitcode: Optional[int], -+ command: str, output: Optional[str]): -+ super().__init__(exitcode, command, output) -+ self.exitcode = exitcode -+ self.command = command -+ self.output = output -+ -+ def __str__(self) -> str: -+ ret = '' -+ if self.__cause__ is not None: -+ name = type(self.__cause__).__name__ -+ reason = str(self.__cause__) -+ if reason: -+ ret += f"{name}: {reason}" -+ else: -+ ret += f"{name}" -+ ret += '\n' -+ -+ if self.exitcode is not None: -+ ret += f"\tExit code: {self.exitcode}\n" -+ ret += f"\tCommand: {self.command}\n" -+ ret += f"\tOutput: {self.output}\n" -+ return ret -+ -+ - class AbnormalShutdown(QEMUMachineError): - """ - Exception raised when a graceful shutdown was requested, but not performed. -@@ -397,7 +426,7 @@ class QEMUMachine: - - try: - self._launch() -- except: -+ except BaseException as exc: - # We may have launched the process but it may - # have exited before we could connect via QMP. - # Assume the VM didn't launch or is exiting. -@@ -408,11 +437,15 @@ class QEMUMachine: - else: - self._post_shutdown() - -- LOG.debug('Error launching VM') -- if self._qemu_full_args: -- LOG.debug('Command: %r', ' '.join(self._qemu_full_args)) -- if self._iolog: -- LOG.debug('Output: %r', self._iolog) -+ if isinstance(exc, Exception): -+ raise VMLaunchFailure( -+ exitcode=self.exitcode(), -+ command=' '.join(self._qemu_full_args), -+ output=self._iolog -+ ) from exc -+ -+ # Don't wrap 'BaseException'; doing so would downgrade -+ # that exception. However, we still want to clean up. - raise - - def _launch(self) -> None: -diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests/tests/mirror-top-perms -index 0a51a613f39764b2b3ab3fa460ef..b5849978c4158c35e18480186ea2 100755 ---- a/tests/qemu-iotests/tests/mirror-top-perms -+++ b/tests/qemu-iotests/tests/mirror-top-perms -@@ -21,7 +21,6 @@ - - import os - --from qemu.aqmp import ConnectError - from qemu.machine import machine - from qemu.qmp import QMPConnectError - -@@ -107,7 +106,7 @@ class TestMirrorTopPerms(iotests.QMPTestCase): - self.vm_b.launch() - print('ERROR: VM B launched successfully, ' - 'this should not have happened') -- except (QMPConnectError, ConnectError): -+ except (QMPConnectError, machine.VMLaunchFailure): - assert 'Is another process using the image' in self.vm_b.get_log() - - result = self.vm.qmp('block-job-cancel', diff --git a/python-move-qmp-shell-under-the-AQMP-pac.patch b/python-move-qmp-shell-under-the-AQMP-pac.patch deleted file mode 100644 index 4dc8a6e8..00000000 --- a/python-move-qmp-shell-under-the-AQMP-pac.patch +++ /dev/null @@ -1,1143 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:55 -0500 -Subject: python: move qmp-shell under the AQMP package - -Git-commit: fd9c3a6219b0470c356c8486188052d353846806 - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Beraldo Leal -Signed-off-by: Li Zhang ---- - python/README.rst | 2 +- - python/qemu/aqmp/qmp_shell.py | 537 ++++++++++++++++++++++++++++++++++ - python/qemu/qmp/qmp_shell.py | 537 ---------------------------------- - python/setup.cfg | 2 +- - scripts/qmp/qmp-shell | 2 +- - 5 files changed, 540 insertions(+), 540 deletions(-) - -diff --git a/python/README.rst b/python/README.rst -index 9c1fceaee73b11cb313b71a9a558..fcf74f69eae011aafd1e089e1f92 100644 ---- a/python/README.rst -+++ b/python/README.rst -@@ -59,7 +59,7 @@ Package installation also normally provides executable console scripts, - so that tools like ``qmp-shell`` are always available via $PATH. To - invoke them without installation, you can invoke e.g.: - --``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` -+``> PYTHONPATH=~/src/qemu/python python3 -m qemu.aqmp.qmp_shell`` - - The mappings between console script name and python module path can be - found in ``setup.cfg``. -diff --git a/python/qemu/aqmp/qmp_shell.py b/python/qemu/aqmp/qmp_shell.py -new file mode 100644 -index 0000000000000000000000000000000000000000..d11bf54b00e5d56616ae57be0006b9b0629dd9f4 ---- /dev/null -+++ b/python/qemu/aqmp/qmp_shell.py -@@ -0,0 +1,537 @@ -+# -+# Copyright (C) 2009, 2010 Red Hat Inc. -+# -+# Authors: -+# Luiz Capitulino -+# -+# This work is licensed under the terms of the GNU GPL, version 2. See -+# the COPYING file in the top-level directory. -+# -+ -+""" -+Low-level QEMU shell on top of QMP. -+ -+usage: qmp-shell [-h] [-H] [-N] [-v] [-p] qmp_server -+ -+positional arguments: -+ qmp_server < UNIX socket path | TCP address:port > -+ -+optional arguments: -+ -h, --help show this help message and exit -+ -H, --hmp Use HMP interface -+ -N, --skip-negotiation -+ Skip negotiate (for qemu-ga) -+ -v, --verbose Verbose (echo commands sent and received) -+ -p, --pretty Pretty-print JSON -+ -+ -+Start QEMU with: -+ -+# qemu [...] -qmp unix:./qmp-sock,server -+ -+Run the shell: -+ -+$ qmp-shell ./qmp-sock -+ -+Commands have the following format: -+ -+ < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ] -+ -+For example: -+ -+(QEMU) device_add driver=e1000 id=net1 -+{'return': {}} -+(QEMU) -+ -+key=value pairs also support Python or JSON object literal subset notations, -+without spaces. Dictionaries/objects {} are supported as are arrays []. -+ -+ example-command arg-name1={'key':'value','obj'={'prop':"value"}} -+ -+Both JSON and Python formatting should work, including both styles of -+string literal quotes. Both paradigms of literal values should work, -+including null/true/false for JSON and None/True/False for Python. -+ -+ -+Transactions have the following multi-line format: -+ -+ transaction( -+ action-name1 [ arg-name1=arg1 ] ... [arg-nameN=argN ] -+ ... -+ action-nameN [ arg-name1=arg1 ] ... [arg-nameN=argN ] -+ ) -+ -+One line transactions are also supported: -+ -+ transaction( action-name1 ... ) -+ -+For example: -+ -+ (QEMU) transaction( -+ TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1 -+ TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0 -+ TRANS> ) -+ {"return": {}} -+ (QEMU) -+ -+Use the -v and -p options to activate the verbose and pretty-print options, -+which will echo back the properly formatted JSON-compliant QMP that is being -+sent to QEMU, which is useful for debugging and documentation generation. -+""" -+ -+import argparse -+import ast -+import json -+import logging -+import os -+import re -+import readline -+import sys -+from typing import ( -+ Iterator, -+ List, -+ NoReturn, -+ Optional, -+ Sequence, -+) -+ -+from qemu.aqmp import ConnectError, QMPError, SocketAddrT -+from qemu.aqmp.legacy import ( -+ QEMUMonitorProtocol, -+ QMPBadPortError, -+ QMPMessage, -+ QMPObject, -+) -+ -+ -+LOG = logging.getLogger(__name__) -+ -+ -+class QMPCompleter: -+ """ -+ QMPCompleter provides a readline library tab-complete behavior. -+ """ -+ # NB: Python 3.9+ will probably allow us to subclass list[str] directly, -+ # but pylint as of today does not know that List[str] is simply 'list'. -+ def __init__(self) -> None: -+ self._matches: List[str] = [] -+ -+ def append(self, value: str) -> None: -+ """Append a new valid completion to the list of possibilities.""" -+ return self._matches.append(value) -+ -+ def complete(self, text: str, state: int) -> Optional[str]: -+ """readline.set_completer() callback implementation.""" -+ for cmd in self._matches: -+ if cmd.startswith(text): -+ if state == 0: -+ return cmd -+ state -= 1 -+ return None -+ -+ -+class QMPShellError(QMPError): -+ """ -+ QMP Shell Base error class. -+ """ -+ -+ -+class FuzzyJSON(ast.NodeTransformer): -+ """ -+ This extension of ast.NodeTransformer filters literal "true/false/null" -+ values in a Python AST and replaces them by proper "True/False/None" values -+ that Python can properly evaluate. -+ """ -+ -+ @classmethod -+ def visit_Name(cls, # pylint: disable=invalid-name -+ node: ast.Name) -> ast.AST: -+ """ -+ Transform Name nodes with certain values into Constant (keyword) nodes. -+ """ -+ if node.id == 'true': -+ return ast.Constant(value=True) -+ if node.id == 'false': -+ return ast.Constant(value=False) -+ if node.id == 'null': -+ return ast.Constant(value=None) -+ return node -+ -+ -+class QMPShell(QEMUMonitorProtocol): -+ """ -+ QMPShell provides a basic readline-based QMP shell. -+ -+ :param address: Address of the QMP server. -+ :param pretty: Pretty-print QMP messages. -+ :param verbose: Echo outgoing QMP messages to console. -+ """ -+ def __init__(self, address: SocketAddrT, -+ pretty: bool = False, verbose: bool = False): -+ super().__init__(address) -+ self._greeting: Optional[QMPMessage] = None -+ self._completer = QMPCompleter() -+ self._transmode = False -+ self._actions: List[QMPMessage] = [] -+ self._histfile = os.path.join(os.path.expanduser('~'), -+ '.qmp-shell_history') -+ self.pretty = pretty -+ self.verbose = verbose -+ -+ def close(self) -> None: -+ # Hook into context manager of parent to save shell history. -+ self._save_history() -+ super().close() -+ -+ def _fill_completion(self) -> None: -+ cmds = self.cmd('query-commands') -+ if 'error' in cmds: -+ return -+ for cmd in cmds['return']: -+ self._completer.append(cmd['name']) -+ -+ def _completer_setup(self) -> None: -+ self._completer = QMPCompleter() -+ self._fill_completion() -+ readline.set_history_length(1024) -+ readline.set_completer(self._completer.complete) -+ readline.parse_and_bind("tab: complete") -+ # NB: default delimiters conflict with some command names -+ # (eg. query-), clearing everything as it doesn't seem to matter -+ readline.set_completer_delims('') -+ try: -+ readline.read_history_file(self._histfile) -+ except FileNotFoundError: -+ pass -+ except IOError as err: -+ msg = f"Failed to read history '{self._histfile}': {err!s}" -+ LOG.warning(msg) -+ -+ def _save_history(self) -> None: -+ try: -+ readline.write_history_file(self._histfile) -+ except IOError as err: -+ msg = f"Failed to save history file '{self._histfile}': {err!s}" -+ LOG.warning(msg) -+ -+ @classmethod -+ def _parse_value(cls, val: str) -> object: -+ try: -+ return int(val) -+ except ValueError: -+ pass -+ -+ if val.lower() == 'true': -+ return True -+ if val.lower() == 'false': -+ return False -+ if val.startswith(('{', '[')): -+ # Try first as pure JSON: -+ try: -+ return json.loads(val) -+ except ValueError: -+ pass -+ # Try once again as FuzzyJSON: -+ try: -+ tree = ast.parse(val, mode='eval') -+ transformed = FuzzyJSON().visit(tree) -+ return ast.literal_eval(transformed) -+ except (SyntaxError, ValueError): -+ pass -+ return val -+ -+ def _cli_expr(self, -+ tokens: Sequence[str], -+ parent: QMPObject) -> None: -+ for arg in tokens: -+ (key, sep, val) = arg.partition('=') -+ if sep != '=': -+ raise QMPShellError( -+ f"Expected a key=value pair, got '{arg!s}'" -+ ) -+ -+ value = self._parse_value(val) -+ optpath = key.split('.') -+ curpath = [] -+ for path in optpath[:-1]: -+ curpath.append(path) -+ obj = parent.get(path, {}) -+ if not isinstance(obj, dict): -+ msg = 'Cannot use "{:s}" as both leaf and non-leaf key' -+ raise QMPShellError(msg.format('.'.join(curpath))) -+ parent[path] = obj -+ parent = obj -+ if optpath[-1] in parent: -+ if isinstance(parent[optpath[-1]], dict): -+ msg = 'Cannot use "{:s}" as both leaf and non-leaf key' -+ raise QMPShellError(msg.format('.'.join(curpath))) -+ raise QMPShellError(f'Cannot set "{key}" multiple times') -+ parent[optpath[-1]] = value -+ -+ def _build_cmd(self, cmdline: str) -> Optional[QMPMessage]: -+ """ -+ Build a QMP input object from a user provided command-line in the -+ following format: -+ -+ < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ] -+ """ -+ argument_regex = r'''(?:[^\s"']|"(?:\\.|[^"])*"|'(?:\\.|[^'])*')+''' -+ cmdargs = re.findall(argument_regex, cmdline) -+ qmpcmd: QMPMessage -+ -+ # Transactional CLI entry: -+ if cmdargs and cmdargs[0] == 'transaction(': -+ self._transmode = True -+ self._actions = [] -+ cmdargs.pop(0) -+ -+ # Transactional CLI exit: -+ if cmdargs and cmdargs[0] == ')' and self._transmode: -+ self._transmode = False -+ if len(cmdargs) > 1: -+ msg = 'Unexpected input after close of Transaction sub-shell' -+ raise QMPShellError(msg) -+ qmpcmd = { -+ 'execute': 'transaction', -+ 'arguments': {'actions': self._actions} -+ } -+ return qmpcmd -+ -+ # No args, or no args remaining -+ if not cmdargs: -+ return None -+ -+ if self._transmode: -+ # Parse and cache this Transactional Action -+ finalize = False -+ action = {'type': cmdargs[0], 'data': {}} -+ if cmdargs[-1] == ')': -+ cmdargs.pop(-1) -+ finalize = True -+ self._cli_expr(cmdargs[1:], action['data']) -+ self._actions.append(action) -+ return self._build_cmd(')') if finalize else None -+ -+ # Standard command: parse and return it to be executed. -+ qmpcmd = {'execute': cmdargs[0], 'arguments': {}} -+ self._cli_expr(cmdargs[1:], qmpcmd['arguments']) -+ return qmpcmd -+ -+ def _print(self, qmp_message: object) -> None: -+ jsobj = json.dumps(qmp_message, -+ indent=4 if self.pretty else None, -+ sort_keys=self.pretty) -+ print(str(jsobj)) -+ -+ def _execute_cmd(self, cmdline: str) -> bool: -+ try: -+ qmpcmd = self._build_cmd(cmdline) -+ except QMPShellError as err: -+ print( -+ f"Error while parsing command line: {err!s}\n" -+ "command format: " -+ "[arg-name1=arg1] ... [arg-nameN=argN", -+ file=sys.stderr -+ ) -+ return True -+ # For transaction mode, we may have just cached the action: -+ if qmpcmd is None: -+ return True -+ if self.verbose: -+ self._print(qmpcmd) -+ resp = self.cmd_obj(qmpcmd) -+ if resp is None: -+ print('Disconnected') -+ return False -+ self._print(resp) -+ return True -+ -+ def connect(self, negotiate: bool = True) -> None: -+ self._greeting = super().connect(negotiate) -+ self._completer_setup() -+ -+ def show_banner(self, -+ msg: str = 'Welcome to the QMP low-level shell!') -> None: -+ """ -+ Print to stdio a greeting, and the QEMU version if available. -+ """ -+ print(msg) -+ if not self._greeting: -+ print('Connected') -+ return -+ version = self._greeting['QMP']['version']['qemu'] -+ print("Connected to QEMU {major}.{minor}.{micro}\n".format(**version)) -+ -+ @property -+ def prompt(self) -> str: -+ """ -+ Return the current shell prompt, including a trailing space. -+ """ -+ if self._transmode: -+ return 'TRANS> ' -+ return '(QEMU) ' -+ -+ def read_exec_command(self) -> bool: -+ """ -+ Read and execute a command. -+ -+ @return True if execution was ok, return False if disconnected. -+ """ -+ try: -+ cmdline = input(self.prompt) -+ except EOFError: -+ print() -+ return False -+ -+ if cmdline == '': -+ for event in self.get_events(): -+ print(event) -+ return True -+ -+ return self._execute_cmd(cmdline) -+ -+ def repl(self) -> Iterator[None]: -+ """ -+ Return an iterator that implements the REPL. -+ """ -+ self.show_banner() -+ while self.read_exec_command(): -+ yield -+ self.close() -+ -+ -+class HMPShell(QMPShell): -+ """ -+ HMPShell provides a basic readline-based HMP shell, tunnelled via QMP. -+ -+ :param address: Address of the QMP server. -+ :param pretty: Pretty-print QMP messages. -+ :param verbose: Echo outgoing QMP messages to console. -+ """ -+ def __init__(self, address: SocketAddrT, -+ pretty: bool = False, verbose: bool = False): -+ super().__init__(address, pretty, verbose) -+ self._cpu_index = 0 -+ -+ def _cmd_completion(self) -> None: -+ for cmd in self._cmd_passthrough('help')['return'].split('\r\n'): -+ if cmd and cmd[0] != '[' and cmd[0] != '\t': -+ name = cmd.split()[0] # drop help text -+ if name == 'info': -+ continue -+ if name.find('|') != -1: -+ # Command in the form 'foobar|f' or 'f|foobar', take the -+ # full name -+ opt = name.split('|') -+ if len(opt[0]) == 1: -+ name = opt[1] -+ else: -+ name = opt[0] -+ self._completer.append(name) -+ self._completer.append('help ' + name) # help completion -+ -+ def _info_completion(self) -> None: -+ for cmd in self._cmd_passthrough('info')['return'].split('\r\n'): -+ if cmd: -+ self._completer.append('info ' + cmd.split()[1]) -+ -+ def _other_completion(self) -> None: -+ # special cases -+ self._completer.append('help info') -+ -+ def _fill_completion(self) -> None: -+ self._cmd_completion() -+ self._info_completion() -+ self._other_completion() -+ -+ def _cmd_passthrough(self, cmdline: str, -+ cpu_index: int = 0) -> QMPMessage: -+ return self.cmd_obj({ -+ 'execute': 'human-monitor-command', -+ 'arguments': { -+ 'command-line': cmdline, -+ 'cpu-index': cpu_index -+ } -+ }) -+ -+ def _execute_cmd(self, cmdline: str) -> bool: -+ if cmdline.split()[0] == "cpu": -+ # trap the cpu command, it requires special setting -+ try: -+ idx = int(cmdline.split()[1]) -+ if 'return' not in self._cmd_passthrough('info version', idx): -+ print('bad CPU index') -+ return True -+ self._cpu_index = idx -+ except ValueError: -+ print('cpu command takes an integer argument') -+ return True -+ resp = self._cmd_passthrough(cmdline, self._cpu_index) -+ if resp is None: -+ print('Disconnected') -+ return False -+ assert 'return' in resp or 'error' in resp -+ if 'return' in resp: -+ # Success -+ if len(resp['return']) > 0: -+ print(resp['return'], end=' ') -+ else: -+ # Error -+ print('%s: %s' % (resp['error']['class'], resp['error']['desc'])) -+ return True -+ -+ def show_banner(self, msg: str = 'Welcome to the HMP shell!') -> None: -+ QMPShell.show_banner(self, msg) -+ -+ -+def die(msg: str) -> NoReturn: -+ """Write an error to stderr, then exit with a return code of 1.""" -+ sys.stderr.write('ERROR: %s\n' % msg) -+ sys.exit(1) -+ -+ -+def main() -> None: -+ """ -+ qmp-shell entry point: parse command line arguments and start the REPL. -+ """ -+ parser = argparse.ArgumentParser() -+ parser.add_argument('-H', '--hmp', action='store_true', -+ help='Use HMP interface') -+ parser.add_argument('-N', '--skip-negotiation', action='store_true', -+ help='Skip negotiate (for qemu-ga)') -+ parser.add_argument('-v', '--verbose', action='store_true', -+ help='Verbose (echo commands sent and received)') -+ parser.add_argument('-p', '--pretty', action='store_true', -+ help='Pretty-print JSON') -+ -+ default_server = os.environ.get('QMP_SOCKET') -+ parser.add_argument('qmp_server', action='store', -+ default=default_server, -+ help='< UNIX socket path | TCP address:port >') -+ -+ args = parser.parse_args() -+ if args.qmp_server is None: -+ parser.error("QMP socket or TCP address must be specified") -+ -+ shell_class = HMPShell if args.hmp else QMPShell -+ -+ try: -+ address = shell_class.parse_address(args.qmp_server) -+ except QMPBadPortError: -+ parser.error(f"Bad port number: {args.qmp_server}") -+ return # pycharm doesn't know error() is noreturn -+ -+ with shell_class(address, args.pretty, args.verbose) as qemu: -+ try: -+ qemu.connect(negotiate=not args.skip_negotiation) -+ except ConnectError as err: -+ if isinstance(err.exc, OSError): -+ die(f"Couldn't connect to {args.qmp_server}: {err!s}") -+ die(str(err)) -+ -+ for _ in qemu.repl(): -+ pass -+ -+ -+if __name__ == '__main__': -+ main() -diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py -deleted file mode 100644 -index d11bf54b00e5d56616ae57be0006b9b0629dd9f4..0000000000000000000000000000000000000000 ---- a/python/qemu/qmp/qmp_shell.py -+++ /dev/null -@@ -1,537 +0,0 @@ --# --# Copyright (C) 2009, 2010 Red Hat Inc. --# --# Authors: --# Luiz Capitulino --# --# This work is licensed under the terms of the GNU GPL, version 2. See --# the COPYING file in the top-level directory. --# -- --""" --Low-level QEMU shell on top of QMP. -- --usage: qmp-shell [-h] [-H] [-N] [-v] [-p] qmp_server -- --positional arguments: -- qmp_server < UNIX socket path | TCP address:port > -- --optional arguments: -- -h, --help show this help message and exit -- -H, --hmp Use HMP interface -- -N, --skip-negotiation -- Skip negotiate (for qemu-ga) -- -v, --verbose Verbose (echo commands sent and received) -- -p, --pretty Pretty-print JSON -- -- --Start QEMU with: -- --# qemu [...] -qmp unix:./qmp-sock,server -- --Run the shell: -- --$ qmp-shell ./qmp-sock -- --Commands have the following format: -- -- < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ] -- --For example: -- --(QEMU) device_add driver=e1000 id=net1 --{'return': {}} --(QEMU) -- --key=value pairs also support Python or JSON object literal subset notations, --without spaces. Dictionaries/objects {} are supported as are arrays []. -- -- example-command arg-name1={'key':'value','obj'={'prop':"value"}} -- --Both JSON and Python formatting should work, including both styles of --string literal quotes. Both paradigms of literal values should work, --including null/true/false for JSON and None/True/False for Python. -- -- --Transactions have the following multi-line format: -- -- transaction( -- action-name1 [ arg-name1=arg1 ] ... [arg-nameN=argN ] -- ... -- action-nameN [ arg-name1=arg1 ] ... [arg-nameN=argN ] -- ) -- --One line transactions are also supported: -- -- transaction( action-name1 ... ) -- --For example: -- -- (QEMU) transaction( -- TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1 -- TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0 -- TRANS> ) -- {"return": {}} -- (QEMU) -- --Use the -v and -p options to activate the verbose and pretty-print options, --which will echo back the properly formatted JSON-compliant QMP that is being --sent to QEMU, which is useful for debugging and documentation generation. --""" -- --import argparse --import ast --import json --import logging --import os --import re --import readline --import sys --from typing import ( -- Iterator, -- List, -- NoReturn, -- Optional, -- Sequence, --) -- --from qemu.aqmp import ConnectError, QMPError, SocketAddrT --from qemu.aqmp.legacy import ( -- QEMUMonitorProtocol, -- QMPBadPortError, -- QMPMessage, -- QMPObject, --) -- -- --LOG = logging.getLogger(__name__) -- -- --class QMPCompleter: -- """ -- QMPCompleter provides a readline library tab-complete behavior. -- """ -- # NB: Python 3.9+ will probably allow us to subclass list[str] directly, -- # but pylint as of today does not know that List[str] is simply 'list'. -- def __init__(self) -> None: -- self._matches: List[str] = [] -- -- def append(self, value: str) -> None: -- """Append a new valid completion to the list of possibilities.""" -- return self._matches.append(value) -- -- def complete(self, text: str, state: int) -> Optional[str]: -- """readline.set_completer() callback implementation.""" -- for cmd in self._matches: -- if cmd.startswith(text): -- if state == 0: -- return cmd -- state -= 1 -- return None -- -- --class QMPShellError(QMPError): -- """ -- QMP Shell Base error class. -- """ -- -- --class FuzzyJSON(ast.NodeTransformer): -- """ -- This extension of ast.NodeTransformer filters literal "true/false/null" -- values in a Python AST and replaces them by proper "True/False/None" values -- that Python can properly evaluate. -- """ -- -- @classmethod -- def visit_Name(cls, # pylint: disable=invalid-name -- node: ast.Name) -> ast.AST: -- """ -- Transform Name nodes with certain values into Constant (keyword) nodes. -- """ -- if node.id == 'true': -- return ast.Constant(value=True) -- if node.id == 'false': -- return ast.Constant(value=False) -- if node.id == 'null': -- return ast.Constant(value=None) -- return node -- -- --class QMPShell(QEMUMonitorProtocol): -- """ -- QMPShell provides a basic readline-based QMP shell. -- -- :param address: Address of the QMP server. -- :param pretty: Pretty-print QMP messages. -- :param verbose: Echo outgoing QMP messages to console. -- """ -- def __init__(self, address: SocketAddrT, -- pretty: bool = False, verbose: bool = False): -- super().__init__(address) -- self._greeting: Optional[QMPMessage] = None -- self._completer = QMPCompleter() -- self._transmode = False -- self._actions: List[QMPMessage] = [] -- self._histfile = os.path.join(os.path.expanduser('~'), -- '.qmp-shell_history') -- self.pretty = pretty -- self.verbose = verbose -- -- def close(self) -> None: -- # Hook into context manager of parent to save shell history. -- self._save_history() -- super().close() -- -- def _fill_completion(self) -> None: -- cmds = self.cmd('query-commands') -- if 'error' in cmds: -- return -- for cmd in cmds['return']: -- self._completer.append(cmd['name']) -- -- def _completer_setup(self) -> None: -- self._completer = QMPCompleter() -- self._fill_completion() -- readline.set_history_length(1024) -- readline.set_completer(self._completer.complete) -- readline.parse_and_bind("tab: complete") -- # NB: default delimiters conflict with some command names -- # (eg. query-), clearing everything as it doesn't seem to matter -- readline.set_completer_delims('') -- try: -- readline.read_history_file(self._histfile) -- except FileNotFoundError: -- pass -- except IOError as err: -- msg = f"Failed to read history '{self._histfile}': {err!s}" -- LOG.warning(msg) -- -- def _save_history(self) -> None: -- try: -- readline.write_history_file(self._histfile) -- except IOError as err: -- msg = f"Failed to save history file '{self._histfile}': {err!s}" -- LOG.warning(msg) -- -- @classmethod -- def _parse_value(cls, val: str) -> object: -- try: -- return int(val) -- except ValueError: -- pass -- -- if val.lower() == 'true': -- return True -- if val.lower() == 'false': -- return False -- if val.startswith(('{', '[')): -- # Try first as pure JSON: -- try: -- return json.loads(val) -- except ValueError: -- pass -- # Try once again as FuzzyJSON: -- try: -- tree = ast.parse(val, mode='eval') -- transformed = FuzzyJSON().visit(tree) -- return ast.literal_eval(transformed) -- except (SyntaxError, ValueError): -- pass -- return val -- -- def _cli_expr(self, -- tokens: Sequence[str], -- parent: QMPObject) -> None: -- for arg in tokens: -- (key, sep, val) = arg.partition('=') -- if sep != '=': -- raise QMPShellError( -- f"Expected a key=value pair, got '{arg!s}'" -- ) -- -- value = self._parse_value(val) -- optpath = key.split('.') -- curpath = [] -- for path in optpath[:-1]: -- curpath.append(path) -- obj = parent.get(path, {}) -- if not isinstance(obj, dict): -- msg = 'Cannot use "{:s}" as both leaf and non-leaf key' -- raise QMPShellError(msg.format('.'.join(curpath))) -- parent[path] = obj -- parent = obj -- if optpath[-1] in parent: -- if isinstance(parent[optpath[-1]], dict): -- msg = 'Cannot use "{:s}" as both leaf and non-leaf key' -- raise QMPShellError(msg.format('.'.join(curpath))) -- raise QMPShellError(f'Cannot set "{key}" multiple times') -- parent[optpath[-1]] = value -- -- def _build_cmd(self, cmdline: str) -> Optional[QMPMessage]: -- """ -- Build a QMP input object from a user provided command-line in the -- following format: -- -- < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ] -- """ -- argument_regex = r'''(?:[^\s"']|"(?:\\.|[^"])*"|'(?:\\.|[^'])*')+''' -- cmdargs = re.findall(argument_regex, cmdline) -- qmpcmd: QMPMessage -- -- # Transactional CLI entry: -- if cmdargs and cmdargs[0] == 'transaction(': -- self._transmode = True -- self._actions = [] -- cmdargs.pop(0) -- -- # Transactional CLI exit: -- if cmdargs and cmdargs[0] == ')' and self._transmode: -- self._transmode = False -- if len(cmdargs) > 1: -- msg = 'Unexpected input after close of Transaction sub-shell' -- raise QMPShellError(msg) -- qmpcmd = { -- 'execute': 'transaction', -- 'arguments': {'actions': self._actions} -- } -- return qmpcmd -- -- # No args, or no args remaining -- if not cmdargs: -- return None -- -- if self._transmode: -- # Parse and cache this Transactional Action -- finalize = False -- action = {'type': cmdargs[0], 'data': {}} -- if cmdargs[-1] == ')': -- cmdargs.pop(-1) -- finalize = True -- self._cli_expr(cmdargs[1:], action['data']) -- self._actions.append(action) -- return self._build_cmd(')') if finalize else None -- -- # Standard command: parse and return it to be executed. -- qmpcmd = {'execute': cmdargs[0], 'arguments': {}} -- self._cli_expr(cmdargs[1:], qmpcmd['arguments']) -- return qmpcmd -- -- def _print(self, qmp_message: object) -> None: -- jsobj = json.dumps(qmp_message, -- indent=4 if self.pretty else None, -- sort_keys=self.pretty) -- print(str(jsobj)) -- -- def _execute_cmd(self, cmdline: str) -> bool: -- try: -- qmpcmd = self._build_cmd(cmdline) -- except QMPShellError as err: -- print( -- f"Error while parsing command line: {err!s}\n" -- "command format: " -- "[arg-name1=arg1] ... [arg-nameN=argN", -- file=sys.stderr -- ) -- return True -- # For transaction mode, we may have just cached the action: -- if qmpcmd is None: -- return True -- if self.verbose: -- self._print(qmpcmd) -- resp = self.cmd_obj(qmpcmd) -- if resp is None: -- print('Disconnected') -- return False -- self._print(resp) -- return True -- -- def connect(self, negotiate: bool = True) -> None: -- self._greeting = super().connect(negotiate) -- self._completer_setup() -- -- def show_banner(self, -- msg: str = 'Welcome to the QMP low-level shell!') -> None: -- """ -- Print to stdio a greeting, and the QEMU version if available. -- """ -- print(msg) -- if not self._greeting: -- print('Connected') -- return -- version = self._greeting['QMP']['version']['qemu'] -- print("Connected to QEMU {major}.{minor}.{micro}\n".format(**version)) -- -- @property -- def prompt(self) -> str: -- """ -- Return the current shell prompt, including a trailing space. -- """ -- if self._transmode: -- return 'TRANS> ' -- return '(QEMU) ' -- -- def read_exec_command(self) -> bool: -- """ -- Read and execute a command. -- -- @return True if execution was ok, return False if disconnected. -- """ -- try: -- cmdline = input(self.prompt) -- except EOFError: -- print() -- return False -- -- if cmdline == '': -- for event in self.get_events(): -- print(event) -- return True -- -- return self._execute_cmd(cmdline) -- -- def repl(self) -> Iterator[None]: -- """ -- Return an iterator that implements the REPL. -- """ -- self.show_banner() -- while self.read_exec_command(): -- yield -- self.close() -- -- --class HMPShell(QMPShell): -- """ -- HMPShell provides a basic readline-based HMP shell, tunnelled via QMP. -- -- :param address: Address of the QMP server. -- :param pretty: Pretty-print QMP messages. -- :param verbose: Echo outgoing QMP messages to console. -- """ -- def __init__(self, address: SocketAddrT, -- pretty: bool = False, verbose: bool = False): -- super().__init__(address, pretty, verbose) -- self._cpu_index = 0 -- -- def _cmd_completion(self) -> None: -- for cmd in self._cmd_passthrough('help')['return'].split('\r\n'): -- if cmd and cmd[0] != '[' and cmd[0] != '\t': -- name = cmd.split()[0] # drop help text -- if name == 'info': -- continue -- if name.find('|') != -1: -- # Command in the form 'foobar|f' or 'f|foobar', take the -- # full name -- opt = name.split('|') -- if len(opt[0]) == 1: -- name = opt[1] -- else: -- name = opt[0] -- self._completer.append(name) -- self._completer.append('help ' + name) # help completion -- -- def _info_completion(self) -> None: -- for cmd in self._cmd_passthrough('info')['return'].split('\r\n'): -- if cmd: -- self._completer.append('info ' + cmd.split()[1]) -- -- def _other_completion(self) -> None: -- # special cases -- self._completer.append('help info') -- -- def _fill_completion(self) -> None: -- self._cmd_completion() -- self._info_completion() -- self._other_completion() -- -- def _cmd_passthrough(self, cmdline: str, -- cpu_index: int = 0) -> QMPMessage: -- return self.cmd_obj({ -- 'execute': 'human-monitor-command', -- 'arguments': { -- 'command-line': cmdline, -- 'cpu-index': cpu_index -- } -- }) -- -- def _execute_cmd(self, cmdline: str) -> bool: -- if cmdline.split()[0] == "cpu": -- # trap the cpu command, it requires special setting -- try: -- idx = int(cmdline.split()[1]) -- if 'return' not in self._cmd_passthrough('info version', idx): -- print('bad CPU index') -- return True -- self._cpu_index = idx -- except ValueError: -- print('cpu command takes an integer argument') -- return True -- resp = self._cmd_passthrough(cmdline, self._cpu_index) -- if resp is None: -- print('Disconnected') -- return False -- assert 'return' in resp or 'error' in resp -- if 'return' in resp: -- # Success -- if len(resp['return']) > 0: -- print(resp['return'], end=' ') -- else: -- # Error -- print('%s: %s' % (resp['error']['class'], resp['error']['desc'])) -- return True -- -- def show_banner(self, msg: str = 'Welcome to the HMP shell!') -> None: -- QMPShell.show_banner(self, msg) -- -- --def die(msg: str) -> NoReturn: -- """Write an error to stderr, then exit with a return code of 1.""" -- sys.stderr.write('ERROR: %s\n' % msg) -- sys.exit(1) -- -- --def main() -> None: -- """ -- qmp-shell entry point: parse command line arguments and start the REPL. -- """ -- parser = argparse.ArgumentParser() -- parser.add_argument('-H', '--hmp', action='store_true', -- help='Use HMP interface') -- parser.add_argument('-N', '--skip-negotiation', action='store_true', -- help='Skip negotiate (for qemu-ga)') -- parser.add_argument('-v', '--verbose', action='store_true', -- help='Verbose (echo commands sent and received)') -- parser.add_argument('-p', '--pretty', action='store_true', -- help='Pretty-print JSON') -- -- default_server = os.environ.get('QMP_SOCKET') -- parser.add_argument('qmp_server', action='store', -- default=default_server, -- help='< UNIX socket path | TCP address:port >') -- -- args = parser.parse_args() -- if args.qmp_server is None: -- parser.error("QMP socket or TCP address must be specified") -- -- shell_class = HMPShell if args.hmp else QMPShell -- -- try: -- address = shell_class.parse_address(args.qmp_server) -- except QMPBadPortError: -- parser.error(f"Bad port number: {args.qmp_server}") -- return # pycharm doesn't know error() is noreturn -- -- with shell_class(address, args.pretty, args.verbose) as qemu: -- try: -- qemu.connect(negotiate=not args.skip_negotiation) -- except ConnectError as err: -- if isinstance(err.exc, OSError): -- die(f"Couldn't connect to {args.qmp_server}: {err!s}") -- die(str(err)) -- -- for _ in qemu.repl(): -- pass -- -- --if __name__ == '__main__': -- main() -diff --git a/python/setup.cfg b/python/setup.cfg -index 91ccef7e8fd85d0d6d3d86adbc8d..0063c757b78638ef651a362af338 100644 ---- a/python/setup.cfg -+++ b/python/setup.cfg -@@ -67,7 +67,7 @@ console_scripts = - qom-tree = qemu.utils.qom:QOMTree.entry_point - qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] - qemu-ga-client = qemu.utils.qemu_ga_client:main -- qmp-shell = qemu.qmp.qmp_shell:main -+ qmp-shell = qemu.aqmp.qmp_shell:main - aqmp-tui = qemu.aqmp.aqmp_tui:main [tui] - - [flake8] -diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell -index 4a20f97db708b74ebfed715e38ea..31b19d73e22a4d9c91aaf0ce9725 100755 ---- a/scripts/qmp/qmp-shell -+++ b/scripts/qmp/qmp-shell -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp import qmp_shell -+from qemu.aqmp import qmp_shell - - - if __name__ == '__main__': diff --git a/python-move-qmp-utilities-to-python-qemu.patch b/python-move-qmp-utilities-to-python-qemu.patch deleted file mode 100644 index e8f33517..00000000 --- a/python-move-qmp-utilities-to-python-qemu.patch +++ /dev/null @@ -1,2153 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:54 -0500 -Subject: python: move qmp utilities to python/qemu/utils - -Git-commit: 0347c4c4cfed47e54d9dc275ceb28d35b250749f - -In order to upload a QMP package to PyPI, I want to remove any scripts -that I am not 100% confident I want to support upstream, beyond our -castle walls. - -Move most of our QMP utilities into the utils package so we can split -them out from the PyPI upload. - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Beraldo Leal -Signed-off-by: Li Zhang ---- - python/qemu/qmp/qemu_ga_client.py | 323 ---------------------------- - python/qemu/qmp/qom.py | 272 ----------------------- - python/qemu/qmp/qom_common.py | 178 --------------- - python/qemu/qmp/qom_fuse.py | 206 ------------------ - python/qemu/utils/qemu_ga_client.py | 323 ++++++++++++++++++++++++++++ - python/qemu/utils/qom.py | 272 +++++++++++++++++++++++ - python/qemu/utils/qom_common.py | 178 +++++++++++++++ - python/qemu/utils/qom_fuse.py | 206 ++++++++++++++++++ - python/setup.cfg | 16 +- - scripts/qmp/qemu-ga-client | 2 +- - scripts/qmp/qom-fuse | 2 +- - scripts/qmp/qom-get | 2 +- - scripts/qmp/qom-list | 2 +- - scripts/qmp/qom-set | 2 +- - scripts/qmp/qom-tree | 2 +- - 15 files changed, 993 insertions(+), 993 deletions(-) - -diff --git a/python/qemu/qmp/qemu_ga_client.py b/python/qemu/qmp/qemu_ga_client.py -deleted file mode 100644 -index 67ac0b421129dd03e973886ac4ac1e1e3de3d358..0000000000000000000000000000000000000000 ---- a/python/qemu/qmp/qemu_ga_client.py -+++ /dev/null -@@ -1,323 +0,0 @@ --""" --QEMU Guest Agent Client -- --Usage: -- --Start QEMU with: -- --# qemu [...] -chardev socket,path=/tmp/qga.sock,server,wait=off,id=qga0 \ -- -device virtio-serial \ -- -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -- --Run the script: -- --$ qemu-ga-client --address=/tmp/qga.sock [args...] -- --or -- --$ export QGA_CLIENT_ADDRESS=/tmp/qga.sock --$ qemu-ga-client [args...] -- --For example: -- --$ qemu-ga-client cat /etc/resolv.conf --# Generated by NetworkManager --nameserver 10.0.2.3 --$ qemu-ga-client fsfreeze status --thawed --$ qemu-ga-client fsfreeze freeze --2 filesystems frozen -- --See also: https://wiki.qemu.org/Features/QAPI/GuestAgent --""" -- --# Copyright (C) 2012 Ryota Ozaki --# --# This work is licensed under the terms of the GNU GPL, version 2. See --# the COPYING file in the top-level directory. -- --import argparse --import base64 --import errno --import os --import random --import sys --from typing import ( -- Any, -- Callable, -- Dict, -- Optional, -- Sequence, --) -- --from qemu import qmp --from qemu.qmp import SocketAddrT -- -- --# This script has not seen many patches or careful attention in quite --# some time. If you would like to improve it, please review the design --# carefully and add docstrings at that point in time. Until then: -- --# pylint: disable=missing-docstring -- -- --class QemuGuestAgent(qmp.QEMUMonitorProtocol): -- def __getattr__(self, name: str) -> Callable[..., Any]: -- def wrapper(**kwds: object) -> object: -- return self.command('guest-' + name.replace('_', '-'), **kwds) -- return wrapper -- -- --class QemuGuestAgentClient: -- def __init__(self, address: SocketAddrT): -- self.qga = QemuGuestAgent(address) -- self.qga.connect(negotiate=False) -- -- def sync(self, timeout: Optional[float] = 3) -> None: -- # Avoid being blocked forever -- if not self.ping(timeout): -- raise EnvironmentError('Agent seems not alive') -- uid = random.randint(0, (1 << 32) - 1) -- while True: -- ret = self.qga.sync(id=uid) -- if isinstance(ret, int) and int(ret) == uid: -- break -- -- def __file_read_all(self, handle: int) -> bytes: -- eof = False -- data = b'' -- while not eof: -- ret = self.qga.file_read(handle=handle, count=1024) -- _data = base64.b64decode(ret['buf-b64']) -- data += _data -- eof = ret['eof'] -- return data -- -- def read(self, path: str) -> bytes: -- handle = self.qga.file_open(path=path) -- try: -- data = self.__file_read_all(handle) -- finally: -- self.qga.file_close(handle=handle) -- return data -- -- def info(self) -> str: -- info = self.qga.info() -- -- msgs = [] -- msgs.append('version: ' + info['version']) -- msgs.append('supported_commands:') -- enabled = [c['name'] for c in info['supported_commands'] -- if c['enabled']] -- msgs.append('\tenabled: ' + ', '.join(enabled)) -- disabled = [c['name'] for c in info['supported_commands'] -- if not c['enabled']] -- msgs.append('\tdisabled: ' + ', '.join(disabled)) -- -- return '\n'.join(msgs) -- -- @classmethod -- def __gen_ipv4_netmask(cls, prefixlen: int) -> str: -- mask = int('1' * prefixlen + '0' * (32 - prefixlen), 2) -- return '.'.join([str(mask >> 24), -- str((mask >> 16) & 0xff), -- str((mask >> 8) & 0xff), -- str(mask & 0xff)]) -- -- def ifconfig(self) -> str: -- nifs = self.qga.network_get_interfaces() -- -- msgs = [] -- for nif in nifs: -- msgs.append(nif['name'] + ':') -- if 'ip-addresses' in nif: -- for ipaddr in nif['ip-addresses']: -- if ipaddr['ip-address-type'] == 'ipv4': -- addr = ipaddr['ip-address'] -- mask = self.__gen_ipv4_netmask(int(ipaddr['prefix'])) -- msgs.append(f"\tinet {addr} netmask {mask}") -- elif ipaddr['ip-address-type'] == 'ipv6': -- addr = ipaddr['ip-address'] -- prefix = ipaddr['prefix'] -- msgs.append(f"\tinet6 {addr} prefixlen {prefix}") -- if nif['hardware-address'] != '00:00:00:00:00:00': -- msgs.append("\tether " + nif['hardware-address']) -- -- return '\n'.join(msgs) -- -- def ping(self, timeout: Optional[float]) -> bool: -- self.qga.settimeout(timeout) -- try: -- self.qga.ping() -- except TimeoutError: -- return False -- return True -- -- def fsfreeze(self, cmd: str) -> object: -- if cmd not in ['status', 'freeze', 'thaw']: -- raise Exception('Invalid command: ' + cmd) -- # Can be int (freeze, thaw) or GuestFsfreezeStatus (status) -- return getattr(self.qga, 'fsfreeze' + '_' + cmd)() -- -- def fstrim(self, minimum: int) -> Dict[str, object]: -- # returns GuestFilesystemTrimResponse -- ret = getattr(self.qga, 'fstrim')(minimum=minimum) -- assert isinstance(ret, dict) -- return ret -- -- def suspend(self, mode: str) -> None: -- if mode not in ['disk', 'ram', 'hybrid']: -- raise Exception('Invalid mode: ' + mode) -- -- try: -- getattr(self.qga, 'suspend' + '_' + mode)() -- # On error exception will raise -- except TimeoutError: -- # On success command will timed out -- return -- -- def shutdown(self, mode: str = 'powerdown') -> None: -- if mode not in ['powerdown', 'halt', 'reboot']: -- raise Exception('Invalid mode: ' + mode) -- -- try: -- self.qga.shutdown(mode=mode) -- except TimeoutError: -- pass -- -- --def _cmd_cat(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- if len(args) != 1: -- print('Invalid argument') -- print('Usage: cat ') -- sys.exit(1) -- print(client.read(args[0])) -- -- --def _cmd_fsfreeze(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- usage = 'Usage: fsfreeze status|freeze|thaw' -- if len(args) != 1: -- print('Invalid argument') -- print(usage) -- sys.exit(1) -- if args[0] not in ['status', 'freeze', 'thaw']: -- print('Invalid command: ' + args[0]) -- print(usage) -- sys.exit(1) -- cmd = args[0] -- ret = client.fsfreeze(cmd) -- if cmd == 'status': -- print(ret) -- return -- -- assert isinstance(ret, int) -- verb = 'frozen' if cmd == 'freeze' else 'thawed' -- print(f"{ret:d} filesystems {verb}") -- -- --def _cmd_fstrim(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- if len(args) == 0: -- minimum = 0 -- else: -- minimum = int(args[0]) -- print(client.fstrim(minimum)) -- -- --def _cmd_ifconfig(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- assert not args -- print(client.ifconfig()) -- -- --def _cmd_info(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- assert not args -- print(client.info()) -- -- --def _cmd_ping(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- timeout = 3.0 if len(args) == 0 else float(args[0]) -- alive = client.ping(timeout) -- if not alive: -- print("Not responded in %s sec" % args[0]) -- sys.exit(1) -- -- --def _cmd_suspend(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- usage = 'Usage: suspend disk|ram|hybrid' -- if len(args) != 1: -- print('Less argument') -- print(usage) -- sys.exit(1) -- if args[0] not in ['disk', 'ram', 'hybrid']: -- print('Invalid command: ' + args[0]) -- print(usage) -- sys.exit(1) -- client.suspend(args[0]) -- -- --def _cmd_shutdown(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- assert not args -- client.shutdown() -- -- --_cmd_powerdown = _cmd_shutdown -- -- --def _cmd_halt(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- assert not args -- client.shutdown('halt') -- -- --def _cmd_reboot(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -- assert not args -- client.shutdown('reboot') -- -- --commands = [m.replace('_cmd_', '') for m in dir() if '_cmd_' in m] -- -- --def send_command(address: str, cmd: str, args: Sequence[str]) -> None: -- if not os.path.exists(address): -- print('%s not found' % address) -- sys.exit(1) -- -- if cmd not in commands: -- print('Invalid command: ' + cmd) -- print('Available commands: ' + ', '.join(commands)) -- sys.exit(1) -- -- try: -- client = QemuGuestAgentClient(address) -- except OSError as err: -- print(err) -- if err.errno == errno.ECONNREFUSED: -- print('Hint: qemu is not running?') -- sys.exit(1) -- -- if cmd == 'fsfreeze' and args[0] == 'freeze': -- client.sync(60) -- elif cmd != 'ping': -- client.sync() -- -- globals()['_cmd_' + cmd](client, args) -- -- --def main() -> None: -- address = os.environ.get('QGA_CLIENT_ADDRESS') -- -- parser = argparse.ArgumentParser() -- parser.add_argument('--address', action='store', -- default=address, -- help='Specify a ip:port pair or a unix socket path') -- parser.add_argument('command', choices=commands) -- parser.add_argument('args', nargs='*') -- -- args = parser.parse_args() -- if args.address is None: -- parser.error('address is not specified') -- sys.exit(1) -- -- send_command(args.address, args.command, args.args) -- -- --if __name__ == '__main__': -- main() -diff --git a/python/qemu/qmp/qom.py b/python/qemu/qmp/qom.py -deleted file mode 100644 -index 8ff28a83439767ce37db21d8790c50ddb4845f50..0000000000000000000000000000000000000000 ---- a/python/qemu/qmp/qom.py -+++ /dev/null -@@ -1,272 +0,0 @@ --""" --QEMU Object Model testing tools. -- --usage: qom [-h] {set,get,list,tree,fuse} ... -- --Query and manipulate QOM data -- --optional arguments: -- -h, --help show this help message and exit -- --QOM commands: -- {set,get,list,tree,fuse} -- set Set a QOM property value -- get Get a QOM property value -- list List QOM properties at a given path -- tree Show QOM tree from a given path -- fuse Mount a QOM tree as a FUSE filesystem --""" --## --# Copyright John Snow 2020, for Red Hat, Inc. --# Copyright IBM, Corp. 2011 --# --# Authors: --# John Snow --# Anthony Liguori --# --# This work is licensed under the terms of the GNU GPL, version 2 or later. --# See the COPYING file in the top-level directory. --# --# Based on ./scripts/qmp/qom-[set|get|tree|list] --## -- --import argparse -- --from . import QMPResponseError --from .qom_common import QOMCommand -- -- --try: -- from .qom_fuse import QOMFuse --except ModuleNotFoundError as _err: -- if _err.name != 'fuse': -- raise --else: -- assert issubclass(QOMFuse, QOMCommand) -- -- --class QOMSet(QOMCommand): -- """ -- QOM Command - Set a property to a given value. -- -- usage: qom-set [-h] [--socket SOCKET] . -- -- Set a QOM property value -- -- positional arguments: -- . QOM path and property, separated by a period '.' -- new QOM property value -- -- optional arguments: -- -h, --help show this help message and exit -- --socket SOCKET, -s SOCKET -- QMP socket path or address (addr:port). May also be -- set via QMP_SOCKET environment variable. -- """ -- name = 'set' -- help = 'Set a QOM property value' -- -- @classmethod -- def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -- super().configure_parser(parser) -- cls.add_path_prop_arg(parser) -- parser.add_argument( -- 'value', -- metavar='', -- action='store', -- help='new QOM property value' -- ) -- -- def __init__(self, args: argparse.Namespace): -- super().__init__(args) -- self.path, self.prop = args.path_prop.rsplit('.', 1) -- self.value = args.value -- -- def run(self) -> int: -- rsp = self.qmp.command( -- 'qom-set', -- path=self.path, -- property=self.prop, -- value=self.value -- ) -- print(rsp) -- return 0 -- -- --class QOMGet(QOMCommand): -- """ -- QOM Command - Get a property's current value. -- -- usage: qom-get [-h] [--socket SOCKET] . -- -- Get a QOM property value -- -- positional arguments: -- . QOM path and property, separated by a period '.' -- -- optional arguments: -- -h, --help show this help message and exit -- --socket SOCKET, -s SOCKET -- QMP socket path or address (addr:port). May also be -- set via QMP_SOCKET environment variable. -- """ -- name = 'get' -- help = 'Get a QOM property value' -- -- @classmethod -- def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -- super().configure_parser(parser) -- cls.add_path_prop_arg(parser) -- -- def __init__(self, args: argparse.Namespace): -- super().__init__(args) -- try: -- tmp = args.path_prop.rsplit('.', 1) -- except ValueError as err: -- raise ValueError('Invalid format for .') from err -- self.path = tmp[0] -- self.prop = tmp[1] -- -- def run(self) -> int: -- rsp = self.qmp.command( -- 'qom-get', -- path=self.path, -- property=self.prop -- ) -- if isinstance(rsp, dict): -- for key, value in rsp.items(): -- print(f"{key}: {value}") -- else: -- print(rsp) -- return 0 -- -- --class QOMList(QOMCommand): -- """ -- QOM Command - List the properties at a given path. -- -- usage: qom-list [-h] [--socket SOCKET] -- -- List QOM properties at a given path -- -- positional arguments: -- QOM path -- -- optional arguments: -- -h, --help show this help message and exit -- --socket SOCKET, -s SOCKET -- QMP socket path or address (addr:port). May also be -- set via QMP_SOCKET environment variable. -- """ -- name = 'list' -- help = 'List QOM properties at a given path' -- -- @classmethod -- def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -- super().configure_parser(parser) -- parser.add_argument( -- 'path', -- metavar='', -- action='store', -- help='QOM path', -- ) -- -- def __init__(self, args: argparse.Namespace): -- super().__init__(args) -- self.path = args.path -- -- def run(self) -> int: -- rsp = self.qom_list(self.path) -- for item in rsp: -- if item.child: -- print(f"{item.name}/") -- elif item.link: -- print(f"@{item.name}/") -- else: -- print(item.name) -- return 0 -- -- --class QOMTree(QOMCommand): -- """ -- QOM Command - Show the full tree below a given path. -- -- usage: qom-tree [-h] [--socket SOCKET] [] -- -- Show QOM tree from a given path -- -- positional arguments: -- QOM path -- -- optional arguments: -- -h, --help show this help message and exit -- --socket SOCKET, -s SOCKET -- QMP socket path or address (addr:port). May also be -- set via QMP_SOCKET environment variable. -- """ -- name = 'tree' -- help = 'Show QOM tree from a given path' -- -- @classmethod -- def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -- super().configure_parser(parser) -- parser.add_argument( -- 'path', -- metavar='', -- action='store', -- help='QOM path', -- nargs='?', -- default='/' -- ) -- -- def __init__(self, args: argparse.Namespace): -- super().__init__(args) -- self.path = args.path -- -- def _list_node(self, path: str) -> None: -- print(path) -- items = self.qom_list(path) -- for item in items: -- if item.child: -- continue -- try: -- rsp = self.qmp.command('qom-get', path=path, -- property=item.name) -- print(f" {item.name}: {rsp} ({item.type})") -- except QMPResponseError as err: -- print(f" {item.name}: ({item.type})") -- print('') -- for item in items: -- if not item.child: -- continue -- if path == '/': -- path = '' -- self._list_node(f"{path}/{item.name}") -- -- def run(self) -> int: -- self._list_node(self.path) -- return 0 -- -- --def main() -> int: -- """QOM script main entry point.""" -- parser = argparse.ArgumentParser( -- description='Query and manipulate QOM data' -- ) -- subparsers = parser.add_subparsers( -- title='QOM commands', -- dest='command' -- ) -- -- for command in QOMCommand.__subclasses__(): -- command.register(subparsers) -- -- args = parser.parse_args() -- -- if args.command is None: -- parser.error('Command not specified.') -- return 1 -- -- cmd_class = args.cmd_class -- assert isinstance(cmd_class, type(QOMCommand)) -- return cmd_class.command_runner(args) -diff --git a/python/qemu/qmp/qom_common.py b/python/qemu/qmp/qom_common.py -deleted file mode 100644 -index a59ae1a2a1883cb4d89b0e44507c5001f44357a0..0000000000000000000000000000000000000000 ---- a/python/qemu/qmp/qom_common.py -+++ /dev/null -@@ -1,178 +0,0 @@ --""" --QOM Command abstractions. --""" --## --# Copyright John Snow 2020, for Red Hat, Inc. --# Copyright IBM, Corp. 2011 --# --# Authors: --# John Snow --# Anthony Liguori --# --# This work is licensed under the terms of the GNU GPL, version 2 or later. --# See the COPYING file in the top-level directory. --# --# Based on ./scripts/qmp/qom-[set|get|tree|list] --## -- --import argparse --import os --import sys --from typing import ( -- Any, -- Dict, -- List, -- Optional, -- Type, -- TypeVar, --) -- --from . import QEMUMonitorProtocol, QMPError -- -- --# The following is needed only for a type alias. --Subparsers = argparse._SubParsersAction # pylint: disable=protected-access -- -- --class ObjectPropertyInfo: -- """ -- Represents the return type from e.g. qom-list. -- """ -- def __init__(self, name: str, type_: str, -- description: Optional[str] = None, -- default_value: Optional[object] = None): -- self.name = name -- self.type = type_ -- self.description = description -- self.default_value = default_value -- -- @classmethod -- def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyInfo': -- """ -- Build an ObjectPropertyInfo from a Dict with an unknown shape. -- """ -- assert value.keys() >= {'name', 'type'} -- assert value.keys() <= {'name', 'type', 'description', 'default-value'} -- return cls(value['name'], value['type'], -- value.get('description'), -- value.get('default-value')) -- -- @property -- def child(self) -> bool: -- """Is this property a child property?""" -- return self.type.startswith('child<') -- -- @property -- def link(self) -> bool: -- """Is this property a link property?""" -- return self.type.startswith('link<') -- -- --CommandT = TypeVar('CommandT', bound='QOMCommand') -- -- --class QOMCommand: -- """ -- Represents a QOM sub-command. -- -- :param args: Parsed arguments, as returned from parser.parse_args. -- """ -- name: str -- help: str -- -- def __init__(self, args: argparse.Namespace): -- if args.socket is None: -- raise QMPError("No QMP socket path or address given") -- self.qmp = QEMUMonitorProtocol( -- QEMUMonitorProtocol.parse_address(args.socket) -- ) -- self.qmp.connect() -- -- @classmethod -- def register(cls, subparsers: Subparsers) -> None: -- """ -- Register this command with the argument parser. -- -- :param subparsers: argparse subparsers object, from "add_subparsers". -- """ -- subparser = subparsers.add_parser(cls.name, help=cls.help, -- description=cls.help) -- cls.configure_parser(subparser) -- -- @classmethod -- def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -- """ -- Configure a parser with this command's arguments. -- -- :param parser: argparse parser or subparser object. -- """ -- default_path = os.environ.get('QMP_SOCKET') -- parser.add_argument( -- '--socket', '-s', -- dest='socket', -- action='store', -- help='QMP socket path or address (addr:port).' -- ' May also be set via QMP_SOCKET environment variable.', -- default=default_path -- ) -- parser.set_defaults(cmd_class=cls) -- -- @classmethod -- def add_path_prop_arg(cls, parser: argparse.ArgumentParser) -> None: -- """ -- Add the . positional argument to this command. -- -- :param parser: The parser to add the argument to. -- """ -- parser.add_argument( -- 'path_prop', -- metavar='.', -- action='store', -- help="QOM path and property, separated by a period '.'" -- ) -- -- def run(self) -> int: -- """ -- Run this command. -- -- :return: 0 on success, 1 otherwise. -- """ -- raise NotImplementedError -- -- def qom_list(self, path: str) -> List[ObjectPropertyInfo]: -- """ -- :return: a strongly typed list from the 'qom-list' command. -- """ -- rsp = self.qmp.command('qom-list', path=path) -- # qom-list returns List[ObjectPropertyInfo] -- assert isinstance(rsp, list) -- return [ObjectPropertyInfo.make(x) for x in rsp] -- -- @classmethod -- def command_runner( -- cls: Type[CommandT], -- args: argparse.Namespace -- ) -> int: -- """ -- Run a fully-parsed subcommand, with error-handling for the CLI. -- -- :return: The return code from `run()`. -- """ -- try: -- cmd = cls(args) -- return cmd.run() -- except QMPError as err: -- print(f"{type(err).__name__}: {err!s}", file=sys.stderr) -- return -1 -- -- @classmethod -- def entry_point(cls) -> int: -- """ -- Build this command's parser, parse arguments, and run the command. -- -- :return: `run`'s return code. -- """ -- parser = argparse.ArgumentParser(description=cls.help) -- cls.configure_parser(parser) -- args = parser.parse_args() -- return cls.command_runner(args) -diff --git a/python/qemu/qmp/qom_fuse.py b/python/qemu/qmp/qom_fuse.py -deleted file mode 100644 -index 43f4671fdb18c6aa1b11df9694855167fced8f10..0000000000000000000000000000000000000000 ---- a/python/qemu/qmp/qom_fuse.py -+++ /dev/null -@@ -1,206 +0,0 @@ --""" --QEMU Object Model FUSE filesystem tool -- --This script offers a simple FUSE filesystem within which the QOM tree --may be browsed, queried and edited using traditional shell tooling. -- --This script requires the 'fusepy' python package. -- -- --usage: qom-fuse [-h] [--socket SOCKET] -- --Mount a QOM tree as a FUSE filesystem -- --positional arguments: -- Mount point -- --optional arguments: -- -h, --help show this help message and exit -- --socket SOCKET, -s SOCKET -- QMP socket path or address (addr:port). May also be -- set via QMP_SOCKET environment variable. --""" --## --# Copyright IBM, Corp. 2012 --# Copyright (C) 2020 Red Hat, Inc. --# --# Authors: --# Anthony Liguori --# Markus Armbruster --# --# This work is licensed under the terms of the GNU GPL, version 2 or later. --# See the COPYING file in the top-level directory. --## -- --import argparse --from errno import ENOENT, EPERM --import stat --import sys --from typing import ( -- IO, -- Dict, -- Iterator, -- Mapping, -- Optional, -- Union, --) -- --import fuse --from fuse import FUSE, FuseOSError, Operations -- --from . import QMPResponseError --from .qom_common import QOMCommand -- -- --fuse.fuse_python_api = (0, 2) -- -- --class QOMFuse(QOMCommand, Operations): -- """ -- QOMFuse implements both fuse.Operations and QOMCommand. -- -- Operations implements the FS, and QOMCommand implements the CLI command. -- """ -- name = 'fuse' -- help = 'Mount a QOM tree as a FUSE filesystem' -- fuse: FUSE -- -- @classmethod -- def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -- super().configure_parser(parser) -- parser.add_argument( -- 'mount', -- metavar='', -- action='store', -- help="Mount point", -- ) -- -- def __init__(self, args: argparse.Namespace): -- super().__init__(args) -- self.mount = args.mount -- self.ino_map: Dict[str, int] = {} -- self.ino_count = 1 -- -- def run(self) -> int: -- print(f"Mounting QOMFS to '{self.mount}'", file=sys.stderr) -- self.fuse = FUSE(self, self.mount, foreground=True) -- return 0 -- -- def get_ino(self, path: str) -> int: -- """Get an inode number for a given QOM path.""" -- if path in self.ino_map: -- return self.ino_map[path] -- self.ino_map[path] = self.ino_count -- self.ino_count += 1 -- return self.ino_map[path] -- -- def is_object(self, path: str) -> bool: -- """Is the given QOM path an object?""" -- try: -- self.qom_list(path) -- return True -- except QMPResponseError: -- return False -- -- def is_property(self, path: str) -> bool: -- """Is the given QOM path a property?""" -- path, prop = path.rsplit('/', 1) -- if path == '': -- path = '/' -- try: -- for item in self.qom_list(path): -- if item.name == prop: -- return True -- return False -- except QMPResponseError: -- return False -- -- def is_link(self, path: str) -> bool: -- """Is the given QOM path a link?""" -- path, prop = path.rsplit('/', 1) -- if path == '': -- path = '/' -- try: -- for item in self.qom_list(path): -- if item.name == prop and item.link: -- return True -- return False -- except QMPResponseError: -- return False -- -- def read(self, path: str, size: int, offset: int, fh: IO[bytes]) -> bytes: -- if not self.is_property(path): -- raise FuseOSError(ENOENT) -- -- path, prop = path.rsplit('/', 1) -- if path == '': -- path = '/' -- try: -- data = str(self.qmp.command('qom-get', path=path, property=prop)) -- data += '\n' # make values shell friendly -- except QMPResponseError as err: -- raise FuseOSError(EPERM) from err -- -- if offset > len(data): -- return b'' -- -- return bytes(data[offset:][:size], encoding='utf-8') -- -- def readlink(self, path: str) -> Union[bool, str]: -- if not self.is_link(path): -- return False -- path, prop = path.rsplit('/', 1) -- prefix = '/'.join(['..'] * (len(path.split('/')) - 1)) -- return prefix + str(self.qmp.command('qom-get', path=path, -- property=prop)) -- -- def getattr(self, path: str, -- fh: Optional[IO[bytes]] = None) -> Mapping[str, object]: -- if self.is_link(path): -- value = { -- 'st_mode': 0o755 | stat.S_IFLNK, -- 'st_ino': self.get_ino(path), -- 'st_dev': 0, -- 'st_nlink': 2, -- 'st_uid': 1000, -- 'st_gid': 1000, -- 'st_size': 4096, -- 'st_atime': 0, -- 'st_mtime': 0, -- 'st_ctime': 0 -- } -- elif self.is_object(path): -- value = { -- 'st_mode': 0o755 | stat.S_IFDIR, -- 'st_ino': self.get_ino(path), -- 'st_dev': 0, -- 'st_nlink': 2, -- 'st_uid': 1000, -- 'st_gid': 1000, -- 'st_size': 4096, -- 'st_atime': 0, -- 'st_mtime': 0, -- 'st_ctime': 0 -- } -- elif self.is_property(path): -- value = { -- 'st_mode': 0o644 | stat.S_IFREG, -- 'st_ino': self.get_ino(path), -- 'st_dev': 0, -- 'st_nlink': 1, -- 'st_uid': 1000, -- 'st_gid': 1000, -- 'st_size': 4096, -- 'st_atime': 0, -- 'st_mtime': 0, -- 'st_ctime': 0 -- } -- else: -- raise FuseOSError(ENOENT) -- return value -- -- def readdir(self, path: str, fh: IO[bytes]) -> Iterator[str]: -- yield '.' -- yield '..' -- for item in self.qom_list(path): -- yield item.name -diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_ga_client.py -new file mode 100644 -index 0000000000000000000000000000000000000000..67ac0b421129dd03e973886ac4ac1e1e3de3d358 ---- /dev/null -+++ b/python/qemu/utils/qemu_ga_client.py -@@ -0,0 +1,323 @@ -+""" -+QEMU Guest Agent Client -+ -+Usage: -+ -+Start QEMU with: -+ -+# qemu [...] -chardev socket,path=/tmp/qga.sock,server,wait=off,id=qga0 \ -+ -device virtio-serial \ -+ -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -+ -+Run the script: -+ -+$ qemu-ga-client --address=/tmp/qga.sock [args...] -+ -+or -+ -+$ export QGA_CLIENT_ADDRESS=/tmp/qga.sock -+$ qemu-ga-client [args...] -+ -+For example: -+ -+$ qemu-ga-client cat /etc/resolv.conf -+# Generated by NetworkManager -+nameserver 10.0.2.3 -+$ qemu-ga-client fsfreeze status -+thawed -+$ qemu-ga-client fsfreeze freeze -+2 filesystems frozen -+ -+See also: https://wiki.qemu.org/Features/QAPI/GuestAgent -+""" -+ -+# Copyright (C) 2012 Ryota Ozaki -+# -+# This work is licensed under the terms of the GNU GPL, version 2. See -+# the COPYING file in the top-level directory. -+ -+import argparse -+import base64 -+import errno -+import os -+import random -+import sys -+from typing import ( -+ Any, -+ Callable, -+ Dict, -+ Optional, -+ Sequence, -+) -+ -+from qemu import qmp -+from qemu.qmp import SocketAddrT -+ -+ -+# This script has not seen many patches or careful attention in quite -+# some time. If you would like to improve it, please review the design -+# carefully and add docstrings at that point in time. Until then: -+ -+# pylint: disable=missing-docstring -+ -+ -+class QemuGuestAgent(qmp.QEMUMonitorProtocol): -+ def __getattr__(self, name: str) -> Callable[..., Any]: -+ def wrapper(**kwds: object) -> object: -+ return self.command('guest-' + name.replace('_', '-'), **kwds) -+ return wrapper -+ -+ -+class QemuGuestAgentClient: -+ def __init__(self, address: SocketAddrT): -+ self.qga = QemuGuestAgent(address) -+ self.qga.connect(negotiate=False) -+ -+ def sync(self, timeout: Optional[float] = 3) -> None: -+ # Avoid being blocked forever -+ if not self.ping(timeout): -+ raise EnvironmentError('Agent seems not alive') -+ uid = random.randint(0, (1 << 32) - 1) -+ while True: -+ ret = self.qga.sync(id=uid) -+ if isinstance(ret, int) and int(ret) == uid: -+ break -+ -+ def __file_read_all(self, handle: int) -> bytes: -+ eof = False -+ data = b'' -+ while not eof: -+ ret = self.qga.file_read(handle=handle, count=1024) -+ _data = base64.b64decode(ret['buf-b64']) -+ data += _data -+ eof = ret['eof'] -+ return data -+ -+ def read(self, path: str) -> bytes: -+ handle = self.qga.file_open(path=path) -+ try: -+ data = self.__file_read_all(handle) -+ finally: -+ self.qga.file_close(handle=handle) -+ return data -+ -+ def info(self) -> str: -+ info = self.qga.info() -+ -+ msgs = [] -+ msgs.append('version: ' + info['version']) -+ msgs.append('supported_commands:') -+ enabled = [c['name'] for c in info['supported_commands'] -+ if c['enabled']] -+ msgs.append('\tenabled: ' + ', '.join(enabled)) -+ disabled = [c['name'] for c in info['supported_commands'] -+ if not c['enabled']] -+ msgs.append('\tdisabled: ' + ', '.join(disabled)) -+ -+ return '\n'.join(msgs) -+ -+ @classmethod -+ def __gen_ipv4_netmask(cls, prefixlen: int) -> str: -+ mask = int('1' * prefixlen + '0' * (32 - prefixlen), 2) -+ return '.'.join([str(mask >> 24), -+ str((mask >> 16) & 0xff), -+ str((mask >> 8) & 0xff), -+ str(mask & 0xff)]) -+ -+ def ifconfig(self) -> str: -+ nifs = self.qga.network_get_interfaces() -+ -+ msgs = [] -+ for nif in nifs: -+ msgs.append(nif['name'] + ':') -+ if 'ip-addresses' in nif: -+ for ipaddr in nif['ip-addresses']: -+ if ipaddr['ip-address-type'] == 'ipv4': -+ addr = ipaddr['ip-address'] -+ mask = self.__gen_ipv4_netmask(int(ipaddr['prefix'])) -+ msgs.append(f"\tinet {addr} netmask {mask}") -+ elif ipaddr['ip-address-type'] == 'ipv6': -+ addr = ipaddr['ip-address'] -+ prefix = ipaddr['prefix'] -+ msgs.append(f"\tinet6 {addr} prefixlen {prefix}") -+ if nif['hardware-address'] != '00:00:00:00:00:00': -+ msgs.append("\tether " + nif['hardware-address']) -+ -+ return '\n'.join(msgs) -+ -+ def ping(self, timeout: Optional[float]) -> bool: -+ self.qga.settimeout(timeout) -+ try: -+ self.qga.ping() -+ except TimeoutError: -+ return False -+ return True -+ -+ def fsfreeze(self, cmd: str) -> object: -+ if cmd not in ['status', 'freeze', 'thaw']: -+ raise Exception('Invalid command: ' + cmd) -+ # Can be int (freeze, thaw) or GuestFsfreezeStatus (status) -+ return getattr(self.qga, 'fsfreeze' + '_' + cmd)() -+ -+ def fstrim(self, minimum: int) -> Dict[str, object]: -+ # returns GuestFilesystemTrimResponse -+ ret = getattr(self.qga, 'fstrim')(minimum=minimum) -+ assert isinstance(ret, dict) -+ return ret -+ -+ def suspend(self, mode: str) -> None: -+ if mode not in ['disk', 'ram', 'hybrid']: -+ raise Exception('Invalid mode: ' + mode) -+ -+ try: -+ getattr(self.qga, 'suspend' + '_' + mode)() -+ # On error exception will raise -+ except TimeoutError: -+ # On success command will timed out -+ return -+ -+ def shutdown(self, mode: str = 'powerdown') -> None: -+ if mode not in ['powerdown', 'halt', 'reboot']: -+ raise Exception('Invalid mode: ' + mode) -+ -+ try: -+ self.qga.shutdown(mode=mode) -+ except TimeoutError: -+ pass -+ -+ -+def _cmd_cat(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ if len(args) != 1: -+ print('Invalid argument') -+ print('Usage: cat ') -+ sys.exit(1) -+ print(client.read(args[0])) -+ -+ -+def _cmd_fsfreeze(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ usage = 'Usage: fsfreeze status|freeze|thaw' -+ if len(args) != 1: -+ print('Invalid argument') -+ print(usage) -+ sys.exit(1) -+ if args[0] not in ['status', 'freeze', 'thaw']: -+ print('Invalid command: ' + args[0]) -+ print(usage) -+ sys.exit(1) -+ cmd = args[0] -+ ret = client.fsfreeze(cmd) -+ if cmd == 'status': -+ print(ret) -+ return -+ -+ assert isinstance(ret, int) -+ verb = 'frozen' if cmd == 'freeze' else 'thawed' -+ print(f"{ret:d} filesystems {verb}") -+ -+ -+def _cmd_fstrim(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ if len(args) == 0: -+ minimum = 0 -+ else: -+ minimum = int(args[0]) -+ print(client.fstrim(minimum)) -+ -+ -+def _cmd_ifconfig(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ assert not args -+ print(client.ifconfig()) -+ -+ -+def _cmd_info(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ assert not args -+ print(client.info()) -+ -+ -+def _cmd_ping(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ timeout = 3.0 if len(args) == 0 else float(args[0]) -+ alive = client.ping(timeout) -+ if not alive: -+ print("Not responded in %s sec" % args[0]) -+ sys.exit(1) -+ -+ -+def _cmd_suspend(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ usage = 'Usage: suspend disk|ram|hybrid' -+ if len(args) != 1: -+ print('Less argument') -+ print(usage) -+ sys.exit(1) -+ if args[0] not in ['disk', 'ram', 'hybrid']: -+ print('Invalid command: ' + args[0]) -+ print(usage) -+ sys.exit(1) -+ client.suspend(args[0]) -+ -+ -+def _cmd_shutdown(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ assert not args -+ client.shutdown() -+ -+ -+_cmd_powerdown = _cmd_shutdown -+ -+ -+def _cmd_halt(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ assert not args -+ client.shutdown('halt') -+ -+ -+def _cmd_reboot(client: QemuGuestAgentClient, args: Sequence[str]) -> None: -+ assert not args -+ client.shutdown('reboot') -+ -+ -+commands = [m.replace('_cmd_', '') for m in dir() if '_cmd_' in m] -+ -+ -+def send_command(address: str, cmd: str, args: Sequence[str]) -> None: -+ if not os.path.exists(address): -+ print('%s not found' % address) -+ sys.exit(1) -+ -+ if cmd not in commands: -+ print('Invalid command: ' + cmd) -+ print('Available commands: ' + ', '.join(commands)) -+ sys.exit(1) -+ -+ try: -+ client = QemuGuestAgentClient(address) -+ except OSError as err: -+ print(err) -+ if err.errno == errno.ECONNREFUSED: -+ print('Hint: qemu is not running?') -+ sys.exit(1) -+ -+ if cmd == 'fsfreeze' and args[0] == 'freeze': -+ client.sync(60) -+ elif cmd != 'ping': -+ client.sync() -+ -+ globals()['_cmd_' + cmd](client, args) -+ -+ -+def main() -> None: -+ address = os.environ.get('QGA_CLIENT_ADDRESS') -+ -+ parser = argparse.ArgumentParser() -+ parser.add_argument('--address', action='store', -+ default=address, -+ help='Specify a ip:port pair or a unix socket path') -+ parser.add_argument('command', choices=commands) -+ parser.add_argument('args', nargs='*') -+ -+ args = parser.parse_args() -+ if args.address is None: -+ parser.error('address is not specified') -+ sys.exit(1) -+ -+ send_command(args.address, args.command, args.args) -+ -+ -+if __name__ == '__main__': -+ main() -diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py -new file mode 100644 -index 0000000000000000000000000000000000000000..8ff28a83439767ce37db21d8790c50ddb4845f50 ---- /dev/null -+++ b/python/qemu/utils/qom.py -@@ -0,0 +1,272 @@ -+""" -+QEMU Object Model testing tools. -+ -+usage: qom [-h] {set,get,list,tree,fuse} ... -+ -+Query and manipulate QOM data -+ -+optional arguments: -+ -h, --help show this help message and exit -+ -+QOM commands: -+ {set,get,list,tree,fuse} -+ set Set a QOM property value -+ get Get a QOM property value -+ list List QOM properties at a given path -+ tree Show QOM tree from a given path -+ fuse Mount a QOM tree as a FUSE filesystem -+""" -+## -+# Copyright John Snow 2020, for Red Hat, Inc. -+# Copyright IBM, Corp. 2011 -+# -+# Authors: -+# John Snow -+# Anthony Liguori -+# -+# This work is licensed under the terms of the GNU GPL, version 2 or later. -+# See the COPYING file in the top-level directory. -+# -+# Based on ./scripts/qmp/qom-[set|get|tree|list] -+## -+ -+import argparse -+ -+from . import QMPResponseError -+from .qom_common import QOMCommand -+ -+ -+try: -+ from .qom_fuse import QOMFuse -+except ModuleNotFoundError as _err: -+ if _err.name != 'fuse': -+ raise -+else: -+ assert issubclass(QOMFuse, QOMCommand) -+ -+ -+class QOMSet(QOMCommand): -+ """ -+ QOM Command - Set a property to a given value. -+ -+ usage: qom-set [-h] [--socket SOCKET] . -+ -+ Set a QOM property value -+ -+ positional arguments: -+ . QOM path and property, separated by a period '.' -+ new QOM property value -+ -+ optional arguments: -+ -h, --help show this help message and exit -+ --socket SOCKET, -s SOCKET -+ QMP socket path or address (addr:port). May also be -+ set via QMP_SOCKET environment variable. -+ """ -+ name = 'set' -+ help = 'Set a QOM property value' -+ -+ @classmethod -+ def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -+ super().configure_parser(parser) -+ cls.add_path_prop_arg(parser) -+ parser.add_argument( -+ 'value', -+ metavar='', -+ action='store', -+ help='new QOM property value' -+ ) -+ -+ def __init__(self, args: argparse.Namespace): -+ super().__init__(args) -+ self.path, self.prop = args.path_prop.rsplit('.', 1) -+ self.value = args.value -+ -+ def run(self) -> int: -+ rsp = self.qmp.command( -+ 'qom-set', -+ path=self.path, -+ property=self.prop, -+ value=self.value -+ ) -+ print(rsp) -+ return 0 -+ -+ -+class QOMGet(QOMCommand): -+ """ -+ QOM Command - Get a property's current value. -+ -+ usage: qom-get [-h] [--socket SOCKET] . -+ -+ Get a QOM property value -+ -+ positional arguments: -+ . QOM path and property, separated by a period '.' -+ -+ optional arguments: -+ -h, --help show this help message and exit -+ --socket SOCKET, -s SOCKET -+ QMP socket path or address (addr:port). May also be -+ set via QMP_SOCKET environment variable. -+ """ -+ name = 'get' -+ help = 'Get a QOM property value' -+ -+ @classmethod -+ def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -+ super().configure_parser(parser) -+ cls.add_path_prop_arg(parser) -+ -+ def __init__(self, args: argparse.Namespace): -+ super().__init__(args) -+ try: -+ tmp = args.path_prop.rsplit('.', 1) -+ except ValueError as err: -+ raise ValueError('Invalid format for .') from err -+ self.path = tmp[0] -+ self.prop = tmp[1] -+ -+ def run(self) -> int: -+ rsp = self.qmp.command( -+ 'qom-get', -+ path=self.path, -+ property=self.prop -+ ) -+ if isinstance(rsp, dict): -+ for key, value in rsp.items(): -+ print(f"{key}: {value}") -+ else: -+ print(rsp) -+ return 0 -+ -+ -+class QOMList(QOMCommand): -+ """ -+ QOM Command - List the properties at a given path. -+ -+ usage: qom-list [-h] [--socket SOCKET] -+ -+ List QOM properties at a given path -+ -+ positional arguments: -+ QOM path -+ -+ optional arguments: -+ -h, --help show this help message and exit -+ --socket SOCKET, -s SOCKET -+ QMP socket path or address (addr:port). May also be -+ set via QMP_SOCKET environment variable. -+ """ -+ name = 'list' -+ help = 'List QOM properties at a given path' -+ -+ @classmethod -+ def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -+ super().configure_parser(parser) -+ parser.add_argument( -+ 'path', -+ metavar='', -+ action='store', -+ help='QOM path', -+ ) -+ -+ def __init__(self, args: argparse.Namespace): -+ super().__init__(args) -+ self.path = args.path -+ -+ def run(self) -> int: -+ rsp = self.qom_list(self.path) -+ for item in rsp: -+ if item.child: -+ print(f"{item.name}/") -+ elif item.link: -+ print(f"@{item.name}/") -+ else: -+ print(item.name) -+ return 0 -+ -+ -+class QOMTree(QOMCommand): -+ """ -+ QOM Command - Show the full tree below a given path. -+ -+ usage: qom-tree [-h] [--socket SOCKET] [] -+ -+ Show QOM tree from a given path -+ -+ positional arguments: -+ QOM path -+ -+ optional arguments: -+ -h, --help show this help message and exit -+ --socket SOCKET, -s SOCKET -+ QMP socket path or address (addr:port). May also be -+ set via QMP_SOCKET environment variable. -+ """ -+ name = 'tree' -+ help = 'Show QOM tree from a given path' -+ -+ @classmethod -+ def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -+ super().configure_parser(parser) -+ parser.add_argument( -+ 'path', -+ metavar='', -+ action='store', -+ help='QOM path', -+ nargs='?', -+ default='/' -+ ) -+ -+ def __init__(self, args: argparse.Namespace): -+ super().__init__(args) -+ self.path = args.path -+ -+ def _list_node(self, path: str) -> None: -+ print(path) -+ items = self.qom_list(path) -+ for item in items: -+ if item.child: -+ continue -+ try: -+ rsp = self.qmp.command('qom-get', path=path, -+ property=item.name) -+ print(f" {item.name}: {rsp} ({item.type})") -+ except QMPResponseError as err: -+ print(f" {item.name}: ({item.type})") -+ print('') -+ for item in items: -+ if not item.child: -+ continue -+ if path == '/': -+ path = '' -+ self._list_node(f"{path}/{item.name}") -+ -+ def run(self) -> int: -+ self._list_node(self.path) -+ return 0 -+ -+ -+def main() -> int: -+ """QOM script main entry point.""" -+ parser = argparse.ArgumentParser( -+ description='Query and manipulate QOM data' -+ ) -+ subparsers = parser.add_subparsers( -+ title='QOM commands', -+ dest='command' -+ ) -+ -+ for command in QOMCommand.__subclasses__(): -+ command.register(subparsers) -+ -+ args = parser.parse_args() -+ -+ if args.command is None: -+ parser.error('Command not specified.') -+ return 1 -+ -+ cmd_class = args.cmd_class -+ assert isinstance(cmd_class, type(QOMCommand)) -+ return cmd_class.command_runner(args) -diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common.py -new file mode 100644 -index 0000000000000000000000000000000000000000..a59ae1a2a1883cb4d89b0e44507c5001f44357a0 ---- /dev/null -+++ b/python/qemu/utils/qom_common.py -@@ -0,0 +1,178 @@ -+""" -+QOM Command abstractions. -+""" -+## -+# Copyright John Snow 2020, for Red Hat, Inc. -+# Copyright IBM, Corp. 2011 -+# -+# Authors: -+# John Snow -+# Anthony Liguori -+# -+# This work is licensed under the terms of the GNU GPL, version 2 or later. -+# See the COPYING file in the top-level directory. -+# -+# Based on ./scripts/qmp/qom-[set|get|tree|list] -+## -+ -+import argparse -+import os -+import sys -+from typing import ( -+ Any, -+ Dict, -+ List, -+ Optional, -+ Type, -+ TypeVar, -+) -+ -+from . import QEMUMonitorProtocol, QMPError -+ -+ -+# The following is needed only for a type alias. -+Subparsers = argparse._SubParsersAction # pylint: disable=protected-access -+ -+ -+class ObjectPropertyInfo: -+ """ -+ Represents the return type from e.g. qom-list. -+ """ -+ def __init__(self, name: str, type_: str, -+ description: Optional[str] = None, -+ default_value: Optional[object] = None): -+ self.name = name -+ self.type = type_ -+ self.description = description -+ self.default_value = default_value -+ -+ @classmethod -+ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyInfo': -+ """ -+ Build an ObjectPropertyInfo from a Dict with an unknown shape. -+ """ -+ assert value.keys() >= {'name', 'type'} -+ assert value.keys() <= {'name', 'type', 'description', 'default-value'} -+ return cls(value['name'], value['type'], -+ value.get('description'), -+ value.get('default-value')) -+ -+ @property -+ def child(self) -> bool: -+ """Is this property a child property?""" -+ return self.type.startswith('child<') -+ -+ @property -+ def link(self) -> bool: -+ """Is this property a link property?""" -+ return self.type.startswith('link<') -+ -+ -+CommandT = TypeVar('CommandT', bound='QOMCommand') -+ -+ -+class QOMCommand: -+ """ -+ Represents a QOM sub-command. -+ -+ :param args: Parsed arguments, as returned from parser.parse_args. -+ """ -+ name: str -+ help: str -+ -+ def __init__(self, args: argparse.Namespace): -+ if args.socket is None: -+ raise QMPError("No QMP socket path or address given") -+ self.qmp = QEMUMonitorProtocol( -+ QEMUMonitorProtocol.parse_address(args.socket) -+ ) -+ self.qmp.connect() -+ -+ @classmethod -+ def register(cls, subparsers: Subparsers) -> None: -+ """ -+ Register this command with the argument parser. -+ -+ :param subparsers: argparse subparsers object, from "add_subparsers". -+ """ -+ subparser = subparsers.add_parser(cls.name, help=cls.help, -+ description=cls.help) -+ cls.configure_parser(subparser) -+ -+ @classmethod -+ def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -+ """ -+ Configure a parser with this command's arguments. -+ -+ :param parser: argparse parser or subparser object. -+ """ -+ default_path = os.environ.get('QMP_SOCKET') -+ parser.add_argument( -+ '--socket', '-s', -+ dest='socket', -+ action='store', -+ help='QMP socket path or address (addr:port).' -+ ' May also be set via QMP_SOCKET environment variable.', -+ default=default_path -+ ) -+ parser.set_defaults(cmd_class=cls) -+ -+ @classmethod -+ def add_path_prop_arg(cls, parser: argparse.ArgumentParser) -> None: -+ """ -+ Add the . positional argument to this command. -+ -+ :param parser: The parser to add the argument to. -+ """ -+ parser.add_argument( -+ 'path_prop', -+ metavar='.', -+ action='store', -+ help="QOM path and property, separated by a period '.'" -+ ) -+ -+ def run(self) -> int: -+ """ -+ Run this command. -+ -+ :return: 0 on success, 1 otherwise. -+ """ -+ raise NotImplementedError -+ -+ def qom_list(self, path: str) -> List[ObjectPropertyInfo]: -+ """ -+ :return: a strongly typed list from the 'qom-list' command. -+ """ -+ rsp = self.qmp.command('qom-list', path=path) -+ # qom-list returns List[ObjectPropertyInfo] -+ assert isinstance(rsp, list) -+ return [ObjectPropertyInfo.make(x) for x in rsp] -+ -+ @classmethod -+ def command_runner( -+ cls: Type[CommandT], -+ args: argparse.Namespace -+ ) -> int: -+ """ -+ Run a fully-parsed subcommand, with error-handling for the CLI. -+ -+ :return: The return code from `run()`. -+ """ -+ try: -+ cmd = cls(args) -+ return cmd.run() -+ except QMPError as err: -+ print(f"{type(err).__name__}: {err!s}", file=sys.stderr) -+ return -1 -+ -+ @classmethod -+ def entry_point(cls) -> int: -+ """ -+ Build this command's parser, parse arguments, and run the command. -+ -+ :return: `run`'s return code. -+ """ -+ parser = argparse.ArgumentParser(description=cls.help) -+ cls.configure_parser(parser) -+ args = parser.parse_args() -+ return cls.command_runner(args) -diff --git a/python/qemu/utils/qom_fuse.py b/python/qemu/utils/qom_fuse.py -new file mode 100644 -index 0000000000000000000000000000000000000000..43f4671fdb18c6aa1b11df9694855167fced8f10 ---- /dev/null -+++ b/python/qemu/utils/qom_fuse.py -@@ -0,0 +1,206 @@ -+""" -+QEMU Object Model FUSE filesystem tool -+ -+This script offers a simple FUSE filesystem within which the QOM tree -+may be browsed, queried and edited using traditional shell tooling. -+ -+This script requires the 'fusepy' python package. -+ -+ -+usage: qom-fuse [-h] [--socket SOCKET] -+ -+Mount a QOM tree as a FUSE filesystem -+ -+positional arguments: -+ Mount point -+ -+optional arguments: -+ -h, --help show this help message and exit -+ --socket SOCKET, -s SOCKET -+ QMP socket path or address (addr:port). May also be -+ set via QMP_SOCKET environment variable. -+""" -+## -+# Copyright IBM, Corp. 2012 -+# Copyright (C) 2020 Red Hat, Inc. -+# -+# Authors: -+# Anthony Liguori -+# Markus Armbruster -+# -+# This work is licensed under the terms of the GNU GPL, version 2 or later. -+# See the COPYING file in the top-level directory. -+## -+ -+import argparse -+from errno import ENOENT, EPERM -+import stat -+import sys -+from typing import ( -+ IO, -+ Dict, -+ Iterator, -+ Mapping, -+ Optional, -+ Union, -+) -+ -+import fuse -+from fuse import FUSE, FuseOSError, Operations -+ -+from . import QMPResponseError -+from .qom_common import QOMCommand -+ -+ -+fuse.fuse_python_api = (0, 2) -+ -+ -+class QOMFuse(QOMCommand, Operations): -+ """ -+ QOMFuse implements both fuse.Operations and QOMCommand. -+ -+ Operations implements the FS, and QOMCommand implements the CLI command. -+ """ -+ name = 'fuse' -+ help = 'Mount a QOM tree as a FUSE filesystem' -+ fuse: FUSE -+ -+ @classmethod -+ def configure_parser(cls, parser: argparse.ArgumentParser) -> None: -+ super().configure_parser(parser) -+ parser.add_argument( -+ 'mount', -+ metavar='', -+ action='store', -+ help="Mount point", -+ ) -+ -+ def __init__(self, args: argparse.Namespace): -+ super().__init__(args) -+ self.mount = args.mount -+ self.ino_map: Dict[str, int] = {} -+ self.ino_count = 1 -+ -+ def run(self) -> int: -+ print(f"Mounting QOMFS to '{self.mount}'", file=sys.stderr) -+ self.fuse = FUSE(self, self.mount, foreground=True) -+ return 0 -+ -+ def get_ino(self, path: str) -> int: -+ """Get an inode number for a given QOM path.""" -+ if path in self.ino_map: -+ return self.ino_map[path] -+ self.ino_map[path] = self.ino_count -+ self.ino_count += 1 -+ return self.ino_map[path] -+ -+ def is_object(self, path: str) -> bool: -+ """Is the given QOM path an object?""" -+ try: -+ self.qom_list(path) -+ return True -+ except QMPResponseError: -+ return False -+ -+ def is_property(self, path: str) -> bool: -+ """Is the given QOM path a property?""" -+ path, prop = path.rsplit('/', 1) -+ if path == '': -+ path = '/' -+ try: -+ for item in self.qom_list(path): -+ if item.name == prop: -+ return True -+ return False -+ except QMPResponseError: -+ return False -+ -+ def is_link(self, path: str) -> bool: -+ """Is the given QOM path a link?""" -+ path, prop = path.rsplit('/', 1) -+ if path == '': -+ path = '/' -+ try: -+ for item in self.qom_list(path): -+ if item.name == prop and item.link: -+ return True -+ return False -+ except QMPResponseError: -+ return False -+ -+ def read(self, path: str, size: int, offset: int, fh: IO[bytes]) -> bytes: -+ if not self.is_property(path): -+ raise FuseOSError(ENOENT) -+ -+ path, prop = path.rsplit('/', 1) -+ if path == '': -+ path = '/' -+ try: -+ data = str(self.qmp.command('qom-get', path=path, property=prop)) -+ data += '\n' # make values shell friendly -+ except QMPResponseError as err: -+ raise FuseOSError(EPERM) from err -+ -+ if offset > len(data): -+ return b'' -+ -+ return bytes(data[offset:][:size], encoding='utf-8') -+ -+ def readlink(self, path: str) -> Union[bool, str]: -+ if not self.is_link(path): -+ return False -+ path, prop = path.rsplit('/', 1) -+ prefix = '/'.join(['..'] * (len(path.split('/')) - 1)) -+ return prefix + str(self.qmp.command('qom-get', path=path, -+ property=prop)) -+ -+ def getattr(self, path: str, -+ fh: Optional[IO[bytes]] = None) -> Mapping[str, object]: -+ if self.is_link(path): -+ value = { -+ 'st_mode': 0o755 | stat.S_IFLNK, -+ 'st_ino': self.get_ino(path), -+ 'st_dev': 0, -+ 'st_nlink': 2, -+ 'st_uid': 1000, -+ 'st_gid': 1000, -+ 'st_size': 4096, -+ 'st_atime': 0, -+ 'st_mtime': 0, -+ 'st_ctime': 0 -+ } -+ elif self.is_object(path): -+ value = { -+ 'st_mode': 0o755 | stat.S_IFDIR, -+ 'st_ino': self.get_ino(path), -+ 'st_dev': 0, -+ 'st_nlink': 2, -+ 'st_uid': 1000, -+ 'st_gid': 1000, -+ 'st_size': 4096, -+ 'st_atime': 0, -+ 'st_mtime': 0, -+ 'st_ctime': 0 -+ } -+ elif self.is_property(path): -+ value = { -+ 'st_mode': 0o644 | stat.S_IFREG, -+ 'st_ino': self.get_ino(path), -+ 'st_dev': 0, -+ 'st_nlink': 1, -+ 'st_uid': 1000, -+ 'st_gid': 1000, -+ 'st_size': 4096, -+ 'st_atime': 0, -+ 'st_mtime': 0, -+ 'st_ctime': 0 -+ } -+ else: -+ raise FuseOSError(ENOENT) -+ return value -+ -+ def readdir(self, path: str, fh: IO[bytes]) -> Iterator[str]: -+ yield '.' -+ yield '..' -+ for item in self.qom_list(path): -+ yield item.name -diff --git a/python/setup.cfg b/python/setup.cfg -index 4f4f20571f304507e20ce16cee66..91ccef7e8fd85d0d6d3d86adbc8d 100644 ---- a/python/setup.cfg -+++ b/python/setup.cfg -@@ -60,13 +60,13 @@ tui = - - [options.entry_points] - console_scripts = -- qom = qemu.qmp.qom:main -- qom-set = qemu.qmp.qom:QOMSet.entry_point -- qom-get = qemu.qmp.qom:QOMGet.entry_point -- qom-list = qemu.qmp.qom:QOMList.entry_point -- qom-tree = qemu.qmp.qom:QOMTree.entry_point -- qom-fuse = qemu.qmp.qom_fuse:QOMFuse.entry_point [fuse] -- qemu-ga-client = qemu.qmp.qemu_ga_client:main -+ qom = qemu.utils.qom:main -+ qom-set = qemu.utils.qom:QOMSet.entry_point -+ qom-get = qemu.utils.qom:QOMGet.entry_point -+ qom-list = qemu.utils.qom:QOMList.entry_point -+ qom-tree = qemu.utils.qom:QOMTree.entry_point -+ qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] -+ qemu-ga-client = qemu.utils.qemu_ga_client:main - qmp-shell = qemu.qmp.qmp_shell:main - aqmp-tui = qemu.aqmp.aqmp_tui:main [tui] - -@@ -80,7 +80,7 @@ python_version = 3.6 - warn_unused_configs = True - namespace_packages = True - --[mypy-qemu.qmp.qom_fuse] -+[mypy-qemu.utils.qom_fuse] - # fusepy has no type stubs: - allow_subclassing_any = True - -diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client -index 102fd2cad93fcc76e428e841241a..56edd0234a62cc25a069bb6a65dc 100755 ---- a/scripts/qmp/qemu-ga-client -+++ b/scripts/qmp/qemu-ga-client -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp import qemu_ga_client -+from qemu.utils import qemu_ga_client - - - if __name__ == '__main__': -diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse -index a58c8ef9793b387eeaec6777a5c3..d453807b273f5576c90c8809df2b 100755 ---- a/scripts/qmp/qom-fuse -+++ b/scripts/qmp/qom-fuse -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp.qom_fuse import QOMFuse -+from qemu.utils.qom_fuse import QOMFuse - - - if __name__ == '__main__': -diff --git a/scripts/qmp/qom-get b/scripts/qmp/qom-get -index e4f3e0c01381a0240379016340d4..04ebe052e82a97bbadde1dfc76c4 100755 ---- a/scripts/qmp/qom-get -+++ b/scripts/qmp/qom-get -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp.qom import QOMGet -+from qemu.utils.qom import QOMGet - - - if __name__ == '__main__': -diff --git a/scripts/qmp/qom-list b/scripts/qmp/qom-list -index 7a071a54e1e7785142b2dc262ac4..853b85a8d3fc4e032f40747c3c08 100755 ---- a/scripts/qmp/qom-list -+++ b/scripts/qmp/qom-list -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp.qom import QOMList -+from qemu.utils.qom import QOMList - - - if __name__ == '__main__': -diff --git a/scripts/qmp/qom-set b/scripts/qmp/qom-set -index 9ca9e2ba106b158e0926184533b9..06820feec424ecd30235c6ed9006 100755 ---- a/scripts/qmp/qom-set -+++ b/scripts/qmp/qom-set -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp.qom import QOMSet -+from qemu.utils.qom import QOMSet - - - if __name__ == '__main__': -diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree -index 7d0ccca3a4dd87edb92b1ac7a6e7..760e172277e9b66ff2a6d770b526 100755 ---- a/scripts/qmp/qom-tree -+++ b/scripts/qmp/qom-tree -@@ -4,7 +4,7 @@ import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) --from qemu.qmp.qom import QOMTree -+from qemu.utils.qom import QOMTree - - - if __name__ == '__main__': diff --git a/python-qmp-switch-qmp-shell-to-AQMP.patch b/python-qmp-switch-qmp-shell-to-AQMP.patch deleted file mode 100644 index 198a3020..00000000 --- a/python-qmp-switch-qmp-shell-to-AQMP.patch +++ /dev/null @@ -1,121 +0,0 @@ -From: John Snow -Date: Mon, 10 Jan 2022 18:28:53 -0500 -Subject: python/qmp: switch qmp-shell to AQMP - -Git-commit: f3efd12930f34b9724e15d8fd2ff56a97b67219d - -We have a replacement for async QMP, but it doesn't have feature parity -yet. For now, then, port the old tool onto the new backend. - -Signed-off-by: John Snow -Reviewed-by: Vladimir Sementsov-Ogievskiy -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/legacy.py | 3 +++ - python/qemu/qmp/qmp_shell.py | 31 +++++++++++++++++-------------- - 2 files changed, 20 insertions(+), 14 deletions(-) - -diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py -index 27df22818a76190e872f08c0852e..0890f95b16875ecb815ed4560bc7 100644 ---- a/python/qemu/aqmp/legacy.py -+++ b/python/qemu/aqmp/legacy.py -@@ -22,6 +22,9 @@ from .protocol import Runstate, SocketAddrT - from .qmp_client import QMPClient - - -+# (Temporarily) Re-export QMPBadPortError -+QMPBadPortError = qemu.qmp.QMPBadPortError -+ - #: QMPMessage is an entire QMP message of any kind. - QMPMessage = Dict[str, Any] - -diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py -index e7d7eb18f19cae7ac185b333013e..d11bf54b00e5d56616ae57be0006 100644 ---- a/python/qemu/qmp/qmp_shell.py -+++ b/python/qemu/qmp/qmp_shell.py -@@ -95,8 +95,13 @@ from typing import ( - Sequence, - ) - --from qemu import qmp --from qemu.qmp import QMPMessage -+from qemu.aqmp import ConnectError, QMPError, SocketAddrT -+from qemu.aqmp.legacy import ( -+ QEMUMonitorProtocol, -+ QMPBadPortError, -+ QMPMessage, -+ QMPObject, -+) - - - LOG = logging.getLogger(__name__) -@@ -125,7 +130,7 @@ class QMPCompleter: - return None - - --class QMPShellError(qmp.QMPError): -+class QMPShellError(QMPError): - """ - QMP Shell Base error class. - """ -@@ -153,7 +158,7 @@ class FuzzyJSON(ast.NodeTransformer): - return node - - --class QMPShell(qmp.QEMUMonitorProtocol): -+class QMPShell(QEMUMonitorProtocol): - """ - QMPShell provides a basic readline-based QMP shell. - -@@ -161,7 +166,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): - :param pretty: Pretty-print QMP messages. - :param verbose: Echo outgoing QMP messages to console. - """ -- def __init__(self, address: qmp.SocketAddrT, -+ def __init__(self, address: SocketAddrT, - pretty: bool = False, verbose: bool = False): - super().__init__(address) - self._greeting: Optional[QMPMessage] = None -@@ -237,7 +242,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): - - def _cli_expr(self, - tokens: Sequence[str], -- parent: qmp.QMPObject) -> None: -+ parent: QMPObject) -> None: - for arg in tokens: - (key, sep, val) = arg.partition('=') - if sep != '=': -@@ -403,7 +408,7 @@ class HMPShell(QMPShell): - :param pretty: Pretty-print QMP messages. - :param verbose: Echo outgoing QMP messages to console. - """ -- def __init__(self, address: qmp.SocketAddrT, -+ def __init__(self, address: SocketAddrT, - pretty: bool = False, verbose: bool = False): - super().__init__(address, pretty, verbose) - self._cpu_index = 0 -@@ -512,19 +517,17 @@ def main() -> None: - - try: - address = shell_class.parse_address(args.qmp_server) -- except qmp.QMPBadPortError: -+ except QMPBadPortError: - parser.error(f"Bad port number: {args.qmp_server}") - return # pycharm doesn't know error() is noreturn - - with shell_class(address, args.pretty, args.verbose) as qemu: - try: - qemu.connect(negotiate=not args.skip_negotiation) -- except qmp.QMPConnectError: -- die("Didn't get QMP greeting message") -- except qmp.QMPCapabilitiesError: -- die("Couldn't negotiate capabilities") -- except OSError as err: -- die(f"Couldn't connect to {args.qmp_server}: {err!s}") -+ except ConnectError as err: -+ if isinstance(err.exc, OSError): -+ die(f"Couldn't connect to {args.qmp_server}: {err!s}") -+ die(str(err)) - - for _ in qemu.repl(): - pass diff --git a/python-support-recording-QMP-session-to-.patch b/python-support-recording-QMP-session-to-.patch deleted file mode 100644 index 58088a36..00000000 --- a/python-support-recording-QMP-session-to-.patch +++ /dev/null @@ -1,184 +0,0 @@ -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Fri, 28 Jan 2022 16:11:57 +0000 -Subject: python: support recording QMP session to a file -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Git-commit: 5c66d7d8de9a00460199669d26cd83fba135bee5 - -When running QMP commands with very large response payloads, it is often -not easy to spot the info you want. If we can save the response to a -file then tools like 'grep' or 'jq' can be used to extract information. - -For convenience of processing, we merge the QMP command and response -dictionaries together: - - { - "arguments": {}, - "execute": "query-kvm", - "return": { - "enabled": false, - "present": true - } - } - -Example usage - - $ ./scripts/qmp/qmp-shell-wrap -l q.log -p -- ./build/qemu-system-x86_64 -display none - Welcome to the QMP low-level shell! - Connected - (QEMU) query-kvm - { - "return": { - "enabled": false, - "present": true - } - } - (QEMU) query-mice - { - "return": [ - { - "absolute": false, - "current": true, - "index": 2, - "name": "QEMU PS/2 Mouse" - } - ] - } - - $ jq --slurp '. | to_entries[] | select(.value.execute == "query-kvm") | - .value.return.enabled' < q.log - false - -Reviewed-by: Philippe Mathieu-Daudé -Signed-off-by: Daniel P. Berrangé -Message-id: 20220128161157.36261-3-berrange@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/qemu/aqmp/qmp_shell.py | 29 ++++++++++++++++++++++------- - python/setup.cfg | 3 +++ - 2 files changed, 25 insertions(+), 7 deletions(-) - -diff --git a/python/qemu/aqmp/qmp_shell.py b/python/qemu/aqmp/qmp_shell.py -index c60df787fcd50bf8a0109e5f5cd3..35691494d0a88070bcf1ad691699 100644 ---- a/python/qemu/aqmp/qmp_shell.py -+++ b/python/qemu/aqmp/qmp_shell.py -@@ -89,6 +89,7 @@ import readline - from subprocess import Popen - import sys - from typing import ( -+ IO, - Iterator, - List, - NoReturn, -@@ -170,7 +171,8 @@ class QMPShell(QEMUMonitorProtocol): - def __init__(self, address: SocketAddrT, - pretty: bool = False, - verbose: bool = False, -- server: bool = False): -+ server: bool = False, -+ logfile: Optional[str] = None): - super().__init__(address, server=server) - self._greeting: Optional[QMPMessage] = None - self._completer = QMPCompleter() -@@ -180,6 +182,10 @@ class QMPShell(QEMUMonitorProtocol): - '.qmp-shell_history') - self.pretty = pretty - self.verbose = verbose -+ self.logfile = None -+ -+ if logfile is not None: -+ self.logfile = open(logfile, "w", encoding='utf-8') - - def close(self) -> None: - # Hook into context manager of parent to save shell history. -@@ -320,11 +326,11 @@ class QMPShell(QEMUMonitorProtocol): - self._cli_expr(cmdargs[1:], qmpcmd['arguments']) - return qmpcmd - -- def _print(self, qmp_message: object) -> None: -+ def _print(self, qmp_message: object, fh: IO[str] = sys.stdout) -> None: - jsobj = json.dumps(qmp_message, - indent=4 if self.pretty else None, - sort_keys=self.pretty) -- print(str(jsobj)) -+ print(str(jsobj), file=fh) - - def _execute_cmd(self, cmdline: str) -> bool: - try: -@@ -347,6 +353,9 @@ class QMPShell(QEMUMonitorProtocol): - print('Disconnected') - return False - self._print(resp) -+ if self.logfile is not None: -+ cmd = {**qmpcmd, **resp} -+ self._print(cmd, fh=self.logfile) - return True - - def connect(self, negotiate: bool = True) -> None: -@@ -414,8 +423,9 @@ class HMPShell(QMPShell): - def __init__(self, address: SocketAddrT, - pretty: bool = False, - verbose: bool = False, -- server: bool = False): -- super().__init__(address, pretty, verbose, server) -+ server: bool = False, -+ logfile: Optional[str] = None): -+ super().__init__(address, pretty, verbose, server, logfile) - self._cpu_index = 0 - - def _cmd_completion(self) -> None: -@@ -508,6 +518,8 @@ def main() -> None: - help='Verbose (echo commands sent and received)') - parser.add_argument('-p', '--pretty', action='store_true', - help='Pretty-print JSON') -+ parser.add_argument('-l', '--logfile', -+ help='Save log of all QMP messages to PATH') - - default_server = os.environ.get('QMP_SOCKET') - parser.add_argument('qmp_server', action='store', -@@ -526,7 +538,7 @@ def main() -> None: - parser.error(f"Bad port number: {args.qmp_server}") - return # pycharm doesn't know error() is noreturn - -- with shell_class(address, args.pretty, args.verbose) as qemu: -+ with shell_class(address, args.pretty, args.verbose, args.logfile) as qemu: - try: - qemu.connect(negotiate=not args.skip_negotiation) - except ConnectError as err: -@@ -550,6 +562,8 @@ def main_wrap() -> None: - help='Verbose (echo commands sent and received)') - parser.add_argument('-p', '--pretty', action='store_true', - help='Pretty-print JSON') -+ parser.add_argument('-l', '--logfile', -+ help='Save log of all QMP messages to PATH') - - parser.add_argument('command', nargs=argparse.REMAINDER, - help='QEMU command line to invoke') -@@ -574,7 +588,8 @@ def main_wrap() -> None: - return # pycharm doesn't know error() is noreturn - - try: -- with shell_class(address, args.pretty, args.verbose, True) as qemu: -+ with shell_class(address, args.pretty, args.verbose, -+ True, args.logfile) as qemu: - with Popen(cmd): - - try: -diff --git a/python/setup.cfg b/python/setup.cfg -index bec54e8b0d663191e2b7afbfa350..241f243e8b94417f9b032c41576b 100644 ---- a/python/setup.cfg -+++ b/python/setup.cfg -@@ -114,7 +114,10 @@ ignore_missing_imports = True - # no Warning level messages displayed, use "--disable=all --enable=classes - # --disable=W". - disable=consider-using-f-string, -+ consider-using-with, -+ too-many-arguments, - too-many-function-args, # mypy handles this with less false positives. -+ too-many-instance-attributes, - no-member, # mypy also handles this better. - - [pylint.basic] diff --git a/python-upgrade-mypy-to-0.780.patch b/python-upgrade-mypy-to-0.780.patch deleted file mode 100644 index f7b9618e..00000000 --- a/python-upgrade-mypy-to-0.780.patch +++ /dev/null @@ -1,232 +0,0 @@ -From: John Snow -Date: Mon, 31 Jan 2022 23:11:33 -0500 -Subject: python: upgrade mypy to 0.780 - -Git-commit: 74a1505d279897d2a448c876820a33cbe1f0f22e - -We need a slightly newer version of mypy in order to use some features -of the asyncio server functions in the next commit. - -(Note: pipenv is not really suited to upgrading individual packages; I -need to replace this tool with something better for the task. For now, -the miscellaneous updates not related to the mypy upgrade are simply -beyond my control. It's on my list to take care of soon.) - -Signed-off-by: John Snow -Reviewed-by: Kevin Wolf -Message-id: 20220201041134.1237016-4-jsnow@redhat.com -Signed-off-by: John Snow -Signed-off-by: Li Zhang ---- - python/Pipfile.lock | 66 ++++++++++++++++++++++++++------------------- - python/setup.cfg | 2 +- - 2 files changed, 40 insertions(+), 28 deletions(-) - -diff --git a/python/Pipfile.lock b/python/Pipfile.lock -index d2a7dbd88be19fd6db0baa083d8a..ce46404ce0840c693d3c982674ac 100644 ---- a/python/Pipfile.lock -+++ b/python/Pipfile.lock -@@ -1,7 +1,7 @@ - { - "_meta": { - "hash": { -- "sha256": "784b327272db32403d5a488507853b5afba850ba26a5948e5b6a90c1baef2d9c" -+ "sha256": "f1a25654d884a5b450e38d78b1f2e3ebb9073e421cc4358d4bbb83ac251a5670" - }, - "pipfile-spec": 6, - "requires": { -@@ -34,7 +34,7 @@ - "sha256:09bdb456e02564731f8b5957cdd0c98a7f01d2db5e90eb1d794c353c28bfd705", - "sha256:6a8a51f64dae307f6e0c9db752b66a7951e282389d8362cc1d39a56f3feeb31d" - ], -- "markers": "python_version ~= '3.6'", -+ "index": "pypi", - "version": "==2.6.0" - }, - "avocado-framework": { -@@ -50,6 +50,7 @@ - "sha256:106fef6dc37dd8c0e2c0a60d3fca3e77460a48907f335fa28420463a6f799736", - "sha256:23e223426b28491b1ced97dc3bbe183027419dfc7982b4fa2f05d5f3ff10711c" - ], -+ "index": "pypi", - "version": "==0.3.2" - }, - "filelock": { -@@ -57,6 +58,7 @@ - "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59", - "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836" - ], -+ "index": "pypi", - "version": "==3.0.12" - }, - "flake8": { -@@ -88,7 +90,7 @@ - "sha256:54161657e8ffc76596c4ede7080ca68cb02962a2e074a2586b695a93a925d36e", - "sha256:e962bff7440364183203d179d7ae9ad90cb1f2b74dcb84300e88ecc42dca3351" - ], -- "markers": "python_version < '3.7'", -+ "index": "pypi", - "version": "==5.1.4" - }, - "isort": { -@@ -124,7 +126,7 @@ - "sha256:ed361bb83436f117f9917d282a456f9e5009ea12fd6de8742d1a4752c3017e93", - "sha256:f5144c75445ae3ca2057faac03fda5a902eff196702b0a24daf1d6ce0650514b" - ], -- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", -+ "index": "pypi", - "version": "==1.6.0" - }, - "mccabe": { -@@ -136,23 +138,23 @@ - }, - "mypy": { - "hashes": [ -- "sha256:15b948e1302682e3682f11f50208b726a246ab4e6c1b39f9264a8796bb416aa2", -- "sha256:219a3116ecd015f8dca7b5d2c366c973509dfb9a8fc97ef044a36e3da66144a1", -- "sha256:3b1fc683fb204c6b4403a1ef23f0b1fac8e4477091585e0c8c54cbdf7d7bb164", -- "sha256:3beff56b453b6ef94ecb2996bea101a08f1f8a9771d3cbf4988a61e4d9973761", -- "sha256:7687f6455ec3ed7649d1ae574136835a4272b65b3ddcf01ab8704ac65616c5ce", -- "sha256:7ec45a70d40ede1ec7ad7f95b3c94c9cf4c186a32f6bacb1795b60abd2f9ef27", -- "sha256:86c857510a9b7c3104cf4cde1568f4921762c8f9842e987bc03ed4f160925754", -- "sha256:8a627507ef9b307b46a1fea9513d5c98680ba09591253082b4c48697ba05a4ae", -- "sha256:8dfb69fbf9f3aeed18afffb15e319ca7f8da9642336348ddd6cab2713ddcf8f9", -- "sha256:a34b577cdf6313bf24755f7a0e3f3c326d5c1f4fe7422d1d06498eb25ad0c600", -- "sha256:a8ffcd53cb5dfc131850851cc09f1c44689c2812d0beb954d8138d4f5fc17f65", -- "sha256:b90928f2d9eb2f33162405f32dde9f6dcead63a0971ca8a1b50eb4ca3e35ceb8", -- "sha256:c56ffe22faa2e51054c5f7a3bc70a370939c2ed4de308c690e7949230c995913", -- "sha256:f91c7ae919bbc3f96cd5e5b2e786b2b108343d1d7972ea130f7de27fdd547cf3" -+ "sha256:00cb1964a7476e871d6108341ac9c1a857d6bd20bf5877f4773ac5e9d92cd3cd", -+ "sha256:127de5a9b817a03a98c5ae8a0c46a20dc44442af6dcfa2ae7f96cb519b312efa", -+ "sha256:1f3976a945ad7f0a0727aafdc5651c2d3278e3c88dee94e2bf75cd3386b7b2f4", -+ "sha256:2f8c098f12b402c19b735aec724cc9105cc1a9eea405d08814eb4b14a6fb1a41", -+ "sha256:4ef13b619a289aa025f2273e05e755f8049bb4eaba6d703a425de37d495d178d", -+ "sha256:5d142f219bf8c7894dfa79ebfb7d352c4c63a325e75f10dfb4c3db9417dcd135", -+ "sha256:62eb5dd4ea86bda8ce386f26684f7f26e4bfe6283c9f2b6ca6d17faf704dcfad", -+ "sha256:64c36eb0936d0bfb7d8da49f92c18e312ad2e3ed46e5548ae4ca997b0d33bd59", -+ "sha256:75eed74d2faf2759f79c5f56f17388defd2fc994222312ec54ee921e37b31ad4", -+ "sha256:974bebe3699b9b46278a7f076635d219183da26e1a675c1f8243a69221758273", -+ "sha256:a5e5bb12b7982b179af513dddb06fca12285f0316d74f3964078acbfcf4c68f2", -+ "sha256:d31291df31bafb997952dc0a17ebb2737f802c754aed31dd155a8bfe75112c57", -+ "sha256:d3b4941de44341227ece1caaf5b08b23e42ad4eeb8b603219afb11e9d4cfb437", -+ "sha256:eadb865126da4e3c4c95bdb47fe1bb087a3e3ea14d39a3b13224b8a4d9f9a102" - ], - "index": "pypi", -- "version": "==0.770" -+ "version": "==0.780" - }, - "mypy-extensions": { - "hashes": [ -@@ -166,7 +168,7 @@ - "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5", - "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a" - ], -- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", -+ "index": "pypi", - "version": "==20.9" - }, - "pluggy": { -@@ -174,7 +176,7 @@ - "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", - "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d" - ], -- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", -+ "index": "pypi", - "version": "==0.13.1" - }, - "py": { -@@ -182,7 +184,7 @@ - "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3", - "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a" - ], -- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", -+ "index": "pypi", - "version": "==1.10.0" - }, - "pycodestyle": { -@@ -205,7 +207,7 @@ - "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f", - "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e" - ], -- "markers": "python_version >= '3.5'", -+ "index": "pypi", - "version": "==2.9.0" - }, - "pylint": { -@@ -221,13 +223,21 @@ - "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", - "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b" - ], -- "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", -+ "index": "pypi", - "version": "==2.4.7" - }, - "qemu": { - "editable": true, - "path": "." - }, -+ "setuptools": { -+ "hashes": [ -+ "sha256:22c7348c6d2976a52632c67f7ab0cdf40147db7789f9aed18734643fe9cf3373", -+ "sha256:4ce92f1e1f8f01233ee9952c04f6b81d1e02939d6e1b488428154974a4d0783e" -+ ], -+ "markers": "python_version >= '3.6'", -+ "version": "==59.6.0" -+ }, - "six": { - "hashes": [ - "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", -@@ -294,19 +304,21 @@ - "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342", - "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84" - ], -- "markers": "python_version < '3.8'", -+ "index": "pypi", - "version": "==3.10.0.0" - }, - "urwid": { - "hashes": [ - "sha256:588bee9c1cb208d0906a9f73c613d2bd32c3ed3702012f51efe318a3f2127eae" - ], -+ "index": "pypi", - "version": "==2.1.2" - }, - "urwid-readline": { - "hashes": [ - "sha256:018020cbc864bb5ed87be17dc26b069eae2755cb29f3a9c569aac3bded1efaf4" - ], -+ "index": "pypi", - "version": "==0.13" - }, - "virtualenv": { -@@ -314,7 +326,7 @@ - "sha256:14fdf849f80dbb29a4eb6caa9875d476ee2a5cf76a5f5415fa2f1606010ab467", - "sha256:2b0126166ea7c9c3661f5b8e06773d28f83322de7a3ff7d06f0aed18c9de6a76" - ], -- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", -+ "index": "pypi", - "version": "==20.4.7" - }, - "wrapt": { -@@ -328,7 +340,7 @@ - "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76", - "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098" - ], -- "markers": "python_version < '3.10'", -+ "index": "pypi", - "version": "==3.4.1" - } - } -diff --git a/python/setup.cfg b/python/setup.cfg -index 417e937839b85eecd752b29ad7df..4f4f20571f304507e20ce16cee66 100644 ---- a/python/setup.cfg -+++ b/python/setup.cfg -@@ -41,7 +41,7 @@ devel = - flake8 >= 3.6.0 - fusepy >= 2.0.4 - isort >= 5.1.2 -- mypy >= 0.770 -+ mypy >= 0.780 - pylint >= 2.8.0 - tox >= 3.18.0 - urwid >= 2.1.2 diff --git a/qcow2-simple-case-support-for-downgradin.patch b/qcow2-simple-case-support-for-downgradin.patch deleted file mode 100644 index 93478584..00000000 --- a/qcow2-simple-case-support-for-downgradin.patch +++ /dev/null @@ -1,108 +0,0 @@ -From: Vladimir Sementsov-Ogievskiy -Date: Thu, 23 Dec 2021 17:01:37 +0100 -Subject: qcow2: simple case support for downgrading of qcow2 images with zstd - -Git-commit: 083c24561a1f52829b5b31a0fb2f7c77efb979c0 - -If image doesn't have any compressed cluster we can easily switch to -zlib compression, which may allow to downgrade the image. - -That's mostly needed to support IMGOPTS='compression_type=zstd' in some -iotests which do qcow2 downgrade. - -While being here also fix checkpatch complain against '#' in printf -formatting. - -Signed-off-by: Vladimir Sementsov-Ogievskiy -Reviewed-by: Max Reitz -Message-Id: <20211223160144.1097696-13-vsementsov@virtuozzo.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - block/qcow2.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 56 insertions(+), 2 deletions(-) - -diff --git a/block/qcow2.c b/block/qcow2.c -index d50901675699ef3806bacb780ee0..c8115e1cba0f8ed09254f7889d38 100644 ---- a/block/qcow2.c -+++ b/block/qcow2.c -@@ -5279,6 +5279,38 @@ static int qcow2_load_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, - return bs->drv->bdrv_co_preadv_part(bs, offset, qiov->size, qiov, 0, 0); - } - -+static int qcow2_has_compressed_clusters(BlockDriverState *bs) -+{ -+ int64_t offset = 0; -+ int64_t bytes = bdrv_getlength(bs); -+ -+ if (bytes < 0) { -+ return bytes; -+ } -+ -+ while (bytes != 0) { -+ int ret; -+ QCow2SubclusterType type; -+ unsigned int cur_bytes = MIN(INT_MAX, bytes); -+ uint64_t host_offset; -+ -+ ret = qcow2_get_host_offset(bs, offset, &cur_bytes, &host_offset, -+ &type); -+ if (ret < 0) { -+ return ret; -+ } -+ -+ if (type == QCOW2_SUBCLUSTER_COMPRESSED) { -+ return 1; -+ } -+ -+ offset += cur_bytes; -+ bytes -= cur_bytes; -+ } -+ -+ return 0; -+} -+ - /* - * Downgrades an image's version. To achieve this, any incompatible features - * have to be removed. -@@ -5336,9 +5368,10 @@ static int qcow2_downgrade(BlockDriverState *bs, int target_version, - * the first place; if that happens nonetheless, returning -ENOTSUP is the - * best thing to do anyway */ - -- if (s->incompatible_features) { -+ if (s->incompatible_features & ~QCOW2_INCOMPAT_COMPRESSION) { - error_setg(errp, "Cannot downgrade an image with incompatible features " -- "%#" PRIx64 " set", s->incompatible_features); -+ "0x%" PRIx64 " set", -+ s->incompatible_features & ~QCOW2_INCOMPAT_COMPRESSION); - return -ENOTSUP; - } - -@@ -5356,6 +5389,27 @@ static int qcow2_downgrade(BlockDriverState *bs, int target_version, - return ret; - } - -+ if (s->incompatible_features & QCOW2_INCOMPAT_COMPRESSION) { -+ ret = qcow2_has_compressed_clusters(bs); -+ if (ret < 0) { -+ error_setg(errp, "Failed to check block status"); -+ return -EINVAL; -+ } -+ if (ret) { -+ error_setg(errp, "Cannot downgrade an image with zstd compression " -+ "type and existing compressed clusters"); -+ return -ENOTSUP; -+ } -+ /* -+ * No compressed clusters for now, so just chose default zlib -+ * compression. -+ */ -+ s->incompatible_features &= ~QCOW2_INCOMPAT_COMPRESSION; -+ s->compression_type = QCOW2_COMPRESSION_TYPE_ZLIB; -+ } -+ -+ assert(s->incompatible_features == 0); -+ - s->qcow_version = target_version; - ret = qcow2_update_header(bs); - if (ret < 0) { diff --git a/qemu-6.2.0.tar.xz b/qemu-6.2.0.tar.xz deleted file mode 100644 index 71e3feb9..00000000 --- a/qemu-6.2.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:68e15d8e45ac56326e0b9a4afa8b49a3dfe8aba3488221d098c84698bca65b45 -size 115667324 diff --git a/qemu-6.2.0.tar.xz.sig b/qemu-6.2.0.tar.xz.sig deleted file mode 100644 index a5a55a0f204a91e2096bcafce81ff563581a0c18b1cb4adfe115c100e7c384ac..0000000000000000000000000000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 310 zcmV-60m=S}0W$;u0SW*e79j-AtjXb3H0!IlEkB?$Q_0Tp2(^R-0%5rev;YbT5HnNB z&hZGfgvbB~{0ekdLWQIRVEmp3E{xdAgo0Sgl{bU>@H-rC6@v|QkZ#Ez^_Fa5#??D< zl-9^I=T6`qy|Mh4C&Yv%aS_|tvDv~ReU0Lbt(`0Ch5QJ_FHX(*@RHq&VZ=}EWE4k0 zAPd7}Ifu3?$tEuR+DO6+OX<#2`PARjY*biDAt}e7^-jPd{bIT`tJF7n+#oC>=VU@k z9KO(U;7fQwLs0c3R~k?i(2nO9Fihk;c@-$0h?$n?jMqoWXgi#uZa5k}h|7wHbH0NT zle~viha&52jrcTmfXGxMdQ%nadu}Q068ID?wLv`$dYjd9^_MKo%xPhwrRXT#xjeU7 IZ(0os0CB^U0{{R3 diff --git a/qemu-7.0.0.tar.xz b/qemu-7.0.0.tar.xz new file mode 100644 index 00000000..b3d07999 --- /dev/null +++ b/qemu-7.0.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6b375c7951f728402798b0baabb2d86478ca53d44cedbefabbe1c46bf46f839 +size 125117636 diff --git a/qemu-7.0.0.tar.xz.sig b/qemu-7.0.0.tar.xz.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..8c1cf7f689c39bda78ae81c0c2ea41d30bb37abd0415d1fad4af486cdbf1d25b GIT binary patch literal 310 zcmV-60m=S}0W$;u0SW*e79j-AtjXb3H0!IlEkB?$Q_0Tp2(^R-0%Bh`xc~|Y5HnNB z&hZGfgb2Qo>n?qq#FtcK?%J1M`57$d<5s4s^dM^DOFan6r7&emZOm4-%ZUJnW>UKQ67~9u z`1dB3mw%GVY2%hONrGTR@vw$qX6W0)8ipBqc!=NPemFO$nDqsoKRv7=*U9c29rk3r z3s~!SEzfG~mSH{Fno3z){!WUgWoy@E&}&1FRoS(BrF71Y&^-war7bWwU@@nO)LxyE IeMOV~0+AS%pa1{> literal 0 HcmV?d00001 diff --git a/qemu-binfmt-conf-Modify-default-path.patch b/qemu-binfmt-conf-Modify-default-path.patch index d80af9d3..d96cfb22 100644 --- a/qemu-binfmt-conf-Modify-default-path.patch +++ b/qemu-binfmt-conf-Modify-default-path.patch @@ -13,7 +13,7 @@ Signed-off-by: Andreas Färber 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh -index 7de996d536eaf9c41255ae9695a5..cb06245a834f9e8f2bb0464a25ce 100755 +index 9cb723f44355c55d21eeeb2c1b7b..02eedc7c92d788637385ef3eba19 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -334,7 +334,7 @@ BINFMT_SET=qemu_register_interpreter diff --git a/qemu-binfmt-conf.sh-should-use-F-as-shor.patch b/qemu-binfmt-conf.sh-should-use-F-as-shor.patch deleted file mode 100644 index c9aee1cd..00000000 --- a/qemu-binfmt-conf.sh-should-use-F-as-shor.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Martin Wilck -Date: Tue, 14 Sep 2021 14:10:58 -0300 -Subject: =?UTF-8?q?qemu-binfmt-conf.sh=20should=20use=20"-F"=20as=20short?= - =?UTF-8?q?=20option=20for=20"--qemu-suffix".=0AFix=20the=20getopt=20call?= - =?UTF-8?q?=20to=20make=20this=20work.?= - -Git-commit: 00000000000000000000000000000000000000000 -References: bsc#1186256 - -Signed-off-by: Martin Wilck ---- - scripts/qemu-binfmt-conf.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh -index cb06245a834f9e8f2bb0464a25ce..53be2ba047fa3fba9d9b61030ab3 100755 ---- a/scripts/qemu-binfmt-conf.sh -+++ b/scripts/qemu-binfmt-conf.sh -@@ -340,7 +340,7 @@ PERSISTENT=no - PRESERVE_ARG0=no - QEMU_SUFFIX="" - --options=$(getopt -o ds:Q:S:e:hc:p:g: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent:,preserve-argv0: -- "$@") -+options=$(getopt -o ds:Q:S:e:hc:p:g:F: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent:,preserve-argv0: -- "$@") - eval set -- "$options" - - while true ; do diff --git a/qemu-cvs-gettimeofday.patch b/qemu-cvs-gettimeofday.patch index 7bbb404c..b1ed2870 100644 --- a/qemu-cvs-gettimeofday.patch +++ b/qemu-cvs-gettimeofday.patch @@ -11,10 +11,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 3 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index f1cfcc81048695222abc0a0f546d..5da0c1e2be709e7fcbbe34235813 100644 +index f65045efe6a22bb38d0c95dde084..4ba8637359340c3d84953be2347b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -9527,6 +9527,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, +@@ -9754,6 +9754,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, { struct timeval tv; struct timezone tz; diff --git a/qemu-cvs-ioctl_debug.patch b/qemu-cvs-ioctl_debug.patch index e6a737a3..b5d541d6 100644 --- a/qemu-cvs-ioctl_debug.patch +++ b/qemu-cvs-ioctl_debug.patch @@ -13,10 +13,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 5da0c1e2be709e7fcbbe34235813..ad8e36a3e6e37a5cec02dd867776 100644 +index 4ba8637359340c3d84953be2347b..72cb2bbbcc3bf29af6f3f6ee3d85 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -5699,8 +5699,21 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg) +@@ -5700,8 +5700,21 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg) ie = ioctl_entries; for(;;) { if (ie->target_cmd == 0) { diff --git a/qemu-cvs-ioctl_nodirection.patch b/qemu-cvs-ioctl_nodirection.patch index 01714f21..377bd5fb 100644 --- a/qemu-cvs-ioctl_nodirection.patch +++ b/qemu-cvs-ioctl_nodirection.patch @@ -16,10 +16,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 8 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index ad8e36a3e6e37a5cec02dd867776..0a1d99cb44d168d561de4c42e132 100644 +index 72cb2bbbcc3bf29af6f3f6ee3d85..c9adb65a2293e9735341a217a68d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -5744,6 +5744,13 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg) +@@ -5745,6 +5745,13 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg) arg_type++; target_size = thunk_type_size(arg_type, 0); switch(ie->access) { @@ -33,7 +33,7 @@ index ad8e36a3e6e37a5cec02dd867776..0a1d99cb44d168d561de4c42e132 100644 case IOC_R: ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp)); if (!is_error(ret)) { -@@ -5762,6 +5769,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg) +@@ -5763,6 +5770,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg) unlock_user(argptr, arg, 0); ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp)); break; diff --git a/qemu.changes b/qemu.changes index 65e4b92e..5ee346f5 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,168 @@ +------------------------------------------------------------------- +Thu May 26 09:45:14 UTC 2022 - Dario Faggioli + +- Substantial rework of the spec file: + * the 'make check' testsuite now runs in the %check section of + the main package, not in a subpackage + * switched from %setup to %autosetup + * rearranged the content in order to minimize the use of %if, + %ifarch, etc + +------------------------------------------------------------------- +Thu May 26 02:06:42 UTC 2022 - Dario Faggioli + +- Some tests are having issues when run in OBS. They seem to be due to + race conditions, triggered by resource constraints on the OBS workers. + Let's disable them for now, while we investigate and try to fix them. +* Patches added: + Disable-some-tests-that-have-problems-in.patch + +------------------------------------------------------------------- +Tue May 24 19:01:48 UTC 2022 - Dario Faggioli + +- Revert an upstream commit that add some qtests that are problematic + for GCC12+LTO +* Patches added: + Revert-8dcb404bff6d9147765d7dd3e9c849337.patch + +------------------------------------------------------------------- +Tue May 24 16:15:06 UTC 2022 - Dario Faggioli + +- _multibuild: disable the build of qemu-testsuite. We are going + to run 'make check' as part of the %check phase of the main (qemu) + package, so we do not need a dedicated build any longer. + +------------------------------------------------------------------- +Tue May 24 07:33:40 UTC 2022 - Dario Faggioli + +- Get rid of downstream patches breaking s390 modules. Replace + them with the upstream proposed and Acked (but never committed) + solution (bsc#1199015) +* Patches added: + modules-generates-per-target-modinfo.patch + modules-introduces-module_kconfig-direct.patch +* Patches dropped: + Fix-the-module-building-problem-for-s390.patch + modules-quick-fix-a-fundamental-error-in.patch + +------------------------------------------------------------------- +Fri May 20 16:30:12 UTC 2022 - Dario Faggioli + +- backport patches for having coroutine work well when LTO is used +* Patches added: + coroutine-ucontext-use-QEMU_DEFINE_STATI.patch + coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch + coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch + +------------------------------------------------------------------- +Fri May 13 14:02:04 UTC 2022 - Dario Faggioli + +- seabios: drop patch that changes python in python2. Just + go to python3 directly. +* Patches dropped: + seabios-use-python2-explicitly-as-needed.patch + +------------------------------------------------------------------- +Thu May 12 16:32:11 UTC 2022 - Dario Faggioli + +- Make temp dir (for update_git.sh) configurable +- Added new subpackages (audio-dbus, ui-dbus) +- Update to v7.0.0. For full release notese, see: + * https://wiki.qemu.org/ChangeLog/7.0 + Be sure to also check the following pages: + * https://qemu-project.gitlab.io/qemu/about/removed-features.html + * https://qemu-project.gitlab.io/qemu/about/deprecated.html + Some notable changes: + * [ARM] The virt board has gained a new control knob to disable passing a RNG seed in the DTB (dtb-kaslr-seed) + * [ARM] The AST2600 SoC now supports a dummy version of the i3c device + * [ARM] The virt board can now run guests with KVM on hosts with restricted IPA ranges + * [ARM] The virt board now supports virtio-mem-pci + * [ARM] The virt board now supports specifying the guest CPU topology + * [ARM] On the virt board, we now enable PAuth when using KVM or hvf and the host CPU supports it + * [RISC-V] Add support for ratified 1.0 Vector extension + * [RISC-V] Support for the Zve64f and Zve32f extensions + * [RISC-V] Drop support for draft 0.7.1 Vector extension + * [RISC-V] Support Zfhmin and Zfh extensions + * [RISC-V] RISC-V KVM support + * [RISC-V] Mark Hypervisor extension as non experimental + * [RISC-V] Enable Hypervisor extension by default + * [x86] Support for Intel AMX. + * [PCI/PCIe] Q35: fix PCIe device becoming disabled after migration when ACPI based PCI hotplug is used (6b0969f1ec) + * [PCI/PCIe] initial bits of SR/IOV support (250346169) + * [PCI/PCIe] arm/virt: fixed PXB interrupt routing (e609301b45) + * [PCI/PCIe] arm/virt: support for virtio-mem-pci (b1b87327a9) + * [virtiofs] Fix for CVE-2022-0358 - behaviour with supplementary groups and SGID directories + * [virtiofs] Improved security label support + * [virtiofs] The virtiofsd in qemu is now starting to be deprecated; please start using and contributing to Rust virtiofsd + * Patches Added: + intc-exynos4210_gic-replace-snprintf-wit.patch + * Patches dropped: + Python-aqmp-fix-type-definitions-for-myp.patch + acpi-validate-hotplug-selector-on-access.patch + block-backend-Retain-permissions-after-m.patch + brotli-fix-actual-variable-array-paramet.patch + doc-Add-the-SGX-numa-description.patch + hw-i386-amd_iommu-Fix-maybe-uninitialize.patch + hw-intc-exynos4210_gic-provide-more-room.patch + hw-nvme-fix-CVE-2021-3929.patch + hw-nvram-at24-return-0xff-if-1-byte-addr.patch + iotest-065-explicit-compression-type.patch + iotest-214-explicit-compression-type.patch + iotest-302-use-img_info_log-helper.patch + iotest-303-explicit-compression-type.patch + iotest-39-use-_qcow2_dump_header.patch + iotests-60-more-accurate-set-dirty-bit-i.patch + iotests-MRCE-Write-data-to-source.patch + iotests-bash-tests-filter-compression-ty.patch + iotests-common.rc-introduce-_qcow2_dump_.patch + iotests-declare-lack-of-support-for-comp.patch + iotests-drop-qemu_img_verbose-helper.patch + iotests-massive-use-_qcow2_dump_header.patch + iotests-specify-some-unsupported_imgopts.patch + iotests.py-filter-out-successful-output-.patch + iotests.py-img_info_log-rename-imgopts-a.patch + iotests.py-implement-unsupported_imgopts.patch + iotests.py-qemu_img-create-support-IMGOP.patch + iotests.py-rewrite-default-luks-support-.patch + meson-build-all-modules-by-default.patch + numa-Enable-numa-for-SGX-EPC-sections.patch + numa-Support-SGX-numa-in-the-monitor-and.patch + python-aqmp-Fix-negotiation-with-pre-oob.patch + python-aqmp-add-SocketAddrT-to-package-r.patch + python-aqmp-add-__del__-method-to-legacy.patch + python-aqmp-add-_session_guard.patch + python-aqmp-add-socket-bind-step-to-lega.patch + python-aqmp-add-start_server-and-accept-.patch + python-aqmp-copy-type-definitions-from-q.patch + python-aqmp-drop-_bind_hack.patch + python-aqmp-fix-docstring-typo.patch + python-aqmp-fix-race-condition-in-legacy.patch + python-aqmp-handle-asyncio.TimeoutError-.patch + python-aqmp-refactor-_do_accept-into-two.patch + python-aqmp-remove-_new_session-and-_est.patch + python-aqmp-rename-AQMPError-to-QMPError.patch + python-aqmp-rename-accept-to-start_serve.patch + python-aqmp-split-_client_connected_cb-o.patch + python-aqmp-squelch-pylint-warning-for-t.patch + python-aqmp-stop-the-server-during-disco.patch + python-introduce-qmp-shell-wrap-convenie.patch + python-machine-raise-VMLaunchFailure-exc.patch + python-move-qmp-shell-under-the-AQMP-pac.patch + python-move-qmp-utilities-to-python-qemu.patch + python-qmp-switch-qmp-shell-to-AQMP.patch + python-support-recording-QMP-session-to-.patch + python-upgrade-mypy-to-0.780.patch + qcow2-simple-case-support-for-downgradin.patch + qemu-6.2.0.tar.xz + qemu-6.2.0.tar.xz.sig + qemu-binfmt-conf.sh-should-use-F-as-shor.patch + tests-qemu-iotests-040-Skip-TestCommitWi.patch + tests-qemu-iotests-Fix-051-for-binaries-.patch + tests-qemu-iotests-testrunner-Quote-case.patch + tools-virtiofsd-Add-rseq-syscall-to-the-.patch + virtiofsd-Drop-membership-of-all-supplem.patch + block-qdict-Fix-Werror-maybe-uninitializ.patch + ------------------------------------------------------------------- Wed May 11 10:30:34 UTC 2022 - Martin Liška diff --git a/qemu.spec b/qemu.spec index bee1889a..d0250786 100644 --- a/qemu.spec +++ b/qemu.spec @@ -16,12 +16,21 @@ # -# !! IMPORTANT !! See README.PACKAGING before modifying package in any way +%global flavor @BUILD_FLAVOR@%{nil} +%define name_suffix %{nil} -#!ForceMultiversion +%if "%flavor" == "linux-user" + %define name_suffix -linux-user + %define summary_string CPU emulator for user space +%else + %define summary_string Machine emulator and virtualizer +%endif %define _buildshell /bin/bash +%define srcdir %{_builddir}/%buildsubdir +%define blddir %srcdir/build + %define build_x86_firmware 0 %define build_ppc_firmware 0 %define build_opensbi_firmware 0 @@ -30,9 +39,9 @@ %define force_fit_virtio_pxe_rom 1 %if "%{?distribution}" == "" -%define distro private-build + %define distro private-build %else -%define distro %{distribution} + %define distro %{distribution} %endif # So, we have openSUSE:Factory, and we have "ports". In openSUSE:Factory, we @@ -50,60 +59,62 @@ # be available in as many ports as possible (as noarch packages). %ifarch x86_64 aarch64 -%define build_ppc_firmware 1 -# Currently, opensbi does not cross build cleanly on 15.3 and 15.4 -%if ! 0%{?sle_version} -%define build_opensbi_firmware 1 -%endif -%define build_x86_firmware 1 + %define build_ppc_firmware 1 + # Currently, opensbi does not cross build cleanly on 15.3 and 15.4 + %if ! 0%{?sle_version} + %define build_opensbi_firmware 1 + %endif + %define build_x86_firmware 1 %endif %ifarch ppc64 ppc64le -%define build_ppc_firmware 1 -%if ! 0%{?sle_version} -%define build_opensbi_firmware 1 -%endif -# FIXME: Try to enable cross building of x86 firmwares here on PPC + %define build_ppc_firmware 1 + %if ! 0%{?sle_version} + %define build_opensbi_firmware 1 + %endif + # FIXME: Try to enable cross building of x86 firmwares here on PPC %endif %ifarch riscv64 -%define build_opensbi_firmware 1 + %define build_opensbi_firmware 1 %endif %ifarch %ix86 x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 -%define kvm_available 1 -%define with_uring 1 -%define liburing_min_version 1.0 + %define kvm_available 1 + %define with_uring 1 + %define liburing_min_version 1.0 %endif %ifarch %ix86 x86_64 s390x -%define legacy_qemu_kvm 1 + %define legacy_qemu_kvm 1 %endif %ifarch x86_64 aarch64 ppc64le s390x -%define with_rbd 1 + %define with_rbd 1 %endif %ifarch x86_64 ppc64le -%define with_daxctl 1 + %define with_daxctl 1 %endif -# qemu, qemu-linux-user, and qemu-testsuite "flavors" are enabled via OBS Multibuild -%global flavor @BUILD_FLAVOR@%{nil} -%define name_suffix %{nil} -%if "%flavor" == "testsuite" -%define name_suffix -testsuite -%endif -%if "%flavor" == "linux-user" -%define name_suffix -linux-user -%define summary_string CPU emulator for user space -%else -%define summary_string Machine emulator and virtualizer -%endif +# Enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward. +# The following ones need to be > 64K +%define supported_nics_large {e1000 rtl8139} +# The following ones need to be <= 64K +%define supported_nics_small {virtio} +# Though not required, make unsupported pxe roms migration compatable as well +%define unsupported_nics {eepro100 ne2k_pci pcnet} + +%define generic_qemu_description \ +QEMU provides full machine emulation and cross architecture usage. \ +It closely integrates with KVM and Xen virtualization, allowing for \ +excellent performance. Many options are available for defining the \ +emulated environment, including traditional devices, direct host device \ +access, and interfaces specific to virtualization. %bcond_with system_membarrier -%define qemuver 6.2.0 -%define srcver 6.2.0 -%define sbver 1.15.0_0_g2dd4b9b +%define qemuver 7.0.0 +%define srcver 7.0.0 +%define sbver 1.16.0_0_gd239552 %define srcname qemu Name: qemu%{name_suffix} URL: https://www.qemu.org/ @@ -132,14 +143,14 @@ Source14: 50-seabios-256k.json Source15: 60-seabios-128k.json Source200: qemu-rpmlintrc Source201: pkg-split.txt +Source202: DSDT.pcie Source300: bundles.tar.xz Source301: update_git.sh Source302: config.sh Source303: README.PACKAGING # Upstream First -- https://wiki.qemu.org/Contribute/SubmitAPatch # This patch queue is auto-generated - see README.PACKAGING for process - -# Patches applied in base project: +# Patches applied in base project, qemu-opensuse: Patch00000: XXX-dont-dump-core-on-sigabort.patch Patch00001: qemu-binfmt-conf-Modify-default-path.patch Patch00002: qemu-cvs-gettimeofday.patch @@ -167,94 +178,46 @@ Patch00023: tests-qemu-iotests-Triple-timeout-of-i-o.patch Patch00024: tests-Fix-block-tests-to-be-compatible-w.patch Patch00025: xen-ignore-live-parameter-from-xen-save-.patch Patch00026: tests-change-error-message-in-test-162.patch -Patch00027: hw-intc-exynos4210_gic-provide-more-room.patch -Patch00028: configure-only-populate-roms-if-softmmu.patch -Patch00029: pc-bios-s390-ccw-net-avoid-warning-about.patch -Patch00030: roms-change-cross-compiler-naming-to-be-.patch -Patch00031: test-add-mapping-from-arch-of-i686-to-qe.patch -Patch00032: configure-remove-pkgversion-from-CONFIG_.patch -Patch00033: Revert-qht-constify-qht_statistics_init.patch -Patch00034: qht-Revert-some-constification-in-qht.c.patch -Patch00035: meson-install-ivshmem-client-and-ivshmem.patch -Patch00036: Revert-roms-efirom-tests-uefi-test-tools.patch -Patch00037: Makefile-Don-t-check-pc-bios-as-pre-requ.patch -Patch00038: roms-Makefile-add-cross-file-to-qboot-me.patch -Patch00039: usb-Help-compiler-out-to-avoid-a-warning.patch -Patch00040: qom-handle-case-of-chardev-spice-module-.patch -Patch00041: doc-add-our-support-doc-to-the-main-proj.patch -Patch00042: qemu-binfmt-conf.sh-should-use-F-as-shor.patch -Patch00043: modules-quick-fix-a-fundamental-error-in.patch -Patch00044: scsi-generic-replace-logical-block-count.patch -Patch00045: meson-build-all-modules-by-default.patch -Patch00046: acpi-validate-hotplug-selector-on-access.patch -Patch00047: tests-qemu-iotests-Fix-051-for-binaries-.patch -Patch00048: iotests-MRCE-Write-data-to-source.patch -Patch00049: iotests.py-img_info_log-rename-imgopts-a.patch -Patch00050: iotests.py-implement-unsupported_imgopts.patch -Patch00051: iotests-specify-some-unsupported_imgopts.patch -Patch00052: iotests.py-qemu_img-create-support-IMGOP.patch -Patch00053: iotests-drop-qemu_img_verbose-helper.patch -Patch00054: iotests.py-rewrite-default-luks-support-.patch -Patch00055: iotest-303-explicit-compression-type.patch -Patch00056: iotest-065-explicit-compression-type.patch -Patch00057: iotests.py-filter-out-successful-output-.patch -Patch00058: iotest-302-use-img_info_log-helper.patch -Patch00059: qcow2-simple-case-support-for-downgradin.patch -Patch00060: iotests-common.rc-introduce-_qcow2_dump_.patch -Patch00061: iotests-massive-use-_qcow2_dump_header.patch -Patch00062: iotest-39-use-_qcow2_dump_header.patch -Patch00063: iotests-bash-tests-filter-compression-ty.patch -Patch00064: iotests-60-more-accurate-set-dirty-bit-i.patch -Patch00065: iotest-214-explicit-compression-type.patch -Patch00066: iotests-declare-lack-of-support-for-comp.patch -Patch00067: block-backend-Retain-permissions-after-m.patch -Patch00068: virtiofsd-Drop-membership-of-all-supplem.patch -Patch00069: hw-scsi-megasas-check-for-NULL-frame-in-.patch -Patch00070: hw-nvram-at24-return-0xff-if-1-byte-addr.patch -Patch00071: hw-i386-amd_iommu-Fix-maybe-uninitialize.patch -Patch00072: tools-virtiofsd-Add-rseq-syscall-to-the-.patch -Patch00073: tests-qemu-iotests-040-Skip-TestCommitWi.patch -Patch00074: tests-qemu-iotests-testrunner-Quote-case.patch -Patch00075: Fix-the-module-building-problem-for-s390.patch -Patch00076: scsi-generic-check-for-additional-SG_IO-.patch -Patch00077: hw-nvme-fix-CVE-2021-3929.patch -Patch00078: numa-Enable-numa-for-SGX-EPC-sections.patch -Patch00079: numa-Support-SGX-numa-in-the-monitor-and.patch -Patch00080: doc-Add-the-SGX-numa-description.patch -Patch00081: python-aqmp-Fix-negotiation-with-pre-oob.patch -Patch00082: python-machine-raise-VMLaunchFailure-exc.patch -Patch00083: python-upgrade-mypy-to-0.780.patch -Patch00084: Python-aqmp-fix-type-definitions-for-myp.patch -Patch00085: python-aqmp-add-__del__-method-to-legacy.patch -Patch00086: python-aqmp-copy-type-definitions-from-q.patch -Patch00087: python-aqmp-handle-asyncio.TimeoutError-.patch -Patch00088: python-aqmp-add-SocketAddrT-to-package-r.patch -Patch00089: python-aqmp-fix-docstring-typo.patch -Patch00090: python-aqmp-rename-AQMPError-to-QMPError.patch -Patch00091: python-qmp-switch-qmp-shell-to-AQMP.patch -Patch00092: python-aqmp-add-socket-bind-step-to-lega.patch -Patch00093: python-move-qmp-utilities-to-python-qemu.patch -Patch00094: python-move-qmp-shell-under-the-AQMP-pac.patch -Patch00095: python-introduce-qmp-shell-wrap-convenie.patch -Patch00096: python-support-recording-QMP-session-to-.patch -Patch00097: python-aqmp-add-_session_guard.patch -Patch00098: python-aqmp-rename-accept-to-start_serve.patch -Patch00099: python-aqmp-remove-_new_session-and-_est.patch -Patch00100: python-aqmp-split-_client_connected_cb-o.patch -Patch00101: python-aqmp-squelch-pylint-warning-for-t.patch -Patch00102: python-aqmp-refactor-_do_accept-into-two.patch -Patch00103: python-aqmp-stop-the-server-during-disco.patch -Patch00104: python-aqmp-add-start_server-and-accept-.patch -Patch00105: python-aqmp-fix-race-condition-in-legacy.patch -Patch00106: python-aqmp-drop-_bind_hack.patch +Patch00027: configure-only-populate-roms-if-softmmu.patch +Patch00028: pc-bios-s390-ccw-net-avoid-warning-about.patch +Patch00029: roms-change-cross-compiler-naming-to-be-.patch +Patch00030: test-add-mapping-from-arch-of-i686-to-qe.patch +Patch00031: configure-remove-pkgversion-from-CONFIG_.patch +Patch00032: Revert-qht-constify-qht_statistics_init.patch +Patch00033: qht-Revert-some-constification-in-qht.c.patch +Patch00034: meson-install-ivshmem-client-and-ivshmem.patch +Patch00035: Revert-roms-efirom-tests-uefi-test-tools.patch +Patch00036: Makefile-Don-t-check-pc-bios-as-pre-requ.patch +%ifarch aarch64 +Patch00037: roms-Makefile-add-cross-file-to-qboot-me.patch +%endif +%ifarch %arm %ix86 ppc +Patch00038: usb-Help-compiler-out-to-avoid-a-warning.patch +%endif +Patch00039: qom-handle-case-of-chardev-spice-module-.patch +Patch00040: scsi-generic-replace-logical-block-count.patch +Patch00041: hw-scsi-megasas-check-for-NULL-frame-in-.patch +Patch00042: scsi-generic-check-for-additional-SG_IO-.patch +%if %{legacy_qemu_kvm} +Patch00043: doc-add-our-support-doc-to-the-main-proj.patch +%endif +Patch00044: intc-exynos4210_gic-replace-snprintf-wit.patch +Patch00045: coroutine-ucontext-use-QEMU_DEFINE_STATI.patch +Patch00046: coroutine-use-QEMU_DEFINE_STATIC_CO_TLS.patch +Patch00047: coroutine-win32-use-QEMU_DEFINE_STATIC_C.patch +Patch00048: modules-introduces-module_kconfig-direct.patch +Patch00049: modules-generates-per-target-modinfo.patch +Patch00050: Revert-8dcb404bff6d9147765d7dd3e9c849337.patch +Patch00051: Disable-some-tests-that-have-problems-in.patch # Patches applied in roms/seabios/: -Patch01000: seabios-use-python2-explicitly-as-needed.patch -Patch01001: seabios-switch-to-python3-as-needed.patch -Patch01002: enable-cross-compilation-on-ARM.patch -Patch01003: build-be-explicit-about-mx86-used-note-n.patch +Patch01000: seabios-switch-to-python3-as-needed.patch +Patch01001: enable-cross-compilation-on-ARM.patch +Patch01002: build-be-explicit-about-mx86-used-note-n.patch # Patches applied in roms/ipxe/: Patch02000: ath5k-Add-missing-AR5K_EEPROM_READ-in-at.patch +%if 0%{?patch-possibly-applied-elsewhere} Patch02001: stub-out-the-SAN-req-s-in-int13.patch +%endif Patch02002: ipxe-Makefile-fix-issues-of-build-reprod.patch Patch02003: help-compiler-out-by-initializing-array.patch Patch02004: Silence-GCC-12-spurious-warnings.patch @@ -269,14 +232,9 @@ Patch05000: Makefile-define-endianess-for-cross-buil.patch Patch11000: qboot-add-cross.ini-file-to-handle-aarch.patch # Patches applied in roms/opensbi/: Patch13000: Makefile-fix-build-with-binutils-2.38.patch -# Patches applied in roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/: -Patch27000: brotli-fix-actual-variable-array-paramet.patch - -# Please do not add patches manually here. - +# Please, do not add patches manually here BuildRoot: %{_tmppath}/%{name}-%{version}-build - -# Common BuildRequires listed here: +# Build dependencies common to qemu and qemu-linux-user packages BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: meson @@ -284,6 +242,7 @@ BuildRequires: ninja >= 1.7 BuildRequires: python3-base >= 3.6 BuildRequires: python3-setuptools %if "%{name}" == "qemu-linux-user" +# Build dependencies exclusive to the qemu-linux-user package BuildRequires: glib2-devel-static >= 2.56 BuildRequires: glibc-devel-static BuildRequires: pcre-devel-static @@ -292,16 +251,9 @@ BuildRequires: zlib-devel-static %if 0%{?qemu_user_space_build:1} #!BuildIgnore: post-build-checks %endif - -%description -QEMU provides CPU emulation along with other related capabilities. This package -provides programs to run user space binaries and libraries meant for another -architecture. The syscall interface is intercepted and execution below the -syscall layer occurs on the native hardware and operating system. - -# above section is for qemu-linux-user -# ------------------------------------------------------------------------ +# End of build dependencies for qemu-linux-user %else +# Build dependencies exclusive to the qemu package %if %{build_x86_firmware} BuildRequires: acpica BuildRequires: binutils-devel @@ -326,6 +278,28 @@ BuildRequires: cross-ppc64-binutils BuildRequires: cross-ppc64-gcc%gcc_version %endif %endif +%if 0%{?with_daxctl} +BuildRequires: pkgconfig(libndctl) +%endif +%ifnarch %arm s390x +BuildRequires: libnuma-devel +%endif +%ifarch x86_64 +BuildRequires: pkgconfig(libpmem) +%endif +%if 0%{?with_rbd} +BuildRequires: librbd-devel +%endif +%if 0%{?with_uring} +BuildRequires: pkgconfig(liburing) >= %liburing_min_version +%endif +%if %{kvm_available} +BuildRequires: pkgconfig(udev) +%endif +%ifarch x86_64 +BuildRequires: xen-devel >= 4.2 +%endif +BuildRequires: Mesa-devel BuildRequires: bison BuildRequires: brlapi-devel BuildRequires: flex @@ -334,6 +308,15 @@ BuildRequires: libattr-devel BuildRequires: libbz2-devel BuildRequires: libfdt-devel >= 1.4.2 BuildRequires: libgcrypt-devel >= 1.8.0 +BuildRequires: lzfse-devel +BuildRequires: multipath-tools-devel +BuildRequires: pkgconfig +BuildRequires: python3-Sphinx +BuildRequires: rdma-core-devel +BuildRequires: snappy-devel +BuildRequires: update-desktop-files +BuildRequires: usbredir-devel >= 0.6 +BuildRequires: xfsprogs-devel BuildRequires: pkgconfig(alsa) BuildRequires: pkgconfig(epoxy) BuildRequires: pkgconfig(gbm) @@ -341,67 +324,40 @@ BuildRequires: pkgconfig(glib-2.0) >= 2.56 BuildRequires: pkgconfig(glusterfs-api) >= 3 BuildRequires: pkgconfig(gnutls) >= 3.5.18 BuildRequires: pkgconfig(gtk+-3.0) >= 3.22 +BuildRequires: pkgconfig(jack) BuildRequires: pkgconfig(libcacard) >= 2.5.1 BuildRequires: pkgconfig(libcap-ng) BuildRequires: pkgconfig(libcurl) >= 7.29 BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libiscsi) >= 1.9.0 BuildRequires: pkgconfig(libjpeg) -BuildRequires: pkgconfig(libsasl2) -%if 0%{?with_daxctl} -BuildRequires: pkgconfig(libndctl) -%endif BuildRequires: pkgconfig(libnfs) >= 1.9.3 -%ifnarch %arm s390x -BuildRequires: libnuma-devel -%endif -BuildRequires: pkgconfig(pixman-1) >= 0.21.8 -%ifarch x86_64 -BuildRequires: pkgconfig(libpmem) -%endif -BuildRequires: pkgconfig(jack) BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(libpulse) -%if 0%{?with_rbd} -BuildRequires: librbd-devel -%endif -BuildRequires: Mesa-devel +BuildRequires: pkgconfig(libsasl2) BuildRequires: pkgconfig(libseccomp) >= 2.3.0 BuildRequires: pkgconfig(libssh) >= 0.8.7 -BuildRequires: pkgconfig(slirp) >= 4.2.0 -BuildRequires: pkgconfig(spice-server) >= 0.12.5 -%if 0%{?with_uring} -BuildRequires: pkgconfig(liburing) >= %liburing_min_version -%endif -BuildRequires: lzfse-devel -BuildRequires: multipath-tools-devel -BuildRequires: pkgconfig -BuildRequires: python3-Sphinx -BuildRequires: rdma-core-devel -BuildRequires: snappy-devel BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(libusb-1.0) >= 1.0.13 +BuildRequires: pkgconfig(libzstd) BuildRequires: pkgconfig(lzo2) BuildRequires: pkgconfig(ncurses) +BuildRequires: pkgconfig(pixman-1) >= 0.21.8 +BuildRequires: pkgconfig(slirp) >= 4.2.0 BuildRequires: pkgconfig(spice-protocol) >= 0.12.3 +BuildRequires: pkgconfig(spice-server) >= 0.12.5 BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(vdeplug) -BuildRequires: pkgconfig(xkbcommon) -%{?systemd_ordering} -%if %{kvm_available} -BuildRequires: pkgconfig(udev) -%endif -BuildRequires: update-desktop-files -BuildRequires: usbredir-devel >= 0.6 BuildRequires: pkgconfig(virglrenderer) >= 0.4.1 BuildRequires: pkgconfig(vte-2.91) -%ifarch x86_64 -BuildRequires: xen-devel >= 4.2 -%endif -BuildRequires: xfsprogs-devel -BuildRequires: pkgconfig(libzstd) +BuildRequires: pkgconfig(xkbcommon) BuildRequires: pkgconfig(zlib) +%{?systemd_ordering} +# End of build dependencies for qemu +%endif %if "%{name}" == "qemu" +# Required, recommended, etc for the qemu package (note that there's basically +# none of these for the qemu-linux-user package). Requires: group(kvm) Requires: group(qemu) Requires: user(qemu) @@ -433,11 +389,8 @@ Requires: qemu-arm Suggests: qemu-arm %endif Recommends: kvm_stat +# End of "if kvm_available" %endif -Recommends: qemu-block-curl -Recommends: qemu-ksm = %{qemuver} -Recommends: qemu-tools -Recommends: qemu-ui-curses %ifarch s390x Recommends: qemu-hw-s390x-virtio-gpu-ccw %else @@ -450,1504 +403,103 @@ Recommends: qemu-hw-usb-redirect Recommends: qemu-hw-usb-smartcard Recommends: qemu-ui-gtk Recommends: qemu-ui-spice-app +# End of "ifarch s390x" %endif +%if 0%{?with_rbd} +Suggests: qemu-block-rbd +%endif +Recommends: qemu-block-curl +Recommends: qemu-ksm = %{qemuver} +Recommends: qemu-tools +Recommends: qemu-ui-curses +Suggests: qemu-accel-qtest Suggests: qemu-block-dmg Suggests: qemu-block-gluster Suggests: qemu-block-iscsi Suggests: qemu-block-nfs -%if 0%{?with_rbd} -Suggests: qemu-block-rbd -%endif Suggests: qemu-block-ssh Suggests: qemu-chardev-baum Suggests: qemu-extra -Suggests: qemu-skiboot Suggests: qemu-lang Suggests: qemu-microvm +Suggests: qemu-skiboot Suggests: qemu-vhost-user-gpu -Suggests: qemu-accel-qtest Obsoletes: qemu-audio-oss < %{qemuver} Obsoletes: qemu-audio-sdl < %{qemuver} Obsoletes: qemu-ui-sdl < %{qemuver} +# End of Requires:, Recommends, Suggests: and Obsoletes: for qemu +%endif -%define generic_qemu_description QEMU provides full machine emulation and cross architecture usage. It closely\ -integrates with KVM and Xen virtualization, allowing for excellent performance.\ -Many options are available for defining the emulated environment, including\ -traditional devices, direct host device access, and interfaces specific to\ -virtualization. +%if "%{name}" == "qemu-linux-user" +# Description and files for the qemu-linux-user package %description -%{generic_qemu_description} +QEMU provides CPU emulation along with other related capabilities. This package +provides programs to run user space binaries and libraries meant for another +architecture. The syscall interface is intercepted and execution below the +syscall layer occurs on the native hardware and operating system. -This package acts as an umbrella package to the other QEMU sub-packages. - -%package x86 -Summary: Machine emulator and virtualizer for x86 architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Requires: qemu-accel-tcg-x86 -Requires: qemu-ipxe -Requires: qemu-seabios -Requires: qemu-sgabios -Requires: qemu-vgabios -Recommends: ovmf -Recommends: qemu-microvm -Recommends: qemu-ovmf-x86_64 - -%description x86 -%{generic_qemu_description} - -This package provides i386 and x86_64 emulation. - -%package ppc -Summary: Machine emulator and virtualizer for Power architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Requires: qemu-SLOF -Recommends: qemu-ipxe -Recommends: qemu-vgabios - -%description ppc -%{generic_qemu_description} - -This package provides ppc and ppc64 emulation. - -%package s390x -Summary: Machine emulator and virtualizer for S/390 architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Provides: qemu-s390 = %{qemuver} -Obsoletes: qemu-s390 < %{qemuver} - -%description s390x -%{generic_qemu_description} - -This package provides s390x emulation. - -%package arm -Summary: Machine emulator and virtualizer for ARM architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Recommends: ovmf -Recommends: qemu-ipxe -Recommends: qemu-uefi-aarch64 -Recommends: qemu-vgabios - -%description arm -%{generic_qemu_description} - -This package provides arm emulation. - -%package extra -Summary: Machine emulator and virtualizer for "extra" architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Recommends: qemu-ipxe -Recommends: qemu-skiboot -Recommends: qemu-vgabios - -%description extra -%{generic_qemu_description} - -This package provides some lesser used emulations, including alpha, m68k, -mips, sparc, and xtensa. (The term "extra" is juxtapositioned against more -popular QEMU packages which are dedicated to a single architecture.) - -%if %{legacy_qemu_kvm} -%package kvm -Summary: Wrapper to enable KVM acceleration under QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%ifarch %ix86 x86_64 -Requires: qemu-x86 = %{qemuver} -%endif -%ifarch s390x -Requires: qemu-s390x = %{qemuver} -%endif -Provides: kvm = %{qemuver} -Obsoletes: kvm < %{qemuver} - -%description kvm -%{generic_qemu_description} - -This package provides a symlink to the main QEMU emulator used for KVM -virtualization. The symlink is named qemu-kvm, which causes the QEMU program -to enable the KVM accelerator, due to the name reference ending with 'kvm'. -This package is an artifact of the early origins of QEMU, and is deprecated. -%endif - -%package lang -Summary: Translations for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 - -%description lang -This package contains a few language translations, particularly for the -graphical user interface components that come with QEMU. The bulk of strings -in QEMU are not localized. +%files +%defattr(-, root, root) +%doc README.rst VERSION +%license COPYING COPYING.LIB LICENSE +%_bindir/qemu-aarch64 +%_bindir/qemu-aarch64_be +%_bindir/qemu-alpha +%_bindir/qemu-arm +%_bindir/qemu-armeb +%_bindir/qemu-cris +%_bindir/qemu-hexagon +%_bindir/qemu-hppa +%_bindir/qemu-i386 +%_bindir/qemu-m68k +%_bindir/qemu-microblaze +%_bindir/qemu-microblazeel +%_bindir/qemu-mips +%_bindir/qemu-mips64 +%_bindir/qemu-mips64el +%_bindir/qemu-mipsel +%_bindir/qemu-mipsn32 +%_bindir/qemu-mipsn32el +%_bindir/qemu-nios2 +%_bindir/qemu-or1k +%_bindir/qemu-ppc +%_bindir/qemu-ppc64 +%_bindir/qemu-ppc64le +%_bindir/qemu-riscv32 +%_bindir/qemu-riscv64 +%_bindir/qemu-s390x +%_bindir/qemu-sh4 +%_bindir/qemu-sh4eb +%_bindir/qemu-sparc +%_bindir/qemu-sparc32plus +%_bindir/qemu-sparc64 +%_bindir/qemu-x86_64 +%_bindir/qemu-xtensa +%_bindir/qemu-xtensaeb +%_bindir/qemu-binfmt +%_bindir/qemu-*-binfmt +%_sbindir/qemu-binfmt-conf.sh +# End of package description and files for qemu-linux-user +%else +# Description and files for the qemu package and for all its subpackages # Modules need to match {qemu-system-*,qemu-img} version. # We cannot have qemu and qemu-tools require them in the right version, # as that would drag in the dependencies the modules are supposed to avoid. # Nor can we have modules require the right version of qemu and qemu-tools # as Xen reuses our qemu-tools but does not want our qemu and qemu-x86. +# FIXME: Is it still true that Xen does not want our qemu and qemu-x86 ?!? %define qemu_module_conflicts \ Conflicts: %name < %{qemuver}-%{release} \ Conflicts: %name > %{qemuver}-%{release} \ Conflicts: qemu-tools < %{qemuver}-%{release} \ Conflicts: qemu-tools > %{qemuver}-%{release} -%package audio-alsa -Summary: ALSA based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-alsa -This package contains a module for ALSA based audio support for QEMU. - -%package audio-pa -Summary: Pulse Audio based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-pa -This package contains a module for Pulse Audio based audio support for QEMU. - -%package audio-jack -Summary: JACK based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-jack -This package contains a module for JACK based audio support for QEMU. - -%package audio-spice -Summary: Spice based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/05 -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description audio-spice -This package contains a module for Spice based audio support for QEMU. - -%package audio-oss -Summary: OSS based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-oss -This package contains a module for OSS based audio support for QEMU. - -%package block-curl -Summary: cURL block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-curl -This package contains a module for accessing network-based image files over -a network connection from qemu-img tool and QEMU system emulation. - -%package block-dmg -Summary: DMG block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-dmg -This package contains a module for accessing Mac OS X image files from -qemu-img tool and QEMU system emulation. - -%package block-gluster -Summary: GlusterFS block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-gluster -This package contains a module for accessing network-based image files over a -GlusterFS network connection from qemu-img tool and QEMU system emulation. - -%package block-iscsi -Summary: iSCSI block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-iscsi -This package contains a module for accessing network-based image files over an -iSCSI network connection from qemu-img tool and QEMU system emulation. - -%package block-nfs -Summary: direct Network File System support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-nfs -This package contains a module for directly accessing nfs based image files -for QEMU. - -%if 0%{?with_rbd} -%package block-rbd -Summary: Rados Block Device (Ceph) support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-rbd -This package contains a module for accessing ceph (rbd,rados) image files -for QEMU. -%endif - -%package block-ssh -Summary: SSH (SFTP) block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-ssh -This package contains a module for accessing network-based image files over an -SSH network connection from qemu-img tool and QEMU system emulation. - -%package chardev-baum -Summary: Baum braille chardev support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/00 -%{qemu_module_conflicts} - -%description chardev-baum -This package contains a module for baum braille chardev support for QEMU. - -%package chardev-spice -Summary: Spice vmc and port chardev support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/08 -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description chardev-spice -This package contains a module for Spice chardev support for QEMU. - -%package hw-display-qxl -Summary: QXL display support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/01 -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description hw-display-qxl -This package contains a module for QXL display support for QEMU. - -%package hw-display-virtio-gpu -Summary: Virtio GPU display support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/04 -%{qemu_module_conflicts} - -%description hw-display-virtio-gpu -This package contains a module for Virtio GPU display support for QEMU. - -%package hw-display-virtio-gpu-pci -Summary: Virtio-gpu pci device for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-hw-display-virtio-gpu -Provides: %name:%_datadir/%name/forsplits/11 -%{qemu_module_conflicts} - -%description hw-display-virtio-gpu-pci -This package contains a module providing the virtio gpu pci device for QEMU. - -%package hw-display-virtio-vga -Summary: Virtio vga device for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/12 -%{qemu_module_conflicts} - -%description hw-display-virtio-vga -This package contains a module providing the virtio vga device for QEMU. - -%package hw-s390x-virtio-gpu-ccw -Summary: S390x virtio-gpu ccw device for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-hw-display-virtio-gpu -Provides: %name:%_datadir/%name/forsplits/13 -%{qemu_module_conflicts} - -%description hw-s390x-virtio-gpu-ccw -This package contains a module providing the s390x virtio gpu ccw device for -QEMU. - -%package hw-usb-redirect -Summary: USB redirection support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/02 -%{qemu_module_conflicts} - -%description hw-usb-redirect -This package contains a module for USB redirection support for QEMU. - -%package hw-usb-smartcard -Summary: USB smartcard support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/03 -%{qemu_module_conflicts} - -%description hw-usb-smartcard -This package contains a modules for USB smartcard support for QEMU. - -%package hw-usb-host -Summary: USB passthrough driver support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/14 -%{qemu_module_conflicts} - -%description hw-usb-host -This package contains a modules for USB passthrough driver for QEMU. - -%package ui-curses -Summary: Curses based UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description ui-curses -This package contains a module for doing curses based UI for QEMU. - -%package ui-gtk -Summary: GTK based UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-ui-opengl -%{qemu_module_conflicts} - -%description ui-gtk -This package contains a module for doing GTK based UI for QEMU. - -%package ui-opengl -Summary: OpenGL based UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/10 -%{qemu_module_conflicts} - -%description ui-opengl -This package contains a module for doing OpenGL based UI for QEMU. - -%package ui-spice-app -Summary: Spice UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-chardev-spice -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description ui-spice-app -This package contains a module for doing Spice based UI for QEMU. - -%package ui-spice-core -Summary: Core Spice support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/09 -Requires: qemu-ui-opengl -# This next Requires is only since virt-manager expects audio support -Requires: qemu-audio-spice -%{qemu_module_conflicts} - -%description ui-spice-core -This package contains a module with core Spice support for QEMU. - -%package vhost-user-gpu -Summary: Vhost user mode virtio-gpu 2D/3D rendering backend for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description vhost-user-gpu -This package contains a vhost user mode virtio-gpu 2D/3D rendering backend for -QEMU. - -%package tools -Summary: Tools for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires(pre): permissions -Requires: group(kvm) -Recommends: multipath-tools -Recommends: qemu-block-curl -%if 0%{?with_rbd} -Recommends: qemu-block-rbd -%endif - -%description tools -This package contains various QEMU related tools, including a bridge helper, -a virtfs helper, ivshmem, disk utilities and scripts for various purposes. - -%package ivshmem-tools -Summary: Inter-VM Shared Memory Tools for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/07 - -%description ivshmem-tools -This package contains a sample shared memory client and server which utilize -QEMU's Inter-VM shared memory device as specified by the ivshmem client-server -protocol specification documented in docs/specs/ivshmem-spec.txt in QEMU source -code. - -%package guest-agent -Summary: Guest agent for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: group(kvm) -Requires(post): udev -Supplements: modalias(acpi*:QEMU0002%3A*) -Supplements: modalias(pci:v00005853d00000001sv*sd*bc*sc*i*) -Supplements: modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*) -%{?systemd_ordering} - -%description guest-agent -This package contains the QEMU guest agent. It is installed in the linux guest -to provide information and control at the guest OS level. - -%if %{build_x86_firmware} -%package microvm -Summary: x86 MicroVM firmware for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -BuildArch: noarch - -%description microvm -This package provides minimal x86 firmware for booting certain guests under -QEMU. qboot provides the minimum resources needed to boot PVH and bzImages. -bios-microvm, created from a minimal seabios configuration, provides slightly -wider support than qboot, but still focuses on quick boot up. - -%package seabios -Summary: x86 Legacy BIOS for QEMU -Group: System/Emulators/PC -Version: %{sbver} -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description seabios -SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS -is the default and legacy BIOS for QEMU. - -%package vgabios -Summary: VGA BIOSes for QEMU -Group: System/Emulators/PC -Version: %{sbver} -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description vgabios -VGABIOS provides the video ROM BIOSes for the following variants of VGA -emulated devices: Std VGA, QXL, Cirrus CLGD 5446 and VMware emulated -video card. For use with QEMU. - -%package sgabios -Summary: Serial Graphics Adapter BIOS for QEMU -Group: System/Emulators/PC -Version: 8 -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description sgabios -The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy -x86 software to communicate with an attached serial console as if a video card -were attached. For use with QEMU. - -%package ipxe -Summary: PXE ROMs for QEMU NICs -Group: System/Emulators/PC -Version: 1.0.0+ -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description ipxe -Provides Preboot Execution Environment (PXE) ROM support for various emulated -network adapters available with QEMU. -%endif - -%if %{build_ppc_firmware} -%package skiboot -Summary: OPAL firmware (aka skiboot), used in booting OpenPOWER systems -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -BuildArch: noarch -Requires(post): update-alternatives -Requires(postun):update-alternatives -Provides: %name:%_datadir/%name/forsplits/06 - -%description skiboot -Provides OPAL (OpenPower Abstraction Layer) firmware, aka skiboot, as -traditionally packaged with QEMU. - -%package SLOF -Summary: Slimline Open Firmware - SLOF -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -BuildArch: noarch - -%description SLOF -Slimline Open Firmware (SLOF) is an implementation of the IEEE 1275 standard. -It can be used as partition firmware for pSeries machines running on QEMU or KVM. -%endif - -%package ksm -Summary: Kernel Samepage Merging services -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires(pre): coreutils -Requires(post): coreutils - -%description ksm -Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that -merges anonymous (private) pages (not pagecache ones). - -This package provides a service file for starting and stopping KSM. - -%package accel-tcg-x86 -Summary: TCG accelerator for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/15 -%{qemu_module_conflicts} - -%description accel-tcg-x86 -TCG is the QEMU binary translator, responsible for converting from target to -host instruction set. - -This package provides the TCG accelerator for QEMU. - -%package accel-qtest -Summary: QTest accelerator for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/16 -%{qemu_module_conflicts} - -%description accel-qtest -QTest is a device emulation testing framework. It is useful to test device -models. - -This package provides QTest accelerator for testing QEMU. - -# above section is for qemu -%else -BuildRequires: bc -BuildRequires: qemu-arm = %{qemuver} -BuildRequires: qemu-audio-alsa = %{qemuver} -BuildRequires: qemu-audio-jack = %{qemuver} -BuildRequires: qemu-audio-oss = %{qemuver} -BuildRequires: qemu-audio-pa = %{qemuver} -BuildRequires: qemu-audio-spice = %{qemuver} -BuildRequires: qemu-block-curl = %{qemuver} -BuildRequires: qemu-block-dmg = %{qemuver} -BuildRequires: qemu-block-gluster = %{qemuver} -BuildRequires: qemu-block-iscsi = %{qemuver} -BuildRequires: qemu-block-nfs = %{qemuver} -%if 0%{?with_rbd} -BuildRequires: qemu-block-rbd = %{qemuver} -%endif -BuildRequires: qemu-accel-qtest = %{qemuver} -BuildRequires: qemu-accel-tcg-x86 = %{qemuver} -BuildRequires: qemu-block-ssh = %{qemuver} -BuildRequires: qemu-chardev-baum = %{qemuver} -BuildRequires: qemu-chardev-spice = %{qemuver} -BuildRequires: qemu-extra = %{qemuver} -BuildRequires: qemu-guest-agent = %{qemuver} -BuildRequires: qemu-hw-display-qxl = %{qemuver} -BuildRequires: qemu-hw-display-virtio-gpu = %{qemuver} -BuildRequires: qemu-hw-usb-host = %{qemuver} -BuildRequires: qemu-hw-usb-redirect = %{qemuver} -BuildRequires: qemu-hw-usb-smartcard = %{qemuver} -BuildRequires: qemu-ipxe = 1.0.0+ -BuildRequires: qemu-ivshmem-tools = %{qemuver} -BuildRequires: qemu-ksm = %{qemuver} -BuildRequires: qemu-lang = %{qemuver} -BuildRequires: qemu-ppc = %{qemuver} -BuildRequires: qemu-s390x = %{qemuver} -BuildRequires: qemu-seabios = %{sbver} -BuildRequires: qemu-sgabios = 8 -BuildRequires: qemu-skiboot = %{qemuver} -BuildRequires: qemu-tools = %{qemuver} -BuildRequires: qemu-ui-curses = %{qemuver} -BuildRequires: qemu-ui-gtk = %{qemuver} -BuildRequires: qemu-ui-opengl = %{qemuver} -BuildRequires: qemu-ui-spice-app = %{qemuver} -BuildRequires: qemu-ui-spice-core = %{qemuver} -BuildRequires: qemu-vgabios = %{sbver} -BuildRequires: qemu-x86 = %{qemuver} - %description -This package records qemu testsuite results and represents successful testing. +%{generic_qemu_description} -# above section is for qemu-testsuite -%endif -# above section is for qemu and qemu-testsuite -%endif - -# ======================================================================== - -%prep -%setup -q -n %{srcname}-%{expand:%%(SV=%{srcver};echo ${SV%%%%+git*})} -%patch00000 -p1 -%patch00001 -p1 -%patch00002 -p1 -%patch00003 -p1 -%patch00004 -p1 -%patch00005 -p1 -%patch00006 -p1 -%patch00007 -p1 -%patch00008 -p1 -%patch00009 -p1 -%patch00010 -p1 -%patch00011 -p1 -%patch00012 -p1 -%patch00013 -p1 -%patch00014 -p1 -%patch00015 -p1 -%patch00016 -p1 -%patch00017 -p1 -%patch00018 -p1 -%patch00019 -p1 -%patch00020 -p1 -%patch00021 -p1 -%patch00022 -p1 -%patch00023 -p1 -%patch00024 -p1 -%patch00025 -p1 -%patch00026 -p1 -%patch00027 -p1 -%patch00028 -p1 -%patch00029 -p1 -%patch00030 -p1 -%patch00031 -p1 -%patch00032 -p1 -%patch00033 -p1 -%patch00034 -p1 -%patch00035 -p1 -%patch00036 -p1 -%patch00037 -p1 -%ifarch aarch64 -%patch00038 -p1 -%endif -%ifarch %arm %ix86 ppc -%patch00039 -p1 -%endif -%patch00040 -p1 -%if %{legacy_qemu_kvm} -%patch00041 -p1 -%endif -%patch00042 -p1 -%patch00043 -p1 -%patch00044 -p1 -%patch00045 -p1 -%patch00046 -p1 -%patch00047 -p1 -%patch00048 -p1 -%patch00049 -p1 -%patch00050 -p1 -%patch00051 -p1 -%patch00052 -p1 -%patch00053 -p1 -%patch00054 -p1 -%patch00055 -p1 -%patch00056 -p1 -%patch00057 -p1 -%patch00058 -p1 -%patch00059 -p1 -%patch00060 -p1 -%patch00061 -p1 -%patch00062 -p1 -%patch00063 -p1 -%patch00064 -p1 -%patch00065 -p1 -%patch00066 -p1 -%patch00067 -p1 -%patch00068 -p1 -%patch00069 -p1 -%patch00070 -p1 -%patch00071 -p1 -%patch00072 -p1 -%patch00073 -p1 -%patch00074 -p1 -%patch00075 -p1 -%patch00076 -p1 -%patch00077 -p1 -%patch00078 -p1 -%patch00079 -p1 -%patch00080 -p1 -%patch00081 -p1 -%patch00082 -p1 -%patch00083 -p1 -%patch00084 -p1 -%patch00085 -p1 -%patch00086 -p1 -%patch00087 -p1 -%patch00088 -p1 -%patch00089 -p1 -%patch00090 -p1 -%patch00091 -p1 -%patch00092 -p1 -%patch00093 -p1 -%patch00094 -p1 -%patch00095 -p1 -%patch00096 -p1 -%patch00097 -p1 -%patch00098 -p1 -%patch00099 -p1 -%patch00100 -p1 -%patch00101 -p1 -%patch00102 -p1 -%patch00103 -p1 -%patch00104 -p1 -%patch00105 -p1 -%patch00106 -p1 -%patch01000 -p1 -%patch01001 -p1 -%patch01002 -p1 -%patch01003 -p1 -%patch02000 -p1 -%if 0%{?patch-possibly-applied-elsewhere} -%patch02001 -p1 -%endif -%patch02002 -p1 -%patch02003 -p1 -%patch02004 -p1 -%patch03000 -p1 -%patch03001 -p1 -%patch04000 -p1 -%patch05000 -p1 -%patch11000 -p1 -%patch13000 -p1 -%patch27000 -p1 - -%if "%{name}" != "qemu-linux-user" -# for the record, this set of firmware files is installed, but we don't -# build (yet): bamboo.dtb canyonlands.dtb hppa-firmware.img openbios-ppc -# openbios-sparc32 openbios-sparc64 palcode-clipper petalogix-ml605.dtb -# petalogix-s3adsp1800.dtb QEMU,cgthree.bin QEMU,tcx.bin qemu_vga.ndrv -# u-boot.e500 u-boot-sam460-20100605.bin opensbi-riscv32-generic-fw_dynamic.bin -# opensbi-riscv32-generic-fw_dynamic.elfnpcm7xx_bootrom.bin - -# Note that: -# - default firmwares are built "by default", i.e., they're built automatically -# during the process of building QEMU (on each specific arch) -# - extra firmwares are built "manually" (see below) from their own sources -# (which, typically, are submodules checked out in the {srcdi}r/roms directory) -%define ppc_default_firmware %{nil} -%define ppc_extra_firmware {skiboot.lid slof.bin} -%define riscv64_default_firmware %{nil} -%define riscv64_extra_firmware {opensbi-riscv64-generic-fw_dynamic.bin \ -opensbi-riscv64-generic-fw_dynamic.elf} -%define s390x_default_firmware {s390-ccw.img s390-netboot.img} -%define s390x_extra_firmware %{nil} -%define x86_default_firmware {linuxboot.bin linuxboot_dma.bin multiboot.bin \ -multiboot_dma.bin kvmvapic.bin pvh.bin} -%define x86_extra_firmware {bios.bin bios-256k.bin bios-microvm.bin qboot.rom \ -pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom pxe-pcnet.rom pxe-rtl8139.rom \ -pxe-virtio.rom sgabios.bin vgabios-ati.bin vgabios-bochs-display.bin \ -vgabios.bin vgabios-cirrus.bin vgabios-qxl.bin vgabios-ramfb.bin \ -vgabios-stdvga.bin vgabios-virtio.bin vgabios-vmware.bin \ -efi-e1000.rom efi-e1000e.rom efi-eepro100.rom efi-ne2k_pci.rom efi-pcnet.rom \ -efi-rtl8139.rom efi-virtio.rom efi-vmxnet3.rom} - -# Complete list of all the firmwares that we build, if we consider -# all the builds, on all the arches. -%define firmware { \ -%{ppc_default_firmware} %{ppc_extra_firmware} \ -%{riscv64_default_firmware} %{riscv64_extra_firmware} \ -%{s390x_default_firmware} %{s390x_extra_firmware} \ -%{x86_default_firmware} %{x86_extra_firmware} } - -# Note that: -# - {arch}_default_built_firmware are the firmwares that we will be built by -# default in this particular build, on the arch where we currently are on -# - {arch}_extra_built_fimrware, likewise, but for extra firmwares, built manually -%ifarch ppc64 ppc64le -%define ppc_default_built_firmware %{ppc_default_firmware} -%endif -%ifarch riscv64 -%define riscv64_default_built_firmware %{riscv64_default_firmware} -%endif -%ifarch s390x -%define s390x_default_built_firmware %{s390x_default_firmware} -%endif -%ifarch %ix86 x86_64 -%define x86_default_built_firmware %{x86_default_firmware} -%endif - -%if %{build_opensbi_firmware} -%define riscv64_extra_built_firmware %{riscv64_extra_firmware} -%endif -%if %{build_ppc_firmware} -%define ppc_extra_built_firmware %{ppc_extra_firmware} -%endif -%if %{build_x86_firmware} -%define x86_extra_built_firmware %{x86_extra_firmware} -%endif - -# List of only firmwares that will actually be built, in this instance -%define built_firmware { \ -%{?ppc_default_built_firmware} %{?ppc_extra_built_firmware} \ -%{?riscv64_default_built_firmware} %{?riscv64_extra_built_firmware} \ -%{?s390x_default_built_firmware} %{?s390x_extra_built_firmware} \ -%{?x86_default_built_firmware} %{?x86_extra_built_firmware} } - -# above section is for qemu and qemu-testsuite -%endif - -# ======================================================================== - -%build - -# non-x86 archs still seem to have some issues with Link Time Optimization -%ifnarch %ix86 x86_64 -%define _lto_cflags %{nil} -%endif - -%if %{legacy_qemu_kvm} -%ifarch s390x -cp %{SOURCE13} docs/supported.rst -%else -cp %{SOURCE13} docs/supported.rst -%endif -%endif - -%define srcdir %{_builddir}/%buildsubdir -%define blddir %srcdir/build -mkdir -p %blddir -cd %blddir - -%srcdir/configure \ - --prefix=%_prefix \ - --sysconfdir=%_sysconfdir \ - --libdir=%_libdir \ - --libexecdir=%_libexecdir \ - --localstatedir=%_localstatedir \ - --docdir=%_docdir \ - --firmwarepath=%_datadir/%name \ - --python=%_bindir/python3 \ - --extra-cflags="%{optflags}" \ - --with-git-submodules=ignore \ - --disable-fuzzing \ - --disable-multiprocess \ - --disable-stack-protector \ - --disable-strip \ - --disable-tcg-interpreter \ -%if "%{_lto_cflags}" != "%{nil}" - --enable-lto \ -%endif -%if "%flavor" != "testsuite" - --disable-qom-cast-debug \ -%endif - --with-git-submodules=ignore \ -%if "%{name}" != "qemu-linux-user" - --with-pkgversion="%(echo '%{distro}' | sed 's/ (.*)//')" \ - --with-default-devices \ - --enable-system --disable-linux-user \ - --enable-tools --enable-guest-agent \ - --enable-modules \ - --disable-module-upgrades \ - --enable-slirp=system \ - --enable-pie \ - --enable-docs \ - --enable-attr \ - --disable-auth-pam \ - --enable-bochs \ - --enable-brlapi \ - --enable-bzip2 \ - --enable-cap-ng \ - --disable-capstone \ - --enable-cloop \ - --enable-coroutine-pool \ - --disable-crypto-afalg \ - --enable-curl \ - --enable-curses \ - --enable-dmg \ - --enable-fdt \ - --enable-gio \ - --enable-gcrypt \ - --enable-glusterfs \ - --enable-gnutls \ - --enable-gtk \ - --disable-hax \ - --disable-hvf \ - --enable-iconv \ -%if %{kvm_available} - --enable-kvm \ -%else - --disable-kvm \ -%endif -%if 0%{?with_daxctl} - --enable-libdaxctl \ -%else - --disable-libdaxctl \ -%endif - --enable-libiscsi \ - --enable-libnfs \ -%ifarch x86_64 - --enable-libpmem \ -%else - --disable-libpmem \ -%endif - --enable-libssh \ - --enable-libusb \ - --disable-libxml2 \ - --enable-linux-aio \ -%if 0%{?with_uring} - --enable-linux-io-uring \ -%else - --disable-linux-io-uring \ -%endif - --enable-lzfse \ - --enable-lzo \ - --disable-malloc-trim \ -%if %{with system_membarrier} - --enable-membarrier \ -%else - --disable-membarrier \ -%endif - --enable-mpath \ - --disable-netmap \ - --disable-nettle \ -%ifarch %arm s390x - --disable-numa \ -%else - --enable-numa \ -%endif - --enable-opengl \ - --enable-parallels \ - --disable-plugins \ - --enable-pvrdma \ - --enable-qcow1 \ - --enable-qed \ -%if 0%{?with_rbd} - --enable-rbd \ -%else - --disable-rbd \ -%endif - --enable-rdma \ - --enable-replication \ - --disable-safe-stack \ - --disable-sanitizers \ - --disable-sdl \ - --disable-sdl-image \ - --enable-seccomp \ - --enable-smartcard \ - --enable-snappy \ - --enable-spice \ - --enable-tpm \ - --enable-usb-redir \ - --enable-vde \ - --enable-vdi \ - --enable-vhost-crypto \ - --enable-vhost-kernel \ - --enable-vhost-net \ - --enable-vhost-scsi \ - --enable-vhost-user \ - --enable-vhost-user-blk-server \ - --enable-vhost-user-fs \ - --enable-vhost-vdpa \ - --enable-vhost-vsock \ - --enable-virglrenderer \ - --enable-virtfs \ - --enable-vnc \ - --enable-vnc-jpeg \ - --enable-vnc-png \ - --enable-vnc-sasl \ - --enable-vte \ - --enable-vvfat \ - --enable-werror \ - --disable-whpx \ - --enable-zstd \ -%ifarch x86_64 - --enable-xen \ - --enable-xen-pci-passthrough \ -%else - --disable-xen \ -%endif - --enable-xfsctl \ - --enable-xkbcommon \ -# above section is for qemu and qemu-testsuite -# ------------------------------------------------------------------------ -%else - --without-default-devices \ - --disable-system --enable-linux-user \ - --disable-tools --disable-guest-agent \ - --static \ - --disable-modules \ - --disable-pie \ - --disable-docs \ - --disable-blobs \ - --disable-bochs \ - --disable-capstone \ - --disable-cloop \ - --enable-coroutine-pool \ - --disable-dmg \ - --disable-fdt \ - --disable-gio \ - --disable-iconv \ - --disable-kvm \ - --disable-libdaxctl \ - --disable-linux-io-uring \ - --disable-malloc-trim \ -%if %{with system_membarrier} - --enable-membarrier \ -%else - --disable-membarrier \ -%endif - --disable-parallels \ - --disable-plugins \ - --disable-qcow1 \ - --disable-qed \ - --disable-replication \ - --disable-safe-stack \ - --disable-slirp \ - --disable-tpm \ - --disable-vdi \ - --disable-vhost-crypto \ - --disable-vhost-kernel \ - --disable-vhost-net \ - --disable-vhost-scsi \ - --disable-vhost-user \ - --disable-vhost-user-blk-server \ - --disable-vhost-user-fs \ - --disable-vhost-vsock \ - --disable-vnc \ - --disable-vvfat \ - --disable-xkbcommon \ - -# above section is for qemu-linux-user -%endif - -%if "%{name}" == "qemu" - -# Let's build QEMU (and all the "default" firmwares, for each arch) - -# First, delete the firmware files that we intend to build... -for i in %built_firmware -do - unlink %srcdir/pc-bios/$i -done - -%make_build - -# ... And then, reinstate the firmwares that have been built already -for i in %{?s390x_default_built_firmware} -do - cp pc-bios/s390-ccw/$i %srcdir/pc-bios/ -done - -for i in %{?x86_default_built_firmware} -do - cp pc-bios/optionrom/$i %srcdir/pc-bios/ -done - -# Build the "extra" firmwares. Note that the QEMU Makefile in {srcdir}/roms -# does some cross-compiler auto detection. So we often don't need to define -# or pass CROSS= and CROSS_COMPILE ourselves. - -%if %{build_ppc_firmware} -# FIXME: check if we can upstream: Makefile-define-endianess-for-cross-buil.patch -%make_build -C %srcdir/roms skiboot - -%make_build -C %srcdir/roms slof -%endif - -%if %{build_opensbi_firmware} -%make_build -C %srcdir/roms opensbi64-generic -%endif - -%if %{build_x86_firmware} - -%make_build %{?_smp_mflags} -C %srcdir/roms bios \ - SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" \ - -# FIXME: check if we can upstream: roms-Makefile-add-cross-file-to-qboot-me.patch -# and qboot-add-cross.ini-file-to-handle-aarch.patch -%make_build -C %srcdir/roms qboot - -%make_build -C %srcdir/roms seavgabios \ - -%make_build -C %srcdir/roms seavgabios-ati \ - -%make_build -C %srcdir/roms pxerom - -%make_build -C %srcdir/roms efirom \ - EDK2_BASETOOLS_OPTFLAGS='-fPIE' - -# We're currently not building firmware on ix86, but let's make sure this works -# fine if one enables it, e.g., locally (for debugging or something). -# FIXME: check if we can get rid or upstream: roms-sgabios-Fix-csum8-to-be-built-by-ho.patch -make -C %srcdir/roms sgabios HOSTCC=cc \ -%ifnarch %ix86 x86_64 - CC=x86_64-suse-linux-gcc LD=x86_64-suse-linux-ld \ -%endif - -%if %{force_fit_virtio_pxe_rom} -pushd %srcdir -patch -p1 < %_sourcedir/stub-out-the-SAN-req-s-in-int13.patch -popd -%make_build -C %srcdir/roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom -%endif - -# enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward -# the following need to be > 64K -%define supported_nics_large {e1000 rtl8139} -# the following need to be <= 64K -%define supported_nics_small {virtio} -# Though not required, make unsupported pxe roms migration compatable as well -%define unsupported_nics {eepro100 ne2k_pci pcnet} - -for i in %supported_nics_large %unsupported_nics - do - if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "131072" ; then - echo "pxe rom is too large" - exit 1 - fi - if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -le "65536" ; then - ./%srcdir/roms/ipxe/src/util/padimg.pl %srcdir/pc-bios/pxe-$i.rom -s 65536 -b 255 - echo -ne "SEGMENT OVERAGE\0" >> %srcdir/pc-bios/pxe-$i.rom - fi -done -for i in %supported_nics_small - do - if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "65536" ; then - echo "pxe rom is too large" - exit 1 - fi -done - -%endif -# End of {build_x86_firmware} - -%endif -# End of "{name}" == "qemu" - -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-testsuite" - -# XXX: What's the point of all this, if we need to rebuild everything anyway?!? -ln -s %_bindir/qemu-img qemu-img -ln -s %_bindir/qemu-ga qemu-ga -ln -s %_bindir/qemu-io qemu-io -ln -s %_bindir/elf2map elf2map -ln -s %_bindir/qemu-nbd qemu-nbd -ln -s %_bindir/qemu-edid qemu-edid -ln -s %_bindir/qemu-keymap qemu-keymap -ln -s %_bindir/ivshmem-client ivshmem-client -ln -s %_bindir/ivshmem-server ivshmem-server -ln -s %_bindir/qemu-pr-helper qemu-pr-helper -ln -s %_libexecdir/virtfs-proxy-helper fsdev/virtfs-proxy-helper - -for i in %firmware -do - unlink pc-bios/$i - ln -s %_datadir/qemu/$i pc-bios/$i -done - -for conf in %{_builddir}/%buildsubdir/configs/targets/*-softmmu.mak; do - arch=`echo "$conf" | sed -e 's|%{_builddir}/%buildsubdir/configs/targets/\(.*\)-softmmu.mak|\1|g'` - if $(unlink $arch-softmmu/qemu-system-$arch); then - ln -s %_bindir/qemu-system-$arch $arch-softmmu/qemu-system-$arch - fi -done - -# Compile the QOM test binary first, so that ... -%make_build tests/qtest/qom-test V=1 -# ... make comes in fresh and has lots of address space (needed for 32bit, bsc#957379) -%make_build check-report.tap V=1 - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-linux-user" - -%make_build - -%ifarch %ix86 -%define qemu_arch i386 -%endif -%ifarch x86_64 -%define qemu_arch x86_64 -%endif -%ifarch %arm -%define qemu_arch arm -%endif -%ifarch aarch64 -%define qemu_arch aarch64 -%endif -%ifarch ppc -%define qemu_arch ppc -%endif -%ifarch ppc64 -%define qemu_arch ppc64 -%endif -%ifarch ppc64le -%define qemu_arch ppc64le -%endif -%ifarch s390x -%define qemu_arch s390x -%endif - -%endif - -# ======================================================================== - -%check -cd %blddir -%if "%{name}" == "qemu-testsuite" - -export QEMU_PROG=%_bindir/qemu-system-x86_64 -export QEMU_IMG_PROG=%_bindir/qemu-img -export QEMU_IO_PROG=%_bindir/qemu-io -export QEMU_NBD_PROG=%_bindir/qemu-nbd -%make_build check-block V=1 - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-linux-user" - -%ifarch %ix86 x86_64 %arm aarch64 ppc ppc64 ppc64le s390x -%ifnarch %arm -%{qemu_arch}-linux-user/qemu-%{qemu_arch} %_bindir/ls > /dev/null -%endif -%make_build check-softfloat -%endif - -%endif - -# ======================================================================== - -%install -cd %blddir - -%if "%{name}" == "qemu-testsuite" - -install -D -m 0644 check-report.tap %{buildroot}%_datadir/qemu/check-report.tap - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-linux-user" - -%make_build install DESTDIR=%{buildroot} -rm -rf %{buildroot}%_datadir/qemu/keymaps -unlink %{buildroot}%_datadir/qemu/trace-events-all -install -d -m 755 %{buildroot}%_sbindir -install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64_be-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-alpha-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-armeb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-cris-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hexagon-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hppa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-i386-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-m68k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblaze-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblazeel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-nios2-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-or1k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64le-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-s390x-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4eb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc32plus-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-x86_64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt -%fdupes -s %{buildroot} - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu" - -%make_build install DESTDIR=%{buildroot} - -%find_lang %name -install -d -m 0755 %{buildroot}%_datadir/%name/firmware -install -d -m 0755 %{buildroot}/usr/lib/supportconfig/plugins -install -d -m 0755 %{buildroot}%_sysconfdir/%name/firmware -install -D -m 0644 %{SOURCE4} %{buildroot}%_sysconfdir/%name/bridge.conf -install -D -m 0755 %{SOURCE3} %{buildroot}%_datadir/%name/qemu-ifup -install -D -p -m 0644 %{SOURCE8} %{buildroot}/usr/lib/udev/rules.d/80-qemu-ga.rules -install -D -m 0755 scripts/analyze-migration.py %{buildroot}%_bindir/analyze-migration.py -install -D -m 0755 scripts/vmstate-static-checker.py %{buildroot}%_bindir/vmstate-static-checker.py -install -D -m 0755 scripts/kvm/vmxcap %{buildroot}%_bindir/vmxcap -install -D -m 0755 %{SOURCE9} %{buildroot}/usr/lib/supportconfig/plugins/%name -install -D -m 0644 %{SOURCE10} %{buildroot}%_docdir/qemu-arm/supported.txt -install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt -install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt -install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390x/supported.txt -%if %{legacy_qemu_kvm} -install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz -install -d %{buildroot}%_docdir/qemu-kvm -%ifarch s390x -ln -s qemu-system-s390x %{buildroot}%_bindir/qemu-kvm -ln -s ../qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt -rst2html --exit-status=2 %{buildroot}%_docdir/qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html -%else -ln -s qemu-system-x86_64 %{buildroot}%_bindir/qemu-kvm -ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt -rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html -%endif -%endif -%if %{kvm_available} -install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/80-kvm.rules -%endif -install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-guest-agent.service -install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service -%ifarch s390x -install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf -%endif - -# We rely on a separate project / package to provide edk2 firmware -unlink %{buildroot}%_datadir/%name/edk2-licenses.txt -unlink %{buildroot}%_datadir/%name/firmware/50-edk2-i386-secure.json -unlink %{buildroot}%_datadir/%name/firmware/50-edk2-x86_64-secure.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-aarch64.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-arm.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-i386.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-x86_64.json -unlink %{buildroot}%_datadir/%name/edk2-aarch64-code.fd -unlink %{buildroot}%_datadir/%name/edk2-arm-code.fd -unlink %{buildroot}%_datadir/%name/edk2-arm-vars.fd -unlink %{buildroot}%_datadir/%name/edk2-i386-code.fd -unlink %{buildroot}%_datadir/%name/edk2-i386-secure-code.fd -unlink %{buildroot}%_datadir/%name/edk2-i386-vars.fd -unlink %{buildroot}%_datadir/%name/edk2-x86_64-code.fd -unlink %{buildroot}%_datadir/%name/edk2-x86_64-secure-code.fd - -# this was never meant for customer consumption - delete even though installed -unlink %{buildroot}%_bindir/elf2dmp - -install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt -for X in 00 01 02 03 04 05 07 08 09 10 11 12 13 14 15 16 17 18 19 -do - ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X -done - -# For PPC and x86 firmwares, there are a few extra install steps necessary. -# In general, if we know that we have not built a firmware, remove it from the -# install base, as the one that we have there is the upstream binary, that got -# copied there during `make install`. - -%if %{build_ppc_firmware} -# in support of update-alternatives -mv %{buildroot}%_datadir/%name/skiboot.lid %{buildroot}%_datadir/%name/skiboot.lid.qemu -# create a dummy target for /etc/alternatives/skiboot.lid -mkdir -p %{buildroot}%{_sysconfdir}/alternatives -ln -s -f %{_sysconfdir}/alternatives/skiboot.lid %{buildroot}%{_datadir}/%name/skiboot.lid -ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/06 -%else -for f in %{ppc_extra_firmware} ; do - unlink %{buildroot}%_datadir/%name/$f -done -%endif - -# For riscv64 firmwares (currently, only opensbi), we leave them there in -# any case, because they're part of the qemu-extra package, and riscv is -# a bit special in many ways already. - -%if %{build_x86_firmware} -install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json -install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json -%else -for f in %{x86_extra_firmware} ; do - unlink %{buildroot}%_datadir/%name/$f -done -%endif - -%suse_update_desktop_file qemu -%fdupes -s %{buildroot} - -# ======================================================================== +This package acts as an umbrella package to the other QEMU sub-packages. %if %{kvm_available} %post @@ -1966,70 +518,13 @@ if [ $(stat -L -c "%i" /proc/1/root/) = $(stat -L -c "%i" /) ]; then sysctl vm.allocate_pgste=1 || : %endif fi +# End of "if kvm_available" %endif -%post tools -%set_permissions %_libexecdir/qemu-bridge-helper - -%verifyscript tools -%verify_permissions %_libexecdir/qemu-bridge-helper - -%pre guest-agent -%service_add_pre qemu-guest-agent.service - -%post guest-agent -%service_add_post qemu-guest-agent.service -if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then - /usr/bin/systemctl start qemu-guest-agent.service || : -fi - -%preun guest-agent -if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then - /usr/bin/systemctl stop qemu-guest-agent.service || : -fi - -%postun guest-agent -%service_del_postun_without_restart qemu-guest-agent.service -if [ "$1" = "1" ] ; then - if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then - /usr/bin/systemctl restart qemu-guest-agent.service || : - fi -fi - -%pre ksm -%service_add_pre ksm.service - -%post ksm -%service_add_post ksm.service - -%preun ksm -%service_del_preun ksm.service - -%postun ksm -%service_del_postun ksm.service - -%if %{build_ppc_firmware} -%post skiboot -update-alternatives --install \ - %{_datadir}/%name/skiboot.lid skiboot.lid %{_datadir}/%name/skiboot.lid.qemu 15 - -%preun skiboot -if [ ! -f %{_datadir}/%name/skiboot.lid.qemu ] ; then - update-alternatives --remove skiboot.lid %{_datadir}/%name/skiboot.lid.qemu -fi -%endif - -# above section is for qemu -%endif - -# ======================================================================== - %files %defattr(-, root, root) %doc README.rst VERSION %license COPYING COPYING.LIB LICENSE - -%if "%{name}" == "qemu" %dir %_datadir/icons/hicolor %dir %_datadir/icons/hicolor/*/ %dir %_datadir/icons/hicolor/*/apps @@ -2080,6 +575,7 @@ fi %_docdir/%name/about/index.html %_docdir/%name/about/license.html %_docdir/%name/about/removed-features.html +%_docdir/%name/dbus-dbusindex.html %_docdir/%name/devel/atomics.html %_docdir/%name/devel/bitops.html %_docdir/%name/devel/block-coroutine-wrapper.html @@ -2092,6 +588,11 @@ fi %_docdir/%name/devel/decodetree.html %_docdir/%name/devel/ebpf_rss.html %_docdir/%name/devel/fuzzing.html +%_docdir/%name/devel/index-api.html +%_docdir/%name/devel/index-build.html +%_docdir/%name/devel/index-internals.html +%_docdir/%name/devel/index-process.html +%_docdir/%name/devel/index-tcg.html %_docdir/%name/devel/index.html %_docdir/%name/devel/kconfig.html %_docdir/%name/devel/loads-stores.html @@ -2110,8 +611,6 @@ fi %_docdir/%name/devel/stable-process.html %_docdir/%name/devel/style.html %_docdir/%name/devel/submitting-a-patch.html -%_docdir/%name/devel/submitting-a-patch.html -%_docdir/%name/devel/submitting-a-pull-request.html %_docdir/%name/devel/submitting-a-pull-request.html %_docdir/%name/devel/tcg-icount.html %_docdir/%name/devel/tcg-plugins.html @@ -2119,7 +618,6 @@ fi %_docdir/%name/devel/testing.html %_docdir/%name/devel/tracing.html %_docdir/%name/devel/trivial-patches.html -%_docdir/%name/devel/trivial-patches.html %_docdir/%name/devel/ui.html %_docdir/%name/devel/vfio-migration.html %_docdir/%name/devel/writing-monitor-commands.html @@ -2127,6 +625,7 @@ fi %_docdir/%name/index.html %_docdir/%name/interop/barrier.html %_docdir/%name/interop/bitmaps.html +%_docdir/%name/interop/dbus-display.html %_docdir/%name/interop/dbus-vmstate.html %_docdir/%name/interop/dbus.html %_docdir/%name/interop/index.html @@ -2138,19 +637,25 @@ fi %_docdir/%name/interop/vhost-user-gpu.html %_docdir/%name/interop/vhost-user.html %_docdir/%name/interop/vhost-vdpa.html +%_docdir/%name/interop/virtio-balloon-stats.html %_docdir/%name/objects.inv %_docdir/%name/search.html %_docdir/%name/searchindex.js %_docdir/%name/specs/acpi_cpu_hotplug.html +%_docdir/%name/specs/acpi_erst.html %_docdir/%name/specs/acpi_hest_ghes.html %_docdir/%name/specs/acpi_hw_reduced_hotplug.html %_docdir/%name/specs/acpi_mem_hotplug.html %_docdir/%name/specs/acpi_nvdimm.html %_docdir/%name/specs/acpi_pci_hotplug.html %_docdir/%name/specs/index.html +%_docdir/%name/specs/ppc-spapr-hcalls.html +%_docdir/%name/specs/ppc-spapr-hotplug.html %_docdir/%name/specs/ppc-spapr-numa.html +%_docdir/%name/specs/ppc-spapr-uv-hcalls.html %_docdir/%name/specs/ppc-spapr-xive.html %_docdir/%name/specs/ppc-xive.html +%_docdir/%name/specs/sev-guest-firmware.html %_docdir/%name/specs/tpm.html %_docdir/%name/system/arm/aspeed.html %_docdir/%name/system/arm/collie.html @@ -2188,8 +693,10 @@ fi %_docdir/%name/system/authz.html %_docdir/%name/system/barrier.html %_docdir/%name/system/bootindex.html +%_docdir/%name/system/confidential-guest-support.html %_docdir/%name/system/cpu-hotplug.html %_docdir/%name/system/device-emulation.html +%_docdir/%name/system/devices/can.html %_docdir/%name/system/devices/ivshmem.html %_docdir/%name/system/devices/net.html %_docdir/%name/system/devices/nvme.html @@ -2200,6 +707,7 @@ fi %_docdir/%name/system/gdb.html %_docdir/%name/system/generic-loader.html %_docdir/%name/system/guest-loader.html +%_docdir/%name/system/i386/amd-memory-encryption.html %_docdir/%name/system/i386/cpu.html %_docdir/%name/system/i386/kvm-pv.html %_docdir/%name/system/i386/microvm.html @@ -2283,6 +791,26 @@ fi /usr/lib/udev/rules.d/80-kvm.rules %endif +%package x86 +Summary: Machine emulator and virtualizer for x86 architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Requires: qemu-accel-tcg-x86 +Requires: qemu-ipxe +Requires: qemu-seabios +Requires: qemu-sgabios +Requires: qemu-vgabios +Recommends: ovmf +Recommends: qemu-microvm +Recommends: qemu-ovmf-x86_64 + +%description x86 +%{generic_qemu_description} + +This package provides i386 and x86_64 emulation. + %files x86 %defattr(-, root, root) %_bindir/qemu-system-i386 @@ -2296,6 +824,21 @@ fi %dir %_docdir/qemu-x86 %_docdir/qemu-x86/supported.txt +%package ppc +Summary: Machine emulator and virtualizer for Power architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Requires: qemu-SLOF +Recommends: qemu-ipxe +Recommends: qemu-vgabios + +%description ppc +%{generic_qemu_description} + +This package provides ppc and ppc64 emulation. + %files ppc %defattr(-, root, root) %_bindir/qemu-system-ppc @@ -2306,9 +849,24 @@ fi %_datadir/%name/qemu_vga.ndrv %_datadir/%name/u-boot.e500 %_datadir/%name/u-boot-sam460-20100605.bin +%_datadir/%name/vof*.bin %dir %_docdir/qemu-ppc %_docdir/qemu-ppc/supported.txt +%package s390x +Summary: Machine emulator and virtualizer for S/390 architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Provides: qemu-s390 = %{qemuver} +Obsoletes: qemu-s390 < %{qemuver} + +%description s390x +%{generic_qemu_description} + +This package provides s390x emulation. + %files s390x %defattr(-, root, root) %_bindir/qemu-system-s390x @@ -2317,6 +875,22 @@ fi %dir %_docdir/qemu-s390x %_docdir/qemu-s390x/supported.txt +%package arm +Summary: Machine emulator and virtualizer for ARM architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Recommends: ovmf +Recommends: qemu-ipxe +Recommends: qemu-uefi-aarch64 +Recommends: qemu-vgabios + +%description arm +%{generic_qemu_description} + +This package provides arm emulation. + %files arm %defattr(-, root, root) %_bindir/qemu-system-arm @@ -2325,6 +899,23 @@ fi %dir %_docdir/qemu-arm %_docdir/qemu-arm/supported.txt +%package extra +Summary: Machine emulator and virtualizer for "extra" architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Recommends: qemu-ipxe +Recommends: qemu-skiboot +Recommends: qemu-vgabios + +%description extra +%{generic_qemu_description} + +This package provides some lesser used emulations, including alpha, m68k, +mips, sparc, and xtensa. (The term "extra" is juxtapositioned against more +popular QEMU packages which are dedicated to a single architecture.) + %files extra %defattr(-, root, root) %_bindir/qemu-system-alpha @@ -2354,9 +945,7 @@ fi %_datadir/%name/openbios-sparc32 %_datadir/%name/openbios-sparc64 %_datadir/%name/opensbi-riscv32-generic-fw_dynamic.bin -%_datadir/%name/opensbi-riscv32-generic-fw_dynamic.elf %_datadir/%name/opensbi-riscv64-generic-fw_dynamic.bin -%_datadir/%name/opensbi-riscv64-generic-fw_dynamic.elf %_datadir/%name/palcode-clipper %_datadir/%name/petalogix-ml605.dtb %_datadir/%name/petalogix-s3adsp1800.dtb @@ -2364,6 +953,28 @@ fi %_datadir/%name/QEMU,tcx.bin %if %{legacy_qemu_kvm} +%package kvm +Summary: Wrapper to enable KVM acceleration under QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%ifarch %ix86 x86_64 +Requires: qemu-x86 = %{qemuver} +%endif +%ifarch s390x +Requires: qemu-s390x = %{qemuver} +%endif +Provides: kvm = %{qemuver} +Obsoletes: kvm < %{qemuver} + +%description kvm +%{generic_qemu_description} + +This package provides a symlink to the main QEMU emulator used for KVM +virtualization. The symlink is named qemu-kvm, which causes the QEMU program +to enable the KVM accelerator, due to the name reference ending with 'kvm'. +This package is an artifact of the early origins of QEMU, and is deprecated. + %files kvm %defattr(-,root,root) %_bindir/qemu-kvm @@ -2371,23 +982,95 @@ fi %_docdir/qemu-kvm/kvm-supported.html %_docdir/qemu-kvm/kvm-supported.txt %_mandir/man1/qemu-kvm.1.gz +# End of "if legacy_qemu_kvm" %endif +%package lang +Summary: Translations for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 + +%description lang +This package contains a few language translations, particularly for the +graphical user interface components that come with QEMU. The bulk of strings +in QEMU are not localized. + +%files lang -f %blddir/%name.lang +%defattr(-, root, root) + +%package audio-alsa +Summary: ALSA based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-alsa +This package contains a module for ALSA based audio support for QEMU. + %files audio-alsa %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-alsa.so +%package audio-dbus +Summary: D-Bus based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-dbus +This package provides a module for D-Bus based audio support for QEMU. + +%files audio-dbus +%defattr(-, root, root) +%dir %_libdir/%name +%_libdir/%name/audio-dbus.so + +%package audio-pa +Summary: Pulse Audio based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-pa +This package contains a module for Pulse Audio based audio support for QEMU. + %files audio-pa %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-pa.so +%package audio-jack +Summary: JACK based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-jack +This package contains a module for JACK based audio support for QEMU. + %files audio-jack %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-jack.so +%package audio-spice +Summary: Spice based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/05 +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description audio-spice +This package contains a module for Spice based audio support for QEMU. + %files audio-spice %defattr(-, root, root) %dir %_datadir/%name/forsplits @@ -2395,49 +1078,148 @@ fi %dir %_libdir/%name %_libdir/%name/audio-spice.so +%package audio-oss +Summary: OSS based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-oss +This package contains a module for OSS based audio support for QEMU. + %files audio-oss %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-oss.so +%package block-curl +Summary: cURL block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-curl +This package contains a module for accessing network-based image files over +a network connection from qemu-img tool and QEMU system emulation. + %files block-curl %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-curl.so +%package block-dmg +Summary: DMG block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-dmg +This package contains a module for accessing Mac OS X image files from +qemu-img tool and QEMU system emulation. + %files block-dmg %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-dmg-bz2.so %_libdir/%name/block-dmg-lzfse.so +%package block-gluster +Summary: GlusterFS block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-gluster +This package contains a module for accessing network-based image files over a +GlusterFS network connection from qemu-img tool and QEMU system emulation. + %files block-gluster %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-gluster.so +%package block-iscsi +Summary: iSCSI block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-iscsi +This package contains a module for accessing network-based image files over an +iSCSI network connection from qemu-img tool and QEMU system emulation. + %files block-iscsi %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-iscsi.so +%package block-nfs +Summary: direct Network File System support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-nfs +This package contains a module for directly accessing nfs based image files +for QEMU. + %files block-nfs %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-nfs.so %if 0%{?with_rbd} +%package block-rbd +Summary: Rados Block Device (Ceph) support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-rbd +This package contains a module for accessing ceph (rbd,rados) image files +for QEMU. + %files block-rbd %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-rbd.so +# End of "if with_rbd" %endif +%package block-ssh +Summary: SSH (SFTP) block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-ssh +This package contains a module for accessing network-based image files over an +SSH network connection from qemu-img tool and QEMU system emulation. + %files block-ssh %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-ssh.so +%package chardev-baum +Summary: Baum braille chardev support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/00 +%{qemu_module_conflicts} + +%description chardev-baum +This package contains a module for baum braille chardev support for QEMU. + %files chardev-baum %defattr(-, root, root) %dir %_datadir/%name @@ -2446,6 +1228,18 @@ fi %dir %_libdir/%name %_libdir/%name/chardev-baum.so +%package chardev-spice +Summary: Spice vmc and port chardev support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/08 +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description chardev-spice +This package contains a module for Spice chardev support for QEMU. + %files chardev-spice %defattr(-, root, root) %dir %_datadir/%name @@ -2454,6 +1248,18 @@ fi %dir %_libdir/%name %_libdir/%name/chardev-spice.so +%package hw-display-qxl +Summary: QXL display support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/01 +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description hw-display-qxl +This package contains a module for QXL display support for QEMU. + %files hw-display-qxl %defattr(-, root, root) %dir %_datadir/%name @@ -2462,6 +1268,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-display-qxl.so +%package hw-display-virtio-gpu +Summary: Virtio GPU display support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/04 +%{qemu_module_conflicts} + +%description hw-display-virtio-gpu +This package contains a module for Virtio GPU display support for QEMU. + %files hw-display-virtio-gpu %defattr(-, root, root) %dir %_datadir/%name @@ -2470,6 +1287,18 @@ fi %_libdir/%name/hw-display-virtio-gpu.so %_libdir/%name/hw-display-virtio-gpu-gl.so +%package hw-display-virtio-gpu-pci +Summary: Virtio-gpu pci device for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-hw-display-virtio-gpu +Provides: %name:%_datadir/%name/forsplits/11 +%{qemu_module_conflicts} + +%description hw-display-virtio-gpu-pci +This package contains a module providing the virtio gpu pci device for QEMU. + %files hw-display-virtio-gpu-pci %defattr(-, root, root) %dir %_datadir/%name @@ -2479,6 +1308,17 @@ fi %_libdir/%name/hw-display-virtio-gpu-pci.so %_libdir/%name/hw-display-virtio-gpu-pci-gl.so +%package hw-display-virtio-vga +Summary: Virtio vga device for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/12 +%{qemu_module_conflicts} + +%description hw-display-virtio-vga +This package contains a module providing the virtio vga device for QEMU. + %files hw-display-virtio-vga %defattr(-, root, root) %dir %_datadir/%name @@ -2488,6 +1328,19 @@ fi %_libdir/%name/hw-display-virtio-vga.so %_libdir/%name/hw-display-virtio-vga-gl.so +%package hw-s390x-virtio-gpu-ccw +Summary: S390x virtio-gpu ccw device for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-hw-display-virtio-gpu +Provides: %name:%_datadir/%name/forsplits/13 +%{qemu_module_conflicts} + +%description hw-s390x-virtio-gpu-ccw +This package contains a module providing the s390x virtio gpu ccw device for +QEMU. + %files hw-s390x-virtio-gpu-ccw %defattr(-, root, root) %dir %_datadir/%name @@ -2496,6 +1349,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-s390x-virtio-gpu-ccw.so +%package hw-usb-redirect +Summary: USB redirection support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/02 +%{qemu_module_conflicts} + +%description hw-usb-redirect +This package contains a module for USB redirection support for QEMU. + %files hw-usb-redirect %defattr(-, root, root) %dir %_datadir/%name @@ -2504,6 +1368,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-usb-redirect.so +%package hw-usb-smartcard +Summary: USB smartcard support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/03 +%{qemu_module_conflicts} + +%description hw-usb-smartcard +This package contains a modules for USB smartcard support for QEMU. + %files hw-usb-smartcard %defattr(-, root, root) %dir %_datadir/%name @@ -2512,6 +1387,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-usb-smartcard.so +%package hw-usb-host +Summary: USB passthrough driver support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/14 +%{qemu_module_conflicts} + +%description hw-usb-host +This package contains a modules for USB passthrough driver for QEMU. + %files hw-usb-host %defattr(-, root, root) %dir %_datadir/%name @@ -2520,16 +1406,63 @@ fi %dir %_libdir/%name %_libdir/%name/hw-usb-host.so +%package ui-dbus +Summary: D-Bus based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description ui-dbus +This package contains a module for doing D-Bus based UI for QEMU. + +%files ui-dbus +%defattr(-, root, root) +%dir %_libdir/%name +%_libdir/%name/ui-dbus.so + +%package ui-curses +Summary: Curses based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description ui-curses +This package contains a module for doing curses based UI for QEMU. + %files ui-curses %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/ui-curses.so +%package ui-gtk +Summary: GTK based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-ui-opengl +%{qemu_module_conflicts} + +%description ui-gtk +This package contains a module for doing GTK based UI for QEMU. + %files ui-gtk %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/ui-gtk.so +%package ui-opengl +Summary: OpenGL based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/10 +%{qemu_module_conflicts} + +%description ui-opengl +This package contains a module for doing OpenGL based UI for QEMU. + %files ui-opengl %defattr(-, root, root) %dir %_datadir/%name @@ -2539,6 +1472,37 @@ fi %_libdir/%name/ui-egl-headless.so %_libdir/%name/ui-opengl.so +%package ui-spice-app +Summary: Spice UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-chardev-spice +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description ui-spice-app +This package contains a module for doing Spice based UI for QEMU. + +%files ui-spice-app +%defattr(-, root, root) +%dir %_libdir/%name +%_libdir/%name/ui-spice-app.so + +%package ui-spice-core +Summary: Core Spice support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/09 +Requires: qemu-ui-opengl +# This next Requires is only since virt-manager expects audio support +Requires: qemu-audio-spice +%{qemu_module_conflicts} + +%description ui-spice-core +This package contains a module with core Spice support for QEMU. + %files ui-spice-core %defattr(-, root, root) %dir %_datadir/%name @@ -2547,81 +1511,16 @@ fi %dir %_libdir/%name %_libdir/%name/ui-spice-core.so -%files ui-spice-app -%defattr(-, root, root) -%dir %_libdir/%name -%_libdir/%name/ui-spice-app.so +%package vhost-user-gpu +Summary: Vhost user mode virtio-gpu 2D/3D rendering backend for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} -%files lang -f %blddir/%name.lang -%defattr(-, root, root) - -%if %{build_x86_firmware} -%files seabios -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/bios.bin -%_datadir/%name/bios-256k.bin -%_datadir/%name/firmware/50-seabios-256k.json -%_datadir/%name/firmware/60-seabios-128k.json - -%files microvm -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/bios-microvm.bin -%_datadir/%name/qboot.rom - -%files vgabios -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/vgabios.bin -%_datadir/%name/vgabios-ati.bin -%_datadir/%name/vgabios-bochs-display.bin -%_datadir/%name/vgabios-cirrus.bin -%_datadir/%name/vgabios-qxl.bin -%_datadir/%name/vgabios-ramfb.bin -%_datadir/%name/vgabios-stdvga.bin -%_datadir/%name/vgabios-virtio.bin -%_datadir/%name/vgabios-vmware.bin - -%files sgabios -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/sgabios.bin - -%files ipxe -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/efi-e1000.rom -%_datadir/%name/efi-e1000e.rom -%_datadir/%name/efi-eepro100.rom -%_datadir/%name/efi-ne2k_pci.rom -%_datadir/%name/efi-pcnet.rom -%_datadir/%name/efi-rtl8139.rom -%_datadir/%name/efi-virtio.rom -%_datadir/%name/efi-vmxnet3.rom -%_datadir/%name/pxe-e1000.rom -%_datadir/%name/pxe-eepro100.rom -%_datadir/%name/pxe-ne2k_pci.rom -%_datadir/%name/pxe-pcnet.rom -%_datadir/%name/pxe-rtl8139.rom -%_datadir/%name/pxe-virtio.rom -%endif - -%if %{build_ppc_firmware} -%files skiboot -%defattr(-, root, root) -%dir %_datadir/%name -%dir %_datadir/%name/forsplits -%_datadir/%name/forsplits/06 -%_datadir/%name/skiboot.lid -%_datadir/%name/skiboot.lid.qemu -%ghost %_sysconfdir/alternatives/skiboot.lid - -%files SLOF -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/slof.bin -%endif +%description vhost-user-gpu +This package contains a vhost user mode virtio-gpu 2D/3D rendering backend for +QEMU. %files vhost-user-gpu %defattr(-, root, root) @@ -2629,6 +1528,29 @@ fi %_datadir/%name/vhost-user/50-qemu-gpu.json %_libexecdir/vhost-user-gpu +%package tools +Summary: Tools for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires(pre): permissions +Requires: group(kvm) +Recommends: multipath-tools +Recommends: qemu-block-curl +%if 0%{?with_rbd} +Recommends: qemu-block-rbd +%endif + +%description tools +This package contains various QEMU related tools, including a bridge helper, +a virtfs helper, ivshmem, disk utilities and scripts for various purposes. + +%post tools +%set_permissions %_libexecdir/qemu-bridge-helper + +%verifyscript tools +%verify_permissions %_libexecdir/qemu-bridge-helper + %files tools %defattr(-, root, root) %_bindir/analyze-migration.py @@ -2651,6 +1573,19 @@ fi %dir %_sysconfdir/%name %config %_sysconfdir/%name/bridge.conf +%package ivshmem-tools +Summary: Inter-VM Shared Memory Tools for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/07 + +%description ivshmem-tools +This package contains a sample shared memory client and server which utilize +QEMU's Inter-VM shared memory device as specified by the ivshmem client-server +protocol specification documented in docs/specs/ivshmem-spec.txt in QEMU source +code. + %files ivshmem-tools %defattr(-, root, root) %dir %_datadir/%name @@ -2659,6 +1594,44 @@ fi %_bindir/ivshmem-client %_bindir/ivshmem-server +%package guest-agent +Summary: Guest agent for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: group(kvm) +Requires(post): udev +Supplements: modalias(acpi*:QEMU0002%3A*) +Supplements: modalias(pci:v00005853d00000001sv*sd*bc*sc*i*) +Supplements: modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*) +%{?systemd_ordering} + +%description guest-agent +This package contains the QEMU guest agent. It is installed in the linux guest +to provide information and control at the guest OS level. + +%pre guest-agent +%service_add_pre qemu-guest-agent.service + +%post guest-agent +%service_add_post qemu-guest-agent.service +if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then + /usr/bin/systemctl start qemu-guest-agent.service || : +fi + +%preun guest-agent +if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then + /usr/bin/systemctl stop qemu-guest-agent.service || : +fi + +%postun guest-agent +%service_del_postun_without_restart qemu-guest-agent.service +if [ "$1" = "1" ] ; then + if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then + /usr/bin/systemctl restart qemu-guest-agent.service || : + fi +fi + %files guest-agent %defattr(-, root, root) %attr(0755,root,kvm) %_bindir/qemu-ga @@ -2668,10 +1641,50 @@ fi %{_unitdir}/qemu-guest-agent.service /usr/lib/udev/rules.d/80-qemu-ga.rules +%package ksm +Summary: Kernel Samepage Merging services +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires(pre): coreutils +Requires(post): coreutils + +%description ksm +Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that +merges anonymous (private) pages (not pagecache ones). + +This package provides a service file for starting and stopping KSM. + +%pre ksm +%service_add_pre ksm.service + +%post ksm +%service_add_post ksm.service + +%preun ksm +%service_del_preun ksm.service + +%postun ksm +%service_del_postun ksm.service + %files ksm %defattr(-, root, root) %{_unitdir}/ksm.service +%package accel-tcg-x86 +Summary: TCG accelerator for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/15 +%{qemu_module_conflicts} + +%description accel-tcg-x86 +TCG is the QEMU binary translator, responsible for converting from target to +host instruction set. + +This package provides the TCG accelerator for QEMU. + %files accel-tcg-x86 %defattr(-, root, root) %dir %_datadir/%name @@ -2681,6 +1694,20 @@ fi %_libdir/%name/accel-tcg-i386.so %_libdir/%name/accel-tcg-x86_64.so +%package accel-qtest +Summary: QTest accelerator for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/16 +%{qemu_module_conflicts} + +%description accel-qtest +QTest is a device emulation testing framework. It is useful to test device +models. + +This package provides QTest accelerator for testing QEMU. + %files accel-qtest %defattr(-, root, root) %dir %_datadir/%name @@ -2718,55 +1745,774 @@ fi %_libdir/%name/accel-qtest-xtensa.so %_libdir/%name/accel-qtest-xtensaeb.so -# above section is for qemu +%if %{build_x86_firmware} +%package microvm +Summary: x86 MicroVM firmware for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +BuildArch: noarch + +%description microvm +This package provides minimal x86 firmware for booting certain guests under +QEMU. qboot provides the minimum resources needed to boot PVH and bzImages. +bios-microvm, created from a minimal seabios configuration, provides slightly +wider support than qboot, but still focuses on quick boot up. + +%files microvm +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/bios-microvm.bin +%_datadir/%name/qboot.rom + +%package seabios +Summary: x86 Legacy BIOS for QEMU +Group: System/Emulators/PC +Version: %{sbver} +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description seabios +SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS +is the default and legacy BIOS for QEMU. + +%files seabios +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/bios.bin +%_datadir/%name/bios-256k.bin +%_datadir/%name/firmware/50-seabios-256k.json +%_datadir/%name/firmware/60-seabios-128k.json + +%package vgabios +Summary: VGA BIOSes for QEMU +Group: System/Emulators/PC +Version: %{sbver} +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description vgabios +VGABIOS provides the video ROM BIOSes for the following variants of VGA +emulated devices: Std VGA, QXL, Cirrus CLGD 5446 and VMware emulated +video card. For use with QEMU. + +%files vgabios +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/vgabios.bin +%_datadir/%name/vgabios-ati.bin +%_datadir/%name/vgabios-bochs-display.bin +%_datadir/%name/vgabios-cirrus.bin +%_datadir/%name/vgabios-qxl.bin +%_datadir/%name/vgabios-ramfb.bin +%_datadir/%name/vgabios-stdvga.bin +%_datadir/%name/vgabios-virtio.bin +%_datadir/%name/vgabios-vmware.bin + +%package sgabios +Summary: Serial Graphics Adapter BIOS for QEMU +Group: System/Emulators/PC +Version: 8 +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description sgabios +The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy +x86 software to communicate with an attached serial console as if a video card +were attached. For use with QEMU. + +%files sgabios +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/sgabios.bin + +%package ipxe +Summary: PXE ROMs for QEMU NICs +Group: System/Emulators/PC +Version: 1.0.0+ +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description ipxe +Provides Preboot Execution Environment (PXE) ROM support for various emulated +network adapters available with QEMU. + +%files ipxe +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/efi-e1000.rom +%_datadir/%name/efi-e1000e.rom +%_datadir/%name/efi-eepro100.rom +%_datadir/%name/efi-ne2k_pci.rom +%_datadir/%name/efi-pcnet.rom +%_datadir/%name/efi-rtl8139.rom +%_datadir/%name/efi-virtio.rom +%_datadir/%name/efi-vmxnet3.rom +%_datadir/%name/pxe-e1000.rom +%_datadir/%name/pxe-eepro100.rom +%_datadir/%name/pxe-ne2k_pci.rom +%_datadir/%name/pxe-pcnet.rom +%_datadir/%name/pxe-rtl8139.rom +%_datadir/%name/pxe-virtio.rom +# End of "if build_x86_firmware +%endif + +%if %{build_ppc_firmware} +%package skiboot +Summary: OPAL firmware (aka skiboot), used in booting OpenPOWER systems +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +BuildArch: noarch +Requires(post): update-alternatives +Requires(postun):update-alternatives +Provides: %name:%_datadir/%name/forsplits/06 + +%description skiboot +Provides OPAL (OpenPower Abstraction Layer) firmware, aka skiboot, as +traditionally packaged with QEMU. + +%post skiboot +update-alternatives --install \ + %{_datadir}/%name/skiboot.lid skiboot.lid %{_datadir}/%name/skiboot.lid.qemu 15 + +%preun skiboot +if [ ! -f %{_datadir}/%name/skiboot.lid.qemu ] ; then + update-alternatives --remove skiboot.lid %{_datadir}/%name/skiboot.lid.qemu +fi + +%files skiboot +%defattr(-, root, root) +%dir %_datadir/%name +%dir %_datadir/%name/forsplits +%_datadir/%name/forsplits/06 +%_datadir/%name/skiboot.lid +%_datadir/%name/skiboot.lid.qemu +%ghost %_sysconfdir/alternatives/skiboot.lid + +%package SLOF +Summary: Slimline Open Firmware - SLOF +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +BuildArch: noarch + +%description SLOF +Slimline Open Firmware (SLOF) is an implementation of the IEEE 1275 standard. +It can be used as partition firmware for pSeries machines running on QEMU or KVM. + +%files SLOF +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/slof.bin +# End of "if build_ppc_firmware +%endif +# End of descriptions and files for qemu and its subpackages +%endif + +%prep +%autosetup -p1 -n %{srcname}-%{expand:%%(SV=%{srcver};echo ${SV%%%%+git*})} + +%if "%{name}" == "qemu" +# Firmwares handling for package qemu (for qemu-linux-user, there's nothing +# that we need to do in this regard). + +# For the record, this set of firmware files is installed, but we don't +# build them (yet): bamboo.dtb canyonlands.dtb hppa-firmware.img openbios-ppc +# openbios-sparc32 openbios-sparc64 palcode-clipper petalogix-ml605.dtb +# petalogix-s3adsp1800.dtb QEMU,cgthree.bin QEMU,tcx.bin qemu_vga.ndrv +# u-boot.e500 u-boot-sam460-20100605.bin opensbi-riscv32-generic-fw_dynamic.bin +# opensbi-riscv32-generic-fw_dynamic.elfnpcm7xx_bootrom.bin vof.bin +# vof-nvram.bin + +# Note that: +# - default firmwares are built "by default", i.e., they're built automatically +# during the process of building QEMU (on each specific arch) +# - extra firmwares are built "manually" (see below) from their own sources +# (which, typically, are submodules checked out in the {srcdi}r/roms directory) +%define ppc_default_firmware %{nil} +%define ppc_extra_firmware {skiboot.lid slof.bin} +%define riscv64_default_firmware %{nil} +%define riscv64_extra_firmware {opensbi-riscv64-generic-fw_dynamic.bin} +%define s390x_default_firmware {s390-ccw.img s390-netboot.img} +%define s390x_extra_firmware %{nil} +%define x86_default_firmware {linuxboot.bin linuxboot_dma.bin multiboot.bin \ +multiboot_dma.bin kvmvapic.bin pvh.bin} +%define x86_extra_firmware {bios.bin bios-256k.bin bios-microvm.bin qboot.rom \ +pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom pxe-pcnet.rom pxe-rtl8139.rom \ +pxe-virtio.rom sgabios.bin vgabios-ati.bin vgabios-bochs-display.bin \ +vgabios.bin vgabios-cirrus.bin vgabios-qxl.bin vgabios-ramfb.bin \ +vgabios-stdvga.bin vgabios-virtio.bin vgabios-vmware.bin \ +efi-e1000.rom efi-e1000e.rom efi-eepro100.rom efi-ne2k_pci.rom efi-pcnet.rom \ +efi-rtl8139.rom efi-virtio.rom efi-vmxnet3.rom} + +# Complete list of all the firmwares that we build, if we consider +# all the builds, on all the arches. +%define firmware { \ +%{ppc_default_firmware} %{ppc_extra_firmware} \ +%{riscv64_default_firmware} %{riscv64_extra_firmware} \ +%{s390x_default_firmware} %{s390x_extra_firmware} \ +%{x86_default_firmware} %{x86_extra_firmware} } + +# Note that: +# - {arch}_default_built_firmware are the firmwares that we will be built by +# default in this particular build, on the arch where we currently are on +# - {arch}_extra_built_fimrware, likewise, but for extra firmwares, built manually +%ifarch ppc64 ppc64le +%define ppc_default_built_firmware %{ppc_default_firmware} +%endif +%ifarch riscv64 +%define riscv64_default_built_firmware %{riscv64_default_firmware} +%endif +%ifarch s390x +%define s390x_default_built_firmware %{s390x_default_firmware} +%endif +%ifarch %ix86 x86_64 +%define x86_default_built_firmware %{x86_default_firmware} +%endif + +%if %{build_opensbi_firmware} +%define riscv64_extra_built_firmware %{riscv64_extra_firmware} +%endif +%if %{build_ppc_firmware} +%define ppc_extra_built_firmware %{ppc_extra_firmware} +%endif +%if %{build_x86_firmware} +%define x86_extra_built_firmware %{x86_extra_firmware} +%endif + +# List of only firmwares that will actually be built, in this instance +%define built_firmware { \ +%{?ppc_default_built_firmware} %{?ppc_extra_built_firmware} \ +%{?riscv64_default_built_firmware} %{?riscv64_extra_built_firmware} \ +%{?s390x_default_built_firmware} %{?s390x_extra_built_firmware} \ +%{?x86_default_built_firmware} %{?x86_extra_built_firmware} } + +# End of firmware handling for package qemu +%endif + +%build +# non-x86 archs still seem to have some issues with Link Time Optimization +%ifnarch %ix86 x86_64 +%define _lto_cflags %{nil} +%endif + +%if %{legacy_qemu_kvm} +%ifarch s390x +cp %{SOURCE13} docs/supported.rst +%else +# FIXME: So... We always put this same document there... Why the ifarch then ? +cp %{SOURCE13} docs/supported.rst +%endif +# End of "if legacy_qemu_kvm" +%endif + +mkdir -p %blddir +cd %blddir +# Configure options for qemu and qemu-linux-user packages +%srcdir/configure \ + --prefix=%_prefix \ + --sysconfdir=%_sysconfdir \ + --libdir=%_libdir \ + --libexecdir=%_libexecdir \ + --localstatedir=%_localstatedir \ + --docdir=%_docdir \ + --firmwarepath=%_datadir/%name \ + --python=%_bindir/python3 \ + --extra-cflags="%{optflags}" \ + --with-git-submodules=ignore \ + --with-pkgversion="%(echo '%{distro}' | sed 's/ (.*)//')" \ + --disable-fuzzing \ + --disable-multiprocess \ + --disable-stack-protector \ + --disable-strip \ + --disable-tcg-interpreter \ + --disable-qom-cast-debug \ + --enable-coroutine-pool \ +%if "%{_lto_cflags}" != "%{nil}" + --enable-lto \ +%endif +%if %{with system_membarrier} + --enable-membarrier \ +%else + --disable-membarrier \ %endif -# ------------------------------------------------------------------------ %if "%{name}" == "qemu-linux-user" - -%_bindir/qemu-aarch64 -%_bindir/qemu-aarch64_be -%_bindir/qemu-alpha -%_bindir/qemu-arm -%_bindir/qemu-armeb -%_bindir/qemu-cris -%_bindir/qemu-hexagon -%_bindir/qemu-hppa -%_bindir/qemu-i386 -%_bindir/qemu-m68k -%_bindir/qemu-microblaze -%_bindir/qemu-microblazeel -%_bindir/qemu-mips -%_bindir/qemu-mips64 -%_bindir/qemu-mips64el -%_bindir/qemu-mipsel -%_bindir/qemu-mipsn32 -%_bindir/qemu-mipsn32el -%_bindir/qemu-nios2 -%_bindir/qemu-or1k -%_bindir/qemu-ppc -%_bindir/qemu-ppc64 -%_bindir/qemu-ppc64le -%_bindir/qemu-riscv32 -%_bindir/qemu-riscv64 -%_bindir/qemu-s390x -%_bindir/qemu-sh4 -%_bindir/qemu-sh4eb -%_bindir/qemu-sparc -%_bindir/qemu-sparc32plus -%_bindir/qemu-sparc64 -%_bindir/qemu-x86_64 -%_bindir/qemu-xtensa -%_bindir/qemu-xtensaeb -%_bindir/qemu-binfmt -%_bindir/qemu-*-binfmt -%_sbindir/qemu-binfmt-conf.sh - + --disable-blobs \ + --disable-bochs \ + --disable-capstone \ + --disable-cloop \ + --disable-dmg \ + --disable-docs \ + --disable-fdt \ + --disable-gio \ + --disable-guest-agent \ + --disable-iconv \ + --disable-kvm \ + --disable-libdaxctl \ + --disable-linux-io-uring \ + --disable-malloc-trim \ + --disable-modules \ + --disable-parallels \ + --disable-pie \ + --disable-plugins \ + --disable-qcow1 \ + --disable-qed \ + --disable-replication \ + --disable-safe-stack \ + --disable-slirp \ + --disable-system \ + --disable-tools \ + --disable-tpm \ + --disable-vdi \ + --disable-vhost-crypto \ + --disable-vhost-kernel \ + --disable-vhost-net \ + --disable-vhost-scsi \ + --disable-vhost-user \ + --disable-vhost-user-blk-server \ + --disable-vhost-vsock \ + --disable-vnc \ + --disable-vvfat \ + --disable-vhost-user-fs \ + --disable-xkbcommon \ + --enable-linux-user \ + --static \ + --without-default-devices \ +%else +%if %{kvm_available} + --enable-kvm \ +%else + --disable-kvm \ %endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-testsuite" +%if 0%{?with_daxctl} + --enable-libdaxctl \ +%else + --disable-libdaxctl \ +%endif +%ifarch x86_64 + --enable-libpmem \ +%else + --disable-libpmem \ +%endif +%if 0%{?with_uring} + --enable-linux-io-uring \ +%else + --disable-linux-io-uring \ +%endif +%ifarch %arm s390x + --disable-numa \ +%else + --enable-numa \ +%endif +%if 0%{?with_rbd} + --enable-rbd \ +%else + --disable-rbd \ +%endif +%ifarch x86_64 + --enable-xen \ + --enable-xen-pci-passthrough \ +%else + --disable-xen \ +%endif + --disable-auth-pam \ + --disable-capstone \ + --disable-crypto-afalg \ + --disable-hax \ + --disable-hvf \ + --disable-linux-user \ + --disable-malloc-trim \ + --disable-module-upgrades \ + --disable-netmap \ + --disable-nettle \ + --disable-safe-stack \ + --disable-sanitizers \ + --disable-sdl \ + --disable-sdl-image \ + --disable-plugins \ + --disable-whpx \ + --enable-attr \ + --enable-bochs \ + --enable-brlapi \ + --enable-bzip2 \ + --enable-cap-ng \ + --enable-cloop \ + --enable-curl \ + --enable-curses \ + --enable-dmg \ + --enable-docs \ + --enable-fdt \ + --enable-gcrypt \ + --enable-gio \ + --enable-glusterfs \ + --enable-gnutls \ + --enable-gtk \ + --enable-guest-agent \ + --enable-iconv \ + --enable-libiscsi \ + --enable-libnfs \ + --enable-libssh \ + --enable-libusb \ + --enable-linux-aio \ + --enable-lzfse \ + --enable-lzo \ + --enable-modules \ + --enable-mpath \ + --enable-opengl \ + --enable-parallels \ + --enable-pie \ + --enable-pvrdma \ + --enable-qcow1 \ + --enable-qed \ + --enable-rdma \ + --enable-replication \ + --enable-seccomp \ + --enable-slirp=system \ + --enable-smartcard \ + --enable-snappy \ + --enable-spice \ + --enable-system \ + --enable-tools \ + --enable-tpm \ + --enable-usb-redir \ + --enable-vde \ + --enable-vdi \ + --enable-vhost-crypto \ + --enable-vhost-kernel \ + --enable-vhost-net \ + --enable-vhost-scsi \ + --enable-vhost-user \ + --enable-vhost-user-blk-server \ + --enable-vhost-vdpa \ + --enable-vhost-vsock \ + --enable-virglrenderer \ + --enable-virtfs \ + --enable-vnc \ + --enable-vnc-jpeg \ + --enable-vnc-png \ + --enable-vnc-sasl \ + --enable-vte \ + --enable-vvfat \ + --enable-werror \ + --enable-zstd \ + --enable-vhost-user-fs \ + --enable-xkbcommon \ + --with-default-devices \ +%endif +# End of configure options for packages qemu and qemu-linux-user -%_datadir/qemu/check-report.tap +%if "%{name}" == "qemu" +# If we are building the qemu package, we first need to delete, from the +# pc-bios directory, all the binary firmware files that we are going to build +# ourselves. We will reinstate their built version later. +for i in %built_firmware +do + unlink %srcdir/pc-bios/$i +done +%endif +%make_build +#V=1 VERBOSE=1 + +%if "%{name}" == "qemu" +# Second part of the firmware handling process for the qemu package. We have +# already built QEMU (see make_build above), which means we have also built +# all the "default" (see above) firmwares. Therefore, we can copy them to the +# pc-bios directory, since we want them to be there for the install phase. +for i in %{?s390x_default_built_firmware} +do + cp pc-bios/s390-ccw/$i %srcdir/pc-bios/ +done +for i in %{?x86_default_built_firmware} +do + cp pc-bios/optionrom/$i %srcdir/pc-bios/ +done + +# The last step is building the "extra" (see above) firmwares. The binaries +# will just end up in the pc-bios directory by themselves, so there's no need +# to manually copy them there. Note also that the Makefile in {srcdir}/roms +# does some cross-compiler auto detection. So we often don't need to define +# or pass CROSS= and CROSS_COMPILE ourselves, when we're cross compiling. +%if %{build_ppc_firmware} +# FIXME: check if we can upstream: Makefile-define-endianess-for-cross-buil.patch +%make_build -C %srcdir/roms skiboot +%make_build -C %srcdir/roms slof +%endif +%if %{build_opensbi_firmware} +%make_build -C %srcdir/roms opensbi64-generic +%endif +%if %{build_x86_firmware} +%make_build %{?_smp_mflags} -C %srcdir/roms bios SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" +# FIXME: check if we can upstream: roms-Makefile-add-cross-file-to-qboot-me.patch +# and qboot-add-cross.ini-file-to-handle-aarch.patch +%make_build -C %srcdir/roms qboot +%make_build -C %srcdir/roms seavgabios +%make_build -C %srcdir/roms seavgabios-ati +%make_build -C %srcdir/roms pxerom +%make_build -C %srcdir/roms efirom EDK2_BASETOOLS_OPTFLAGS='-fPIE' +# We're currently not building firmware on ix86, but let's make sure this works +# fine if one enables it, e.g., locally (for debugging or something). +# FIXME: check if we can get rid or upstream: roms-sgabios-Fix-csum8-to-be-built-by-ho.patch +make -C %srcdir/roms sgabios HOSTCC=cc \ +%ifnarch %ix86 x86_64 + CC=x86_64-suse-linux-gcc LD=x86_64-suse-linux-ld \ +%endif + %{nil} + +%if %{force_fit_virtio_pxe_rom} +pushd %srcdir +patch -p1 < %_sourcedir/stub-out-the-SAN-req-s-in-int13.patch +popd +%make_build -C %srcdir/roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom +%endif + +for i in %supported_nics_large %unsupported_nics + do + if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "131072" ; then + echo "pxe rom is too large" + exit 1 + fi + if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -le "65536" ; then + ./%srcdir/roms/ipxe/src/util/padimg.pl %srcdir/pc-bios/pxe-$i.rom -s 65536 -b 255 + echo -ne "SEGMENT OVERAGE\0" >> %srcdir/pc-bios/pxe-$i.rom + fi +done +for i in %supported_nics_small + do + if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "65536" ; then + echo "pxe rom is too large" + exit 1 + fi +done +# End of "if build_x86_firmware" +%endif + +# Done handling firmwares for qemu +%endif + +%install +cd %blddir +%make_build install DESTDIR=%{buildroot} + +%if "%{name}" == "qemu-linux-user" +# Adjust the content of the buildroot for the qemu-linux-user package +rm -rf %{buildroot}%_datadir/qemu/keymaps +unlink %{buildroot}%_datadir/qemu/trace-events-all +install -d -m 755 %{buildroot}%_sbindir +# FIXME: All the following symlinking is just legacy and should go away! +install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64_be-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-alpha-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-armeb-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-cris-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hexagon-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hppa-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-i386-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-m68k-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblaze-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblazeel-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64el-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsel-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32el-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-nios2-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-or1k-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64le-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-s390x-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4eb-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc32plus-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-x86_64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensa-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt +# Done setting up the buildroot for qemu-linux-user +%else +# Adjust the content of the buildroot for the qemu and all its subpackages +%find_lang %name +install -d -m 0755 %{buildroot}%_datadir/%name/firmware +install -d -m 0755 %{buildroot}/usr/lib/supportconfig/plugins +install -d -m 0755 %{buildroot}%_sysconfdir/%name/firmware +install -D -m 0644 %{SOURCE4} %{buildroot}%_sysconfdir/%name/bridge.conf +install -D -m 0755 %{SOURCE3} %{buildroot}%_datadir/%name/qemu-ifup +install -D -p -m 0644 %{SOURCE8} %{buildroot}/usr/lib/udev/rules.d/80-qemu-ga.rules +install -D -m 0755 scripts/analyze-migration.py %{buildroot}%_bindir/analyze-migration.py +install -D -m 0755 scripts/vmstate-static-checker.py %{buildroot}%_bindir/vmstate-static-checker.py +install -D -m 0755 scripts/kvm/vmxcap %{buildroot}%_bindir/vmxcap +install -D -m 0755 %{SOURCE9} %{buildroot}/usr/lib/supportconfig/plugins/%name +install -D -m 0644 %{SOURCE10} %{buildroot}%_docdir/qemu-arm/supported.txt +install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt +install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt +install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390x/supported.txt +%if %{legacy_qemu_kvm} +install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz +install -d %{buildroot}%_docdir/qemu-kvm +%ifarch s390x +ln -s qemu-system-s390x %{buildroot}%_bindir/qemu-kvm +ln -s ../qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt +rst2html --exit-status=2 %{buildroot}%_docdir/qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html +%else +ln -s qemu-system-x86_64 %{buildroot}%_bindir/qemu-kvm +ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt +rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html +%endif +# End of "if legacy_qemu_kvm" +%endif +%if %{kvm_available} +install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/80-kvm.rules +%endif +install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-guest-agent.service +install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service +%ifarch s390x +install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf +%endif + +# We rely on a separate project / package to provide edk2 firmware +unlink %{buildroot}%_datadir/%name/edk2-licenses.txt +unlink %{buildroot}%_datadir/%name/firmware/50-edk2-i386-secure.json +unlink %{buildroot}%_datadir/%name/firmware/50-edk2-x86_64-secure.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-aarch64.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-arm.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-i386.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-x86_64.json +unlink %{buildroot}%_datadir/%name/edk2-aarch64-code.fd +unlink %{buildroot}%_datadir/%name/edk2-arm-code.fd +unlink %{buildroot}%_datadir/%name/edk2-arm-vars.fd +unlink %{buildroot}%_datadir/%name/edk2-i386-code.fd +unlink %{buildroot}%_datadir/%name/edk2-i386-secure-code.fd +unlink %{buildroot}%_datadir/%name/edk2-i386-vars.fd +unlink %{buildroot}%_datadir/%name/edk2-x86_64-code.fd +unlink %{buildroot}%_datadir/%name/edk2-x86_64-secure-code.fd + +# this was never meant for customer consumption - delete even though installed +unlink %{buildroot}%_bindir/elf2dmp + +install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt +for X in 00 01 02 03 04 05 07 08 09 10 11 12 13 14 15 16 17 18 19 +do + ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X +done + +# For PPC and x86 firmwares, there are a few extra install steps necessary. +# In general, if we know that we have not built a firmware, we must remove it +# from the install base. In fact, the one that we have there is the upstream +# provided binary, which we don't want to ship. +%if %{build_ppc_firmware} +# in support of update-alternatives +mv %{buildroot}%_datadir/%name/skiboot.lid %{buildroot}%_datadir/%name/skiboot.lid.qemu +# create a dummy target for /etc/alternatives/skiboot.lid +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +ln -s -f %{_sysconfdir}/alternatives/skiboot.lid %{buildroot}%{_datadir}/%name/skiboot.lid +ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/06 +%else +for f in %{ppc_extra_firmware} ; do + unlink %{buildroot}%_datadir/%name/$f +done +# End of "if build_ppc_firmware" +%endif +%if %{build_x86_firmware} +install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json +install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json +%else +for f in %{x86_extra_firmware} ; do + unlink %{buildroot}%_datadir/%name/$f +done +# Enf of "if build_x86_firmware" +%endif + +# For riscv64 firmwares (currently, only opensbi), we actuallly leave the +# upstream provided binaries there, as they're part of the qemu-extra package +# (and riscv is a bit special in many ways already). + +%suse_update_desktop_file qemu + +# End of setting up the buildroot for qemu and its subpackages +%endif +# Get rid of dupes (NB: this is common to qemu and qemu-linux-user) +%fdupes -s %{buildroot} + +%check +cd %blddir + +%if "%{name}" == "qemu" +# Let's try to run 'make check' for the qemu package + +# Patch 'increase x86_64 physical bits to 42' requires that the DSDT used for +# acpi [q]tests is modified too. But it's binary, and that means we cannot +# do that in the patch itself. Instead, we keep a copy of the binary in the +# package sources, and put it in place now, before the tests themselves. +# If that patch is removed, the following line needs to go as well. +cp %{SOURCE202} %{srcdir}/tests/data/acpi/microvm/ + +# Compile the QOM test binary first, so that ... +%make_build tests/qtest/qom-test +# ... make comes in fresh and has lots of address space (needed for 32bit, bsc#957379) +# FIXME: is this still a problem? +# Let's build everything first +%make_build check-build + +# Let's run the 'make check' component individually, so we have more +# control on the options (like -j, etc) +%make_build check-unit +%make_build check-qapi-schema +# iotests are not reliable if ran in parallel in OBS +%make_build -j1 check-block +%make_build check-softfloat +%make_build check-qtest +# FIXME: does it make sense to give it a run to, as a recap: +#make_build check-report.junit.xml ? + +# End of checks for qemu +%else +# Let's run the relevant check for the qemu-linux-user package + +%ifarch %ix86 +%define qemu_arch i386 +%endif +%ifarch x86_64 +%define qemu_arch x86_64 +%endif +%ifarch %arm +%define qemu_arch arm +%endif +%ifarch aarch64 +%define qemu_arch aarch64 +%endif +%ifarch ppc +%define qemu_arch ppc +%endif +%ifarch ppc64 +%define qemu_arch ppc64 +%endif +%ifarch ppc64le +%define qemu_arch ppc64le +%endif +%ifarch s390x +%define qemu_arch s390x +%endif + +%ifarch %ix86 x86_64 %arm aarch64 ppc ppc64 ppc64le s390x +%ifnarch %arm +%{qemu_arch}-linux-user/qemu-%{qemu_arch} %_bindir/ls > /dev/null +%endif +%endif + +%make_build check-softfloat +# Done with checks for qemu-linux-user %endif %changelog diff --git a/qemu.spec.in b/qemu.spec.in index 6b87be3f..10fcbdda 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -15,13 +15,26 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # - # !! IMPORTANT !! See README.PACKAGING before modifying package in any way #!ForceMultiversion +# qemu and qemu-linux-user "flavors" are enabled via OBS Multibuild +%global flavor @BUILD_FLAVOR@%{nil} +%define name_suffix %{nil} + +%if "%flavor" == "linux-user" + %define name_suffix -linux-user + %define summary_string CPU emulator for user space +%else + %define summary_string Machine emulator and virtualizer +%endif + %define _buildshell /bin/bash +%define srcdir %{_builddir}/%buildsubdir +%define blddir %srcdir/build + %define build_x86_firmware 0 %define build_ppc_firmware 0 %define build_opensbi_firmware 0 @@ -30,9 +43,9 @@ %define force_fit_virtio_pxe_rom 1 %if "%{?distribution}" == "" -%define distro private-build + %define distro private-build %else -%define distro %{distribution} + %define distro %{distribution} %endif # So, we have openSUSE:Factory, and we have "ports". In openSUSE:Factory, we @@ -50,58 +63,60 @@ # be available in as many ports as possible (as noarch packages). %ifarch x86_64 aarch64 -%define build_ppc_firmware 1 -# Currently, opensbi does not cross build cleanly on 15.3 and 15.4 -%if ! 0%{?sle_version} -%define build_opensbi_firmware 1 -%endif -%define build_x86_firmware 1 + %define build_ppc_firmware 1 + # Currently, opensbi does not cross build cleanly on 15.3 and 15.4 + %if ! 0%{?sle_version} + %define build_opensbi_firmware 1 + %endif + %define build_x86_firmware 1 %endif %ifarch ppc64 ppc64le -%define build_ppc_firmware 1 -%if ! 0%{?sle_version} -%define build_opensbi_firmware 1 -%endif -# FIXME: Try to enable cross building of x86 firmwares here on PPC + %define build_ppc_firmware 1 + %if ! 0%{?sle_version} + %define build_opensbi_firmware 1 + %endif + # FIXME: Try to enable cross building of x86 firmwares here on PPC %endif %ifarch riscv64 -%define build_opensbi_firmware 1 + %define build_opensbi_firmware 1 %endif %ifarch %ix86 x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 -%define kvm_available 1 -%define with_uring 1 -%define liburing_min_version 1.0 + %define kvm_available 1 + %define with_uring 1 + %define liburing_min_version 1.0 %endif %ifarch %ix86 x86_64 s390x -%define legacy_qemu_kvm 1 + %define legacy_qemu_kvm 1 %endif %ifarch x86_64 aarch64 ppc64le s390x -%define with_rbd 1 + %define with_rbd 1 %endif %ifarch x86_64 ppc64le -%define with_daxctl 1 + %define with_daxctl 1 %endif -# qemu, qemu-linux-user, and qemu-testsuite "flavors" are enabled via OBS Multibuild -%global flavor @BUILD_FLAVOR@%{nil} -%define name_suffix %{nil} -%if "%flavor" == "testsuite" -%define name_suffix -testsuite -%endif -%if "%flavor" == "linux-user" -%define name_suffix -linux-user -%define summary_string CPU emulator for user space -%else -%define summary_string Machine emulator and virtualizer -%endif +# Enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward. +# The following ones need to be > 64K +%define supported_nics_large {e1000 rtl8139} +# The following ones need to be <= 64K +%define supported_nics_small {virtio} +# Though not required, make unsupported pxe roms migration compatable as well +%define unsupported_nics {eepro100 ne2k_pci pcnet} + +%define generic_qemu_description \ +QEMU provides full machine emulation and cross architecture usage. \ +It closely integrates with KVM and Xen virtualization, allowing for \ +excellent performance. Many options are available for defining the \ +emulated environment, including traditional devices, direct host device \ +access, and interfaces specific to virtualization. %bcond_with system_membarrier -INSERT_VERSIONING +INSERT_VERSIONING_DO_NOT_TOUCH_THIS_LINE %define srcname qemu Name: qemu%{name_suffix} URL: https://www.qemu.org/ @@ -129,20 +144,15 @@ Source14: 50-seabios-256k.json Source15: 60-seabios-128k.json Source200: qemu-rpmlintrc Source201: pkg-split.txt +Source202: DSDT.pcie Source300: bundles.tar.xz Source301: update_git.sh Source302: config.sh Source303: README.PACKAGING # Upstream First -- https://wiki.qemu.org/Contribute/SubmitAPatch -# This patch queue is auto-generated - see README.PACKAGING for process - -PATCH_FILES - -# Please do not add patches manually here. - +PATCH_FILES_DO_NOT_TOUCH_THIS_LINE BuildRoot: %{_tmppath}/%{name}-%{version}-build - -# Common BuildRequires listed here: +# Build dependencies common to qemu and qemu-linux-user packages BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: meson @@ -150,6 +160,7 @@ BuildRequires: ninja >= 1.7 BuildRequires: python3-base >= 3.6 BuildRequires: python3-setuptools %if "%{name}" == "qemu-linux-user" +# Build dependencies exclusive to the qemu-linux-user package BuildRequires: glib2-devel-static >= 2.56 BuildRequires: glibc-devel-static BuildRequires: pcre-devel-static @@ -158,16 +169,9 @@ BuildRequires: zlib-devel-static %if 0%{?qemu_user_space_build:1} #!BuildIgnore: post-build-checks %endif - -%description -QEMU provides CPU emulation along with other related capabilities. This package -provides programs to run user space binaries and libraries meant for another -architecture. The syscall interface is intercepted and execution below the -syscall layer occurs on the native hardware and operating system. - -# above section is for qemu-linux-user -# ------------------------------------------------------------------------ +# End of build dependencies for qemu-linux-user %else +# Build dependencies exclusive to the qemu package %if %{build_x86_firmware} BuildRequires: acpica BuildRequires: binutils-devel @@ -192,82 +196,86 @@ BuildRequires: cross-ppc64-binutils BuildRequires: cross-ppc64-gcc%gcc_version %endif %endif -BuildRequires: pkgconfig(alsa) +%if 0%{?with_daxctl} +BuildRequires: pkgconfig(libndctl) +%endif +%ifnarch %arm s390x +BuildRequires: libnuma-devel +%endif +%ifarch x86_64 +BuildRequires: pkgconfig(libpmem) +%endif +%if 0%{?with_rbd} +BuildRequires: librbd-devel +%endif +%if 0%{?with_uring} +BuildRequires: pkgconfig(liburing) >= %liburing_min_version +%endif +%if %{kvm_available} +BuildRequires: pkgconfig(udev) +%endif +%ifarch x86_64 +BuildRequires: xen-devel >= 4.2 +%endif +BuildRequires: Mesa-devel BuildRequires: bison BuildRequires: brlapi-devel -BuildRequires: pkgconfig(libcurl) >= 7.29 -BuildRequires: pkgconfig(libsasl2) BuildRequires: flex -BuildRequires: pkgconfig(glib-2.0) >= 2.56 BuildRequires: libaio-devel BuildRequires: libattr-devel BuildRequires: libbz2-devel BuildRequires: libfdt-devel >= 1.4.2 BuildRequires: libgcrypt-devel >= 1.8.0 -BuildRequires: pkgconfig(epoxy) -BuildRequires: pkgconfig(gbm) -BuildRequires: pkgconfig(glusterfs-api) >= 3 -BuildRequires: pkgconfig(gnutls) >= 3.5.18 -BuildRequires: pkgconfig(gtk+-3.0) >= 3.22 -BuildRequires: pkgconfig(libcacard) >= 2.5.1 -BuildRequires: pkgconfig(libcap-ng) -BuildRequires: pkgconfig(libdrm) -BuildRequires: pkgconfig(libiscsi) >= 1.9.0 -BuildRequires: pkgconfig(libjpeg) -%if 0%{?with_daxctl} -BuildRequires: pkgconfig(libndctl) -%endif -BuildRequires: pkgconfig(libnfs) >= 1.9.3 -%ifnarch %arm s390x -BuildRequires: libnuma-devel -%endif -BuildRequires: pkgconfig(pixman-1) >= 0.21.8 -%ifarch x86_64 -BuildRequires: pkgconfig(libpmem) -%endif -BuildRequires: pkgconfig(jack) -BuildRequires: pkgconfig(libpng) -BuildRequires: pkgconfig(libpulse) -%if 0%{?with_rbd} -BuildRequires: librbd-devel -%endif -BuildRequires: Mesa-devel -BuildRequires: pkgconfig(libseccomp) >= 2.3.0 -BuildRequires: pkgconfig(libssh) >= 0.8.7 -BuildRequires: pkgconfig(slirp) >= 4.2.0 -BuildRequires: pkgconfig(spice-server) >= 0.12.5 -%if 0%{?with_uring} -BuildRequires: pkgconfig(liburing) >= %liburing_min_version -%endif BuildRequires: lzfse-devel BuildRequires: multipath-tools-devel BuildRequires: pkgconfig +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(epoxy) +BuildRequires: pkgconfig(gbm) +BuildRequires: pkgconfig(glib-2.0) >= 2.56 +BuildRequires: pkgconfig(glusterfs-api) >= 3 +BuildRequires: pkgconfig(gnutls) >= 3.5.18 +BuildRequires: pkgconfig(gtk+-3.0) >= 3.22 +BuildRequires: pkgconfig(jack) +BuildRequires: pkgconfig(libcacard) >= 2.5.1 +BuildRequires: pkgconfig(libcap-ng) +BuildRequires: pkgconfig(libcurl) >= 7.29 +BuildRequires: pkgconfig(libdrm) +BuildRequires: pkgconfig(libiscsi) >= 1.9.0 +BuildRequires: pkgconfig(libjpeg) +BuildRequires: pkgconfig(libnfs) >= 1.9.3 +BuildRequires: pkgconfig(libpng) +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(libsasl2) +BuildRequires: pkgconfig(libseccomp) >= 2.3.0 +BuildRequires: pkgconfig(libssh) >= 0.8.7 +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(libusb-1.0) >= 1.0.13 +BuildRequires: pkgconfig(libzstd) +BuildRequires: pkgconfig(lzo2) +BuildRequires: pkgconfig(ncurses) +BuildRequires: pkgconfig(pixman-1) >= 0.21.8 +BuildRequires: pkgconfig(slirp) >= 4.2.0 +BuildRequires: pkgconfig(spice-protocol) >= 0.12.3 +BuildRequires: pkgconfig(spice-server) >= 0.12.5 +BuildRequires: pkgconfig(systemd) +BuildRequires: pkgconfig(vdeplug) +BuildRequires: pkgconfig(virglrenderer) >= 0.4.1 +BuildRequires: pkgconfig(vte-2.91) +BuildRequires: pkgconfig(xkbcommon) +BuildRequires: pkgconfig(zlib) BuildRequires: python3-Sphinx BuildRequires: rdma-core-devel BuildRequires: snappy-devel -BuildRequires: pkgconfig(libudev) -BuildRequires: pkgconfig(libusb-1.0) >= 1.0.13 -BuildRequires: pkgconfig(lzo2) -BuildRequires: pkgconfig(ncurses) -BuildRequires: pkgconfig(spice-protocol) >= 0.12.3 -BuildRequires: pkgconfig(systemd) -BuildRequires: pkgconfig(vdeplug) -BuildRequires: pkgconfig(xkbcommon) -%{?systemd_ordering} -%if %{kvm_available} -BuildRequires: pkgconfig(udev) -%endif BuildRequires: update-desktop-files BuildRequires: usbredir-devel >= 0.6 -BuildRequires: pkgconfig(virglrenderer) >= 0.4.1 -BuildRequires: pkgconfig(vte-2.91) -%ifarch x86_64 -BuildRequires: xen-devel >= 4.2 -%endif BuildRequires: xfsprogs-devel -BuildRequires: pkgconfig(zlib) -BuildRequires: pkgconfig(libzstd) +%{?systemd_ordering} +# End of build dependencies for qemu +%endif %if "%{name}" == "qemu" +# Required, recommended, etc for the qemu package (note that there's basically +# none of these for the qemu-linux-user package). Requires: group(kvm) Requires: group(qemu) Requires: user(qemu) @@ -299,11 +307,8 @@ Requires: qemu-arm Suggests: qemu-arm %endif Recommends: kvm_stat +# End of "if kvm_available" %endif -Recommends: qemu-block-curl -Recommends: qemu-ksm = %{qemuver} -Recommends: qemu-tools -Recommends: qemu-ui-curses %ifarch s390x Recommends: qemu-hw-s390x-virtio-gpu-ccw %else @@ -316,1374 +321,103 @@ Recommends: qemu-hw-usb-redirect Recommends: qemu-hw-usb-smartcard Recommends: qemu-ui-gtk Recommends: qemu-ui-spice-app +# End of "ifarch s390x" %endif +%if 0%{?with_rbd} +Suggests: qemu-block-rbd +%endif +Recommends: qemu-block-curl +Recommends: qemu-ksm = %{qemuver} +Recommends: qemu-tools +Recommends: qemu-ui-curses +Suggests: qemu-accel-qtest Suggests: qemu-block-dmg Suggests: qemu-block-gluster Suggests: qemu-block-iscsi Suggests: qemu-block-nfs -%if 0%{?with_rbd} -Suggests: qemu-block-rbd -%endif Suggests: qemu-block-ssh Suggests: qemu-chardev-baum Suggests: qemu-extra -Suggests: qemu-skiboot Suggests: qemu-lang Suggests: qemu-microvm +Suggests: qemu-skiboot Suggests: qemu-vhost-user-gpu -Suggests: qemu-accel-qtest Obsoletes: qemu-audio-oss < %{qemuver} Obsoletes: qemu-audio-sdl < %{qemuver} Obsoletes: qemu-ui-sdl < %{qemuver} +# End of Requires:, Recommends, Suggests: and Obsoletes: for qemu +%endif -%define generic_qemu_description QEMU provides full machine emulation and cross architecture usage. It closely\ -integrates with KVM and Xen virtualization, allowing for excellent performance.\ -Many options are available for defining the emulated environment, including\ -traditional devices, direct host device access, and interfaces specific to\ -virtualization. +%if "%{name}" == "qemu-linux-user" +# Description and files for the qemu-linux-user package %description -%{generic_qemu_description} +QEMU provides CPU emulation along with other related capabilities. This package +provides programs to run user space binaries and libraries meant for another +architecture. The syscall interface is intercepted and execution below the +syscall layer occurs on the native hardware and operating system. -This package acts as an umbrella package to the other QEMU sub-packages. - -%package x86 -Summary: Machine emulator and virtualizer for x86 architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Requires: qemu-accel-tcg-x86 -Requires: qemu-ipxe -Requires: qemu-seabios -Requires: qemu-sgabios -Requires: qemu-vgabios -Recommends: ovmf -Recommends: qemu-microvm -Recommends: qemu-ovmf-x86_64 - -%description x86 -%{generic_qemu_description} - -This package provides i386 and x86_64 emulation. - -%package ppc -Summary: Machine emulator and virtualizer for Power architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Requires: qemu-SLOF -Recommends: qemu-ipxe -Recommends: qemu-vgabios - -%description ppc -%{generic_qemu_description} - -This package provides ppc and ppc64 emulation. - -%package s390x -Summary: Machine emulator and virtualizer for S/390 architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Provides: qemu-s390 = %{qemuver} -Obsoletes: qemu-s390 < %{qemuver} - -%description s390x -%{generic_qemu_description} - -This package provides s390x emulation. - -%package arm -Summary: Machine emulator and virtualizer for ARM architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Recommends: ovmf -Recommends: qemu-ipxe -Recommends: qemu-uefi-aarch64 -Recommends: qemu-vgabios - -%description arm -%{generic_qemu_description} - -This package provides arm emulation. - -%package extra -Summary: Machine emulator and virtualizer for "extra" architectures -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: %name = %{qemuver} -Recommends: qemu-ipxe -Recommends: qemu-skiboot -Recommends: qemu-vgabios - -%description extra -%{generic_qemu_description} - -This package provides some lesser used emulations, including alpha, m68k, -mips, sparc, and xtensa. (The term "extra" is juxtapositioned against more -popular QEMU packages which are dedicated to a single architecture.) - -%if %{legacy_qemu_kvm} -%package kvm -Summary: Wrapper to enable KVM acceleration under QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%ifarch %ix86 x86_64 -Requires: qemu-x86 = %{qemuver} -%endif -%ifarch s390x -Requires: qemu-s390x = %{qemuver} -%endif -Provides: kvm = %{qemuver} -Obsoletes: kvm < %{qemuver} - -%description kvm -%{generic_qemu_description} - -This package provides a symlink to the main QEMU emulator used for KVM -virtualization. The symlink is named qemu-kvm, which causes the QEMU program -to enable the KVM accelerator, due to the name reference ending with 'kvm'. -This package is an artifact of the early origins of QEMU, and is deprecated. -%endif - -%package lang -Summary: Translations for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 - -%description lang -This package contains a few language translations, particularly for the -graphical user interface components that come with QEMU. The bulk of strings -in QEMU are not localized. +%files +%defattr(-, root, root) +%doc README.rst VERSION +%license COPYING COPYING.LIB LICENSE +%_bindir/qemu-aarch64 +%_bindir/qemu-aarch64_be +%_bindir/qemu-alpha +%_bindir/qemu-arm +%_bindir/qemu-armeb +%_bindir/qemu-cris +%_bindir/qemu-hexagon +%_bindir/qemu-hppa +%_bindir/qemu-i386 +%_bindir/qemu-m68k +%_bindir/qemu-microblaze +%_bindir/qemu-microblazeel +%_bindir/qemu-mips +%_bindir/qemu-mips64 +%_bindir/qemu-mips64el +%_bindir/qemu-mipsel +%_bindir/qemu-mipsn32 +%_bindir/qemu-mipsn32el +%_bindir/qemu-nios2 +%_bindir/qemu-or1k +%_bindir/qemu-ppc +%_bindir/qemu-ppc64 +%_bindir/qemu-ppc64le +%_bindir/qemu-riscv32 +%_bindir/qemu-riscv64 +%_bindir/qemu-s390x +%_bindir/qemu-sh4 +%_bindir/qemu-sh4eb +%_bindir/qemu-sparc +%_bindir/qemu-sparc32plus +%_bindir/qemu-sparc64 +%_bindir/qemu-x86_64 +%_bindir/qemu-xtensa +%_bindir/qemu-xtensaeb +%_bindir/qemu-binfmt +%_bindir/qemu-*-binfmt +%_sbindir/qemu-binfmt-conf.sh +# End of package description and files for qemu-linux-user +%else +# Description and files for the qemu package and for all its subpackages # Modules need to match {qemu-system-*,qemu-img} version. # We cannot have qemu and qemu-tools require them in the right version, # as that would drag in the dependencies the modules are supposed to avoid. # Nor can we have modules require the right version of qemu and qemu-tools # as Xen reuses our qemu-tools but does not want our qemu and qemu-x86. +# FIXME: Is it still true that Xen does not want our qemu and qemu-x86 ?!? %define qemu_module_conflicts \ Conflicts: %name < %{qemuver}-%{release} \ Conflicts: %name > %{qemuver}-%{release} \ Conflicts: qemu-tools < %{qemuver}-%{release} \ Conflicts: qemu-tools > %{qemuver}-%{release} -%package audio-alsa -Summary: ALSA based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-alsa -This package contains a module for ALSA based audio support for QEMU. - -%package audio-pa -Summary: Pulse Audio based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-pa -This package contains a module for Pulse Audio based audio support for QEMU. - -%package audio-jack -Summary: JACK based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-jack -This package contains a module for JACK based audio support for QEMU. - -%package audio-spice -Summary: Spice based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/05 -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description audio-spice -This package contains a module for Spice based audio support for QEMU. - -%package audio-oss -Summary: OSS based audio support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description audio-oss -This package contains a module for OSS based audio support for QEMU. - -%package block-curl -Summary: cURL block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-curl -This package contains a module for accessing network-based image files over -a network connection from qemu-img tool and QEMU system emulation. - -%package block-dmg -Summary: DMG block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-dmg -This package contains a module for accessing Mac OS X image files from -qemu-img tool and QEMU system emulation. - -%package block-gluster -Summary: GlusterFS block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-gluster -This package contains a module for accessing network-based image files over a -GlusterFS network connection from qemu-img tool and QEMU system emulation. - -%package block-iscsi -Summary: iSCSI block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-iscsi -This package contains a module for accessing network-based image files over an -iSCSI network connection from qemu-img tool and QEMU system emulation. - -%package block-nfs -Summary: direct Network File System support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-nfs -This package contains a module for directly accessing nfs based image files -for QEMU. - -%if 0%{?with_rbd} -%package block-rbd -Summary: Rados Block Device (Ceph) support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-rbd -This package contains a module for accessing ceph (rbd,rados) image files -for QEMU. -%endif - -%package block-ssh -Summary: SSH (SFTP) block support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description block-ssh -This package contains a module for accessing network-based image files over an -SSH network connection from qemu-img tool and QEMU system emulation. - -%package chardev-baum -Summary: Baum braille chardev support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/00 -%{qemu_module_conflicts} - -%description chardev-baum -This package contains a module for baum braille chardev support for QEMU. - -%package chardev-spice -Summary: Spice vmc and port chardev support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/08 -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description chardev-spice -This package contains a module for Spice chardev support for QEMU. - -%package hw-display-qxl -Summary: QXL display support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/01 -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description hw-display-qxl -This package contains a module for QXL display support for QEMU. - -%package hw-display-virtio-gpu -Summary: Virtio GPU display support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/04 -%{qemu_module_conflicts} - -%description hw-display-virtio-gpu -This package contains a module for Virtio GPU display support for QEMU. - -%package hw-display-virtio-gpu-pci -Summary: Virtio-gpu pci device for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-hw-display-virtio-gpu -Provides: %name:%_datadir/%name/forsplits/11 -%{qemu_module_conflicts} - -%description hw-display-virtio-gpu-pci -This package contains a module providing the virtio gpu pci device for QEMU. - -%package hw-display-virtio-vga -Summary: Virtio vga device for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/12 -%{qemu_module_conflicts} - -%description hw-display-virtio-vga -This package contains a module providing the virtio vga device for QEMU. - -%package hw-s390x-virtio-gpu-ccw -Summary: S390x virtio-gpu ccw device for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-hw-display-virtio-gpu -Provides: %name:%_datadir/%name/forsplits/13 -%{qemu_module_conflicts} - -%description hw-s390x-virtio-gpu-ccw -This package contains a module providing the s390x virtio gpu ccw device for -QEMU. - -%package hw-usb-redirect -Summary: USB redirection support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/02 -%{qemu_module_conflicts} - -%description hw-usb-redirect -This package contains a module for USB redirection support for QEMU. - -%package hw-usb-smartcard -Summary: USB smartcard support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/03 -%{qemu_module_conflicts} - -%description hw-usb-smartcard -This package contains a modules for USB smartcard support for QEMU. - -%package hw-usb-host -Summary: USB passthrough driver support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/14 -%{qemu_module_conflicts} - -%description hw-usb-host -This package contains a modules for USB passthrough driver for QEMU. - -%package ui-curses -Summary: Curses based UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description ui-curses -This package contains a module for doing curses based UI for QEMU. - -%package ui-gtk -Summary: GTK based UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-ui-opengl -%{qemu_module_conflicts} - -%description ui-gtk -This package contains a module for doing GTK based UI for QEMU. - -%package ui-opengl -Summary: OpenGL based UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/10 -%{qemu_module_conflicts} - -%description ui-opengl -This package contains a module for doing OpenGL based UI for QEMU. - -%package ui-spice-app -Summary: Spice UI support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: qemu-chardev-spice -Requires: qemu-ui-spice-core -%{qemu_module_conflicts} - -%description ui-spice-app -This package contains a module for doing Spice based UI for QEMU. - -%package ui-spice-core -Summary: Core Spice support for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/09 -Requires: qemu-ui-opengl -# This next Requires is only since virt-manager expects audio support -Requires: qemu-audio-spice -%{qemu_module_conflicts} - -%description ui-spice-core -This package contains a module with core Spice support for QEMU. - -%package vhost-user-gpu -Summary: Vhost user mode virtio-gpu 2D/3D rendering backend for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -%{qemu_module_conflicts} - -%description vhost-user-gpu -This package contains a vhost user mode virtio-gpu 2D/3D rendering backend for -QEMU. - -%package tools -Summary: Tools for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires(pre): permissions -Requires: group(kvm) -Recommends: multipath-tools -Recommends: qemu-block-curl -%if 0%{?with_rbd} -Recommends: qemu-block-rbd -%endif - -%description tools -This package contains various QEMU related tools, including a bridge helper, -a virtfs helper, ivshmem, disk utilities and scripts for various purposes. - -%package ivshmem-tools -Summary: Inter-VM Shared Memory Tools for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/07 - -%description ivshmem-tools -This package contains a sample shared memory client and server which utilize -QEMU's Inter-VM shared memory device as specified by the ivshmem client-server -protocol specification documented in docs/specs/ivshmem-spec.txt in QEMU source -code. - -%package guest-agent -Summary: Guest agent for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires: group(kvm) -Requires(post): udev -Supplements: modalias(acpi*:QEMU0002%3A*) -Supplements: modalias(pci:v00005853d00000001sv*sd*bc*sc*i*) -Supplements: modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*) -%{?systemd_ordering} - -%description guest-agent -This package contains the QEMU guest agent. It is installed in the linux guest -to provide information and control at the guest OS level. - -%if %{build_x86_firmware} -%package microvm -Summary: x86 MicroVM firmware for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -BuildArch: noarch - -%description microvm -This package provides minimal x86 firmware for booting certain guests under -QEMU. qboot provides the minimum resources needed to boot PVH and bzImages. -bios-microvm, created from a minimal seabios configuration, provides slightly -wider support than qboot, but still focuses on quick boot up. - -%package seabios -Summary: x86 Legacy BIOS for QEMU -Group: System/Emulators/PC -Version: %{sbver} -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description seabios -SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS -is the default and legacy BIOS for QEMU. - -%package vgabios -Summary: VGA BIOSes for QEMU -Group: System/Emulators/PC -Version: %{sbver} -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description vgabios -VGABIOS provides the video ROM BIOSes for the following variants of VGA -emulated devices: Std VGA, QXL, Cirrus CLGD 5446 and VMware emulated -video card. For use with QEMU. - -%package sgabios -Summary: Serial Graphics Adapter BIOS for QEMU -Group: System/Emulators/PC -Version: 8 -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description sgabios -The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy -x86 software to communicate with an attached serial console as if a video card -were attached. For use with QEMU. - -%package ipxe -Summary: PXE ROMs for QEMU NICs -Group: System/Emulators/PC -Version: 1.0.0+ -Release: 0 -BuildArch: noarch -Conflicts: %name < 1.6.0 - -%description ipxe -Provides Preboot Execution Environment (PXE) ROM support for various emulated -network adapters available with QEMU. -%endif - -%if %{build_ppc_firmware} -%package skiboot -Summary: OPAL firmware (aka skiboot), used in booting OpenPOWER systems -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -BuildArch: noarch -Requires(post): update-alternatives -Requires(postun):update-alternatives -Provides: %name:%_datadir/%name/forsplits/06 - -%description skiboot -Provides OPAL (OpenPower Abstraction Layer) firmware, aka skiboot, as -traditionally packaged with QEMU. - -%package SLOF -Summary: Slimline Open Firmware - SLOF -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -BuildArch: noarch - -%description SLOF -Slimline Open Firmware (SLOF) is an implementation of the IEEE 1275 standard. -It can be used as partition firmware for pSeries machines running on QEMU or KVM. -%endif - -%package ksm -Summary: Kernel Samepage Merging services -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Requires(pre): coreutils -Requires(post): coreutils - -%description ksm -Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that -merges anonymous (private) pages (not pagecache ones). - -This package provides a service file for starting and stopping KSM. - -%package accel-tcg-x86 -Summary: TCG accelerator for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/15 -%{qemu_module_conflicts} - -%description accel-tcg-x86 -TCG is the QEMU binary translator, responsible for converting from target to -host instruction set. - -This package provides the TCG accelerator for QEMU. - -%package accel-qtest -Summary: QTest accelerator for QEMU -Group: System/Emulators/PC -Version: %{qemuver} -Release: 0 -Provides: %name:%_datadir/%name/forsplits/16 -%{qemu_module_conflicts} - -%description accel-qtest -QTest is a device emulation testing framework. It is useful to test device -models. - -This package provides QTest accelerator for testing QEMU. - -# above section is for qemu -%else -BuildRequires: bc -BuildRequires: qemu-arm = %{qemuver} -BuildRequires: qemu-audio-oss = %{qemuver} -BuildRequires: qemu-audio-alsa = %{qemuver} -BuildRequires: qemu-audio-pa = %{qemuver} -BuildRequires: qemu-audio-jack = %{qemuver} -BuildRequires: qemu-audio-spice = %{qemuver} -BuildRequires: qemu-block-curl = %{qemuver} -BuildRequires: qemu-block-dmg = %{qemuver} -BuildRequires: qemu-block-gluster = %{qemuver} -BuildRequires: qemu-block-iscsi = %{qemuver} -BuildRequires: qemu-block-nfs = %{qemuver} -%if 0%{?with_rbd} -BuildRequires: qemu-block-rbd = %{qemuver} -%endif -BuildRequires: qemu-accel-qtest = %{qemuver} -BuildRequires: qemu-accel-tcg-x86 = %{qemuver} -BuildRequires: qemu-block-ssh = %{qemuver} -BuildRequires: qemu-chardev-baum = %{qemuver} -BuildRequires: qemu-chardev-spice = %{qemuver} -BuildRequires: qemu-extra = %{qemuver} -BuildRequires: qemu-guest-agent = %{qemuver} -BuildRequires: qemu-hw-display-qxl = %{qemuver} -BuildRequires: qemu-hw-display-virtio-gpu = %{qemuver} -BuildRequires: qemu-hw-usb-host = %{qemuver} -BuildRequires: qemu-hw-usb-redirect = %{qemuver} -BuildRequires: qemu-hw-usb-smartcard = %{qemuver} -BuildRequires: qemu-ipxe = 1.0.0+ -BuildRequires: qemu-ivshmem-tools = %{qemuver} -BuildRequires: qemu-ksm = %{qemuver} -BuildRequires: qemu-lang = %{qemuver} -BuildRequires: qemu-ppc = %{qemuver} -BuildRequires: qemu-s390x = %{qemuver} -BuildRequires: qemu-seabios = %{sbver} -BuildRequires: qemu-sgabios = 8 -BuildRequires: qemu-skiboot = %{qemuver} -BuildRequires: qemu-tools = %{qemuver} -BuildRequires: qemu-ui-curses = %{qemuver} -BuildRequires: qemu-ui-gtk = %{qemuver} -BuildRequires: qemu-ui-opengl = %{qemuver} -BuildRequires: qemu-ui-spice-app = %{qemuver} -BuildRequires: qemu-ui-spice-core = %{qemuver} -BuildRequires: qemu-vgabios = %{sbver} -BuildRequires: qemu-x86 = %{qemuver} - %description -This package records qemu testsuite results and represents successful testing. +%{generic_qemu_description} -# above section is for qemu-testsuite -%endif -# above section is for qemu and qemu-testsuite -%endif - -# ======================================================================== - -%prep -%setup -q -n %{srcname}-%{expand:%%(SV=%{srcver};echo ${SV%%%%+git*})} -PATCH_EXEC - -%if "%{name}" != "qemu-linux-user" -# for the record, this set of firmware files is installed, but we don't -# build (yet): bamboo.dtb canyonlands.dtb hppa-firmware.img openbios-ppc -# openbios-sparc32 openbios-sparc64 palcode-clipper petalogix-ml605.dtb -# petalogix-s3adsp1800.dtb QEMU,cgthree.bin QEMU,tcx.bin qemu_vga.ndrv -# u-boot.e500 u-boot-sam460-20100605.bin opensbi-riscv32-generic-fw_dynamic.bin -# opensbi-riscv32-generic-fw_dynamic.elfnpcm7xx_bootrom.bin - -# Note that: -# - default firmwares are built "by default", i.e., they're built automatically -# during the process of building QEMU (on each specific arch) -# - extra firmwares are built "manually" (see below) from their own sources -# (which, typically, are submodules checked out in the {srcdi}r/roms directory) -%define ppc_default_firmware %{nil} -%define ppc_extra_firmware {skiboot.lid slof.bin} -%define riscv64_default_firmware %{nil} -%define riscv64_extra_firmware {opensbi-riscv64-generic-fw_dynamic.bin \ -opensbi-riscv64-generic-fw_dynamic.elf} -%define s390x_default_firmware {s390-ccw.img s390-netboot.img} -%define s390x_extra_firmware %{nil} -%define x86_default_firmware {linuxboot.bin linuxboot_dma.bin multiboot.bin \ -multiboot_dma.bin kvmvapic.bin pvh.bin} -%define x86_extra_firmware {bios.bin bios-256k.bin bios-microvm.bin qboot.rom \ -pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom pxe-pcnet.rom pxe-rtl8139.rom \ -pxe-virtio.rom sgabios.bin vgabios-ati.bin vgabios-bochs-display.bin \ -vgabios.bin vgabios-cirrus.bin vgabios-qxl.bin vgabios-ramfb.bin \ -vgabios-stdvga.bin vgabios-virtio.bin vgabios-vmware.bin \ -efi-e1000.rom efi-e1000e.rom efi-eepro100.rom efi-ne2k_pci.rom efi-pcnet.rom \ -efi-rtl8139.rom efi-virtio.rom efi-vmxnet3.rom} - -# Complete list of all the firmwares that we build, if we consider -# all the builds, on all the arches. -%define firmware { \ -%{ppc_default_firmware} %{ppc_extra_firmware} \ -%{riscv64_default_firmware} %{riscv64_extra_firmware} \ -%{s390x_default_firmware} %{s390x_extra_firmware} \ -%{x86_default_firmware} %{x86_extra_firmware} } - -# Note that: -# - {arch}_default_built_firmware are the firmwares that we will be built by -# default in this particular build, on the arch where we currently are on -# - {arch}_extra_built_fimrware, likewise, but for extra firmwares, built manually -%ifarch ppc64 ppc64le -%define ppc_default_built_firmware %{ppc_default_firmware} -%endif -%ifarch riscv64 -%define riscv64_default_built_firmware %{riscv64_default_firmware} -%endif -%ifarch s390x -%define s390x_default_built_firmware %{s390x_default_firmware} -%endif -%ifarch %ix86 x86_64 -%define x86_default_built_firmware %{x86_default_firmware} -%endif - -%if %{build_opensbi_firmware} -%define riscv64_extra_built_firmware %{riscv64_extra_firmware} -%endif -%if %{build_ppc_firmware} -%define ppc_extra_built_firmware %{ppc_extra_firmware} -%endif -%if %{build_x86_firmware} -%define x86_extra_built_firmware %{x86_extra_firmware} -%endif - -# List of only firmwares that will actually be built, in this instance -%define built_firmware { \ -%{?ppc_default_built_firmware} %{?ppc_extra_built_firmware} \ -%{?riscv64_default_built_firmware} %{?riscv64_extra_built_firmware} \ -%{?s390x_default_built_firmware} %{?s390x_extra_built_firmware} \ -%{?x86_default_built_firmware} %{?x86_extra_built_firmware} } - -# above section is for qemu and qemu-testsuite -%endif - -# ======================================================================== - -%build - -# non-x86 archs still seem to have some issues with Link Time Optimization -%ifnarch %ix86 x86_64 -%define _lto_cflags %{nil} -%endif - -%if %{legacy_qemu_kvm} -%ifarch s390x -cp %{SOURCE13} docs/supported.rst -%else -cp %{SOURCE13} docs/supported.rst -%endif -%endif - -%define srcdir %{_builddir}/%buildsubdir -%define blddir %srcdir/build -mkdir -p %blddir -cd %blddir - -%srcdir/configure \ - --prefix=%_prefix \ - --sysconfdir=%_sysconfdir \ - --libdir=%_libdir \ - --libexecdir=%_libexecdir \ - --localstatedir=%_localstatedir \ - --docdir=%_docdir \ - --firmwarepath=%_datadir/%name \ - --python=%_bindir/python3 \ - --extra-cflags="%{optflags}" \ - --with-git-submodules=ignore \ - --disable-fuzzing \ - --disable-multiprocess \ - --disable-stack-protector \ - --disable-strip \ - --disable-tcg-interpreter \ -%if "%{_lto_cflags}" != "%{nil}" - --enable-lto \ -%endif -%if "%flavor" != "testsuite" - --disable-qom-cast-debug \ -%endif - --with-git-submodules=ignore \ -%if "%{name}" != "qemu-linux-user" - --with-pkgversion="%(echo '%{distro}' | sed 's/ (.*)//')" \ - --with-default-devices \ - --enable-system --disable-linux-user \ - --enable-tools --enable-guest-agent \ - --enable-modules \ - --disable-module-upgrades \ - --enable-slirp=system \ - --enable-pie \ - --enable-docs \ - --enable-attr \ - --disable-auth-pam \ - --enable-bochs \ - --enable-brlapi \ - --enable-bzip2 \ - --enable-cap-ng \ - --disable-capstone \ - --enable-cloop \ - --enable-coroutine-pool \ - --disable-crypto-afalg \ - --enable-curl \ - --enable-curses \ - --enable-dmg \ - --enable-fdt \ - --enable-gio \ - --enable-gcrypt \ - --enable-glusterfs \ - --enable-gnutls \ - --enable-gtk \ - --disable-hax \ - --disable-hvf \ - --enable-iconv \ -%if %{kvm_available} - --enable-kvm \ -%else - --disable-kvm \ -%endif -%if 0%{?with_daxctl} - --enable-libdaxctl \ -%else - --disable-libdaxctl \ -%endif - --enable-libiscsi \ - --enable-libnfs \ -%ifarch x86_64 - --enable-libpmem \ -%else - --disable-libpmem \ -%endif - --enable-libssh \ - --enable-libusb \ - --disable-libxml2 \ - --enable-linux-aio \ -%if 0%{?with_uring} - --enable-linux-io-uring \ -%else - --disable-linux-io-uring \ -%endif - --enable-lzfse \ - --enable-lzo \ - --disable-malloc-trim \ -%if %{with system_membarrier} - --enable-membarrier \ -%else - --disable-membarrier \ -%endif - --enable-mpath \ - --disable-netmap \ - --disable-nettle \ -%ifarch %arm s390x - --disable-numa \ -%else - --enable-numa \ -%endif - --enable-opengl \ - --enable-parallels \ - --disable-plugins \ - --enable-pvrdma \ - --enable-qcow1 \ - --enable-qed \ -%if 0%{?with_rbd} - --enable-rbd \ -%else - --disable-rbd \ -%endif - --enable-rdma \ - --enable-replication \ - --disable-safe-stack \ - --disable-sanitizers \ - --disable-sdl \ - --disable-sdl-image \ - --enable-seccomp \ - --enable-smartcard \ - --enable-snappy \ - --enable-spice \ - --enable-tpm \ - --enable-usb-redir \ - --enable-vde \ - --enable-vdi \ - --enable-vhost-crypto \ - --enable-vhost-kernel \ - --enable-vhost-net \ - --enable-vhost-scsi \ - --enable-vhost-user \ - --enable-vhost-user-blk-server \ - --enable-vhost-user-fs \ - --enable-vhost-vdpa \ - --enable-vhost-vsock \ - --enable-virglrenderer \ - --enable-virtfs \ - --enable-vnc \ - --enable-vnc-jpeg \ - --enable-vnc-png \ - --enable-vnc-sasl \ - --enable-vte \ - --enable-vvfat \ - --enable-werror \ - --disable-whpx \ - --enable-zstd \ -%ifarch x86_64 - --enable-xen \ - --enable-xen-pci-passthrough \ -%else - --disable-xen \ -%endif - --enable-xfsctl \ - --enable-xkbcommon \ -# above section is for qemu and qemu-testsuite -# ------------------------------------------------------------------------ -%else - --without-default-devices \ - --disable-system --enable-linux-user \ - --disable-tools --disable-guest-agent \ - --static \ - --disable-modules \ - --disable-pie \ - --disable-docs \ - --disable-blobs \ - --disable-bochs \ - --disable-capstone \ - --disable-cloop \ - --enable-coroutine-pool \ - --disable-dmg \ - --disable-fdt \ - --disable-gio \ - --disable-iconv \ - --disable-kvm \ - --disable-libdaxctl \ - --disable-linux-io-uring \ - --disable-malloc-trim \ -%if %{with system_membarrier} - --enable-membarrier \ -%else - --disable-membarrier \ -%endif - --disable-parallels \ - --disable-plugins \ - --disable-qcow1 \ - --disable-qed \ - --disable-replication \ - --disable-safe-stack \ - --disable-slirp \ - --disable-tpm \ - --disable-vdi \ - --disable-vhost-crypto \ - --disable-vhost-kernel \ - --disable-vhost-net \ - --disable-vhost-scsi \ - --disable-vhost-user \ - --disable-vhost-user-blk-server \ - --disable-vhost-user-fs \ - --disable-vhost-vsock \ - --disable-vnc \ - --disable-vvfat \ - --disable-xkbcommon \ - -# above section is for qemu-linux-user -%endif - -%if "%{name}" == "qemu" - -# Let's build QEMU (and all the "default" firmwares, for each arch) - -# First, delete the firmware files that we intend to build... -for i in %built_firmware -do - unlink %srcdir/pc-bios/$i -done - -%make_build - -# ... And then, reinstate the firmwares that have been built already -for i in %{?s390x_default_built_firmware} -do - cp pc-bios/s390-ccw/$i %srcdir/pc-bios/ -done - -for i in %{?x86_default_built_firmware} -do - cp pc-bios/optionrom/$i %srcdir/pc-bios/ -done - -# Build the "extra" firmwares. Note that the QEMU Makefile in {srcdir}/roms -# does some cross-compiler auto detection. So we often don't need to define -# or pass CROSS= and CROSS_COMPILE ourselves. - -%if %{build_ppc_firmware} -# FIXME: check if we can upstream: Makefile-define-endianess-for-cross-buil.patch -%make_build -C %srcdir/roms skiboot - -%make_build -C %srcdir/roms slof -%endif - -%if %{build_opensbi_firmware} -%make_build -C %srcdir/roms opensbi64-generic -%endif - -%if %{build_x86_firmware} - -%make_build %{?_smp_mflags} -C %srcdir/roms bios \ - SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" \ - -# FIXME: check if we can upstream: roms-Makefile-add-cross-file-to-qboot-me.patch -# and qboot-add-cross.ini-file-to-handle-aarch.patch -%make_build -C %srcdir/roms qboot - -%make_build -C %srcdir/roms seavgabios \ - -%make_build -C %srcdir/roms seavgabios-ati \ - -%make_build -C %srcdir/roms pxerom - -%make_build -C %srcdir/roms efirom \ - EDK2_BASETOOLS_OPTFLAGS='-fPIE' - -# We're currently not building firmware on ix86, but let's make sure this works -# fine if one enables it, e.g., locally (for debugging or something). -# FIXME: check if we can get rid or upstream: roms-sgabios-Fix-csum8-to-be-built-by-ho.patch -make -C %srcdir/roms sgabios HOSTCC=cc \ -%ifnarch %ix86 x86_64 - CC=x86_64-suse-linux-gcc LD=x86_64-suse-linux-ld \ -%endif - -%if %{force_fit_virtio_pxe_rom} -pushd %srcdir -patch -p1 < %_sourcedir/stub-out-the-SAN-req-s-in-int13.patch -popd -%make_build -C %srcdir/roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom -%endif - -# enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward -# the following need to be > 64K -%define supported_nics_large {e1000 rtl8139} -# the following need to be <= 64K -%define supported_nics_small {virtio} -# Though not required, make unsupported pxe roms migration compatable as well -%define unsupported_nics {eepro100 ne2k_pci pcnet} - -for i in %supported_nics_large %unsupported_nics - do - if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "131072" ; then - echo "pxe rom is too large" - exit 1 - fi - if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -le "65536" ; then - ./%srcdir/roms/ipxe/src/util/padimg.pl %srcdir/pc-bios/pxe-$i.rom -s 65536 -b 255 - echo -ne "SEGMENT OVERAGE\0" >> %srcdir/pc-bios/pxe-$i.rom - fi -done -for i in %supported_nics_small - do - if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "65536" ; then - echo "pxe rom is too large" - exit 1 - fi -done - -%endif -# End of {build_x86_firmware} - -%endif -# End of "{name}" == "qemu" - -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-testsuite" - -# XXX: What's the point of all this, if we need to rebuild everything anyway?!? -ln -s %_bindir/qemu-img qemu-img -ln -s %_bindir/qemu-ga qemu-ga -ln -s %_bindir/qemu-io qemu-io -ln -s %_bindir/elf2map elf2map -ln -s %_bindir/qemu-nbd qemu-nbd -ln -s %_bindir/qemu-edid qemu-edid -ln -s %_bindir/qemu-keymap qemu-keymap -ln -s %_bindir/ivshmem-client ivshmem-client -ln -s %_bindir/ivshmem-server ivshmem-server -ln -s %_bindir/qemu-pr-helper qemu-pr-helper -ln -s %_libexecdir/virtfs-proxy-helper fsdev/virtfs-proxy-helper - -for i in %firmware -do - unlink pc-bios/$i - ln -s %_datadir/qemu/$i pc-bios/$i -done - -for conf in %{_builddir}/%buildsubdir/configs/targets/*-softmmu.mak; do - arch=`echo "$conf" | sed -e 's|%{_builddir}/%buildsubdir/configs/targets/\(.*\)-softmmu.mak|\1|g'` - if $(unlink $arch-softmmu/qemu-system-$arch); then - ln -s %_bindir/qemu-system-$arch $arch-softmmu/qemu-system-$arch - fi -done - -# Compile the QOM test binary first, so that ... -%make_build tests/qtest/qom-test V=1 -# ... make comes in fresh and has lots of address space (needed for 32bit, bsc#957379) -%make_build check-report.tap V=1 - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-linux-user" - -%make_build - -%ifarch %ix86 -%define qemu_arch i386 -%endif -%ifarch x86_64 -%define qemu_arch x86_64 -%endif -%ifarch %arm -%define qemu_arch arm -%endif -%ifarch aarch64 -%define qemu_arch aarch64 -%endif -%ifarch ppc -%define qemu_arch ppc -%endif -%ifarch ppc64 -%define qemu_arch ppc64 -%endif -%ifarch ppc64le -%define qemu_arch ppc64le -%endif -%ifarch s390x -%define qemu_arch s390x -%endif - -%endif - -# ======================================================================== - -%check -cd %blddir -%if "%{name}" == "qemu-testsuite" - -export QEMU_PROG=%_bindir/qemu-system-x86_64 -export QEMU_IMG_PROG=%_bindir/qemu-img -export QEMU_IO_PROG=%_bindir/qemu-io -export QEMU_NBD_PROG=%_bindir/qemu-nbd -%make_build check-block V=1 - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-linux-user" - -%ifarch %ix86 x86_64 %arm aarch64 ppc ppc64 ppc64le s390x -%ifnarch %arm -%{qemu_arch}-linux-user/qemu-%{qemu_arch} %_bindir/ls > /dev/null -%endif -%make_build check-softfloat -%endif - -%endif - -# ======================================================================== - -%install -cd %blddir - -%if "%{name}" == "qemu-testsuite" - -install -D -m 0644 check-report.tap %{buildroot}%_datadir/qemu/check-report.tap - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-linux-user" - -%make_build install DESTDIR=%{buildroot} -rm -rf %{buildroot}%_datadir/qemu/keymaps -unlink %{buildroot}%_datadir/qemu/trace-events-all -install -d -m 755 %{buildroot}%_sbindir -install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64_be-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-alpha-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-armeb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-cris-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hexagon-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hppa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-i386-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-m68k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblaze-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblazeel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-nios2-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-or1k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64le-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-s390x-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4eb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc32plus-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-x86_64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt -%fdupes -s %{buildroot} - -%endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu" - -%make_build install DESTDIR=%{buildroot} - -%find_lang %name -install -d -m 0755 %{buildroot}%_datadir/%name/firmware -install -d -m 0755 %{buildroot}/usr/lib/supportconfig/plugins -install -d -m 0755 %{buildroot}%_sysconfdir/%name/firmware -install -D -m 0644 %{SOURCE4} %{buildroot}%_sysconfdir/%name/bridge.conf -install -D -m 0755 %{SOURCE3} %{buildroot}%_datadir/%name/qemu-ifup -install -D -p -m 0644 %{SOURCE8} %{buildroot}/usr/lib/udev/rules.d/80-qemu-ga.rules -install -D -m 0755 scripts/analyze-migration.py %{buildroot}%_bindir/analyze-migration.py -install -D -m 0755 scripts/vmstate-static-checker.py %{buildroot}%_bindir/vmstate-static-checker.py -install -D -m 0755 scripts/kvm/vmxcap %{buildroot}%_bindir/vmxcap -install -D -m 0755 %{SOURCE9} %{buildroot}/usr/lib/supportconfig/plugins/%name -install -D -m 0644 %{SOURCE10} %{buildroot}%_docdir/qemu-arm/supported.txt -install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt -install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt -install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390x/supported.txt -%if %{legacy_qemu_kvm} -install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz -install -d %{buildroot}%_docdir/qemu-kvm -%ifarch s390x -ln -s qemu-system-s390x %{buildroot}%_bindir/qemu-kvm -ln -s ../qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt -rst2html --exit-status=2 %{buildroot}%_docdir/qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html -%else -ln -s qemu-system-x86_64 %{buildroot}%_bindir/qemu-kvm -ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt -rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html -%endif -%endif -%if %{kvm_available} -install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/80-kvm.rules -%endif -install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-guest-agent.service -install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service -%ifarch s390x -install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf -%endif - -# We rely on a separate project / package to provide edk2 firmware -unlink %{buildroot}%_datadir/%name/edk2-licenses.txt -unlink %{buildroot}%_datadir/%name/firmware/50-edk2-i386-secure.json -unlink %{buildroot}%_datadir/%name/firmware/50-edk2-x86_64-secure.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-aarch64.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-arm.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-i386.json -unlink %{buildroot}%_datadir/%name/firmware/60-edk2-x86_64.json -unlink %{buildroot}%_datadir/%name/edk2-aarch64-code.fd -unlink %{buildroot}%_datadir/%name/edk2-arm-code.fd -unlink %{buildroot}%_datadir/%name/edk2-arm-vars.fd -unlink %{buildroot}%_datadir/%name/edk2-i386-code.fd -unlink %{buildroot}%_datadir/%name/edk2-i386-secure-code.fd -unlink %{buildroot}%_datadir/%name/edk2-i386-vars.fd -unlink %{buildroot}%_datadir/%name/edk2-x86_64-code.fd -unlink %{buildroot}%_datadir/%name/edk2-x86_64-secure-code.fd - -# this was never meant for customer consumption - delete even though installed -unlink %{buildroot}%_bindir/elf2dmp - -install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt -for X in 00 01 02 03 04 05 07 08 09 10 11 12 13 14 15 16 17 18 19 -do - ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X -done - -# For PPC and x86 firmwares, there are a few extra install steps necessary. -# In general, if we know that we have not built a firmware, remove it from the -# install base, as the one that we have there is the upstream binary, that got -# copied there during `make install`. - -%if %{build_ppc_firmware} -# in support of update-alternatives -mv %{buildroot}%_datadir/%name/skiboot.lid %{buildroot}%_datadir/%name/skiboot.lid.qemu -# create a dummy target for /etc/alternatives/skiboot.lid -mkdir -p %{buildroot}%{_sysconfdir}/alternatives -ln -s -f %{_sysconfdir}/alternatives/skiboot.lid %{buildroot}%{_datadir}/%name/skiboot.lid -ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/06 -%else -for f in %{ppc_extra_firmware} ; do - unlink %{buildroot}%_datadir/%name/$f -done -%endif - -# For riscv64 firmwares (currently, only opensbi), we leave them there in -# any case, because they're part of the qemu-extra package, and riscv is -# a bit special in many ways already. - -%if %{build_x86_firmware} -install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json -install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json -%else -for f in %{x86_extra_firmware} ; do - unlink %{buildroot}%_datadir/%name/$f -done -%endif - -%suse_update_desktop_file qemu -%fdupes -s %{buildroot} - -# ======================================================================== +This package acts as an umbrella package to the other QEMU sub-packages. %if %{kvm_available} %post @@ -1702,70 +436,13 @@ if [ $(stat -L -c "%i" /proc/1/root/) = $(stat -L -c "%i" /) ]; then sysctl vm.allocate_pgste=1 || : %endif fi +# End of "if kvm_available" %endif -%post tools -%set_permissions %_libexecdir/qemu-bridge-helper - -%verifyscript tools -%verify_permissions %_libexecdir/qemu-bridge-helper - -%pre guest-agent -%service_add_pre qemu-guest-agent.service - -%post guest-agent -%service_add_post qemu-guest-agent.service -if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then - /usr/bin/systemctl start qemu-guest-agent.service || : -fi - -%preun guest-agent -if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then - /usr/bin/systemctl stop qemu-guest-agent.service || : -fi - -%postun guest-agent -%service_del_postun_without_restart qemu-guest-agent.service -if [ "$1" = "1" ] ; then - if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then - /usr/bin/systemctl restart qemu-guest-agent.service || : - fi -fi - -%pre ksm -%service_add_pre ksm.service - -%post ksm -%service_add_post ksm.service - -%preun ksm -%service_del_preun ksm.service - -%postun ksm -%service_del_postun ksm.service - -%if %{build_ppc_firmware} -%post skiboot -update-alternatives --install \ - %{_datadir}/%name/skiboot.lid skiboot.lid %{_datadir}/%name/skiboot.lid.qemu 15 - -%preun skiboot -if [ ! -f %{_datadir}/%name/skiboot.lid.qemu ] ; then - update-alternatives --remove skiboot.lid %{_datadir}/%name/skiboot.lid.qemu -fi -%endif - -# above section is for qemu -%endif - -# ======================================================================== - %files %defattr(-, root, root) %doc README.rst VERSION %license COPYING COPYING.LIB LICENSE - -%if "%{name}" == "qemu" %dir %_datadir/icons/hicolor %dir %_datadir/icons/hicolor/*/ %dir %_datadir/icons/hicolor/*/apps @@ -1816,6 +493,7 @@ fi %_docdir/%name/about/index.html %_docdir/%name/about/license.html %_docdir/%name/about/removed-features.html +%_docdir/%name/dbus-dbusindex.html %_docdir/%name/devel/atomics.html %_docdir/%name/devel/bitops.html %_docdir/%name/devel/block-coroutine-wrapper.html @@ -1828,6 +506,11 @@ fi %_docdir/%name/devel/decodetree.html %_docdir/%name/devel/ebpf_rss.html %_docdir/%name/devel/fuzzing.html +%_docdir/%name/devel/index-api.html +%_docdir/%name/devel/index-build.html +%_docdir/%name/devel/index-internals.html +%_docdir/%name/devel/index-process.html +%_docdir/%name/devel/index-tcg.html %_docdir/%name/devel/index.html %_docdir/%name/devel/kconfig.html %_docdir/%name/devel/loads-stores.html @@ -1846,8 +529,6 @@ fi %_docdir/%name/devel/stable-process.html %_docdir/%name/devel/style.html %_docdir/%name/devel/submitting-a-patch.html -%_docdir/%name/devel/submitting-a-patch.html -%_docdir/%name/devel/submitting-a-pull-request.html %_docdir/%name/devel/submitting-a-pull-request.html %_docdir/%name/devel/tcg-icount.html %_docdir/%name/devel/tcg-plugins.html @@ -1855,7 +536,6 @@ fi %_docdir/%name/devel/testing.html %_docdir/%name/devel/tracing.html %_docdir/%name/devel/trivial-patches.html -%_docdir/%name/devel/trivial-patches.html %_docdir/%name/devel/ui.html %_docdir/%name/devel/vfio-migration.html %_docdir/%name/devel/writing-monitor-commands.html @@ -1863,6 +543,7 @@ fi %_docdir/%name/index.html %_docdir/%name/interop/barrier.html %_docdir/%name/interop/bitmaps.html +%_docdir/%name/interop/dbus-display.html %_docdir/%name/interop/dbus-vmstate.html %_docdir/%name/interop/dbus.html %_docdir/%name/interop/index.html @@ -1874,19 +555,25 @@ fi %_docdir/%name/interop/vhost-user-gpu.html %_docdir/%name/interop/vhost-user.html %_docdir/%name/interop/vhost-vdpa.html +%_docdir/%name/interop/virtio-balloon-stats.html %_docdir/%name/objects.inv %_docdir/%name/search.html %_docdir/%name/searchindex.js %_docdir/%name/specs/acpi_cpu_hotplug.html +%_docdir/%name/specs/acpi_erst.html %_docdir/%name/specs/acpi_hest_ghes.html %_docdir/%name/specs/acpi_hw_reduced_hotplug.html %_docdir/%name/specs/acpi_mem_hotplug.html %_docdir/%name/specs/acpi_nvdimm.html %_docdir/%name/specs/acpi_pci_hotplug.html %_docdir/%name/specs/index.html +%_docdir/%name/specs/ppc-spapr-hcalls.html +%_docdir/%name/specs/ppc-spapr-hotplug.html %_docdir/%name/specs/ppc-spapr-numa.html +%_docdir/%name/specs/ppc-spapr-uv-hcalls.html %_docdir/%name/specs/ppc-spapr-xive.html %_docdir/%name/specs/ppc-xive.html +%_docdir/%name/specs/sev-guest-firmware.html %_docdir/%name/specs/tpm.html %_docdir/%name/system/arm/aspeed.html %_docdir/%name/system/arm/collie.html @@ -1924,8 +611,10 @@ fi %_docdir/%name/system/authz.html %_docdir/%name/system/barrier.html %_docdir/%name/system/bootindex.html +%_docdir/%name/system/confidential-guest-support.html %_docdir/%name/system/cpu-hotplug.html %_docdir/%name/system/device-emulation.html +%_docdir/%name/system/devices/can.html %_docdir/%name/system/devices/ivshmem.html %_docdir/%name/system/devices/net.html %_docdir/%name/system/devices/nvme.html @@ -1936,6 +625,7 @@ fi %_docdir/%name/system/gdb.html %_docdir/%name/system/generic-loader.html %_docdir/%name/system/guest-loader.html +%_docdir/%name/system/i386/amd-memory-encryption.html %_docdir/%name/system/i386/cpu.html %_docdir/%name/system/i386/kvm-pv.html %_docdir/%name/system/i386/microvm.html @@ -2019,6 +709,26 @@ fi /usr/lib/udev/rules.d/80-kvm.rules %endif +%package x86 +Summary: Machine emulator and virtualizer for x86 architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Requires: qemu-accel-tcg-x86 +Requires: qemu-ipxe +Requires: qemu-seabios +Requires: qemu-sgabios +Requires: qemu-vgabios +Recommends: ovmf +Recommends: qemu-microvm +Recommends: qemu-ovmf-x86_64 + +%description x86 +%{generic_qemu_description} + +This package provides i386 and x86_64 emulation. + %files x86 %defattr(-, root, root) %_bindir/qemu-system-i386 @@ -2032,6 +742,21 @@ fi %dir %_docdir/qemu-x86 %_docdir/qemu-x86/supported.txt +%package ppc +Summary: Machine emulator and virtualizer for Power architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Requires: qemu-SLOF +Recommends: qemu-ipxe +Recommends: qemu-vgabios + +%description ppc +%{generic_qemu_description} + +This package provides ppc and ppc64 emulation. + %files ppc %defattr(-, root, root) %_bindir/qemu-system-ppc @@ -2042,9 +767,24 @@ fi %_datadir/%name/qemu_vga.ndrv %_datadir/%name/u-boot.e500 %_datadir/%name/u-boot-sam460-20100605.bin +%_datadir/%name/vof*.bin %dir %_docdir/qemu-ppc %_docdir/qemu-ppc/supported.txt +%package s390x +Summary: Machine emulator and virtualizer for S/390 architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Provides: qemu-s390 = %{qemuver} +Obsoletes: qemu-s390 < %{qemuver} + +%description s390x +%{generic_qemu_description} + +This package provides s390x emulation. + %files s390x %defattr(-, root, root) %_bindir/qemu-system-s390x @@ -2053,6 +793,22 @@ fi %dir %_docdir/qemu-s390x %_docdir/qemu-s390x/supported.txt +%package arm +Summary: Machine emulator and virtualizer for ARM architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Recommends: ovmf +Recommends: qemu-ipxe +Recommends: qemu-uefi-aarch64 +Recommends: qemu-vgabios + +%description arm +%{generic_qemu_description} + +This package provides arm emulation. + %files arm %defattr(-, root, root) %_bindir/qemu-system-arm @@ -2061,6 +817,23 @@ fi %dir %_docdir/qemu-arm %_docdir/qemu-arm/supported.txt +%package extra +Summary: Machine emulator and virtualizer for "extra" architectures +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: %name = %{qemuver} +Recommends: qemu-ipxe +Recommends: qemu-skiboot +Recommends: qemu-vgabios + +%description extra +%{generic_qemu_description} + +This package provides some lesser used emulations, including alpha, m68k, +mips, sparc, and xtensa. (The term "extra" is juxtapositioned against more +popular QEMU packages which are dedicated to a single architecture.) + %files extra %defattr(-, root, root) %_bindir/qemu-system-alpha @@ -2090,9 +863,7 @@ fi %_datadir/%name/openbios-sparc32 %_datadir/%name/openbios-sparc64 %_datadir/%name/opensbi-riscv32-generic-fw_dynamic.bin -%_datadir/%name/opensbi-riscv32-generic-fw_dynamic.elf %_datadir/%name/opensbi-riscv64-generic-fw_dynamic.bin -%_datadir/%name/opensbi-riscv64-generic-fw_dynamic.elf %_datadir/%name/palcode-clipper %_datadir/%name/petalogix-ml605.dtb %_datadir/%name/petalogix-s3adsp1800.dtb @@ -2100,6 +871,28 @@ fi %_datadir/%name/QEMU,tcx.bin %if %{legacy_qemu_kvm} +%package kvm +Summary: Wrapper to enable KVM acceleration under QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%ifarch %ix86 x86_64 +Requires: qemu-x86 = %{qemuver} +%endif +%ifarch s390x +Requires: qemu-s390x = %{qemuver} +%endif +Provides: kvm = %{qemuver} +Obsoletes: kvm < %{qemuver} + +%description kvm +%{generic_qemu_description} + +This package provides a symlink to the main QEMU emulator used for KVM +virtualization. The symlink is named qemu-kvm, which causes the QEMU program +to enable the KVM accelerator, due to the name reference ending with 'kvm'. +This package is an artifact of the early origins of QEMU, and is deprecated. + %files kvm %defattr(-,root,root) %_bindir/qemu-kvm @@ -2107,23 +900,95 @@ fi %_docdir/qemu-kvm/kvm-supported.html %_docdir/qemu-kvm/kvm-supported.txt %_mandir/man1/qemu-kvm.1.gz +# End of "if legacy_qemu_kvm" %endif +%package lang +Summary: Translations for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 + +%description lang +This package contains a few language translations, particularly for the +graphical user interface components that come with QEMU. The bulk of strings +in QEMU are not localized. + +%files lang -f %blddir/%name.lang +%defattr(-, root, root) + +%package audio-alsa +Summary: ALSA based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-alsa +This package contains a module for ALSA based audio support for QEMU. + %files audio-alsa %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-alsa.so +%package audio-dbus +Summary: D-Bus based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-dbus +This package provides a module for D-Bus based audio support for QEMU. + +%files audio-dbus +%defattr(-, root, root) +%dir %_libdir/%name +%_libdir/%name/audio-dbus.so + +%package audio-pa +Summary: Pulse Audio based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-pa +This package contains a module for Pulse Audio based audio support for QEMU. + %files audio-pa %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-pa.so +%package audio-jack +Summary: JACK based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-jack +This package contains a module for JACK based audio support for QEMU. + %files audio-jack %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-jack.so +%package audio-spice +Summary: Spice based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/05 +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description audio-spice +This package contains a module for Spice based audio support for QEMU. + %files audio-spice %defattr(-, root, root) %dir %_datadir/%name/forsplits @@ -2131,49 +996,148 @@ fi %dir %_libdir/%name %_libdir/%name/audio-spice.so +%package audio-oss +Summary: OSS based audio support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description audio-oss +This package contains a module for OSS based audio support for QEMU. + %files audio-oss %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/audio-oss.so +%package block-curl +Summary: cURL block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-curl +This package contains a module for accessing network-based image files over +a network connection from qemu-img tool and QEMU system emulation. + %files block-curl %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-curl.so +%package block-dmg +Summary: DMG block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-dmg +This package contains a module for accessing Mac OS X image files from +qemu-img tool and QEMU system emulation. + %files block-dmg %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-dmg-bz2.so %_libdir/%name/block-dmg-lzfse.so +%package block-gluster +Summary: GlusterFS block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-gluster +This package contains a module for accessing network-based image files over a +GlusterFS network connection from qemu-img tool and QEMU system emulation. + %files block-gluster %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-gluster.so +%package block-iscsi +Summary: iSCSI block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-iscsi +This package contains a module for accessing network-based image files over an +iSCSI network connection from qemu-img tool and QEMU system emulation. + %files block-iscsi %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-iscsi.so +%package block-nfs +Summary: direct Network File System support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-nfs +This package contains a module for directly accessing nfs based image files +for QEMU. + %files block-nfs %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-nfs.so %if 0%{?with_rbd} +%package block-rbd +Summary: Rados Block Device (Ceph) support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-rbd +This package contains a module for accessing ceph (rbd,rados) image files +for QEMU. + %files block-rbd %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-rbd.so +# End of "if with_rbd" %endif +%package block-ssh +Summary: SSH (SFTP) block support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description block-ssh +This package contains a module for accessing network-based image files over an +SSH network connection from qemu-img tool and QEMU system emulation. + %files block-ssh %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/block-ssh.so +%package chardev-baum +Summary: Baum braille chardev support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/00 +%{qemu_module_conflicts} + +%description chardev-baum +This package contains a module for baum braille chardev support for QEMU. + %files chardev-baum %defattr(-, root, root) %dir %_datadir/%name @@ -2182,6 +1146,18 @@ fi %dir %_libdir/%name %_libdir/%name/chardev-baum.so +%package chardev-spice +Summary: Spice vmc and port chardev support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/08 +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description chardev-spice +This package contains a module for Spice chardev support for QEMU. + %files chardev-spice %defattr(-, root, root) %dir %_datadir/%name @@ -2190,6 +1166,18 @@ fi %dir %_libdir/%name %_libdir/%name/chardev-spice.so +%package hw-display-qxl +Summary: QXL display support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/01 +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description hw-display-qxl +This package contains a module for QXL display support for QEMU. + %files hw-display-qxl %defattr(-, root, root) %dir %_datadir/%name @@ -2198,6 +1186,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-display-qxl.so +%package hw-display-virtio-gpu +Summary: Virtio GPU display support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/04 +%{qemu_module_conflicts} + +%description hw-display-virtio-gpu +This package contains a module for Virtio GPU display support for QEMU. + %files hw-display-virtio-gpu %defattr(-, root, root) %dir %_datadir/%name @@ -2206,6 +1205,18 @@ fi %_libdir/%name/hw-display-virtio-gpu.so %_libdir/%name/hw-display-virtio-gpu-gl.so +%package hw-display-virtio-gpu-pci +Summary: Virtio-gpu pci device for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-hw-display-virtio-gpu +Provides: %name:%_datadir/%name/forsplits/11 +%{qemu_module_conflicts} + +%description hw-display-virtio-gpu-pci +This package contains a module providing the virtio gpu pci device for QEMU. + %files hw-display-virtio-gpu-pci %defattr(-, root, root) %dir %_datadir/%name @@ -2215,6 +1226,17 @@ fi %_libdir/%name/hw-display-virtio-gpu-pci.so %_libdir/%name/hw-display-virtio-gpu-pci-gl.so +%package hw-display-virtio-vga +Summary: Virtio vga device for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/12 +%{qemu_module_conflicts} + +%description hw-display-virtio-vga +This package contains a module providing the virtio vga device for QEMU. + %files hw-display-virtio-vga %defattr(-, root, root) %dir %_datadir/%name @@ -2224,6 +1246,19 @@ fi %_libdir/%name/hw-display-virtio-vga.so %_libdir/%name/hw-display-virtio-vga-gl.so +%package hw-s390x-virtio-gpu-ccw +Summary: S390x virtio-gpu ccw device for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-hw-display-virtio-gpu +Provides: %name:%_datadir/%name/forsplits/13 +%{qemu_module_conflicts} + +%description hw-s390x-virtio-gpu-ccw +This package contains a module providing the s390x virtio gpu ccw device for +QEMU. + %files hw-s390x-virtio-gpu-ccw %defattr(-, root, root) %dir %_datadir/%name @@ -2232,6 +1267,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-s390x-virtio-gpu-ccw.so +%package hw-usb-redirect +Summary: USB redirection support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/02 +%{qemu_module_conflicts} + +%description hw-usb-redirect +This package contains a module for USB redirection support for QEMU. + %files hw-usb-redirect %defattr(-, root, root) %dir %_datadir/%name @@ -2240,6 +1286,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-usb-redirect.so +%package hw-usb-smartcard +Summary: USB smartcard support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/03 +%{qemu_module_conflicts} + +%description hw-usb-smartcard +This package contains a modules for USB smartcard support for QEMU. + %files hw-usb-smartcard %defattr(-, root, root) %dir %_datadir/%name @@ -2248,6 +1305,17 @@ fi %dir %_libdir/%name %_libdir/%name/hw-usb-smartcard.so +%package hw-usb-host +Summary: USB passthrough driver support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/14 +%{qemu_module_conflicts} + +%description hw-usb-host +This package contains a modules for USB passthrough driver for QEMU. + %files hw-usb-host %defattr(-, root, root) %dir %_datadir/%name @@ -2256,16 +1324,63 @@ fi %dir %_libdir/%name %_libdir/%name/hw-usb-host.so +%package ui-dbus +Summary: D-Bus based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description ui-dbus +This package contains a module for doing D-Bus based UI for QEMU. + +%files ui-dbus +%defattr(-, root, root) +%dir %_libdir/%name +%_libdir/%name/ui-dbus.so + +%package ui-curses +Summary: Curses based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} + +%description ui-curses +This package contains a module for doing curses based UI for QEMU. + %files ui-curses %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/ui-curses.so +%package ui-gtk +Summary: GTK based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-ui-opengl +%{qemu_module_conflicts} + +%description ui-gtk +This package contains a module for doing GTK based UI for QEMU. + %files ui-gtk %defattr(-, root, root) %dir %_libdir/%name %_libdir/%name/ui-gtk.so +%package ui-opengl +Summary: OpenGL based UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/10 +%{qemu_module_conflicts} + +%description ui-opengl +This package contains a module for doing OpenGL based UI for QEMU. + %files ui-opengl %defattr(-, root, root) %dir %_datadir/%name @@ -2275,6 +1390,37 @@ fi %_libdir/%name/ui-egl-headless.so %_libdir/%name/ui-opengl.so +%package ui-spice-app +Summary: Spice UI support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: qemu-chardev-spice +Requires: qemu-ui-spice-core +%{qemu_module_conflicts} + +%description ui-spice-app +This package contains a module for doing Spice based UI for QEMU. + +%files ui-spice-app +%defattr(-, root, root) +%dir %_libdir/%name +%_libdir/%name/ui-spice-app.so + +%package ui-spice-core +Summary: Core Spice support for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/09 +Requires: qemu-ui-opengl +# This next Requires is only since virt-manager expects audio support +Requires: qemu-audio-spice +%{qemu_module_conflicts} + +%description ui-spice-core +This package contains a module with core Spice support for QEMU. + %files ui-spice-core %defattr(-, root, root) %dir %_datadir/%name @@ -2283,81 +1429,16 @@ fi %dir %_libdir/%name %_libdir/%name/ui-spice-core.so -%files ui-spice-app -%defattr(-, root, root) -%dir %_libdir/%name -%_libdir/%name/ui-spice-app.so +%package vhost-user-gpu +Summary: Vhost user mode virtio-gpu 2D/3D rendering backend for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +%{qemu_module_conflicts} -%files lang -f %blddir/%name.lang -%defattr(-, root, root) - -%if %{build_x86_firmware} -%files seabios -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/bios.bin -%_datadir/%name/bios-256k.bin -%_datadir/%name/firmware/50-seabios-256k.json -%_datadir/%name/firmware/60-seabios-128k.json - -%files microvm -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/bios-microvm.bin -%_datadir/%name/qboot.rom - -%files vgabios -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/vgabios.bin -%_datadir/%name/vgabios-ati.bin -%_datadir/%name/vgabios-bochs-display.bin -%_datadir/%name/vgabios-cirrus.bin -%_datadir/%name/vgabios-qxl.bin -%_datadir/%name/vgabios-ramfb.bin -%_datadir/%name/vgabios-stdvga.bin -%_datadir/%name/vgabios-virtio.bin -%_datadir/%name/vgabios-vmware.bin - -%files sgabios -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/sgabios.bin - -%files ipxe -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/efi-e1000.rom -%_datadir/%name/efi-e1000e.rom -%_datadir/%name/efi-eepro100.rom -%_datadir/%name/efi-ne2k_pci.rom -%_datadir/%name/efi-pcnet.rom -%_datadir/%name/efi-rtl8139.rom -%_datadir/%name/efi-virtio.rom -%_datadir/%name/efi-vmxnet3.rom -%_datadir/%name/pxe-e1000.rom -%_datadir/%name/pxe-eepro100.rom -%_datadir/%name/pxe-ne2k_pci.rom -%_datadir/%name/pxe-pcnet.rom -%_datadir/%name/pxe-rtl8139.rom -%_datadir/%name/pxe-virtio.rom -%endif - -%if %{build_ppc_firmware} -%files skiboot -%defattr(-, root, root) -%dir %_datadir/%name -%dir %_datadir/%name/forsplits -%_datadir/%name/forsplits/06 -%_datadir/%name/skiboot.lid -%_datadir/%name/skiboot.lid.qemu -%ghost %_sysconfdir/alternatives/skiboot.lid - -%files SLOF -%defattr(-, root, root) -%dir %_datadir/%name -%_datadir/%name/slof.bin -%endif +%description vhost-user-gpu +This package contains a vhost user mode virtio-gpu 2D/3D rendering backend for +QEMU. %files vhost-user-gpu %defattr(-, root, root) @@ -2365,6 +1446,28 @@ fi %_datadir/%name/vhost-user/50-qemu-gpu.json %_libexecdir/vhost-user-gpu +%package tools +Summary: Tools for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires(pre): permissions +Requires: group(kvm) +Recommends: multipath-tools +Recommends: qemu-block-curl +%if 0%{?with_rbd} +Recommends: qemu-block-rbd +%endif + +%description tools +This package contains various QEMU related tools, including a bridge helper, +a virtfs helper, ivshmem, disk utilities and scripts for various purposes. + +%post tools +%set_permissions %_libexecdir/qemu-bridge-helper +%verifyscript tools +%verify_permissions %_libexecdir/qemu-bridge-helper + %files tools %defattr(-, root, root) %_bindir/analyze-migration.py @@ -2387,6 +1490,19 @@ fi %dir %_sysconfdir/%name %config %_sysconfdir/%name/bridge.conf +%package ivshmem-tools +Summary: Inter-VM Shared Memory Tools for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/07 + +%description ivshmem-tools +This package contains a sample shared memory client and server which utilize +QEMU's Inter-VM shared memory device as specified by the ivshmem client-server +protocol specification documented in docs/specs/ivshmem-spec.txt in QEMU source +code. + %files ivshmem-tools %defattr(-, root, root) %dir %_datadir/%name @@ -2395,6 +1511,44 @@ fi %_bindir/ivshmem-client %_bindir/ivshmem-server +%package guest-agent +Summary: Guest agent for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires: group(kvm) +Requires(post): udev +Supplements: modalias(acpi*:QEMU0002%3A*) +Supplements: modalias(pci:v00005853d00000001sv*sd*bc*sc*i*) +Supplements: modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*) +%{?systemd_ordering} + +%description guest-agent +This package contains the QEMU guest agent. It is installed in the linux guest +to provide information and control at the guest OS level. + +%pre guest-agent +%service_add_pre qemu-guest-agent.service + +%post guest-agent +%service_add_post qemu-guest-agent.service +if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then + /usr/bin/systemctl start qemu-guest-agent.service || : +fi + +%preun guest-agent +if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then + /usr/bin/systemctl stop qemu-guest-agent.service || : +fi + +%postun guest-agent +%service_del_postun_without_restart qemu-guest-agent.service +if [ "$1" = "1" ] ; then + if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then + /usr/bin/systemctl restart qemu-guest-agent.service || : + fi +fi + %files guest-agent %defattr(-, root, root) %attr(0755,root,kvm) %_bindir/qemu-ga @@ -2404,10 +1558,50 @@ fi %{_unitdir}/qemu-guest-agent.service /usr/lib/udev/rules.d/80-qemu-ga.rules +%package ksm +Summary: Kernel Samepage Merging services +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Requires(pre): coreutils +Requires(post): coreutils + +%description ksm +Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that +merges anonymous (private) pages (not pagecache ones). + +This package provides a service file for starting and stopping KSM. + +%pre ksm +%service_add_pre ksm.service + +%post ksm +%service_add_post ksm.service + +%preun ksm +%service_del_preun ksm.service + +%postun ksm +%service_del_postun ksm.service + %files ksm %defattr(-, root, root) %{_unitdir}/ksm.service +%package accel-tcg-x86 +Summary: TCG accelerator for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/15 +%{qemu_module_conflicts} + +%description accel-tcg-x86 +TCG is the QEMU binary translator, responsible for converting from target to +host instruction set. + +This package provides the TCG accelerator for QEMU. + %files accel-tcg-x86 %defattr(-, root, root) %dir %_datadir/%name @@ -2417,6 +1611,20 @@ fi %_libdir/%name/accel-tcg-i386.so %_libdir/%name/accel-tcg-x86_64.so +%package accel-qtest +Summary: QTest accelerator for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +Provides: %name:%_datadir/%name/forsplits/16 +%{qemu_module_conflicts} + +%description accel-qtest +QTest is a device emulation testing framework. It is useful to test device +models. + +This package provides QTest accelerator for testing QEMU. + %files accel-qtest %defattr(-, root, root) %dir %_datadir/%name @@ -2454,55 +1662,774 @@ fi %_libdir/%name/accel-qtest-xtensa.so %_libdir/%name/accel-qtest-xtensaeb.so -# above section is for qemu +%if %{build_x86_firmware} +%package microvm +Summary: x86 MicroVM firmware for QEMU +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +BuildArch: noarch + +%description microvm +This package provides minimal x86 firmware for booting certain guests under +QEMU. qboot provides the minimum resources needed to boot PVH and bzImages. +bios-microvm, created from a minimal seabios configuration, provides slightly +wider support than qboot, but still focuses on quick boot up. + +%files microvm +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/bios-microvm.bin +%_datadir/%name/qboot.rom + +%package seabios +Summary: x86 Legacy BIOS for QEMU +Group: System/Emulators/PC +Version: %{sbver} +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description seabios +SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS +is the default and legacy BIOS for QEMU. + +%files seabios +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/bios.bin +%_datadir/%name/bios-256k.bin +%_datadir/%name/firmware/50-seabios-256k.json +%_datadir/%name/firmware/60-seabios-128k.json + +%package vgabios +Summary: VGA BIOSes for QEMU +Group: System/Emulators/PC +Version: %{sbver} +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description vgabios +VGABIOS provides the video ROM BIOSes for the following variants of VGA +emulated devices: Std VGA, QXL, Cirrus CLGD 5446 and VMware emulated +video card. For use with QEMU. + +%files vgabios +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/vgabios.bin +%_datadir/%name/vgabios-ati.bin +%_datadir/%name/vgabios-bochs-display.bin +%_datadir/%name/vgabios-cirrus.bin +%_datadir/%name/vgabios-qxl.bin +%_datadir/%name/vgabios-ramfb.bin +%_datadir/%name/vgabios-stdvga.bin +%_datadir/%name/vgabios-virtio.bin +%_datadir/%name/vgabios-vmware.bin + +%package sgabios +Summary: Serial Graphics Adapter BIOS for QEMU +Group: System/Emulators/PC +Version: 8 +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description sgabios +The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy +x86 software to communicate with an attached serial console as if a video card +were attached. For use with QEMU. + +%files sgabios +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/sgabios.bin + +%package ipxe +Summary: PXE ROMs for QEMU NICs +Group: System/Emulators/PC +Version: 1.0.0+ +Release: 0 +BuildArch: noarch +Conflicts: %name < 1.6.0 + +%description ipxe +Provides Preboot Execution Environment (PXE) ROM support for various emulated +network adapters available with QEMU. + +%files ipxe +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/efi-e1000.rom +%_datadir/%name/efi-e1000e.rom +%_datadir/%name/efi-eepro100.rom +%_datadir/%name/efi-ne2k_pci.rom +%_datadir/%name/efi-pcnet.rom +%_datadir/%name/efi-rtl8139.rom +%_datadir/%name/efi-virtio.rom +%_datadir/%name/efi-vmxnet3.rom +%_datadir/%name/pxe-e1000.rom +%_datadir/%name/pxe-eepro100.rom +%_datadir/%name/pxe-ne2k_pci.rom +%_datadir/%name/pxe-pcnet.rom +%_datadir/%name/pxe-rtl8139.rom +%_datadir/%name/pxe-virtio.rom +# End of "if build_x86_firmware +%endif + +%if %{build_ppc_firmware} +%package skiboot +Summary: OPAL firmware (aka skiboot), used in booting OpenPOWER systems +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +BuildArch: noarch +Requires(post): update-alternatives +Requires(postun):update-alternatives +Provides: %name:%_datadir/%name/forsplits/06 + +%description skiboot +Provides OPAL (OpenPower Abstraction Layer) firmware, aka skiboot, as +traditionally packaged with QEMU. + +%post skiboot +update-alternatives --install \ + %{_datadir}/%name/skiboot.lid skiboot.lid %{_datadir}/%name/skiboot.lid.qemu 15 + +%preun skiboot +if [ ! -f %{_datadir}/%name/skiboot.lid.qemu ] ; then + update-alternatives --remove skiboot.lid %{_datadir}/%name/skiboot.lid.qemu +fi + +%files skiboot +%defattr(-, root, root) +%dir %_datadir/%name +%dir %_datadir/%name/forsplits +%_datadir/%name/forsplits/06 +%_datadir/%name/skiboot.lid +%_datadir/%name/skiboot.lid.qemu +%ghost %_sysconfdir/alternatives/skiboot.lid + +%package SLOF +Summary: Slimline Open Firmware - SLOF +Group: System/Emulators/PC +Version: %{qemuver} +Release: 0 +BuildArch: noarch + +%description SLOF +Slimline Open Firmware (SLOF) is an implementation of the IEEE 1275 standard. +It can be used as partition firmware for pSeries machines running on QEMU or KVM. + +%files SLOF +%defattr(-, root, root) +%dir %_datadir/%name +%_datadir/%name/slof.bin +# End of "if build_ppc_firmware +%endif +# End of descriptions and files for qemu and its subpackages +%endif + +%prep +%autosetup -p1 -n %{srcname}-%{expand:%%(SV=%{srcver};echo ${SV%%%%+git*})} + +%if "%{name}" == "qemu" +# Firmwares handling for package qemu (for qemu-linux-user, there's nothing +# that we need to do in this regard). + +# For the record, this set of firmware files is installed, but we don't +# build them (yet): bamboo.dtb canyonlands.dtb hppa-firmware.img openbios-ppc +# openbios-sparc32 openbios-sparc64 palcode-clipper petalogix-ml605.dtb +# petalogix-s3adsp1800.dtb QEMU,cgthree.bin QEMU,tcx.bin qemu_vga.ndrv +# u-boot.e500 u-boot-sam460-20100605.bin opensbi-riscv32-generic-fw_dynamic.bin +# opensbi-riscv32-generic-fw_dynamic.elfnpcm7xx_bootrom.bin vof.bin +# vof-nvram.bin + +# Note that: +# - default firmwares are built "by default", i.e., they're built automatically +# during the process of building QEMU (on each specific arch) +# - extra firmwares are built "manually" (see below) from their own sources +# (which, typically, are submodules checked out in the {srcdi}r/roms directory) +%define ppc_default_firmware %{nil} +%define ppc_extra_firmware {skiboot.lid slof.bin} +%define riscv64_default_firmware %{nil} +%define riscv64_extra_firmware {opensbi-riscv64-generic-fw_dynamic.bin} +%define s390x_default_firmware {s390-ccw.img s390-netboot.img} +%define s390x_extra_firmware %{nil} +%define x86_default_firmware {linuxboot.bin linuxboot_dma.bin multiboot.bin \ +multiboot_dma.bin kvmvapic.bin pvh.bin} +%define x86_extra_firmware {bios.bin bios-256k.bin bios-microvm.bin qboot.rom \ +pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom pxe-pcnet.rom pxe-rtl8139.rom \ +pxe-virtio.rom sgabios.bin vgabios-ati.bin vgabios-bochs-display.bin \ +vgabios.bin vgabios-cirrus.bin vgabios-qxl.bin vgabios-ramfb.bin \ +vgabios-stdvga.bin vgabios-virtio.bin vgabios-vmware.bin \ +efi-e1000.rom efi-e1000e.rom efi-eepro100.rom efi-ne2k_pci.rom efi-pcnet.rom \ +efi-rtl8139.rom efi-virtio.rom efi-vmxnet3.rom} + +# Complete list of all the firmwares that we build, if we consider +# all the builds, on all the arches. +%define firmware { \ +%{ppc_default_firmware} %{ppc_extra_firmware} \ +%{riscv64_default_firmware} %{riscv64_extra_firmware} \ +%{s390x_default_firmware} %{s390x_extra_firmware} \ +%{x86_default_firmware} %{x86_extra_firmware} } + +# Note that: +# - {arch}_default_built_firmware are the firmwares that we will be built by +# default in this particular build, on the arch where we currently are on +# - {arch}_extra_built_fimrware, likewise, but for extra firmwares, built manually +%ifarch ppc64 ppc64le +%define ppc_default_built_firmware %{ppc_default_firmware} +%endif +%ifarch riscv64 +%define riscv64_default_built_firmware %{riscv64_default_firmware} +%endif +%ifarch s390x +%define s390x_default_built_firmware %{s390x_default_firmware} +%endif +%ifarch %ix86 x86_64 +%define x86_default_built_firmware %{x86_default_firmware} +%endif + +%if %{build_opensbi_firmware} +%define riscv64_extra_built_firmware %{riscv64_extra_firmware} +%endif +%if %{build_ppc_firmware} +%define ppc_extra_built_firmware %{ppc_extra_firmware} +%endif +%if %{build_x86_firmware} +%define x86_extra_built_firmware %{x86_extra_firmware} +%endif + +# List of only firmwares that will actually be built, in this instance +%define built_firmware { \ +%{?ppc_default_built_firmware} %{?ppc_extra_built_firmware} \ +%{?riscv64_default_built_firmware} %{?riscv64_extra_built_firmware} \ +%{?s390x_default_built_firmware} %{?s390x_extra_built_firmware} \ +%{?x86_default_built_firmware} %{?x86_extra_built_firmware} } + +# End of firmware handling for package qemu +%endif + +%build +# non-x86 archs still seem to have some issues with Link Time Optimization +%ifnarch %ix86 x86_64 +%define _lto_cflags %{nil} +%endif + +%if %{legacy_qemu_kvm} +%ifarch s390x +cp %{SOURCE13} docs/supported.rst +%else +# FIXME: So... We always put this same document there... Why the ifarch then ? +cp %{SOURCE13} docs/supported.rst +%endif +# End of "if legacy_qemu_kvm" +%endif + +mkdir -p %blddir +cd %blddir +# Configure options for qemu and qemu-linux-user packages +%srcdir/configure \ + --prefix=%_prefix \ + --sysconfdir=%_sysconfdir \ + --libdir=%_libdir \ + --libexecdir=%_libexecdir \ + --localstatedir=%_localstatedir \ + --docdir=%_docdir \ + --firmwarepath=%_datadir/%name \ + --python=%_bindir/python3 \ + --extra-cflags="%{optflags}" \ + --with-git-submodules=ignore \ + --with-pkgversion="%(echo '%{distro}' | sed 's/ (.*)//')" \ + --disable-fuzzing \ + --disable-multiprocess \ + --disable-stack-protector \ + --disable-strip \ + --disable-tcg-interpreter \ + --disable-qom-cast-debug \ + --enable-coroutine-pool \ +%if "%{_lto_cflags}" != "%{nil}" + --enable-lto \ +%endif +%if %{with system_membarrier} + --enable-membarrier \ +%else + --disable-membarrier \ %endif -# ------------------------------------------------------------------------ %if "%{name}" == "qemu-linux-user" - -%_bindir/qemu-aarch64 -%_bindir/qemu-aarch64_be -%_bindir/qemu-alpha -%_bindir/qemu-arm -%_bindir/qemu-armeb -%_bindir/qemu-cris -%_bindir/qemu-hexagon -%_bindir/qemu-hppa -%_bindir/qemu-i386 -%_bindir/qemu-m68k -%_bindir/qemu-microblaze -%_bindir/qemu-microblazeel -%_bindir/qemu-mips -%_bindir/qemu-mips64 -%_bindir/qemu-mips64el -%_bindir/qemu-mipsel -%_bindir/qemu-mipsn32 -%_bindir/qemu-mipsn32el -%_bindir/qemu-nios2 -%_bindir/qemu-or1k -%_bindir/qemu-ppc -%_bindir/qemu-ppc64 -%_bindir/qemu-ppc64le -%_bindir/qemu-riscv32 -%_bindir/qemu-riscv64 -%_bindir/qemu-s390x -%_bindir/qemu-sh4 -%_bindir/qemu-sh4eb -%_bindir/qemu-sparc -%_bindir/qemu-sparc32plus -%_bindir/qemu-sparc64 -%_bindir/qemu-x86_64 -%_bindir/qemu-xtensa -%_bindir/qemu-xtensaeb -%_bindir/qemu-binfmt -%_bindir/qemu-*-binfmt -%_sbindir/qemu-binfmt-conf.sh - + --disable-blobs \ + --disable-bochs \ + --disable-capstone \ + --disable-cloop \ + --disable-dmg \ + --disable-docs \ + --disable-fdt \ + --disable-gio \ + --disable-guest-agent \ + --disable-iconv \ + --disable-kvm \ + --disable-libdaxctl \ + --disable-linux-io-uring \ + --disable-malloc-trim \ + --disable-modules \ + --disable-parallels \ + --disable-pie \ + --disable-plugins \ + --disable-qcow1 \ + --disable-qed \ + --disable-replication \ + --disable-safe-stack \ + --disable-slirp \ + --disable-system \ + --disable-tools \ + --disable-tpm \ + --disable-vdi \ + --disable-vhost-crypto \ + --disable-vhost-kernel \ + --disable-vhost-net \ + --disable-vhost-scsi \ + --disable-vhost-user \ + --disable-vhost-user-blk-server \ + --disable-vhost-vsock \ + --disable-vnc \ + --disable-vvfat \ + --disable-vhost-user-fs \ + --disable-xkbcommon \ + --enable-linux-user \ + --static \ + --without-default-devices \ +%else +%if %{kvm_available} + --enable-kvm \ +%else + --disable-kvm \ %endif -# ------------------------------------------------------------------------ -%if "%{name}" == "qemu-testsuite" +%if 0%{?with_daxctl} + --enable-libdaxctl \ +%else + --disable-libdaxctl \ +%endif +%ifarch x86_64 + --enable-libpmem \ +%else + --disable-libpmem \ +%endif +%if 0%{?with_uring} + --enable-linux-io-uring \ +%else + --disable-linux-io-uring \ +%endif +%ifarch %arm s390x + --disable-numa \ +%else + --enable-numa \ +%endif +%if 0%{?with_rbd} + --enable-rbd \ +%else + --disable-rbd \ +%endif +%ifarch x86_64 + --enable-xen \ + --enable-xen-pci-passthrough \ +%else + --disable-xen \ +%endif + --disable-auth-pam \ + --disable-capstone \ + --disable-crypto-afalg \ + --disable-hax \ + --disable-hvf \ + --disable-linux-user \ + --disable-malloc-trim \ + --disable-module-upgrades \ + --disable-netmap \ + --disable-nettle \ + --disable-safe-stack \ + --disable-sanitizers \ + --disable-sdl \ + --disable-sdl-image \ + --disable-plugins \ + --disable-whpx \ + --enable-attr \ + --enable-bochs \ + --enable-brlapi \ + --enable-bzip2 \ + --enable-cap-ng \ + --enable-cloop \ + --enable-curl \ + --enable-curses \ + --enable-dmg \ + --enable-docs \ + --enable-fdt \ + --enable-gcrypt \ + --enable-gio \ + --enable-glusterfs \ + --enable-gnutls \ + --enable-gtk \ + --enable-guest-agent \ + --enable-iconv \ + --enable-libiscsi \ + --enable-libnfs \ + --enable-libssh \ + --enable-libusb \ + --enable-linux-aio \ + --enable-lzfse \ + --enable-lzo \ + --enable-modules \ + --enable-mpath \ + --enable-opengl \ + --enable-parallels \ + --enable-pie \ + --enable-pvrdma \ + --enable-qcow1 \ + --enable-qed \ + --enable-rdma \ + --enable-replication \ + --enable-seccomp \ + --enable-slirp=system \ + --enable-smartcard \ + --enable-snappy \ + --enable-spice \ + --enable-system \ + --enable-tools \ + --enable-tpm \ + --enable-usb-redir \ + --enable-vde \ + --enable-vdi \ + --enable-vhost-crypto \ + --enable-vhost-kernel \ + --enable-vhost-net \ + --enable-vhost-scsi \ + --enable-vhost-user \ + --enable-vhost-user-blk-server \ + --enable-vhost-vdpa \ + --enable-vhost-vsock \ + --enable-virglrenderer \ + --enable-virtfs \ + --enable-vnc \ + --enable-vnc-jpeg \ + --enable-vnc-png \ + --enable-vnc-sasl \ + --enable-vte \ + --enable-vvfat \ + --enable-werror \ + --enable-zstd \ + --enable-vhost-user-fs \ + --enable-xkbcommon \ + --with-default-devices \ +%endif +# End of configure options for packages qemu and qemu-linux-user -%_datadir/qemu/check-report.tap +%if "%{name}" == "qemu" +# If we are building the qemu package, we first need to delete, from the +# pc-bios directory, all the binary firmware files that we are going to build +# ourselves. We will reinstate their built version later. +for i in %built_firmware +do + unlink %srcdir/pc-bios/$i +done +%endif +%make_build +#V=1 VERBOSE=1 + +%if "%{name}" == "qemu" +# Second part of the firmware handling process for the qemu package. We have +# already built QEMU (see make_build above), which means we have also built +# all the "default" (see above) firmwares. Therefore, we can copy them to the +# pc-bios directory, since we want them to be there for the install phase. +for i in %{?s390x_default_built_firmware} +do + cp pc-bios/s390-ccw/$i %srcdir/pc-bios/ +done +for i in %{?x86_default_built_firmware} +do + cp pc-bios/optionrom/$i %srcdir/pc-bios/ +done + +# The last step is building the "extra" (see above) firmwares. The binaries +# will just end up in the pc-bios directory by themselves, so there's no need +# to manually copy them there. Note also that the Makefile in {srcdir}/roms +# does some cross-compiler auto detection. So we often don't need to define +# or pass CROSS= and CROSS_COMPILE ourselves, when we're cross compiling. +%if %{build_ppc_firmware} +# FIXME: check if we can upstream: Makefile-define-endianess-for-cross-buil.patch +%make_build -C %srcdir/roms skiboot +%make_build -C %srcdir/roms slof +%endif +%if %{build_opensbi_firmware} +%make_build -C %srcdir/roms opensbi64-generic +%endif +%if %{build_x86_firmware} +%make_build %{?_smp_mflags} -C %srcdir/roms bios SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" +# FIXME: check if we can upstream: roms-Makefile-add-cross-file-to-qboot-me.patch +# and qboot-add-cross.ini-file-to-handle-aarch.patch +%make_build -C %srcdir/roms qboot +%make_build -C %srcdir/roms seavgabios +%make_build -C %srcdir/roms seavgabios-ati +%make_build -C %srcdir/roms pxerom +%make_build -C %srcdir/roms efirom EDK2_BASETOOLS_OPTFLAGS='-fPIE' +# We're currently not building firmware on ix86, but let's make sure this works +# fine if one enables it, e.g., locally (for debugging or something). +# FIXME: check if we can get rid or upstream: roms-sgabios-Fix-csum8-to-be-built-by-ho.patch +make -C %srcdir/roms sgabios HOSTCC=cc \ +%ifnarch %ix86 x86_64 + CC=x86_64-suse-linux-gcc LD=x86_64-suse-linux-ld \ +%endif + %{nil} + +%if %{force_fit_virtio_pxe_rom} +pushd %srcdir +patch -p1 < %_sourcedir/stub-out-the-SAN-req-s-in-int13.patch +popd +%make_build -C %srcdir/roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom +%endif + +for i in %supported_nics_large %unsupported_nics + do + if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "131072" ; then + echo "pxe rom is too large" + exit 1 + fi + if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -le "65536" ; then + ./%srcdir/roms/ipxe/src/util/padimg.pl %srcdir/pc-bios/pxe-$i.rom -s 65536 -b 255 + echo -ne "SEGMENT OVERAGE\0" >> %srcdir/pc-bios/pxe-$i.rom + fi +done +for i in %supported_nics_small + do + if test "`stat -c '%s' %srcdir/pc-bios/pxe-$i.rom`" -gt "65536" ; then + echo "pxe rom is too large" + exit 1 + fi +done +# End of "if build_x86_firmware" +%endif + +# Done handling firmwares for qemu +%endif + +%install +cd %blddir +%make_build install DESTDIR=%{buildroot} + +%if "%{name}" == "qemu-linux-user" +# Adjust the content of the buildroot for the qemu-linux-user package +rm -rf %{buildroot}%_datadir/qemu/keymaps +unlink %{buildroot}%_datadir/qemu/trace-events-all +install -d -m 755 %{buildroot}%_sbindir +# FIXME: All the following symlinking is just legacy and should go away! +install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64_be-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-alpha-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-armeb-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-cris-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hexagon-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hppa-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-i386-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-m68k-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblaze-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblazeel-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64el-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsel-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32el-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-nios2-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-or1k-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64le-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-s390x-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4eb-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc32plus-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-x86_64-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensa-binfmt +ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt +# Done setting up the buildroot for qemu-linux-user +%else +# Adjust the content of the buildroot for the qemu and all its subpackages +%find_lang %name +install -d -m 0755 %{buildroot}%_datadir/%name/firmware +install -d -m 0755 %{buildroot}/usr/lib/supportconfig/plugins +install -d -m 0755 %{buildroot}%_sysconfdir/%name/firmware +install -D -m 0644 %{SOURCE4} %{buildroot}%_sysconfdir/%name/bridge.conf +install -D -m 0755 %{SOURCE3} %{buildroot}%_datadir/%name/qemu-ifup +install -D -p -m 0644 %{SOURCE8} %{buildroot}/usr/lib/udev/rules.d/80-qemu-ga.rules +install -D -m 0755 scripts/analyze-migration.py %{buildroot}%_bindir/analyze-migration.py +install -D -m 0755 scripts/vmstate-static-checker.py %{buildroot}%_bindir/vmstate-static-checker.py +install -D -m 0755 scripts/kvm/vmxcap %{buildroot}%_bindir/vmxcap +install -D -m 0755 %{SOURCE9} %{buildroot}/usr/lib/supportconfig/plugins/%name +install -D -m 0644 %{SOURCE10} %{buildroot}%_docdir/qemu-arm/supported.txt +install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt +install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt +install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390x/supported.txt +%if %{legacy_qemu_kvm} +install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz +install -d %{buildroot}%_docdir/qemu-kvm +%ifarch s390x +ln -s qemu-system-s390x %{buildroot}%_bindir/qemu-kvm +ln -s ../qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt +rst2html --exit-status=2 %{buildroot}%_docdir/qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html +%else +ln -s qemu-system-x86_64 %{buildroot}%_bindir/qemu-kvm +ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt +rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html +%endif +# End of "if legacy_qemu_kvm" +%endif +%if %{kvm_available} +install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/80-kvm.rules +%endif +install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-guest-agent.service +install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service +%ifarch s390x +install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf +%endif + +# We rely on a separate project / package to provide edk2 firmware +unlink %{buildroot}%_datadir/%name/edk2-licenses.txt +unlink %{buildroot}%_datadir/%name/firmware/50-edk2-i386-secure.json +unlink %{buildroot}%_datadir/%name/firmware/50-edk2-x86_64-secure.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-aarch64.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-arm.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-i386.json +unlink %{buildroot}%_datadir/%name/firmware/60-edk2-x86_64.json +unlink %{buildroot}%_datadir/%name/edk2-aarch64-code.fd +unlink %{buildroot}%_datadir/%name/edk2-arm-code.fd +unlink %{buildroot}%_datadir/%name/edk2-arm-vars.fd +unlink %{buildroot}%_datadir/%name/edk2-i386-code.fd +unlink %{buildroot}%_datadir/%name/edk2-i386-secure-code.fd +unlink %{buildroot}%_datadir/%name/edk2-i386-vars.fd +unlink %{buildroot}%_datadir/%name/edk2-x86_64-code.fd +unlink %{buildroot}%_datadir/%name/edk2-x86_64-secure-code.fd + +# this was never meant for customer consumption - delete even though installed +unlink %{buildroot}%_bindir/elf2dmp + +install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt +for X in 00 01 02 03 04 05 07 08 09 10 11 12 13 14 15 16 17 18 19 +do + ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X +done + +# For PPC and x86 firmwares, there are a few extra install steps necessary. +# In general, if we know that we have not built a firmware, we must remove it +# from the install base. In fact, the one that we have there is the upstream +# provided binary, which we don't want to ship. +%if %{build_ppc_firmware} +# in support of update-alternatives +mv %{buildroot}%_datadir/%name/skiboot.lid %{buildroot}%_datadir/%name/skiboot.lid.qemu +# create a dummy target for /etc/alternatives/skiboot.lid +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +ln -s -f %{_sysconfdir}/alternatives/skiboot.lid %{buildroot}%{_datadir}/%name/skiboot.lid +ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/06 +%else +for f in %{ppc_extra_firmware} ; do + unlink %{buildroot}%_datadir/%name/$f +done +# End of "if build_ppc_firmware" +%endif +%if %{build_x86_firmware} +install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json +install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json +%else +for f in %{x86_extra_firmware} ; do + unlink %{buildroot}%_datadir/%name/$f +done +# Enf of "if build_x86_firmware" +%endif + +# For riscv64 firmwares (currently, only opensbi), we actuallly leave the +# upstream provided binaries there, as they're part of the qemu-extra package +# (and riscv is a bit special in many ways already). + +%suse_update_desktop_file qemu + +# End of setting up the buildroot for qemu and its subpackages +%endif +# Get rid of dupes (NB: this is common to qemu and qemu-linux-user) +%fdupes -s %{buildroot} + +%check +cd %blddir + +%if "%{name}" == "qemu" +# Let's try to run 'make check' for the qemu package + +# Patch 'increase x86_64 physical bits to 42' requires that the DSDT used for +# acpi [q]tests is modified too. But it's binary, and that means we cannot +# do that in the patch itself. Instead, we keep a copy of the binary in the +# package sources, and put it in place now, before the tests themselves. +# If that patch is removed, the following line needs to go as well. +cp %{SOURCE202} %{srcdir}/tests/data/acpi/microvm/ + +# Compile the QOM test binary first, so that ... +%make_build tests/qtest/qom-test +# ... make comes in fresh and has lots of address space (needed for 32bit, bsc#957379) +# FIXME: is this still a problem? +# Let's build everything first +%make_build check-build + +# Let's run the 'make check' component individually, so we have more +# control on the options (like -j, etc) +%make_build check-unit +%make_build check-qapi-schema +# iotests are not reliable if ran in parallel in OBS +%make_build -j1 check-block +%make_build check-softfloat +%make_build check-qtest +# FIXME: does it make sense to give it a run to, as a recap: +#make_build check-report.junit.xml ? + +# End of checks for qemu +%else +# Let's run the relevant check for the qemu-linux-user package + +%ifarch %ix86 +%define qemu_arch i386 +%endif +%ifarch x86_64 +%define qemu_arch x86_64 +%endif +%ifarch %arm +%define qemu_arch arm +%endif +%ifarch aarch64 +%define qemu_arch aarch64 +%endif +%ifarch ppc +%define qemu_arch ppc +%endif +%ifarch ppc64 +%define qemu_arch ppc64 +%endif +%ifarch ppc64le +%define qemu_arch ppc64le +%endif +%ifarch s390x +%define qemu_arch s390x +%endif + +%ifarch %ix86 x86_64 %arm aarch64 ppc ppc64 ppc64le s390x +%ifnarch %arm +%{qemu_arch}-linux-user/qemu-%{qemu_arch} %_bindir/ls > /dev/null +%endif +%endif + +%make_build check-softfloat +# Done with checks for qemu-linux-user %endif %changelog diff --git a/qht-Revert-some-constification-in-qht.c.patch b/qht-Revert-some-constification-in-qht.c.patch index b1a1ee6d..85bda99f 100644 --- a/qht-Revert-some-constification-in-qht.c.patch +++ b/qht-Revert-some-constification-in-qht.c.patch @@ -34,10 +34,10 @@ index 2e2d6bca932c83bea993850b60f8..6484837487b012cbfc63b6c6e39e 100644 /** * qht_remove - remove a pointer from the hash table diff --git a/util/qht.c b/util/qht.c -index cfc2c60639af8f7905aae51c53bb..152b8d74f0b12cf4ed75e543575f 100644 +index 0803c194d10b5cdafdc8b18ec083..24fdd3e0e23447b2ca67c0a1bc3a 100644 --- a/util/qht.c +++ b/util/qht.c -@@ -485,10 +485,10 @@ bool qht_reset_size(struct qht *ht, size_t n_elems) +@@ -486,10 +486,10 @@ bool qht_reset_size(struct qht *ht, size_t n_elems) } static inline @@ -50,7 +50,7 @@ index cfc2c60639af8f7905aae51c53bb..152b8d74f0b12cf4ed75e543575f 100644 int i; do { -@@ -512,7 +512,7 @@ void *qht_do_lookup(const struct qht_bucket *head, qht_lookup_func_t func, +@@ -513,7 +513,7 @@ void *qht_do_lookup(const struct qht_bucket *head, qht_lookup_func_t func, } static __attribute__((noinline)) @@ -59,7 +59,7 @@ index cfc2c60639af8f7905aae51c53bb..152b8d74f0b12cf4ed75e543575f 100644 const void *userp, uint32_t hash) { unsigned int version; -@@ -525,10 +525,10 @@ void *qht_lookup__slowpath(const struct qht_bucket *b, qht_lookup_func_t func, +@@ -526,10 +526,10 @@ void *qht_lookup__slowpath(const struct qht_bucket *b, qht_lookup_func_t func, return ret; } @@ -72,7 +72,7 @@ index cfc2c60639af8f7905aae51c53bb..152b8d74f0b12cf4ed75e543575f 100644 const struct qht_map *map; unsigned int version; void *ret; -@@ -548,7 +548,7 @@ void *qht_lookup_custom(const struct qht *ht, const void *userp, uint32_t hash, +@@ -549,7 +549,7 @@ void *qht_lookup_custom(const struct qht *ht, const void *userp, uint32_t hash, return qht_lookup__slowpath(b, func, userp, hash); } diff --git a/qom-handle-case-of-chardev-spice-module-.patch b/qom-handle-case-of-chardev-spice-module-.patch index 9588bbb0..82da537c 100644 --- a/qom-handle-case-of-chardev-spice-module-.patch +++ b/qom-handle-case-of-chardev-spice-module-.patch @@ -14,10 +14,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 6 insertions(+) diff --git a/qom/object.c b/qom/object.c -index 4f0677cca9e494a3eb20d9dabd0c..63ed3d67b61f7c5c67a3ee25e201 100644 +index d34608558e9e5e53f4b363774f06..ce9f80117e518640b89fb1afa7d3 100644 --- a/qom/object.c +++ b/qom/object.c -@@ -237,6 +237,12 @@ static bool type_is_ancestor(TypeImpl *type, TypeImpl *target_type) +@@ -238,6 +238,12 @@ static bool type_is_ancestor(TypeImpl *type, TypeImpl *target_type) return true; } diff --git a/roms-Makefile-add-cross-file-to-qboot-me.patch b/roms-Makefile-add-cross-file-to-qboot-me.patch index 756f1346..fb955fd2 100644 --- a/roms-Makefile-add-cross-file-to-qboot-me.patch +++ b/roms-Makefile-add-cross-file-to-qboot-me.patch @@ -13,10 +13,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roms/Makefile b/roms/Makefile -index 6ea8edd9fcf6bb0cdc1f1602f241..df969e3ec33ab07fe3fcb489e0df 100644 +index c7c6e973db59572e8b8bee74e969..6f979016c273246ce91432ee0ace 100644 --- a/roms/Makefile +++ b/roms/Makefile -@@ -199,7 +199,7 @@ MESON = meson +@@ -197,7 +197,7 @@ MESON = meson NINJA = ninja qboot: mkdir -p qboot/build diff --git a/roms-Makefile-pass-a-packaging-timestamp.patch b/roms-Makefile-pass-a-packaging-timestamp.patch index 59af3e04..49be9f7e 100644 --- a/roms-Makefile-pass-a-packaging-timestamp.patch +++ b/roms-Makefile-pass-a-packaging-timestamp.patch @@ -20,7 +20,7 @@ Signed-off-by: Bruce Rogers 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/roms/Makefile b/roms/Makefile -index b967b53bb76ee8a94fc9b37e4460..66d06f5831303c3d41e943290389 100644 +index 5e44d9789001979a0e9ef3183f90..3d53bd528666b594ab3d6b631450 100644 --- a/roms/Makefile +++ b/roms/Makefile @@ -52,6 +52,12 @@ SEABIOS_EXTRAVERSION="-prebuilt.qemu.org" diff --git a/scsi-generic-check-for-additional-SG_IO-.patch b/scsi-generic-check-for-additional-SG_IO-.patch index 7ce294ff..e0185bca 100644 --- a/scsi-generic-check-for-additional-SG_IO-.patch +++ b/scsi-generic-check-for-additional-SG_IO-.patch @@ -2,6 +2,7 @@ From: Hannes Reinecke Date: Fri, 25 Mar 2022 18:41:52 +0100 Subject: scsi-generic: check for additional SG_IO status on completion +Git-commit: 0000000000000000000000000000000000000000 References: bsc#1178049 SG_IO may return additional status in the 'status', 'driver_status', diff --git a/seabios-switch-to-python3-as-needed.patch b/seabios-switch-to-python3-as-needed.patch index bbb46284..43046b6d 100644 --- a/seabios-switch-to-python3-as-needed.patch +++ b/seabios-switch-to-python3-as-needed.patch @@ -17,24 +17,24 @@ Signed-off-by: Bruce Rogers 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/roms/seabios/Makefile b/roms/seabios/Makefile -index 418a0e3649443ee89e8fdad436f5..408983026669e531dcb84230dd23 100644 +index c108f87de7683667d1a0cad6b9e5..408983026669e531dcb84230dd23 100644 --- a/roms/seabios/Makefile +++ b/roms/seabios/Makefile @@ -22,7 +22,7 @@ LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip --PYTHON=python2 +-PYTHON=python +PYTHON=python3 CPP=cpp IASL:=iasl LD32BIT_FLAG:=-melf_i386 diff --git a/roms/seabios/scripts/acpi_extract.py b/roms/seabios/scripts/acpi_extract.py -index 86c6226c0f9aae4e4687cf216369..7ac054e626780253fcec78414b17 100755 +index 3ed863b6a79412a1276bb905d08f..7ac054e626780253fcec78414b17 100755 --- a/roms/seabios/scripts/acpi_extract.py +++ b/roms/seabios/scripts/acpi_extract.py @@ -1,4 +1,4 @@ --#!/usr/bin/python2 +-#!/usr/bin/python +#!/usr/bin/python3 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin # @@ -49,11 +49,11 @@ index 86c6226c0f9aae4e4687cf216369..7ac054e626780253fcec78414b17 100755 outstrs.append("static unsigned %s %s[] = {" % (otype, array)) odata = [] diff --git a/roms/seabios/scripts/acpi_extract_preprocess.py b/roms/seabios/scripts/acpi_extract_preprocess.py -index b8e92a525730442815a0dce78f45..6963847a8b5d3e4bf9340a67afe2 100755 +index 2698118406d97c164783335c7fb6..6963847a8b5d3e4bf9340a67afe2 100755 --- a/roms/seabios/scripts/acpi_extract_preprocess.py +++ b/roms/seabios/scripts/acpi_extract_preprocess.py @@ -1,4 +1,4 @@ --#!/usr/bin/python2 +-#!/usr/bin/python +#!/usr/bin/python3 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin # diff --git a/seabios-use-python2-explicitly-as-needed.patch b/seabios-use-python2-explicitly-as-needed.patch deleted file mode 100644 index 61123989..00000000 --- a/seabios-use-python2-explicitly-as-needed.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Bruce Rogers -Date: Thu, 27 Jun 2019 10:15:24 -0600 -Subject: seabios: use python2 explicitly as needed - -Switch to python2 the places where "python" is explicitly referenced. -(Ignore the uses of #!/usr/bin/env python, since that usage does the -right thing in our build environment). - -Signed-off-by: Bruce Rogers ---- - Makefile | 2 +- - scripts/acpi_extract.py | 2 +- - scripts/acpi_extract_preprocess.py | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/roms/seabios/Makefile b/roms/seabios/Makefile -index c108f87de7683667d1a0cad6b9e5..418a0e3649443ee89e8fdad436f5 100644 ---- a/roms/seabios/Makefile -+++ b/roms/seabios/Makefile -@@ -22,7 +22,7 @@ LD=$(CROSS_PREFIX)ld - OBJCOPY=$(CROSS_PREFIX)objcopy - OBJDUMP=$(CROSS_PREFIX)objdump - STRIP=$(CROSS_PREFIX)strip --PYTHON=python -+PYTHON=python2 - CPP=cpp - IASL:=iasl - LD32BIT_FLAG:=-melf_i386 -diff --git a/roms/seabios/scripts/acpi_extract.py b/roms/seabios/scripts/acpi_extract.py -index 3ed863b6a79412a1276bb905d08f..86c6226c0f9aae4e4687cf216369 100755 ---- a/roms/seabios/scripts/acpi_extract.py -+++ b/roms/seabios/scripts/acpi_extract.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python2 - # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin - # - # This file may be distributed under the terms of the GNU GPLv3 license. -diff --git a/roms/seabios/scripts/acpi_extract_preprocess.py b/roms/seabios/scripts/acpi_extract_preprocess.py -index 2698118406d97c164783335c7fb6..b8e92a525730442815a0dce78f45 100755 ---- a/roms/seabios/scripts/acpi_extract_preprocess.py -+++ b/roms/seabios/scripts/acpi_extract_preprocess.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python2 - # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin - # - # This file may be distributed under the terms of the GNU GPLv3 license. diff --git a/tests-Fix-block-tests-to-be-compatible-w.patch b/tests-Fix-block-tests-to-be-compatible-w.patch index 7cbad25b..f1e5926d 100644 --- a/tests-Fix-block-tests-to-be-compatible-w.patch +++ b/tests-Fix-block-tests-to-be-compatible-w.patch @@ -60,7 +60,7 @@ index e45285ccc311522481ac1b27ba99..7168bdf70c3eb32d4de0d28bb947 100644 file format: IMGFMT virtual size: 64 MiB (67108864 bytes) diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153 -index 607af590918aaccd12490493b42a..987158ca49a88cef0815ea86f39e 100755 +index 9bc3be8f75c5a791331868d51136..9875eaf25981d557e403c3471633 100755 --- a/tests/qemu-iotests/153 +++ b/tests/qemu-iotests/153 @@ -202,7 +202,8 @@ _send_qemu_cmd $QEMU_HANDLE \ diff --git a/tests-qemu-iotests-040-Skip-TestCommitWi.patch b/tests-qemu-iotests-040-Skip-TestCommitWi.patch deleted file mode 100644 index f14eb081..00000000 --- a/tests-qemu-iotests-040-Skip-TestCommitWi.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Thomas Huth -Date: Wed, 23 Feb 2022 13:31:27 +0100 -Subject: tests/qemu-iotests/040: Skip TestCommitWithFilters without 'throttle' - -Git-commit: 024354ea9164d3c4b6fd766784939fe39fa4e166 - -iotest 040 already has some checks for the availability of the 'throttle' -driver, but some new code has been added in the course of time that -depends on 'throttle' but does not check for its availability. Add -a check to the TestCommitWithFilters class so that this iotest now -also passes again if 'throttle' has not been enabled in the QEMU -binaries. - -Signed-off-by: Thomas Huth -Message-Id: <20220223123127.3206042-1-thuth@redhat.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/040 | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 -index 6af5ab9e764cc5a061712a622a81..0e1cfd7e49d1b02f41d286c95f74 100755 ---- a/tests/qemu-iotests/040 -+++ b/tests/qemu-iotests/040 -@@ -744,6 +744,7 @@ class TestCommitWithFilters(iotests.QMPTestCase): - pattern_file) - self.assertFalse('Pattern verification failed' in result) - -+ @iotests.skip_if_unsupported(['throttle']) - def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, self.img0, '64M') - qemu_img('create', '-f', iotests.imgfmt, self.img1, '64M') diff --git a/tests-qemu-iotests-Fix-051-for-binaries-.patch b/tests-qemu-iotests-Fix-051-for-binaries-.patch deleted file mode 100644 index 55538016..00000000 --- a/tests-qemu-iotests-Fix-051-for-binaries-.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Thomas Huth -Date: Mon, 6 Dec 2021 15:34:04 +0100 -Subject: tests/qemu-iotests: Fix 051 for binaries without 'lsi53c895a' - -Git-commit: 0c83471bd75d329f4945e27dc1aa3a6cc2fda3bf - -The lsi53c895a SCSI adaptor might not be enabled in each and every -x86 QEMU binary, e.g. it's disabled in the RHEL/CentOS build. -Thus let's add a check to the 051 test so that it does not fail if -this device is not available. - -Signed-off-by: Thomas Huth -Message-Id: <20211206143404.247032-1-thuth@redhat.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/051 | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 -index 1d2fa93a11593ffa70cecf106532..e9042a621420332ac288060cbec2 100755 ---- a/tests/qemu-iotests/051 -+++ b/tests/qemu-iotests/051 -@@ -45,6 +45,10 @@ _supported_proto file - _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file - _require_drivers nbd - -+if [ "$QEMU_DEFAULT_MACHINE" = "pc" ]; then -+ _require_devices lsi53c895a -+fi -+ - do_run_qemu() - { - echo Testing: "$@" diff --git a/tests-qemu-iotests-testrunner-Quote-case.patch b/tests-qemu-iotests-testrunner-Quote-case.patch deleted file mode 100644 index e6c88e4f..00000000 --- a/tests-qemu-iotests-testrunner-Quote-case.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Thomas Huth -Date: Wed, 23 Feb 2022 13:43:53 +0100 -Subject: tests/qemu-iotests/testrunner: Quote "case not run" lines in TAP mode - -Git-commit: db4b2133b8d3012dfd1977dc12d48d6bf46543d6 - -In TAP mode, the stdout is reserved for the TAP protocol, so we -have to make sure to mark other lines with a comment '#' character -at the beginning to avoid that the TAP parser at the other end -gets confused. - -To test this condition, run "configure" for example with: - - --block-drv-rw-whitelist=copy-before-write,qcow2,raw,file,host_device,blkdebug,null-co,copy-on-read - -so that iotest 041 will report that some tests are not run due to -the missing "quorum" driver. Without this change, "make check-block" -fails since the meson tap parser gets confused by these messages. - -Signed-off-by: Thomas Huth -Message-Id: <20220223124353.3273898-1-thuth@redhat.com> -Signed-off-by: Hanna Reitz -Signed-off-by: Li Zhang ---- - tests/qemu-iotests/testrunner.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py -index 0e29c2fddddb2e7c611f5ad1f366..a7e2c16e09559054e53da60a1ac9 100644 ---- a/tests/qemu-iotests/testrunner.py -+++ b/tests/qemu-iotests/testrunner.py -@@ -305,7 +305,10 @@ class TestRunner(ContextManager['TestRunner']): - test_field_width=test_field_width) - - if res.casenotrun: -- print(res.casenotrun) -+ if self.tap: -+ print('#' + res.casenotrun.replace('\n', '\n#')) -+ else: -+ print(res.casenotrun) - - return res - diff --git a/tools-virtiofsd-Add-rseq-syscall-to-the-.patch b/tools-virtiofsd-Add-rseq-syscall-to-the-.patch deleted file mode 100644 index 8f5d795f..00000000 --- a/tools-virtiofsd-Add-rseq-syscall-to-the-.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Christian Ehrhardt -Date: Wed, 9 Feb 2022 12:14:56 +0100 -Subject: tools/virtiofsd: Add rseq syscall to the seccomp allowlist - -Git-commit: 7b223e38603de3a75602e14914d26f9d4baf52eb -References: bsc#1196924 - -The virtiofsd currently crashes when used with glibc 2.35. -That is due to the rseq system call being added to every thread -creation [1][2]. - -[1]: https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ -[2]: https://sourceware.org/pipermail/libc-alpha/2022-February/136040.html - -This happens not at daemon start, but when a guest connects - - /usr/lib/qemu/virtiofsd -f --socket-path=/tmp/testvfsd -o sandbox=chroot \ - -o source=/var/guests/j-virtiofs --socket-group=kvm - virtio_session_mount: Waiting for vhost-user socket connection... - # start ok, now guest will connect - virtio_session_mount: Received vhost-user socket connection - virtio_loop: Entry - fv_queue_set_started: qidx=0 started=1 - fv_queue_set_started: qidx=1 started=1 - Bad system call (core dumped) - -We have to put rseq on the seccomp allowlist to avoid that the daemon -is crashing in this case. - -Reported-by: Michael Hudson-Doyle -Signed-off-by: Christian Ehrhardt -Reviewed-by: Dr. David Alan Gilbert -Message-id: 20220209111456.3328420-1-christian.ehrhardt@canonical.com - -[Moved rseq to its alphabetically ordered position in the seccomp -allowlist. ---Stefan] -Signed-off-by: Stefan Hajnoczi -Signed-off-by: Dario Faggioli ---- - tools/virtiofsd/passthrough_seccomp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c -index a3ce9f898d2d5cb30153b9301c1c..2bc0127b69ad72a0505bb45c1fcd 100644 ---- a/tools/virtiofsd/passthrough_seccomp.c -+++ b/tools/virtiofsd/passthrough_seccomp.c -@@ -91,6 +91,9 @@ static const int syscall_allowlist[] = { - SCMP_SYS(renameat2), - SCMP_SYS(removexattr), - SCMP_SYS(restart_syscall), -+#ifdef __NR_rseq -+ SCMP_SYS(rseq), /* required since glibc 2.35 */ -+#endif - SCMP_SYS(rt_sigaction), - SCMP_SYS(rt_sigprocmask), - SCMP_SYS(rt_sigreturn), diff --git a/update_git.sh b/update_git.sh index 740fc21f..48b7a5d7 100644 --- a/update_git.sh +++ b/update_git.sh @@ -17,9 +17,9 @@ set -e clean_up_temp_dirs() { echo "Cleaning temporary files before exit" -rm -rf $GIT_DIR -rm -rf $CMP_DIR -rm -rf $BUN_DIR +#rm -rf $GIT_DIR +#rm -rf $CMP_DIR +#rm -rf $BUN_DIR exit } @@ -47,9 +47,9 @@ check_requirements() { RC=1 fi ONE_GIG_IN_1K_BLOCKS=1048576 - AVAIL=$(df --output=avail /dev/shm | tail -1) + AVAIL=$(df --output=avail $TMPDIR | tail -1) if [[ $AVAIL -lt $ONE_GIG_IN_1K_BLOCKS ]]; then - echo "ERROR: Please provide at least 1GB available space in /dev/shm" + echo "ERROR: Please provide at least 1GB available space in $TMPDIR" RC=1 fi if [[ "$RC" = "1" ]]; then @@ -439,7 +439,7 @@ declare -a PATCHES_BY_SUBMODULE_PATH IN_PATCH_SECTION=0 INDEX=$REPO_COUNT # "invalid" since zero based index of objects < one based count of objects while IFS= read -r line; do - if [[ "$line" = "# Patches applied in base project:" ]]; then + if [[ "$line" = "# Patches applied in base project, qemu-opensuse:" ]]; then IN_PATCH_SECTION=1 INDEX=0 # base project is 0 by definition continue @@ -466,7 +466,7 @@ while IFS= read -r line; do if [[ "$IN_PATCH_SECTION" = "0" ]]; then continue fi - if [[ "$line" =~ ^$ ]]; then + if [[ "$line" = "# Please, do not add patches manually here" ]]; then PATCHES_BY_SUBMODULE_PATH[$INDEX]=$ACCUMULATED_PATCHES break; fi @@ -476,6 +476,9 @@ while IFS= read -r line; do ACCUMULATED_PATCHES="$ACCUMULATED_PATCHES $PATCH" continue fi + if [[ "$line" =~ ^%if.*$ ]] || [[ "$line" =~ ^%endif$ ]]; then + continue + fi echo "ERROR: Failure groking spec file for patches!" exit done < $PKG.spec @@ -679,20 +682,29 @@ find $BUN_DIR -mindepth 1 -delete for package in $PKG; do while IFS= read -r line; do - if [ "$line" = "PATCH_FILES" ]; then + if [ "$line" = "PATCH_FILES_DO_NOT_TOUCH_THIS_LINE" ]; then # Here (and other places below) we try to get ONLY the numbered patches, but it's possible some ACTUAL patch name actually starts with multiple digits, but EXTREMELY unlikely # TODO: do this better! + echo "# This patch queue is auto-generated - see README.PACKAGING for process" + unset PREV_S for i in [0-9][0-9][0-9][0-9]*-*.patch; do NUM=${i%%-*} DIV=$((10#$NUM/$PATCH_RANGE)) REM=$((10#$NUM%$PATCH_RANGE)) if [[ "$REM" = "0" ]]; then if [[ "$DIV" = "0" ]]; then - echo "# Patches applied in base project:" + echo "# Patches applied in base project, qemu-opensuse:" else echo "# Patches applied in ${PATCH_PATH_MAP[$DIV]}:" fi fi + S=$(grep "^Include-If: " $i) || true + if [ "$PREV_S" != "" -a "$PREV_S" != "$S" ]; then + echo "%endif" + fi + if [ "$S" != "" -a "$S" != "$PREV_S" ]; then + echo "${S:12}" + fi if [[ "$FIVE_DIGIT_POTENTIAL" != "0" ]]; then if [[ "$NUMBERED_PATCHES" = "0" ]]; then PATCH_NUMBER=${i%%-*} @@ -708,8 +720,13 @@ find $BUN_DIR -mindepth 1 -delete echo -e "Patch$NUM: $i" fi fi + PREV_S=$S done - elif [ "$line" = "PATCH_EXEC" ]; then + if [ "$PREV_S" != "" ]; then + echo "%endif" + fi + echo "# Please, do not add patches manually here" + elif [ "$line" = "PATCH_EXEC_DO_NOT_TOUCH_THIS_LINE" ]; then unset PREV_S for i in [0-9][0-9][0-9][0-9]*-*.patch; do S=$(grep "^Include-If: " $i) || true @@ -726,7 +743,7 @@ find $BUN_DIR -mindepth 1 -delete if [ "$PREV_S" != "" ]; then echo "%endif" fi - elif [ "$line" = "INSERT_VERSIONING" ]; then + elif [ "$line" = "INSERT_VERSIONING_DO_NOT_TOUCH_THIS_LINE" ]; then echo "%define qemuver $QEMU_VERSION$VERSION_EXTRA" echo "%define srcver $SOURCE_VERSION$VERSION_EXTRA" # For SLE11, where seabios isn't in the qemu tarball: @@ -840,13 +857,13 @@ fi #============================================================================== # cleanup directories from any previous failed run: -rm -rf /dev/shm/qemu-???????-git-dir -rm -rf /dev/shm/qemu-???????-cmp-dir -rm -rf /dev/shm/qemu-???????-bun-dir +rm -rf ${TMPDIR}/qemu-???????-git-dir +rm -rf ${TMPDIR}/qemu-???????-cmp-dir +rm -rf ${TMPDIR}/qemu-???????-bun-dir # Temporary directories used in this script -GIT_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-git-dir) -CMP_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-cmp-dir) -BUN_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-bun-dir) +GIT_DIR=$(mktemp -d ${TMPDIR}/qemu-XXXXXXX-git-dir) +CMP_DIR=$(mktemp -d ${TMPDIR}/qemu-XXXXXXX-cmp-dir) +BUN_DIR=$(mktemp -d ${TMPDIR}/qemu-XXXXXXX-bun-dir) if [[ ! -e $(readlink -f ${LOCAL_REPO_MAP[0]}) ]]; then echo "No local repo found at ${LOCAL_REPO_MAP[0]}" diff --git a/usb-Help-compiler-out-to-avoid-a-warning.patch b/usb-Help-compiler-out-to-avoid-a-warning.patch index b2ce410c..1f65f560 100644 --- a/usb-Help-compiler-out-to-avoid-a-warning.patch +++ b/usb-Help-compiler-out-to-avoid-a-warning.patch @@ -2,6 +2,8 @@ From: Bruce Rogers Date: Thu, 3 Dec 2020 16:48:13 -0700 Subject: usb: Help compiler out to avoid a warning on x86 compilation +Git-commit: 0000000000000000000000000000000000000000 + Include-If: %ifarch %arm %ix86 ppc There is an assert present which already should give the compiler @@ -18,10 +20,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c -index e01700039b13d1404d3dc66eb3d3..395f0923f7633c03f2359d503fbd 100644 +index 0cd0a5e540272a4183176ce8426d..2af21f0af68da3cd9d10f0e41f84 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c -@@ -3310,7 +3310,7 @@ static void usb_xhci_init(XHCIState *xhci) +@@ -3314,7 +3314,7 @@ static void usb_xhci_init(XHCIState *xhci) USB_SPEED_MASK_FULL | USB_SPEED_MASK_HIGH; assert(i < XHCI_MAXPORTS); @@ -30,7 +32,7 @@ index e01700039b13d1404d3dc66eb3d3..395f0923f7633c03f2359d503fbd 100644 speedmask |= port->speedmask; } if (i < xhci->numports_3) { -@@ -3324,7 +3324,7 @@ static void usb_xhci_init(XHCIState *xhci) +@@ -3328,7 +3328,7 @@ static void usb_xhci_init(XHCIState *xhci) port->uport = &xhci->uports[i]; port->speedmask = USB_SPEED_MASK_SUPER; assert(i < XHCI_MAXPORTS); diff --git a/virtiofsd-Drop-membership-of-all-supplem.patch b/virtiofsd-Drop-membership-of-all-supplem.patch deleted file mode 100644 index c8727a59..00000000 --- a/virtiofsd-Drop-membership-of-all-supplem.patch +++ /dev/null @@ -1,101 +0,0 @@ -From: Vivek Goyal -Date: Tue, 25 Jan 2022 13:51:14 -0500 -Subject: virtiofsd: Drop membership of all supplementary groups - (CVE-2022-0358) - -Git-commit: 449e8171f96a6a944d1f3b7d3627ae059eae21ca -References: bsc#1195161 - -At the start, drop membership of all supplementary groups. This is -not required. - -If we have membership of "root" supplementary group and when we switch -uid/gid using setresuid/setsgid, we still retain membership of existing -supplemntary groups. And that can allow some operations which are not -normally allowed. - -For example, if root in guest creates a dir as follows. - -$ mkdir -m 03777 test_dir - -This sets SGID on dir as well as allows unprivileged users to write into -this dir. - -And now as unprivileged user open file as follows. - -$ su test -$ fd = open("test_dir/priviledge_id", O_RDWR|O_CREAT|O_EXCL, 02755); - -This will create SGID set executable in test_dir/. - -And that's a problem because now an unpriviliged user can execute it, -get egid=0 and get access to resources owned by "root" group. This is -privilege escalation. - -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2044863 -Fixes: CVE-2022-0358 -Reported-by: JIETAO XIAO -Suggested-by: Miklos Szeredi -Reviewed-by: Stefan Hajnoczi -Reviewed-by: Dr. David Alan Gilbert -Signed-off-by: Vivek Goyal -Message-Id: -Signed-off-by: Dr. David Alan Gilbert - dgilbert: Fixed missing {}'s style nit -Signed-off-by: Dario Faggioli ---- - tools/virtiofsd/passthrough_ll.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c -index 64b5b4fbb18670075eedd1f3d158..b3d0674f6d2f267664d1c4558856 100644 ---- a/tools/virtiofsd/passthrough_ll.c -+++ b/tools/virtiofsd/passthrough_ll.c -@@ -54,6 +54,7 @@ - #include - #include - #include -+#include - - #include "qemu/cutils.h" - #include "passthrough_helpers.h" -@@ -1161,6 +1162,30 @@ static void lo_lookup(fuse_req_t req, fuse_ino_t parent, const char *name) - #define OURSYS_setresuid SYS_setresuid - #endif - -+static void drop_supplementary_groups(void) -+{ -+ int ret; -+ -+ ret = getgroups(0, NULL); -+ if (ret == -1) { -+ fuse_log(FUSE_LOG_ERR, "getgroups() failed with error=%d:%s\n", -+ errno, strerror(errno)); -+ exit(1); -+ } -+ -+ if (!ret) { -+ return; -+ } -+ -+ /* Drop all supplementary groups. We should not need it */ -+ ret = setgroups(0, NULL); -+ if (ret == -1) { -+ fuse_log(FUSE_LOG_ERR, "setgroups() failed with error=%d:%s\n", -+ errno, strerror(errno)); -+ exit(1); -+ } -+} -+ - /* - * Change to uid/gid of caller so that file is created with - * ownership of caller. -@@ -3926,6 +3951,8 @@ int main(int argc, char *argv[]) - - qemu_init_exec_dir(argv[0]); - -+ drop_supplementary_groups(); -+ - pthread_mutex_init(&lo.mutex, NULL); - lo.inodes = g_hash_table_new(lo_key_hash, lo_key_equal); - lo.root.fd = -1; diff --git a/xen-ignore-live-parameter-from-xen-save-.patch b/xen-ignore-live-parameter-from-xen-save-.patch index 17ec39e0..a98bb876 100644 --- a/xen-ignore-live-parameter-from-xen-save-.patch +++ b/xen-ignore-live-parameter-from-xen-save-.patch @@ -27,10 +27,10 @@ Signed-off-by: Bruce Rogers 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c -index d59e976d50e7c81c20bbf5b930d1..7f7cedddb36dcc536fc242349882 100644 +index 02ed94c180661c99970aebfe16a0..52251cf0afd48f919ad705544bf2 100644 --- a/migration/savevm.c +++ b/migration/savevm.c -@@ -2942,7 +2942,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live, +@@ -2966,7 +2966,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live, * So call bdrv_inactivate_all (release locks) here to let the other * side of the migration take control of the images. */