From eeb65e691686b64d165d88a6587031097db6bfd5 Mon Sep 17 00:00:00 2001 From: Vladimir Ermakov Date: Fri, 2 Jul 2021 22:36:04 +0300 Subject: [PATCH] qemu: update to 6.1.0, add usb passthrough option One of big change is that QEMU has switched to Meson build system. That result in few changes to build scripts to fix python interpreter usage. Second change that it's not possible to select binaries to build, so now we have to build all targets at once (that require --enable-tools). Options --disable-sheepdog and --disable-vxhs was removed from qemu 6.1.0 and 6.0.0 accordingly. Signed-off-by: Vladimir Ermakov Signed-off-by: Tianling Shen --- utils/qemu/Makefile | 43 ++++++++----------- ...nfigure-allow-disable-fortify_source.patch | 6 +-- ...enabling-disabling-libudev-from-comm.patch | 6 +-- ...-guest_agent-no-matter-whether-softm.patch | 6 +-- ...lation-failure-when-isnan-is-a-macro.patch | 8 ++-- ...ilation-when-AS-is-actually-gcc-driv.patch | 26 ++++++----- ...util-mmap-alloc-fix-missing-MAP_SYNC.patch | 4 +- ...ate-applets-for-guest-shutdown-modes.patch | 10 ++--- 8 files changed, 45 insertions(+), 64 deletions(-) diff --git a/utils/qemu/Makefile b/utils/qemu/Makefile index 49e3e984fd..4bf863123b 100644 --- a/utils/qemu/Makefile +++ b/utils/qemu/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qemu -PKG_VERSION:=5.0.0 -PKG_RELEASE:=5 +PKG_VERSION:=6.1.0 +PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=2f13a92a0fa5c8b69ff0796b59b86b080bbb92ebad5d301a7724dd06b5e78cb6 +PKG_HASH:=eebc089db3414bbeedf1e464beda0a7515aad30f73261abc246c9b27503a3c96 PKG_SOURCE_URL:=http://download.qemu.org/ -PKG_LICENSE:=GPL-2.0 +PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=LICENSE tcg/LICENSE PKG_MAINTAINER:=Yousong Zhou PKG_CPE_ID:=cpe:/a:qemu:qemu @@ -23,7 +23,7 @@ PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 PKG_USE_MIPS16:=0 -PKG_BUILD_DEPENDS+=spice-protocol +PKG_BUILD_DEPENDS+=spice-protocol meson/host include $(INCLUDE_DIR)/nls.mk include $(INCLUDE_DIR)/package.mk @@ -98,7 +98,7 @@ endef define Package/qemu-img/install $(INSTALL_DIR) $(1)/usr/bin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/qemu-img $(1)/usr/bin/qemu-img + $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/qemu-img $(1)/usr/bin/qemu-img endef @@ -113,7 +113,7 @@ endef define Package/qemu-nbd/install $(INSTALL_DIR) $(1)/usr/sbin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/qemu-nbd $(1)/usr/sbin/qemu-nbd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/qemu-nbd $(1)/usr/sbin/qemu-nbd endef @@ -192,12 +192,13 @@ define qemu-target SUBMENU:=Virtualization TITLE:=QEMU target $(1) URL:=http://www.qemu.org - DEPENDS:= +glib2 +libpthread +zlib $(QEMU_DEPS_IN_HOST) $(qemu-target-$(1)-deps) \ + DEPENDS:= +glib2 +libpthread +zlib +libbpf $(QEMU_DEPS_IN_HOST) $(qemu-target-$(1)-deps) \ +QEMU_UI_VNC:qemu-keymaps \ +QEMU_UI_VNC_JPEG:libjpeg \ +QEMU_UI_VNC_PNG:libpng \ +QEMU_UI_VNC_SASL:libsasl2 \ +QEMU_UI_SPICE:libspice-server \ + +QEMU_DEV_USB:libusb-1.0 \ $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +pixman +qemu-firmware-efi $(ICONV_DEPENDS)) endef @@ -259,6 +260,9 @@ config QEMU_UI_VNC_SASL config QEMU_UI_SPICE bool "QEMU SPICE ui support" +config QEMU_DEV_USB + bool "QEMU USB passthrough support" + endif endef @@ -268,6 +272,7 @@ PKG_CONFIG_DEPENDS += \ CONFIG_QEMU_UI_VNC_PNG \ CONFIG_QEMU_UI_VNC_SASL \ CONFIG_QEMU_UI_SPICE \ + CONFIG_QEMU_DEV_USB \ # QEMU configure script does not recognize these options @@ -301,7 +306,9 @@ CONFIGURE_ARGS += \ --enable-vhost-scsi \ --enable-vhost-user \ --enable-vhost-user-fs \ + --enable-vhost-user-blk-server \ --enable-vhost-vsock \ + --enable-vhost-vdpa \ # Image formats support CONFIGURE_ARGS += \ @@ -353,6 +360,8 @@ CONFIGURE_ARGS += \ --enable-live-block-migration \ --enable-membarrier \ --enable-replication \ + --enable-lto \ + --enable-tools \ # Review configure options not explicitly specified here # @@ -377,7 +386,7 @@ CONFIGURE_ARGS += \ --disable-debug-tcg \ --disable-docs \ --disable-gcrypt \ - --disable-git-update \ + --with-git-submodules=ignore \ --disable-glusterfs \ --disable-gnutls \ --disable-guest-agent-msi \ @@ -387,7 +396,7 @@ CONFIGURE_ARGS += \ --disable-libpmem \ --disable-libssh \ --disable-libudev \ - --disable-libusb \ + --$(if $(CONFIG_QEMU_DEV_USB),enable,disable)-libusb \ --disable-libxml2 \ --disable-linux-aio \ --disable-linux-io-uring \ @@ -407,19 +416,16 @@ CONFIGURE_ARGS += \ --disable-rdma \ --disable-sanitizers \ --disable-seccomp \ - --disable-sheepdog \ --disable-smartcard \ --disable-snappy \ --disable-sparse \ --disable-strip \ --disable-tcg-interpreter \ --disable-tcmalloc \ - --disable-tools \ --disable-tpm \ --disable-usb-redir \ --disable-vde \ --disable-virtfs \ - --disable-vxhs \ --disable-werror \ --disable-xen-pci-passthrough \ --disable-xkbcommon \ @@ -437,17 +443,6 @@ MAKE_FLAGS:=$(filter-out \ ARCH=% \ ,$(MAKE_FLAGS)) -QEMU_MAKE_TARGETS := \ - $(if $(CONFIG_PACKAGE_qemu-ga),qemu-ga) \ - $(if $(CONFIG_PACKAGE_qemu-bridge-helper),qemu-bridge-helper) \ - $(if $(CONFIG_PACKAGE_qemu-img),qemu-img) \ - $(if $(CONFIG_PACKAGE_qemu-nbd),qemu-nbd) \ - $(foreach target,$(qemu-target-list),$(if $(CONFIG_PACKAGE_qemu-$(target)),$(target)/all)) \ - -define Build/Compile - $(if $(strip $(QEMU_MAKE_TARGETS)),$(call Build/Compile/Default,$(QEMU_MAKE_TARGETS))) -endef - $(eval $(call BuildPackage,virtio-console-helper)) $(eval $(call BuildPackage,qemu-ga)) $(eval $(call BuildPackage,qemu-bridge-helper)) diff --git a/utils/qemu/patches/0001-configure-allow-disable-fortify_source.patch b/utils/qemu/patches/0001-configure-allow-disable-fortify_source.patch index 4d11c4ab14..0cafa774b3 100644 --- a/utils/qemu/patches/0001-configure-allow-disable-fortify_source.patch +++ b/utils/qemu/patches/0001-configure-allow-disable-fortify_source.patch @@ -9,13 +9,11 @@ OpenWrt base build system decide flavor of fortify_source to use configure | 2 ++ 1 file changed, 2 insertions(+) -diff --git a/configure b/configure -index 23b5e93752..c8d2ac1c3e 100755 --- a/configure +++ b/configure -@@ -1601,6 +1601,8 @@ for opt do +@@ -1581,6 +1581,8 @@ for opt do ;; - --gdb=*) gdb_bin="$optarg" + --disable-slirp-smbd) slirp_smbd=no ;; + --disable-fortify-source) fortify_source="no" + ;; diff --git a/utils/qemu/patches/0002-configure-allow-enabling-disabling-libudev-from-comm.patch b/utils/qemu/patches/0002-configure-allow-enabling-disabling-libudev-from-comm.patch index 0af7763d49..3902b9e22c 100644 --- a/utils/qemu/patches/0002-configure-allow-enabling-disabling-libudev-from-comm.patch +++ b/utils/qemu/patches/0002-configure-allow-enabling-disabling-libudev-from-comm.patch @@ -7,13 +7,11 @@ Subject: [PATCH] configure: allow enabling/disabling libudev from command line configure | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/configure b/configure -index c8d2ac1c3e..cf3f8ffdd7 100755 --- a/configure +++ b/configure -@@ -1601,6 +1601,10 @@ for opt do +@@ -1581,6 +1581,10 @@ for opt do ;; - --gdb=*) gdb_bin="$optarg" + --disable-slirp-smbd) slirp_smbd=no ;; + --enable-libudev) libudev=yes + ;; diff --git a/utils/qemu/patches/0003-configure-enable-guest_agent-no-matter-whether-softm.patch b/utils/qemu/patches/0003-configure-enable-guest_agent-no-matter-whether-softm.patch index afeb2738b7..31d97df120 100644 --- a/utils/qemu/patches/0003-configure-enable-guest_agent-no-matter-whether-softm.patch +++ b/utils/qemu/patches/0003-configure-enable-guest_agent-no-matter-whether-softm.patch @@ -12,11 +12,9 @@ Fixes a512590 ("configure: qemu-ga is only needed with softmmu targets") configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/configure b/configure -index cf3f8ffdd7..b4af83a01f 100755 --- a/configure +++ b/configure -@@ -6414,7 +6414,7 @@ fi +@@ -4375,7 +4375,7 @@ fi # Probe for guest agent support/options if [ "$guest_agent" != "no" ]; then @@ -24,4 +22,4 @@ index cf3f8ffdd7..b4af83a01f 100755 + if [ "$guest_agent" = "" -a "$want_tools" = no ] ; then guest_agent=no elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then - tools="qemu-ga\$(EXESUF) $tools" + guest_agent=yes diff --git a/utils/qemu/patches/0004-disas-fix-compilation-failure-when-isnan-is-a-macro.patch b/utils/qemu/patches/0004-disas-fix-compilation-failure-when-isnan-is-a-macro.patch index 52c4b3b39c..df79e24172 100644 --- a/utils/qemu/patches/0004-disas-fix-compilation-failure-when-isnan-is-a-macro.patch +++ b/utils/qemu/patches/0004-disas-fix-compilation-failure-when-isnan-is-a-macro.patch @@ -7,11 +7,9 @@ Subject: [PATCH] disas: fix compilation failure when isnan is a macro disas/libvixl/vixl/utils.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -diff --git a/disas/libvixl/vixl/utils.h b/disas/libvixl/vixl/utils.h -index 5ab134e240..df30663df8 100644 --- a/disas/libvixl/vixl/utils.h +++ b/disas/libvixl/vixl/utils.h -@@ -118,11 +118,17 @@ double double_pack(uint64_t sign, uint64_t exp, uint64_t mantissa); +@@ -118,11 +118,17 @@ double double_pack(uint64_t sign, uint64 // An fpclassify() function for 16-bit half-precision floats. int float16classify(float16 value); @@ -30,7 +28,7 @@ index 5ab134e240..df30663df8 100644 return true; } return false; -@@ -132,7 +138,7 @@ inline bool IsSignallingNaN(double num) { +@@ -132,7 +138,7 @@ inline bool IsSignallingNaN(double num) inline bool IsSignallingNaN(float num) { const uint32_t kFP32QuietNaNMask = 0x00400000; uint32_t raw = float_to_rawbits(num); @@ -39,7 +37,7 @@ index 5ab134e240..df30663df8 100644 return true; } return false; -@@ -148,21 +154,21 @@ inline bool IsSignallingNaN(float16 num) { +@@ -148,21 +154,21 @@ inline bool IsSignallingNaN(float16 num) template inline bool IsQuietNaN(T num) { diff --git a/utils/qemu/patches/0005-pc-bios-fix-compilation-when-AS-is-actually-gcc-driv.patch b/utils/qemu/patches/0005-pc-bios-fix-compilation-when-AS-is-actually-gcc-driv.patch index 7785bd2d9e..f4746b69ba 100644 --- a/utils/qemu/patches/0005-pc-bios-fix-compilation-when-AS-is-actually-gcc-driv.patch +++ b/utils/qemu/patches/0005-pc-bios-fix-compilation-when-AS-is-actually-gcc-driv.patch @@ -7,25 +7,23 @@ Subject: [PATCH] pc-bios: fix compilation when $(AS) is actually gcc driver pc-bios/optionrom/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile -index e33a24da0d..ce734e8202 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile -@@ -34,7 +34,7 @@ endif - QEMU_INCLUDES += -I$(SRC_PATH) +@@ -36,7 +36,7 @@ override CFLAGS += -m32 -include $(SRC_D + endif Wa = -Wa, --ASFLAGS += -32 -+ASFLAGS += $(Wa)-32 - QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32) - - build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin -@@ -44,7 +44,7 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin +-override ASFLAGS += -32 ++override ASFLAGS += $(Wa)-32 + override CFLAGS += $(call cc-option, $(Wa)-32) + LD_I386_EMULATION ?= elf_i386 +@@ -47,7 +47,7 @@ all: multiboot.bin linuxboot.bin linuxbo + pvh.img: pvh.o pvh_main.o %.o: %.S -- $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@") -+ $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@ -x assembler -,"AS","$(TARGET_DIR)$@") +- $(call quiet-command,$(CPP) $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$@") ++ $(call quiet-command,$(CPP) $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@ -x assembler -,"AS","$@") - pvh.img: pvh.o pvh_main.o - $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@") + %.o: %.c + $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@") diff --git a/utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch b/utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch index 2cc566e1b3..e09447bd1e 100644 --- a/utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch +++ b/utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch @@ -20,8 +20,6 @@ Signed-off-by: Yousong Zhou util/mmap-alloc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c -index 27dcccd8ec..e133e38d21 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -12,9 +12,6 @@ @@ -34,7 +32,7 @@ index 27dcccd8ec..e133e38d21 100644 #endif /* CONFIG_LINUX */ #include "qemu/osdep.h" -@@ -27,6 +24,13 @@ +@@ -29,6 +26,13 @@ #include #endif diff --git a/utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch b/utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch index 1bcf720884..d51abc2d5b 100644 --- a/utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch +++ b/utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch @@ -11,11 +11,9 @@ https://gitlab.alpinelinux.org/alpine/aports/commit/76b81b486480fd9c3294cd420bcf qga/commands-posix.c | 5 +++++ 1 file changed, 5 insertions(+) -diff --git a/qga/commands-posix.c b/qga/commands-posix.c -index a52af0315f..623d856c64 100644 --- a/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) +@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) { const char *shutdown_flag; @@ -23,7 +21,7 @@ index a52af0315f..623d856c64 100644 Error *local_err = NULL; pid_t pid; int status; -@@ -91,10 +92,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) +@@ -91,10 +92,13 @@ void qmp_guest_shutdown(bool has_mode, c slog("guest-shutdown called, mode: %s", mode); if (!has_mode || strcmp(mode, "powerdown") == 0) { shutdown_flag = "-P"; @@ -37,10 +35,10 @@ index a52af0315f..623d856c64 100644 } else { error_setg(errp, "mode is invalid (valid values are: halt|powerdown|reboot"); -@@ -111,6 +115,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) +@@ -111,6 +115,7 @@ void qmp_guest_shutdown(bool has_mode, c execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", - "hypervisor initiated shutdown", (char*)NULL, environ); + "hypervisor initiated shutdown", (char *)NULL, environ); + execle(fallback_cmd, fallback_cmd, (char*)NULL, environ); _exit(EXIT_FAILURE); } else if (pid < 0) {