diff --git a/debian_iso_image.inc b/debian_iso_image.inc index 8ee81c001..ded3f033b 100644 --- a/debian_iso_image.inc +++ b/debian_iso_image.inc @@ -10,3 +10,8 @@ trident-installer iputils-arping iputils-ping iputils-tracepath +qemu-block-extra +qemu-guest-agent +qemu-system-common +qemu-system-data +qemu-system-x86 diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 4bcfaa7c3..0bf15a1ab 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -94,3 +94,4 @@ security/shim-unsigned security/openscap storage-drivers/trident-installer tools/kdump-tools +virt/qemu diff --git a/virt/qemu/debian/deb_patches/0001-Customize-Debian-build-files-for-STX.patch b/virt/qemu/debian/deb_patches/0001-Customize-Debian-build-files-for-STX.patch new file mode 100644 index 000000000..188b2ebd1 --- /dev/null +++ b/virt/qemu/debian/deb_patches/0001-Customize-Debian-build-files-for-STX.patch @@ -0,0 +1,419 @@ +From 33716964e8381628d575160b6a015a3f8ba68640 Mon Sep 17 00:00:00 2001 +From: Thales Elero Cervi +Date: Fri, 18 Nov 2022 16:59:35 -0300 +Subject: [PATCH] Customize Debian build files for STX + +Change the Debian build files to generate qemu Debian packages as +they are needed for StarlingX qemu use case. +Building the upstream qemu was taking ~30 minutes and generating +an output directory with 30 packages and ~1.1G in size. Removing +the unnecessary packages resulted in a build that takes ~15min and +in an output directory with only 10 needed packages and ~320M. + +We mainly remove UI/Graphical modules and focus on building +qemu-system-x86 only. We do not need other qemu-system-* packages +for different architectures neither the build dependencies for +cross-compiling those packages. + +Removed packages: +* qemu-system-gui +* qemu-system-[misc|arm|mips|ppc|sparc] +* qemu-user +* qemu-user-static +* qemu-user-binftmt + +Signed-off-by: Thales Elero Cervi +--- + debian/control | 215 +++---------------------------------------------- + debian/rules | 80 +----------------- + 2 files changed, 14 insertions(+), 281 deletions(-) + +diff --git a/debian/control b/debian/control +index 6534765..7cc0fb4 100644 +--- a/debian/control ++++ b/debian/control +@@ -21,14 +21,10 @@ Build-Depends: debhelper-compat (= 12), + libcapstone-dev (>> 4.0.2~), + # --enable-linux-aio linux-* + libaio-dev [linux-any], +-# --audio-drv-list=pa,alsa,oss linux-* +-# --audio-drv-list=pa,oss kfreebsd-* +- libpulse-dev, +- libasound2-dev [linux-any], + # for virtfs (now in libc6) + # --enable-attr +-# --enable-brlapi +- libbrlapi-dev, ++# --disable-brlapi ++# libbrlapi-dev, + # --enable-virtfs linux-* + # needed for virtfs + # --enable-cap-ng linux-* +@@ -85,8 +81,8 @@ Build-Depends: debhelper-compat (= 12), + # vde is debian-only since ubuntu/vde2 is in universe + # --enable-vde + libvdeplug-dev, +-# --enable-xen linux-amd64|linux-i386 +- libxen-dev [linux-amd64 linux-i386], ++# --disable-xen linux-amd64|linux-i386 ++# libxen-dev [linux-amd64 linux-i386], + # --enable-nettle + nettle-dev, + ## always enabled: --enable-uuid +@@ -114,18 +110,18 @@ Build-Depends: debhelper-compat (= 12), + ## auth-pam - for auth for vnc&Co using PAM + ## gio-2.0 - for -display=spice-app + Build-Depends-Indep: +- gcc-s390x-linux-gnu, ++# gcc-s390x-linux-gnu, + # libc6.1-dev-alpha-cross isn't really needed but the code, + # for whatever reason, #include's string.h which needs libc6.1-dev + gcc-alpha-linux-gnu, libc6.1-dev-alpha-cross, + # skiboot firmware, openbios +- gcc-powerpc64-linux-gnu, ++# gcc-powerpc64-linux-gnu, + # openbios +- gcc-sparc64-linux-gnu, fcode-utils, xsltproc, ++# gcc-sparc64-linux-gnu, fcode-utils, xsltproc, + # hppa-firmware +- gcc-hppa-linux-gnu, ++# gcc-hppa-linux-gnu, + # opensbi +- gcc-riscv64-linux-gnu, ++# gcc-riscv64-linux-gnu, + Build-Conflicts: oss4-dev + Standards-Version: 4.5.1 + Homepage: http://www.qemu.org/ +@@ -218,141 +214,12 @@ Description: QEMU full system emulation binaries (common files) + This package provides common files needed for target-specific + full system emulation (qemu-system-*) packages. + +-Package: qemu-system-gui +-Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: same +-Depends: ${misc:Depends}, ${shlibs:Depends}, +- qemu-system-x86 (= ${binary:Version}) | qemu-system-arm (= ${binary:Version}) | qemu-system-mips (= ${binary:Version}) | qemu-system-ppc (= ${binary:Version}) | qemu-system-sparc (= ${binary:Version}) | qemu-system-misc (= ${binary:Version}) | qemu-system-s390x (= ${binary:Version}) | qemu-system-x86-xen (= ${binary:Version}), +-Description: QEMU full system emulation binaries (user interface and audio support) +- This package provides local graphical user interface (currently GTK) +- and audio backends for full system emulation (qemu-system-*) packages. +- +-Package: qemu-system-misc +-Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${shlibs:Depends}, ${misc:Depends}, qemu-system-common (>> ${source:Version}~), qemu-system-data (>> ${source:Version}~), +-Recommends: qemu-system-gui (= ${binary:Version}), qemu-utils, +-# alpha uses vgabios +-# alpha m68k sh4 uses bootroms +- seabios, ipxe-qemu (>= 1.0.0+git-20131111.c3d1e78-1~) +-Suggests: samba, vde2, qemu-block-extra (= ${binary:Version}), +-Provides: ${sysprovides:misc} +-Description: QEMU full system emulation binaries (miscellaneous) +- QEMU is a fast processor emulator: currently the package supports +- ARM, CRIS, M68k (ColdFire), MicroBlaze, and SH4 +- emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the full system emulation binaries to emulate +- various other hardware which did not made into separate packages. +- Emulators for the following architectures are provided: +- ${sysarch:misc}. +- . +- In system emulation mode QEMU emulates a full system, including a processor +- and various peripherals. It enables easier testing and debugging of system +- code. It can also be used to provide virtual hosting of several virtual +- machines on a single server. +- +-Package: qemu-system-arm +-Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${shlibs:Depends}, ${misc:Depends}, qemu-system-common (>> ${source:Version}~), qemu-system-data (>> ${source:Version}~), +-Recommends: qemu-system-gui (= ${binary:Version}), qemu-utils, +-# aarch64 arm uses bootroms +- ipxe-qemu (>= 1.0.0+git-20131111.c3d1e78-1~), +- qemu-efi-aarch64, qemu-efi-arm +-Suggests: samba, vde2, qemu-block-extra (= ${binary:Version}), +-Provides: qemu-kvm [linux-arm64 linux-armhf linux-armel], ${sysprovides:arm} +-Breaks: qemu-kvm [linux-arm64 linux-armhf linux-armel] +-Replaces: qemu-kvm [linux-arm64 linux-armhf linux-armel] +-Description: QEMU full system emulation binaries (arm) +- QEMU is a fast processor emulator: currently the package supports +- ARM emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the full system emulation binaries to emulate +- the following arm hardware: ${sysarch:arm}. +- . +- In system emulation mode QEMU emulates a full system, including a processor +- and various peripherals. It enables easier testing and debugging of system +- code. It can also be used to provide virtual hosting of several virtual +- machines on a single server. +- +-Package: qemu-system-mips +-Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${shlibs:Depends}, ${misc:Depends}, qemu-system-common (>> ${source:Version}~), qemu-system-data (>> ${source:Version}~), +-Recommends: qemu-system-gui (= ${binary:Version}), qemu-utils, +-# all mips targets uses vgabios and bootroms +- seabios, ipxe-qemu (>= 1.0.0+git-20131111.c3d1e78-1~) +-Suggests: samba, vde2, qemu-block-extra (= ${binary:Version}), +-Provides: ${sysprovides:mips} +-Description: QEMU full system emulation binaries (mips) +- QEMU is a fast processor emulator: currently the package supports +- MIPS emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the full system emulation binaries to emulate +- the following mips hardware: ${sysarch:mips}. +- . +- In system emulation mode QEMU emulates a full system, including a processor +- and various peripherals. It enables easier testing and debugging of system +- code. It can also be used to provide virtual hosting of several virtual +- machines on a single server. +- +-Package: qemu-system-ppc +-Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${shlibs:Depends}, ${misc:Depends}, qemu-system-common (>> ${source:Version}~), qemu-system-data (>> ${source:Version}~), +-Suggests: samba, vde2, qemu-block-extra (= ${binary:Version}), +-Recommends: qemu-system-gui (= ${binary:Version}), qemu-utils, +-# ppc targets use vgabios-stdvga and bootroms +- seabios, ipxe-qemu (>= 1.0.0+git-20131111.c3d1e78-1~) +-Provides: qemu-kvm [linux-ppc64 linux-ppc64el linux-powerpc], ${sysprovides:ppc} +-Breaks: qemu-kvm [linux-ppc64 linux-ppc64el linux-powerpc] +-Replaces: qemu-kvm [linux-ppc64 linux-ppc64el linux-powerpc] +-Description: QEMU full system emulation binaries (ppc) +- QEMU is a fast processor emulator: currently the package supports +- PowerPC emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the full system emulation binaries to emulate +- the following PowerPC hardware: ${sysarch:ppc}. +- . +- In system emulation mode QEMU emulates a full system, including a processor +- and various peripherals. It enables easier testing and debugging of system +- code. It can also be used to provide virtual hosting of several virtual +- machines on a single server. +- +-Package: qemu-system-sparc +-Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${shlibs:Depends}, ${misc:Depends}, qemu-system-common (>> ${source:Version}~), qemu-system-data (>> ${source:Version}~), +-Recommends: qemu-system-gui (= ${binary:Version}), qemu-utils, +-# sparc64 uses vgabios-stdvga and bootroms +- seabios, ipxe-qemu (>= 1.0.0+git-20131111.c3d1e78-1~) +-Suggests: samba, vde2, qemu-block-extra (= ${binary:Version}), +-Provides: ${sysprovides:sparc} +-Description: QEMU full system emulation binaries (sparc) +- QEMU is a fast processor emulator: currently the package supports +- SPARC emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the full system emulation binaries to emulate +- the following sparc hardware: ${sysarch:sparc}. +- . +- In system emulation mode QEMU emulates a full system, including a processor +- and various peripherals. It enables easier testing and debugging of system +- code. It can also be used to provide virtual hosting of several virtual +- machines on a single server. +- + Package: qemu-system-x86 + Architecture: amd64 arm arm64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 + Multi-Arch: foreign + Depends: ${shlibs:Depends}, ${misc:Depends}, qemu-system-common (>> ${source:Version}~), qemu-system-data (>> ${source:Version}~), + seabios (>= 1.10.2-1~), ipxe-qemu (>= 1.0.0+git-20131111.c3d1e78-1~) +-Recommends: qemu-system-gui (= ${binary:Version}), qemu-utils, +- ovmf, ++Recommends: qemu-utils, ovmf + Suggests: samba, vde2, qemu-block-extra (= ${binary:Version}), + sgabios, + Provides: qemu-kvm [linux-amd64 linux-i386], ${sysprovides:x86} +@@ -374,68 +241,6 @@ Description: QEMU full system emulation binaries (x86) + On x86 host hardware this package also enables KVM kernel virtual machine + usage on systems which supports it. + +-Package: qemu-user +-Architecture: amd64 arm arm64 armel armhf i386 ia64 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${shlibs:Depends}, ${misc:Depends} +-Recommends: qemu-user-binfmt +-Description: QEMU user mode emulation binaries +- QEMU is a fast processor emulator: currently the package supports +- ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4, +- SPARC and x86-64 emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the user mode emulation binaries. In this mode +- QEMU can launch Linux processes compiled for one CPU on another CPU. +- . +- If qemu-user-binfmt package is also installed, it will register binary +- format handlers from this qemu-user package with the kernel so it will +- be possible to run foreign binaries directly. However, this might not +- be suitable for using inside foreign chroots, in which case it is +- possible to use qemu-user-static package instead of qemu-user-binmft, -- +- qemu-user-static will register statically linked binfmt handlers instead. +- +-Package: qemu-user-static +-Architecture: amd64 arm arm64 armel armhf i386 ia64 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Built-Using: ${built-using} +-Multi-Arch: foreign +-Depends: ${misc:Depends} +-Recommends: binfmt-support +-Breaks: binfmt-support (<< 2.1.7~) +-Provides: qemu-user-binfmt +-Conflicts: qemu-user-binfmt +-Suggests: sudo +-Description: QEMU user mode emulation binaries (static version) +- QEMU is a fast processor emulator: currently the package supports +- ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4, +- SPARC and x86-64 emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides the user mode emulation binaries, built +- statically. In this mode QEMU can launch Linux processes compiled for +- one CPU on another CPU. +- . +- qemu-user-static package will register binary formats which the provided +- emulators can handle, so that it will be possible to run foreign binaries +- directly. +- +-Package: qemu-user-binfmt +-Architecture: amd64 arm arm64 armel armhf i386 ia64 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 +-Multi-Arch: foreign +-Depends: ${misc:Depends}, qemu-user (= ${binary:Version}), binfmt-support +-Breaks: binfmt-support (<< 2.1.7~) +-Conflicts: qemu-user-static +-Description: QEMU user mode binfmt registration for qemu-user +- QEMU is a fast processor emulator: currently the package supports +- ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4, +- SPARC and x86-64 emulation. By using dynamic translation it achieves +- reasonable speed while being easy to port on new host CPUs. +- . +- This package provides binfmt support registration for the user mode +- emulation binaries from qemu-user. This is an empty package, it does +- not contain any additional files, only registration scripts which run +- at install and remove times. +- + Package: qemu-utils + Architecture: amd64 arm arm64 armel armhf hppa i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el riscv64 s390x sparc sparc64 x32 + Multi-Arch: foreign +diff --git a/debian/rules b/debian/rules +index 9d9f18f..d6778c3 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -72,14 +72,11 @@ endif + ifeq (${enable_system},enable) + + # list of system (softmmu) targets, from ./configure +-system_targets = \ +- i386 x86_64 alpha aarch64 arm avr cris hppa m68k microblaze microblazeel \ +- mips mipsel mips64 mips64el moxie nios2 or1k ppc ppc64 riscv32 riscv64 rx \ +- sh4 sh4eb sparc sparc64 s390x tricore xtensa xtensaeb ++system_targets = i386 x86_64 + + # qemu-system subpackages, from d/control + sys_systems = arm mips ppc sparc x86 $(if $(filter ${VENDOR},UBUNTU),s390x,) +-systems = ${sys_systems} misc ++systems = x86 + sysarch_arm = $(filter aarch64 arm,${system_targets}) + sysarch_mips = $(filter mips mipsel mips64 mips64el,${system_targets}) + sysarch_ppc = $(filter ppc ppc64,${system_targets}) +@@ -348,9 +345,11 @@ endif # enable_linux_user + + dh_install -a + dh_missing --list-missing ++ifeq ($(enable_linux_user),enable) + dh_installdocs -a -Nqemu-user-binfmt + dh_installchangelogs -a -Nqemu-user-binfmt -XChangelog + dh_installdocs -a -pqemu-user-binfmt --link-doc=qemu-user ++endif + dh_installman -a + dh_installudev -a + ifeq (${enable_system},enable) +@@ -393,35 +392,6 @@ debian/control: debian/control-in debian/rules + chmod -w $@ + endif + +-### openbios rules +-b/openbios/config-host.mak: +- mkdir -p b/openbios +- cd b/openbios && ../../roms/openbios/config/scripts/switch-arch builtin-ppc builtin-sparc32 builtin-sparc64 +-build-openbios: $(addprefix b/openbios/obj-, $(addsuffix /.built, ppc sparc32 sparc64)) +-b/openbios/obj-%/.built: b/openbios/config-host.mak +- ${MAKE} -C ${@D} V=${V} EXTRACFLAGS="-ffreestanding -fno-pic -fno-stack-protector" +- @touch $@ +-install-openbios: build-openbios +- install -m 0644 b/openbios/obj-ppc/openbios-qemu.elf "${sysdatadir}/openbios-ppc" +- install -m 0644 b/openbios/obj-sparc32/openbios-builtin.elf "${sysdatadir}/openbios-sparc32" +- install -m 0644 b/openbios/obj-sparc64/openbios-builtin.elf "${sysdatadir}/openbios-sparc64" +- install -m 0644 -t "${sysdatadir}" \ +- b/openbios/obj-sparc32/QEMU,tcx.bin \ +- b/openbios/obj-sparc32/QEMU,cgthree.bin \ +- b/openbios/obj-sparc64/QEMU,VGA.bin +-sysdata-components += openbios +- +-### powernv firmware in roms/skiboot +-build-skiboot: b/skiboot/skiboot.lid +-b/skiboot/skiboot.lid: +- mkdir -p b/skiboot +- ${MAKE} -C b/skiboot -f ${CURDIR}/roms/skiboot/Makefile \ +- SRC=${CURDIR}/roms/skiboot \ +- CROSS_COMPILE=${PPC64_CROSSPFX} V=${V} +-install-skiboot: b/skiboot/skiboot.lid +- install -m 0644 -t "${sysdatadir}" $< +-sysdata-components += skiboot +- + ### x86 optionrom + build-x86-optionrom: b/optionrom/built + b/optionrom/built: +@@ -471,48 +441,6 @@ install-palcode-clipper: b/qemu-palcode/palcode-clipper + install -m 0644 $< ${sysdatadir}/palcode-clipper + sysdata-components += palcode-clipper + +-### SLOF +-build-slof: b/SLOF/boot_rom.bin +-b/SLOF/boot_rom.bin: +- cp -al roms/SLOF b/ +- env -u LDFLAGS -u CFLAGS $(MAKE) -C b/SLOF qemu CROSS="powerpc64-linux-gnu-" V=${V} +-install-slof: b/SLOF/boot_rom.bin +- install -m 0644 $< ${sysdatadir}/slof.bin +-sysdata-components += slof +- +-### s390x firmware in pc-bios/s390-ccw +-build-s390x-fw: b/s390fw/built +-b/s390fw/built: +- mkdir -p b/s390fw +- ${MAKE} -f debian/s390fw.mak OUT=b/s390fw/ +- touch $@ +-install-s390x-fw: build-s390x-fw +- install -m 0644 -t "${sysdatadir}" b/s390fw/s390*.img +-sysdata-components += s390x-fw +- +-### hppa-firmware (roms/seabios-hppa) +-build-hppa-fw: b/hppafw/hppa-firmware.img +-b/hppafw/hppa-firmware.img: | b +- mkdir -p b/hppafw +- ${MAKE} -C roms/seabios-hppa OUT=../../b/hppafw/ PYTHON=python3 parisc +- hppa-linux-gnu-strip -R.note -R.comment $@ +-install-hppa-fw: b/hppafw/hppa-firmware.img +- install -m 0644 $< ${sysdatadir} +-sysdata-components += hppa-fw +- +-### opensbi (riscv firmware) +-# we only build v64 variants, not v32 +-build-opensbi: b/opensbi/.built +-b/opensbi/.built: | b +- mkdir -p b/opensbi +- ${MAKE} -C roms/opensbi O=../../b/opensbi CROSS_COMPILE=riscv64-linux-gnu- V=${V} PLATFORM=generic +- riscv64-linux-gnu-strip --strip-unneeded -R.comment -R.note b/opensbi/platform/generic/firmware/fw_dynamic.elf +- touch $@ +-install-opensbi: build-opensbi +- install -m 0644 b/opensbi/platform/generic/firmware/fw_dynamic.bin ${sysdatadir}/opensbi-riscv64-generic-fw_dynamic.bin +- install -m 0644 b/opensbi/platform/generic/firmware/fw_dynamic.elf ${sysdatadir}/opensbi-riscv64-generic-fw_dynamic.elf +-sysdata-components += opensbi +- + build-indep: $(addprefix build-, ${sysdata-components}) + + b/install-indep-prep.stamp: +-- +2.25.1 + diff --git a/virt/qemu/debian/deb_patches/series b/virt/qemu/debian/deb_patches/series new file mode 100644 index 000000000..4290b84d0 --- /dev/null +++ b/virt/qemu/debian/deb_patches/series @@ -0,0 +1 @@ +0001-Customize-Debian-build-files-for-STX.patch diff --git a/virt/qemu/debian/meta_data.yaml b/virt/qemu/debian/meta_data.yaml new file mode 100644 index 000000000..79f24b239 --- /dev/null +++ b/virt/qemu/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: qemu +debver: 5.2+dfsg-11+deb11u2 +archive: https://snapshot.debian.org/archive/debian/20221109T211529Z/pool/main/q/qemu/ +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/virt/qemu/debian/patches/0001-STX-Add-support-statement-to-help-output.patch b/virt/qemu/debian/patches/0001-STX-Add-support-statement-to-help-output.patch new file mode 100644 index 000000000..b48c3ebf3 --- /dev/null +++ b/virt/qemu/debian/patches/0001-STX-Add-support-statement-to-help-output.patch @@ -0,0 +1,63 @@ +From d8d9a42d7e243f0874f77c0fc932f32ecbde42e6 Mon Sep 17 00:00:00 2001 +From: Eduardo Habkost +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: Add support statement to -help output + +RH-Author: Eduardo Habkost +Message-id: <1386183197-27761-1-git-send-email-ehabkost@redhat.com> +Patchwork-id: 55994 +O-Subject: [qemu-kvm RHEL7 PATCH] Add support statement to -help output +Bugzilla: 972773 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: knoel@redhat.com +RH-Acked-by: Paolo Bonzini + +Bugzilla: 972773 +Brew scratch build: +http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6676272 + +Add support statement to -help output, reporting direct qemu-kvm usage +as unsupported by Red Hat, and advising users to use libvirt instead. + +Change the above to say StarlingX instead of Red Hat. +STX-Author: Jim Somerville + +Signed-off-by: Eduardo Habkost +Signed-off-by: Jim Somerville +Signed-off-by: Rafael Falcao +--- + softmmu/vl.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/softmmu/vl.c b/softmmu/vl.c +index e6e0ad5a92..27ce96f671 100644 +--- a/softmmu/vl.c ++++ b/softmmu/vl.c +@@ -1688,9 +1688,17 @@ static void version(void) + QEMU_COPYRIGHT "\n"); + } + ++static void print_stx_warning(void) ++{ ++ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by StarlingX.\n" ++ "WARNING: Use libvirt as the stable management interface.\n" ++ "WARNING: Some command line options listed here may not be available in future releases.\n\n"); ++} ++ + static void help(int exitcode) + { + version(); ++ print_stx_warning(); + printf("usage: %s [options] [disk_image]\n\n" + "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n", + error_get_progname()); +@@ -1707,6 +1715,7 @@ static void help(int exitcode) + "\n" + QEMU_HELP_BOTTOM "\n"); + ++ print_stx_warning(); + exit(exitcode); + } + +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0002-STX-migration-thread-affinity-and-priority-qmp.patch b/virt/qemu/debian/patches/0002-STX-migration-thread-affinity-and-priority-qmp.patch new file mode 100644 index 000000000..b8d40985a --- /dev/null +++ b/virt/qemu/debian/patches/0002-STX-migration-thread-affinity-and-priority-qmp.patch @@ -0,0 +1,272 @@ +From 049547fec5faedf6127cd7bf3c6e72f5a2fc16ab Mon Sep 17 00:00:00 2001 +From: Jim Somerville +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: migration thread affinity and priority qmp + +This includes de-blacklisting the scheduler and affinity +setting syscalls. + +Signed-off-by: Jim Somerville +[ Update hmp-commands struc ] +Signed-off-by: Rafael Falcao +--- + hmp-commands.hx | 30 ++++++++++++++++++++++++ + include/monitor/hmp.h | 2 ++ + migration/migration.c | 53 ++++++++++++++++++++++++++++++++++++++++++ + monitor/hmp-cmds.c | 26 +++++++++++++++++++++ + qapi/misc.json | 30 ++++++++++++++++++++++++ + softmmu/qemu-seccomp.c | 5 ---- + softmmu/trace-events | 1 + + 7 files changed, 142 insertions(+), 5 deletions(-) + +diff --git a/hmp-commands.hx b/hmp-commands.hx +index ff2d7aa8f3..c5db85593b 100644 +--- a/hmp-commands.hx ++++ b/hmp-commands.hx +@@ -1103,6 +1103,36 @@ SRST + once migration finished successfully. Only implemented for SPICE. + ERST + ++ { ++ .name = "migrate_set_thread_cpumask", ++ .args_type = "value:o", ++ .params = "value", ++ .help = "Set CPU mask for the migration thread." ++ "Defaults to CPU 0 if no mask is specified", ++ .cmd = hmp_migrate_set_thread_cpumask, ++ }, ++ ++SRST ++``migrate_set_thread_cpumask`` *value* ++ Set CPU mask for the migration thread ++ERST ++ ++ { ++ .name = "migrate_set_thread_priority", ++ .args_type = "value:o", ++ .params = "value", ++ .help = "Set real time priority for the the migration thread." ++ "Defaults to no change migration thread priority if not" ++ "specified or out of range. Range [1-99].Scheduling" ++ "policy will always be- SCHED_FIFO", ++ .cmd = hmp_migrate_set_thread_priority, ++ }, ++ ++SRST ++``migrate_set_thread_priority`` *value* ++ Set real time priority for the the migration thread ++ERST ++ + { + .name = "dump-guest-memory", + .args_type = "paging:-p,detach:-d,windmp:-w,zlib:-z,lzo:-l,snappy:-s,filename:F,begin:l?,length:l?", +diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h +index ed2913fd18..85100cd33d 100644 +--- a/include/monitor/hmp.h ++++ b/include/monitor/hmp.h +@@ -72,6 +72,8 @@ void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict); + void hmp_client_migrate_info(Monitor *mon, const QDict *qdict); + void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict); + void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict); ++void hmp_migrate_set_thread_cpumask(Monitor *mon, const QDict *qdict); ++void hmp_migrate_set_thread_priority(Monitor *mon, const QDict *qdict); + void hmp_set_password(Monitor *mon, const QDict *qdict); + void hmp_expire_password(Monitor *mon, const QDict *qdict); + void hmp_change(Monitor *mon, const QDict *qdict); +diff --git a/migration/migration.c b/migration/migration.c +index 87a9b59f83..b7415a52ca 100644 +--- a/migration/migration.c ++++ b/migration/migration.c +@@ -39,6 +39,7 @@ + #include "qapi/qapi-visit-migration.h" + #include "qapi/qapi-visit-sockets.h" + #include "qapi/qapi-commands-migration.h" ++#include "qapi/qapi-commands-misc.h" + #include "qapi/qapi-events-migration.h" + #include "qapi/qmp/qerror.h" + #include "qapi/qmp/qnull.h" +@@ -56,6 +57,16 @@ + #include "net/announce.h" + #include "qemu/queue.h" + #include "multifd.h" ++#include ++ ++/* #define DEBUG */ ++ ++#ifdef DEBUG ++#define DPRINTF(fmt, ...) \ ++ printf(fmt, ## __VA_ARGS__) ++#else ++#define DPRINTF(fmt, ...) ++#endif + + #ifdef CONFIG_VFIO + #include "hw/vfio/vfio-common.h" +@@ -118,6 +129,11 @@ + static NotifierList migration_state_notifiers = + NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); + ++/* variables for pinning the migration thread to a CPU and assigning the ++ * realtime priority to it */ ++static uint64_t migrate_thread_cpumask=0; ++static uint64_t migrate_thread_priority=0; ++ + static bool deferred_incoming; + + /* Messages sent on the return path from destination to source */ +@@ -2215,6 +2231,30 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp) + qmp_migrate_set_parameters(&p, errp); + } + ++void qmp_migrate_set_thread_cpumask(int64_t value, Error **errp) ++{ ++ /* Check for truncation */ ++ if (value != (size_t)value) { ++ error_setg(errp, "Migration thread CPU Mask exceeding address space"); ++ return; ++ } ++ /*resize the value */ ++ value >>= 20; /*Magic */ ++ migrate_thread_cpumask = value; ++} ++ ++void qmp_migrate_set_thread_priority(int64_t value, Error **errp) ++{ ++ /* Check for truncation */ ++ if (value != (size_t)value) { ++ error_setg(errp, "Migration thread Priority exceeding address space"); ++ return; ++ } ++ /*resize the value */ ++ value >>= 20; ++ migrate_thread_priority = value; ++} ++ + int64_t qmp_query_migrate_cache_size(Error **errp) + { + return migrate_xbzrle_cache_size(); +@@ -3540,6 +3580,19 @@ static void *migration_thread(void *opaque) + qemu_savevm_send_postcopy_advise(s->to_dst_file); + } + ++ /* Bind Migration thread to the processor specified by the user */ ++ if (sched_setaffinity(0, sizeof(migrate_thread_cpumask), (cpu_set_t *)&migrate_thread_cpumask) <0) { ++ DPRINTF("Error setting user input affinity. Switching to default.\n"); ++ } ++ ++ /* Change the realtime priority of the migration thread specified by the user */ ++ struct sched_param schedp; ++ memset(&schedp, 0, sizeof(schedp)); ++ schedp.sched_priority = migrate_thread_priority; ++ if (sched_setscheduler(0, SCHED_FIFO, &schedp) < 0) { ++ DPRINTF("Error setting user input priority. Switching to default.\n"); ++ } ++ + if (migrate_colo_enabled()) { + /* Notify migration destination that we enable COLO */ + qemu_savevm_send_colo_enable(s->to_dst_file); +diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c +index 65d8ff4849..a079ec3ace 100644 +--- a/monitor/hmp-cmds.c ++++ b/monitor/hmp-cmds.c +@@ -1471,6 +1471,32 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict) + hmp_handle_error(mon, err); + } + ++void hmp_migrate_set_thread_cpumask(Monitor *mon, const QDict *qdict) ++{ ++ int64_t value = qdict_get_int(qdict, "value"); ++ Error *err = NULL; ++ ++ qmp_migrate_set_thread_cpumask(value, &err); ++ if (err) { ++ monitor_printf(mon, "%s\n", error_get_pretty(err)); ++ error_free(err); ++ return; ++ } ++} ++ ++void hmp_migrate_set_thread_priority(Monitor *mon, const QDict *qdict) ++{ ++ int64_t value = qdict_get_int(qdict, "value"); ++ Error *err = NULL; ++ ++ qmp_migrate_set_thread_priority(value, &err); ++ if (err) { ++ monitor_printf(mon, "%s\n", error_get_pretty(err)); ++ error_free(err); ++ return; ++ } ++} ++ + void hmp_set_password(Monitor *mon, const QDict *qdict) + { + const char *protocol = qdict_get_str(qdict, "protocol"); +diff --git a/qapi/misc.json b/qapi/misc.json +index 40df513856..1c75d85126 100644 +--- a/qapi/misc.json ++++ b/qapi/misc.json +@@ -238,6 +238,36 @@ + 'returns': 'str', + 'features': [ 'savevm-monitor-nodes' ] } + ++## ++# @migrate_set_thread_cpumask: ++# ++# Set migration thread CPU mask. ++# ++# @value: CPU mask. ++# ++# Returns: nothing on success ++# ++# Notes: A value lesser than zero will be automatically round up to zero. ++# ++# Since: 0.14.0 ++## ++{ 'command': 'migrate_set_thread_cpumask', 'data': {'value': 'int'} } ++ ++## ++# @migrate_set_thread_priority: ++# ++# Set migration thread Real Timer priority mask. ++# ++# @value: Thread Priority. ++# ++# Returns: nothing on success ++# ++# Notes: A value lesser than zero will be automatically round up to zero. ++# ++# Since: 0.14.0 ++## ++{ 'command': 'migrate_set_thread_priority', 'data': {'value': 'int'} } ++ + ## + # @change: + # +diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c +index 8325ecb766..b1b8431eb3 100644 +--- a/softmmu/qemu-seccomp.c ++++ b/softmmu/qemu-seccomp.c +@@ -101,11 +101,6 @@ static const struct QemuSeccompSyscall blacklist[] = { + { SCMP_SYS(setpriority), QEMU_SECCOMP_SET_RESOURCECTL }, + { SCMP_SYS(sched_setparam), QEMU_SECCOMP_SET_RESOURCECTL }, + { SCMP_SYS(sched_getparam), QEMU_SECCOMP_SET_RESOURCECTL }, +- { SCMP_SYS(sched_setscheduler), QEMU_SECCOMP_SET_RESOURCECTL, +- ARRAY_SIZE(sched_setscheduler_arg), sched_setscheduler_arg }, +- { SCMP_SYS(sched_getscheduler), QEMU_SECCOMP_SET_RESOURCECTL }, +- { SCMP_SYS(sched_setaffinity), QEMU_SECCOMP_SET_RESOURCECTL }, +- { SCMP_SYS(sched_getaffinity), QEMU_SECCOMP_SET_RESOURCECTL }, + { SCMP_SYS(sched_get_priority_max), QEMU_SECCOMP_SET_RESOURCECTL }, + { SCMP_SYS(sched_get_priority_min), QEMU_SECCOMP_SET_RESOURCECTL }, + }; +diff --git a/softmmu/trace-events b/softmmu/trace-events +index b80ca042e1..b0210d70c3 100644 +--- a/softmmu/trace-events ++++ b/softmmu/trace-events +@@ -26,3 +26,4 @@ runstate_set(int current_state, const char *current_state_str, int new_state, co + system_wakeup_request(int reason) "reason=%d" + qemu_system_shutdown_request(int reason) "reason=%d" + qemu_system_powerdown_request(void) "" ++migrate_thread(uint64_t migrate_thread_cpumask, uint64_t migrate_thread_priority) "migration Thread pinned to %" PRIu64 "with Priority %" PRIu64 +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0003-STX-qemu-dpdk-changes-for-openvswitch-dpdk.patch b/virt/qemu/debian/patches/0003-STX-qemu-dpdk-changes-for-openvswitch-dpdk.patch new file mode 100644 index 000000000..deee242c7 --- /dev/null +++ b/virt/qemu/debian/patches/0003-STX-qemu-dpdk-changes-for-openvswitch-dpdk.patch @@ -0,0 +1,197 @@ +From 31ae2e35caa16dcf4cc1fa2ff5e3c1aa825b5352 Mon Sep 17 00:00:00 2001 +From: Jim Somerville +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: qemu dpdk changes for openvswitch dpdk + +Signed-off-by: Jim Somerville +Signed-off-by: Rafael Falcao +--- + configure | 26 ++++++++++++++++++ + hw/net/virtio-net.c | 5 ++++ + softmmu/vl.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 98 insertions(+) + +diff --git a/configure b/configure +index 18c26e0389..cb6d3c08fc 100755 +--- a/configure ++++ b/configure +@@ -1106,6 +1106,11 @@ for opt do + ;; + --enable-whpx) whpx="enabled" + ;; ++ --disable-dpdk) dpdk="no" ++ ;; ++ --dpdkdir=*) rte_sdk="$optarg" ++ dpdk="yes" ++ ;; + --disable-tcg-interpreter) tcg_interpreter="no" + ;; + --enable-tcg-interpreter) tcg_interpreter="yes" +@@ -5993,6 +5998,27 @@ if test "$guest_agent" = "yes" ; then + echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak + fi + echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak ++if test "$dpdk" = "yes"; then ++ if test "${rte_sdk+set}" != set; then ++ echo "No dpdkdir given" ++ exit 1 ++ fi ++ echo "dpdk_dir=`eval echo $rte_sdk`" >> $config_host_mak ++ echo "dpdk_lib_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/lib" >> $config_host_mak ++ echo "dpdk_inc_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/include" >> $config_host_mak ++ echo "" >> $config_host_mak ++ echo "dpdk_libs=\$(dpdk_lib_dir)/librte_eal.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/libethdev.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_cmdline.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_hash.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_lpm.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_mbuf.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_mempool.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_ring.a \\" >> $config_host_mak ++ echo " \$(dpdk_lib_dir)/librte_malloc.a" >> $config_host_mak ++ LIBS="\$(dpdk_libs) $LIBS" ++ QEMU_INCLUDES="-I\$(dpdk_inc_dir) $QEMU_INCLUDES" ++fi + if test "$vde" = "yes" ; then + echo "CONFIG_VDE=y" >> $config_host_mak + echo "VDE_LIBS=$vde_libs" >> $config_host_mak +diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c +index 9179013ac4..a25381c452 100644 +--- a/hw/net/virtio-net.c ++++ b/hw/net/virtio-net.c +@@ -2,6 +2,7 @@ + * Virtio Network Device + * + * Copyright IBM, Corp. 2007 ++ * Copyright 2012-2013 Intel Corporation All Rights Reserved. + * + * Authors: + * Anthony Liguori +@@ -1509,6 +1510,7 @@ static void receive_header(VirtIONet *n, const struct iovec *iov, int iov_cnt, + } + } + ++#if 0 + static int receive_filter(VirtIONet *n, const uint8_t *buf, int size) + { + static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +@@ -1559,6 +1561,7 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size) + + return 0; + } ++#endif + + static uint8_t virtio_net_get_hash_type(bool isip4, + bool isip6, +@@ -1687,8 +1690,10 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, + return 0; + } + ++ #if 0 + if (!receive_filter(n, buf, size)) + return size; ++ #endif + + offset = i = 0; + +diff --git a/softmmu/vl.c b/softmmu/vl.c +index 27ce96f671..5f556f1a0e 100644 +--- a/softmmu/vl.c ++++ b/softmmu/vl.c +@@ -2445,6 +2445,35 @@ static const QEMUOption *lookup_opt(int argc, char **argv, + return popt; + } + ++#ifdef CONFIG_ENABLE_DPDK ++static const QEMUOption *quick_scan_opt(int argc, char **argv, int *poptind) ++{ ++ const QEMUOption *popt; ++ int optind = *poptind; ++ char *r = argv[optind]; ++ ++ loc_set_cmdline(argv, optind, 1); ++ optind++; ++ /* Treat --foo the same as -foo. */ ++ if (r[1] == '-') ++ r++; ++ popt = qemu_options; ++ for(;;) { ++ /* need to ignore non qemu args, e.g. dpdk args */ ++ if (!popt->name) { ++ *poptind = optind; ++ return NULL; ++ } ++ if (!strcmp(popt->name, r + 1)) ++ break; ++ popt++; ++ } ++ ++ *poptind = optind; ++ return popt; ++} ++#endif ++ + static MachineClass *select_machine(void) + { + GSList *machines = object_class_get_list(TYPE_MACHINE, false); +@@ -2901,6 +2930,10 @@ void qemu_init(int argc, char **argv, char **envp) + FILE *vmstate_dump_file = NULL; + Error *main_loop_err = NULL; + Error *err = NULL; ++#ifdef CONFIG_ENABLE_DPDK ++ bool use_dpdk = false; ++ int retval; ++#endif + bool list_data_dirs = false; + char **dirs; + const char *mem_path = NULL; +@@ -2922,6 +2955,37 @@ void qemu_init(int argc, char **argv, char **envp) + atexit(qemu_run_exit_notifiers); + qemu_init_exec_dir(argv[0]); + ++#ifdef CONFIG_ENABLE_DPDK ++ /* need to check for -enable-dpdk before calling rte_eal_init. If ++ * it is not found, don't call rte_eal_init */ ++ optind = 1; ++ while (optind < argc) { ++ if (argv[optind][0] != '-') { ++ /* disk image */ ++ optind++; ++ continue; ++ } else { ++ const QEMUOption *popt; ++ popt = quick_scan_opt(argc, argv, &optind); ++ if (popt) { ++ switch (popt->index) { ++ case QEMU_OPTION_enable_dpdk: ++ use_dpdk = true; ++ break; ++ } ++ } ++ } ++ } ++ ++ if (use_dpdk) { ++ if ((retval = rte_eal_init(argc, argv)) < 0) ++ return -1; ++ ++ argc -= retval; ++ argv += retval; ++ } ++#endif ++ + module_call_init(MODULE_INIT_QOM); + module_call_init(MODULE_INIT_MIGRATION); + +@@ -3869,6 +3933,9 @@ void qemu_init(int argc, char **argv, char **envp) + + user_register_global_props(); + ++ extern int ++ rte_eal_init(int argc, char **argv); ++ + replay_configure(icount_opts); + + if (incoming && !preconfig_exit_requested) { +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0004-STX-qemu-add-enable-dpdk-runtime-flag.patch b/virt/qemu/debian/patches/0004-STX-qemu-add-enable-dpdk-runtime-flag.patch new file mode 100644 index 000000000..c632d823b --- /dev/null +++ b/virt/qemu/debian/patches/0004-STX-qemu-add-enable-dpdk-runtime-flag.patch @@ -0,0 +1,53 @@ +From 6b809649650c367ea0458928434600ca064206c1 Mon Sep 17 00:00:00 2001 +From: Paul Barrette +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: qemu: add -enable-dpdk runtime flag + +For Intel's dpdk openvswitch support, qemu takes a set of dpdk +specific command line args. Qemu will dump and error if it doesn't +recognize the CLI args. So, add a new runtime flag to tell qemu that +it is using dpdk and then the main function can take the appropriate +action. This way, qemu can take dpdk args or run normally without +dpdk. + +Signed-off-by: Paul Barrette +Signed-off-by: Jim Somerville +[ Update qemu-options.hx struc ] +Signed-off-by: Rafael Falcao +--- + qemu-options.hx | 7 +++++++ + softmmu/vl.c | 1 + + 2 files changed, 8 insertions(+) + +diff --git a/qemu-options.hx b/qemu-options.hx +index 104632ea34..1a339453e4 100644 +--- a/qemu-options.hx ++++ b/qemu-options.hx +@@ -906,6 +906,13 @@ DEFHEADING() + + DEFHEADING(Block device options:) + ++DEF("enable-dpdk", 0, QEMU_OPTION_enable_dpdk, ++ "-enable-dpdk initialized DPDK EAL environment\n", QEMU_ARCH_ALL) ++SRST ++``-enable-dpdk`` ++ Enable DPDK EAL environment at init time (expecting DPDK CLI params). ++ERST ++ + DEF("fda", HAS_ARG, QEMU_OPTION_fda, + "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL) + DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL) +diff --git a/softmmu/vl.c b/softmmu/vl.c +index 5f556f1a0e..a398697d0d 100644 +--- a/softmmu/vl.c ++++ b/softmmu/vl.c +@@ -3899,6 +3899,7 @@ void qemu_init(int argc, char **argv, char **envp) + qsp_enable(); + break; + case QEMU_OPTION_nouserconfig: ++ case QEMU_OPTION_enable_dpdk: + /* Nothing to be parsed here. Especially, do not error out below. */ + break; + default: +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0005-STX-qemu-add-compile-define-for-CONFIG_DPDK.patch b/virt/qemu/debian/patches/0005-STX-qemu-add-compile-define-for-CONFIG_DPDK.patch new file mode 100644 index 000000000..9174233d6 --- /dev/null +++ b/virt/qemu/debian/patches/0005-STX-qemu-add-compile-define-for-CONFIG_DPDK.patch @@ -0,0 +1,32 @@ +From 93451fe51ab37bf8663a766ce1d77d3ac883ee1f Mon Sep 17 00:00:00 2001 +From: Paul Barrette +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: qemu: add compile define for CONFIG_DPDK + +Dpdk build linkage will be detected if --dpdkdir is specified at +configure time, which is the default. In the dpdk=yes section, add a +compile time define that can be used internally. + +Signed-off-by: Paul Barrette +Signed-off-by: Jim Somerville +Signed-off-by: Rafael Falcao +--- + configure | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index cb6d3c08fc..d0c4b79446 100755 +--- a/configure ++++ b/configure +@@ -6003,7 +6003,8 @@ if test "$dpdk" = "yes"; then + echo "No dpdkdir given" + exit 1 + fi +- echo "dpdk_dir=`eval echo $rte_sdk`" >> $config_host_mak ++ echo "CONFIG_ENABLE_DPDK=y" >> $config_host_mak ++ echo "dpdk_dir=`eval echo $rte_sdk`" >> $config_host_mak + echo "dpdk_lib_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/lib" >> $config_host_mak + echo "dpdk_inc_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/include" >> $config_host_mak + echo "" >> $config_host_mak +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0006-STX-add-libdl.patch b/virt/qemu/debian/patches/0006-STX-add-libdl.patch new file mode 100644 index 000000000..bae935e9b --- /dev/null +++ b/virt/qemu/debian/patches/0006-STX-add-libdl.patch @@ -0,0 +1,41 @@ +From 95ba02087f976256a91045286628fb797e3f0af1 Mon Sep 17 00:00:00 2001 +From: Amy Fong +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: add libdl + +qemu/dpdk 1.7* compile errors + +In dpdk 1.7.*, librte_eal needs -ldl, otherwise, we'll +get errors like: + +LINK x86_64-softmmu/qemu-system-x86_64 +/usr/bin/ld: +.../x86_64-ivshmem-linuxapp-gcc/lib/librte_eal.a(eal.o): +undefined reference to symbol 'dlopen@@GLIBC_2.2.5' +/usr/bin/ld: note: 'dlopen@@GLIBC_2.2.5' is defined in DSO +/lib64/libdl.so.2 so try adding it to the linker command line +/lib64/libdl.so.2: could not read symbols: Invalid operation +collect2: error: ld returned 1 exit status + +Signed-off-by: Amy Fong +Signed-off-by: Jim Somerville +Signed-off-by: Rafael Falcao +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index d0c4b79446..e90a4e8fe0 100755 +--- a/configure ++++ b/configure +@@ -6017,7 +6017,7 @@ if test "$dpdk" = "yes"; then + echo " \$(dpdk_lib_dir)/librte_mempool.a \\" >> $config_host_mak + echo " \$(dpdk_lib_dir)/librte_ring.a \\" >> $config_host_mak + echo " \$(dpdk_lib_dir)/librte_malloc.a" >> $config_host_mak +- LIBS="\$(dpdk_libs) $LIBS" ++ LIBS="\$(dpdk_libs) -ldl $LIBS" + QEMU_INCLUDES="-I\$(dpdk_inc_dir) $QEMU_INCLUDES" + fi + if test "$vde" = "yes" ; then +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0007-STX-qemu-dpdk-custom-config.patch b/virt/qemu/debian/patches/0007-STX-qemu-dpdk-custom-config.patch new file mode 100644 index 000000000..8011de56b --- /dev/null +++ b/virt/qemu/debian/patches/0007-STX-qemu-dpdk-custom-config.patch @@ -0,0 +1,39 @@ +From 2e53239f58b4faeeca9f1ae279207edb3aa4f30c Mon Sep 17 00:00:00 2001 +From: Jim Somerville +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: qemu dpdk custom config + +Signed-off-by: Jim Somerville +Signed-off-by: Rafael Falcao +--- + configure | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index e90a4e8fe0..77c0321b5f 100755 +--- a/configure ++++ b/configure +@@ -1111,6 +1111,8 @@ for opt do + --dpdkdir=*) rte_sdk="$optarg" + dpdk="yes" + ;; ++ --dpdktarget=*) rte_target="$optarg" ++ ;; + --disable-tcg-interpreter) tcg_interpreter="no" + ;; + --enable-tcg-interpreter) tcg_interpreter="yes" +@@ -6005,9 +6007,10 @@ if test "$dpdk" = "yes"; then + fi + echo "CONFIG_ENABLE_DPDK=y" >> $config_host_mak + echo "dpdk_dir=`eval echo $rte_sdk`" >> $config_host_mak +- echo "dpdk_lib_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/lib" >> $config_host_mak +- echo "dpdk_inc_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/include" >> $config_host_mak + echo "" >> $config_host_mak ++ echo "dpdk_target=`eval echo $rte_target`" >> $config_host_mak ++ echo "dpdk_lib_dir=\$(dpdk_dir)/\$(dpdk_target)/lib" >> $config_host_mak ++ echo "dpdk_inc_dir=\$(dpdk_dir)/\$(dpdk_target)/include" >> $config_host_mak + echo "dpdk_libs=\$(dpdk_lib_dir)/librte_eal.a \\" >> $config_host_mak + echo " \$(dpdk_lib_dir)/libethdev.a \\" >> $config_host_mak + echo " \$(dpdk_lib_dir)/librte_cmdline.a \\" >> $config_host_mak +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0008-STX-realtime-uses-mlock-instead-of-mlockall.patch b/virt/qemu/debian/patches/0008-STX-realtime-uses-mlock-instead-of-mlockall.patch new file mode 100644 index 000000000..2b7284030 --- /dev/null +++ b/virt/qemu/debian/patches/0008-STX-realtime-uses-mlock-instead-of-mlockall.patch @@ -0,0 +1,102 @@ +From f06fb5c1bf146f661fdca218943018fcf25c5ca6 Mon Sep 17 00:00:00 2001 +From: Jim Somerville +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: realtime uses mlock instead of mlockall + +This enhances qemu to use mlock() instead of mlockall() when +'-realtime mlock=on' is specified, so that memory is engineerable. + +mlockall() is not practically engineerable since it requires significant +4K reserved memory per process. It will lock pages of the code, data and +stack segment, shared libraries, user space kernel data, shared memory, +and memory-mapped files. This easily translates to >> 1GiB when you +consider [heap] segment of 225MiB and VmData near 500 MiB to 900 MiB. + +Using mlock() only in ram_block_add(), we no longer lock stack / data, +shared libraries, and heap. + +NOTE: This degrades the guarantee provided by '-realtime mlock=on' +since we may end up delaying the instance to fault in code pages from +disk or allocate memory, thus breaking any realtime guarantees. + +Signed-off-by: Jim Somerville +Signed-off-by: Rafael Falcao +--- + softmmu/physmem.c | 13 ++++++++++++- + softmmu/vl.c | 8 ++++---- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/softmmu/physmem.c b/softmmu/physmem.c +index 3027747c03..e63fad9b13 100644 +--- a/softmmu/physmem.c ++++ b/softmmu/physmem.c +@@ -1464,6 +1464,7 @@ static void *file_ram_alloc(RAMBlock *block, + Error **errp) + { + void *area; ++ int flags; + + block->page_size = qemu_fd_getpagesize(fd); + if (block->mr->align % block->page_size) { +@@ -1510,8 +1511,13 @@ static void *file_ram_alloc(RAMBlock *block, + perror("ftruncate"); + } + ++ /* WRS - enable mlock */ ++ flags = block->flags & RAM_SHARED; ++ if (enable_mlock) { ++ flags |= MAP_LOCKED; ++ } + area = qemu_ram_mmap(fd, memory, block->mr->align, +- block->flags & RAM_SHARED, block->flags & RAM_PMEM); ++ flags, block->flags & RAM_PMEM); + if (area == MAP_FAILED) { + error_setg_errno(errp, errno, + "unable to map backing store for guest RAM"); +@@ -1937,6 +1943,11 @@ static void ram_block_add(RAMBlock *new_block, Error **errp, bool shared) + QEMU_MADV_DONTFORK); + } + ram_block_notify_add(new_block->host, new_block->max_length); ++ if (enable_mlock) { ++ if (mlock(new_block->host, new_block->max_length) < 0) { ++ perror("mlock"); ++ } ++ } + } + } + +diff --git a/softmmu/vl.c b/softmmu/vl.c +index a398697d0d..527fe4e961 100644 +--- a/softmmu/vl.c ++++ b/softmmu/vl.c +@@ -2,6 +2,7 @@ + * QEMU System Emulator + * + * Copyright (c) 2003-2008 Fabrice Bellard ++ * Copyright (c) 2013-2016 Wind River Systems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal +@@ -38,6 +39,7 @@ + #include "sysemu/tcg.h" + #include "sysemu/xen.h" + ++#include "qemu-common.h" + #include "qemu/error-report.h" + #include "qemu/sockets.h" + #include "sysemu/accel.h" +@@ -1111,10 +1113,8 @@ static QemuOptsList qemu_smp_opts = { + static void realtime_init(void) + { + if (enable_mlock) { +- if (os_mlock() < 0) { +- error_report("locking memory failed"); +- exit(1); +- } ++ /* WRS - do not call os_mlock(), prevent call to mlockall */ ++ ; + } + } + +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0009-STX-Suspend-Resume-for-VMs-with-PCIPT-Virtio.patch b/virt/qemu/debian/patches/0009-STX-Suspend-Resume-for-VMs-with-PCIPT-Virtio.patch new file mode 100644 index 000000000..76d17b5e6 --- /dev/null +++ b/virt/qemu/debian/patches/0009-STX-Suspend-Resume-for-VMs-with-PCIPT-Virtio.patch @@ -0,0 +1,95 @@ +From ad19f7aad9e2ff9a007eddbd9a19b61a9c1af769 Mon Sep 17 00:00:00 2001 +From: Jim Somerville +[ Trimmed the shortlog ] +Signed-off-by: Rafael Falcao +--- + hw/virtio/vhost.c | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c +index 614ccc2bcb..05c045925a 100644 +--- a/hw/virtio/vhost.c ++++ b/hw/virtio/vhost.c +@@ -61,6 +61,10 @@ bool vhost_has_free_slot(void) + return slots_limit > used_memslots; + } + ++static int vhost_virtqueue_set_addr(struct vhost_dev *dev, ++ struct vhost_virtqueue *vq, ++ unsigned idx, bool enable_log); ++ + static void vhost_dev_sync_region(struct vhost_dev *dev, + MemoryRegionSection *section, + uint64_t mfirst, uint64_t mlast, +@@ -448,6 +452,21 @@ static void vhost_begin(MemoryListener *listener) + dev->n_tmp_sections = 0; + } + ++static void vhost_update_backend_ring_mappings(struct vhost_dev *dev) ++{ ++ int i,r; ++ ++ if(dev->vhost_ops->backend_type != VHOST_BACKEND_TYPE_USER) { ++ return; ++ } ++ ++ for (i = 0; i < dev->nvqs; ++i) { ++ r = vhost_virtqueue_set_addr(dev, dev->vqs + i, i, dev->log_enabled); ++ assert(r >= 0); ++ } ++ return; ++} ++ + static void vhost_commit(MemoryListener *listener) + { + struct vhost_dev *dev = container_of(listener, struct vhost_dev, +@@ -524,7 +543,7 @@ static void vhost_commit(MemoryListener *listener) + if (r < 0) { + VHOST_OPS_DEBUG("vhost_set_mem_table failed"); + } +- goto out; ++ goto vring_mapping; + } + log_size = vhost_get_log_size(dev); + /* We allocate an extra 4K bytes to log, +@@ -543,6 +562,11 @@ static void vhost_commit(MemoryListener *listener) + vhost_dev_log_resize(dev, log_size); + } + ++vring_mapping: ++ /* For vhost-user backend, update the vring mappings after we sent a new ++ * guest memory map. */ ++ vhost_update_backend_ring_mappings(dev); ++ + out: + /* Deref the old list of sections, this must happen _after_ the + * vhost_set_mem_table to ensure the client isn't still using the +-- +2.25.1 + diff --git a/virt/qemu/debian/patches/0010-STX-Modify-live-migration-auto-converge-threshold.patch b/virt/qemu/debian/patches/0010-STX-Modify-live-migration-auto-converge-threshold.patch new file mode 100644 index 000000000..934384d3a --- /dev/null +++ b/virt/qemu/debian/patches/0010-STX-Modify-live-migration-auto-converge-threshold.patch @@ -0,0 +1,32 @@ +From 862773099be4c599cf2885cb8b0f706b01964157 Mon Sep 17 00:00:00 2001 +From: Jim Somerville +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: Modify live migration auto-converge threshold + +Currently the live migration auto-converge can throttle a VM +vcpus time to 99%. This value for "max cpu trottling percentage" +causes some detaches to fail. Based on characterization results, +we set this value to 92. + +Signed-off-by: Jim Somerville +[ Trimmed the shortlog ] +Signed-off-by: Rafael Falcao +--- + softmmu/cpu-throttle.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/softmmu/cpu-throttle.c b/softmmu/cpu-throttle.c +index 2ec4b8e0bc..211c074f8d 100644 +--- a/softmmu/cpu-throttle.c ++++ b/softmmu/cpu-throttle.c +@@ -35,7 +35,7 @@ static QEMUTimer *throttle_timer; + static unsigned int throttle_percentage; + + #define CPU_THROTTLE_PCT_MIN 1 +-#define CPU_THROTTLE_PCT_MAX 99 ++#define CPU_THROTTLE_PCT_MAX 92 + #define CPU_THROTTLE_TIMESLICE_NS 10000000 + + static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque) +-- +2.25.1 diff --git a/virt/qemu/debian/patches/0011-STX-virtio-serial-don-t-touch-virtqueue-if-vm-is-sto.patch b/virt/qemu/debian/patches/0011-STX-virtio-serial-don-t-touch-virtqueue-if-vm-is-sto.patch new file mode 100644 index 000000000..d9c4ec321 --- /dev/null +++ b/virt/qemu/debian/patches/0011-STX-virtio-serial-don-t-touch-virtqueue-if-vm-is-sto.patch @@ -0,0 +1,41 @@ +From 80c5f13e549cb59adc781335c4d6a8f81f578615 Mon Sep 17 00:00:00 2001 +From: Jim Somerville +Date: Fri, 26 Apr 2019 17:41:04 -0300 +Subject: [PATCH] STX: virtio-serial: don't touch virtqueue if vm is stopped + Candidate for upstreaming. + +During migration there is a window where virtio-serial +data has been transmitted to the receiving side, but +the region caches haven't been initialized there yet. +This causes an assertion fail crash. + +The fix is inspired by: + +70e53e6 virtio-net: don't touch virtqueue if vm is stopped + +We remove the call to virtio_queue_ready as it is covered +by the call to virtio_queue_empty already, and replace it +with a test to ensure that the vm is running. + +Signed-off-by: Jim Somerville +[ Trimmed the shortlog ] +Signed-off-by: Rafael Falcao +--- + hw/char/virtio-serial-bus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c +index cf08ef9728..9b4b258413 100644 +--- a/hw/char/virtio-serial-bus.c ++++ b/hw/char/virtio-serial-bus.c +@@ -311,7 +311,7 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port) + VirtQueue *vq = port->ivq; + unsigned int bytes; + +- if (!virtio_queue_ready(vq) || ++ if (!vdev->vm_running || + !(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) || + virtio_queue_empty(vq)) { + return 0; +-- +2.25.1 diff --git a/virt/qemu/debian/patches/series b/virt/qemu/debian/patches/series new file mode 100644 index 000000000..71ff99010 --- /dev/null +++ b/virt/qemu/debian/patches/series @@ -0,0 +1,11 @@ +0001-STX-Add-support-statement-to-help-output.patch +0002-STX-migration-thread-affinity-and-priority-qmp.patch +0003-STX-qemu-dpdk-changes-for-openvswitch-dpdk.patch +0004-STX-qemu-add-enable-dpdk-runtime-flag.patch +0005-STX-qemu-add-compile-define-for-CONFIG_DPDK.patch +0006-STX-add-libdl.patch +0007-STX-qemu-dpdk-custom-config.patch +0008-STX-realtime-uses-mlock-instead-of-mlockall.patch +0009-STX-Suspend-Resume-for-VMs-with-PCIPT-Virtio.patch +0010-STX-Modify-live-migration-auto-converge-threshold.patch +0011-STX-virtio-serial-don-t-touch-virtqueue-if-vm-is-sto.patch