Debian: Add build structure for virt/qemu

This change adds the necessary files for the qemu package to
be built for Debian. This review follows the same approach
used on the virt/libvirt [1].

The base version selected comes from the Debian archive [2] since the
salsa-debian [3] version was not fully compatible with stx build tools.
The full upstream build was quite long (time) and big (size) so we
patched the Debian files with debian_patches to drop unnecessary
packages, that is, packages that starlingx does not need.

The patches dir will contain source code patches required for
stx-qemu, that is, the code that was earlier added on top of 3.0.0
qemu release to add StarlingX required functionalities.
The work done on this change is simply porting the code changes,
copying it and doing the minimum required updates when it is needed.

The list of commits follow, where the "-" character indicates that the
commit was dropped now that we are based on 5.2:

 d3400d STX: virtio-serial: don't touch virtqueue if vm is stopped
 71dc08 STX: Modify live migration auto-converge threshold
 9be81b STX: Suspend/Resume for VMs with PCIPT+Virtio
 876a3c STX: realtime uses mlock instead of mlockall
 007444 STX: qemu dpdk custom config
 3f6344 STX: add libdl
 dbda73 STX: qemu: add compile define for CONFIG_DPDK
 626bfd STX: qemu: add -enable-dpdk runtime flag
 79ea26 STX: qemu dpdk changes for openvswitch dpdk
 9c83db STX: migration thread affinity and priority qmp
 e7fbe5 STX: Add support statement to -help output
-48de9c STX: Changes for running on CentOS
-32b6f0 Upstream: Workaround: make sure vdev->vq[i].inuse never goes
        below 0
-246b26 virtio: Return true from virtio_queue_empty if broken

[1] https://review.opendev.org/c/starlingx/integ/+/863561
[2] https://snapshot.debian.org/archive/debian/20221109T211529Z/pool/main/q/qemu/
[3] https://salsa.debian.org/qemu-team/qemu/-/tree/debian-bullseye

Test Plan:
PASS: Build the qemu packages
PASS: Build iso with qemu packages
PASS: Bootstrap Debian ISO on AIO-SX
PASS: Ensure qemu packages are installed (apt list --installed)
PASS: Lock/Unlock AIO-SX *
* Future tests regarding the libvirt/qemu runtime features will be done
once all the pieces are in place in the ISO.

Depends-On: https://review.opendev.org/c/starlingx/root/+/864942

Story: 2010317
Task: 46390

Signed-off-by: Rafael Falcao <rafael.vieirafalcao@windriver.com>
Co-Authored-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
Change-Id: I424debf7eb24c024ba82a490cda746dbd5af0019
This commit is contained in:
Rafael Falcao 2022-10-31 16:52:28 -03:00 committed by Thales Elero Cervi
parent 5dee5799d4
commit 75a234904f
17 changed files with 1411 additions and 0 deletions

View File

@ -10,3 +10,8 @@ trident-installer
iputils-arping iputils-arping
iputils-ping iputils-ping
iputils-tracepath iputils-tracepath
qemu-block-extra
qemu-guest-agent
qemu-system-common
qemu-system-data
qemu-system-x86

View File

@ -94,3 +94,4 @@ security/shim-unsigned
security/openscap security/openscap
storage-drivers/trident-installer storage-drivers/trident-installer
tools/kdump-tools tools/kdump-tools
virt/qemu

View File

@ -0,0 +1,419 @@
From 33716964e8381628d575160b6a015a3f8ba68640 Mon Sep 17 00:00:00 2001
From: Thales Elero Cervi <thaleselero.cervi@windriver.com>
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 <thaleselero.cervi@windriver.com>
---
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

View File

@ -0,0 +1 @@
0001-Customize-Debian-build-files-for-STX.patch

View File

@ -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

View File

@ -0,0 +1,63 @@
From d8d9a42d7e243f0874f77c0fc932f32ecbde42e6 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Fri, 26 Apr 2019 17:41:04 -0300
Subject: [PATCH] STX: Add support statement to -help output
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
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 <mrezanin@redhat.com>
RH-Acked-by: knoel@redhat.com
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
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 <Jim.Somerville@windriver.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,272 @@
From 049547fec5faedf6127cd7bf3c6e72f5a2fc16ab Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
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 <Jim.Somerville@windriver.com>
[ Update hmp-commands struc ]
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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 <sched.h>
+
+/* #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

View File

@ -0,0 +1,197 @@
From 31ae2e35caa16dcf4cc1fa2ff5e3c1aa825b5352 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Fri, 26 Apr 2019 17:41:04 -0300
Subject: [PATCH] STX: qemu dpdk changes for openvswitch dpdk
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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 <aliguori@us.ibm.com>
@@ -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

View File

@ -0,0 +1,53 @@
From 6b809649650c367ea0458928434600ca064206c1 Mon Sep 17 00:00:00 2001
From: Paul Barrette <paul.barrette@windriver.com>
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 <paul.barrette@windriver.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
[ Update qemu-options.hx struc ]
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,32 @@
From 93451fe51ab37bf8663a766ce1d77d3ac883ee1f Mon Sep 17 00:00:00 2001
From: Paul Barrette <paul.barrette@windriver.com>
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 <paul.barrette@windriver.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,41 @@
From 95ba02087f976256a91045286628fb797e3f0af1 Mon Sep 17 00:00:00 2001
From: Amy Fong <amy.fong@windriver.com>
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 <amy.fong@windriver.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,39 @@
From 2e53239f58b4faeeca9f1ae279207edb3aa4f30c Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Fri, 26 Apr 2019 17:41:04 -0300
Subject: [PATCH] STX: qemu dpdk custom config
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,102 @@
From f06fb5c1bf146f661fdca218943018fcf25c5ca6 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
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 <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,95 @@
From ad19f7aad9e2ff9a007eddbd9a19b61a9c1af769 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com
Date: Fri, 26 Apr 2019 17:41:04 -0300
Subject: [PATCH] STX: Suspend/Resume for VMs with PCIPT+Virtio
When we have a Passthrough or a SR-IOV device, the plug/unplug of these
devices causes the guest memory map to change.
When the vhost code in qemu detects that the guest memory map changed,
it verifies that the virtio vring mappings into its own address space
did not change and sends the vhost backend the VHOST_SET_MEM_TABLE
message so that the backend can update its mapping based on the new
guest memory map.
If this guest memory map change happens after the virtio device has
been initialized and started, we get into the situation where ports
are brought down as part of the VHOST_SET_MEM_TABLE message handling
and has nothing to restart the device.
The root cause of this issue was that the mappings for the vring was
changing when we get a new VHOST_USER_SET_MEM_TABLE message and we
were trying to restart the device with the old vring mapping.
The correct fix is to send a VHOST_SET_VRING_ADDR message from qemu
which will force the mapping to be recalculated based on the new
memory map.
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
[ Trimmed the shortlog ]
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,32 @@
From 862773099be4c599cf2885cb8b0f706b01964157 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
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 <Jim.Somerville@windriver.com>
[ Trimmed the shortlog ]
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -0,0 +1,41 @@
From 80c5f13e549cb59adc781335c4d6a8f81f578615 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
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 <Jim.Somerville@windriver.com>
[ Trimmed the shortlog ]
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
---
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

View File

@ -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