gnu: qemu: Update to 9.1.3.

* gnu/packages/virtualization.scm (qemu): Update to 9.1.3.
[source] <patches>: Add qemu-disable-migration-test.patch.
[arguments] <phases>: Adjust install-user-static phase.
[native-inputs]: Add python-tomli.
(qemu-patch): Delete procedure.
* gnu/packages/patches/qemu-disable-bios-tables-test.patch: Rebase.
* gnu/packages/patches/qemu-fix-agent-paths.patch: Likewise.
* gnu/packages/patches/qemu-disable-aarch64-migration-test.patch: Delete file.
* gnu/packages/patches/qemu-disable-migration-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.

Change-Id: I573070a297ffc9ca096c52e2fa18f839ad89a24e
This commit is contained in:
Maxim Cournoyer 2025-02-23 22:26:48 +09:00
parent 84a351b3de
commit 4a1ea5d0da
No known key found for this signature in database
GPG key ID: 1260E46482E63562
6 changed files with 134 additions and 91 deletions

View file

@ -2141,8 +2141,8 @@ dist_patch_DATA = \
%D%/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch \ %D%/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch \
%D%/packages/patches/qemu-7.2.4-build-info-manual.patch \ %D%/packages/patches/qemu-7.2.4-build-info-manual.patch \
%D%/packages/patches/qemu-build-info-manual.patch \ %D%/packages/patches/qemu-build-info-manual.patch \
%D%/packages/patches/qemu-disable-aarch64-migration-test.patch \
%D%/packages/patches/qemu-disable-bios-tables-test.patch \ %D%/packages/patches/qemu-disable-bios-tables-test.patch \
%D%/packages/patches/qemu-disable-migration-test.patch \
%D%/packages/patches/qemu-glibc-2.27.patch \ %D%/packages/patches/qemu-glibc-2.27.patch \
%D%/packages/patches/qemu-glibc-2.30.patch \ %D%/packages/patches/qemu-glibc-2.30.patch \
%D%/packages/patches/qemu-fix-agent-paths.patch \ %D%/packages/patches/qemu-fix-agent-paths.patch \

View file

@ -1,13 +0,0 @@
Disable the qtest-aarch64/migration-test, which sometimes fail non-deterministically.
See: https://gitlab.com/qemu-project/qemu/-/issues/1230.
--- qemu-7.1.0/tests/qtest/meson.build.old 1969-12-31 19:00:01.000000000 -0500
+++ qemu-7.1.0/tests/qtest/meson.build 2022-09-26 11:11:05.434209797 -0400
@@ -219,7 +219,6 @@
['arm-cpu-features',
'numa-test',
'boot-serial-test',
- 'migration-test',
'bcm2835-dma-test']
qtests_s390x = \

View file

@ -1,18 +1,17 @@
The bios-tables-test may fail; disable it (see: https://gitlab.com/qemu-project/qemu/-/issues/1098) The bios-tables-test may fail; disable it (see: https://gitlab.com/qemu-project/qemu/-/issues/1098)
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index f096cf3ecd..82f6e1ffeb 100644 index 2f0d3ef080..e3c33a86b5 100644
--- a/tests/qtest/meson.build --- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build +++ b/tests/qtest/meson.build
@@ -1,7 +1,6 @@ @@ -1,6 +1,5 @@
slow_qtests = { slow_qtests = {
'ahci-test' : 60,
'aspeed_smc-test': 360, 'aspeed_smc-test': 360,
- 'bios-tables-test' : 120, - 'bios-tables-test' : 910,
'boot-serial-test' : 60, 'cdrom-test' : 610,
'migration-test' : 150, 'device-introspect-test' : 720,
'npcm7xx_pwm-test': 150, 'migration-test' : 480,
@@ -82,9 +81,6 @@ qtests_i386 = \ @@ -86,9 +85,6 @@ qtests_i386 = \
config_all_devices.has_key('CONFIG_Q35') and \ config_all_devices.has_key('CONFIG_Q35') and \
config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \ config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \
slirp.found() ? ['virtio-net-failover'] : []) + \ slirp.found() ? ['virtio-net-failover'] : []) + \
@ -22,15 +21,25 @@ index f096cf3ecd..82f6e1ffeb 100644
qtests_pci + \ qtests_pci + \
qtests_cxl + \ qtests_cxl + \
['fdc-test', ['fdc-test',
@@ -213,7 +209,6 @@ qtests_arm = \ @@ -235,7 +231,6 @@ qtests_arm = \
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
qtests_aarch64 = \ qtests_aarch64 = \
- (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \ - (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
(config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \ (config_all_accel.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
(config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
@@ -304,7 +299,6 @@ if gnutls.found() @@ -260,9 +255,6 @@ qtests_s390x = \
qtests_riscv32 = \
(config_all_devices.has_key('CONFIG_SIFIVE_E_AON') ? ['sifive-e-aon-watchdog-test'] : [])
-qtests_riscv64 = \
- (unpack_edk2_blobs ? ['bios-tables-test'] : [])
-
qos_test_ss = ss.source_set()
qos_test_ss.add(
'ac97-test.c',
@@ -328,7 +320,6 @@ if gnutls.found()
endif endif
qtests = { qtests = {

View file

@ -0,0 +1,57 @@
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index e3c33a86b5..a3bbf9c841 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -2,7 +2,6 @@ slow_qtests = {
'aspeed_smc-test': 360,
'cdrom-test' : 610,
'device-introspect-test' : 720,
- 'migration-test' : 480,
'npcm7xx_pwm-test': 300,
'npcm7xx_watchdog_timer-test': 120,
'qom-test' : 900,
@@ -100,7 +99,6 @@ qtests_i386 = \
'cpu-plug-test',
'q35-test',
'vmgenid-test',
- 'migration-test',
'test-x86-cpuid-compat',
'numa-test'
]
@@ -173,7 +171,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 + ['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'] : [])
@@ -240,8 +238,7 @@ qtests_aarch64 = \
config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
['arm-cpu-features',
'numa-test',
- 'boot-serial-test',
- 'migration-test']
+ 'boot-serial-test']
qtests_s390x = \
qtests_filter + \
@@ -249,8 +246,7 @@ qtests_s390x = \
'drive_del-test',
'device-plug-test',
'virtio-ccw-test',
- 'cpu-plug-test',
- 'migration-test']
+ 'cpu-plug-test']
qtests_riscv32 = \
(config_all_devices.has_key('CONFIG_SIFIVE_E_AON') ? ['sifive-e-aon-watchdog-test'] : [])
@@ -324,7 +320,6 @@ qtests = {
'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1,
'erst-test': files('erst-test.c'),
'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
- 'migration-test': migration_files,
'pxe-test': files('boot-sector.c'),
'qos-test': [chardev, io, qos_test_ss.apply({}).sources()],
'tpm-crb-swtpm-test': [io, tpmemu_files],

View file

@ -4,19 +4,20 @@ after the patch from the Nix package:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
diff --git a/qga/commands-posix.c b/qga/commands-posix.c diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 6e3c15f539..eaef900b6e 100644
--- a/qga/commands-posix.c --- a/qga/commands-posix.c
+++ b/qga/commands-posix.c +++ b/qga/commands-posix.c
@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp) @@ -216,6 +216,7 @@ out:
void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) void qmp_guest_shutdown(const char *mode, Error **errp)
{ {
const char *shutdown_flag; const char *shutdown_flag;
+ const char *command; + const char *command;
Error *local_err = NULL; Error *local_err = NULL;
pid_t pid;
int status; #ifdef CONFIG_SOLARIS
@@ -101,10 +102,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) @@ -235,16 +236,24 @@ void qmp_guest_shutdown(const char *mode, Error **errp)
slog("guest-shutdown called, mode: %s", mode); slog("guest-shutdown called, mode: %s", mode);
if (!has_mode || strcmp(mode, "powerdown") == 0) { if (!mode || strcmp(mode, "powerdown") == 0) {
shutdown_flag = powerdown_flag; shutdown_flag = powerdown_flag;
+ command = "shutdown"; + command = "shutdown";
} else if (strcmp(mode, "halt") == 0) { } else if (strcmp(mode, "halt") == 0) {
@ -28,38 +29,35 @@ diff --git a/qga/commands-posix.c b/qga/commands-posix.c
} else { } else {
error_setg(errp, error_setg(errp,
"mode is invalid (valid values are: halt|powerdown|reboot"); "mode is invalid (valid values are: halt|powerdown|reboot");
@@ -123,6 +127,11 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) return;
execl("/sbin/shutdown", "shutdown", shutdown_flag, "-g0", "-y",
"hypervisor initiated shutdown", (char *)NULL);
#else
+ /* try Guixs shutdown/halt/reboot first */
+ char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command);
+ execl(path, command, (char *)NULL);
+ g_free(path);
+
execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
"hypervisor initiated shutdown", (char *)NULL);
#endif
@@ -159,10 +168,12 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
Error *local_err = NULL;
struct timeval tv;
static const char hwclock_path[] = "/sbin/hwclock";
+ static const char hwclock_path_guix[] = "/run/current-system/profile/sbin/hwclock";
static int hwclock_available = -1;
if (hwclock_available < 0) {
- hwclock_available = (access(hwclock_path, X_OK) == 0);
+ hwclock_available = (access(hwclock_path_guix, X_OK) == 0) ||
+ (access(hwclock_path, X_OK) == 0);
} }
if (!hwclock_available) { + /* Try Guixs shutdown/halt/reboot first. */
@@ -208,6 +219,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) + char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command);
+ execl(path, command, (char *) NULL);
+ g_free(path);
+
const char *argv[] = {"/sbin/shutdown",
#ifdef CONFIG_SOLARIS
shutdown_flag, "-g0", "-y",
@@ -269,7 +278,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
int ret;
Error *local_err = NULL;
struct timeval tv;
- const char *argv[] = {"/sbin/hwclock", has_time ? "-w" : "-s", NULL};
+ const char *argv[] = {"/run/current-system/profile/sbin/hwclock", has_time ? "-w" : "-s", NULL};
/* Use '/sbin/hwclock -w' to set RTC from the system time, /* If user has passed a time, validate and set it. */
* or '/sbin/hwclock -s' to set the system time from RTC. */ if (has_time) {
+ execl(hwclock_path_guix, "hwclock", has_time ? "-w" : "-s", @@ -302,6 +311,11 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
+ NULL); * hardware clock (RTC). */
execl(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL); ga_run_command(argv, NULL, "set hardware clock to system time",
_exit(EXIT_FAILURE); &local_err);
} else if (pid < 0) { + if (local_err) {
+ argv[0] = "/sbin/hwclock";
+ ga_run_command(argv, NULL, "set hardware clock to system time",
+ &local_err);
+ }
if (local_err) {
error_propagate(errp, local_err);
return;

View file

@ -15,7 +15,7 @@
;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org> ;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2020-2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Brett Gilio <brettg@gnu.org> ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2021 Leo Famulari <leo@famulari.name> ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
;;; Copyright © 2021, 2022 Pierre Langlois <pierre.langlois@gmx.com> ;;; Copyright © 2021, 2022 Pierre Langlois <pierre.langlois@gmx.com>
@ -183,29 +183,20 @@
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (ice-9 match)) #:use-module (ice-9 match))
(define (qemu-patch commit file-name sha256-bv)
"Return an origin for COMMIT."
(origin
(method url-fetch)
(uri (string-append
"http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
commit))
(hash (content-hash sha256-bv sha256))
(file-name file-name)))
(define-public qemu (define-public qemu
(package (package
(name "qemu") (name "qemu")
(version "8.2.2") (version "9.1.3")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (string-append "https://download.qemu.org/qemu-" (uri (string-append "https://download.qemu.org/qemu-"
version ".tar.xz")) version ".tar.xz"))
(sha256 (sha256
(base32 "1wy45fbf4816l4ylsz8b8cbypva9apcdnvlgqfr586icp30lcww4")) (base32 "12dc3fpv6c6qvw89amjjbb6dgc2f1c1alfgn2nab7a8kxnh7f2j8"))
(patches (search-patches "qemu-build-info-manual.patch" (patches (search-patches "qemu-build-info-manual.patch"
"qemu-disable-bios-tables-test.patch" "qemu-disable-bios-tables-test.patch"
"qemu-disable-migration-test.patch"
"qemu-fix-agent-paths.patch")) "qemu-fix-agent-paths.patch"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
@ -437,8 +428,7 @@
;; Configure, build and install QEMU user-emulation static binaries. ;; Configure, build and install QEMU user-emulation static binaries.
(add-after 'configure 'configure-user-static (add-after 'configure 'configure-user-static
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((static (assoc-ref outputs "static")) (let* ((gcc (search-input-file inputs "/bin/gcc"))
(gcc (search-input-file inputs "/bin/gcc"))
;; This is the common set of configure flags; it is ;; This is the common set of configure flags; it is
;; duplicated here to isolate this phase from manipulations ;; duplicated here to isolate this phase from manipulations
;; to the #:configure-flags build argument, as done in ;; to the #:configure-flags build argument, as done in
@ -446,7 +436,8 @@
(configure-flags (list (string-append "--cc=" gcc) (configure-flags (list (string-append "--cc=" gcc)
(string-append "--host-cc=" gcc) (string-append "--host-cc=" gcc)
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--disable-debug-info"))) "--disable-debug-info"))
(static (assoc-ref outputs "static")))
(mkdir-p "../user-static") (mkdir-p "../user-static")
(with-directory-excursion "../user-static" (with-directory-excursion "../user-static"
(apply invoke "../../configure" (apply invoke "../../configure"
@ -462,15 +453,18 @@
(apply (assoc-ref %standard-phases 'build) args)))) (apply (assoc-ref %standard-phases 'build) args))))
(add-after 'install 'install-user-static (add-after 'install 'install-user-static
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((static (assoc-ref outputs "static")) (let ((static-bin (string-append
(bin (string-append static "/bin"))) (assoc-ref outputs "static") ;see bug#70611
"/bin")))
(with-directory-excursion "../user-static" (with-directory-excursion "../user-static"
(for-each (cut install-file <> bin) (for-each
(append-map (cut find-files <> "^qemu-" #:stat stat) (cut install-file <> static-bin)
(scandir "." (find-files "."
(cut string-suffix? (lambda (name stat)
"-linux-user" <>)))))))) ;; Select 'qemu-' prefixed executables.
(and (string-prefix? "./qemu-" name)
(eq? 'regular (stat:type stat))
(logtest #o100 (stat:perms stat))))))))))
(add-before 'check 'set-SOCK_DIR (add-before 'check 'set-SOCK_DIR
(lambda _ (lambda _
;; The default value for SOCK_DIR is TMPDIR, which can be long ;; The default value for SOCK_DIR is TMPDIR, which can be long
@ -506,7 +500,7 @@ exec smbd $@")))
(add-after 'install 'move-html-doc (add-after 'install 'move-html-doc
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out #$output) (let* ((out #$output)
(doc #$output:doc) (doc (assoc-ref outputs "doc")) ;see bug#70611
(qemu-doc (string-append doc "/share/doc/qemu-" (qemu-doc (string-append doc "/share/doc/qemu-"
#$(package-version this-package)))) #$(package-version this-package))))
(mkdir-p qemu-doc) (mkdir-p qemu-doc)
@ -538,7 +532,6 @@ exec smbd $@")))
ncurses ncurses
openbios-qemu-ppc openbios-qemu-ppc
opensbi-qemu opensbi-qemu
;; pciutils
pixman pixman
pulseaudio pulseaudio
sdl2 sdl2
@ -548,8 +541,6 @@ exec smbd $@")))
util-linux util-linux
vde2 vde2
virglrenderer virglrenderer
;; Formats to support for .qcow2 (and possibly other) compression.
zlib zlib
`(,zstd "lib")))) `(,zstd "lib"))))
(native-inputs (native-inputs
@ -567,6 +558,7 @@ exec smbd $@")))
python-wrapper python-wrapper
python-sphinx python-sphinx
python-sphinx-rtd-theme python-sphinx-rtd-theme
python-tomli
texinfo texinfo
;; The following static libraries are required to build ;; The following static libraries are required to build
;; the static output of QEMU. ;; the static output of QEMU.