import qemu-kvm-2.12.0-77.module+el8.1.0+3382+49219945

This commit is contained in:
CentOS Sources 2019-08-01 14:56:56 -04:00 committed by Stepan Oksanichenko
commit 380f322602
741 changed files with 127779 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/qemu-2.12.0.tar.xz

1
.qemu-kvm.metadata Normal file
View File

@ -0,0 +1 @@
5a62c911b2cebbd41decd5c77c524395212411cf SOURCES/qemu-2.12.0.tar.xz

View File

@ -0,0 +1,332 @@
From 7000ac85100400a686b48562d830c7b14a439a94 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Mon, 11 Sep 2017 07:11:00 +0200
Subject: Initial redhat build
This patch introduces redhat build structure in redhat subdirectory. In addition,
several issues are fixed in QEMU tree:
- Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm
- As we use qemu-kvm as name in all places, this is updated to be consistent
- Man page renamed from qemu to qemu-kvm
- man page is installed using make install so we have to fix it in qemu tree
- Use "/share/qemu-kvm" as SHARE_SUFFIX
- We reconfigured our share to qemu-kvm to be consistent with used name
- Added .gitpublish configuration file
- Support for git publish has to be stored in repository root
--
Rebase notes for RHEL-8 (2.12.0):
- Conflict fix in .gitpublish
- Not packaging hppa-firmware.img
- Disable vxhs.o in block/Makefile.obj
- Disable ppc64 builds
- Removed acpi-dsdt.aml (upstream)
- dropped libjpeg build requirement
- Replaced buildrequirement librados2 and librbd1 by librados and librbd.
- dropping "-pie -fPIE -DPIE" as we're using --enable-pie
- Do not use tcmmaloc
- Dropping gperftools-devel dependency
Rebase notes for RHEL-8.0 (2.11.0):
- Removed references to rhel6 rom files (virtio.rom, pcnet, rtl8139,
net2k_pci e1000, bios-256k,
pxe-e1000e.rom)
- Removed 80-kvm.rules file
- Changing ipxe linking to match upstream
- Updating kvm.modules and ksmtuned files
- cleaning %kvm_files section
- Remove CONFIG_RHV
- Remove CONFIG_LIVE_BLOCK_OPS
- Removing CONFIG_VTD
- Moving vxhs related changes to another commit
- removed live-block-migration option
Rebase notes (2.11.0):
- Removed --with-pixman configure option (upstream)
- Enabling multipath for qemu-pr-helper
- Removed qemu-kvm-tools
- Removed references to "-rhev" and "-ma"
- Removing kvm-unit-tests
- Enabling qemu-geust-agent
Rebase notes (2.10.0):
- live_block_migration option added upstream
- moved qmp-spec.txt file (upstream)
- added s390-netboot.img (added upstream)
- removed qemu_vga.ndrv (added upstream)
- switch to (rhevh-)rhel-7.5-candidate
- switched differentiation defaults
- moved binary files to separate commit
Rebase notes (2.9.0):
- documentation files handling changes (upstrem)
- removed --enable-colo option and --disable-archipelago (upstream)
- bump BuildRequires versions
- new mandatory argument for tracetool.py (upstream)
- updated RHEL 6 roms
- switch from sha1sum to sha256sum
- Moved adding rhel6-e1000.rom from machine types commit
- Moved adding pxe-e1000e.rom from device disable commit
- Use rdma-core instead of librdmacm
- Add upstream tarballs tar.xz to .gitignore
- Updated git-backport-diff script
Rebase notes (2.8.0):
- removed vhdx option (upstream)
- qemu-tech.html merged to qemu-doc.html (upstream)
- removed skiboot.lid firmware
- Changed tracetool.py parameters
- Added support for easy z-stream switch
Rebase notes (2.7.0):
- removed kvm_stat
- added efi-e1000e.rom
- added efi-vmxnet.rom
- added linuxboot_dma.bin
- trace-events renamed to trace-events-all
- reverted dependency to seccomp on aarch64
- Add ipxe-qemu-roms ad build dependency to pass tests
Rebase notes (2.6.0):
- removed q35-acpi-dsdt.aml
- add enable-gcrypt option
Rebase notes (2.5.0):
- New seccomp hadling in configure
- New condition format in migration/migration.c
- libcacard extracted
- vnc fixes
- libsecomp for aarch64 requirements changed downstream
Rebase notes (2.4.0):
- remove --enable-ws-vnc
- use error_setg instead of error_set in migration/migration.c
- remove target-x86_64.conf
- create /etc/qemu-kvm on copying of bridge.conf
- disabled opengl
- rebased to version 2.3.0-30.el7
- Merged patches (Rebase 2.12.0)
- spec: Change License line
- spec: Do not depend on ipxe for Power architectures
- configuration: Use gcrypt instead of nettle
- spec: Use hardening flags for ksmctl build
Merged patches (rebase 2.11.0)
- ce6e8e5b8a redhat/qemu-kvm.spec.template: Enable seccomp on s390x, too
- 8629f208c6 redhat: Remove qemu.binfmt from the downstream repository
- b889ce1c40 Disable build of qemu-kvm-ma for x86_64
- 4506913c42 redhat: add CONFIG_RHV flag
- 21ecaec46f s390x: vm.allocate_pgste sysctl is no longer needed
- 78a1864d99 Update build_configure for 2.10.0 options
- decf881320 redhat: Provide s390x specific /etc/modprobe.d/kvm.conf
- e0cd3138cc redhat/qemu-kvm.spec: Use the freshly built s390-ccw.img firmware image
- 7af6b9a4fa redhat: install generic kvm.conf except for s390 and x86 architectures
- c4290f50bb redhat: fix rh-srpm target
- 8943f52e8b Package qemu-block-drivers manpage
- 88b41044d6 update spec to build and install qemu-pr-helper
Merged patches (rebase 2.10.0)
- feefd46 qemu-kvm.spec: Enable s390x build
- 985051e Removing texi2html from build requirements
- 7c64a2a Update ignore files for redhat usage
- 8f9a95a Disable replication feature
- 1b7bbc5 block/vxhs: modularize VXHS via g_module
- 7511527 Remove the dependencies to seavgabios-bin and ipxe-roms-qemu on s390x
- aa0891c Downstream: Don't disable SMT on POWER9 hosts
- a13a0e9 Update configuration for qemu 2.9
- bbf46dd disable pulseaudio and alsa
- 9124839 redhat/Makefile: honor BREW_FLAGS like the kernel
- 53c03bd copy SLIT test reference blobs into tests directory
- c4c77e6 Differentiation support
- f1ec0e8 configure: allow to disable VT-d emulation
- b972023 Disable VT-d for rhel builds
- 29a0414 RHEL Diff.: Add option in configure to disable live block ops
- 1f33b29 RHEL Diff.: Unregister live block operations
- c590551 RHEL Diff.: Disable live block operations in HMP monitor
- c7e208f RHEL Diff.: Add rpm spec options for live block ops
- 733af5c pegas: add rpm spec options for vhost-user
- ff16138 Add support for local build
- fb426d4 qemu-kvm.spec: Configure vm.allocate_pgste for s390x
Merged patches (rebase 2.9.0)
- 9c7ab94 Enable seccomp for ppc64/ppc64le architecture
- f6d7e9d Update qemu-kvm package Summary and Description
- a9e55b6 Disable usbredir and libcacard for unsupported architectures
- 0218220 Update configuration for 2.8.0 release
Merged patches (rebase 2.7.0)
- 2be6077 Fix SLOF dependency
- dc58590 spec: Remove dependency to ipxe-roms-qemu for aarch64
- 357ef43 spec: link sgabios.bin only for x86_64
- 08d82cc spec: Update rules before triggering for kvm device
- 8980a76 spec: Do not package ivshmem-server and ivshmem-client
- 027067c spec: add a sample kvm.conf to enable Nested Virtualization
- ba2ba30 Adjust locked memory limits to allow unprivileged VMs on Power
- e9740b0 Increase locked memory limit for all users, not just kvm group
- 8c301be add vgabios-virtio.bin symlink
- 4d03723 usb: enable streams support
- 2a9363e Add install dependency required for usb streams
- 9a54442 Add dump-guest-memory.py to all archs
- 73fffc9 add e1000e ipxe rom symlink
- aaaa2a9 Add 'luks' to block driver whitelist
- c78c3a8 redhat: switch from gcrypt to nettle for crypto
- bb51a69 redhat: include username and date in RPM N-E-V-R for scratch builds
Merged patches (rebase 2.4.0)
- 9201274 spec: Remove obsolete differentiation code
- a938a8c spec: Use external configuration script
- 5ca8d0e spec: Use configure options to prevent default resolution
- 5dca391 spec: Ship complete QMP documentation files
- 7899edd aarch64: allow --enable-seccomp
- a56fb9c aarch64: redhat spec: enable seccomp
- a9571e6 rhel: Update package version for SLOF dependency
- 25c70c4 configure: Add support for tcmalloc
- db72485 Change fsreeze-hook default location
- 14b8a9e redhat: add kvm-unit-tests tarball to environment
- 5ee4238 spec: Build tscdeadline_latency.flat from kvm-unit-tests
- 6ba800b Downstream-only: Start kvm-setup service before libvirtd service
- 59b43d6 Do not stop qemu-guest-agent service on target switch
- 4d851fa provide vhost module config file with max_mem_regions set to 509
- 0b18027 spec: Require proper version of SLOF
- 3c436c7 Fix rh-brew-aarch64, rh-brew-ppc rh-brew-ga-ppc target
(cherry picked from commit ba7591ec4a0906121d15ffbf740580bd79ec5814)
---
.gitpublish | 58 +--
Makefile | 2 +-
block/Makefile.objs | 2 +-
os-posix.c | 2 +-
redhat/.gitignore | 5 +
redhat/85-kvm.preset | 5 +
redhat/95-kvm-memlock.conf | 10 +
redhat/99-qemu-guest-agent.rules | 2 +
redhat/Makefile | 88 ++++
redhat/Makefile.common | 48 +++
redhat/Makefile.local | 76 ++++
redhat/bridge.conf | 1 +
redhat/build_configure.sh | 145 +++++++
redhat/ksm.service | 13 +
redhat/ksm.sysconfig | 4 +
redhat/ksmctl.c | 77 ++++
redhat/ksmtuned | 139 +++++++
redhat/ksmtuned.conf | 21 +
redhat/ksmtuned.service | 12 +
redhat/kvm-s390x.conf | 7 +
redhat/kvm-setup | 40 ++
redhat/kvm-setup.service | 14 +
redhat/kvm-x86.conf | 12 +
redhat/kvm.conf | 3 +
redhat/kvm.modules | 18 +
redhat/qemu-ga.sysconfig | 19 +
redhat/qemu-guest-agent.service | 20 +
redhat/qemu-kvm.spec.template | 794 +++++++++++++++++++++++++++++++++++++
redhat/qemu-pr-helper.service | 15 +
redhat/qemu-pr-helper.socket | 9 +
redhat/rpmbuild/BUILD/.gitignore | 2 +
redhat/rpmbuild/RPMS/.gitignore | 2 +
redhat/rpmbuild/SOURCES/.gitignore | 2 +
redhat/rpmbuild/SPECS/.gitignore | 2 +
redhat/rpmbuild/SRPMS/.gitignore | 2 +
redhat/scripts/frh.py | 26 ++
redhat/scripts/git-backport-diff | 327 +++++++++++++++
redhat/scripts/git-compile-check | 215 ++++++++++
redhat/scripts/process-patches.sh | 78 ++++
redhat/scripts/tarball_checksum.sh | 3 +
redhat/vhost.conf | 3 +
ui/vnc.c | 2 +-
42 files changed, 2270 insertions(+), 55 deletions(-)
create mode 100644 redhat/.gitignore
create mode 100644 redhat/85-kvm.preset
create mode 100644 redhat/95-kvm-memlock.conf
create mode 100644 redhat/99-qemu-guest-agent.rules
create mode 100644 redhat/Makefile
create mode 100644 redhat/Makefile.common
create mode 100644 redhat/Makefile.local
create mode 100644 redhat/bridge.conf
create mode 100755 redhat/build_configure.sh
create mode 100644 redhat/ksm.service
create mode 100644 redhat/ksm.sysconfig
create mode 100644 redhat/ksmctl.c
create mode 100644 redhat/ksmtuned
create mode 100644 redhat/ksmtuned.conf
create mode 100644 redhat/ksmtuned.service
create mode 100644 redhat/kvm-s390x.conf
create mode 100644 redhat/kvm-setup
create mode 100644 redhat/kvm-setup.service
create mode 100644 redhat/kvm-x86.conf
create mode 100644 redhat/kvm.conf
create mode 100644 redhat/kvm.modules
create mode 100644 redhat/qemu-ga.sysconfig
create mode 100644 redhat/qemu-guest-agent.service
create mode 100644 redhat/qemu-kvm.spec.template
create mode 100644 redhat/qemu-pr-helper.service
create mode 100644 redhat/qemu-pr-helper.socket
create mode 100644 redhat/rpmbuild/BUILD/.gitignore
create mode 100644 redhat/rpmbuild/RPMS/.gitignore
create mode 100644 redhat/rpmbuild/SOURCES/.gitignore
create mode 100644 redhat/rpmbuild/SPECS/.gitignore
create mode 100644 redhat/rpmbuild/SRPMS/.gitignore
create mode 100755 redhat/scripts/frh.py
create mode 100755 redhat/scripts/git-backport-diff
create mode 100755 redhat/scripts/git-compile-check
create mode 100755 redhat/scripts/process-patches.sh
create mode 100755 redhat/scripts/tarball_checksum.sh
create mode 100644 redhat/vhost.conf
diff --git a/Makefile b/Makefile
index d71dd5b..89ba4c5 100644
--- a/Makefile
+++ b/Makefile
@@ -804,7 +804,7 @@ install-doc: $(DOCS)
$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
ifdef CONFIG_POSIX
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
- $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
+ $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1/qemu-kvm.1"
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
diff --git a/block/Makefile.objs b/block/Makefile.objs
index d644bac..c0693fc 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -20,7 +20,7 @@ block-obj-$(CONFIG_LIBNFS) += nfs.o
block-obj-$(CONFIG_CURL) += curl.o
block-obj-$(CONFIG_RBD) += rbd.o
block-obj-$(CONFIG_GLUSTERFS) += gluster.o
-block-obj-$(CONFIG_VXHS) += vxhs.o
+#block-obj-$(CONFIG_VXHS) += vxhs.o
block-obj-$(CONFIG_LIBSSH2) += ssh.o
block-obj-y += accounting.o dirty-bitmap.o
block-obj-y += write-threshold.o
diff --git a/os-posix.c b/os-posix.c
index b9c2343..05de8ee 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -75,7 +75,7 @@ void os_setup_signal_handling(void)
/* Find a likely location for support files using the location of the binary.
For installed binaries this will be "$bindir/../share/qemu". When
running from the build tree this will be "$bindir/../pc-bios". */
-#define SHARE_SUFFIX "/share/qemu"
+#define SHARE_SUFFIX "/share/qemu-kvm"
#define BUILD_SUFFIX "/pc-bios"
char *os_find_datadir(void)
{
diff --git a/ui/vnc.c b/ui/vnc.c
index e164eb7..0c3011b 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4045,7 +4045,7 @@ void vnc_display_open(const char *id, Error **errp)
trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth);
#ifdef CONFIG_VNC_SASL
- if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
+ if ((saslErr = sasl_server_init(NULL, "qemu-kvm")) != SASL_OK) {
error_setg(errp, "Failed to initialize SASL auth: %s",
sasl_errstring(saslErr, NULL, NULL));
goto fail;
--
1.8.3.1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,515 @@
From e58ce3910208fead9e24eb08e19a11bb2eba2f1e Mon Sep 17 00:00:00 2001
From: "Danilo C. L. de Paula" <ddepaula@redhat.com>
Date: Wed, 7 Mar 2018 13:05:43 -0300
Subject: block/vxhs: modularize VXHS via g_module
RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <8a91a423440b7a5a14e868279c772e99b865bfc6.1494281291.git.jcody@redhat.com>
Patchwork-id: 75046
O-Subject: [RHEV-7.4 qemu-kvm-rhev 4/4] block/vxhs: modularize VXHS via g_module Bugzilla: 1265869
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
This converts the VXHS driver to be a runtime loaded module, with no
external build dependencies on libvxhs / libqnio. This (libvxhs) is a
3rd party library, written by Veritas, to interface with the VXHS
server.
Red Hat is not going to distribute libvxhs, nor will Red Hat use libvxhs
in the build systems. So that creates two criteria for the
modularization, for business reasons:
1. No runtime dependencies on libvxhs (aside from opening the library on
vxhs open)
2. No build dependencies on libvxhs packages.
There is support in QEMU for modular block drivers, however there are
two issues with using the built-in support:
A. It is all-or-none; if modules are enabled all protocols are built
as modules. This wouldn't be that bad, as it would of course
enable more granular dependencies for qemu rpm packages. But...
B. It is not designed with criteria #2 in mind; it reduces runtime
dependencies, not build dependencies. The protocol libraries
that are still built linked against external libraries and using
external headers.
This patch uses g_module to load the libvxhs library, and incorporates
the libvxhs.h header in the build tree. If block driver protocols are
also built as modules, libvxhs will still work and be built as a module
too, except the shared library will still not have any dependency on
libvxhs.
There are a few changes in this patch from upstream (aside from the
module loading aspects):
1. It enables VXHS support to be built as a protocl module if
--enable-modules is used during configure.
2. If the init call to iio_init() fails, populate errp with a
meaningful error message.
3. Since we are loading the library dynamically, make check the min and
max supported versions in the libvxhs library on load.
Patches for items #1 and #2 have been posted upstream.
It is expected that the libvxhs library is located at the following
pathname: /usr/lib64/qemu/libvxhs.so.1
VXHS support is only built for x86_64 in RHEV.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
block/vxhs: improve error message for missing / bad vxhs module
RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <59af10d83125fff42beacd30dbca83d50409bbed.1513031708.git.jcody@redhat.com>
Patchwork-id: 78305
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 1/1] block/vxhs: improve error message for missing / bad vxhs module
Bugzilla: 1505654
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
[Downstream only, as the module load of libvxhs is downstream only]
In the case of missing libvxhs libraries, the original error message,
while technically accurate, may lead a user to think there is a QEMU bug
if trying to using the VXHS protocol. Update the message so that it is
clear that the likely issue is that the Veritas QEMU libvxhs RPM is not
installed (or not installed correctly, if there are permission or file
corruption issues, etc.).
An example error message before this change:
> qemu-img info vxhs://localhost/test
qemu-img: Could not open 'vxhs://localhost/test': \
error loading libvxhs: /usr/lib64/qemu/libvxhs.so.1: \
cannot open shared object file: No such file or directory
An example error message after this change:
> qemu-img info vxhs://localhost/test
qemu-img: Could not open 'vxhs://localhost/test': \
The VXHS library from Veritas might not be installed correctly \
(/usr/lib64/qemu/libvxhs.so.1: \
cannot open shared object file: No such file or directory)
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block/vxhs.c | 123 ++++++++++++++++++++++++++++++++----
configure | 33 +---------
include/block/vxhs_shim.h | 143 ++++++++++++++++++++++++++++++++++++++++++
redhat/build_configure.sh | 9 ++-
redhat/qemu-kvm.spec.template | 7 +++
5 files changed, 273 insertions(+), 42 deletions(-)
create mode 100644 include/block/vxhs_shim.h
diff --git a/block/vxhs.c b/block/vxhs.c
index 75cc6c8..68edb51 100644
--- a/block/vxhs.c
+++ b/block/vxhs.c
@@ -9,7 +9,8 @@
*/
#include "qemu/osdep.h"
-#include <qnio/qnio_api.h>
+#include "block/vxhs_shim.h"
+#include <gmodule.h>
#include <sys/param.h>
#include "block/block_int.h"
#include "qapi/qmp/qerror.h"
@@ -58,6 +59,97 @@ typedef struct BDRVVXHSState {
char *tlscredsid; /* tlscredsid */
} BDRVVXHSState;
+#define LIBVXHS_FULL_PATHNAME "/usr/lib64/qemu/libvxhs.so.1"
+static bool libvxhs_loaded;
+static GModule *libvxhs_handle;
+
+static LibVXHSFuncs libvxhs;
+
+typedef struct LibVXHSSymbols {
+ const char *name;
+ gpointer *addr;
+} LibVXHSSymbols;
+
+static LibVXHSSymbols libvxhs_symbols[] = {
+ {"iio_init", (gpointer *) &libvxhs.iio_init},
+ {"iio_fini", (gpointer *) &libvxhs.iio_fini},
+ {"iio_min_version", (gpointer *) &libvxhs.iio_min_version},
+ {"iio_max_version", (gpointer *) &libvxhs.iio_max_version},
+ {"iio_open", (gpointer *) &libvxhs.iio_open},
+ {"iio_close", (gpointer *) &libvxhs.iio_close},
+ {"iio_writev", (gpointer *) &libvxhs.iio_writev},
+ {"iio_readv", (gpointer *) &libvxhs.iio_readv},
+ {"iio_ioctl", (gpointer *) &libvxhs.iio_ioctl},
+ {NULL}
+};
+
+static void bdrv_vxhs_set_funcs(GModule *handle, Error **errp)
+{
+ int i = 0;
+ while (libvxhs_symbols[i].name) {
+ const char *name = libvxhs_symbols[i].name;
+ if (!g_module_symbol(handle, name, libvxhs_symbols[i].addr)) {
+ error_setg(errp, "%s could not be loaded from libvxhs: %s",
+ name, g_module_error());
+ return;
+ }
+ ++i;
+ }
+}
+
+static void bdrv_vxhs_load_libs(Error **errp)
+{
+ Error *local_err = NULL;
+ int32_t ver;
+
+ if (libvxhs_loaded) {
+ return;
+ }
+
+ if (!g_module_supported()) {
+ error_setg(errp, "modules are not supported on this platform: %s",
+ g_module_error());
+ return;
+ }
+
+ libvxhs_handle = g_module_open(LIBVXHS_FULL_PATHNAME,
+ G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ if (!libvxhs_handle) {
+ error_setg(errp, "The VXHS library from Veritas might not be installed "
+ "correctly (%s)", g_module_error());
+ return;
+ }
+
+ g_module_make_resident(libvxhs_handle);
+
+ bdrv_vxhs_set_funcs(libvxhs_handle, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ /* Now check to see if the libvxhs we are using here is supported
+ * by the loaded version */
+
+ ver = (*libvxhs.iio_min_version)();
+ if (ver > QNIO_VERSION) {
+ error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
+ "only %"PRId32" or newer is supported by %s",
+ QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
+ return;
+ }
+
+ ver = (*libvxhs.iio_max_version)();
+ if (ver < QNIO_VERSION) {
+ error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
+ "only %"PRId32" or earlier is supported by %s",
+ QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
+ return;
+ }
+
+ libvxhs_loaded = true;
+}
+
static void vxhs_complete_aio_bh(void *opaque)
{
VXHSAIOCB *acb = opaque;
@@ -219,7 +311,7 @@ static void vxhs_parse_filename(const char *filename, QDict *options,
static int vxhs_init_and_ref(void)
{
if (vxhs_ref++ == 0) {
- if (iio_init(QNIO_VERSION, vxhs_iio_callback)) {
+ if ((*libvxhs.iio_init)(QNIO_VERSION, vxhs_iio_callback)) {
return -ENODEV;
}
}
@@ -229,7 +321,7 @@ static int vxhs_init_and_ref(void)
static void vxhs_unref(void)
{
if (--vxhs_ref == 0) {
- iio_fini();
+ (*libvxhs.iio_fini)();
}
}
@@ -299,8 +391,17 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
char *client_key = NULL;
char *client_cert = NULL;
+ bdrv_vxhs_load_libs(&local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ /* on error, cannot cleanup because the iio_fini() function
+ * is not loaded */
+ return -EINVAL;
+ }
+
ret = vxhs_init_and_ref();
if (ret < 0) {
+ error_setg(&local_err, "libvxhs iio_init() failed");
ret = -EINVAL;
goto out;
}
@@ -385,8 +486,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
/*
* Open qnio channel to storage agent if not opened before
*/
- dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0,
- cacert, client_key, client_cert);
+ dev_handlep = (*libvxhs.iio_open)(of_vsa_addr, s->vdisk_guid, 0,
+ cacert, client_key, client_cert);
if (dev_handlep == NULL) {
trace_vxhs_open_iio_open(of_vsa_addr);
ret = -ENODEV;
@@ -450,12 +551,12 @@ static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, int64_t sector_num,
switch (iodir) {
case VDISK_AIO_WRITE:
- ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov,
- offset, (uint64_t)size, iio_flags);
+ ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
+ offset, (uint64_t)size, iio_flags);
break;
case VDISK_AIO_READ:
- ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov,
- offset, (uint64_t)size, iio_flags);
+ ret = (*libvxhs.iio_readv)(dev_handle, acb, qiov->iov, qiov->niov,
+ offset, (uint64_t)size, iio_flags);
break;
default:
trace_vxhs_aio_rw_invalid(iodir);
@@ -505,7 +606,7 @@ static void vxhs_close(BlockDriverState *bs)
* Close vDisk device
*/
if (s->vdisk_hostinfo.dev_handle) {
- iio_close(s->vdisk_hostinfo.dev_handle);
+ (*libvxhs.iio_close)(s->vdisk_hostinfo.dev_handle);
s->vdisk_hostinfo.dev_handle = NULL;
}
@@ -527,7 +628,7 @@ static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s)
int ret = 0;
void *dev_handle = s->vdisk_hostinfo.dev_handle;
- ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
+ ret = (*libvxhs.iio_ioctl)(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
if (ret < 0) {
trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno);
return -EIO;
diff --git a/configure b/configure
index 0a19b03..7358269 100755
--- a/configure
+++ b/configure
@@ -3369,7 +3369,7 @@ else
glib_req_ver=2.22
fi
glib_modules=gthread-2.0
-if test "$modules" = yes; then
+if test "$modules" = yes -o "$vxhs" = yes; then
glib_modules="$glib_modules gmodule-export-2.0"
fi
@@ -5314,33 +5314,6 @@ if compile_prog "" "" ; then
fi
##########################################
-# Veritas HyperScale block driver VxHS
-# Check if libvxhs is installed
-
-if test "$vxhs" != "no" ; then
- cat > $TMPC <<EOF
-#include <stdint.h>
-#include <qnio/qnio_api.h>
-
-void *vxhs_callback;
-
-int main(void) {
- iio_init(QNIO_VERSION, vxhs_callback);
- return 0;
-}
-EOF
- vxhs_libs="-lvxhs -lssl"
- if compile_prog "" "$vxhs_libs" ; then
- vxhs=yes
- else
- if test "$vxhs" = "yes" ; then
- feature_not_found "vxhs block device" "Install libvxhs See github"
- fi
- vxhs=no
- fi
-fi
-
-##########################################
# check for _Static_assert()
have_static_assert=no
@@ -6614,8 +6587,8 @@ if test "$pthread_setname_np" = "yes" ; then
fi
if test "$vxhs" = "yes" ; then
- echo "CONFIG_VXHS=y" >> $config_host_mak
- echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
+ echo "CONFIG_VXHS=m" >> $config_host_mak
+ echo "VXHS_LIBS= -lssl" >> $config_host_mak
fi
if test "$tcg_interpreter" = "yes"; then
diff --git a/include/block/vxhs_shim.h b/include/block/vxhs_shim.h
new file mode 100644
index 0000000..42519ae
--- /dev/null
+++ b/include/block/vxhs_shim.h
@@ -0,0 +1,143 @@
+/*
+ * Network IO library for VxHS QEMU block driver (Veritas Technologies)
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2014-08-15 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#ifndef QNIO_API_H
+#define QNIO_API_H
+
+#include <sys/uio.h>
+
+/*
+ * Bump up the version everytime this file is modified
+ */
+#define QNIO_VERSION 34
+
+/*
+ * These are the opcodes referenced by callback routine.
+ */
+#define IRP_READ_REQUEST 0x1FFF
+#define IRP_WRITE_REQUEST 0x2FFF
+#define IRP_VDISK_CHECK_IO_FAILOVER_READY 2020
+
+/*
+ * opcodes for iio_ioctl.
+ */
+#define IOR_VDISK_STAT 1005
+
+/*
+ * Error values for iio_cb_t callback function.
+ */
+#define QNIOERROR_HUP 901 /* Retriable error */
+#define QNIOERROR_NOCONN 902 /* Non-retriable error */
+
+
+/* Operation Flags */
+#define IIO_FLAG_ASYNC 0x0001 /* Do an async send */
+
+/*
+ * INPUT:
+ * ctx - opaque context
+ * opcode - Operation
+ * error - 0 for sucess, non-zero for failure.
+ * RETURNS:
+ * void
+ * DESCRIPTION:
+ * This callback is called, after Async request completes.
+ *
+ * CONTEXT:
+ * The callback should be wait-free.
+ */
+typedef void (*iio_cb_t) (void *ctx, uint32_t opcode, uint32_t error);
+
+typedef struct LibVXHSFuncs {
+/*
+ * RETURNS:
+ * 0 for sucess, non-zero for failure.
+ * DESCRIPTION:
+ * Intilize the library state. This should be called at the
+ * begining before issuing any library call.
+ */
+ int (*iio_init)(int32_t version, iio_cb_t cb);
+/*
+ * RETURNS:
+ * void
+ * DESCRIPTION:
+ * Relinquish library resources. This should be called on the
+ * close of last open device.
+ */
+ void (*iio_fini)(void);
+/*
+ * DESCRIPTION:
+ * Returns minimum QNIO API version supported by library.
+ */
+ int32_t (*iio_min_version)(void);
+/*
+ * DESCRIPTION:
+ * Returns maximum QNIO API version supported by library.
+ */
+ int32_t (*iio_max_version)(void);
+/*
+ * INPUT:
+ * uri - const string of the format of://<hostname|ip>:port
+ * devid - Device ID.
+ * flags - currently unused, this must be set to 0
+ * cacert - CA certificates file in PEM format
+ * client_key - Client private key file in PEM format
+ * client_cert - Client certificate file in PEM format
+ * RETURNS:
+ * opeque device handle on success, NULL on failure.
+ * DESCRIPTION:
+ * This call returns device handle on success. Returns NULL on
+ * failure with errno set
+ * errno can be one of:
+ * ENODEV - remote device not found
+ * EBADF - Unable to open communication channel.
+ * EBUSY - The call cannot be completed right now
+ */
+ void *(*iio_open)(const char *uri, const char *devid, uint32_t flags,
+ const char *cacert, const char *client_key,
+ const char *client_cert);
+/*
+ * Close the device.
+ * For every matching iio_open() there should be a matching iio_close()
+ * The last close free all data structures associated with the device.
+ */
+ int32_t (*iio_close)(void *dev_handle);
+/*
+ * INPUT:
+ * dev_handle - device descriptor on which read/write needs to be performed
+ * ctx - an opaque context that is not interpreted This is set for
+ * async calls only. It can be NULL.
+ * iov - an array of iovecs (This is a scatter gather operation)
+ * iovcnt - the number of iovecs
+ * offset - an offset to perform the write
+ * size - I/O size
+ * flags - can be one of
+ * IIO_FLAG_ASYNC - indicating this is a aio call.
+ * RETURNS:
+ * -1 on error, sets errno
+ * EBADF - the remote fd is bad
+ * EBUSY - The call cannot be completed right now
+ * EPIPE - the channel got disconnected, call back would be called in
+ * addition to this.
+ */
+ int32_t (*iio_writev)(void *dev_handle, void *ctx, struct iovec *iov,
+ int iovcnt, uint64_t offset, uint64_t size,
+ uint32_t flags);
+
+ int32_t (*iio_readv)(void *dev_handle, void *ctx, struct iovec *iov,
+ int iovcnt, uint64_t offset, uint64_t size,
+ uint32_t flags);
+
+ int32_t (*iio_ioctl)(void *dev_handle, uint32_t opcode, void *opaque,
+ uint32_t flags);
+
+} LibVXHSFuncs;
+
+#endif

View File

@ -0,0 +1,41 @@
From a737b4e82a67c87c6c34bbe5826dc9ed5c6318da Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 18 Dec 2014 06:27:49 +0100
Subject: Use kvm by default
Bugzilla: 906185
RHEL uses kvm accelerator by default, if available.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Rebase notes (2.10.0)
- variable rename (upstream)
Rebase notes (2.2.0):
- Move code from vl.c to accel.c
(cherry picked from commit abcd662eb8e516ebe4a6b401e83a62f749491a15)
(cherry picked from commit eca6d5766d956c37e3f7f28d70903d357308c846)
---
accel/accel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/accel/accel.c b/accel/accel.c
index 93e2434..5f3d73f 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -79,8 +79,8 @@ void configure_accelerator(MachineState *ms)
accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
if (accel == NULL) {
- /* Use the default "accelerator", tcg */
- accel = "tcg";
+ /* RHEL uses kvm as the default accelerator, fallback to tcg */
+ accel = "kvm:tcg";
}
p = accel;
--
1.8.3.1

View File

@ -0,0 +1,74 @@
From caa475eb19e0e235920f15828c6879c4b64499a2 Mon Sep 17 00:00:00 2001
From: Bandan Das <bsd@redhat.com>
Date: Tue, 3 Dec 2013 20:05:13 +0100
Subject: vfio: cap number of devices that can be assigned
RH-Author: Bandan Das <bsd@redhat.com>
Message-id: <1386101113-31560-3-git-send-email-bsd@redhat.com>
Patchwork-id: 55984
O-Subject: [PATCH RHEL7 qemu-kvm v2 2/2] vfio: cap number of devices that can be assigned
Bugzilla: 678368
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
Go through all groups to get count of total number of devices
active to enforce limit
Reasoning from Alex for the limit(32) - Assuming 3 slots per
device, with 125 slots (number of memory slots for RHEL 7),
we can support almost 40 devices and still have few slots left
for other uses. Stepping down a bit, the number 32 arbitrarily
matches the number of slots on a PCI bus and is also a nice power
of two.
Signed-off-by: Bandan Das <bsd@redhat.com>
Rebase notes (2.8.0):
- removed return value for vfio_realize (commit 1a22aca)
Merged patches (2.9.0):
- 17eb774 vfio: Use error_setg when reporting max assigned device overshoot
(cherry picked from commit 9fa3c9fc6dfcde76d80db1aa601b2d577f72ceec)
(cherry picked from commit 3cb35556dc7d994f203d732fe952f95fcdb03c0a)
---
hw/vfio/pci.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index b9bc6cd..34b9d19 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -35,6 +35,7 @@
#include "qapi/error.h"
#define MSIX_CAP_LENGTH 12
+#define MAX_DEV_ASSIGN_CMDLINE 32
static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);
@@ -2807,7 +2808,19 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
ssize_t len;
struct stat st;
int groupid;
- int i, ret;
+ int ret, i = 0;
+
+ QLIST_FOREACH(group, &vfio_group_list, next) {
+ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
+ i++;
+ }
+ }
+
+ if (i >= MAX_DEV_ASSIGN_CMDLINE) {
+ error_setg(errp, "Maximum supported vfio devices (%d) "
+ "already attached", MAX_DEV_ASSIGN_CMDLINE);
+ return;
+ }
if (!vdev->vbasedev.sysfsdev) {
if (!(~vdev->host.domain || ~vdev->host.bus ||
--
1.8.3.1

View File

@ -0,0 +1,57 @@
From 9fad36498006352be79a39ca3428079b6b7ddcc9 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Wed, 4 Dec 2013 18:53:17 +0100
Subject: 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>
Add support statement to -help output, reporting direct qemu-kvm usage
as unsupported by Red Hat, and advising users to use libvirt instead.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 2a07700936e39856cc9f149c6a6517f0715536a6)
(cherry picked from commit 5dd2f4706e2fef945771949e59a8fcc1b5452de9)
---
vl.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/vl.c b/vl.c
index 03950fc..8c89bee 100644
--- a/vl.c
+++ b/vl.c
@@ -1953,9 +1953,17 @@ static void version(void)
QEMU_COPYRIGHT "\n");
}
+static void print_rh_warning(void)
+{
+ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.\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_rh_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());
@@ -1972,6 +1980,7 @@ static void help(int exitcode)
"\n"
QEMU_HELP_BOTTOM "\n");
+ print_rh_warning();
exit(exitcode);
}
--
1.8.3.1

View File

@ -0,0 +1,151 @@
From 9324eac6e41aa7667042e117dc3581859cecbf5f Mon Sep 17 00:00:00 2001
From: Andrew Jones <drjones@redhat.com>
Date: Tue, 21 Jan 2014 10:46:52 +0100
Subject: globally limit the maximum number of CPUs
We now globally limit the number of VCPUs.
Especially, there is no way one can specify more than
max_cpus VCPUs for a VM.
This allows us the restore the ppc max_cpus limitation to the upstream
default and minimize the ppc hack in kvm-all.c.
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Danilo Cesar Lemes de Paula <ddepaula@redhat.com>
Rebase notes (2.11.0):
- Removed CONFIG_RHV reference
- Update commit log
Merged patches (2.11.0):
- 92fef14623 redhat: remove manual max_cpus limitations for ppc
- bb722e9eff redhat: globally limit the maximum number of CPUs
- fdeef3c1c7 RHEL: Set vcpus hard limit to 240 for Power
- 0584216921 Match POWER max cpus to x86
Signed-off-by: Andrew Jones <drjones@redhat.com>
(cherry picked from commit a4ceb63bdc5cbac19f5f633ec761b9de0dedb55e)
(cherry picked from commit a1f26d85171b4d554225150053700e93ba6eba10)
redhat: globally limit the maximum number of CPUs
RH-Author: David Hildenbrand <david@redhat.com>
Message-id: <20180109103253.24517-2-david@redhat.com>
Patchwork-id: 78531
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 1/2] redhat: globally limit the maximum number of CPUs
Bugzilla: 1527449
RH-Acked-by: David Gibson <dgibson@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
Upstream-status: n/a
For RHEL, we support 240, for RHV up to 384 VCPUs. Let's limit this
globally instead of fixing up all machines. This way, we can easily
change (increase) the product specific levels later.
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
redhat: remove manual max_cpus limitations for ppc
RH-Author: David Hildenbrand <david@redhat.com>
Message-id: <20180109103253.24517-3-david@redhat.com>
Patchwork-id: 78532
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 2/2] redhat: remove manual max_cpus limitations for ppc
Bugzilla: 1527449
RH-Acked-by: David Gibson <dgibson@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
Upstream-status: n/a
RH-Author: Andrew Jones <drjones@redhat.com>
Message-id: <1390301212-15344-1-git-send-email-drjones@redhat.com>
Patchwork-id: 56862
O-Subject: [RHEL7.0 qemu-kvm PATCH v6] use recommended max vcpu count
Bugzilla: 998708
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
The recommended vcpu max limit (KVM_CAP_NR_VCPUS) should be used instead
of the actual max vcpu limit (KVM_CAP_MAX_VCPUS) to give an error.
This commit matches the limit to current KVM_CAP_NR_VCPUS value.
---
accel/kvm/kvm-all.c | 12 ++++++++++++
vl.c | 19 +++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index ffee68e..3f1c06e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1587,6 +1587,18 @@ static int kvm_init(MachineState *ms)
soft_vcpus_limit = kvm_recommended_vcpus(s);
hard_vcpus_limit = kvm_max_vcpus(s);
+#ifdef HOST_PPC64
+ /*
+ * On POWER, the kernel advertises a soft limit based on the
+ * number of CPU threads on the host. We want to allow exceeding
+ * this for testing purposes, so we don't want to set hard limit
+ * to soft limit as on x86.
+ */
+#else
+ /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */
+ hard_vcpus_limit = soft_vcpus_limit;
+#endif
+
while (nc->name) {
if (nc->num > soft_vcpus_limit) {
warn_report("Number of %s cpus requested (%d) exceeds "
diff --git a/vl.c b/vl.c
index 8c89bee..ce7d04d 100644
--- a/vl.c
+++ b/vl.c
@@ -135,6 +135,8 @@ int main(int argc, char **argv)
#define MAX_VIRTIO_CONSOLES 1
#define MAX_SCLP_CONSOLES 1
+#define RHEL_MAX_CPUS 384
+
static const char *data_dir[16];
static int data_dir_idx;
const char *bios_name = NULL;
@@ -1520,6 +1522,20 @@ MachineClass *find_default_machine(void)
return mc;
}
+/* Maximum number of CPUs limited for Red Hat Enterprise Linux */
+static void limit_max_cpus_in_machines(void)
+{
+ GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
+
+ for (el = machines; el; el = el->next) {
+ MachineClass *mc = el->data;
+
+ if (mc->max_cpus > RHEL_MAX_CPUS) {
+ mc->max_cpus = RHEL_MAX_CPUS;
+ }
+ }
+}
+
MachineInfoList *qmp_query_machines(Error **errp)
{
GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
@@ -4082,6 +4098,9 @@ int main(int argc, char **argv, char **envp)
replay_configure(icount_opts);
+ /* Maximum number of CPUs limited for Red Hat Enterprise Linux */
+ limit_max_cpus_in_machines();
+
machine_class = select_machine();
set_memory_options(&ram_slots, &maxram_size, machine_class);
--
1.8.3.1

View File

@ -0,0 +1,118 @@
From e10de328869f0b7b990b74863111c172fb45d7a4 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 8 Oct 2015 09:50:17 +0200
Subject: Add support for simpletrace
As simpletrace is upstream, we just need to properly handle it during rpmbuild.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Rebase notes (2.9.0):
- Added group argument for tracetool.py (upstream)
Rebase notes (2.8.0):
- Changed tracetool.py parameters
Merged patches (2.3.0):
- db959d6 redhat/qemu-kvm.spec.template: Install qemu-kvm-simpletrace.stp
- 5292fc3 trace: add SystemTap init scripts for simpletrace bridge
- eda9e5e simpletrace: install simpletrace.py
- 85c4c8f trace: add systemtap-initscript README file to RPM
(cherry picked from commit bfc1d7f3628f2ffbabbae71d57a506cea6663ddf)
---
.gitignore | 2 ++
Makefile | 4 +++
README.systemtap | 43 +++++++++++++++++++++++++++++++++
redhat/qemu-kvm.spec.template | 27 +++++++++++++++++++--
scripts/systemtap/conf.d/qemu_kvm.conf | 4 +++
scripts/systemtap/script.d/qemu_kvm.stp | 1 +
6 files changed, 79 insertions(+), 2 deletions(-)
create mode 100644 README.systemtap
create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf
create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp
diff --git a/Makefile b/Makefile
index 89ba4c5..d0a848e 100644
--- a/Makefile
+++ b/Makefile
@@ -864,6 +864,10 @@ endif
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
done
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/script.d"
+ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/script.d/qemu_kvm.stp "$(DESTDIR)$(qemu_datadir)/systemtap/script.d/"
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d"
+ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/conf.d/qemu_kvm.conf "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d/"
for d in $(TARGET_DIRS); do \
$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
done
diff --git a/README.systemtap b/README.systemtap
new file mode 100644
index 0000000..ad913fc
--- /dev/null
+++ b/README.systemtap
@@ -0,0 +1,43 @@
+QEMU tracing using systemtap-initscript
+---------------------------------------
+
+You can capture QEMU trace data all the time using systemtap-initscript. This
+uses SystemTap's flight recorder mode to trace all running guests to a
+fixed-size buffer on the host. Old trace entries are overwritten by new
+entries when the buffer size wraps.
+
+1. Install the systemtap-initscript package:
+ # yum install systemtap-initscript
+
+2. Install the systemtap scripts and the conf file:
+ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
+ # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
+
+The set of trace events to enable is given in qemu_kvm.stp. This SystemTap
+script can be customized to add or remove trace events provided in
+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
+
+SystemTap customizations can be made to qemu_kvm.conf to control the flight
+recorder buffer size and whether to store traces in memory only or disk too.
+See stap(1) for option documentation.
+
+3. Start the systemtap service.
+ # service systemtap start qemu_kvm
+
+4. Make the service start at boot time.
+ # chkconfig systemtap on
+
+5. Confirm that the service works.
+ # service systemtap status qemu_kvm
+ qemu_kvm is running...
+
+When you want to inspect the trace buffer, perform the following steps:
+
+1. Dump the trace buffer.
+ # staprun -A qemu_kvm >/tmp/trace.log
+
+2. Start the systemtap service because the preceding step stops the service.
+ # service systemtap start qemu_kvm
+
+3. Translate the trace record to readable format.
+ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf
new file mode 100644
index 0000000..372d816
--- /dev/null
+++ b/scripts/systemtap/conf.d/qemu_kvm.conf
@@ -0,0 +1,4 @@
+# Force load uprobes (see BZ#1118352)
+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true
+
+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes
diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp
new file mode 100644
index 0000000..c04abf9
--- /dev/null
+++ b/scripts/systemtap/script.d/qemu_kvm.stp
@@ -0,0 +1 @@
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
--
1.8.3.1

View File

@ -0,0 +1,943 @@
From 9d7996484c665193e02927bb76ba93c84efb273f Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Fri, 14 Nov 2014 08:51:50 +0100
Subject: Use qemu-kvm in documentation instead of qemu-system-<arch>
Patchwork-id: 62380
O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCHv4] Use qemu-kvm in documentation instead of qemu-system-i386
Bugzilla: 1140620
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
We change the name and location of qemu-kvm binaries. Update documentation
to reflect this change. Only architectures available in RHEL are updated.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Rebase Notes (2.12.0):
- Additional fixes included
Rebase Notes (2.11.0):
- Fixing docs/qemu-block-drivers.texi
Rebase Notes (2.10.0):
- Changed patch name and updated commit message.
Rebase Notes (2.9.0):
- fixed chunks missed on 2.8 rebase
(cherry picked from commit 1c2dac56d5e710faebe25b7aa9cac594ec0f9d4b)
(cherry picked from commit dfa2037d390047a7d7c7b13f779443bfc6c3709d)
Conflicts:
qemu-options.hx
(cherry picked from commit c7985367ba8258c99526549ab94ef066ae52da14)
Conflicts:
qemu-options.hx
(cherry picked from commit e7dc2155506c1ead844f1faef85e5f71bc2adf9e)
---
docs/can.txt | 10 +--
docs/pr-manager.rst | 4 +-
docs/qemu-block-drivers.texi | 70 ++++++++++-----------
docs/replay.txt | 4 +-
docs/specs/tpm.txt | 4 +-
qemu-doc.texi | 40 ++++++------
qemu-options.hx | 144 ++++++++++++++++++++++---------------------
7 files changed, 140 insertions(+), 136 deletions(-)
diff --git a/docs/can.txt b/docs/can.txt
index a357105..0c0fc11 100644
--- a/docs/can.txt
+++ b/docs/can.txt
@@ -50,9 +50,9 @@ CAN boards can be selected
The ''kvaser_pci'' board/device model is compatible with and has been tested with
''kvaser_pci'' driver included in mainline Linux kernel.
The tested setup was Linux 4.9 kernel on the host and guest side.
-Example for qemu-system-x86_64:
+Example for qemu-kvm (intel architecture):
- qemu-system-x86_64 -enable-kvm -kernel /boot/vmlinuz-4.9.0-4-amd64 \
+ qemu-kvm -enable-kvm -kernel /boot/vmlinuz-4.9.0-4-amd64 \
-initrd ramdisk.cpio \
-virtfs local,path=shareddir,security_model=none,mount_tag=shareddir \
-object can-bus,id=canbus0 \
@@ -60,9 +60,9 @@ Example for qemu-system-x86_64:
-device kvaser_pci,canbus=canbus0 \
-nographic -append "console=ttyS0"
-Example for qemu-system-arm:
+Example for qemu-kvm (arm architecture):
- qemu-system-arm -cpu arm1176 -m 256 -M versatilepb \
+ qemu-kvm -cpu arm1176 -m 256 -M versatilepb \
-kernel kernel-qemu-arm1176-versatilepb \
-hda rpi-wheezy-overlay \
-append "console=ttyAMA0 root=/dev/sda2 ro init=/sbin/init-overlay" \
@@ -104,4 +104,4 @@ Links to other resources
Slides
http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can-slides.pdf
(5) Linux SocketCAN utilities
- https://github.com/linux-can/can-utils/
\ No newline at end of file
+ https://github.com/linux-can/can-utils/
diff --git a/docs/pr-manager.rst b/docs/pr-manager.rst
index 9b1de19..45cb8be 100644
--- a/docs/pr-manager.rst
+++ b/docs/pr-manager.rst
@@ -36,7 +36,7 @@ accepts the path to the helper program's Unix socket. For example,
the following command line defines a ``pr-manager-helper`` object and
attaches it to a SCSI passthrough device::
- $ qemu-system-x86_64
+ $ qemu-kvm
-device virtio-scsi \
-object pr-manager-helper,id=helper0,path=/var/run/qemu-pr-helper.sock
-drive if=none,id=hd,driver=raw,file.filename=/dev/sdb,file.pr-manager=helper0
@@ -44,7 +44,7 @@ attaches it to a SCSI passthrough device::
Alternatively, using ``-blockdev``::
- $ qemu-system-x86_64
+ $ qemu-kvm
-device virtio-scsi \
-object pr-manager-helper,id=helper0,path=/var/run/qemu-pr-helper.sock
-blockdev node-name=hd,driver=raw,file.driver=host_device,file.filename=/dev/sdb,file.pr-manager=helper0
diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi
index f179369..e0d752a 100644
--- a/docs/qemu-block-drivers.texi
+++ b/docs/qemu-block-drivers.texi
@@ -405,7 +405,7 @@ QEMU can automatically create a virtual FAT disk image from a
directory tree. In order to use it, just type:
@example
-qemu-system-i386 linux.img -hdb fat:/my_directory
+qemu-kvm linux.img -hdb fat:/my_directory
@end example
Then you access access to all the files in the @file{/my_directory}
@@ -415,14 +415,14 @@ them via SAMBA or NFS. The default access is @emph{read-only}.
Floppies can be emulated with the @code{:floppy:} option:
@example
-qemu-system-i386 linux.img -fda fat:floppy:/my_directory
+qemu-kvm linux.img -fda fat:floppy:/my_directory
@end example
A read/write support is available for testing (beta stage) with the
@code{:rw:} option:
@example
-qemu-system-i386 linux.img -fda fat:floppy:rw:/my_directory
+qemu-kvm linux.img -fda fat:floppy:rw:/my_directory
@end example
What you should @emph{never} do:
@@ -440,14 +440,14 @@ QEMU can access directly to block device exported using the Network Block Device
protocol.
@example
-qemu-system-i386 linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
+qemu-kvm linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
@end example
If the NBD server is located on the same host, you can use an unix socket instead
of an inet socket:
@example
-qemu-system-i386 linux.img -hdb nbd+unix://?socket=/tmp/my_socket
+qemu-kvm linux.img -hdb nbd+unix://?socket=/tmp/my_socket
@end example
In this case, the block device must be exported using qemu-nbd:
@@ -464,23 +464,23 @@ qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
@noindent
and then you can use it with two guests:
@example
-qemu-system-i386 linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
-qemu-system-i386 linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
+qemu-kvm linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
+qemu-kvm linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
@end example
If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's
own embedded NBD server), you must specify an export name in the URI:
@example
-qemu-system-i386 -cdrom nbd://localhost/debian-500-ppc-netinst
-qemu-system-i386 -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
+qemu-kvm -cdrom nbd://localhost/debian-500-ppc-netinst
+qemu-kvm -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
@end example
The URI syntax for NBD is supported since QEMU 1.3. An alternative syntax is
also available. Here are some example of the older syntax:
@example
-qemu-system-i386 linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
-qemu-system-i386 linux2.img -hdb nbd:unix:/tmp/my_socket
-qemu-system-i386 -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
+qemu-kvm linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
+qemu-kvm linux2.img -hdb nbd:unix:/tmp/my_socket
+qemu-kvm -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
@end example
@node disk_images_sheepdog
@@ -505,7 +505,7 @@ qemu-img convert @var{filename} sheepdog:///@var{image}
You can boot from the Sheepdog disk image with the command:
@example
-qemu-system-i386 sheepdog:///@var{image}
+qemu-kvm sheepdog:///@var{image}
@end example
You can also create a snapshot of the Sheepdog image like qcow2.
@@ -517,7 +517,7 @@ where @var{tag} is a tag name of the newly created snapshot.
To boot from the Sheepdog snapshot, specify the tag name of the
snapshot.
@example
-qemu-system-i386 sheepdog:///@var{image}#@var{tag}
+qemu-kvm sheepdog:///@var{image}#@var{tag}
@end example
You can create a cloned image from the existing snapshot.
@@ -530,14 +530,14 @@ is its tag name.
You can use an unix socket instead of an inet socket:
@example
-qemu-system-i386 sheepdog+unix:///@var{image}?socket=@var{path}
+qemu-kvm sheepdog+unix:///@var{image}?socket=@var{path}
@end example
If the Sheepdog daemon doesn't run on the local host, you need to
specify one of the Sheepdog servers to connect to.
@example
qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size}
-qemu-system-i386 sheepdog://@var{hostname}:@var{port}/@var{image}
+qemu-kvm sheepdog://@var{hostname}:@var{port}/@var{image}
@end example
@node disk_images_iscsi
@@ -627,7 +627,7 @@ cat >iscsi.conf <<EOF
header-digest = "CRC32C"
EOF
-qemu-system-i386 -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
+qemu-kvm -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
-readconfig iscsi.conf
@end example
@@ -646,7 +646,7 @@ tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
-b /IMAGES/cd.iso --device-type=cd
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
-qemu-system-i386 -iscsi initiator-name=iqn.qemu.test:my-initiator \
+qemu-kvm -iscsi initiator-name=iqn.qemu.test:my-initiator \
-boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
-cdrom iscsi://127.0.0.1/iqn.qemu.test/2
@end example
@@ -659,11 +659,11 @@ GlusterFS is a user space distributed file system.
You can boot from the GlusterFS disk image with the command:
@example
URI:
-qemu-system-x86_64 -drive file=gluster[+@var{type}]://[@var{host}[:@var{port}]]/@var{volume}/@var{path}
+qemu-kvm -drive file=gluster[+@var{type}]://[@var{host}[:@var{port}]]/@var{volume}/@var{path}
[?socket=...][,file.debug=9][,file.logfile=...]
JSON:
-qemu-system-x86_64 'json:@{"driver":"qcow2",
+qemu-kvm 'json:@{"driver":"qcow2",
"file":@{"driver":"gluster",
"volume":"testvol","path":"a.img","debug":9,"logfile":"...",
"server":[@{"type":"tcp","host":"...","port":"..."@},
@@ -711,22 +711,22 @@ qemu-img create gluster://@var{host}/@var{volume}/@var{path} @var{size}
Examples
@example
-qemu-system-x86_64 -drive file=gluster://1.2.3.4/testvol/a.img
-qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4/testvol/a.img
-qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
-qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
-qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
-qemu-system-x86_64 -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
-qemu-system-x86_64 -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
-qemu-system-x86_64 -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
-qemu-system-x86_64 -drive file=gluster://1.2.3.4/testvol/a.img,file.debug=9,file.logfile=/var/log/qemu-gluster.log
-qemu-system-x86_64 'json:@{"driver":"qcow2",
+qemu-kvm -drive file=gluster://1.2.3.4/testvol/a.img
+qemu-kvm -drive file=gluster+tcp://1.2.3.4/testvol/a.img
+qemu-kvm -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
+qemu-kvm -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
+qemu-kvm -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
+qemu-kvm -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
+qemu-kvm -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
+qemu-kvm -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
+qemu-kvm -drive file=gluster://1.2.3.4/testvol/a.img,file.debug=9,file.logfile=/var/log/qemu-gluster.log
+qemu-kvm 'json:@{"driver":"qcow2",
"file":@{"driver":"gluster",
"volume":"testvol","path":"a.img",
"debug":9,"logfile":"/var/log/qemu-gluster.log",
"server":[@{"type":"tcp","host":"1.2.3.4","port":24007@},
@{"type":"unix","socket":"/var/run/glusterd.socket"@}]@}@}'
-qemu-system-x86_64 -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
+qemu-kvm -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
file.debug=9,file.logfile=/var/log/qemu-gluster.log,
file.server.0.type=tcp,file.server.0.host=1.2.3.4,file.server.0.port=24007,
file.server.1.type=unix,file.server.1.socket=/var/run/glusterd.socket
@@ -739,13 +739,13 @@ You can access disk images located on a remote ssh server
by using the ssh protocol:
@example
-qemu-system-x86_64 -drive file=ssh://[@var{user}@@]@var{server}[:@var{port}]/@var{path}[?host_key_check=@var{host_key_check}]
+qemu-kvm -drive file=ssh://[@var{user}@@]@var{server}[:@var{port}]/@var{path}[?host_key_check=@var{host_key_check}]
@end example
Alternative syntax using properties:
@example
-qemu-system-x86_64 -drive file.driver=ssh[,file.user=@var{user}],file.host=@var{server}[,file.port=@var{port}],file.path=@var{path}[,file.host_key_check=@var{host_key_check}]
+qemu-kvm -drive file.driver=ssh[,file.user=@var{user}],file.host=@var{server}[,file.port=@var{port}],file.path=@var{path}[,file.host_key_check=@var{host_key_check}]
@end example
@var{ssh} is the protocol.
@@ -808,13 +808,13 @@ driver. For example:
# echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
# echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
-# qemu-system-x86_64 -drive file=nvme://@var{host}:@var{bus}:@var{slot}.@var{func}/@var{namespace}
+# qemu-kvm -drive file=nvme://@var{host}:@var{bus}:@var{slot}.@var{func}/@var{namespace}
@end example
Alternative syntax using properties:
@example
-qemu-system-x86_64 -drive file.driver=nvme,file.device=@var{host}:@var{bus}:@var{slot}.@var{func},file.namespace=@var{namespace}
+qemu-kvm -drive file.driver=nvme,file.device=@var{host}:@var{bus}:@var{slot}.@var{func},file.namespace=@var{namespace}
@end example
@var{host}:@var{bus}:@var{slot}.@var{func} is the NVMe controller's PCI device
diff --git a/docs/replay.txt b/docs/replay.txt
index 2e21e9c..f1923e8 100644
--- a/docs/replay.txt
+++ b/docs/replay.txt
@@ -25,7 +25,7 @@ Deterministic replay has the following features:
Usage of the record/replay:
* First, record the execution with the following command line:
- qemu-system-i386 \
+ qemu-kvm \
-icount shift=7,rr=record,rrfile=replay.bin \
-drive file=disk.qcow2,if=none,id=img-direct \
-drive driver=blkreplay,if=none,image=img-direct,id=img-blkreplay \
@@ -33,7 +33,7 @@ Usage of the record/replay:
-netdev user,id=net1 -device rtl8139,netdev=net1 \
-object filter-replay,id=replay,netdev=net1
* After recording, you can replay it by using another command line:
- qemu-system-i386 \
+ qemu-kvm \
-icount shift=7,rr=replay,rrfile=replay.bin \
-drive file=disk.qcow2,if=none,id=img-direct \
-drive driver=blkreplay,if=none,image=img-direct,id=img-blkreplay \
diff --git a/docs/specs/tpm.txt b/docs/specs/tpm.txt
index d1d7157..897c300 100644
--- a/docs/specs/tpm.txt
+++ b/docs/specs/tpm.txt
@@ -98,7 +98,7 @@ QEMU files related to the TPM passthrough device:
Command line to start QEMU with the TPM passthrough device using the host's
hardware TPM /dev/tpm0:
-qemu-system-x86_64 -display sdl -enable-kvm \
+qemu-kvm -display vnc -enable-kvm \
-m 1024 -boot d -bios bios-256k.bin -boot menu=on \
-tpmdev passthrough,id=tpm0,path=/dev/tpm0 \
-device tpm-tis,tpmdev=tpm0 test.img
@@ -164,7 +164,7 @@ swtpm socket --tpmstate dir=/tmp/mytpm1 \
Command line to start QEMU with the TPM emulator device communicating with
the swtpm:
-qemu-system-x86_64 -display sdl -enable-kvm \
+qemu-kvm -display sdl -enable-kvm \
-m 1024 -boot d -bios bios-256k.bin -boot menu=on \
-chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm \
diff --git a/qemu-doc.texi b/qemu-doc.texi
index 5813d27..de5097a 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -203,12 +203,12 @@ Note that, by default, GUS shares IRQ(7) with parallel ports and so
QEMU must be told to not have parallel ports to have working GUS.
@example
-qemu-system-i386 dos.img -soundhw gus -parallel none
+qemu-kvm dos.img -soundhw gus -parallel none
@end example
Alternatively:
@example
-qemu-system-i386 dos.img -device gus,irq=5
+qemu-kvm dos.img -device gus,irq=5
@end example
Or some other unclaimed IRQ.
@@ -224,7 +224,7 @@ CS4231A is the chip used in Windows Sound System and GUSMAX products
Download and uncompress the linux image (@file{linux.img}) and type:
@example
-qemu-system-i386 linux.img
+qemu-kvm linux.img
@end example
Linux should boot and give you a prompt.
@@ -234,7 +234,7 @@ Linux should boot and give you a prompt.
@example
@c man begin SYNOPSIS
-@command{qemu-system-i386} [@var{options}] [@var{disk_image}]
+@command{qemu-kvm} [@var{options}] [@var{disk_image}]
@c man end
@end example
@@ -813,7 +813,7 @@ On Linux hosts, a shared memory device is available. The basic syntax
is:
@example
-qemu-system-x86_64 -device ivshmem-plain,memdev=@var{hostmem}
+qemu-kvm -device ivshmem-plain,memdev=@var{hostmem}
@end example
where @var{hostmem} names a host memory backend. For a POSIX shared
@@ -834,7 +834,7 @@ memory server is:
ivshmem-server -p @var{pidfile} -S @var{path} -m @var{shm-name} -l @var{shm-size} -n @var{vectors}
# Then start your qemu instances with matching arguments
-qemu-system-x86_64 -device ivshmem-doorbell,vectors=@var{vectors},chardev=@var{id}
+qemu-kvm -device ivshmem-doorbell,vectors=@var{vectors},chardev=@var{id}
-chardev socket,path=@var{path},id=@var{id}
@end example
@@ -859,7 +859,7 @@ Instead of specifying the <shm size> using POSIX shm, you may specify
a memory backend that has hugepage support:
@example
-qemu-system-x86_64 -object memory-backend-file,size=1G,mem-path=/dev/hugepages/my-shmem-file,share,id=mb1
+qemu-kvm -object memory-backend-file,size=1G,mem-path=/dev/hugepages/my-shmem-file,share,id=mb1
-device ivshmem-plain,memdev=mb1
@end example
@@ -875,7 +875,7 @@ kernel testing.
The syntax is:
@example
-qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
+qemu-kvm -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
@end example
Use @option{-kernel} to provide the Linux kernel image and
@@ -890,7 +890,7 @@ If you do not need graphical output, you can disable it and redirect
the virtual serial port and the QEMU monitor to the console with the
@option{-nographic} option. The typical command line is:
@example
-qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
+qemu-kvm -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
-append "root=/dev/hda console=ttyS0" -nographic
@end example
@@ -956,7 +956,7 @@ Network adapter that supports CDC ethernet and RNDIS protocols. @var{id}
specifies a netdev defined with @code{-netdev @dots{},id=@var{id}}.
For instance, user-mode networking can be used with
@example
-qemu-system-i386 [...] -netdev user,id=net0 -device usb-net,netdev=net0
+qemu-kvm [...] -netdev user,id=net0 -device usb-net,netdev=net0
@end example
@item usb-ccid
Smartcard reader device
@@ -975,7 +975,7 @@ no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}.
This USB device implements the USB Transport Layer of HCI. Example
usage:
@example
-@command{qemu-system-i386} [...@var{OPTIONS}...] @option{-usbdevice} bt:hci,vlan=3 @option{-bt} device:keyboard,vlan=3
+@command{qemu-kvm} [...@var{OPTIONS}...] @option{-usbdevice} bt:hci,vlan=3 @option{-bt} device:keyboard,vlan=3
@end example
@end table
@@ -1052,7 +1052,7 @@ For this setup it is recommended to restrict it to listen on a UNIX domain
socket only. For example
@example
-qemu-system-i386 [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc
+qemu-kvm [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc
@end example
This ensures that only users on local box with read/write access to that
@@ -1075,7 +1075,7 @@ is running the password is set with the monitor. Until the monitor is used to
set the password all clients will be rejected.
@example
-qemu-system-i386 [...OPTIONS...] -vnc :1,password -monitor stdio
+qemu-kvm [...OPTIONS...] -vnc :1,password -monitor stdio
(qemu) change vnc password
Password: ********
(qemu)
@@ -1092,7 +1092,7 @@ support provides a secure session, but no authentication. This allows any
client to connect, and provides an encrypted session.
@example
-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio
+qemu-kvm [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio
@end example
In the above example @code{/etc/pki/qemu} should contain at least three files,
@@ -1110,7 +1110,7 @@ then validate against the CA certificate. This is a good choice if deploying
in an environment with a private internal certificate authority.
@example
-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio
+qemu-kvm [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio
@end example
@@ -1121,7 +1121,7 @@ Finally, the previous method can be combined with VNC password authentication
to provide two layers of authentication for clients.
@example
-qemu-system-i386 [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio
+qemu-kvm [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio
(qemu) change vnc password
Password: ********
(qemu)
@@ -1144,7 +1144,7 @@ used for authentication, but assuming use of one supporting SSF,
then QEMU can be launched with:
@example
-qemu-system-i386 [...OPTIONS...] -vnc :1,sasl -monitor stdio
+qemu-kvm [...OPTIONS...] -vnc :1,sasl -monitor stdio
@end example
@node vnc_sec_certificate_sasl
@@ -1158,7 +1158,7 @@ credentials. This can be enabled, by combining the 'sasl' option
with the aforementioned TLS + x509 options:
@example
-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio
+qemu-kvm [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio
@end example
@node vnc_setup_sasl
@@ -1514,7 +1514,7 @@ QEMU has a primitive support to work with gdb, so that you can do
In order to use gdb, launch QEMU with the '-s' option. It will wait for a
gdb connection:
@example
-qemu-system-i386 -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
+qemu-kvm -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
-append "root=/dev/hda"
Connected to host network interface: tun0
Waiting gdb connection on port 1234
@@ -1760,7 +1760,7 @@ Set the initial VGA graphic mode. The default is 800x600x32.
Set OpenBIOS variables in NVRAM, for example:
@example
-qemu-system-ppc -prom-env 'auto-boot?=false' \
+qemu-kvm -prom-env 'auto-boot?=false' \
-prom-env 'boot-device=hd:2,\yaboot' \
-prom-env 'boot-args=conf=hd:2,\yaboot.conf'
@end example
diff --git a/qemu-options.hx b/qemu-options.hx
index 2042dba..43f10b1 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -263,7 +263,7 @@ This option defines a free-form string that can be used to describe @var{fd}.
You can open an image using pre-opened file descriptors from an fd set:
@example
-qemu-system-i386
+qemu-kvm
-add-fd fd=3,set=2,opaque="rdwr:/path/to/file"
-add-fd fd=4,set=2,opaque="rdonly:/path/to/file"
-drive file=/dev/fdset/2,index=0,media=disk
@@ -292,7 +292,7 @@ STEXI
Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.:
@example
-qemu-system-i386 -global ide-hd.physical_block_size=4096 disk-image.img
+qemu-kvm -global ide-hd.physical_block_size=4096 disk-image.img
@end example
In particular, you can use this to set driver properties for devices which are
@@ -346,11 +346,11 @@ bootindex options. The default is non-strict boot.
@example
# try to boot from network first, then from hard disk
-qemu-system-i386 -boot order=nc
+qemu-kvm -boot order=nc
# boot from CD-ROM first, switch back to default order after reboot
-qemu-system-i386 -boot once=d
+qemu-kvm -boot once=d
# boot with a splash picture for 5 seconds.
-qemu-system-i386 -boot menu=on,splash=/root/boot.bmp,splash-time=5000
+qemu-kvm -boot menu=on,splash=/root/boot.bmp,splash-time=5000
@end example
Note: The legacy format '-boot @var{drives}' is still supported but its
@@ -379,7 +379,7 @@ For example, the following command-line sets the guest startup RAM size to
memory the guest can reach to 4GB:
@example
-qemu-system-x86_64 -m 1G,slots=3,maxmem=4G
+qemu-kvm -m 1G,slots=3,maxmem=4G
@end example
If @var{slots} and @var{maxmem} are not specified, memory hotplug won't
@@ -448,12 +448,12 @@ Enable audio and selected sound hardware. Use 'help' to print all
available sound hardware.
@example
-qemu-system-i386 -soundhw sb16,adlib disk.img
-qemu-system-i386 -soundhw es1370 disk.img
-qemu-system-i386 -soundhw ac97 disk.img
-qemu-system-i386 -soundhw hda disk.img
-qemu-system-i386 -soundhw all disk.img
-qemu-system-i386 -soundhw help
+qemu-kvm -soundhw sb16,adlib disk.img
+qemu-kvm -soundhw es1370 disk.img
+qemu-kvm -soundhw ac97 disk.img
+qemu-kvm -soundhw hda disk.img
+qemu-kvm -soundhw all disk.img
+qemu-kvm -soundhw help
@end example
Note that Linux's i810_audio OSS kernel (for AC97) module might
@@ -946,21 +946,21 @@ is off.
Instead of @option{-cdrom} you can use:
@example
-qemu-system-i386 -drive file=file,index=2,media=cdrom
+qemu-kvm -drive file=file,index=2,media=cdrom
@end example
Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you can
use:
@example
-qemu-system-i386 -drive file=file,index=0,media=disk
-qemu-system-i386 -drive file=file,index=1,media=disk
-qemu-system-i386 -drive file=file,index=2,media=disk
-qemu-system-i386 -drive file=file,index=3,media=disk
+qemu-kvm -drive file=file,index=0,media=disk
+qemu-kvm -drive file=file,index=1,media=disk
+qemu-kvm -drive file=file,index=2,media=disk
+qemu-kvm -drive file=file,index=3,media=disk
@end example
You can open an image using pre-opened file descriptors from an fd set:
@example
-qemu-system-i386
+qemu-kvm
-add-fd fd=3,set=2,opaque="rdwr:/path/to/file"
-add-fd fd=4,set=2,opaque="rdonly:/path/to/file"
-drive file=/dev/fdset/2,index=0,media=disk
@@ -968,28 +968,28 @@ qemu-system-i386
You can connect a CDROM to the slave of ide0:
@example
-qemu-system-i386 -drive file=file,if=ide,index=1,media=cdrom
+qemu-kvm -drive file=file,if=ide,index=1,media=cdrom
@end example
If you don't specify the "file=" argument, you define an empty drive:
@example
-qemu-system-i386 -drive if=ide,index=1,media=cdrom
+qemu-kvm -drive if=ide,index=1,media=cdrom
@end example
Instead of @option{-fda}, @option{-fdb}, you can use:
@example
-qemu-system-i386 -drive file=file,index=0,if=floppy
-qemu-system-i386 -drive file=file,index=1,if=floppy
+qemu-kvm -drive file=file,index=0,if=floppy
+qemu-kvm -drive file=file,index=1,if=floppy
@end example
By default, @var{interface} is "ide" and @var{index} is automatically
incremented:
@example
-qemu-system-i386 -drive file=a -drive file=b"
+qemu-kvm -drive file=a -drive file=b"
@end example
is interpreted like:
@example
-qemu-system-i386 -hda a -hdb b
+qemu-kvm -hda a -hdb b
@end example
ETEXI
@@ -2056,8 +2056,8 @@ The following two example do exactly the same, to show how @option{-nic} can
be used to shorten the command line length (note that the e1000 is the default
on i386, so the @option{model=e1000} parameter could even be omitted here, too):
@example
-qemu-system-i386 -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
-qemu-system-i386 -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
+qemu-kvm -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
+qemu-kvm -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
@end example
@item -nic none
@@ -2128,7 +2128,7 @@ can not be resolved.
Example:
@example
-qemu-system-i386 -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
+qemu-kvm -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
@end example
@item tftp=@var{dir}
@@ -2144,7 +2144,7 @@ a guest from a local directory.
Example (using pxelinux):
@example
-qemu-system-i386 -hda linux.img -boot n -device e1000,netdev=n1 \
+qemu-kvm -hda linux.img -boot n -device e1000,netdev=n1 \
-netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
@end example
@@ -2178,7 +2178,7 @@ screen 0, use the following:
@example
# on the host
-qemu-system-i386 -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
+qemu-kvm -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
# this host xterm should open in the guest X11 server
xterm -display :1
@end example
@@ -2188,7 +2188,7 @@ the guest, use the following:
@example
# on the host
-qemu-system-i386 -nic user,hostfwd=tcp::5555-:23
+qemu-kvm -nic user,hostfwd=tcp::5555-:23
telnet localhost 5555
@end example
@@ -2207,7 +2207,7 @@ lifetime, like in the following example:
@example
# open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
# the guest accesses it
-qemu-system-i386 -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
+qemu-kvm -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
@end example
Or you can execute a command on every TCP connection established by the guest,
@@ -2216,7 +2216,7 @@ so that QEMU behaves similar to an inetd process for that virtual server:
@example
# call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
# and connect the TCP stream to its stdin/stdout
-qemu-system-i386 -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
+qemu-kvm -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
@end example
@end table
@@ -2248,21 +2248,22 @@ Examples:
@example
#launch a QEMU instance with the default network script
-qemu-system-i386 linux.img -nic tap
+qemu-kvm linux.img -nic tap
@end example
@example
#launch a QEMU instance with two NICs, each one connected
#to a TAP device
-qemu-system-i386 linux.img \
+qemu-kvm linux.img \
-netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
-netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
+ -net nic,vlan=1 -net tap,vlan=1,ifname=tap1
@end example
@example
#launch a QEMU instance with the default network helper to
#connect a TAP device to bridge br0
-qemu-system-i386 linux.img -device virtio-net-pci,netdev=n1 \
+qemu-kvm linux.img -device virtio-net-pci,netdev=n1 \
-netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
@end example
@@ -2279,13 +2280,13 @@ Examples:
@example
#launch a QEMU instance with the default network helper to
#connect a TAP device to bridge br0
-qemu-system-i386 linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
+qemu-kvm linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
@end example
@example
#launch a QEMU instance with the default network helper to
#connect a TAP device to bridge qemubr0
-qemu-system-i386 linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
+qemu-kvm linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
@end example
@item -netdev socket,id=@var{id}[,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}]
@@ -2300,13 +2301,13 @@ specifies an already opened TCP socket.
Example:
@example
# launch a first QEMU instance
-qemu-system-i386 linux.img \
- -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
- -netdev socket,id=n1,listen=:1234
+qemu-kvm linux.img \
+ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
+ -netdev socket,id=n1,listen=:1234
# connect the network of this instance to the network of the first instance
-qemu-system-i386 linux.img \
- -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
- -netdev socket,id=n2,connect=127.0.0.1:1234
+qemu-kvm linux.img \
+ -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
+ -netdev socket,id=n2,connect=127.0.0.1:1234
@end example
@item -netdev socket,id=@var{id}[,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]]
@@ -2329,23 +2330,23 @@ Use @option{fd=h} to specify an already opened UDP multicast socket.
Example:
@example
# launch one QEMU instance
-qemu-system-i386 linux.img \
- -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
- -netdev socket,id=n1,mcast=230.0.0.1:1234
+qemu-kvm linux.img \
+ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
+ -netdev socket,id=n1,mcast=230.0.0.1:1234
# launch another QEMU instance on same "bus"
-qemu-system-i386 linux.img \
- -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
- -netdev socket,id=n2,mcast=230.0.0.1:1234
+qemu-kvm linux.img \
+ -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
+ -netdev socket,id=n2,mcast=230.0.0.1:1234
# launch yet another QEMU instance on same "bus"
-qemu-system-i386 linux.img \
- -device e1000,netdev=n3,macaddr=52:54:00:12:34:58 \
- -netdev socket,id=n3,mcast=230.0.0.1:1234
+qemu-kvm linux.img \
+ -device e1000,netdev=n3,macaddr=52:54:00:12:34:58 \
+ -netdev socket,id=n3,mcast=230.0.0.1:1234
@end example
Example (User Mode Linux compat.):
@example
# launch QEMU instance (note mcast address selected is UML's default)
-qemu-system-i386 linux.img \
+qemu-kvm linux.img \
-device e1000,netdev=n1,mac=52:54:00:12:34:56 \
-netdev socket,id=n1,mcast=239.192.168.1:1102
# launch UML
@@ -2354,9 +2355,12 @@ qemu-system-i386 linux.img \
Example (send packets from host's 1.2.3.4):
@example
-qemu-system-i386 linux.img \
- -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
- -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
+qemu-kvm linux.img \
+ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
+ -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
+qemu-kvm linux.img \
+ -net nic,macaddr=52:54:00:12:34:56 \
+ -net socket,mcast=239.192.168.1:1102,localaddr=1.2.3.4
@end example
@item -netdev l2tpv3,id=@var{id},src=@var{srcaddr},dst=@var{dstaddr}[,srcport=@var{srcport}][,dstport=@var{dstport}],txsession=@var{txsession}[,rxsession=@var{rxsession}][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=@var{txcookie}][,rxcookie=@var{rxcookie}][,offset=@var{offset}]
@@ -2414,7 +2418,7 @@ brctl addif br-lan vmtunnel0
# on 4.3.2.1
# launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
-qemu-system-i386 linux.img -device e1000,netdev=n1 \
+qemu-kvm linux.img -device e1000,netdev=n1 \
-netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
@end example
@@ -2431,7 +2435,7 @@ Example:
# launch vde switch
vde_switch -F -sock /tmp/myswitch
# launch QEMU instance
-qemu-system-i386 linux.img -nic vde,sock=/tmp/myswitch
+qemu-kvm linux.img -nic vde,sock=/tmp/myswitch
@end example
@item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
@@ -2445,11 +2449,11 @@ be created for multiqueue vhost-user.
Example:
@example
-qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
- -numa node,memdev=mem \
- -chardev socket,id=chr0,path=/path/to/socket \
- -netdev type=vhost-user,id=net0,chardev=chr0 \
- -device virtio-net-pci,netdev=net0
+qemu-kvm -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
+ -numa node,memdev=mem \
+ -chardev socket,id=chr0,path=/path/to/socket \
+ -netdev type=vhost-user,id=net0,chardev=chr0 \
+ -device virtio-net-pci,netdev=net0
@end example
@item -netdev hubport,id=@var{id},hubid=@var{hubid}[,netdev=@var{nd}]
@@ -2879,7 +2883,7 @@ and communicate. Requires the Linux @code{vhci} driver installed. Can
be used as following:
@example
-qemu-system-i386 [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5
+qemu-kvm [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5
@end example
@item -bt device:@var{dev}[,vlan=@var{n}]
@@ -3310,14 +3314,14 @@ ETEXI
DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
"-realtime [mlock=on|off]\n"
- " run qemu with realtime features\n"
+ " run qemu-kvm with realtime features\n"
" mlock=on|off controls mlock support (default: on)\n",
QEMU_ARCH_ALL)
STEXI
@item -realtime mlock=on|off
@findex -realtime
-Run qemu with realtime features.
-mlocking qemu and guest memory can be enabled via @option{mlock=on}
+Run qemu-kvm with realtime features.
+mlocking qemu-kvm and guest memory can be enabled via @option{mlock=on}
(enabled by default).
ETEXI
@@ -3331,7 +3335,7 @@ connections will likely be TCP-based, but also UDP, pseudo TTY, or even
stdio are reasonable use case. The latter is allowing to start QEMU from
within gdb and establish the connection via a pipe:
@example
-(gdb) target remote | exec qemu-system-i386 -gdb stdio ...
+(gdb) target remote | exec qemu-kvm -gdb stdio ...
@end example
ETEXI
@@ -4251,7 +4255,7 @@ which specify the queue number of cryptodev backend, the default of
@example
- # qemu-system-x86_64 \
+ # qemu-kvm \
[...] \
-object cryptodev-backend-builtin,id=cryptodev0 \
-device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
@@ -4271,7 +4275,7 @@ of cryptodev backend for multiqueue vhost-user, the default of @var{queues} is 1
@example
- # qemu-system-x86_64 \
+ # qemu-kvm \
[...] \
-chardev socket,id=chardev0,path=/path/to/socket \
-object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
--
1.8.3.1

View File

@ -0,0 +1,95 @@
From b4b549d6ab0d43ca16d492aa1b6ac75a0f880942 Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Date: Fri, 5 May 2017 19:06:14 +0200
Subject: usb-xhci: Fix PCI capability order
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: <20170505190614.15987-2-dgilbert@redhat.com>
Patchwork-id: 75038
O-Subject: [RHEL-7.4 qemu-kvm-rhev PATCH 1/1] usb-xhci: Fix PCI capability order
Bugzilla: 1447874
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Upstream commit 1108b2f8a9 in 2.7.0 changed the order
of the PCI capability chain in the XHCI pci device in the case
where the device has the PCIe endpoint capability (i.e. only
older machine types, pc-i440fx-2.0 upstream, pc-i440fx-rhel7.0.0
apparently for us).
Changing the order breaks migration compatibility; fixing this
upstream would mean breaking the same case going from 2.7.0->current
that currently works 2.7.0->2.9.0 - so upstream it's a choice
of two breakages.
Since we never released 2.7.0/2.8.0 we can fix this downstream.
This reverts the order so that we create the capabilities in the
order:
PCIe
MSI
MSI-X
The symptom is:
qemu-kvm: get_pci_config_device: Bad config data: i=0x71 read: a0 device: 0 cmask: ff wmask: 0 w1cmask:0
qemu-kvm: Failed to load PCIDevice:config
qemu-kvm: Failed to load xhci:parent_obj
qemu-kvm: error while loading state for instance 0x0 of device '0000:00:0d.0/xhci'
qemu-kvm: load of migration failed: Invalid argument
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
--
Rebase notes (2.9.0):
- Change in assert condition (upstream)
(cherry picked from commit aad727a5ecde1ad4935eb8427604d4df5a1f1f35)
(cherry picked from commit 2dd7402227e77d748a7375233ac9e7feab244bda)
Conflicts:
hw/usb/hcd-xhci.c
(cherry picked from commit a42f86dc906cc7d2c16d02bf125ed76847b469cb)
(cherry picked from commit 992ab2e4f6e15d3e51bc716763aa8d6f45c6d29d)
---
hw/usb/hcd-xhci.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 883141f..181e803 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3368,6 +3368,12 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp)
xhci->max_pstreams_mask = 0;
}
+ if (pci_bus_is_express(pci_get_bus(dev)) ||
+ xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
+ ret = pcie_endpoint_cap_init(dev, 0xa0);
+ assert(ret > 0);
+ }
+
if (xhci->msi != ON_OFF_AUTO_OFF) {
ret = msi_init(dev, 0x70, xhci->numintrs, true, false, &err);
/* Any error other than -ENOTSUP(board's MSI support is broken)
@@ -3416,12 +3422,6 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp)
PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64,
&xhci->mem);
- if (pci_bus_is_express(pci_get_bus(dev)) ||
- xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
- ret = pcie_endpoint_cap_init(dev, 0xa0);
- assert(ret > 0);
- }
-
if (xhci->msix != ON_OFF_AUTO_OFF) {
/* TODO check for errors, and should fail when msix=on */
msix_init(dev, xhci->numintrs,
--
1.8.3.1

View File

@ -0,0 +1,69 @@
From 4ae8dc3b7a9a1c24380d68d8babd20f66dc0e368 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Wed, 14 Jun 2017 15:37:01 +0200
Subject: virtio-scsi: Reject scsi-cd if data plane enabled [RHEL only]
RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <20170614153701.14757-1-famz@redhat.com>
Patchwork-id: 75613
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH v3] virtio-scsi: Reject scsi-cd if data plane enabled [RHEL only]
Bugzilla: 1378816
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
We need a fix for RHEL 7.4 and 7.3.z, but unfortunately upstream isn't
ready. If it were, the changes will be too invasive. To have an idea:
https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg05400.html
is an incomplete attempt to fix part of the issue, and the remaining
work unfortunately involve even more complex changes.
As a band-aid, this partially reverts the effect of ef8875b
(virtio-scsi: Remove op blocker for dataplane, since v2.7). We cannot
simply revert that commit as a whole because we already shipped it in
qemu-kvm-rhev 7.3, since when, block jobs has been possible. We should
only block what has been broken. Also, faithfully reverting the above
commit means adding back the removed op blocker, but that is not enough,
because it still crashes when inserting media into an initially empty
scsi-cd.
All in all, scsi-cd on virtio-scsi-dataplane has basically been unusable
unless the scsi-cd never enters an empty state, so, disable it
altogether. Otherwise it would be much more difficult to avoid
crashing.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
(cherry picked from commit b0caf00bbc35c7d89e02999bdce86e1f867728e8)
(cherry picked from commit c9c4f117d8b507c2f86035c282d537c0a327364f)
(cherry picked from commit 5d586bb2543337f0ff172c6ce942dba3acbcedff)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/scsi/virtio-scsi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 3aa9971..9f754c4 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -790,6 +790,15 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
SCSIDevice *sd = SCSI_DEVICE(dev);
+ /* XXX: Remove this check once block backend is capable of handling
+ * AioContext change upon eject/insert.
+ * s->ctx is NULL if ioeventfd is off, s->ctx is qemu_get_aio_context() if
+ * data plane is not used, both cases are safe for scsi-cd. */
+ if (s->ctx && s->ctx != qemu_get_aio_context() &&
+ object_dynamic_cast(OBJECT(dev), "scsi-cd")) {
+ error_setg(errp, "scsi-cd is not supported by data plane");
+ return;
+ }
if (s->ctx && !s->dataplane_fenced) {
if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
return;
--
1.8.3.1

View File

@ -0,0 +1,36 @@
From bfee0603a426dd57f60e70d05a86f5e5786bb4b0 Mon Sep 17 00:00:00 2001
From: Wei Huang <wei@redhat.com>
Date: Thu, 5 Apr 2018 10:01:03 -0500
Subject: AArch64: Enable CONFIG_FW_CFG_DMA for aarch64
Upstream: Downstream only
RH-Author: Wei Huang <wei@redhat.com>
Message-id: <20180405150103.21732-1-wei@redhat.com>
Patchwork-id: 79487
O-Subject: [RHEL-8 qemu-kvm-rhev PATCH 1/1] AArch64: Enable CONFIG_FW_CFG_DMA for aarch64
Bugzilla: 1564172
RH-Acked-by: Andrew Jones <drjones@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
This patch enables the vmcoreinfo device for aarch64. This device is
required for the crash utility to support qemu guest dump when KASLR is
enabled.
Signed-off-by: Wei Huang <wei@redhat.com>
---
default-configs/aarch64-softmmu.mak | 1 +
1 file changed, 1 insertion(+)
diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak
index 001eb8e..860140e 100644
--- a/default-configs/aarch64-softmmu.mak
+++ b/default-configs/aarch64-softmmu.mak
@@ -27,3 +27,4 @@ CONFIG_IOH3420=y
CONFIG_USB_XHCI=y
CONFIG_USB=y
CONFIG_I2C=y
+CONFIG_FW_CFG_DMA=y
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From 3e38e82fc6601763cb597d8849a61a871ab06b72 Mon Sep 17 00:00:00 2001
From: Thomas Huth <thuth@redhat.com>
Date: Tue, 8 May 2018 12:01:10 +0200
Subject: pc-bios/s390-ccw: struct tpi_info must be declared as aligned(4)
Upstream-status: n/a yet (likely later, but downstream fix is required now)
I've run into a compilation error today with the current version of GCC:
In file included from s390-ccw.h:49,
from main.c:12:
cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors
Since the struct tpi_info contains an element ("struct subchannel_id schid")
which is marked as aligned(4), we've got to mark the struct tpi_info as
aligned(4), too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
pc-bios/s390-ccw/cio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h
index 55eaeee..1a0795f 100644
--- a/pc-bios/s390-ccw/cio.h
+++ b/pc-bios/s390-ccw/cio.h
@@ -125,7 +125,7 @@ struct tpi_info {
__u32 reserved3 : 12;
__u32 int_type : 3;
__u32 reserved4 : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
/* channel command word (type 1) */
struct ccw1 {
--
1.8.3.1

View File

@ -0,0 +1,126 @@
From 411b30bec63d20ebcbc90d933a3ff73851d60f5a Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Sun, 22 Apr 2018 02:44:30 +0100
Subject: pc: pc-*-rhel75.5.0 compat code
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
Message-id: <20180422024430.10218-1-ehabkost@redhat.com>
Patchwork-id: 79845
O-Subject: [RHEL-8.0 qemu-kvm PATCH] pc: pc-*-rhel75.5.0 compat code
Bugzilla: 1569675
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
RH-Acked-by: Peter Xu <peterx@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1569675
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15862256
Based on the pc-*-2.11 and pc-*-2.10 compat code from upstream.
Not tested yet, but still better than having it completely broken
on RHEL-8.0 Alpha. I plan to test it next week.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/i386/pc_piix.c | 2 ++
hw/i386/pc_q35.c | 4 ++++
include/hw/compat.h | 28 ++++++++++++++++++++++++++++
include/hw/i386/pc.h | 13 +++++++++++++
4 files changed, 47 insertions(+)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index cc72512..e5add39 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1166,6 +1166,8 @@ static void pc_machine_rhel750_options(MachineClass *m)
{
pc_machine_rhel7_options(m);
m->desc = "RHEL 7.5.0 PC (i440FX + PIIX, 1996)";
+ m->auto_enable_numa_with_memhp = false;
+ SET_MACHINE_COMPAT(m, PC_RHEL7_5_COMPAT);
}
DEFINE_PC_MACHINE(rhel750, "pc-i440fx-rhel7.5.0", pc_init_rhel750,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index dbf6bfa..ffc461d 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -431,8 +431,12 @@ static void pc_q35_init_rhel750(MachineState *machine)
static void pc_q35_machine_rhel750_options(MachineClass *m)
{
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_q35_machine_rhel7_options(m);
m->desc = "RHEL-7.5.0 PC (Q35 + ICH9, 2009)";
+ m->auto_enable_numa_with_memhp = false;
+ pcmc->default_nic_model = "e1000";
+ SET_MACHINE_COMPAT(m, PC_RHEL7_5_COMPAT);
}
DEFINE_PC_MACHINE(q35_rhel750, "pc-q35-rhel7.5.0", pc_q35_init_rhel750,
diff --git a/include/hw/compat.h b/include/hw/compat.h
index de251fd..f7b39c5 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -446,4 +446,32 @@
.value = "off",\
},
+/* The same as HW_COMPAT_2_11 + HW_COMPAT_2_10 */
+#define HW_COMPAT_RHEL7_5 \
+ { /* HW_COMPAT_RHEL7_5 from HW_COMPAT_2_11 */ \
+ .driver = "hpet",\
+ .property = "hpet-offset-saved",\
+ .value = "false",\
+ },{ /* HW_COMPAT_RHEL7_5 from HW_COMPAT_2_11 */ \
+ .driver = "virtio-blk-pci",\
+ .property = "vectors",\
+ .value = "2",\
+ },{ /* HW_COMPAT_RHEL7_5 from HW_COMPAT_2_11 */ \
+ .driver = "vhost-user-blk-pci",\
+ .property = "vectors",\
+ .value = "2",\
+ },{ /* HW_COMPAT_RHEL7_5 from HW_COMPAT_2_11 */ \
+ .driver = "e1000",\
+ .property = "migrate_tso_props",\
+ .value = "off",\
+ },{ /* HW_COMPAT_RHEL7_5 from HW_COMPAT_2_10 */ \
+ .driver = "virtio-mouse-device",\
+ .property = "wheel-axis",\
+ .value = "false",\
+ },{ /* HW_COMPAT_RHEL7_5 from HW_COMPAT_2_10 */ \
+ .driver = "virtio-tablet-device",\
+ .property = "wheel-axis",\
+ .value = "false",\
+ },
+
#endif /* HW_COMPAT_H */
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index faddeba..e94424f 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -969,6 +969,19 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
.value = "on",\
},
+/* Similar to PC_COMPAT_2_11 + PC_COMPAT_2_10, but:
+ * - x-hv-max-vps was backported to 7.5
+ * - x-pci-hole64-fix was backported to 7.5
+ */
+#define PC_RHEL7_5_COMPAT \
+ HW_COMPAT_RHEL7_5 \
+ { /* PC_RHEL7_5_COMPAT from PC_COMPAT_2_11 */ \
+ .driver = "Skylake-Server" "-" TYPE_X86_CPU,\
+ .property = "clflushopt",\
+ .value = "off",\
+ },
+
+
#define PC_RHEL7_4_COMPAT \
HW_COMPAT_RHEL7_4 \
{ /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_9 */ \
--
1.8.3.1

View File

@ -0,0 +1,106 @@
From 3319e2fd5b151695f30f8574bbd9250f86a96e16 Mon Sep 17 00:00:00 2001
From: Laurent Vivier <lvivier@redhat.com>
Date: Thu, 3 May 2018 14:59:08 +0100
Subject: tcg: workaround branch instruction overflow in tcg_out_qemu_ld/st
RH-Author: Laurent Vivier <lvivier@redhat.com>
Message-id: <20180503145908.8110-1-lvivier@redhat.com>
Patchwork-id: 80019
O-Subject: [qemu-kvm RHEL8/virt212 PATCH] tcg: workaround branch instruction overflow in tcg_out_qemu_ld/st
Bugzilla: 1571145
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
RH-Acked-by: David Gibson <dgibson@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1571145
BRANCH:rhel8/master-2.12.0
UPSTREAM: https://github.com/qemu/qemu/commit/6001f7729e12dd1d810291e4cbf83cee8e07441d
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15973114
ppc64 uses a BC instruction to call the tcg_out_qemu_ld/st
slow path. BC instruction uses a relative address encoded
on 14 bits.
The slow path functions are added at the end of the generated
instructions buffer, in the reverse order of the callers.
So more we have slow path functions more the distance between
the caller (BC) and the function increases.
This patch changes the behavior to generate the functions in
the same order of the callers.
Cc: qemu-stable@nongnu.org
Fixes: 15fa08f845 ("tcg: Dynamically allocate TCGOps")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20180429235840.16659-1-lvivier@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 6001f7729e12dd1d810291e4cbf83cee8e07441d)
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tcg/tcg-ldst.inc.c | 8 ++++----
tcg/tcg.c | 2 +-
tcg/tcg.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tcg/tcg-ldst.inc.c b/tcg/tcg-ldst.inc.c
index 0e14cf4..47f41b9 100644
--- a/tcg/tcg-ldst.inc.c
+++ b/tcg/tcg-ldst.inc.c
@@ -30,7 +30,7 @@ typedef struct TCGLabelQemuLdst {
TCGReg datahi_reg; /* reg index for high word to be loaded or stored */
tcg_insn_unit *raddr; /* gen code addr of the next IR of qemu_ld/st IR */
tcg_insn_unit *label_ptr[2]; /* label pointers to be updated */
- struct TCGLabelQemuLdst *next;
+ QSIMPLEQ_ENTRY(TCGLabelQemuLdst) next;
} TCGLabelQemuLdst;
@@ -46,7 +46,7 @@ static bool tcg_out_ldst_finalize(TCGContext *s)
TCGLabelQemuLdst *lb;
/* qemu_ld/st slow paths */
- for (lb = s->ldst_labels; lb != NULL; lb = lb->next) {
+ QSIMPLEQ_FOREACH(lb, &s->ldst_labels, next) {
if (lb->is_ld) {
tcg_out_qemu_ld_slow_path(s, lb);
} else {
@@ -72,7 +72,7 @@ static inline TCGLabelQemuLdst *new_ldst_label(TCGContext *s)
{
TCGLabelQemuLdst *l = tcg_malloc(sizeof(*l));
- l->next = s->ldst_labels;
- s->ldst_labels = l;
+ QSIMPLEQ_INSERT_TAIL(&s->ldst_labels, l, next);
+
return l;
}
diff --git a/tcg/tcg.c b/tcg/tcg.c
index bb24526..b84850b 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3324,7 +3324,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
s->code_ptr = tb->tc.ptr;
#ifdef TCG_TARGET_NEED_LDST_LABELS
- s->ldst_labels = NULL;
+ QSIMPLEQ_INIT(&s->ldst_labels);
#endif
#ifdef TCG_TARGET_NEED_POOL_LABELS
s->pool_labels = NULL;
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 30896ca..a3076c5 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -699,7 +699,7 @@ struct TCGContext {
/* These structures are private to tcg-target.inc.c. */
#ifdef TCG_TARGET_NEED_LDST_LABELS
- struct TCGLabelQemuLdst *ldst_labels;
+ QSIMPLEQ_HEAD(ldst_labels, TCGLabelQemuLdst) ldst_labels;
#endif
#ifdef TCG_TARGET_NEED_POOL_LABELS
struct TCGLabelPoolData *pool_labels;
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From 2b09944ad35c48e37801d5abe9069283f8835fb2 Mon Sep 17 00:00:00 2001
From: Cornelia Huck <cohuck@redhat.com>
Date: Tue, 8 May 2018 09:01:11 +0000
Subject: s390-ccw: force diag 308 subcode to unsigned long
We currently pass an integer as the subcode parameter. However,
the upper bits of the register containing the subcode need to
be 0, which is not guaranteed unless we explicitly specify the
subcode to be an unsigned long value.
Fixes: d046c51dad3 ("pc-bios/s390-ccw: Get device address via diag 308/6")
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 63d8b5ace31c1e1f3996fe4cd551d6d377594d5a)
---
pc-bios/s390-ccw/iplb.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h
index 5357a36..ded20c8 100644
--- a/pc-bios/s390-ccw/iplb.h
+++ b/pc-bios/s390-ccw/iplb.h
@@ -101,10 +101,11 @@ static inline bool manage_iplb(IplParameterBlock *iplb, bool store)
{
register unsigned long addr asm("0") = (unsigned long) iplb;
register unsigned long rc asm("1") = 0;
+ unsigned long subcode = store ? 6 : 5;
asm volatile ("diag %0,%2,0x308\n"
: "+d" (addr), "+d" (rc)
- : "d" (store ? 6 : 5)
+ : "d" (subcode)
: "memory", "cc");
return rc == 0x01;
}
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From 0384fba1d0550f0bb2a6cfeb24b13d8c8186524d Mon Sep 17 00:00:00 2001
From: Thomas Huth <thuth@redhat.com>
Date: Tue, 8 May 2018 09:01:12 +0000
Subject: pc-bios/s390-ccw: size_t should be unsigned
"size_t" should be an unsigned type according to the C standard.
Thus we should also use this convention in the s390-ccw firmware to avoid
confusion. I checked the sources, and apart from one spot in libc.c, the
code should all be fine with this change.
Buglink: https://bugs.launchpad.net/qemu/+bug/1753437
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit e4f869621203955761cf274c87d5595e9facd319)
---
pc-bios/s390-ccw/libc.c | 2 +-
pc-bios/s390-ccw/libc.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pc-bios/s390-ccw/libc.c b/pc-bios/s390-ccw/libc.c
index 38ea77d..a786566 100644
--- a/pc-bios/s390-ccw/libc.c
+++ b/pc-bios/s390-ccw/libc.c
@@ -63,7 +63,7 @@ uint64_t atoui(const char *str)
*/
char *uitoa(uint64_t num, char *str, size_t len)
{
- size_t num_idx = 1; /* account for NUL */
+ long num_idx = 1; /* account for NUL */
uint64_t tmp = num;
IPL_assert(str != NULL, "uitoa: no space allocated to store string");
diff --git a/pc-bios/s390-ccw/libc.h b/pc-bios/s390-ccw/libc.h
index 63ece70..818517f 100644
--- a/pc-bios/s390-ccw/libc.h
+++ b/pc-bios/s390-ccw/libc.h
@@ -12,7 +12,7 @@
#ifndef S390_CCW_LIBC_H
#define S390_CCW_LIBC_H
-typedef long size_t;
+typedef unsigned long size_t;
typedef int bool;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
--
1.8.3.1

View File

@ -0,0 +1,82 @@
From f21a07e653b25bf6d99c28f709a88ed1dfe6170f Mon Sep 17 00:00:00 2001
From: Collin Walling <walling@linux.ibm.com>
Date: Tue, 8 May 2018 09:01:13 +0000
Subject: pc-bios/s390-ccw: rename MAX_TABLE_ENTRIES to MAX_BOOT_ENTRIES
The MAX_TABLE_ENTRIES constant has a name that is too generic. As we
want to declare a limit for boot menu entries, let's rename it to a more
fitting MAX_BOOT_ENTRIES and set its value to 31 (30 boot entries and
1 default entry). Also we move it from bootmap.h to s390-ccw.h to make
it available for menu.c in a later patch.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 6df2a829dfacfbf10a78199ad4b023a7ea65d9cd)
---
pc-bios/s390-ccw/bootmap.c | 6 +++---
pc-bios/s390-ccw/bootmap.h | 2 --
pc-bios/s390-ccw/s390-ccw.h | 2 ++
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
index 9287b7a..b767fa2 100644
--- a/pc-bios/s390-ccw/bootmap.c
+++ b/pc-bios/s390-ccw/bootmap.c
@@ -297,7 +297,7 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr,
}
debug_print_int("loadparm", loadparm);
- IPL_assert(loadparm <= MAX_TABLE_ENTRIES, "loadparm value greater than"
+ IPL_assert(loadparm < MAX_BOOT_ENTRIES, "loadparm value greater than"
" maximum number of boot entries allowed");
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -585,7 +585,7 @@ static void ipl_scsi(void)
read_block(mbr->pt.blockno, sec, "Error reading Program Table");
IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic in PT");
- while (program_table_entries <= MAX_TABLE_ENTRIES) {
+ while (program_table_entries < MAX_BOOT_ENTRIES) {
if (!prog_table->entry[program_table_entries].scsi.blockno) {
break;
}
@@ -600,7 +600,7 @@ static void ipl_scsi(void)
}
debug_print_int("loadparm", loadparm);
- IPL_assert(loadparm <= MAX_TABLE_ENTRIES, "loadparm value greater than"
+ IPL_assert(loadparm < MAX_BOOT_ENTRIES, "loadparm value greater than"
" maximum number of boot entries allowed");
zipl_run(&prog_table->entry[loadparm].scsi); /* no return */
diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h
index 07eb600..732c111 100644
--- a/pc-bios/s390-ccw/bootmap.h
+++ b/pc-bios/s390-ccw/bootmap.h
@@ -57,8 +57,6 @@ typedef union BootMapPointer {
ExtEckdBlockPtr xeckd;
} __attribute__ ((packed)) BootMapPointer;
-#define MAX_TABLE_ENTRIES 30
-
/* aka Program Table */
typedef struct BootMapTable {
uint8_t magic[4];
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
index fd18da2..2c9e601 100644
--- a/pc-bios/s390-ccw/s390-ccw.h
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -94,6 +94,8 @@ bool menu_is_enabled_zipl(void);
int menu_get_enum_boot_index(int entries);
bool menu_is_enabled_enum(void);
+#define MAX_BOOT_ENTRIES 31
+
static inline void fill_hex(char *out, unsigned char val)
{
const char hex[] = "0123456789abcdef";
--
1.8.3.1

View File

@ -0,0 +1,94 @@
From 3301328699d574c8d6617eb4105cd9d4794f722c Mon Sep 17 00:00:00 2001
From: Collin Walling <walling@linux.ibm.com>
Date: Tue, 8 May 2018 09:01:14 +0000
Subject: pc-bios/s390-ccw: fix loadparm initialization and int conversion
Rename the loadparm char array in main.c to loadparm_str and
increased the size by one byte to account for a null termination
when converting the loadparm string to an int via atoui. We
also allow the boot menu to be enabled when loadparm is set to
an empty string or a series of spaces.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reported-by: Vasily Gorbik <gor@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 074afe60d4c8167dcfaee7aca1065c6360449eaa)
---
hw/s390x/ipl.c | 4 ++++
pc-bios/s390-ccw/main.c | 14 +++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index fb554ab..150f6c0 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -373,6 +373,10 @@ int s390_ipl_set_loadparm(uint8_t *loadparm)
loadparm[i] = ascii2ebcdic[(uint8_t) lp[i]];
}
+ if (i < 8) {
+ memset(loadparm + i, 0x40, 8 - i); /* fill with EBCDIC spaces */
+ }
+
g_free(lp);
return 0;
}
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 9d9f8cf..26f9adf 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -15,11 +15,11 @@
char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
static SubChannelId blk_schid = { .one = 1 };
IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
-static char loadparm[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+static char loadparm_str[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
QemuIplParameters qipl;
#define LOADPARM_PROMPT "PROMPT "
-#define LOADPARM_EMPTY "........"
+#define LOADPARM_EMPTY " "
#define BOOT_MENU_FLAG_MASK (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIPL)
/*
@@ -45,7 +45,7 @@ void panic(const char *string)
unsigned int get_loadparm_index(void)
{
- return atoui(loadparm);
+ return atoui(loadparm_str);
}
static bool find_dev(Schib *schib, int dev_no)
@@ -80,13 +80,13 @@ static bool find_dev(Schib *schib, int dev_no)
static void menu_setup(void)
{
- if (memcmp(loadparm, LOADPARM_PROMPT, 8) == 0) {
+ if (memcmp(loadparm_str, LOADPARM_PROMPT, 8) == 0) {
menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0);
return;
}
/* If loadparm was set to any other value, then do not enable menu */
- if (memcmp(loadparm, LOADPARM_EMPTY, 8) != 0) {
+ if (memcmp(loadparm_str, LOADPARM_EMPTY, 8) != 0) {
return;
}
@@ -116,8 +116,8 @@ static void virtio_setup(void)
*/
enable_mss_facility();
- sclp_get_loadparm_ascii(loadparm);
- memcpy(ldp + 10, loadparm, 8);
+ sclp_get_loadparm_ascii(loadparm_str);
+ memcpy(ldp + 10, loadparm_str, 8);
sclp_print(ldp);
memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
--
1.8.3.1

View File

@ -0,0 +1,105 @@
From c0577fcb360841afe54f76deee37ea4a52761bf3 Mon Sep 17 00:00:00 2001
From: Collin Walling <walling@linux.ibm.com>
Date: Tue, 8 May 2018 09:01:15 +0000
Subject: pc-bios/s390-ccw: fix non-sequential boot entries (eckd)
zIPL boot menu entries can be non-sequential. Let's account
for this issue for the s390 zIPL boot menu. Since this boot
menu is actually an imitation and is not completely capable
of everything the real zIPL menu can do, let's also print a
different banner to the user.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reported-by: Vasily Gorbik <gor@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 7385e947fc65a44dd05abb86c874beb915c1989c)
---
pc-bios/s390-ccw/menu.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c
index 96eec81..aaf5d61 100644
--- a/pc-bios/s390-ccw/menu.c
+++ b/pc-bios/s390-ccw/menu.c
@@ -158,7 +158,7 @@ static void boot_menu_prompt(bool retry)
}
}
-static int get_boot_index(int entries)
+static int get_boot_index(bool *valid_entries)
{
int boot_index;
bool retry = false;
@@ -168,7 +168,8 @@ static int get_boot_index(int entries)
boot_menu_prompt(retry);
boot_index = get_index();
retry = true;
- } while (boot_index < 0 || boot_index >= entries);
+ } while (boot_index < 0 || boot_index >= MAX_BOOT_ENTRIES ||
+ !valid_entries[boot_index]);
sclp_print("\nBooting entry #");
sclp_print(uitoa(boot_index, tmp, sizeof(tmp)));
@@ -176,7 +177,8 @@ static int get_boot_index(int entries)
return boot_index;
}
-static void zipl_println(const char *data, size_t len)
+/* Returns the entry number that was printed */
+static int zipl_print_entry(const char *data, size_t len)
{
char buf[len + 2];
@@ -185,12 +187,15 @@ static void zipl_println(const char *data, size_t len)
buf[len + 1] = '\0';
sclp_print(buf);
+
+ return buf[0] == ' ' ? atoui(buf + 1) : atoui(buf);
}
int menu_get_zipl_boot_index(const char *menu_data)
{
size_t len;
- int entries;
+ int entry;
+ bool valid_entries[MAX_BOOT_ENTRIES] = {false};
uint16_t zipl_flag = *(uint16_t *)(menu_data - ZIPL_FLAG_OFFSET);
uint16_t zipl_timeout = *(uint16_t *)(menu_data - ZIPL_TIMEOUT_OFFSET);
@@ -202,19 +207,25 @@ int menu_get_zipl_boot_index(const char *menu_data)
timeout = zipl_timeout * 1000;
}
- /* Print and count all menu items, including the banner */
- for (entries = 0; *menu_data; entries++) {
+ /* Print banner */
+ sclp_print("s390-ccw zIPL Boot Menu\n\n");
+ menu_data += strlen(menu_data) + 1;
+
+ /* Print entries */
+ while (*menu_data) {
len = strlen(menu_data);
- zipl_println(menu_data, len);
+ entry = zipl_print_entry(menu_data, len);
menu_data += len + 1;
- if (entries < 2) {
+ valid_entries[entry] = true;
+
+ if (entry == 0) {
sclp_print("\n");
}
}
sclp_print("\n");
- return get_boot_index(entries - 1); /* subtract 1 to exclude banner */
+ return get_boot_index(valid_entries);
}
--
1.8.3.1

View File

@ -0,0 +1,135 @@
From f6d3898264a5083ebe7bcc663eab353bfa6ba1f4 Mon Sep 17 00:00:00 2001
From: Collin Walling <walling@linux.ibm.com>
Date: Tue, 8 May 2018 09:01:16 +0000
Subject: pc-bios/s390-ccw: fix non-sequential boot entries (enum)
zIPL boot menu entries can be non-sequential. Let's account
for this issue for the s390 enumerated boot menu. Since we
can no longer print a range of available entries to the
user, we have to present a list of each available entry.
An example of this menu:
s390-ccw Enumerated Boot Menu.
[0] default
[1]
[2]
[7]
[8]
[9]
[11]
[12]
Please choose:
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reported-by: Vasily Gorbik <gor@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 622b39178057289a1c8c1b5148f513e658e90ea1)
---
pc-bios/s390-ccw/bootmap.c | 12 +++++++-----
pc-bios/s390-ccw/menu.c | 29 ++++++++++++++++++++---------
pc-bios/s390-ccw/s390-ccw.h | 2 +-
3 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
index b767fa2..e41e715 100644
--- a/pc-bios/s390-ccw/bootmap.c
+++ b/pc-bios/s390-ccw/bootmap.c
@@ -565,6 +565,8 @@ static void ipl_scsi(void)
int program_table_entries = 0;
BootMapTable *prog_table = (void *)sec;
unsigned int loadparm = get_loadparm_index();
+ bool valid_entries[MAX_BOOT_ENTRIES] = {false};
+ size_t i;
/* Grab the MBR */
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -585,18 +587,18 @@ static void ipl_scsi(void)
read_block(mbr->pt.blockno, sec, "Error reading Program Table");
IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic in PT");
- while (program_table_entries < MAX_BOOT_ENTRIES) {
- if (!prog_table->entry[program_table_entries].scsi.blockno) {
- break;
+ for (i = 0; i < MAX_BOOT_ENTRIES; i++) {
+ if (prog_table->entry[i].scsi.blockno) {
+ valid_entries[i] = true;
+ program_table_entries++;
}
- program_table_entries++;
}
debug_print_int("program table entries", program_table_entries);
IPL_assert(program_table_entries != 0, "Empty Program Table");
if (menu_is_enabled_enum()) {
- loadparm = menu_get_enum_boot_index(program_table_entries);
+ loadparm = menu_get_enum_boot_index(valid_entries);
}
debug_print_int("loadparm", loadparm);
diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c
index aaf5d61..82a4ae6 100644
--- a/pc-bios/s390-ccw/menu.c
+++ b/pc-bios/s390-ccw/menu.c
@@ -228,19 +228,30 @@ int menu_get_zipl_boot_index(const char *menu_data)
return get_boot_index(valid_entries);
}
-
-int menu_get_enum_boot_index(int entries)
+int menu_get_enum_boot_index(bool *valid_entries)
{
- char tmp[4];
+ char tmp[3];
+ int i;
- sclp_print("s390x Enumerated Boot Menu.\n\n");
+ sclp_print("s390-ccw Enumerated Boot Menu.\n\n");
- sclp_print(uitoa(entries, tmp, sizeof(tmp)));
- sclp_print(" entries detected. Select from boot index 0 to ");
- sclp_print(uitoa(entries - 1, tmp, sizeof(tmp)));
- sclp_print(".\n\n");
+ for (i = 0; i < MAX_BOOT_ENTRIES; i++) {
+ if (valid_entries[i]) {
+ if (i < 10) {
+ sclp_print(" ");
+ }
+ sclp_print("[");
+ sclp_print(uitoa(i, tmp, sizeof(tmp)));
+ sclp_print("]");
+ if (i == 0) {
+ sclp_print(" default\n");
+ }
+ sclp_print("\n");
+ }
+ }
- return get_boot_index(entries);
+ sclp_print("\n");
+ return get_boot_index(valid_entries);
}
void menu_set_parms(uint8_t boot_menu_flag, uint32_t boot_menu_timeout)
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
index 2c9e601..a1bdb4c 100644
--- a/pc-bios/s390-ccw/s390-ccw.h
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -91,7 +91,7 @@ void zipl_load(void);
void menu_set_parms(uint8_t boot_menu_flag, uint32_t boot_menu_timeout);
int menu_get_zipl_boot_index(const char *menu_data);
bool menu_is_enabled_zipl(void);
-int menu_get_enum_boot_index(int entries);
+int menu_get_enum_boot_index(bool *valid_entries);
bool menu_is_enabled_enum(void);
#define MAX_BOOT_ENTRIES 31
--
1.8.3.1

View File

@ -0,0 +1,112 @@
From 188fa8896734043c11798495072b7f98111c5d94 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Wed, 25 Apr 2018 13:30:35 +0000
Subject: pc: rhel7.6.0 machine-types
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1557051
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1559791
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15893027
The rhel7.6.0 machine-type was going to be added much later
because RHEL-7.6 is not ready yet. However, adding a new
machine-type is the only way to change the default NIC to e1000e.
This patch adds pc-*-rhel7.6.0 machine-types.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/i386/pc_piix.c | 21 ++++++++++++++++++---
hw/i386/pc_q35.c | 18 ++++++++++++++++--
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e5add39..0ff1e2d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1156,6 +1156,21 @@ static void pc_machine_rhel7_options(MachineClass *m)
m->is_default = 1;
}
+static void pc_init_rhel760(MachineState *machine)
+{
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
+ TYPE_I440FX_PCI_DEVICE);
+}
+
+static void pc_machine_rhel760_options(MachineClass *m)
+{
+ pc_machine_rhel7_options(m);
+ m->desc = "RHEL 7.6.0 PC (i440FX + PIIX, 1996)";
+}
+
+DEFINE_PC_MACHINE(rhel760, "pc-i440fx-rhel7.6.0", pc_init_rhel760,
+ pc_machine_rhel760_options);
+
static void pc_init_rhel750(MachineState *machine)
{
pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
@@ -1164,7 +1179,9 @@ static void pc_init_rhel750(MachineState *machine)
static void pc_machine_rhel750_options(MachineClass *m)
{
- pc_machine_rhel7_options(m);
+ pc_machine_rhel760_options(m);
+ m->alias = NULL;
+ m->is_default = 0;
m->desc = "RHEL 7.5.0 PC (i440FX + PIIX, 1996)";
m->auto_enable_numa_with_memhp = false;
SET_MACHINE_COMPAT(m, PC_RHEL7_5_COMPAT);
@@ -1183,8 +1200,6 @@ static void pc_machine_rhel740_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_machine_rhel750_options(m);
- m->alias = NULL;
- m->is_default = 0;
m->desc = "RHEL 7.4.0 PC (i440FX + PIIX, 1996)";
m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
pcmc->pc_rom_ro = false;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index ffc461d..e1fd23e 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -424,6 +424,20 @@ static void pc_q35_machine_rhel7_options(MachineClass *m)
SET_MACHINE_COMPAT(m, PC_RHEL_COMPAT);
}
+static void pc_q35_init_rhel760(MachineState *machine)
+{
+ pc_q35_init(machine);
+}
+
+static void pc_q35_machine_rhel760_options(MachineClass *m)
+{
+ pc_q35_machine_rhel7_options(m);
+ m->desc = "RHEL-7.6.0 PC (Q35 + ICH9, 2009)";
+}
+
+DEFINE_PC_MACHINE(q35_rhel760, "pc-q35-rhel7.6.0", pc_q35_init_rhel760,
+ pc_q35_machine_rhel760_options);
+
static void pc_q35_init_rhel750(MachineState *machine)
{
pc_q35_init(machine);
@@ -432,7 +446,8 @@ static void pc_q35_init_rhel750(MachineState *machine)
static void pc_q35_machine_rhel750_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pc_q35_machine_rhel7_options(m);
+ pc_q35_machine_rhel760_options(m);
+ m->alias = NULL;
m->desc = "RHEL-7.5.0 PC (Q35 + ICH9, 2009)";
m->auto_enable_numa_with_memhp = false;
pcmc->default_nic_model = "e1000";
@@ -451,7 +466,6 @@ static void pc_q35_machine_rhel740_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_q35_machine_rhel750_options(m);
- m->alias = NULL;
m->desc = "RHEL-7.4.0 PC (Q35 + ICH9, 2009)";
m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
pcmc->pc_rom_ro = false;
--
1.8.3.1

View File

@ -0,0 +1,755 @@
From 88b450562f14b4b246f88c31d0bdd48e47f3afce Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 26 Apr 2018 02:54:03 +0000
Subject: Remove rhel6* machine types
As we do not support RHEL 6 compatibility on RHEL 8 we remove rhel6*
machine types.
Types were originally added for BZ 983991 (Provide RHEL-6 machine types) and were
updated multipletimes during the RHEL 7 development to keep the compatibility. As
all machine types changes are located in pc_piix.c file there are only tests to
be fixed beside this file (and one comment removal in pc.h).
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/i386/pc_piix.c | 696 ---------------------------------------------------
include/hw/i386/pc.h | 2 -
tests/qom-test.c | 4 +-
3 files changed, 1 insertion(+), 701 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 0ff1e2d..229d551 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1324,699 +1324,3 @@ static void pc_machine_rhel700_options(MachineClass *m)
DEFINE_PC_MACHINE(rhel700, "pc-i440fx-rhel7.0.0", pc_init_rhel700,
pc_machine_rhel700_options);
-
-#define PC_RHEL6_6_COMPAT \
- {\
- .driver = "scsi-hd",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "scsi-cd",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "scsi-disk",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "ide-hd",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "ide-cd",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "ide-drive",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "virtio-blk-pci",\
- .property = "discard_granularity",\
- .value = stringify(0),\
- },{\
- .driver = "virtio-serial-pci",\
- .property = "vectors",\
- /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
- .value = stringify(0xFFFFFFFF),\
- },{\
- .driver = "486-" TYPE_X86_CPU,\
- .property = "model",\
- .value = stringify(0),\
- },{\
- .driver = "usb-tablet",\
- .property = "usb_version",\
- .value = stringify(1),\
- },{\
- .driver = "virtio-net-pci",\
- .property = "mq",\
- .value = "off",\
- },{\
- .driver = "VGA",\
- .property = "mmio",\
- .value = "off",\
- },{\
- .driver = "virtio-blk-pci",\
- .property = "config-wce",\
- .value = "off",\
- },{\
- .driver = TYPE_ISA_FDC,\
- .property = "check_media_rate",\
- .value = "off",\
- },{\
- .driver = "virtio-balloon-pci",\
- .property = "class",\
- .value = stringify(PCI_CLASS_MEMORY_RAM),\
- },{\
- .driver = TYPE_PCI_DEVICE,\
- .property = "command_serr_enable",\
- .value = "off",\
- },{\
- .driver = "AC97",\
- .property = "use_broken_id",\
- .value = stringify(1),\
- },{\
- .driver = "intel-hda",\
- .property = "msi",\
- .value = "off",\
- },{\
- .driver = "qemu32-" TYPE_X86_CPU,\
- .property = "min-xlevel",\
- .value = stringify(0),\
- },{\
- .driver = "486-" TYPE_X86_CPU,\
- .property = "min-level",\
- .value = stringify(0),\
- },{\
- .driver = "qemu32-" TYPE_X86_CPU,\
- .property = "model",\
- .value = stringify(3),\
- },{\
- .driver = "usb-ccid",\
- .property = "serial",\
- .value = "1",\
- },{\
- .driver = "virtio-net-pci",\
- .property = "any_layout",\
- .value = "off",\
- },\
- {\
- .driver = "pentium" "-" TYPE_X86_CPU,\
- .property = "apic",\
- .value = "off",\
- },\
- {\
- .driver = "pentium2" "-" TYPE_X86_CPU,\
- .property = "apic",\
- .value = "off",\
- },\
- {\
- .driver = "pentium3" "-" TYPE_X86_CPU,\
- .property = "apic",\
- .value = "off",\
- },\
- {\
- .driver = "Conroe" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Penryn" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Nehalem" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "pclmulqdq",\
- .value = "off",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "pclmulqdq",\
- .value = "off",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "fxsr",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "fxsr",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "mmx",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "mmx",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "pat",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "pat",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "cmov",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "cmov",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "pge",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "pge",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "apic",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "apic",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "cx8",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "cx8",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "mce",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "mce",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "pae",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "pae",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "msr",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "msr",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "tsc",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "tsc",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "pse",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "pse",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "de",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "de",\
- .value = "on",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "fpu",\
- .value = "on",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
- .property = "fpu",\
- .value = "on",\
- },\
- {\
- .driver = "Broadwell" "-" TYPE_X86_CPU,\
- .property = "rdtscp",\
- .value = "off",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
- .property = "rdtscp",\
- .value = "off",\
- },\
- {\
- .driver = "Broadwell" "-" TYPE_X86_CPU,\
- .property = "smap",\
- .value = "off",\
- },\
- { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
- .driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
- .property = "smap",\
- .value = "off",\
- },\
- {\
- .driver = TYPE_X86_CPU,\
- .property = "rdtscp",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "on",\
- },\
- {\
- .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
- .property = "x2apic",\
- .value = "off",\
- },\
- {\
- .driver = TYPE_X86_CPU,\
- .property = "3dnow",\
- .value = "off",\
- },\
- {\
- .driver = TYPE_X86_CPU,\
- .property = "3dnowext",\
- .value = "off",\
- },\
- {\
- .driver = "virtio-net-pci",\
- .property = "__com.redhat_rhel6_ctrl_guest_workaround", \
- .value = "on",\
- },
-
-static void pc_compat_rhel660(MachineState *machine)
-{
- PCMachineState *pcms = PC_MACHINE(machine);
- PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
-
- pc_compat_rhel700(machine);
- if (!machine->cpu_type) {
- machine->cpu_type = "cpu64-rhel6";
- }
-
- x86_cpu_change_kvm_default("kvm-pv-unhalt", NULL);
-
- pcmc->gigabyte_align = false;
- shadow_bios_after_incoming = true;
- ich9_uhci123_irqpin_override = true;
-}
-
-static void pc_init_rhel660(MachineState *machine)
-{
- pc_compat_rhel660(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel660_options(MachineClass *m)
-{
- PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pc_machine_rhel700_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.6.0 PC";
- m->rom_file_has_mr = false;
- m->default_machine_opts = "firmware=bios.bin";
- pcmc->has_acpi_build = false;
- SET_MACHINE_COMPAT(m, PC_RHEL6_6_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel660, "rhel6.6.0", pc_init_rhel660,
- pc_machine_rhel660_options);
-
-#define PC_RHEL6_5_COMPAT \
- {\
- .driver = TYPE_USB_DEVICE,\
- .property = "msos-desc",\
- .value = "no",\
- },
-
-static void pc_compat_rhel650(MachineState *machine)
-{
- pc_compat_rhel660(machine);
-}
-
-static void pc_init_rhel650(MachineState *machine)
-{
- pc_compat_rhel650(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel650_options(MachineClass *m)
-{
- pc_machine_rhel660_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.5.0 PC";
- SET_MACHINE_COMPAT(m, PC_RHEL6_5_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel650, "rhel6.5.0", pc_init_rhel650,
- pc_machine_rhel650_options);
-
-#define PC_RHEL6_4_COMPAT \
- {\
- .driver = "virtio-scsi-pci",\
- .property = "vectors",\
- .value = stringify(2),\
- },{\
- .driver = "hda-micro",\
- .property = "mixer",\
- .value = "off",\
- },{\
- .driver = "hda-duplex",\
- .property = "mixer",\
- .value = "off",\
- },{\
- .driver = "hda-output",\
- .property = "mixer",\
- .value = "off",\
- },{\
- .driver = "virtio-net-pci",\
- .property = "ctrl_mac_addr",\
- .value = "off",\
- },\
- {\
- .driver = TYPE_X86_CPU,\
- .property = "sep",\
- .value = "off",\
- },\
- {\
- .driver = "virtio-net-pci",\
- .property = "__com.redhat_rhel6_ctrl_guest_workaround", \
- .value = "off",\
- },
-
-static void pc_compat_rhel640(MachineState *machine)
-{
- pc_compat_rhel650(machine);
-}
-
-static void pc_init_rhel640(MachineState *machine)
-{
- pc_compat_rhel640(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel640_options(MachineClass *m)
-{
- pc_machine_rhel650_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.4.0 PC";
- SET_MACHINE_COMPAT(m, PC_RHEL6_4_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel640, "rhel6.4.0", pc_init_rhel640,
- pc_machine_rhel640_options);
-
-#define PC_RHEL6_3_COMPAT \
- {\
- .driver = "Conroe-" TYPE_X86_CPU,\
- .property = "min-level",\
- .value = stringify(2),\
- },{\
- .driver = "Penryn-" TYPE_X86_CPU,\
- .property = "min-level",\
- .value = stringify(2),\
- },{\
- .driver = "Nehalem-" TYPE_X86_CPU,\
- .property = "min-level",\
- .value = stringify(2),\
- },{\
- .driver = "e1000",\
- .property = "autonegotiation",\
- .value = "off",\
- },{\
- .driver = "qxl",\
- .property = "revision",\
- .value = stringify(3),\
- },{\
- .driver = "qxl-vga",\
- .property = "revision",\
- .value = stringify(3),\
- },{\
- .driver = "virtio-scsi-pci",\
- .property = "hotplug",\
- .value = "off",\
- },{\
- .driver = "virtio-scsi-pci",\
- .property = "param_change",\
- .value = "off",\
- },{\
- .driver = TYPE_X86_CPU,\
- .property = "pmu",\
- .value = "on",\
- },{\
- .driver = "usb-hub",\
- .property = "serial",\
- .value = "314159",\
- },{\
- .driver = "usb-storage",\
- .property = "serial",\
- .value = "1",\
- },\
- {\
- .driver = "SandyBridge" "-" TYPE_X86_CPU,\
- .property = "tsc-deadline",\
- .value = "off",\
- },\
- { /* PC_RHEL6_3_COMPAT (copied from the entry above) */ \
- .driver = "SandyBridge-IBRS" "-" TYPE_X86_CPU,\
- .property = "tsc-deadline",\
- .value = "off",\
- },
-
-static void pc_compat_rhel630(MachineState *machine)
-{
- pc_compat_rhel640(machine);
- x86_cpu_change_kvm_default("kvm-pv-eoi",NULL);
- enable_compat_apic_id_mode();
-}
-
-static void pc_init_rhel630(MachineState *machine)
-{
- pc_compat_rhel630(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel630_options(MachineClass *m)
-{
- pc_machine_rhel640_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.3.0 PC";
- SET_MACHINE_COMPAT(m, PC_RHEL6_3_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel630, "rhel6.3.0", pc_init_rhel630,
- pc_machine_rhel630_options);
-
-
-#define PC_RHEL6_2_COMPAT \
- {\
- .driver = TYPE_X86_CPU,\
- .property = "pmu",\
- .value = "off",\
- },
-
-static void pc_compat_rhel620(MachineState *machine)
-{
- pc_compat_rhel630(machine);
-}
-
-static void pc_init_rhel620(MachineState *machine)
-{
- pc_compat_rhel620(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel620_options(MachineClass *m)
-{
- pc_machine_rhel630_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.2.0 PC";
- SET_MACHINE_COMPAT(m, PC_RHEL6_2_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel620, "rhel6.2.0", pc_init_rhel620,
- pc_machine_rhel620_options);
-
-/*
- * NOTE: We don't have the event_idx compat entry for the
- * virtio-balloon-pci driver because RHEL6 doesn't disable
- * it either due to a bug (see RHBZ 1029539 fo more info)
- */
-#define PC_RHEL6_1_COMPAT \
- {\
- .driver = "PIIX4_PM",\
- .property = "disable_s3",\
- .value = "0",\
- },{\
- .driver = "PIIX4_PM",\
- .property = "disable_s4",\
- .value = "0",\
- },{\
- .driver = "qxl",\
- .property = "revision",\
- .value = stringify(2),\
- },{\
- .driver = "qxl-vga",\
- .property = "revision",\
- .value = stringify(2),\
- },{\
- .driver = "virtio-blk-pci",\
- .property = "event_idx",\
- .value = "off",\
- },{\
- .driver = "virtio-serial-pci",\
- .property = "event_idx",\
- .value = "off",\
- },{\
- .driver = "virtio-net-pci",\
- .property = "event_idx",\
- .value = "off",\
- },{\
- .driver = "usb-kbd",\
- .property = "serial",\
- .value = "1",\
- },{\
- .driver = "usb-mouse",\
- .property = "serial",\
- .value = "1",\
- },{\
- .driver = "usb-tablet",\
- .property = "serial",\
- .value = "1",\
- },
-
-static void pc_compat_rhel610(MachineState *machine)
-{
- pc_compat_rhel620(machine);
-}
-
-static void pc_init_rhel610(MachineState *machine)
-{
- pc_compat_rhel610(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel610_options(MachineClass *m)
-{
- pc_machine_rhel620_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.1.0 PC";
- SET_MACHINE_COMPAT(m, PC_RHEL6_1_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel610, "rhel6.1.0", pc_init_rhel610,
- pc_machine_rhel610_options);
-
-#define PC_RHEL6_0_COMPAT \
- {\
- .driver = "qxl",\
- .property = "revision",\
- .value = stringify(1),\
- },{\
- .driver = "qxl-vga",\
- .property = "revision",\
- .value = stringify(1),\
- },{\
- .driver = "VGA",\
- .property = "rombar",\
- .value = stringify(0),\
- },
-
-static void pc_compat_rhel600(MachineState *machine)
-{
- pc_compat_rhel610(machine);
-}
-
-static void pc_init_rhel600(MachineState *machine)
-{
- pc_compat_rhel600(machine);
- pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
- TYPE_I440FX_PCI_DEVICE);}
-
-static void pc_machine_rhel600_options(MachineClass *m)
-{
- pc_machine_rhel610_options(m);
- m->family = "pc_piix_Z";
- m->desc = "RHEL 6.0.0 PC";
- SET_MACHINE_COMPAT(m, PC_RHEL6_0_COMPAT);
-}
-
-DEFINE_PC_MACHINE(rhel600, "rhel6.0.0", pc_init_rhel600,
- pc_machine_rhel600_options);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index e94424f..ae84db4 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -1394,8 +1394,6 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
* The PC_RHEL_*_COMPAT serve the same purpose for RHEL-7 machine
* types as the PC_COMPAT_* do for upstream types.
* PC_RHEL_7_*_COMPAT apply both to i440fx and q35 types.
- * PC_RHEL6_*_COMPAT apply to i440fx types only, and therefore live
- * in pc_piix.c.
*/
/*
diff --git a/tests/qom-test.c b/tests/qom-test.c
index db0d3ab..2fc2670 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -16,9 +16,7 @@
#include "libqtest.h"
static const char *blacklist_x86[] = {
- "xenfv", "xenpv", "isapc",
- "rhel6.6.0", "rhel6.5.0", "rhel6.4.0", "rhel6.3.0",
- "rhel6.2.0", "rhel6.1.0", "rhel6.0.0", NULL
+ "xenfv", "xenpv", "isapc", NULL
};
static const struct {
--
1.8.3.1

View File

@ -0,0 +1,81 @@
From 8a50b1caa7e56dc2b9a2f4dc8bc9c63e9a064085 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 26 Apr 2018 02:54:04 +0000
Subject: Remove rhel6_ctrl_guest_workaround
As we are not support RHEL 6 compatibility on RHEL 8 removing hack
to handle missing ctrl-guest-offload in RHEL 6 machine types.
This hack was introduced for BZ 1378334 (windows guests migration from
rhel6.8-z to rhel7.3 with virtio-net-pci fail) in qemu-kvm-rhev for RHEL 7.4
and was backported to qemu-kvm-rhev for RHEL 7.3 as commit 9a30ebb5 (and
propagated to RHEL 7.4 with rebase to 2.9.0).
Singed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/virtio/virtio.c | 22 +---------------------
include/hw/virtio/virtio.h | 1 -
2 files changed, 1 insertion(+), 22 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 4bcb4f4..006d3d1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -24,7 +24,6 @@
#include "hw/virtio/virtio-access.h"
#include "sysemu/dma.h"
-#include "standard-headers/linux/virtio_net.h"
/*
* The alignment to use between consumer and producer parts of vring.
* x86 pagesize again. This is the default, used by transports like PCI
@@ -1992,24 +1991,7 @@ const VMStateInfo virtio_vmstate_info = {
static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
{
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
- bool bad;
- uint64_t ctrl_guest_mask = 1ull << VIRTIO_NET_F_CTRL_GUEST_OFFLOADS;
-
- if (vdev->rhel6_ctrl_guest_workaround && (val & ctrl_guest_mask) &&
- !(vdev->host_features & ctrl_guest_mask)) {
- /*
- * This works around a mistake in the definition of the rhel6.[56].0
- * machinetypes, ctrl-guest-offload was not set in qemu-kvm-rhev for
- * those machine types, but is set on the rhel6 qemu-kvm-rhev build.
- * If an incoming rhel6 guest uses it then we need to allow it.
- * Note: There's a small race where a guest read the flag but didn't
- * declare it's useage yet.
- */
- fprintf(stderr, "RHEL6 ctrl_guest_offload workaround\n");
- vdev->host_features |= ctrl_guest_mask;
- }
-
- bad = (val & ~(vdev->host_features)) != 0;
+ bool bad = (val & ~(vdev->host_features)) != 0;
val &= vdev->host_features;
if (k->set_features) {
@@ -2584,8 +2566,6 @@ static void virtio_device_instance_finalize(Object *obj)
static Property virtio_properties[] = {
DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features),
- DEFINE_PROP_BOOL("__com.redhat_rhel6_ctrl_guest_workaround", VirtIODevice,
- rhel6_ctrl_guest_workaround, false),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 41e13d2..098bdaa 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -95,7 +95,6 @@ struct VirtIODevice
uint8_t device_endian;
bool use_guest_notifier_mask;
AddressSpace *dma_as;
- bool rhel6_ctrl_guest_workaround;
QLIST_HEAD(, VirtQueue) *vector_queues;
};
--
1.8.3.1

View File

@ -0,0 +1,242 @@
From 71562f446db550489bf4ba79e634a8b55e74d83f Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 26 Apr 2018 02:54:06 +0000
Subject: Remove SeaBIOS shadowing
As we do not support RHEL 6 compatibility on RHEL 8 we can remove
hacks that shadow SeaBIOS for incomming RHEL-6 host
This feature was added in qemu-kvm RHEL 7.1 for BZ 1027565 (fail to
reboot guest after migration from RHEL6.5 host to RHEL7.0 host) as
commit 9f136b4ed4ec and was backported to RHEL 7.0 as 0day fix (BZ 1091322,
commit df9e9e9c56c7).
In addition, fix was provided for qemu-kvm-rhev in RHEL 7.1 (BZ 1103579,
commit cada12245ab9).
For qemu-kvm, use of this hack was extended for BZ 1176283
([migration]migrationfailed when configure guest with OVMF bios + machine
type=rhel6.5.0) in RHEL 7.2 by commit c3f813d2f.
For qemu-kvm-rhev, use of this hack was extened for BZ 1170093 (guest NUMA
failed to migrate when machine is rhel6.5.0) for RHEL 7.1 by commit 8e8107cb3
and BZ 1175099 ([migration]migration failed when configure guest with OVMF
bios + machine type=rhel6.5.0) for RHEL 7.2 by commit 8b220c0e.
In addition, during rebase to 2.10, handling was moved to separate module
and stub version was provided.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/i386/Makefile.objs | 1 -
hw/i386/pc_sysfw.c | 16 -------------
hw/i386/shadow-bios.c | 64 -------------------------------------------------
include/sysemu/sysemu.h | 2 --
migration/savevm.c | 7 ------
numa.c | 13 ----------
stubs/Makefile.objs | 1 -
stubs/shadow-bios.c | 7 ------
8 files changed, 111 deletions(-)
delete mode 100644 hw/i386/shadow-bios.c
delete mode 100644 stubs/shadow-bios.c
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c25538..fa87a14 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -10,4 +10,3 @@ obj-$(CONFIG_VMMOUSE) += vmmouse.o
obj-y += kvmvapic.o
obj-y += acpi-build.o
-obj-y += shadow-bios.o
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 2a6de35..73ac783 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -207,13 +207,6 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
(bios_size % 65536) != 0) {
goto bios_error;
}
- if (shadow_bios_after_incoming && bios_size != 128 * 1024) {
- MachineClass *mc;
-
- mc = MACHINE_GET_CLASS(current_machine);
- error_report("machine %s only supports a 128KB BIOS image", mc->name);
- exit(1);
- }
bios = g_malloc(sizeof(*bios));
memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
if (!isapc_ram_fw) {
@@ -261,15 +254,6 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
return;
}
- if (shadow_bios_after_incoming) {
- MachineClass *mc;
-
- mc = MACHINE_GET_CLASS(current_machine);
- error_report("flash-based firmware is not supported by machine %s",
- mc->name);
- exit(1);
- }
-
if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
/* Older KVM cannot execute from device memory. So, flash memory
* cannot be used unless the readonly memory kvm capability is present. */
diff --git a/hw/i386/shadow-bios.c b/hw/i386/shadow-bios.c
deleted file mode 100644
index 65a4cb8..0000000
--- a/hw/i386/shadow-bios.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "qemu/osdep.h"
-#include "sysemu/sysemu.h"
-#include "target/i386/cpu.h"
-#include "exec/ram_addr.h"
-#include "qemu/cutils.h"
-
-void shadow_bios(void)
-{
- RAMBlock *block, *ram, *oprom, *bios;
- size_t one_meg, oprom_size, bios_size;
- uint8_t *cd_seg_host, *ef_seg_host;
-
- ram = NULL;
- oprom = NULL;
- bios = NULL;
- rcu_read_lock();
- QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
- if (strcmp("pc.ram", block->idstr) == 0) {
- assert(ram == NULL);
- ram = block;
- } else if (strcmp("pc.rom", block->idstr) == 0) {
- assert(oprom == NULL);
- oprom = block;
- } else if (strcmp("pc.bios", block->idstr) == 0) {
- assert(bios == NULL);
- bios = block;
- }
- }
- assert(ram != NULL);
- assert(oprom != NULL);
- assert(bios != NULL);
- assert(memory_region_is_ram(ram->mr));
- assert(memory_region_is_ram(oprom->mr));
- assert(memory_region_is_ram(bios->mr));
- assert(int128_eq(ram->mr->size, int128_make64(ram->used_length)));
- assert(int128_eq(oprom->mr->size, int128_make64(oprom->used_length)));
- assert(int128_eq(bios->mr->size, int128_make64(bios->used_length)));
-
- one_meg = 1024 * 1024;
- oprom_size = 128 * 1024;
- bios_size = 128 * 1024;
- assert(ram->used_length >= one_meg);
- assert(oprom->used_length == oprom_size);
- assert(bios->used_length == bios_size);
-
- ef_seg_host = memory_region_get_ram_ptr(ram->mr) + (one_meg - bios_size);
- cd_seg_host = ef_seg_host - oprom_size;
-
- /* This is a crude hack, but we must distinguish a rhel6.x.0 machtype guest
- * coming in from a RHEL-6 emulator (where shadowing has had no effect on
- * "pc.ram") from a similar guest coming in from a RHEL-7 emulator (where
- * shadowing has worked). In the latter case we must not trample the live
- * SeaBIOS variables in "pc.ram".
- */
- if (buffer_is_zero(ef_seg_host, bios_size)) {
- fprintf(stderr, "copying E and F segments from pc.bios to pc.ram\n");
- memcpy(ef_seg_host, memory_region_get_ram_ptr(bios->mr), bios_size);
- }
- if (buffer_is_zero(cd_seg_host, oprom_size)) {
- fprintf(stderr, "copying C and D segments from pc.rom to pc.ram\n");
- memcpy(cd_seg_host, memory_region_get_ram_ptr(oprom->mr), oprom_size);
- }
- rcu_read_unlock();
-}
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 5832c38..2b42151 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -94,8 +94,6 @@ void qemu_add_machine_init_done_notifier(Notifier *notify);
void qemu_remove_machine_init_done_notifier(Notifier *notify);
void qemu_announce_self(void);
-extern bool shadow_bios_after_incoming;
-void shadow_bios(void);
extern int autostart;
diff --git a/migration/savevm.c b/migration/savevm.c
index 56c9feb..6c539d1 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -84,7 +84,6 @@ enum qemu_vm_cmd {
MIG_CMD_PACKAGED, /* Send a wrapped stream within this stream */
MIG_CMD_MAX
};
-bool shadow_bios_after_incoming;
#define MAX_VM_CMD_PACKAGED_SIZE UINT32_MAX
static struct mig_cmd_args {
@@ -2206,12 +2205,6 @@ int qemu_loadvm_state(QEMUFile *f)
}
qemu_loadvm_state_cleanup();
- /* Supplement SeaBIOS's shadowing now, because it was useless when the
- * incoming VM started on the RHEL-6 emulator.
- */
- if (shadow_bios_after_incoming) {
- shadow_bios();
- }
cpu_synchronize_all_post_init();
diff --git a/numa.c b/numa.c
index daf10d8..1116c90 100644
--- a/numa.c
+++ b/numa.c
@@ -493,19 +493,6 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
return;
}
- /* The shadow_bios_after_incoming hack at savevm.c:shadow_bios() is not
- * able to handle the multiple memory blocks added when using NUMA
- * memdevs. We can disallow -numa memdev= when using rhel6.* machine-types
- * because RHEL-6 didn't support the NUMA memdev option.
- */
- if (shadow_bios_after_incoming) {
- MachineClass *mc;
- mc = MACHINE_GET_CLASS(current_machine);
- error_report("-numa memdev is not supported by machine %s",
- mc->name);
- exit(1);
- }
-
memory_region_init(mr, owner, name, ram_size);
for (i = 0; i < nb_numa_nodes; i++) {
uint64_t size = numa_info[i].node_mem;
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 8f111c5..dfdfca7 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -44,4 +44,3 @@ stub-obj-y += xen-hvm.o
stub-obj-y += pci-host-piix.o
stub-obj-y += ram-block.o
stub-obj-y += ide-isa.o
-stub-obj-y += shadow-bios.o
diff --git a/stubs/shadow-bios.c b/stubs/shadow-bios.c
deleted file mode 100644
index c77cd7a..0000000
--- a/stubs/shadow-bios.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "sysemu/sysemu.h"
-
-void shadow_bios(void)
-{
- abort();
-}
--
1.8.3.1

View File

@ -0,0 +1,67 @@
From 40a88676cdb22e844dce24c1745b6004a8cf7806 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 26 Apr 2018 02:54:07 +0000
Subject: Remove ich9_uhci123_irqpin_override
As we do not support RHEL 6 compatibility we remove this hack.
This hack was introduced in RHEL 7.1 for BZ 1085701 and 1103581 (Guest
hits call trace migrate from RHEL6.5 to RHEL7.0 host with -M 6.1
& balloon & uhci device) by commits 8061ffe65490 and 42a193d925b3,
and was backported to RHEL 7.0 as 0day fix (BZ 1090981,
commit 48addb5b5b3b).
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/usb/hcd-uhci.c | 13 +------------
include/hw/usb.h | 3 ---
2 files changed, 1 insertion(+), 15 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 86d6ab8..9d7b9df 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -152,8 +152,6 @@ typedef struct UHCI_QH {
uint32_t el_link;
} UHCI_QH;
-bool ich9_uhci123_irqpin_override;
-
static void uhci_async_cancel(UHCIAsync *async);
static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td);
static void uhci_resume(void *opaque);
@@ -1222,16 +1220,7 @@ static void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
/* TODO: reset value should be 0. */
pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
- if (ich9_uhci123_irqpin_override &&
- u->info.vendor_id == PCI_VENDOR_ID_INTEL &&
- (u->info.device_id == PCI_DEVICE_ID_INTEL_82801I_UHCI1 ||
- u->info.device_id == PCI_DEVICE_ID_INTEL_82801I_UHCI2 ||
- u->info.device_id == PCI_DEVICE_ID_INTEL_82801I_UHCI3)) {
- fprintf(stderr, "RHEL-6 compat: %s: irq_pin = 3\n", u->info.name);
- irq_pin = 3;
- } else {
- irq_pin = u->info.irq_pin;
- }
+ irq_pin = u->info.irq_pin;
pci_config_set_interrupt_pin(pci_conf, irq_pin + 1);
if (s->masterbus) {
diff --git a/include/hw/usb.h b/include/hw/usb.h
index 5b3fb1f..b943ec9 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -607,9 +607,6 @@ int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
uint8_t interface_protocol);
-/* hcd-uhci.c -- RHEL-6 machine type compatibility */
-extern bool ich9_uhci123_irqpin_override;
-
/* hcd-xhci.c -- rhel7.0.0 machine type compatibility */
extern bool migrate_cve_2014_5263_xhci_fields;
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From db20a3f422ca948784aa74375d1977b7d0a1c7ed Mon Sep 17 00:00:00 2001
From: Cornelia Huck <cohuck@redhat.com>
Date: Tue, 15 May 2018 07:33:45 +0000
Subject: s390x/css: disabled subchannels cannot be status pending
The 3270 code will try to post an attention interrupt when the
3270 emulator (e.g. x3270) attaches. If the guest has not yet
enabled the subchannel for the 3270 device, we will present a spurious
cc 1 (status pending) when it uses msch on it later on, e.g. when
trying to enable the subchannel.
To fix this, just don't do anything in css_conditional_io_interrupt()
if the subchannel is not enabled. The 3270 code will work fine with
that, and the other user of this function (virtio-ccw) never
attempts to post an interrupt for a disabled device to begin with.
CC: qemu-stable@nongnu.org
Reported-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit 6e9c893ecd00afd5344c35d0d0ded50eaa0938f6)
---
hw/s390x/css.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 301bf17..56c3fa8 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -617,6 +617,14 @@ void css_inject_io_interrupt(SubchDev *sch)
void css_conditional_io_interrupt(SubchDev *sch)
{
/*
+ * If the subchannel is not enabled, it is not made status pending
+ * (see PoP p. 16-17, "Status Control").
+ */
+ if (!(sch->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ENA)) {
+ return;
+ }
+
+ /*
* If the subchannel is not currently status pending, make it pending
* with alert status.
*/
--
1.8.3.1

View File

@ -0,0 +1,129 @@
From 4772dbd9b905b7b304f24fe3d2e4ca8ba0a18816 Mon Sep 17 00:00:00 2001
From: Cornelia Huck <cohuck@redhat.com>
Date: Tue, 15 May 2018 07:33:46 +0000
Subject: virtio-ccw: common reset handler
All the different virtio ccw devices use the same reset handler,
so let's move setting it into the base virtio ccw device class.
CC: qemu-stable@nongnu.org
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit 0c53057adb04d254bc09511880670c92ab185fc6)
---
hw/s390x/virtio-ccw.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 8720e46..2db8cc6 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -1348,7 +1348,6 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_net_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_net_properties;
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
}
@@ -1376,7 +1375,6 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_blk_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_blk_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1404,7 +1402,6 @@ static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_serial_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_serial_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -1432,7 +1429,6 @@ static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_balloon_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_balloon_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1460,7 +1456,6 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_scsi_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_scsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1487,7 +1482,6 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data)
k->realize = vhost_ccw_scsi_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = vhost_ccw_scsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1524,7 +1518,6 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_rng_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_rng_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1564,7 +1557,6 @@ static void virtio_ccw_crypto_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_crypto_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_crypto_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1603,7 +1595,6 @@ static void virtio_ccw_gpu_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_gpu_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_gpu_properties;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
@@ -1632,7 +1623,6 @@ static void virtio_ccw_input_class_init(ObjectClass *klass, void *data)
k->realize = virtio_ccw_input_realize;
k->unrealize = virtio_ccw_unrealize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_input_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -1736,6 +1726,7 @@ static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)
dc->realize = virtio_ccw_busdev_realize;
dc->unrealize = virtio_ccw_busdev_unrealize;
dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
+ dc->reset = virtio_ccw_reset;
}
static const TypeInfo virtio_ccw_device_info = {
@@ -1812,7 +1803,6 @@ static void virtio_ccw_9p_class_init(ObjectClass *klass, void *data)
k->unrealize = virtio_ccw_unrealize;
k->realize = virtio_ccw_9p_realize;
- dc->reset = virtio_ccw_reset;
dc->props = virtio_ccw_9p_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1862,7 +1852,6 @@ static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
k->unrealize = virtio_ccw_unrealize;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
dc->props = vhost_vsock_ccw_properties;
- dc->reset = virtio_ccw_reset;
}
static void vhost_vsock_ccw_instance_init(Object *obj)
--
1.8.3.1

View File

@ -0,0 +1,105 @@
From 39b8d397fe34ae375e33371ee58894d13667560b Mon Sep 17 00:00:00 2001
From: Cornelia Huck <cohuck@redhat.com>
Date: Tue, 15 May 2018 07:33:47 +0000
Subject: s390x/ccw: make sure all ccw devices are properly reset
Thomas reported that the subchannel for a 3270 device that ended up
in a broken state (status pending even though not enabled) did not
get out of that state even after a reboot (which involves a subsytem
reset). The reason for this is that the 3270 device did not define
a reset handler.
Let's fix this by introducing a base reset handler (set up for all
ccw devices) that resets the subchannel and have virtio-ccw call
its virtio-specific reset procedure in addition to that.
CC: qemu-stable@nongnu.org
Reported-by: Thomas Huth <thuth@redhat.com>
Suggested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit 838fb84f83c84f00d15b1bede5e080b495644458)
---
hw/s390x/ccw-device.c | 8 ++++++++
hw/s390x/virtio-ccw.c | 9 ++++++---
hw/s390x/virtio-ccw.h | 1 +
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c
index f9bfa15..7cd73df 100644
--- a/hw/s390x/ccw-device.c
+++ b/hw/s390x/ccw-device.c
@@ -40,6 +40,13 @@ static Property ccw_device_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
+static void ccw_device_reset(DeviceState *d)
+{
+ CcwDevice *ccw_dev = CCW_DEVICE(d);
+
+ css_reset_sch(ccw_dev->sch);
+}
+
static void ccw_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -48,6 +55,7 @@ static void ccw_device_class_init(ObjectClass *klass, void *data)
k->realize = ccw_device_realize;
k->refill_ids = ccw_device_refill_ids;
dc->props = ccw_device_properties;
+ dc->reset = ccw_device_reset;
}
const VMStateDescription vmstate_ccw_dev = {
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 2db8cc6..dfedd84 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -1061,10 +1061,12 @@ static void virtio_ccw_reset(DeviceState *d)
{
VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
VirtIODevice *vdev = virtio_bus_get_device(&dev->bus);
- CcwDevice *ccw_dev = CCW_DEVICE(d);
+ VirtIOCCWDeviceClass *vdc = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
virtio_ccw_reset_virtio(dev, vdev);
- css_reset_sch(ccw_dev->sch);
+ if (vdc->parent_reset) {
+ vdc->parent_reset(d);
+ }
}
static void virtio_ccw_vmstate_change(DeviceState *d, bool running)
@@ -1721,12 +1723,13 @@ static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
CCWDeviceClass *k = CCW_DEVICE_CLASS(dc);
+ VirtIOCCWDeviceClass *vdc = VIRTIO_CCW_DEVICE_CLASS(klass);
k->unplug = virtio_ccw_busdev_unplug;
dc->realize = virtio_ccw_busdev_realize;
dc->unrealize = virtio_ccw_busdev_unrealize;
dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
- dc->reset = virtio_ccw_reset;
+ device_class_set_parent_reset(dc, virtio_ccw_reset, &vdc->parent_reset);
}
static const TypeInfo virtio_ccw_device_info = {
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index 2fc5130..3453aa1 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -77,6 +77,7 @@ typedef struct VirtIOCCWDeviceClass {
CCWDeviceClass parent_class;
void (*realize)(VirtioCcwDevice *dev, Error **errp);
void (*unrealize)(VirtioCcwDevice *dev, Error **errp);
+ void (*parent_reset)(DeviceState *dev);
} VirtIOCCWDeviceClass;
/* Performance improves when virtqueue kick processing is decoupled from the
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From 0d4f38c339fa1e200a01fdf8b17a0a5c22d07ae2 Mon Sep 17 00:00:00 2001
From: Thomas Huth <thuth@redhat.com>
Date: Tue, 15 May 2018 07:33:48 +0000
Subject: s390x: Re-enable CONFIG_TERMINAL3270
Upstream-status: n/a (downstream only config change)
This is required to be able to connect to the guest via a 3270
terminal.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
default-configs/s390x-softmmu.mak | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/default-configs/s390x-softmmu.mak b/default-configs/s390x-softmmu.mak
index 649bf2c..17e871a 100644
--- a/default-configs/s390x-softmmu.mak
+++ b/default-configs/s390x-softmmu.mak
@@ -4,8 +4,7 @@ CONFIG_PCI=y
#CONFIG_VHOST_USER_BLK=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
CONFIG_VIRTIO=y
CONFIG_SCLPCONSOLE=y
-# Disabled for Red Hat Enterprise Linux:
-# CONFIG_TERMINAL3270=y
+CONFIG_TERMINAL3270=y
CONFIG_S390_FLIC=y
CONFIG_S390_FLIC_KVM=$(CONFIG_KVM)
# Disabled for Red Hat Enterprise Linux:
--
1.8.3.1

View File

@ -0,0 +1,70 @@
From 7574808ac154ac9ddf8264bf14e775fab96d0cac Mon Sep 17 00:00:00 2001
From: Laurent Vivier <lvivier@redhat.com>
Date: Thu, 7 Jun 2018 12:55:12 +0000
Subject: redhat: define pseries-rhel7.6.0 machine types
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16632825
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1585651
BRANCH: rhel8/master-2.12.0
UPSTREAM: downsream only
Tested: minimal, as the change is the same as for RHEL7.6
Tested ping-pong migration between two
pseries-rhel7.6.0/qemu-kvm-2.12.0 and with
pseries-rhel7.5.0/qemu-kvm-rhev-2.10
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/ppc/spapr.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index c751111..c3f08b3 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4352,19 +4352,41 @@ DEFINE_SPAPR_MACHINE(2_1, "2.1", false);
#endif
/*
+ * pseries-rhel7.6.0
+ */
+
+static void spapr_machine_rhel760_instance_options(MachineState *machine)
+{
+}
+
+static void spapr_machine_rhel760_class_options(MachineClass *mc)
+{
+ /* Defaults for the latest behaviour inherited from the base class */
+}
+
+DEFINE_SPAPR_MACHINE(rhel760, "rhel7.6.0", true);
+
+/*
* pseries-rhel7.5.0
+ * like SPAPR_COMPAT_2_11 and SPAPR_COMPAT_2_10
+ * SPAPR_CAP_HTM already enabled in 7.4
+ *
*/
+#define SPAPR_COMPAT_RHEL7_5 \
+ HW_COMPAT_RHEL7_5 \
static void spapr_machine_rhel750_instance_options(MachineState *machine)
{
+ spapr_machine_rhel760_instance_options(machine);
}
static void spapr_machine_rhel750_class_options(MachineClass *mc)
{
- /* Defaults for the latest behaviour inherited from the base class */
+ spapr_machine_rhel760_class_options(mc);
+ SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_RHEL7_5);
}
-DEFINE_SPAPR_MACHINE(rhel750, "rhel7.5.0", true);
+DEFINE_SPAPR_MACHINE(rhel750, "rhel7.5.0", false);
/*
* pseries-rhel7.5.0-sxxm
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From f53aa3f10b0c22093917fc076e3ddcb41398f12a Mon Sep 17 00:00:00 2001
From: Christian Borntraeger <borntraeger@de.ibm.com>
Date: Wed, 20 Jun 2018 10:58:31 +0000
Subject: s390x/cpumodels: add z14 Model ZR1
Introduce the new z14 Model ZR1 cpu model. Mostly identical to z14, only
the cpu type differs (3906 vs. 3907)
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20180613081819.147178-1-borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit 23ad956bff98d949057156ea3f68a9763c2dda0e)
---
target/s390x/cpu_models.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index c4016e0..24e689c 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -79,6 +79,7 @@ static S390CPUDef s390_cpu_defs[] = {
CPUDEF_INIT(0x2964, 13, 2, 47, 0x08000000U, "z13.2", "IBM z13 GA2"),
CPUDEF_INIT(0x2965, 13, 2, 47, 0x08000000U, "z13s", "IBM z13s GA1"),
CPUDEF_INIT(0x3906, 14, 1, 47, 0x08000000U, "z14", "IBM z14 GA1"),
+ CPUDEF_INIT(0x3907, 14, 1, 47, 0x08000000U, "z14ZR1", "IBM z14 Model ZR1 GA1"),
};
#define QEMU_MAX_CPU_TYPE 0x2827
--
1.8.3.1

View File

@ -0,0 +1 @@
DEVPATH=="*/kvm", ACTION=="change", RUN+="/lib/udev/udev-kvm-check $env{COUNT} $env{EVENT}"

5
SOURCES/85-kvm.preset Normal file
View File

@ -0,0 +1,5 @@
# Enable kvm-setup by default. This can have odd side effects on
# PowerNV systems that aren't intended as KVM hosts, but at present we
# only support RHEL on PowerNV for the purpose of being a RHEV host.
enable kvm-setup.service

View File

@ -0,0 +1,10 @@
# The KVM HV implementation on Power can require a significant amount
# of unswappable memory (about half of which also needs to be host
# physically contiguous) to hold the guest's Hash Page Table (HPT) -
# roughly 1/64th of the guest's RAM size, minimum 16MiB.
#
# These limits allow unprivileged users to start smallish VMs, such as
# those used by libguestfs.
#
* hard memlock 65536
* soft memlock 65536

View File

@ -0,0 +1,2 @@
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \
TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"

39
SOURCES/README.tests Normal file
View File

@ -0,0 +1,39 @@
qemu-kvm-tests README
=====================
The qemu-kvm-tests rpm contains tests that can be used to verify the
functionality of the installed qemu-kvm package
When installed, the files from this rpm will be arranged in the following
directory structure
tests-src/
├── README
├── scripts
│   ├── qemu.py
│   └── qmp
└── tests
├── acceptance
├── Makefile.include
└── qemu-iotests
The tests/ directory within the tests-src/ directory is setup to remain a copy
of a subset of the tests/ directory from the QEMU source tree
The avocado_qemu tests and qemu-iotests, along with files required for the
execution of the avocado_qemu tests (scripts/qemu.py and scripts/qmp/) will be
installed in a new location - /usr/lib64/qemu-kvm/tests-src/
avocado_qemu tests:
The avocado_qemu tests can be executed by running the following avocado command:
avocado run -p qemu_bin=/usr/libexec/qemu-kvm /usr/lib64/qemu-kvm/tests/acceptance/
Avocado needs to be installed separately using either pip or from source as
Avocado is not being packaged for RHEL-8.
qemu-iotests:
symlinks to corresponding binaries need to be created for QEMU_PROG,
QEMU_IO_PROG, QEMU_IMG_PROG, and QEMU_NBD_PROG before the iotests can be
executed.
The primary purpose of this package is to make these tests available to be
executed as gating tests for the virt module in the RHEL-8 OSCI environment.

1
SOURCES/bridge.conf Normal file
View File

@ -0,0 +1 @@
allow virbr0

13
SOURCES/ksm.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Kernel Samepage Merging
ConditionPathExists=/sys/kernel/mm/ksm
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/ksm
ExecStart=/usr/libexec/ksmctl start
ExecStop=/usr/libexec/ksmctl stop
[Install]
WantedBy=multi-user.target

4
SOURCES/ksm.sysconfig Normal file
View File

@ -0,0 +1,4 @@
# The maximum number of unswappable kernel pages
# which may be allocated by ksm (0 for unlimited)
# If unset, defaults to half of total memory
# KSM_MAX_KERNEL_PAGES=

77
SOURCES/ksmctl.c Normal file
View File

@ -0,0 +1,77 @@
/* Start/stop KSM, for systemd.
* Copyright (C) 2009, 2011 Red Hat, Inc.
* Written by Paolo Bonzini <pbonzini@redhat.com>.
* Based on the original sysvinit script by Dan Kenigsberg <danken@redhat.com>
* This file is distributed under the GNU General Public License, version 2
* or later. */
#include <unistd.h>
#include <stdio.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define KSM_MAX_KERNEL_PAGES_FILE "/sys/kernel/mm/ksm/max_kernel_pages"
#define KSM_RUN_FILE "/sys/kernel/mm/ksm/run"
char *program_name;
int usage(void)
{
fprintf(stderr, "Usage: %s {start|stop}\n", program_name);
return 1;
}
int write_value(uint64_t value, char *filename)
{
FILE *fp;
if (!(fp = fopen(filename, "w")) ||
fprintf(fp, "%llu\n", (unsigned long long) value) == EOF ||
fflush(fp) == EOF ||
fclose(fp) == EOF)
return 1;
return 0;
}
uint64_t ksm_max_kernel_pages()
{
char *var = getenv("KSM_MAX_KERNEL_PAGES");
char *endptr;
uint64_t value;
if (var && *var) {
value = strtoll(var, &endptr, 0);
if (value < LLONG_MAX && !*endptr)
return value;
}
/* Unless KSM_MAX_KERNEL_PAGES is set, let KSM munch up to half of
* total memory. */
return sysconf(_SC_PHYS_PAGES) / 2;
}
int start(void)
{
if (access(KSM_MAX_KERNEL_PAGES_FILE, R_OK) >= 0)
write_value(ksm_max_kernel_pages(), KSM_MAX_KERNEL_PAGES_FILE);
return write_value(1, KSM_RUN_FILE);
}
int stop(void)
{
return write_value(0, KSM_RUN_FILE);
}
int main(int argc, char **argv)
{
program_name = argv[0];
if (argc < 2) {
return usage();
} else if (!strcmp(argv[1], "start")) {
return start();
} else if (!strcmp(argv[1], "stop")) {
return stop();
} else {
return usage();
}
}

139
SOURCES/ksmtuned Normal file
View File

@ -0,0 +1,139 @@
#!/bin/bash
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# Author: Dan Kenigsberg <danken@redhat.com>
#
# ksmtuned - a simple script that controls whether (and with what vigor) ksm
# should search for duplicated pages.
#
# starts ksm when memory commited to qemu processes exceeds a threshold, and
# make ksm work harder and harder untill memory load falls below that
# threshold.
#
# send SIGUSR1 to this process right after a new qemu process is started, or
# following its death, to retune ksm accordingly
#
# needs testing and ironing. contact danken@redhat.com if something breaks.
if [ -f /etc/ksmtuned.conf ]; then
. /etc/ksmtuned.conf
fi
debug() {
if [ -n "$DEBUG" ]; then
s="`/bin/date`: $*"
[ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s"
fi
}
KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60}
KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300}
KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50}
KSM_NPAGES_MIN=${KSM_NPAGES_MIN:-64}
KSM_NPAGES_MAX=${KSM_NPAGES_MAX:-1250}
# millisecond sleep between ksm scans for 16Gb server. Smaller servers sleep
# more, bigger sleep less.
KSM_SLEEP_MSEC=${KSM_SLEEP_MSEC:-10}
KSM_THRES_COEF=${KSM_THRES_COEF:-20}
KSM_THRES_CONST=${KSM_THRES_CONST:-2048}
total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
debug total $total
npages=0
sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total]
[ $sleep -le 10 ] && sleep=10
debug sleep $sleep
thres=$[total * KSM_THRES_COEF / 100]
if [ $KSM_THRES_CONST -gt $thres ]; then
thres=$KSM_THRES_CONST
fi
debug thres $thres
KSMCTL () {
case x$1 in
xstop)
echo 0 > /sys/kernel/mm/ksm/run
;;
xstart)
echo $2 > /sys/kernel/mm/ksm/pages_to_scan
echo $3 > /sys/kernel/mm/ksm/sleep_millisecs
echo 1 > /sys/kernel/mm/ksm/run
;;
esac
}
committed_memory () {
# calculate how much memory is committed to running qemu processes
local pidlist
pidlist=$(pgrep -d ' ' -- '^qemu(-(kvm|system-.+)|:.{1,11})$')
if [ -n "$pidlist" ]; then
ps -p "$pidlist" -o rsz=
fi | awk '{ sum += $1 }; END { print 0+sum }'
}
free_memory () {
awk '/^(MemFree|Buffers|Cached):/ {free += $2}; END {print free}' \
/proc/meminfo
}
increase_npages() {
local delta
delta=${1:-0}
npages=$[npages + delta]
if [ $npages -lt $KSM_NPAGES_MIN ]; then
npages=$KSM_NPAGES_MIN
elif [ $npages -gt $KSM_NPAGES_MAX ]; then
npages=$KSM_NPAGES_MAX
fi
echo $npages
}
adjust () {
local free committed
free=`free_memory`
committed=`committed_memory`
debug committed $committed free $free
if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then
KSMCTL stop
debug "$[committed + thres] < $total and free > $thres, stop ksm"
return 1
fi
debug "$[committed + thres] > $total, start ksm"
if [ $free -lt $thres ]; then
npages=`increase_npages $KSM_NPAGES_BOOST`
debug "$free < $thres, boost"
else
npages=`increase_npages $KSM_NPAGES_DECAY`
debug "$free > $thres, decay"
fi
KSMCTL start $npages $sleep
debug "KSMCTL start $npages $sleep"
return 0
}
function nothing () {
:
}
loop () {
trap nothing SIGUSR1
while true
do
sleep $KSM_MONITOR_INTERVAL &
wait $!
adjust
done
}
PIDFILE=${PIDFILE-/var/run/ksmtune.pid}
if touch "$PIDFILE"; then
loop &
echo $! > "$PIDFILE"
fi

21
SOURCES/ksmtuned.conf Normal file
View File

@ -0,0 +1,21 @@
# Configuration file for ksmtuned.
# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60
# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10
# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX=1250
# KSM_THRES_COEF=20
# KSM_THRES_CONST=2048
# uncomment the following if you want ksmtuned debug info
# LOGFILE=/var/log/ksmtuned
# DEBUG=1

12
SOURCES/ksmtuned.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Kernel Samepage Merging (KSM) Tuning Daemon
After=ksm.service
Requires=ksm.service
[Service]
ExecStart=/usr/sbin/ksmtuned
ExecReload=/bin/kill -USR1 $MAINPID
Type=forking
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,51 @@
From 9cb37fdbeafdbdc28cf224fd7905a7d678961505 Mon Sep 17 00:00:00 2001
From: Wei Huang <wei@redhat.com>
Date: Wed, 28 Mar 2018 18:58:55 +0200
Subject: [PATCH 001/268] AArch64: Add virt-rhel7.6 machine type
RH-Author: Wei Huang <wei@redhat.com>
Message-id: <20180328185856.20056-2-wei@redhat.com>
Patchwork-id: 79427
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 1/2] AArch64: Add virt-rhel7.6 machine type
Bugzilla: 1558723
RH-Acked-by: Andrew Jones <drjones@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
This patch adds "virt-rhel7.6" machine type. Because RHEL 7.5 virt-arm
was a preview product, we remove the "virt-rhel7.5" type to avoid the
legacy support burden.
Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/arm/virt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 806eb1e..a4d0f52 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1820,7 +1820,7 @@ static void rhel_machine_init(void)
}
type_init(rhel_machine_init);
-static void rhel750_virt_instance_init(Object *obj)
+static void rhel760_virt_instance_init(Object *obj)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
@@ -1862,8 +1862,8 @@ static void rhel750_virt_instance_init(Object *obj)
vms->irqmap=a15irqmap;
}
-static void rhel750_virt_options(MachineClass *mc)
+static void rhel760_virt_options(MachineClass *mc)
{
SET_MACHINE_COMPAT(mc, ARM_RHEL_COMPAT);
}
-DEFINE_RHEL_MACHINE_AS_LATEST(7, 5, 0)
+DEFINE_RHEL_MACHINE_AS_LATEST(7, 6, 0)
--
1.8.3.1

View File

@ -0,0 +1,105 @@
From a326b17336ae12d9fa492ea34b9b1b08150262d0 Mon Sep 17 00:00:00 2001
From: Yash Mankad <ymankad@redhat.com>
Date: Wed, 12 Dec 2018 00:14:39 +0000
Subject: [PATCH 11/13] Acceptance tests: add Linux kernel boot and console
checking test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Yash Mankad <ymankad@redhat.com>
Message-id: <d56f34e8ffd54d5df93dadface61538e5a3c99ab.1544573601.git.ymankad@redhat.com>
Patchwork-id: 83433
O-Subject: [RHEL-8.0 qemu-kvm PATCH v2 5/7] Acceptance tests: add Linux kernel boot and console checking test
Bugzilla: 1655807
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
From: Cleber Rosa <crosa@redhat.com>
This test boots a Linux kernel, and checks that the given command
line was effective in two ways:
* It makes the kernel use the set "console device" as a console
* The kernel records the command line as expected in the console
Given that way too many error conditions may occur, and detecting the
kernel boot progress status may not be trivial, this test relies on a
timeout to handle unexpected situations. Also, it's *not* tagged as a
quick test for obvious reasons.
It may be useful, while interactively running/debugging this test, or
tests similar to this one, to show some of the logging channels.
Example:
$ avocado --show=QMP,console run boot_linux_console.py
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20180530184156.15634-6-crosa@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit c1cc73f407b890c4e7ab5bf520c0637e0364e92a)
Signed-off-by: Yash Mankad <ymankad@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/acceptance/boot_linux_console.py | 47 ++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 tests/acceptance/boot_linux_console.py
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
new file mode 100644
index 0000000..98324f7
--- /dev/null
+++ b/tests/acceptance/boot_linux_console.py
@@ -0,0 +1,47 @@
+# Functional test that boots a Linux kernel and checks the console
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# Author:
+# Cleber Rosa <crosa@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import logging
+
+from avocado_qemu import Test
+
+
+class BootLinuxConsole(Test):
+ """
+ Boots a x86_64 Linux kernel and checks that the console is operational
+ and the kernel command line is properly passed from QEMU to the kernel
+
+ :avocado: enable
+ :avocado: tags=x86_64
+ """
+
+ timeout = 60
+
+ def test(self):
+ kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
+ 'Everything/x86_64/os/images/pxeboot/vmlinuz')
+ kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+ self.vm.set_machine('pc')
+ self.vm.set_console()
+ kernel_command_line = 'console=ttyS0'
+ self.vm.add_args('-kernel', kernel_path,
+ '-append', kernel_command_line)
+ self.vm.launch()
+ console = self.vm.console_socket.makefile()
+ console_logger = logging.getLogger('console')
+ while True:
+ msg = console.readline()
+ console_logger.debug(msg.strip())
+ if 'Kernel command line: %s' % kernel_command_line in msg:
+ break
+ if 'Kernel panic - not syncing' in msg:
+ self.fail("Kernel panic reached")
--
1.8.3.1

View File

@ -0,0 +1,180 @@
From ae8198a11e507c4f4f701aa92c3ae531d140e547 Mon Sep 17 00:00:00 2001
From: Yash Mankad <ymankad@redhat.com>
Date: Wed, 12 Dec 2018 00:14:41 +0000
Subject: [PATCH 13/13] Acceptance tests: add make rule for running them
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Yash Mankad <ymankad@redhat.com>
Message-id: <9527fefa2d8d1b27d4a647cf8355236b61fb028b.1544573601.git.ymankad@redhat.com>
Patchwork-id: 83439
O-Subject: [RHEL-8.0 qemu-kvm PATCH v2 7/7] Acceptance tests: add make rule for running them
Bugzilla: 1655807
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
From: Cleber Rosa <crosa@redhat.com>
The acceptance (aka functional, aka Avocado-based) tests are
Python files located in "tests/acceptance" that need to be run
with the Avocado libs and test runner.
Let's provide a convenient way for QEMU developers to run them,
by making use of the tests-venv with the required setup.
Also, while the Avocado test runner will take care of creating a
location to save test results to, it was understood that it's better
if the results are kept within the build tree.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Caio Carrara <ccarrara@redhat.com>
Message-Id: <20181018153134.8493-3-crosa@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit a56931eef343c7564e35bcc05eaed2a469a1b1b8)
Signed-off-by: Yash Mankad <ymankad@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
docs/devel/testing.rst | 43 ++++++++++++++++++++++++++++++++++++++-----
tests/Makefile.include | 21 +++++++++++++++++++--
tests/requirements.txt | 1 +
3 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index f33e5a8..db08a80 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -524,10 +524,39 @@ Tests based on ``avocado_qemu.Test`` can easily:
- http://avocado-framework.readthedocs.io/en/latest/api/test/avocado.html#avocado.Test
- http://avocado-framework.readthedocs.io/en/latest/api/utils/avocado.utils.html
-Installation
-------------
+Running tests
+-------------
+
+You can run the acceptance tests simply by executing:
+
+.. code::
+
+ make check-acceptance
+
+This involves the automatic creation of Python virtual environment
+within the build tree (at ``tests/venv``) which will have all the
+right dependencies, and will save tests results also within the
+build tree (at ``tests/results``).
-To install Avocado and its dependencies, run:
+Note: the build environment must be using a Python 3 stack, and have
+the ``venv`` and ``pip`` packages installed. If necessary, make sure
+``configure`` is called with ``--python=`` and that those modules are
+available. On Debian and Ubuntu based systems, depending on the
+specific version, they may be on packages named ``python3-venv`` and
+``python3-pip``.
+
+The scripts installed inside the virtual environment may be used
+without an "activation". For instance, the Avocado test runner
+may be invoked by running:
+
+ .. code::
+
+ tests/venv/bin/avocado run $OPTION1 $OPTION2 tests/acceptance/
+
+Manual Installation
+-------------------
+
+To manually install Avocado and its dependencies, run:
.. code::
@@ -668,11 +697,15 @@ The exact QEMU binary to be used on QEMUMachine.
Uninstalling Avocado
--------------------
-If you've followed the installation instructions above, you can easily
-uninstall Avocado. Start by listing the packages you have installed::
+If you've followed the manual installation instructions above, you can
+easily uninstall Avocado. Start by listing the packages you have
+installed::
pip list --user
And remove any package you want with::
pip uninstall <package_name>
+
+If you've used ``make check-acceptance``, the Python virtual environment where
+Avocado is installed will be cleaned up as part of ``make check-clean``.
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 99a9dcd..1177ca3 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -10,6 +10,7 @@ check-help:
@echo " $(MAKE) check-speed Run qobject speed tests"
@echo " $(MAKE) check-qapi-schema Run QAPI schema tests"
@echo " $(MAKE) check-block Run block tests"
+ @echo " $(MAKE) check-acceptance Run all acceptance (functional) tests"
@echo " $(MAKE) check-report.html Generates an HTML test report"
@echo " $(MAKE) check-venv Creates a Python venv for tests"
@echo " $(MAKE) check-clean Clean the tests"
@@ -956,10 +957,15 @@ check-decodetree:
# Python venv for running tests
-.PHONY: check-venv
+.PHONY: check-venv check-acceptance
TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
+TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
+# Controls the output generated by Avocado when running tests.
+# Any number of command separated loggers are accepted. For more
+# information please refer to "avocado --help".
+AVOCADO_SHOW=none
$(shell $(PYTHON) -c 'import sys; assert sys.version_info >= (3,0)' >/dev/null 2>&1)
ifeq ($(.SHELLSTATUS),0)
@@ -976,8 +982,19 @@ $(TESTS_VENV_DIR):
$(error "venv directory for tests requires Python 3")
endif
+$(TESTS_RESULTS_DIR):
+ $(call quiet-command, mkdir -p $@, \
+ MKDIR, $@)
+
check-venv: $(TESTS_VENV_DIR)
+check-acceptance: check-venv $(TESTS_RESULTS_DIR)
+ $(call quiet-command, \
+ $(TESTS_VENV_DIR)/bin/python -m avocado \
+ --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
+ --failfast=on $(SRC_PATH)/tests/acceptance, \
+ "AVOCADO", "tests/acceptance")
+
# Consolidated targets
.PHONY: check-qapi-schema check-qtest check-unit check check-clean
@@ -992,7 +1009,7 @@ check-clean:
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
rm -f tests/test-qapi-gen-timestamp
- rm -rf $(TESTS_VENV_DIR)
+ rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
clean: check-clean
diff --git a/tests/requirements.txt b/tests/requirements.txt
index d39f9d1..64c6e27 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -1,3 +1,4 @@
# Add Python module requirements, one per line, to be installed
# in the tests/venv Python virtual environment. For more info,
# refer to: https://pip.pypa.io/en/stable/user_guide/#id1
+avocado-framework==65.0
--
1.8.3.1

View File

@ -0,0 +1,104 @@
From f737591acbcb84db4da620b94970bc3ac4e3b655 Mon Sep 17 00:00:00 2001
From: Yash Mankad <ymankad@redhat.com>
Date: Wed, 12 Dec 2018 00:14:37 +0000
Subject: [PATCH 09/13] Acceptance tests: add quick VNC tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Yash Mankad <ymankad@redhat.com>
Message-id: <77eca16322a6a90444210ee11d64875df2746029.1544573601.git.ymankad@redhat.com>
Patchwork-id: 83434
O-Subject: [RHEL-8.0 qemu-kvm PATCH v2 3/7] Acceptance tests: add quick VNC tests
Bugzilla: 1655807
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
From: Cleber Rosa <crosa@redhat.com>
This patch adds a few simple behavior tests for VNC.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20180530184156.15634-4-crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 7b1bd11cff0915a1266c34bdfb66d70f6372340d)
Signed-off-by: Yash Mankad <ymankad@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/acceptance/vnc.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 tests/acceptance/vnc.py
diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py
new file mode 100644
index 0000000..b1ef9d7
--- /dev/null
+++ b/tests/acceptance/vnc.py
@@ -0,0 +1,60 @@
+# Simple functional tests for VNC functionality
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# Author:
+# Cleber Rosa <crosa@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+
+
+class Vnc(Test):
+ """
+ :avocado: enable
+ :avocado: tags=vnc,quick
+ """
+ def test_no_vnc(self):
+ self.vm.add_args('-nodefaults', '-S')
+ self.vm.launch()
+ self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
+
+ def test_no_vnc_change_password(self):
+ self.vm.add_args('-nodefaults', '-S')
+ self.vm.launch()
+ self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
+ set_password_response = self.vm.qmp('change',
+ device='vnc',
+ target='password',
+ arg='new_password')
+ self.assertIn('error', set_password_response)
+ self.assertEqual(set_password_response['error']['class'],
+ 'GenericError')
+ self.assertEqual(set_password_response['error']['desc'],
+ 'Could not set password')
+
+ def test_vnc_change_password_requires_a_password(self):
+ self.vm.add_args('-nodefaults', '-S', '-vnc', ':0')
+ self.vm.launch()
+ self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
+ set_password_response = self.vm.qmp('change',
+ device='vnc',
+ target='password',
+ arg='new_password')
+ self.assertIn('error', set_password_response)
+ self.assertEqual(set_password_response['error']['class'],
+ 'GenericError')
+ self.assertEqual(set_password_response['error']['desc'],
+ 'Could not set password')
+
+ def test_vnc_change_password(self):
+ self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password')
+ self.vm.launch()
+ self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
+ set_password_response = self.vm.qmp('change',
+ device='vnc',
+ target='password',
+ arg='new_password')
+ self.assertEqual(set_password_response['return'], {})
--
1.8.3.1

View File

@ -0,0 +1,359 @@
From 687a123ab2165fa3adf9e3469577c22008125270 Mon Sep 17 00:00:00 2001
From: Yash Mankad <ymankad@redhat.com>
Date: Wed, 12 Dec 2018 00:14:35 +0000
Subject: [PATCH 07/13] Add functional/acceptance tests infrastructure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Yash Mankad <ymankad@redhat.com>
Message-id: <b1ac81d7ccd9e43f36a74dc6a008974484508c7f.1544573601.git.ymankad@redhat.com>
Patchwork-id: 83432
O-Subject: [RHEL-8.0 qemu-kvm PATCH v2 1/7] Add functional/acceptance tests infrastructure
Bugzilla: 1655807
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
From: Cleber Rosa <crosa@redhat.com>
This patch adds the very minimum infrastructure necessary for writing
and running functional/acceptance tests, including:
* Documentation
* The avocado_qemu.Test base test class
* One example tests (version.py)
Additional functionality is expected to be added along the tests that
require them.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20180530184156.15634-2-crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[ehabkost: fix typo on testing.rst]
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit c3d7e8c90db208b1d876f8d6458c2dfca169137f)
Signed-off-by: Yash Mankad <ymankad@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
docs/devel/testing.rst | 192 ++++++++++++++++++++++++++++++
tests/acceptance/README.rst | 10 ++
tests/acceptance/avocado_qemu/__init__.py | 54 +++++++++
tests/acceptance/version.py | 24 ++++
4 files changed, 280 insertions(+)
create mode 100644 tests/acceptance/README.rst
create mode 100644 tests/acceptance/avocado_qemu/__init__.py
create mode 100644 tests/acceptance/version.py
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 0ca1a2d..f33e5a8 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -484,3 +484,195 @@ supported. To start the fuzzer, run
Alternatively, some command different from "qemu-img info" can be tested, by
changing the ``-c`` option.
+
+Acceptance tests using the Avocado Framework
+============================================
+
+The ``tests/acceptance`` directory hosts functional tests, also known
+as acceptance level tests. They're usually higher level tests, and
+may interact with external resources and with various guest operating
+systems.
+
+These tests are written using the Avocado Testing Framework (which must
+be installed separately) in conjunction with a the ``avocado_qemu.Test``
+class, implemented at ``tests/acceptance/avocado_qemu``.
+
+Tests based on ``avocado_qemu.Test`` can easily:
+
+ * Customize the command line arguments given to the convenience
+ ``self.vm`` attribute (a QEMUMachine instance)
+
+ * Interact with the QEMU monitor, send QMP commands and check
+ their results
+
+ * Interact with the guest OS, using the convenience console device
+ (which may be useful to assert the effectiveness and correctness of
+ command line arguments or QMP commands)
+
+ * Interact with external data files that accompany the test itself
+ (see ``self.get_data()``)
+
+ * Download (and cache) remote data files, such as firmware and kernel
+ images
+
+ * Have access to a library of guest OS images (by means of the
+ ``avocado.utils.vmimage`` library)
+
+ * Make use of various other test related utilities available at the
+ test class itself and at the utility library:
+
+ - http://avocado-framework.readthedocs.io/en/latest/api/test/avocado.html#avocado.Test
+ - http://avocado-framework.readthedocs.io/en/latest/api/utils/avocado.utils.html
+
+Installation
+------------
+
+To install Avocado and its dependencies, run:
+
+.. code::
+
+ pip install --user avocado-framework
+
+Alternatively, follow the instructions on this link:
+
+ http://avocado-framework.readthedocs.io/en/latest/GetStartedGuide.html#installing-avocado
+
+Overview
+--------
+
+This directory provides the ``avocado_qemu`` Python module, containing
+the ``avocado_qemu.Test`` class. Here's a simple usage example:
+
+.. code::
+
+ from avocado_qemu import Test
+
+
+ class Version(Test):
+ """
+ :avocado: enable
+ :avocado: tags=quick
+ """
+ def test_qmp_human_info_version(self):
+ self.vm.launch()
+ res = self.vm.command('human-monitor-command',
+ command_line='info version')
+ self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
+
+To execute your test, run:
+
+.. code::
+
+ avocado run version.py
+
+Tests may be classified according to a convention by using docstring
+directives such as ``:avocado: tags=TAG1,TAG2``. To run all tests
+in the current directory, tagged as "quick", run:
+
+.. code::
+
+ avocado run -t quick .
+
+The ``avocado_qemu.Test`` base test class
+-----------------------------------------
+
+The ``avocado_qemu.Test`` class has a number of characteristics that
+are worth being mentioned right away.
+
+First of all, it attempts to give each test a ready to use QEMUMachine
+instance, available at ``self.vm``. Because many tests will tweak the
+QEMU command line, launching the QEMUMachine (by using ``self.vm.launch()``)
+is left to the test writer.
+
+At test "tear down", ``avocado_qemu.Test`` handles the QEMUMachine
+shutdown.
+
+QEMUMachine
+~~~~~~~~~~~
+
+The QEMUMachine API is already widely used in the Python iotests,
+device-crash-test and other Python scripts. It's a wrapper around the
+execution of a QEMU binary, giving its users:
+
+ * the ability to set command line arguments to be given to the QEMU
+ binary
+
+ * a ready to use QMP connection and interface, which can be used to
+ send commands and inspect its results, as well as asynchronous
+ events
+
+ * convenience methods to set commonly used command line arguments in
+ a more succinct and intuitive way
+
+QEMU binary selection
+~~~~~~~~~~~~~~~~~~~~~
+
+The QEMU binary used for the ``self.vm`` QEMUMachine instance will
+primarily depend on the value of the ``qemu_bin`` parameter. If it's
+not explicitly set, its default value will be the result of a dynamic
+probe in the same source tree. A suitable binary will be one that
+targets the architecture matching host machine.
+
+Based on this description, test writers will usually rely on one of
+the following approaches:
+
+1) Set ``qemu_bin``, and use the given binary
+
+2) Do not set ``qemu_bin``, and use a QEMU binary named like
+ "${arch}-softmmu/qemu-system-${arch}", either in the current
+ working directory, or in the current source tree.
+
+The resulting ``qemu_bin`` value will be preserved in the
+``avocado_qemu.Test`` as an attribute with the same name.
+
+Attribute reference
+-------------------
+
+Besides the attributes and methods that are part of the base
+``avocado.Test`` class, the following attributes are available on any
+``avocado_qemu.Test`` instance.
+
+vm
+~~
+
+A QEMUMachine instance, initially configured according to the given
+``qemu_bin`` parameter.
+
+qemu_bin
+~~~~~~~~
+
+The preserved value of the ``qemu_bin`` parameter or the result of the
+dynamic probe for a QEMU binary in the current working directory or
+source tree.
+
+Parameter reference
+-------------------
+
+To understand how Avocado parameters are accessed by tests, and how
+they can be passed to tests, please refer to::
+
+ http://avocado-framework.readthedocs.io/en/latest/WritingTests.html#accessing-test-parameters
+
+Parameter values can be easily seen in the log files, and will look
+like the following:
+
+.. code::
+
+ PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64
+
+qemu_bin
+~~~~~~~~
+
+The exact QEMU binary to be used on QEMUMachine.
+
+Uninstalling Avocado
+--------------------
+
+If you've followed the installation instructions above, you can easily
+uninstall Avocado. Start by listing the packages you have installed::
+
+ pip list --user
+
+And remove any package you want with::
+
+ pip uninstall <package_name>
diff --git a/tests/acceptance/README.rst b/tests/acceptance/README.rst
new file mode 100644
index 0000000..89260fa
--- /dev/null
+++ b/tests/acceptance/README.rst
@@ -0,0 +1,10 @@
+============================================
+Acceptance tests using the Avocado Framework
+============================================
+
+This directory contains functional tests, also known as acceptance
+level tests. They're usually higher level, and may interact with
+external resources and with various guest operating systems.
+
+For more information, please refer to ``docs/devel/testing.rst``,
+section "Acceptance tests using the Avocado Framework".
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
new file mode 100644
index 0000000..1e54fd5
--- /dev/null
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -0,0 +1,54 @@
+# Test class and utilities for functional tests
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# Author:
+# Cleber Rosa <crosa@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+import sys
+
+import avocado
+
+SRC_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+SRC_ROOT_DIR = os.path.abspath(os.path.dirname(SRC_ROOT_DIR))
+sys.path.append(os.path.join(SRC_ROOT_DIR, 'scripts'))
+
+from qemu import QEMUMachine
+
+def is_readable_executable_file(path):
+ return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
+
+
+def pick_default_qemu_bin():
+ """
+ Picks the path of a QEMU binary, starting either in the current working
+ directory or in the source tree root directory.
+ """
+ arch = os.uname()[4]
+ qemu_bin_relative_path = os.path.join("%s-softmmu" % arch,
+ "qemu-system-%s" % arch)
+ if is_readable_executable_file(qemu_bin_relative_path):
+ return qemu_bin_relative_path
+
+ qemu_bin_from_src_dir_path = os.path.join(SRC_ROOT_DIR,
+ qemu_bin_relative_path)
+ if is_readable_executable_file(qemu_bin_from_src_dir_path):
+ return qemu_bin_from_src_dir_path
+
+
+class Test(avocado.Test):
+ def setUp(self):
+ self.vm = None
+ self.qemu_bin = self.params.get('qemu_bin',
+ default=pick_default_qemu_bin())
+ if self.qemu_bin is None:
+ self.cancel("No QEMU binary defined or found in the source tree")
+ self.vm = QEMUMachine(self.qemu_bin)
+
+ def tearDown(self):
+ if self.vm is not None:
+ self.vm.shutdown()
diff --git a/tests/acceptance/version.py b/tests/acceptance/version.py
new file mode 100644
index 0000000..13b0a74
--- /dev/null
+++ b/tests/acceptance/version.py
@@ -0,0 +1,24 @@
+# Version check example test
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# Author:
+# Cleber Rosa <crosa@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+
+from avocado_qemu import Test
+
+
+class Version(Test):
+ """
+ :avocado: enable
+ :avocado: tags=quick
+ """
+ def test_qmp_human_info_version(self):
+ self.vm.launch()
+ res = self.vm.command('human-monitor-command',
+ command_line='info version')
+ self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
--
1.8.3.1

View File

@ -0,0 +1,160 @@
From 90b8d9d17a9c252427df71fbe5bd76f897529e71 Mon Sep 17 00:00:00 2001
From: "plai@redhat.com" <plai@redhat.com>
Date: Wed, 3 Apr 2019 15:54:30 +0100
Subject: [PATCH 06/10] kvm: Add support to KVM_GET_MSR_FEATURE_INDEX_LIST and
KVM_GET_MSRS system ioctl
RH-Author: plai@redhat.com
Message-id: <1554306874-28796-7-git-send-email-plai@redhat.com>
Patchwork-id: 85384
O-Subject: [RHEL8.1 qemu-kvm PATCH resend 06/10] kvm: Add support to KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSRS system ioctl
Bugzilla: 1561761
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
From: Robert Hoo <robert.hu@linux.intel.com>
Add kvm_get_supported_feature_msrs() to get supported MSR feature index list.
Add kvm_arch_get_supported_msr_feature() to get each MSR features value.
Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
Message-Id: <1539578845-37944-2-git-send-email-robert.hu@linux.intel.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit f57bceb6ab5163ddd6c41ff4344ab8cf28a9c63d)
Signed-off-by: Paul Lai <plai@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
include/sysemu/kvm.h | 2 ++
target/i386/kvm.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 23669c4..3d8f294 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -464,6 +464,8 @@ int kvm_vm_check_extension(KVMState *s, unsigned int extension);
uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
uint32_t index, int reg);
+uint32_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index);
+
void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len);
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 702e3bf..096ed24 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -106,6 +106,7 @@ static int has_pit_state2;
static bool has_msr_mcg_ext_ctl;
static struct kvm_cpuid2 *cpuid_cache;
+static struct kvm_msr_list *kvm_feature_msrs;
int kvm_has_pit_state2(void)
{
@@ -405,6 +406,42 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
return ret;
}
+uint32_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
+{
+ struct {
+ struct kvm_msrs info;
+ struct kvm_msr_entry entries[1];
+ } msr_data;
+ uint32_t ret;
+
+ if (kvm_feature_msrs == NULL) { /* Host doesn't support feature MSRs */
+ return 0;
+ }
+
+ /* Check if requested MSR is supported feature MSR */
+ int i;
+ for (i = 0; i < kvm_feature_msrs->nmsrs; i++)
+ if (kvm_feature_msrs->indices[i] == index) {
+ break;
+ }
+ if (i == kvm_feature_msrs->nmsrs) {
+ return 0; /* if the feature MSR is not supported, simply return 0 */
+ }
+
+ msr_data.info.nmsrs = 1;
+ msr_data.entries[0].index = index;
+
+ ret = kvm_ioctl(s, KVM_GET_MSRS, &msr_data);
+ if (ret != 1) {
+ error_report("KVM get MSR (index=0x%x) feature failed, %s",
+ index, strerror(-ret));
+ exit(1);
+ }
+
+ return msr_data.entries[0].data;
+}
+
+
typedef struct HWPoisonPage {
ram_addr_t ram_addr;
QLIST_ENTRY(HWPoisonPage) list;
@@ -1164,6 +1201,47 @@ void kvm_arch_do_init_vcpu(X86CPU *cpu)
}
}
+static int kvm_get_supported_feature_msrs(KVMState *s)
+{
+ int ret = 0;
+
+ if (kvm_feature_msrs != NULL) {
+ return 0;
+ }
+
+ if (!kvm_check_extension(s, KVM_CAP_GET_MSR_FEATURES)) {
+ return 0;
+ }
+
+ struct kvm_msr_list msr_list;
+
+ msr_list.nmsrs = 0;
+ ret = kvm_ioctl(s, KVM_GET_MSR_FEATURE_INDEX_LIST, &msr_list);
+ if (ret < 0 && ret != -E2BIG) {
+ error_report("Fetch KVM feature MSR list failed: %s",
+ strerror(-ret));
+ return ret;
+ }
+
+ assert(msr_list.nmsrs > 0);
+ kvm_feature_msrs = (struct kvm_msr_list *) \
+ g_malloc0(sizeof(msr_list) +
+ msr_list.nmsrs * sizeof(msr_list.indices[0]));
+
+ kvm_feature_msrs->nmsrs = msr_list.nmsrs;
+ ret = kvm_ioctl(s, KVM_GET_MSR_FEATURE_INDEX_LIST, kvm_feature_msrs);
+
+ if (ret < 0) {
+ error_report("Fetch KVM feature MSR list failed: %s",
+ strerror(-ret));
+ g_free(kvm_feature_msrs);
+ kvm_feature_msrs = NULL;
+ return ret;
+ }
+
+ return 0;
+}
+
static int kvm_get_supported_msrs(KVMState *s)
{
static int kvm_supported_msrs;
@@ -1320,6 +1398,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
return ret;
}
+ kvm_get_supported_feature_msrs(s);
+
uname(&utsname);
lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0;
--
1.8.3.1

View File

@ -0,0 +1,108 @@
From 5c0a6bb69135e0fa83a1e063dfe878e5e98c1785 Mon Sep 17 00:00:00 2001
From: Yash Mankad <ymankad@redhat.com>
Date: Wed, 12 Dec 2018 00:14:40 +0000
Subject: [PATCH 12/13] Bootstrap Python venv for tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Yash Mankad <ymankad@redhat.com>
Message-id: <8e00545539681a5de548c444e7752894b12bc8ec.1544573601.git.ymankad@redhat.com>
Patchwork-id: 83436
O-Subject: [RHEL-8.0 qemu-kvm PATCH v2 6/7] Bootstrap Python venv for tests
Bugzilla: 1655807
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
From: Cleber Rosa <crosa@redhat.com>
A number of QEMU tests are written in Python, and may benefit
from an untainted Python venv.
By using make rules, tests that depend on specific Python libs
can set that rule as a requirement, along with rules that require
the presence or installation of specific libraries.
The tests/requirements.txt is supposed to contain the Python
requirements that should be added to the venv created by check-venv.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Caio Carrara <ccarrara@redhat.com>
Message-Id: <20181018153134.8493-2-crosa@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 213137217a60eca18e9b55817f00dfdd6eaff74a)
Signed-off-by: Yash Mankad <ymankad@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/Makefile.include | 26 ++++++++++++++++++++++++++
tests/requirements.txt | 3 +++
2 files changed, 29 insertions(+)
create mode 100644 tests/requirements.txt
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3ed8531..99a9dcd 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -11,6 +11,7 @@ check-help:
@echo " $(MAKE) check-qapi-schema Run QAPI schema tests"
@echo " $(MAKE) check-block Run block tests"
@echo " $(MAKE) check-report.html Generates an HTML test report"
+ @echo " $(MAKE) check-venv Creates a Python venv for tests"
@echo " $(MAKE) check-clean Clean the tests"
@echo
@echo "Please note that HTML reports do not regenerate if the unit tests"
@@ -953,6 +954,30 @@ check-decodetree:
./check.sh "$(PYTHON)" "$(SRC_PATH)/scripts/decodetree.py", \
TEST, decodetree.py)
+# Python venv for running tests
+
+.PHONY: check-venv
+
+TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
+TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
+
+$(shell $(PYTHON) -c 'import sys; assert sys.version_info >= (3,0)' >/dev/null 2>&1)
+ifeq ($(.SHELLSTATUS),0)
+$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
+ $(call quiet-command, \
+ $(PYTHON) -m venv --system-site-packages $@, \
+ VENV, $@)
+ $(call quiet-command, \
+ $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
+ PIP, $(TESTS_VENV_REQ))
+ $(call quiet-command, touch $@)
+else
+$(TESTS_VENV_DIR):
+ $(error "venv directory for tests requires Python 3")
+endif
+
+check-venv: $(TESTS_VENV_DIR)
+
# Consolidated targets
.PHONY: check-qapi-schema check-qtest check-unit check check-clean
@@ -967,6 +992,7 @@ check-clean:
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
rm -f tests/test-qapi-gen-timestamp
+ rm -rf $(TESTS_VENV_DIR)
clean: check-clean
diff --git a/tests/requirements.txt b/tests/requirements.txt
new file mode 100644
index 0000000..d39f9d1
--- /dev/null
+++ b/tests/requirements.txt
@@ -0,0 +1,3 @@
+# Add Python module requirements, one per line, to be installed
+# in the tests/venv Python virtual environment. For more info,
+# refer to: https://pip.pypa.io/en/stable/user_guide/#id1
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From 4b889f33761a4447998b16846bfb983519def96d Mon Sep 17 00:00:00 2001
From: Thomas Huth <thuth@redhat.com>
Date: Wed, 28 Nov 2018 07:23:59 +0000
Subject: [PATCH 07/16] Declare cirrus-vga as deprecated
RH-Author: Thomas Huth <thuth@redhat.com>
Message-id: <1543389839-8995-1-git-send-email-thuth@redhat.com>
Patchwork-id: 83178
O-Subject: [RHEL8 qemu-kvm PATCH v2] Declare cirrus-vga as deprecated
Bugzilla: 1651994
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1651994
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19300792
Upstream: n/a (downstream only)
Branch: rhel8/master-2.12.0
Branch: rhel8/master-3.0.0
The "cirrus" device in qemu-kvm is considered as a legacy device, which
also had a lot of security issues in the past. KVM guest should preferably
use "stdvga", "virtio-vga" or "qxl" as graphics card nowadays instead.
To avoid that we have to carry along the legacy "cirrus" device in
downstream qemu-kvm forever, let's mark it as deprecated in RHEL8 now,
so that we can finally remove it in RHEL9.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/display/cirrus_vga.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 014268a..29d6055 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -3098,6 +3098,9 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp)
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
int16_t device_id = pc->device_id;
+ warn_report("'cirrus-vga' is deprecated, "
+ "please use a different VGA card instead");
+
/* follow real hardware, cirrus card emulated has 4 MB video memory.
Also accept 8 MB/16 MB for backward compatibility. */
if (s->vga.vram_size_mb != 4 && s->vga.vram_size_mb != 8 &&
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From d68f80c725a05ddf0a2a997ba35832e8f32c7fe9 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 7 Jun 2018 07:43:11 +0200
Subject: [PATCH 259/268] Disable AT24Cx i2c eeprom
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <fc4088a0a805b32f545c561a76d20115da8de85d.1528355911.git.mrezanin@redhat.com>
Patchwork-id: 80598
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 3/7] Disable AT24Cx i2c eeprom
Bugzilla: 1586357
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
We do not want to support new eeprom_at24c device. It is protected
by CONFIG_I2C option but we can't remove it as it cover other supported
devices. Manually remove module with the device.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/nvram/Makefile.objs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/nvram/Makefile.objs b/hw/nvram/Makefile.objs
index a912d25..cbc8bba 100644
--- a/hw/nvram/Makefile.objs
+++ b/hw/nvram/Makefile.objs
@@ -1,6 +1,6 @@
common-obj-$(CONFIG_DS1225Y) += ds1225y.o
common-obj-y += eeprom93xx.o
-common-obj-$(CONFIG_I2C) += eeprom_at24c.o
+#common-obj-$(CONFIG_I2C) += eeprom_at24c.o
common-obj-y += fw_cfg.o
common-obj-y += chrp_nvram.o
common-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 3f953e91fb0d690f33dd6e0d4b257cbb97c410cc Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 7 Jun 2018 07:43:12 +0200
Subject: [PATCH 260/268] Disable CAN bus devices
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <706a21b4d25946165513ff99619c0fed0852dc50.1528355911.git.mrezanin@redhat.com>
Patchwork-id: 80593
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 4/7] Disable CAN bus devices
Bugzilla: 1586357
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
We do not want to support new CAN devices (kvaser_pci, mioe3680_pci
and pcm3680_pci).
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
default-configs/pci.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index 4c8c296..25fc382 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -33,7 +33,7 @@ CONFIG_SERIAL_ISA=y
CONFIG_SERIAL_PCI=y
CONFIG_CAN_BUS=y
CONFIG_CAN_SJA1000=y
-CONFIG_CAN_PCI=y
+#CONFIG_CAN_PCI=y
#CONFIG_IPACK=y
CONFIG_WDT_IB6300ESB=y
CONFIG_PCI_TESTDEV=y
--
1.8.3.1

View File

@ -0,0 +1,55 @@
From 9caf292924a26cbfb7e46d232a0f32f706254866 Mon Sep 17 00:00:00 2001
From: Danilo de Paula <ddepaula@redhat.com>
Date: Fri, 7 Dec 2018 14:16:59 +0000
Subject: [PATCH 2/2] Disable CONFIG_CAN_BUS and CONFIG_CAN_SJA1000
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Danilo de Paula <ddepaula@redhat.com>
Message-id: <20181207141659.3485-1-ddepaula@redhat.com>
Patchwork-id: 83304
O-Subject: [RHEL-8.0/rhel qemu-kvm PATCH] Disable CONFIG_CAN_BUS and CONFIG_CAN_SJA1000
Bugzilla: 1640042
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
BZ: 1640042
Branch: rhel8/master-2.12.0
Branch: rhel8/master-3.1.0-rc2
Upstream: Downstream only
Brew: None
We currently compile qemu-kvm with CONFIG_CAN_SJA1000=y and
CONFIG_CAN_BUS=y in default-configs/pci.mak.
As far as I can see, this has currently no effect,
since we already disabled the other CONFIG_CAN_* switches there
(which control the inclusion of the emulated CAN devices).
Since we do not have any plans to support CAN in downstream, we should also disable
CONFIG_CAN_BUS and CONFIG_CAN_SJA1000 in our downstream configuration.
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
default-configs/pci.mak | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index 763c375..2277308 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -31,8 +31,8 @@ CONFIG_AHCI=y
CONFIG_SERIAL=y
CONFIG_SERIAL_ISA=y
CONFIG_SERIAL_PCI=y
-CONFIG_CAN_BUS=y
-CONFIG_CAN_SJA1000=y
+#CONFIG_CAN_BUS=y
+#CONFIG_CAN_SJA1000=y
#CONFIG_CAN_PCI=y
#CONFIG_IPACK=y
CONFIG_WDT_IB6300ESB=y
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From 3eef52a0caff23b537e88009d79ec1725ccebe06 Mon Sep 17 00:00:00 2001
From: Danilo de Paula <ddepaula@redhat.com>
Date: Fri, 7 Dec 2018 14:12:00 +0000
Subject: [PATCH 1/2] Disable CONFIG_IPMI and CONFIG_I2C for ppc64
RH-Author: Danilo de Paula <ddepaula@redhat.com>
Message-id: <20181207141200.30857-1-ddepaula@redhat.com>
Patchwork-id: 83303
O-Subject: [RHEL-8.0/rhel qemu-kvm PATCH] Disable CONFIG_IPMI and CONFIG_I2C for ppc64
Bugzilla: 1640044
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: David Gibson <dgibson@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
BZ: 1640044
Branch: rhel8/master-2.12.0
Branch: rhel8/master-3.1.0-rc2
Upstream: Downstream only
Brew: none
Our downstream qemu-kvm only uses the para-virtualized "pseries" machine
type.
There is no need to include I2C or IPMI.
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
default-configs/ppc64-softmmu.mak | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index 0ee8f6c..cece3dc 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -15,11 +15,11 @@ CONFIG_USB_OHCI=y
CONFIG_VGA=y
CONFIG_VGA_PCI=y
CONFIG_SERIAL=y
-CONFIG_I2C=y
+#CONFIG_I2C=y
# For PowerNV
#CONFIG_POWERNV=y
-CONFIG_IPMI=y
+#CONFIG_IPMI=y
#CONFIG_IPMI_LOCAL=y
#CONFIG_IPMI_EXTERN=y
#CONFIG_ISA_IPMI_BT=y
--
1.8.3.1

View File

@ -0,0 +1,457 @@
From 88780a41e05b8079cde07466c252b42c113f9e5c Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Sun, 9 Jun 2019 09:35:09 +0100
Subject: [PATCH 8/8] Disable VXHS support
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <1560072909-1725-1-git-send-email-mrezanin@redhat.com>
Patchwork-id: 88629
O-Subject: [RHEL-8 qemu-kvm PATCH] Disable VXHS support
Bugzilla: 1714933
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1714933
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=22065429
Branch: rhel-8.1.0
Upstream: n/a
Reverting commit e9aff9d4ab1f9c10a4cb88fc5b92c4835e8b2688 introducing
downstream modularizaiton of VXHS driver as we do not need to support
VXHS driver anymore.
Patch is not pure revert as we changed way we handle configuration
of qemu build after this patch. In addition, reverting downstream only
removing of vxhs.o from block/Makefile.obj.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block/Makefile.objs | 2 +-
block/vxhs.c | 123 ++++--------------------------------
configure | 33 +++++++++-
include/block/vxhs_shim.h | 143 ------------------------------------------
redhat/qemu-kvm.spec.template | 9 ---
5 files changed, 42 insertions(+), 268 deletions(-)
delete mode 100644 include/block/vxhs_shim.h
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 037c76b..ac7a1f8 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -29,7 +29,7 @@ block-obj-$(CONFIG_LIBNFS) += nfs.o
block-obj-$(CONFIG_CURL) += curl.o
block-obj-$(CONFIG_RBD) += rbd.o
block-obj-$(CONFIG_GLUSTERFS) += gluster.o
-#block-obj-$(CONFIG_VXHS) += vxhs.o
+block-obj-$(CONFIG_VXHS) += vxhs.o
block-obj-$(CONFIG_LIBSSH2) += ssh.o
block-obj-y += accounting.o dirty-bitmap.o
block-obj-y += write-threshold.o
diff --git a/block/vxhs.c b/block/vxhs.c
index 25fea7f..d2a1f4e 100644
--- a/block/vxhs.c
+++ b/block/vxhs.c
@@ -9,8 +9,7 @@
*/
#include "qemu/osdep.h"
-#include "block/vxhs_shim.h"
-#include <gmodule.h>
+#include <qnio/qnio_api.h>
#include <sys/param.h>
#include "block/block_int.h"
#include "block/qdict.h"
@@ -60,97 +59,6 @@ typedef struct BDRVVXHSState {
char *tlscredsid; /* tlscredsid */
} BDRVVXHSState;
-#define LIBVXHS_FULL_PATHNAME "/usr/lib64/qemu/libvxhs.so.1"
-static bool libvxhs_loaded;
-static GModule *libvxhs_handle;
-
-static LibVXHSFuncs libvxhs;
-
-typedef struct LibVXHSSymbols {
- const char *name;
- gpointer *addr;
-} LibVXHSSymbols;
-
-static LibVXHSSymbols libvxhs_symbols[] = {
- {"iio_init", (gpointer *) &libvxhs.iio_init},
- {"iio_fini", (gpointer *) &libvxhs.iio_fini},
- {"iio_min_version", (gpointer *) &libvxhs.iio_min_version},
- {"iio_max_version", (gpointer *) &libvxhs.iio_max_version},
- {"iio_open", (gpointer *) &libvxhs.iio_open},
- {"iio_close", (gpointer *) &libvxhs.iio_close},
- {"iio_writev", (gpointer *) &libvxhs.iio_writev},
- {"iio_readv", (gpointer *) &libvxhs.iio_readv},
- {"iio_ioctl", (gpointer *) &libvxhs.iio_ioctl},
- {NULL}
-};
-
-static void bdrv_vxhs_set_funcs(GModule *handle, Error **errp)
-{
- int i = 0;
- while (libvxhs_symbols[i].name) {
- const char *name = libvxhs_symbols[i].name;
- if (!g_module_symbol(handle, name, libvxhs_symbols[i].addr)) {
- error_setg(errp, "%s could not be loaded from libvxhs: %s",
- name, g_module_error());
- return;
- }
- ++i;
- }
-}
-
-static void bdrv_vxhs_load_libs(Error **errp)
-{
- Error *local_err = NULL;
- int32_t ver;
-
- if (libvxhs_loaded) {
- return;
- }
-
- if (!g_module_supported()) {
- error_setg(errp, "modules are not supported on this platform: %s",
- g_module_error());
- return;
- }
-
- libvxhs_handle = g_module_open(LIBVXHS_FULL_PATHNAME,
- G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
- if (!libvxhs_handle) {
- error_setg(errp, "The VXHS library from Veritas might not be installed "
- "correctly (%s)", g_module_error());
- return;
- }
-
- g_module_make_resident(libvxhs_handle);
-
- bdrv_vxhs_set_funcs(libvxhs_handle, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
- }
-
- /* Now check to see if the libvxhs we are using here is supported
- * by the loaded version */
-
- ver = (*libvxhs.iio_min_version)();
- if (ver > QNIO_VERSION) {
- error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
- "only %"PRId32" or newer is supported by %s",
- QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
- return;
- }
-
- ver = (*libvxhs.iio_max_version)();
- if (ver < QNIO_VERSION) {
- error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
- "only %"PRId32" or earlier is supported by %s",
- QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
- return;
- }
-
- libvxhs_loaded = true;
-}
-
static void vxhs_complete_aio_bh(void *opaque)
{
VXHSAIOCB *acb = opaque;
@@ -312,7 +220,7 @@ static void vxhs_parse_filename(const char *filename, QDict *options,
static int vxhs_init_and_ref(void)
{
if (vxhs_ref++ == 0) {
- if ((*libvxhs.iio_init)(QNIO_VERSION, vxhs_iio_callback)) {
+ if (iio_init(QNIO_VERSION, vxhs_iio_callback)) {
return -ENODEV;
}
}
@@ -322,7 +230,7 @@ static int vxhs_init_and_ref(void)
static void vxhs_unref(void)
{
if (--vxhs_ref == 0) {
- (*libvxhs.iio_fini)();
+ iio_fini();
}
}
@@ -392,17 +300,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
char *client_key = NULL;
char *client_cert = NULL;
- bdrv_vxhs_load_libs(&local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- /* on error, cannot cleanup because the iio_fini() function
- * is not loaded */
- return -EINVAL;
- }
-
ret = vxhs_init_and_ref();
if (ret < 0) {
- error_setg(&local_err, "libvxhs iio_init() failed");
ret = -EINVAL;
goto out;
}
@@ -487,8 +386,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
/*
* Open qnio channel to storage agent if not opened before
*/
- dev_handlep = (*libvxhs.iio_open)(of_vsa_addr, s->vdisk_guid, 0,
- cacert, client_key, client_cert);
+ dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0,
+ cacert, client_key, client_cert);
if (dev_handlep == NULL) {
trace_vxhs_open_iio_open(of_vsa_addr);
ret = -ENODEV;
@@ -552,12 +451,12 @@ static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, int64_t sector_num,
switch (iodir) {
case VDISK_AIO_WRITE:
- ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
- offset, (uint64_t)size, iio_flags);
+ ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov,
+ offset, (uint64_t)size, iio_flags);
break;
case VDISK_AIO_READ:
- ret = (*libvxhs.iio_readv)(dev_handle, acb, qiov->iov, qiov->niov,
- offset, (uint64_t)size, iio_flags);
+ ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov,
+ offset, (uint64_t)size, iio_flags);
break;
default:
trace_vxhs_aio_rw_invalid(iodir);
@@ -607,7 +506,7 @@ static void vxhs_close(BlockDriverState *bs)
* Close vDisk device
*/
if (s->vdisk_hostinfo.dev_handle) {
- (*libvxhs.iio_close)(s->vdisk_hostinfo.dev_handle);
+ iio_close(s->vdisk_hostinfo.dev_handle);
s->vdisk_hostinfo.dev_handle = NULL;
}
@@ -629,7 +528,7 @@ static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s)
int ret = 0;
void *dev_handle = s->vdisk_hostinfo.dev_handle;
- ret = (*libvxhs.iio_ioctl)(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
+ ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
if (ret < 0) {
trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno);
return -EIO;
diff --git a/configure b/configure
index 858b456..6d61b14 100755
--- a/configure
+++ b/configure
@@ -3428,7 +3428,7 @@ else
glib_req_ver=2.22
fi
glib_modules=gthread-2.0
-if test "$modules" = yes -o "$vxhs" = yes; then
+if test "$modules" = yes; then
glib_modules="$glib_modules gmodule-export-2.0"
fi
@@ -5391,6 +5391,33 @@ if compile_prog "" "" ; then
fi
##########################################
+# Veritas HyperScale block driver VxHS
+# Check if libvxhs is installed
+
+if test "$vxhs" != "no" ; then
+ cat > $TMPC <<EOF
+#include <stdint.h>
+#include <qnio/qnio_api.h>
+
+void *vxhs_callback;
+
+int main(void) {
+ iio_init(QNIO_VERSION, vxhs_callback);
+ return 0;
+}
+EOF
+ vxhs_libs="-lvxhs -lssl"
+ if compile_prog "" "$vxhs_libs" ; then
+ vxhs=yes
+ else
+ if test "$vxhs" = "yes" ; then
+ feature_not_found "vxhs block device" "Install libvxhs See github"
+ fi
+ vxhs=no
+ fi
+fi
+
+##########################################
# check for _Static_assert()
have_static_assert=no
@@ -6707,8 +6734,8 @@ if test "$pthread_setname_np" = "yes" ; then
fi
if test "$vxhs" = "yes" ; then
- echo "CONFIG_VXHS=m" >> $config_host_mak
- echo "VXHS_LIBS= -lssl" >> $config_host_mak
+ echo "CONFIG_VXHS=y" >> $config_host_mak
+ echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
fi
if test "$bochs" = "yes" ; then
diff --git a/include/block/vxhs_shim.h b/include/block/vxhs_shim.h
deleted file mode 100644
index 42519ae..0000000
--- a/include/block/vxhs_shim.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Network IO library for VxHS QEMU block driver (Veritas Technologies)
- *
- * This work is licensed under the terms of the GNU GPL, version 2. See
- * the COPYING file in the top-level directory.
- *
- * Contributions after 2014-08-15 are licensed under the terms of the
- * GNU GPL, version 2 or (at your option) any later version.
- */
-
-#ifndef QNIO_API_H
-#define QNIO_API_H
-
-#include <sys/uio.h>
-
-/*
- * Bump up the version everytime this file is modified
- */
-#define QNIO_VERSION 34
-
-/*
- * These are the opcodes referenced by callback routine.
- */
-#define IRP_READ_REQUEST 0x1FFF
-#define IRP_WRITE_REQUEST 0x2FFF
-#define IRP_VDISK_CHECK_IO_FAILOVER_READY 2020
-
-/*
- * opcodes for iio_ioctl.
- */
-#define IOR_VDISK_STAT 1005
-
-/*
- * Error values for iio_cb_t callback function.
- */
-#define QNIOERROR_HUP 901 /* Retriable error */
-#define QNIOERROR_NOCONN 902 /* Non-retriable error */
-
-
-/* Operation Flags */
-#define IIO_FLAG_ASYNC 0x0001 /* Do an async send */
-
-/*
- * INPUT:
- * ctx - opaque context
- * opcode - Operation
- * error - 0 for sucess, non-zero for failure.
- * RETURNS:
- * void
- * DESCRIPTION:
- * This callback is called, after Async request completes.
- *
- * CONTEXT:
- * The callback should be wait-free.
- */
-typedef void (*iio_cb_t) (void *ctx, uint32_t opcode, uint32_t error);
-
-typedef struct LibVXHSFuncs {
-/*
- * RETURNS:
- * 0 for sucess, non-zero for failure.
- * DESCRIPTION:
- * Intilize the library state. This should be called at the
- * begining before issuing any library call.
- */
- int (*iio_init)(int32_t version, iio_cb_t cb);
-/*
- * RETURNS:
- * void
- * DESCRIPTION:
- * Relinquish library resources. This should be called on the
- * close of last open device.
- */
- void (*iio_fini)(void);
-/*
- * DESCRIPTION:
- * Returns minimum QNIO API version supported by library.
- */
- int32_t (*iio_min_version)(void);
-/*
- * DESCRIPTION:
- * Returns maximum QNIO API version supported by library.
- */
- int32_t (*iio_max_version)(void);
-/*
- * INPUT:
- * uri - const string of the format of://<hostname|ip>:port
- * devid - Device ID.
- * flags - currently unused, this must be set to 0
- * cacert - CA certificates file in PEM format
- * client_key - Client private key file in PEM format
- * client_cert - Client certificate file in PEM format
- * RETURNS:
- * opeque device handle on success, NULL on failure.
- * DESCRIPTION:
- * This call returns device handle on success. Returns NULL on
- * failure with errno set
- * errno can be one of:
- * ENODEV - remote device not found
- * EBADF - Unable to open communication channel.
- * EBUSY - The call cannot be completed right now
- */
- void *(*iio_open)(const char *uri, const char *devid, uint32_t flags,
- const char *cacert, const char *client_key,
- const char *client_cert);
-/*
- * Close the device.
- * For every matching iio_open() there should be a matching iio_close()
- * The last close free all data structures associated with the device.
- */
- int32_t (*iio_close)(void *dev_handle);
-/*
- * INPUT:
- * dev_handle - device descriptor on which read/write needs to be performed
- * ctx - an opaque context that is not interpreted This is set for
- * async calls only. It can be NULL.
- * iov - an array of iovecs (This is a scatter gather operation)
- * iovcnt - the number of iovecs
- * offset - an offset to perform the write
- * size - I/O size
- * flags - can be one of
- * IIO_FLAG_ASYNC - indicating this is a aio call.
- * RETURNS:
- * -1 on error, sets errno
- * EBADF - the remote fd is bad
- * EBUSY - The call cannot be completed right now
- * EPIPE - the channel got disconnected, call back would be called in
- * addition to this.
- */
- int32_t (*iio_writev)(void *dev_handle, void *ctx, struct iovec *iov,
- int iovcnt, uint64_t offset, uint64_t size,
- uint32_t flags);
-
- int32_t (*iio_readv)(void *dev_handle, void *ctx, struct iovec *iov,
- int iovcnt, uint64_t offset, uint64_t size,
- uint32_t flags);
-
- int32_t (*iio_ioctl)(void *dev_handle, uint32_t opcode, void *opaque,
- uint32_t flags);
-
-} LibVXHSFuncs;
-
-#endif
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From c670fa1f55724d096e28c9ab929ff4cb7d935d31 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 7 Jun 2018 07:43:09 +0200
Subject: [PATCH 257/268] Disable aarch64 devices reappeared after 2.12 rebase
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <f72359b74f5219ef13ae074e11938a97c1314200.1528355911.git.mrezanin@redhat.com>
Patchwork-id: 80592
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 1/7] Disable aarch64 devices reappeared after 2.12 rebase
Bugzilla: 1586357
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
Up to QEMU 2.11 we disabled aarch64 devices by removing files from
Makefile.
As default_config options were added, we use them to disable devices
since 2.12. However, we can't turn CONFIG_ARM_V7M (turning it off will
break build) so we have to manually remove armv7m module from Makefile.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/arm/Makefile.objs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
index 2885e3e..3e8b167 100644
--- a/hw/arm/Makefile.objs
+++ b/hw/arm/Makefile.objs
@@ -16,7 +16,7 @@ obj-$(CONFIG_STRONGARM) += collie.o
obj-$(CONFIG_VERSATILE) += vexpress.o versatilepb.o
obj-$(CONFIG_ZYNQ) += xilinx_zynq.o
-obj-$(CONFIG_ARM_V7M) += armv7m.o
+#obj-$(CONFIG_ARM_V7M) += armv7m.o
obj-$(CONFIG_EXYNOS4) += exynos4210.o
obj-$(CONFIG_PXA2XX) += pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
obj-$(CONFIG_DIGIC) += digic.o
--
1.8.3.1

View File

@ -0,0 +1,36 @@
From 67c5a8ce8ef97d9b08cfcbe70e05da9ca91dd62e Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Wed, 10 Oct 2018 04:58:19 +0100
Subject: [PATCH 2/5] Disable ivshmem
RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <20181010045819.32729-3-armbru@redhat.com>
Patchwork-id: 82526
O-Subject: [RHEL8/rhel qemu-kvm PATCH 2/2] Disable ivshmem
Bugzilla: 1621817
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
default-configs/pci.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index 25fc382..763c375 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -43,7 +43,7 @@ CONFIG_PCI_TESTDEV=y
CONFIG_EDU=y
CONFIG_VGA=y
CONFIG_VGA_PCI=y
-CONFIG_IVSHMEM_DEVICE=$(CONFIG_IVSHMEM)
+#CONFIG_IVSHMEM_DEVICE=$(CONFIG_IVSHMEM)
#CONFIG_ROCKER=y
#CONFIG_VHOST_USER_SCSI=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
#CONFIG_VHOST_USER_BLK=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
--
1.8.3.1

View File

@ -0,0 +1,39 @@
From 747643ced0f1950360a2af103bb2490849aa3abf Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 7 Jun 2018 07:43:14 +0200
Subject: [PATCH 262/268] Disable new pvrdma device
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <5d290e25879e3ac42c247ff3c3a524001ceb0be1.1528355911.git.mrezanin@redhat.com>
Patchwork-id: 80597
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 6/7] Disable new pvrdma device
Bugzilla: 1586357
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
New pvrdma device was introduced in rebase to QEMU 2.12. We do not want to
support this device.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/rdma/Makefile.objs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/rdma/Makefile.objs b/hw/rdma/Makefile.objs
index 3504c39..02ca2a9 100644
--- a/hw/rdma/Makefile.objs
+++ b/hw/rdma/Makefile.objs
@@ -1,5 +1,6 @@
ifeq ($(CONFIG_RDMA),y)
obj-$(CONFIG_PCI) += rdma_utils.o rdma_backend.o rdma_rm.o
obj-$(CONFIG_PCI) += vmw/pvrdma_dev_ring.o vmw/pvrdma_cmd.o \
- vmw/pvrdma_qp_ops.o vmw/pvrdma_main.o
+ vmw/pvrdma_qp_ops.o
+#obj-$(CONFIG_PCI) += vmw/pvrdma_main.o
endif
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 284c3931c86e875e86c41a838a786d4732f95b5b Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 7 Jun 2018 07:43:13 +0200
Subject: [PATCH 261/268] Disable new superio devices
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <51483d3f0091abc80d52485ab076581d4ca914c5.1528355911.git.mrezanin@redhat.com>
Patchwork-id: 80595
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 5/7] Disable new superio devices
Bugzilla: 1586357
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
We do not want to support new superio devices (fdc37m81x-superio and
smc37c669-superio).
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/isa/Makefile.objs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index 83e06f6..7de4f44 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -1,5 +1,5 @@
common-obj-$(CONFIG_ISA_BUS) += isa-bus.o
-common-obj-$(CONFIG_ISA_BUS) += isa-superio.o smc37c669-superio.o
+#common-obj-$(CONFIG_ISA_BUS) += isa-superio.o smc37c669-superio.o
common-obj-$(CONFIG_APM) += apm.o
common-obj-$(CONFIG_I82378) += i82378.o
common-obj-$(CONFIG_PC87312) += pc87312.o
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 3ebdb9532749bbc04458f868e7c08680a236007c Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 7 Jun 2018 07:43:10 +0200
Subject: [PATCH 258/268] Disable split-irq device
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <63c6336171256528761f3b4aa22c058d472b048b.1528355911.git.mrezanin@redhat.com>
Patchwork-id: 80596
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 2/7] Disable split-irq device
Bugzilla: 1586357
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
There's new split-irq device introduced in QEMU 2.12. We do not want to
support this device.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/core/Makefile.objs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index 2b4491f..e967fb2 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -20,7 +20,7 @@ common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
# common-obj-$(CONFIG_SOFTMMU) += register.o
# obj-$(CONFIG_SOFTMMU) += generic-loader.o
# common-obj-$(CONFIG_SOFTMMU) += or-irq.o
-common-obj-$(CONFIG_SOFTMMU) += split-irq.o
+#common-obj-$(CONFIG_SOFTMMU) += split-irq.o
common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
obj-$(CONFIG_SOFTMMU) += null-machine.o
--
1.8.3.1

View File

@ -0,0 +1,129 @@
From b579d3287a75db4b7ee37d25d99b2087f4ed4475 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Fri, 30 Nov 2018 13:58:43 +0000
Subject: [PATCH 08/16] Do not build bluetooth support
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <1543586323-7323-1-git-send-email-mrezanin@redhat.com>
Patchwork-id: 83193
O-Subject: [RHEL-8 qemu-kvm PATCHv2] Do not build bluetooth support
Bugzilla: 1654651
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1654651
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19329246
Branch: rhel8/master-2.12.0
We do not support bt devices however some bt related code is built in.
As this code is deprecated upstream disabling build of this code downstream.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
v2:
- Removed -bt option from qemu-options.hx
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
Makefile.objs | 4 ++--
hw/bt/Makefile.objs | 4 ++--
qemu-options.hx | 2 ++
vl.c | 7 +++++++
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index c6c3554..be72238 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -115,8 +115,8 @@ common-obj-y += replay/
common-obj-y += ui/
common-obj-m += ui/
-common-obj-y += bt-host.o bt-vhci.o
-bt-host.o-cflags := $(BLUEZ_CFLAGS)
+#common-obj-y += bt-host.o bt-vhci.o
+#bt-host.o-cflags := $(BLUEZ_CFLAGS)
common-obj-y += dma-helpers.o
common-obj-y += vl.o
diff --git a/hw/bt/Makefile.objs b/hw/bt/Makefile.objs
index 867a7d2..e678e9e 100644
--- a/hw/bt/Makefile.objs
+++ b/hw/bt/Makefile.objs
@@ -1,3 +1,3 @@
-common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
-common-obj-y += hci-csr.o
+#common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
+#common-obj-y += hci-csr.o
diff --git a/qemu-options.hx b/qemu-options.hx
index 4271cd3..2e05112 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2827,6 +2827,7 @@ STEXI
ETEXI
DEFHEADING()
+#if 0
DEFHEADING(Bluetooth(R) options:)
STEXI
@table @option
@@ -2901,6 +2902,7 @@ STEXI
@end table
ETEXI
DEFHEADING()
+#endif
#ifdef CONFIG_TPM
DEFHEADING(TPM device options:)
diff --git a/vl.c b/vl.c
index f253876..74fa8f2 100644
--- a/vl.c
+++ b/vl.c
@@ -923,6 +923,7 @@ static void configure_rtc(QemuOpts *opts)
}
}
+#if 0 // Disabled for Red Hat Enterprise Linux
/***********************************************************/
/* Bluetooth support */
static int nb_hcis;
@@ -1044,6 +1045,7 @@ static int bt_parse(const char *opt)
error_report("bad bluetooth parameter '%s'", opt);
return 1;
}
+#endif
static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp)
{
@@ -3367,9 +3369,12 @@ int main(int argc, char **argv, char **envp)
exit(1);
break;
#endif
+
+#if 0 // Disabled for Red Hat Enterprise Linux
case QEMU_OPTION_bt:
add_device_config(DEV_BT, optarg);
break;
+#endif
case QEMU_OPTION_audio_help:
AUD_help ();
exit (0);
@@ -4523,9 +4528,11 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
+#if 0 // Disabled for Red Hat Enterprise Linux
/* init the bluetooth world */
if (foreach_device_config(DEV_BT, bt_parse))
exit(1);
+#endif
if (!xen_enabled()) {
/* On 32-bit hosts, QEMU is limited by virtual address space */
--
1.8.3.1

View File

@ -0,0 +1,53 @@
From 9997a461dc882720fff3990aeca0725a91f20ac3 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 12 Sep 2018 09:43:39 +0100
Subject: [PATCH 2/4] Fix annocheck issues
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <1536745419-16795-1-git-send-email-mrezanin@redhat.com>
Patchwork-id: 82139
O-Subject: [RHEL8/rhel qemu-kvm PATCH] Fix annocheck issues
Bugzilla: 1624164
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
From: Miroslav Rezanina <mrezanin@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1624164
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18283300
BRANCH: rhel8/master-2.12.0
Upstream: Do we want have this upstream?
annocheck reports several issues with qemu-kvm packages.
Most of them is "Compiled without -D_GLIBCXX_ASSERTIONS.". These issues
comes from capstone submodule as we strip all -W compile flags. We can
add missing flag downstream but I'm not sure this change should be done
upstream too.
In addition, there's "Not linked with -Wl,-z,now." error for s390-ccw.img
and s390-netboot.img. However, this flag is used for building these files
as build log shows.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 9803f27..da3eedb 100644
--- a/Makefile
+++ b/Makefile
@@ -502,6 +502,7 @@ CAP_CFLAGS += -DCAPSTONE_HAS_ARM
CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
CAP_CFLAGS += -DCAPSTONE_HAS_X86
+CAP_CFLAGS += -Wp,-D_GLIBCXX_ASSERTIONS
subdir-capstone: .git-submodule-status
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
--
1.8.3.1

View File

@ -0,0 +1,67 @@
From f79fc6d50a69dc3443f028b8f0fa11fe0f94810c Mon Sep 17 00:00:00 2001
From: Danilo de Paula <ddepaula@redhat.com>
Date: Mon, 27 Aug 2018 17:15:07 +0100
Subject: [PATCH] Fix libusb-1.0.22 deprecated libusb_set_debug with
libusb_set_option
RH-Author: Danilo de Paula <ddepaula@redhat.com>
Message-id: <20180827171507.6372-2-ddepaula@redhat.com>
Patchwork-id: 81932
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 1/1] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option
Bugzilla: 1622656
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
From: John Thomson <git@johnthomson.fastmail.com.au>
libusb-1.0.22 marked libusb_set_debug deprecated
it is replaced with
libusb_set_option(libusb_context, LIBUSB_OPTION_LOG_LEVEL, libusb_log_level);
details here: https://github.com/libusb/libusb/commit/539f22e2fd916558d11ab9a66f10f461c5593168
Warning here:
CC hw/usb/host-libusb.o
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c: In function 'usb_host_init':
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c:250:5: error: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Werror=deprecated-declarations]
libusb_set_debug(ctx, loglevel);
^~~~~~~~~~~~~~~~
In file included from /builds/xen/src/qemu-xen/hw/usb/host-libusb.c:40:0:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [/builds/xen/src/qemu-xen/rules.mak:66: hw/usb/host-libusb.o] Error 1
make: Leaving directory '/builds/xen/src/xen/tools/qemu-xen-build'
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Message-id: 20180405132046.4968-1-git@johnthomson.fastmail.com.au
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 9d8fa0df49af16a208fa961c2968fba4daffcc07)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/usb/host-libusb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 0290fb8..f31e9cb 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -248,7 +248,11 @@ static int usb_host_init(void)
if (rc != 0) {
return -1;
}
+#if LIBUSB_API_VERSION >= 0x01000106
+ libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, loglevel);
+#else
libusb_set_debug(ctx, loglevel);
+#endif
#ifdef CONFIG_WIN32
/* FIXME: add support for Windows. */
#else
--
1.8.3.1

View File

@ -0,0 +1,60 @@
From 738561e0b91258ad42765d669a62e9f28784fefe Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 31 May 2018 06:36:35 +0200
Subject: [PATCH 005/268] Fix x-hv-max-vps compat value for 7.4 machine type
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: <1527748595-28488-1-git-send-email-mrezanin@redhat.com>
Patchwork-id: 80541
O-Subject: [RHEL qemu-kvm/qemu-kvm-rhev PATCH] Fix x-hv-max-vps compat value for 7.4 machine type
Bugzilla: 1583959
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
Commit b2f9f4fcaad9c64f4551ab1dbe9e474c3dc6b2b4 increased the limit of vcpus
for windows guest. In addition, it keep old limit for older machine types.
However, due to conflict was compatibility part incorrectly placed and
we keep this limit for 7.3 and older machine types instead of 7.4 and older.
Moving the chunk to correct spot so we have correct limit.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
include/hw/i386/pc.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c33ddbb..285e8df 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -1019,9 +1019,13 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
.driver = "q35-pcihost",\
.property = "x-pci-hole64-fix",\
.value = "off",\
+ },\
+ { /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_10 */ \
+ .driver = TYPE_X86_CPU,\
+ .property = "x-hv-max-vps",\
+ .value = "0x40",\
},
-
#define PC_RHEL7_3_COMPAT \
HW_COMPAT_RHEL7_3 \
{ /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_8 */ \
@@ -1083,11 +1087,6 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
.driver = TYPE_X86_CPU,\
.property = "kvm-no-smi-migration",\
.value = "on",\
- },\
- { /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_10 */ \
- .driver = TYPE_X86_CPU,\
- .property = "x-hv-max-vps",\
- .value = "0x40",\
},
#define PC_RHEL7_2_COMPAT \
--
1.8.3.1

View File

@ -0,0 +1,140 @@
From 7efd1d899d2478ad9fffcf0584907f38cd6d20ff Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 4 Jun 2019 05:12:43 +0100
Subject: [PATCH 1/8] Introduce new "no_guest_reset" parameter for usb-host
device
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <20190604051246.11374-2-kraxel@redhat.com>
Patchwork-id: 88470
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/4] Introduce new "no_guest_reset" parameter for usb-host device
Bugzilla: 1713677
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
From: Alexander Kappner <agk@godking.net>
With certain USB devices passed through via usb-host, a guest attempting to
reset a usb-host device can trigger a reset loop that renders the USB device
unusable. In my use case, the device was an iPhone XR that was passed through to
a Mac OS X Mojave guest. Upon connecting the device, the following happens:
1) Guest recognizes new device, sends reset to emulated USB host
2) QEMU's USB host sends reset to host kernel
3) Host kernel resets device
4) After reset, host kernel determines that some part of the device descriptor
has changed ("device firmware changed" in dmesg), so host kernel decides to
re-enumerate the device.
5) Re-enumeration causes QEMU to disconnect and reconnect the device in the
guest.
6) goto 1)
Here's from the host kernel (note the "device firmware changed" lines")
[3677704.473050] usb 1-1.3: new high-speed USB device number 53 using ehci-pci
[3677704.555594] usb 1-1.3: New USB device found, idVendor=05ac, idProduct=12a8, bcdDevice=11.08
[3677704.555599] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[3677704.555602] usb 1-1.3: Product: iPhone
[3677704.555605] usb 1-1.3: Manufacturer: Apple Inc.
[3677704.555607] usb 1-1.3: SerialNumber: [[removed]]
[3677709.401040] usb 1-1.3: reset high-speed USB device number 53 using ehci-pci
[3677709.479486] usb 1-1.3: device firmware changed
[3677709.479842] usb 1-1.3: USB disconnect, device number 53
[3677709.546039] usb 1-1.3: new high-speed USB device number 54 using ehci-pci
[3677709.627471] usb 1-1.3: New USB device found, idVendor=05ac, idProduct=12a8, bcdDevice=11.08
[3677709.627476] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[3677709.627479] usb 1-1.3: Product: iPhone
[3677709.627481] usb 1-1.3: Manufacturer: Apple Inc.
[3677709.627483] usb 1-1.3: SerialNumber: [[removed]]
[3677762.320044] usb 1-1.3: reset high-speed USB device number 54 using ehci-pci
[3677762.615630] usb 1-1.3: USB disconnect, device number 54
[3677762.787043] usb 1-1.3: new high-speed USB device number 55 using ehci-pci
[3677762.869016] usb 1-1.3: New USB device found, idVendor=05ac, idProduct=12a8, bcdDevice=11.08
[3677762.869024] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[3677762.869028] usb 1-1.3: Product: iPhone
[3677762.869032] usb 1-1.3: Manufacturer: Apple Inc.
[3677762.869035] usb 1-1.3: SerialNumber: [[removed]]
[3677815.662036] usb 1-1.3: reset high-speed USB device number 55 using ehci-pci
Here's from QEMU:
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/005/022: No such file or directory
libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [_open_sysfs_attr] open /sys/bus/usb/devices/5-1/bConfigurationValue failed ret=-1 errno=2
libusb: error [_get_usbfs_fd] File doesn't exist, wait 10 ms and try again
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/005/024: No such file or directory
libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [_open_sysfs_attr] open /sys/bus/usb/devices/5-1/bConfigurationValue failed ret=-1 errno=2
libusb: error [_get_usbfs_fd] File doesn't exist, wait 10 ms and try again
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/005/026: No such file or directory
The result of this is that the device remains permanently unusable in the guest.
The same problem has been previously reported for an iPad:
https://stackoverflow.com/questions/52617634/how-do-i-get-qemu-usb-passthrough-to-work-for-ipad-iphone
This problem can be elegantly solved by interrupting step 2) above. Instead of
passing through the reset, QEMU simply ignores it. To allow this to be
configured on a per-device level, a new parameter "no_guest_reset" is
introduced for the usb-host device. I can confirm that the configuration
described above (iPhone XS + Mojave guest) works flawlessly with
no_guest_reset=True specified.
Working command line for my scenario:
device_add usb-host,vendorid=0x05ac,productid=0x12a8,no_guest_reset=True,id=iphone
Best regards
Alexander
Signed-off-by: Alexander Kappner <agk@godking.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20190128140027.9448-1-kraxel@redhat.com
[ kraxel: rename parameter to "guest-reset" ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ba4c735b4fc74e309ce4b2551d258e442ef513a5)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/usb/host-libusb.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index f31e9cb..d82a10a 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -82,7 +82,7 @@ struct USBHostDevice {
uint32_t options;
uint32_t loglevel;
bool needs_autoscan;
-
+ bool allow_guest_reset;
/* state */
QTAILQ_ENTRY(USBHostDevice) next;
int seen, errcount;
@@ -1451,6 +1451,10 @@ static void usb_host_handle_reset(USBDevice *udev)
USBHostDevice *s = USB_HOST_DEVICE(udev);
int rc;
+ if (!s->allow_guest_reset) {
+ return;
+ }
+
trace_usb_host_reset(s->bus_num, s->addr);
rc = libusb_reset_device(s->dh);
@@ -1568,6 +1572,7 @@ static Property usb_host_dev_properties[] = {
DEFINE_PROP_UINT32("productid", USBHostDevice, match.product_id, 0),
DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
DEFINE_PROP_UINT32("isobsize", USBHostDevice, iso_urb_frames, 32),
+ DEFINE_PROP_BOOL("guest-reset", USBHostDevice, allow_guest_reset, true),
DEFINE_PROP_UINT32("loglevel", USBHostDevice, loglevel,
LIBUSB_LOG_LEVEL_WARNING),
DEFINE_PROP_BIT("pipeline", USBHostDevice, options,
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From 699be60852400ad3459992a02c8477c08944ad09 Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Date: Wed, 1 Aug 2018 13:55:18 +0100
Subject: [PATCH] Migration+TLS: Fix crash due to double cleanup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: <20180801135522.11658-15-dgilbert@redhat.com>
Patchwork-id: 81569
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 14/18] Migration+TLS: Fix crash due to double cleanup
Bugzilla: 1594384
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
During a TLS connect we see:
migration_channel_connect calls
migration_tls_channel_connect
(calls after TLS setup)
migration_channel_connect
My previous error handling fix made migration_channel_connect
call migrate_fd_connect in all cases; unfortunately the above
means it gets called twice and crashes doing double cleanup.
Fixes: 688a3dcba98
Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180430185943.35714-1-dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 8b7bf2badac25c0a52aff1b181ad75fdb304dd0c)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
migration/channel.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/migration/channel.c b/migration/channel.c
index c5eaf0f..7a32b5a 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -71,6 +71,15 @@ void migration_channel_connect(MigrationState *s,
!object_dynamic_cast(OBJECT(ioc),
TYPE_QIO_CHANNEL_TLS)) {
migration_tls_channel_connect(s, ioc, hostname, &error);
+
+ if (!error) {
+ /* tls_channel_connect will call back to this
+ * function after the TLS handshake,
+ * so we mustn't call migrate_fd_connect until then
+ */
+
+ return;
+ }
} else {
QEMUFile *f = qemu_fopen_channel_output(ioc);
--
1.8.3.1

View File

@ -0,0 +1,73 @@
From 6c2f10596f53c29687a64aa78f339e3043850936 Mon Sep 17 00:00:00 2001
From: David Gibson <dgibson@redhat.com>
Date: Wed, 25 Jul 2018 08:36:42 +0100
Subject: [PATCH 03/14] RHEL-8.0: Add pseries-rhel7.6.0-sxxm machine type
RH-Author: David Gibson <dgibson@redhat.com>
Message-id: <20180725083642.11004-1-dgibson@redhat.com>
Patchwork-id: 81501
O-Subject: [RHEL-8.0 qemu-kvm PATCH] RHEL-8.0: Add pseries-rhel7.6.0-sxxm machine type
Bugzilla: 1595501
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
For the pseries-rhel7.3.0 .. pseries-rhel7.5.0 machine types we have -sxxm
variants, the only difference being that the -sxxm variants have the
Spectre and Meltdown mitigations available to guests by default.
We'd delayed on adding a similar variant for RHEL 7.6, in the hope that we
might be able to enable the mitigations by default for the ordinary 7.6
machine type. This requires that updated POWER8 firmware (FW860.51 or
newer) be installed on the host.
The updated firmware was only released late May, and it's not clear how
quickly and widely it will be deployed. For that reason, plus for
consistency in how things need to be configured across rhel-7.y, we're now
adding a pseries-rhel7.6.0-sxxm machine type.
Upstream status: downstream only
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1595501
Signed-off-by: David Gibson <dgibson@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/ppc/spapr.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7de3f07..a61dafd 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4355,6 +4355,28 @@ static void spapr_machine_rhel760_class_options(MachineClass *mc)
DEFINE_SPAPR_MACHINE(rhel760, "rhel7.6.0", true);
/*
+ * pseries-rhel7.6.0-sxxm
+ *
+ * pseries-rhel7.6.0 with speculative execution exploit mitigations enabled by default
+ */
+static void spapr_machine_rhel760sxxm_instance_options(MachineState *machine)
+{
+ spapr_machine_rhel760_instance_options(machine);
+}
+
+static void spapr_machine_rhel760sxxm_class_options(MachineClass *mc)
+{
+ sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
+
+ spapr_machine_rhel760_class_options(mc);
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
+}
+
+DEFINE_SPAPR_MACHINE(rhel760sxxm, "rhel7.6.0-sxxm", false);
+
+/*
* pseries-rhel7.5.0
* like SPAPR_COMPAT_2_11 and SPAPR_COMPAT_2_10
* SPAPR_CAP_HTM already enabled in 7.4
--
1.8.3.1

View File

@ -0,0 +1,45 @@
From d51e082e60b3f28d595ebb88e2b4ac17384cecee Mon Sep 17 00:00:00 2001
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Mon, 19 Nov 2018 15:47:06 +0000
Subject: [PATCH 05/16] Re-enable CONFIG_HYPERV_TESTDEV
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-id: <20181119154706.26183-1-vkuznets@redhat.com>
Patchwork-id: 83046
O-Subject: [qemu-kvm RHEL8/virt212 PATCH] Re-enable CONFIG_HYPERV_TESTDEV
Bugzilla: 1651195
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
BZ: 1651195
BRANCH: rhel8/master-2.12.0
UPSTREAM: downstream only
BREW: 19214465
Recently we re-enabled 'hv_synic' and 'hv_stimer' enlightenments for
Windows guests. Enable 'hyperv-testdev' device so kvm-unit-tests tests for
synic and stimer can pass.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
default-configs/x86_64-softmmu.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 2675606..854eab1 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -60,7 +60,7 @@ CONFIG_XIO3130=y
CONFIG_IOH3420=y
CONFIG_I82801B11=y
CONFIG_SMBIOS=y
-#CONFIG_HYPERV_TESTDEV=$(CONFIG_KVM)
+CONFIG_HYPERV_TESTDEV=$(CONFIG_KVM)
CONFIG_PXB=y
CONFIG_ACPI_VMGENID=y
CONFIG_FW_CFG_DMA=y
--
1.8.3.1

View File

@ -0,0 +1,51 @@
From a2721f63de158e00dda6b043ae8465fb31b8a619 Mon Sep 17 00:00:00 2001
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Wed, 5 Sep 2018 09:41:52 +0100
Subject: [PATCH 1/4] Re-enable disabled Hyper-V enlightenments
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-id: <20180905094152.31940-1-vkuznets@redhat.com>
Patchwork-id: 82051
O-Subject: [qemu-kvm RHEL8/virt212 PATCH] Re-enable disabled Hyper-V enlightenments
Bugzilla: 1625185
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: vrozenfe <vrozenfe@redhat.com>
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
BZ: 1625185
BRANCH:rhel8/master-2.12.0
UPSTREAM: downstream only
BREW: 18157023
Partially revert 0d70915c93d. With the latest Win10 update stimer/synic
enlightenments are a must (see BZ#1610461), vpindex is needed for the
upcoming PV TLB flush/IPI support, reset and runtime are enabled for
consistency with upstream (there's no benefit in disabling them).
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
target/i386/cpu.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e16dba7..0215b20 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5366,13 +5366,11 @@ static Property x86_cpu_properties[] = {
DEFINE_PROP_BOOL("hv-vapic", X86CPU, hyperv_vapic, false),
DEFINE_PROP_BOOL("hv-time", X86CPU, hyperv_time, false),
DEFINE_PROP_BOOL("hv-crash", X86CPU, hyperv_crash, false),
-#if 0 /* Disabled for Red Hat Enterprise Linux */
DEFINE_PROP_BOOL("hv-reset", X86CPU, hyperv_reset, false),
DEFINE_PROP_BOOL("hv-vpindex", X86CPU, hyperv_vpindex, false),
DEFINE_PROP_BOOL("hv-runtime", X86CPU, hyperv_runtime, false),
DEFINE_PROP_BOOL("hv-synic", X86CPU, hyperv_synic, false),
DEFINE_PROP_BOOL("hv-stimer", X86CPU, hyperv_stimer, false),
-#endif
DEFINE_PROP_BOOL("hv-frequencies", X86CPU, hyperv_frequencies, false),
DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true),
DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false),
--
1.8.3.1

View File

@ -0,0 +1,109 @@
From c07dfca3b340161294755691f416ab20f37fa7c3 Mon Sep 17 00:00:00 2001
From: Igor Mammedov <imammedo@redhat.com>
Date: Thu, 4 Oct 2018 10:31:31 +0100
Subject: [PATCH 01/17] Revert "hw/acpi-build: build SRAT memory affinity
structures for DIMM devices"
RH-Author: Igor Mammedov <imammedo@redhat.com>
Message-id: <1538649091-70517-1-git-send-email-imammedo@redhat.com>
Patchwork-id: 82373
O-Subject: [RHEL8/virt-8.0.0 qemu-kvm PATCH] Revert "hw/acpi-build: build SRAT memory affinity structures for DIMM devices"
Bugzilla: 1609235
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1609235
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18630981
Upstream: RHEL only
Since upstream commits
(0efd7e108 "pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size")
(dbb6da8ba7 "pc: acpi: revert back to 1 SRAT entry for hotpluggable area")
hasn't been backported to RHEL8, it's sufficient to revert commit
(848a1cc1e8 "hw/acpi-build: build SRAT memory affinity structures for DIMM devices")
for the result to match the current upstream state and fix the bug.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/i386/acpi-build.c | 56 ++++------------------------------------------------
1 file changed, 4 insertions(+), 52 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index b309a97..a175a8a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2253,55 +2253,6 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
#define HOLE_640K_START (640 * 1024)
#define HOLE_640K_END (1024 * 1024)
-static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
- uint64_t len, int default_node)
-{
- MemoryDeviceInfoList *info_list = qmp_pc_dimm_device_list();
- MemoryDeviceInfoList *info;
- MemoryDeviceInfo *mi;
- PCDIMMDeviceInfo *di;
- uint64_t end = base + len, cur, size;
- bool is_nvdimm;
- AcpiSratMemoryAffinity *numamem;
- MemoryAffinityFlags flags;
-
- for (cur = base, info = info_list;
- cur < end;
- cur += size, info = info->next) {
- numamem = acpi_data_push(table_data, sizeof *numamem);
-
- if (!info) {
- build_srat_memory(numamem, cur, end - cur, default_node,
- MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
- break;
- }
-
- mi = info->value;
- is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
- di = !is_nvdimm ? mi->u.dimm.data : mi->u.nvdimm.data;
-
- if (cur < di->addr) {
- build_srat_memory(numamem, cur, di->addr - cur, default_node,
- MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
- numamem = acpi_data_push(table_data, sizeof *numamem);
- }
-
- size = di->size;
-
- flags = MEM_AFFINITY_ENABLED;
- if (di->hotpluggable) {
- flags |= MEM_AFFINITY_HOTPLUGGABLE;
- }
- if (is_nvdimm) {
- flags |= MEM_AFFINITY_NON_VOLATILE;
- }
-
- build_srat_memory(numamem, di->addr, size, di->node, flags);
- }
-
- qapi_free_MemoryDeviceInfoList(info_list);
-}
-
static void
build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
{
@@ -2413,9 +2364,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
* providing _PXM method if necessary.
*/
if (hotplugabble_address_space_size) {
- build_srat_hotpluggable_memory(table_data, pcms->hotplug_memory.base,
- hotplugabble_address_space_size,
- pcms->numa_nodes - 1);
+ numamem = acpi_data_push(table_data, sizeof *numamem);
+ build_srat_memory(numamem, pcms->hotplug_memory.base,
+ hotplugabble_address_space_size, pcms->numa_nodes - 1,
+ MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
}
build_header(linker, table_data,
--
1.8.3.1

View File

@ -0,0 +1,58 @@
From 6a1d536006d9b6f888bd56ba1ff03c6e66acb020 Mon Sep 17 00:00:00 2001
From: "plai@redhat.com" <plai@redhat.com>
Date: Wed, 3 Apr 2019 15:54:34 +0100
Subject: [PATCH 10/10] Revert "i386: Add CPUID bit for PCONFIG"
RH-Author: plai@redhat.com
Message-id: <1554306874-28796-11-git-send-email-plai@redhat.com>
Patchwork-id: 85388
O-Subject: [RHEL8.1 qemu-kvm PATCH resend 10/10] Revert "i386: Add CPUID bit for PCONFIG"
Bugzilla: 1561761
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
From: Robert Hoo <robert.hu@linux.intel.com>
This reverts commit 5131dc433df54b37e8e918d8fba7fe10344e7a7b.
For new instruction 'PCONFIG' will not be exposed to guest.
Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
Message-Id: <1545227081-213696-3-git-send-email-robert.hu@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 712f807e1965c8f1f1da5bbec2b92a8c540e6631)
Signed-off-by: Paul Lai <plai@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
target/i386/cpu.c | 2 +-
target/i386/cpu.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index ad369be..8e63db6 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1042,7 +1042,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
- NULL, NULL, "pconfig", NULL,
+ NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, "spec-ctrl", "stibp",
NULL, "arch-capabilities", NULL, "ssbd",
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 63f692f..3ae0e8c 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -687,7 +687,6 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
#define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2) /* AVX512 Neural Network Instructions */
#define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
-#define CPUID_7_0_EDX_PCONFIG (1U << 18) /* Platform Configuration */
#define CPUID_7_0_EDX_SPEC_CTRL (1U << 26) /* Speculation Control */
#define CPUID_7_0_EDX_ARCH_CAPABILITIES (1U << 29) /*Arch Capabilities*/
#define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31) /* Speculative Store Bypass Disable */
--
1.8.3.1

View File

@ -0,0 +1,69 @@
From c30a2c251e309eba40fd04e36b80016e4858c586 Mon Sep 17 00:00:00 2001
From: Serhii Popovych <spopovyc@redhat.com>
Date: Wed, 11 Jul 2018 17:11:45 +0100
Subject: [PATCH 2/4] Revert "spapr: Don't allow memory hotplug to memory less
nodes"
RH-Author: Serhii Popovych <spopovyc@redhat.com>
Message-id: <1531329105-80927-3-git-send-email-spopovyc@redhat.com>
Patchwork-id: 81313
O-Subject: [RHEL-8.0 qemu-kvm PATCH 2/2] Revert "spapr: Don't allow memory hotplug to memory less nodes"
Bugzilla: 1599593
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: David Gibson <dgibson@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
This reverts commit b556854bd8524c26b8be98ab1bfdf0826831e793.
Leave change @node type from uint32_t to to int from reverted commit
because node < 0 is always false.
Note that implementing capability or some trick to detect if guest
kernel does not support hot-add to memory: this returns previous
behavour where memory added to first non-empty node.
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
(cherry picked from commit e47f1d2786c3d01a7894a493aafe0efa6b64453c)
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/ppc/spapr.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index f3da93f..ef00937 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3489,28 +3489,6 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
return;
}
- /*
- * Currently PowerPC kernel doesn't allow hot-adding memory to
- * memory-less node, but instead will silently add the memory
- * to the first node that has some memory. This causes two
- * unexpected behaviours for the user.
- *
- * - Memory gets hotplugged to a different node than what the user
- * specified.
- * - Since pc-dimm subsystem in QEMU still thinks that memory belongs
- * to memory-less node, a reboot will set things accordingly
- * and the previously hotplugged memory now ends in the right node.
- * This appears as if some memory moved from one node to another.
- *
- * So until kernel starts supporting memory hotplug to memory-less
- * nodes, just prevent such attempts upfront in QEMU.
- */
- if (nb_numa_nodes && !numa_info[node].node_mem) {
- error_setg(errp, "Can't hotplug memory to memory-less node %d",
- node);
- return;
- }
-
spapr_memory_plug(hotplug_dev, dev, node, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
spapr_core_plug(hotplug_dev, dev, errp);
--
1.8.3.1

View File

@ -0,0 +1,99 @@
From 432dce181a267465b10d3e4bca025314d85ff76f Mon Sep 17 00:00:00 2001
From: Serhii Popovych <spopovyc@redhat.com>
Date: Mon, 9 Jul 2018 11:31:18 +0200
Subject: [PATCH 202/268] Revert "usb: release the created buses"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Serhii Popovych <spopovyc@redhat.com>
Message-id: <1531135878-18813-4-git-send-email-spopovyc@redhat.com>
Patchwork-id: 81266
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH v2 3/3] Revert "usb: release the created buses"
Bugzilla: 1556678
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
RH-Acked-by: David Gibson <dgibson@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The USB device don't hold the bus. There is no ASAN related reports
anymore.
This reverts commit cd7bc87868d534f95e928cad98e2a52df7695771.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20180613172815.32738-3-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 9b5c2fd53feb574036747d0284fd7f73dfedc89c)
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/usb/dev-storage.c | 16 ----------------
hw/usb/dev-uas.c | 2 --
2 files changed, 18 deletions(-)
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 68e2062..9fb00a9 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -589,13 +589,6 @@ static const struct SCSIBusInfo usb_msd_scsi_info_bot = {
.load_request = usb_msd_load_request,
};
-static void usb_msd_unrealize_storage(USBDevice *dev, Error **errp)
-{
- MSDState *s = USB_STORAGE_DEV(dev);
-
- object_unref(OBJECT(&s->bus));
-}
-
static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
{
MSDState *s = USB_STORAGE_DEV(dev);
@@ -645,13 +638,6 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
s->scsi_dev = scsi_dev;
}
-static void usb_msd_bot_unrealize(USBDevice *dev, Error **errp)
-{
- MSDState *s = USB_STORAGE_DEV(dev);
-
- object_unref(OBJECT(&s->bus));
-}
-
static void usb_msd_bot_realize(USBDevice *dev, Error **errp)
{
MSDState *s = USB_STORAGE_DEV(dev);
@@ -716,7 +702,6 @@ static void usb_msd_class_storage_initfn(ObjectClass *klass, void *data)
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->realize = usb_msd_storage_realize;
- uc->unrealize = usb_msd_unrealize_storage;
dc->props = msd_properties;
}
@@ -779,7 +764,6 @@ static void usb_msd_class_bot_initfn(ObjectClass *klass, void *data)
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->realize = usb_msd_bot_realize;
- uc->unrealize = usb_msd_bot_unrealize;
uc->attached_settable = true;
}
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index c218b53..eaf515d 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -896,8 +896,6 @@ static void usb_uas_unrealize(USBDevice *dev, Error **errp)
UASDevice *uas = USB_UAS(dev);
qemu_bh_delete(uas->status_bh);
-
- object_unref(OBJECT(&uas->bus));
}
static void usb_uas_realize(USBDevice *dev, Error **errp)
--
1.8.3.1

View File

@ -0,0 +1,63 @@
From e924798dc9091c09e4e6968b9357e89aac6a5c03 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 13 Jun 2018 10:40:26 +0200
Subject: [PATCH 007/268] Use 4 MB vram for cirrus.
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <20180613104026.4395-3-kraxel@redhat.com>
Patchwork-id: 80652
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 2/2] Use 4 MB vram for cirrus.
Bugzilla: 1542080
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
Follow upstream, which switched from 8 MB to 4 MB in release 2.9,
see commit 73c148130b58709f0f2abfedbae92681d87eb404.
RHEL traditionally defaults to 16 MB video memory, so we had a patch
changing 8 MB -> 16 MB downstream. The 2.9 rebase kept that patch, now
changing 4 MB -> 16 MB.
This patch effectively reverts the downstream change and adds a compat
property so the video memory will stay at 16 MB for 7.5 and older
machine types.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/display/cirrus_vga.c | 2 +-
include/hw/compat.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index feacb45..014268a 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -3133,7 +3133,7 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp)
static Property pci_vga_cirrus_properties[] = {
DEFINE_PROP_UINT32("vgamem_mb", struct PCICirrusVGAState,
- cirrus_vga.vga.vram_size_mb, 16),
+ cirrus_vga.vga.vram_size_mb, 4),
DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState,
cirrus_vga.enable_blitter, true),
DEFINE_PROP_END_OF_LIST(),
diff --git a/include/hw/compat.h b/include/hw/compat.h
index f7b39c5..f4cc6e0 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -472,6 +472,10 @@
.driver = "virtio-tablet-device",\
.property = "wheel-axis",\
.value = "false",\
+ },{ /* HW_COMPAT_RHEL7_5 */ \
+ .driver = "cirrus-vga",\
+ .property = "vgamem_mb",\
+ .value = "16",\
},
#endif /* HW_COMPAT_H */
--
1.8.3.1

View File

@ -0,0 +1,77 @@
From e6e62ad1e8a33076b67b19ce5f03ea6ca6571eef Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Thu, 9 May 2019 22:43:17 +0100
Subject: [PATCH 1/2] kvm: Use KVM_GET_MSR_INDEX_LIST for
MSR_IA32_ARCH_CAPABILITIES support
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
Message-id: <20190509224318.23376-2-ehabkost@redhat.com>
Patchwork-id: 87251
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/2] kvm: Use KVM_GET_MSR_INDEX_LIST for MSR_IA32_ARCH_CAPABILITIES support
Bugzilla: 1707706
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
RH-Acked-by: Bandan Das <bsd@redhat.com>
From: Bandan Das <bsd@redhat.com>
When writing to guest's MSR_IA32_ARCH_CAPABILITIES, check whether it's
supported in the guest using the KVM_GET_MSR_INDEX_LIST ioctl.
Fixes: d86f963694df27f11b3681ffd225c9362de1b634
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: balducci@units.it
Signed-off-by: Bandan Das <bsd@redhat.com>
Message-Id: <jpg4lc4iiav.fsf_-_@linux.bootlegged.copy>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit aec5e9c3a94cf8b7920f59bef69a6f426092c4a0)
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
target/i386/kvm.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index f1626a4..e3e8c78 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -94,6 +94,7 @@ static bool has_msr_xss;
static bool has_msr_spec_ctrl;
static bool has_msr_virt_ssbd;
static bool has_msr_smi_count;
+static bool has_msr_arch_capabs;
static uint32_t has_architectural_pmu_version;
static uint32_t num_architectural_pmu_gp_counters;
@@ -1330,6 +1331,9 @@ static int kvm_get_supported_msrs(KVMState *s)
case MSR_VIRT_SSBD:
has_msr_virt_ssbd = true;
break;
+ case MSR_IA32_ARCH_CAPABILITIES:
+ has_msr_arch_capabs = true;
+ break;
}
}
}
@@ -1834,14 +1838,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
#endif
/* If host supports feature MSR, write down. */
- if (kvm_feature_msrs) {
- int i;
- for (i = 0; i < kvm_feature_msrs->nmsrs; i++)
- if (kvm_feature_msrs->indices[i] == MSR_IA32_ARCH_CAPABILITIES) {
- kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
- env->features[FEAT_ARCH_CAPABILITIES]);
- break;
- }
+ if (has_msr_arch_capabs) {
+ kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
+ env->features[FEAT_ARCH_CAPABILITIES]);
}
/*
--
1.8.3.1

View File

@ -0,0 +1,80 @@
From 486481ac5bddfab22b74bcebcbd27af1f7a604f5 Mon Sep 17 00:00:00 2001
From: Alex Williamson <alex.williamson@redhat.com>
Date: Mon, 3 Dec 2018 22:01:34 +0000
Subject: [PATCH 11/16] kvm: Use inhibit to prevent ballooning without
synchronous mmu
RH-Author: Alex Williamson <alex.williamson@redhat.com>
Message-id: <154387449407.27651.8902076548922742582.stgit@gimli.home>
Patchwork-id: 83237
O-Subject: [RHEL-8.0 qemu-kvm PATCH 2/7] kvm: Use inhibit to prevent ballooning without synchronous mmu
Bugzilla: 1650272
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
RH-Acked-by: David Hildenbrand <david@redhat.com>
Bugzilla: 1650272
Remove KVM specific tests in balloon_page(), instead marking
ballooning as inhibited without KVM_CAP_SYNC_MMU support.
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit f59489423ab79852e98d9b3025b7d99ba8da584f)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
accel/kvm/kvm-all.c | 4 ++++
hw/virtio/virtio-balloon.c | 4 +---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 3f1c06e..3a7c8a3 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -39,6 +39,7 @@
#include "trace.h"
#include "hw/irq.h"
#include "sysemu/sev.h"
+#include "sysemu/balloon.h"
#include "hw/boards.h"
@@ -1711,6 +1712,9 @@ static int kvm_init(MachineState *ms)
s->many_ioeventfds = kvm_check_many_ioeventfds();
s->sync_mmu = !!kvm_vm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
+ if (!s->sync_mmu) {
+ qemu_balloon_inhibit(true);
+ }
return 0;
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index f456cea..4aab291 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -21,7 +21,6 @@
#include "hw/mem/pc-dimm.h"
#include "sysemu/balloon.h"
#include "hw/virtio/virtio-balloon.h"
-#include "sysemu/kvm.h"
#include "exec/address-spaces.h"
#include "qapi/error.h"
#include "qapi/qapi-events-misc.h"
@@ -36,8 +35,7 @@
static void balloon_page(void *addr, int deflate)
{
- if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
- kvm_has_sync_mmu())) {
+ if (!qemu_balloon_is_inhibited()) {
qemu_madvise(addr, BALLOON_PAGE_SIZE,
deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
}
--
1.8.3.1

View File

@ -0,0 +1,46 @@
From 16e7c9997d4e9682095206ef3c07d713d263143c Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Tue, 10 Jul 2018 23:06:16 +0200
Subject: [PATCH 207/268] ahci: don't schedule unnecessary BH
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20180710230616.11000-4-jsnow@redhat.com>
Patchwork-id: 81292
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 3/3] ahci: don't schedule unnecessary BH
Bugzilla: 1584914
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
The comment gives us a hint. *Maybe* we still have something to
process. Well, why not check?
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 20180531004323.4611-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit 42af312adef8afdae11d5f83d12a404b178dbda4)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/ide/ahci.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a9558e4..380366b 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1427,8 +1427,7 @@ static void ahci_cmd_done(IDEDMA *dma)
/* update d2h status */
ahci_write_fis_d2h(ad);
- if (!ad->check_bh) {
- /* maybe we still have something to process, check later */
+ if (ad->port_regs.cmd_issue && !ad->check_bh) {
ad->check_bh = qemu_bh_new(ahci_check_cmd_bh, ad);
qemu_bh_schedule(ad->check_bh);
}
--
1.8.3.1

View File

@ -0,0 +1,81 @@
From 93623a848fba7757a0840b78d7b3874bab4d7a1b Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Tue, 10 Jul 2018 23:06:15 +0200
Subject: [PATCH 206/268] ahci: fix PxCI register race
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20180710230616.11000-3-jsnow@redhat.com>
Patchwork-id: 81293
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 2/3] ahci: fix PxCI register race
Bugzilla: 1584914
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Fixes: https://bugs.launchpad.net/qemu/+bug/1769189
AHCI presently signals completion prior to the PxCI register being
cleared to indicate completion. If a guest driver attempts to issue
a new command in its IRQ handler, it might be surprised to learn there
is still a command pending.
In the case of Windows 10's boot driver, it will actually poll the IRQ
register hoping to find out when the command is done running -- which
will never happen, as there isn't a command running.
Fix this: clear PxCI in ahci_cmd_done and not in the asynchronous BH.
Because it now runs synchronously, we don't need to check if the command
is actually done by spying on the ATA registers. We know it's done.
CC: qemu-stable <qemu-stable@nongnu.org>
Reported-by: François Guerraz <kubrick@fgv6.net>
Tested-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 20180531004323.4611-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit 5694c7eacce6b263ad7497cc1bb76aad746cfd4e)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/ide/ahci.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index b7a6f68..a9558e4 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -532,13 +532,6 @@ static void ahci_check_cmd_bh(void *opaque)
qemu_bh_delete(ad->check_bh);
ad->check_bh = NULL;
- if ((ad->busy_slot != -1) &&
- !(ad->port.ifs[0].status & (BUSY_STAT|DRQ_STAT))) {
- /* no longer busy */
- ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot);
- ad->busy_slot = -1;
- }
-
check_cmd(ad->hba, ad->port_no);
}
@@ -1425,6 +1418,12 @@ static void ahci_cmd_done(IDEDMA *dma)
trace_ahci_cmd_done(ad->hba, ad->port_no);
+ /* no longer busy */
+ if (ad->busy_slot != -1) {
+ ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot);
+ ad->busy_slot = -1;
+ }
+
/* update d2h status */
ahci_write_fis_d2h(ad);
--
1.8.3.1

View File

@ -0,0 +1,66 @@
From f671c509afc918070a550bda393d92bd197c5cab Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Tue, 10 Jul 2018 23:06:14 +0200
Subject: [PATCH 205/268] ahci: trim signatures on raise/lower
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20180710230616.11000-2-jsnow@redhat.com>
Patchwork-id: 81295
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 1/3] ahci: trim signatures on raise/lower
Bugzilla: 1584914
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
These functions work on the AHCI device, not the individual
AHCI devices, so trim the AHCIDevice argument.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 20180531004323.4611-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit dc5a43eda68fff32c7b0b43847332db325b094f3)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/ide/ahci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index e22d7be..b7a6f68 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -131,7 +131,7 @@ static uint32_t ahci_port_read(AHCIState *s, int port, int offset)
return val;
}
-static void ahci_irq_raise(AHCIState *s, AHCIDevice *dev)
+static void ahci_irq_raise(AHCIState *s)
{
DeviceState *dev_state = s->container;
PCIDevice *pci_dev = (PCIDevice *) object_dynamic_cast(OBJECT(dev_state),
@@ -146,7 +146,7 @@ static void ahci_irq_raise(AHCIState *s, AHCIDevice *dev)
}
}
-static void ahci_irq_lower(AHCIState *s, AHCIDevice *dev)
+static void ahci_irq_lower(AHCIState *s)
{
DeviceState *dev_state = s->container;
PCIDevice *pci_dev = (PCIDevice *) object_dynamic_cast(OBJECT(dev_state),
@@ -174,9 +174,9 @@ static void ahci_check_irq(AHCIState *s)
trace_ahci_check_irq(s, old_irq, s->control_regs.irqstatus);
if (s->control_regs.irqstatus &&
(s->control_regs.ghc & HOST_CTL_IRQ_EN)) {
- ahci_irq_raise(s, NULL);
+ ahci_irq_raise(s);
} else {
- ahci_irq_lower(s, NULL);
+ ahci_irq_lower(s);
}
}
--
1.8.3.1

View File

@ -0,0 +1,124 @@
From 4809b6fbd13f8fc67daf1e37254d98e8fb9a9f20 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Tue, 9 Oct 2018 08:16:48 +0100
Subject: [PATCH 04/17] aio: Do aio_notify_accept only during blocking aio_poll
RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <20181009081651.15463-3-famz@redhat.com>
Patchwork-id: 82450
O-Subject: [RHEL8/rhel qemu-kvm PATCH 2/5] aio: Do aio_notify_accept only during blocking aio_poll
Bugzilla: 1623085
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
BZ: 1623085
An aio_notify() pairs with an aio_notify_accept(). The former should
happen in the main thread or a vCPU thread, and the latter should be
done in the IOThread.
There is one rare case that the main thread or vCPU thread may "steal"
the aio_notify() event just raised by itself, in bdrv_set_aio_context()
[1]. The sequence is like this:
main thread IO Thread
===============================================================
bdrv_drained_begin()
aio_disable_external(ctx)
aio_poll(ctx, true)
ctx->notify_me += 2
...
bdrv_drained_end()
...
aio_notify()
...
bdrv_set_aio_context()
aio_poll(ctx, false)
[1] aio_notify_accept(ctx)
ppoll() /* Hang! */
[1] is problematic. It will clear the ctx->notifier event so that
the blocked ppoll() will not return.
(For the curious, this bug was noticed when booting a number of VMs
simultaneously in RHV. One or two of the VMs will hit this race
condition, making the VIRTIO device unresponsive to I/O commands. When
it hangs, Seabios is busy waiting for a read request to complete (read
MBR), right after initializing the virtio-blk-pci device, using 100%
guest CPU. See also https://bugzilla.redhat.com/show_bug.cgi?id=1562750
for the original bug analysis.)
aio_notify() only injects an event when ctx->notify_me is set,
correspondingly aio_notify_accept() is only useful when ctx->notify_me
_was_ set. Move the call to it into the "blocking" branch. This will
effectively skip [1] and fix the hang.
Furthermore, blocking aio_poll is only allowed on home thread
(in_aio_context_home_thread), because otherwise two blocking
aio_poll()'s can steal each other's ctx->notifier event and cause
hanging just like described above.
Cc: qemu-stable@nongnu.org
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180809132259.18402-3-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit b37548fcd1b8ac2e88e185a395bef851f3fc4e65)
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
util/aio-posix.c | 4 ++--
util/aio-win32.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/util/aio-posix.c b/util/aio-posix.c
index f650c7c..f05d3a8 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -591,6 +591,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
* so disable the optimization now.
*/
if (blocking) {
+ assert(in_aio_context_home_thread(ctx));
atomic_add(&ctx->notify_me, 2);
}
@@ -633,6 +634,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
if (blocking) {
atomic_sub(&ctx->notify_me, 2);
+ aio_notify_accept(ctx);
}
/* Adjust polling time */
@@ -676,8 +678,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
}
}
- aio_notify_accept(ctx);
-
/* if we have any readable fds, dispatch event */
if (ret > 0) {
for (i = 0; i < npfd; i++) {
diff --git a/util/aio-win32.c b/util/aio-win32.c
index a67b00c..ac5524c 100644
--- a/util/aio-win32.c
+++ b/util/aio-win32.c
@@ -373,11 +373,12 @@ bool aio_poll(AioContext *ctx, bool blocking)
ret = WaitForMultipleObjects(count, events, FALSE, timeout);
if (blocking) {
assert(first);
+ assert(in_aio_context_home_thread(ctx));
atomic_sub(&ctx->notify_me, 2);
+ aio_notify_accept(ctx);
}
if (first) {
- aio_notify_accept(ctx);
progress |= aio_bh_poll(ctx);
first = false;
}
--
1.8.3.1

View File

@ -0,0 +1,49 @@
From 84935bf2482b06b983ccdb953b2cc90960d2ab16 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Tue, 9 Oct 2018 08:16:47 +0100
Subject: [PATCH 03/17] aio-posix: Don't count ctx->notifier as progress when
polling
RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <20181009081651.15463-2-famz@redhat.com>
Patchwork-id: 82454
O-Subject: [RHEL8/rhel qemu-kvm PATCH 1/5] aio-posix: Don't count ctx->notifier as progress when polling
Bugzilla: 1623085
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
BZ: 1623085
The same logic exists in fd polling. This change is especially important
to avoid busy loop once we limit aio_notify_accept() to blocking
aio_poll().
Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180809132259.18402-2-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa)
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
util/aio-posix.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/aio-posix.c b/util/aio-posix.c
index d8f0cb4..f650c7c 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -494,7 +494,8 @@ static bool run_poll_handlers_once(AioContext *ctx)
QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
if (!node->deleted && node->io_poll &&
aio_node_check(ctx, node->is_external) &&
- node->io_poll(node->opaque)) {
+ node->io_poll(node->opaque) &&
+ node->opaque != &ctx->notifier) {
progress = true;
}
--
1.8.3.1

View File

@ -0,0 +1,186 @@
From 59776df6fa3156a467e889ae00751da4bf6857eb Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Tue, 9 Oct 2018 08:16:50 +0100
Subject: [PATCH 06/17] aio-posix: compute timeout before polling
RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <20181009081651.15463-5-famz@redhat.com>
Patchwork-id: 82453
O-Subject: [RHEL8/rhel qemu-kvm PATCH 4/5] aio-posix: compute timeout before polling
Bugzilla: 1632622
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
BZ: 1632622
This is a preparation for the next patch, and also a very small
optimization. Compute the timeout only once, before invoking
try_poll_mode, and adjust it in run_poll_handlers. The adjustment
is the polling time when polling fails, or zero (non-blocking) if
polling succeeds.
Fixes: 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20180912171040.1732-3-pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit e30cffa04d52e35996569f1cfac111be19576bde)
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
util/aio-posix.c | 59 ++++++++++++++++++++++++++++++++-----------------------
util/trace-events | 4 ++--
2 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/util/aio-posix.c b/util/aio-posix.c
index 1d7cc53..1b17597 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -490,7 +490,7 @@ static void add_pollfd(AioHandler *node)
npfd++;
}
-static bool run_poll_handlers_once(AioContext *ctx)
+static bool run_poll_handlers_once(AioContext *ctx, int64_t *timeout)
{
bool progress = false;
AioHandler *node;
@@ -500,6 +500,7 @@ static bool run_poll_handlers_once(AioContext *ctx)
aio_node_check(ctx, node->is_external) &&
node->io_poll(node->opaque) &&
node->opaque != &ctx->notifier) {
+ *timeout = 0;
progress = true;
}
@@ -522,31 +523,38 @@ static bool run_poll_handlers_once(AioContext *ctx)
*
* Returns: true if progress was made, false otherwise
*/
-static bool run_poll_handlers(AioContext *ctx, int64_t max_ns)
+static bool run_poll_handlers(AioContext *ctx, int64_t max_ns, int64_t *timeout)
{
bool progress;
- int64_t end_time;
+ int64_t start_time, elapsed_time;
assert(ctx->notify_me);
assert(qemu_lockcnt_count(&ctx->list_lock) > 0);
- trace_run_poll_handlers_begin(ctx, max_ns);
-
- end_time = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + max_ns;
+ trace_run_poll_handlers_begin(ctx, max_ns, *timeout);
+ start_time = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
do {
- progress = run_poll_handlers_once(ctx);
- } while (!progress && qemu_clock_get_ns(QEMU_CLOCK_REALTIME) < end_time
+ progress = run_poll_handlers_once(ctx, timeout);
+ elapsed_time = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - start_time;
+ } while (!progress && elapsed_time < max_ns
&& !atomic_read(&ctx->poll_disable_cnt));
- trace_run_poll_handlers_end(ctx, progress);
+ /* If time has passed with no successful polling, adjust *timeout to
+ * keep the same ending time.
+ */
+ if (*timeout != -1) {
+ *timeout -= MIN(*timeout, elapsed_time);
+ }
+ trace_run_poll_handlers_end(ctx, progress, *timeout);
return progress;
}
/* try_poll_mode:
* @ctx: the AioContext
- * @blocking: busy polling is only attempted when blocking is true
+ * @timeout: timeout for blocking wait, computed by the caller and updated if
+ * polling succeeds.
*
* ctx->notify_me must be non-zero so this function can detect aio_notify().
*
@@ -554,19 +562,16 @@ static bool run_poll_handlers(AioContext *ctx, int64_t max_ns)
*
* Returns: true if progress was made, false otherwise
*/
-static bool try_poll_mode(AioContext *ctx, bool blocking)
+static bool try_poll_mode(AioContext *ctx, int64_t *timeout)
{
- if (blocking && ctx->poll_max_ns && !atomic_read(&ctx->poll_disable_cnt)) {
- /* See qemu_soonest_timeout() uint64_t hack */
- int64_t max_ns = MIN((uint64_t)aio_compute_timeout(ctx),
- (uint64_t)ctx->poll_ns);
+ /* See qemu_soonest_timeout() uint64_t hack */
+ int64_t max_ns = MIN((uint64_t)*timeout, (uint64_t)ctx->poll_ns);
- if (max_ns) {
- poll_set_started(ctx, true);
+ if (max_ns && !atomic_read(&ctx->poll_disable_cnt)) {
+ poll_set_started(ctx, true);
- if (run_poll_handlers(ctx, max_ns)) {
- return true;
- }
+ if (run_poll_handlers(ctx, max_ns, timeout)) {
+ return true;
}
}
@@ -575,7 +580,7 @@ static bool try_poll_mode(AioContext *ctx, bool blocking)
/* Even if we don't run busy polling, try polling once in case it can make
* progress and the caller will be able to avoid ppoll(2)/epoll_wait(2).
*/
- return run_poll_handlers_once(ctx);
+ return run_poll_handlers_once(ctx, timeout);
}
bool aio_poll(AioContext *ctx, bool blocking)
@@ -605,8 +610,14 @@ bool aio_poll(AioContext *ctx, bool blocking)
start = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
}
- progress = try_poll_mode(ctx, blocking);
- if (!progress) {
+ timeout = blocking ? aio_compute_timeout(ctx) : 0;
+ progress = try_poll_mode(ctx, &timeout);
+ assert(!(timeout && progress));
+
+ /* If polling is allowed, non-blocking aio_poll does not need the
+ * system call---a single round of run_poll_handlers_once suffices.
+ */
+ if (timeout || atomic_read(&ctx->poll_disable_cnt)) {
assert(npfd == 0);
/* fill pollfds */
@@ -620,8 +631,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
}
}
- timeout = blocking ? aio_compute_timeout(ctx) : 0;
-
/* wait until next event */
if (aio_epoll_check_poll(ctx, pollfds, npfd, timeout)) {
AioHandler epoll_handler;
diff --git a/util/trace-events b/util/trace-events
index 4822434..79569b7 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -1,8 +1,8 @@
# See docs/devel/tracing.txt for syntax documentation.
# util/aio-posix.c
-run_poll_handlers_begin(void *ctx, int64_t max_ns) "ctx %p max_ns %"PRId64
-run_poll_handlers_end(void *ctx, bool progress) "ctx %p progress %d"
+run_poll_handlers_begin(void *ctx, int64_t max_ns, int64_t timeout) "ctx %p max_ns %"PRId64 " timeout %"PRId64
+run_poll_handlers_end(void *ctx, bool progress, int64_t timeout) "ctx %p progress %d new timeout %"PRId64
poll_shrink(void *ctx, int64_t old, int64_t new) "ctx %p old %"PRId64" new %"PRId64
poll_grow(void *ctx, int64_t old, int64_t new) "ctx %p old %"PRId64" new %"PRId64
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From bd738e0bbc2fec04c928959e8e7e99af03024782 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Tue, 9 Oct 2018 08:16:51 +0100
Subject: [PATCH 07/17] aio-posix: do skip system call if ctx->notifier polling
succeeds
RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <20181009081651.15463-6-famz@redhat.com>
Patchwork-id: 82449
O-Subject: [RHEL8/rhel qemu-kvm PATCH 5/5] aio-posix: do skip system call if ctx->notifier polling succeeds
Bugzilla: 1632622
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
BZ: 1632622
Commit 70232b5253 ("aio-posix: Don't count ctx->notifier as progress when
2018-08-15), by not reporting progress, causes aio_poll to execute the
system call when polling succeeds because of ctx->notifier. This introduces
latency before the call to aio_bh_poll() and negates the advantages of
polling, unfortunately.
The fix builds on the previous patch, separating the effect of polling on
the timeout from the progress reported to aio_poll(). ctx->notifier
does zero the timeout, causing the caller to skip the system call,
but it does not report progress, so that the bug fix of commit 70232b5253
still stands.
Fixes: 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20180912171040.1732-4-pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit cfeb35d6774b2e936046aa9923217818bd160299)
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
util/aio-posix.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/util/aio-posix.c b/util/aio-posix.c
index 1b17597..357de8a 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -498,10 +498,11 @@ static bool run_poll_handlers_once(AioContext *ctx, int64_t *timeout)
QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
if (!node->deleted && node->io_poll &&
aio_node_check(ctx, node->is_external) &&
- node->io_poll(node->opaque) &&
- node->opaque != &ctx->notifier) {
+ node->io_poll(node->opaque)) {
*timeout = 0;
- progress = true;
+ if (node->opaque != &ctx->notifier) {
+ progress = true;
+ }
}
/* Caller handles freeing deleted nodes. Don't do it here. */
--
1.8.3.1

View File

@ -0,0 +1,122 @@
From 67669ce3a2c163c467df63abc90e77bd9a856d34 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Tue, 9 Oct 2018 08:16:49 +0100
Subject: [PATCH 05/17] aio-posix: fix concurrent access to poll_disable_cnt
RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <20181009081651.15463-4-famz@redhat.com>
Patchwork-id: 82452
O-Subject: [RHEL8/rhel qemu-kvm PATCH 3/5] aio-posix: fix concurrent access to poll_disable_cnt
Bugzilla: 1632622
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
BZ: 1632622
It is valid for an aio_set_fd_handler to happen concurrently with
aio_poll. In that case, poll_disable_cnt can change under the heels
of aio_poll, and the assertion on poll_disable_cnt can fail in
run_poll_handlers.
Therefore, this patch simply checks the counter on every polling
iteration. There are no particular needs for ordering, since the
polling loop is terminated anyway by aio_notify at the end of
aio_set_fd_handler.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20180912171040.1732-2-pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit d7be5dd19c0df7f76e1b42f0c2cbbabefa1974cb)
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
util/aio-posix.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/util/aio-posix.c b/util/aio-posix.c
index f05d3a8..1d7cc53 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -211,6 +211,7 @@ void aio_set_fd_handler(AioContext *ctx,
AioHandler *node;
bool is_new = false;
bool deleted = false;
+ int poll_disable_change;
qemu_lockcnt_lock(&ctx->list_lock);
@@ -244,11 +245,9 @@ void aio_set_fd_handler(AioContext *ctx,
QLIST_REMOVE(node, node);
deleted = true;
}
-
- if (!node->io_poll) {
- ctx->poll_disable_cnt--;
- }
+ poll_disable_change = -!node->io_poll;
} else {
+ poll_disable_change = !io_poll - (node && !node->io_poll);
if (node == NULL) {
/* Alloc and insert if it's not already there */
node = g_new0(AioHandler, 1);
@@ -257,10 +256,6 @@ void aio_set_fd_handler(AioContext *ctx,
g_source_add_poll(&ctx->source, &node->pfd);
is_new = true;
-
- ctx->poll_disable_cnt += !io_poll;
- } else {
- ctx->poll_disable_cnt += !io_poll - !node->io_poll;
}
/* Update handler with latest information */
@@ -274,6 +269,15 @@ void aio_set_fd_handler(AioContext *ctx,
node->pfd.events |= (io_write ? G_IO_OUT | G_IO_ERR : 0);
}
+ /* No need to order poll_disable_cnt writes against other updates;
+ * the counter is only used to avoid wasting time and latency on
+ * iterated polling when the system call will be ultimately necessary.
+ * Changing handlers is a rare event, and a little wasted polling until
+ * the aio_notify below is not an issue.
+ */
+ atomic_set(&ctx->poll_disable_cnt,
+ atomic_read(&ctx->poll_disable_cnt) + poll_disable_change);
+
aio_epoll_update(ctx, node, is_new);
qemu_lockcnt_unlock(&ctx->list_lock);
aio_notify(ctx);
@@ -525,7 +529,6 @@ static bool run_poll_handlers(AioContext *ctx, int64_t max_ns)
assert(ctx->notify_me);
assert(qemu_lockcnt_count(&ctx->list_lock) > 0);
- assert(ctx->poll_disable_cnt == 0);
trace_run_poll_handlers_begin(ctx, max_ns);
@@ -533,7 +536,8 @@ static bool run_poll_handlers(AioContext *ctx, int64_t max_ns)
do {
progress = run_poll_handlers_once(ctx);
- } while (!progress && qemu_clock_get_ns(QEMU_CLOCK_REALTIME) < end_time);
+ } while (!progress && qemu_clock_get_ns(QEMU_CLOCK_REALTIME) < end_time
+ && !atomic_read(&ctx->poll_disable_cnt));
trace_run_poll_handlers_end(ctx, progress);
@@ -552,7 +556,7 @@ static bool run_poll_handlers(AioContext *ctx, int64_t max_ns)
*/
static bool try_poll_mode(AioContext *ctx, bool blocking)
{
- if (blocking && ctx->poll_max_ns && ctx->poll_disable_cnt == 0) {
+ if (blocking && ctx->poll_max_ns && !atomic_read(&ctx->poll_disable_cnt)) {
/* See qemu_soonest_timeout() uint64_t hack */
int64_t max_ns = MIN((uint64_t)aio_compute_timeout(ctx),
(uint64_t)ctx->poll_ns);
--
1.8.3.1

View File

@ -0,0 +1,64 @@
From 6d0923cbc54fc8eb983f433ca34a09e2a9982035 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Wed, 10 Oct 2018 20:21:57 +0100
Subject: [PATCH 31/49] aio-wait: Increase num_waiters even in home thread
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20181010202213.7372-19-kwolf@redhat.com>
Patchwork-id: 82609
O-Subject: [RHEL-8 qemu-kvm PATCH 28/44] aio-wait: Increase num_waiters even in home thread
Bugzilla: 1637976
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
Even if AIO_WAIT_WHILE() is called in the home context of the
AioContext, we still want to allow the condition to change depending on
other threads as long as they kick the AioWait. Specfically block jobs
can be running in an I/O thread and should then be able to kick a drain
in the main loop context.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit 486574483aba988c83b20e7d3f1ccd50c4c333d8)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
include/block/aio-wait.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h
index c85a62f..600fad1 100644
--- a/include/block/aio-wait.h
+++ b/include/block/aio-wait.h
@@ -76,6 +76,8 @@ typedef struct {
bool waited_ = false; \
AioWait *wait_ = (wait); \
AioContext *ctx_ = (ctx); \
+ /* Increment wait_->num_waiters before evaluating cond. */ \
+ atomic_inc(&wait_->num_waiters); \
if (ctx_ && in_aio_context_home_thread(ctx_)) { \
while ((cond)) { \
aio_poll(ctx_, true); \
@@ -84,8 +86,6 @@ typedef struct {
} else { \
assert(qemu_get_current_aio_context() == \
qemu_get_aio_context()); \
- /* Increment wait_->num_waiters before evaluating cond. */ \
- atomic_inc(&wait_->num_waiters); \
while ((cond)) { \
if (ctx_) { \
aio_context_release(ctx_); \
@@ -96,8 +96,8 @@ typedef struct {
} \
waited_ = true; \
} \
- atomic_dec(&wait_->num_waiters); \
} \
+ atomic_dec(&wait_->num_waiters); \
waited_; })
/**
--
1.8.3.1

View File

@ -0,0 +1,260 @@
From 1df22a2aa1fc70f0b2b268bbe0c184d95ce74b04 Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Wed, 18 Jul 2018 22:54:52 +0200
Subject: [PATCH 234/268] backup: Use copy offloading
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20180718225511.14878-17-jsnow@redhat.com>
Patchwork-id: 81399
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 16/35] backup: Use copy offloading
Bugzilla: 1207657
RH-Acked-by: Eric Blake <eblake@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>
From: Fam Zheng <famz@redhat.com>
The implementation is similar to the 'qemu-img convert'. In the
beginning of the job, offloaded copy is attempted. If it fails, further
I/O will go through the existing bounce buffer code path.
Then, as Kevin pointed out, both this and qemu-img convert can benefit
from a local check if one request fails because of, for example, the
offset is beyond EOF, but another may well be accepted by the protocol
layer. This will be implemented separately.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20180703023758.14422-4-famz@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit 9ded4a0114968e98b41494fc035ba14f84cdf700)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block/backup.c | 150 ++++++++++++++++++++++++++++++++++++++---------------
block/trace-events | 1 +
2 files changed, 110 insertions(+), 41 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index 5661435..d26eeb5 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -45,6 +45,8 @@ typedef struct BackupBlockJob {
QLIST_HEAD(, CowRequest) inflight_reqs;
HBitmap *copy_bitmap;
+ bool use_copy_range;
+ int64_t copy_range_size;
} BackupBlockJob;
static const BlockJobDriver backup_job_driver;
@@ -86,19 +88,101 @@ static void cow_request_end(CowRequest *req)
qemu_co_queue_restart_all(&req->wait_queue);
}
+/* Copy range to target with a bounce buffer and return the bytes copied. If
+ * error occured, return a negative error number */
+static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job,
+ int64_t start,
+ int64_t end,
+ bool is_write_notifier,
+ bool *error_is_read,
+ void **bounce_buffer)
+{
+ int ret;
+ struct iovec iov;
+ QEMUIOVector qiov;
+ BlockBackend *blk = job->common.blk;
+ int nbytes;
+
+ hbitmap_reset(job->copy_bitmap, start / job->cluster_size, 1);
+ nbytes = MIN(job->cluster_size, job->len - start);
+ if (!*bounce_buffer) {
+ *bounce_buffer = blk_blockalign(blk, job->cluster_size);
+ }
+ iov.iov_base = *bounce_buffer;
+ iov.iov_len = nbytes;
+ qemu_iovec_init_external(&qiov, &iov, 1);
+
+ ret = blk_co_preadv(blk, start, qiov.size, &qiov,
+ is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0);
+ if (ret < 0) {
+ trace_backup_do_cow_read_fail(job, start, ret);
+ if (error_is_read) {
+ *error_is_read = true;
+ }
+ goto fail;
+ }
+
+ if (qemu_iovec_is_zero(&qiov)) {
+ ret = blk_co_pwrite_zeroes(job->target, start,
+ qiov.size, BDRV_REQ_MAY_UNMAP);
+ } else {
+ ret = blk_co_pwritev(job->target, start,
+ qiov.size, &qiov,
+ job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0);
+ }
+ if (ret < 0) {
+ trace_backup_do_cow_write_fail(job, start, ret);
+ if (error_is_read) {
+ *error_is_read = false;
+ }
+ goto fail;
+ }
+
+ return nbytes;
+fail:
+ hbitmap_set(job->copy_bitmap, start / job->cluster_size, 1);
+ return ret;
+
+}
+
+/* Copy range to target and return the bytes copied. If error occured, return a
+ * negative error number. */
+static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job,
+ int64_t start,
+ int64_t end,
+ bool is_write_notifier)
+{
+ int ret;
+ int nr_clusters;
+ BlockBackend *blk = job->common.blk;
+ int nbytes;
+
+ assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size));
+ nbytes = MIN(job->copy_range_size, end - start);
+ nr_clusters = DIV_ROUND_UP(nbytes, job->cluster_size);
+ hbitmap_reset(job->copy_bitmap, start / job->cluster_size,
+ nr_clusters);
+ ret = blk_co_copy_range(blk, start, job->target, start, nbytes,
+ is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0);
+ if (ret < 0) {
+ trace_backup_do_cow_copy_range_fail(job, start, ret);
+ hbitmap_set(job->copy_bitmap, start / job->cluster_size,
+ nr_clusters);
+ return ret;
+ }
+
+ return nbytes;
+}
+
static int coroutine_fn backup_do_cow(BackupBlockJob *job,
int64_t offset, uint64_t bytes,
bool *error_is_read,
bool is_write_notifier)
{
- BlockBackend *blk = job->common.blk;
CowRequest cow_request;
- struct iovec iov;
- QEMUIOVector bounce_qiov;
- void *bounce_buffer = NULL;
int ret = 0;
int64_t start, end; /* bytes */
- int n; /* bytes */
+ void *bounce_buffer = NULL;
qemu_co_rwlock_rdlock(&job->flush_rwlock);
@@ -110,60 +194,38 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *job,
wait_for_overlapping_requests(job, start, end);
cow_request_begin(&cow_request, job, start, end);
- for (; start < end; start += job->cluster_size) {
+ while (start < end) {
if (!hbitmap_get(job->copy_bitmap, start / job->cluster_size)) {
trace_backup_do_cow_skip(job, start);
+ start += job->cluster_size;
continue; /* already copied */
}
- hbitmap_reset(job->copy_bitmap, start / job->cluster_size, 1);
trace_backup_do_cow_process(job, start);
- n = MIN(job->cluster_size, job->len - start);
-
- if (!bounce_buffer) {
- bounce_buffer = blk_blockalign(blk, job->cluster_size);
- }
- iov.iov_base = bounce_buffer;
- iov.iov_len = n;
- qemu_iovec_init_external(&bounce_qiov, &iov, 1);
-
- ret = blk_co_preadv(blk, start, bounce_qiov.size, &bounce_qiov,
- is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0);
- if (ret < 0) {
- trace_backup_do_cow_read_fail(job, start, ret);
- if (error_is_read) {
- *error_is_read = true;
+ if (job->use_copy_range) {
+ ret = backup_cow_with_offload(job, start, end, is_write_notifier);
+ if (ret < 0) {
+ job->use_copy_range = false;
}
- hbitmap_set(job->copy_bitmap, start / job->cluster_size, 1);
- goto out;
}
-
- if (buffer_is_zero(iov.iov_base, iov.iov_len)) {
- ret = blk_co_pwrite_zeroes(job->target, start,
- bounce_qiov.size, BDRV_REQ_MAY_UNMAP);
- } else {
- ret = blk_co_pwritev(job->target, start,
- bounce_qiov.size, &bounce_qiov,
- job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0);
+ if (!job->use_copy_range) {
+ ret = backup_cow_with_bounce_buffer(job, start, end, is_write_notifier,
+ error_is_read, &bounce_buffer);
}
if (ret < 0) {
- trace_backup_do_cow_write_fail(job, start, ret);
- if (error_is_read) {
- *error_is_read = false;
- }
- hbitmap_set(job->copy_bitmap, start / job->cluster_size, 1);
- goto out;
+ break;
}
/* Publish progress, guest I/O counts as progress too. Note that the
* offset field is an opaque progress value, it is not a disk offset.
*/
- job->bytes_read += n;
- job_progress_update(&job->common.job, n);
+ start += ret;
+ job->bytes_read += ret;
+ job_progress_update(&job->common.job, ret);
+ ret = 0;
}
-out:
if (bounce_buffer) {
qemu_vfree(bounce_buffer);
}
@@ -665,6 +727,12 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
} else {
job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);
}
+ job->use_copy_range = true;
+ job->copy_range_size = MIN_NON_ZERO(blk_get_max_transfer(job->common.blk),
+ blk_get_max_transfer(job->target));
+ job->copy_range_size = MAX(job->cluster_size,
+ QEMU_ALIGN_UP(job->copy_range_size,
+ job->cluster_size));
/* Required permissions are already taken with target's blk_new() */
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
diff --git a/block/trace-events b/block/trace-events
index 2d59b53..c35287b 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -42,6 +42,7 @@ backup_do_cow_skip(void *job, int64_t start) "job %p start %"PRId64
backup_do_cow_process(void *job, int64_t start) "job %p start %"PRId64
backup_do_cow_read_fail(void *job, int64_t start, int ret) "job %p start %"PRId64" ret %d"
backup_do_cow_write_fail(void *job, int64_t start, int ret) "job %p start %"PRId64" ret %d"
+backup_do_cow_copy_range_fail(void *job, int64_t start, int ret) "job %p start %"PRId64" ret %d"
# blockdev.c
qmp_block_job_cancel(void *job) "job %p"
--
1.8.3.1

View File

@ -0,0 +1,72 @@
From 51b3550c677efeb39b53d6cfe90a2b9798be707b Mon Sep 17 00:00:00 2001
From: Alex Williamson <alex.williamson@redhat.com>
Date: Mon, 3 Dec 2018 22:01:10 +0000
Subject: [PATCH 10/16] balloon: Allow multiple inhibit users
RH-Author: Alex Williamson <alex.williamson@redhat.com>
Message-id: <154387447040.27651.8134042757905328573.stgit@gimli.home>
Patchwork-id: 83235
O-Subject: [RHEL-8.0 qemu-kvm PATCH 1/7] balloon: Allow multiple inhibit users
Bugzilla: 1650272
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
RH-Acked-by: David Hildenbrand <david@redhat.com>
Bugzilla: 1650272
A simple true/false internal state does not allow multiple users. Fix
this within the existing interface by converting to a counter, so long
as the counter is elevated, ballooning is inhibited.
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit 01ccbec7bdf6f89f1b7d46dda05e4c1fd2dd5ade)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
balloon.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/balloon.c b/balloon.c
index 6bf0a96..9319879 100644
--- a/balloon.c
+++ b/balloon.c
@@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "qemu/atomic.h"
#include "exec/cpu-common.h"
#include "sysemu/kvm.h"
#include "sysemu/balloon.h"
@@ -37,16 +38,22 @@
static QEMUBalloonEvent *balloon_event_fn;
static QEMUBalloonStatus *balloon_stat_fn;
static void *balloon_opaque;
-static bool balloon_inhibited;
+static int balloon_inhibit_count;
bool qemu_balloon_is_inhibited(void)
{
- return balloon_inhibited;
+ return atomic_read(&balloon_inhibit_count) > 0;
}
void qemu_balloon_inhibit(bool state)
{
- balloon_inhibited = state;
+ if (state) {
+ atomic_inc(&balloon_inhibit_count);
+ } else {
+ atomic_dec(&balloon_inhibit_count);
+ }
+
+ assert(atomic_read(&balloon_inhibit_count) >= 0);
}
static bool have_balloon(Error **errp)
--
1.8.3.1

View File

@ -0,0 +1,56 @@
From 6749a16ae2e3d5aa51012bed0d9a910be8de004e Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Tue, 20 Nov 2018 18:18:22 +0000
Subject: [PATCH 28/35] bitmap: Update count after a merge
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20181120181828.15132-19-jsnow@redhat.com>
Patchwork-id: 83073
O-Subject: [RHEL8/rhel qemu-kvm PATCH 18/24] bitmap: Update count after a merge
Bugzilla: 1518989
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
From: Eric Blake <eblake@redhat.com>
We need an accurate count of the number of bits set in a bitmap
after a merge. In particular, since the merge operation short-circuits
a merge from an empty source, if you have bitmaps A, B, and C where
B started empty, then merge C into B, and B into A, an inaccurate
count meant that A did not get the contents of C.
In the worst case, we may falsely regard the bitmap as empty when
it has had new writes merged into it.
Fixes: be58721db
CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20181002233314.30159-1-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit d1dde7149e376d72b422a529ec4bf3ed47f3ba30)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
util/hbitmap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/util/hbitmap.c b/util/hbitmap.c
index d5aca51..8d402c5 100644
--- a/util/hbitmap.c
+++ b/util/hbitmap.c
@@ -759,6 +759,9 @@ bool hbitmap_merge(const HBitmap *a, const HBitmap *b, HBitmap *result)
}
}
+ /* Recompute the dirty count */
+ result->count = hb_count_between(result, 0, result->size - 1);
+
return true;
}
--
1.8.3.1

View File

@ -0,0 +1,84 @@
From 9672f88c8747e874efb9d8d6f67b8d4d8c474779 Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Tue, 20 Nov 2018 18:18:25 +0000
Subject: [PATCH 31/35] bloc/qcow2: drop dirty_bitmaps_loaded state variable
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20181120181828.15132-22-jsnow@redhat.com>
Patchwork-id: 83067
O-Subject: [RHEL8/rhel qemu-kvm PATCH 21/24] bloc/qcow2: drop dirty_bitmaps_loaded state variable
Bugzilla: 1518989
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
This variable doesn't work as it should, because it is actually cleared
in qcow2_co_invalidate_cache() by memset(). Drop it, as the following
patch will introduce new behavior.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit 2ea427effff61efa5d0dc69f9cae126d13879617)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block/qcow2.c | 19 ++-----------------
block/qcow2.h | 1 -
2 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 5c5530d..d260cd6 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1149,7 +1149,6 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
uint64_t ext_end;
uint64_t l1_vm_state_index;
bool update_header = false;
- bool header_updated = false;
ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
if (ret < 0) {
@@ -1488,23 +1487,9 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
s->autoclear_features &= QCOW2_AUTOCLEAR_MASK;
}
- if (s->dirty_bitmaps_loaded) {
- /* It's some kind of reopen. There are no known cases where we need to
- * reload bitmaps in such a situation, so it's safer to skip them.
- *
- * Moreover, if we have some readonly bitmaps and we are reopening for
- * rw we should reopen bitmaps correspondingly.
- */
- if (bdrv_has_readonly_bitmaps(bs) &&
- !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) & BDRV_O_INACTIVE))
- {
- qcow2_reopen_bitmaps_rw_hint(bs, &header_updated, &local_err);
- }
- } else {
- header_updated = qcow2_load_dirty_bitmaps(bs, &local_err);
- s->dirty_bitmaps_loaded = true;
+ if (qcow2_load_dirty_bitmaps(bs, &local_err)) {
+ update_header = false;
}
- update_header = update_header && !header_updated;
if (local_err != NULL) {
error_propagate(errp, local_err);
ret = -EINVAL;
diff --git a/block/qcow2.h b/block/qcow2.h
index d2c63e4..43163b2 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -299,7 +299,6 @@ typedef struct BDRVQcow2State {
uint32_t nb_bitmaps;
uint64_t bitmap_directory_size;
uint64_t bitmap_directory_offset;
- bool dirty_bitmaps_loaded;
int flags;
int qcow_version;
--
1.8.3.1

View File

@ -0,0 +1,70 @@
From b48a7b70caf3883782f8e90fb58b7f46ef6ace88 Mon Sep 17 00:00:00 2001
From: Max Reitz <mreitz@redhat.com>
Date: Mon, 18 Jun 2018 16:12:06 +0200
Subject: [PATCH 039/268] block: Add BDRV_REQ_WRITE_UNCHANGED flag
RH-Author: Max Reitz <mreitz@redhat.com>
Message-id: <20180618161212.14444-5-mreitz@redhat.com>
Patchwork-id: 80764
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 04/10] block: Add BDRV_REQ_WRITE_UNCHANGED flag
Bugzilla: 1518738
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
This flag signifies that a write request will not change the visible
disk content. With this flag set, it is sufficient to have the
BLK_PERM_WRITE_UNCHANGED permission instead of BLK_PERM_WRITE.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20180421132929.21610-4-mreitz@redhat.com
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit c6035964f8316b504060618d05b5dd434f18595b)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block/io.c | 6 +++++-
include/block/block.h | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/block/io.c b/block/io.c
index bd9a19a..134b2a4 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1501,7 +1501,11 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
assert(!waited || !req->serialising);
assert(req->overlap_offset <= offset);
assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
- assert(child->perm & BLK_PERM_WRITE);
+ if (flags & BDRV_REQ_WRITE_UNCHANGED) {
+ assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE));
+ } else {
+ assert(child->perm & BLK_PERM_WRITE);
+ }
assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
diff --git a/include/block/block.h b/include/block/block.h
index 397b5e8..3894edd 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -54,8 +54,12 @@ typedef enum {
BDRV_REQ_FUA = 0x10,
BDRV_REQ_WRITE_COMPRESSED = 0x20,
+ /* Signifies that this write request will not change the visible disk
+ * content. */
+ BDRV_REQ_WRITE_UNCHANGED = 0x40,
+
/* Mask of valid flags */
- BDRV_REQ_MASK = 0x3f,
+ BDRV_REQ_MASK = 0x7f,
} BdrvRequestFlags;
typedef struct BlockSizes {
--
1.8.3.1

View File

@ -0,0 +1,260 @@
From b4442d3284353b0ad54eacbe7e29c8d09dbcf301 Mon Sep 17 00:00:00 2001
From: Max Reitz <mreitz@redhat.com>
Date: Mon, 18 Jun 2018 16:12:04 +0200
Subject: [PATCH 037/268] block: Add COR filter driver
RH-Author: Max Reitz <mreitz@redhat.com>
Message-id: <20180618161212.14444-3-mreitz@redhat.com>
Patchwork-id: 80762
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 02/10] block: Add COR filter driver
Bugzilla: 1518738
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
This adds a simple copy-on-read filter driver. It relies on the already
existing COR functionality in the central block layer code, which may be
moved here once we no longer need it there.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20180421132929.21610-2-mreitz@redhat.com
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 6c6f24fd84895d03baa898bbc4324dd4ccc97071)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block/Makefile.objs | 2 +-
block/copy-on-read.c | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++
qapi/block-core.json | 5 +-
3 files changed, 176 insertions(+), 2 deletions(-)
create mode 100644 block/copy-on-read.c
diff --git a/block/Makefile.objs b/block/Makefile.objs
index c0693fc..be2cda1 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -26,7 +26,7 @@ block-obj-y += accounting.o dirty-bitmap.o
block-obj-y += write-threshold.o
block-obj-y += backup.o
block-obj-$(CONFIG_REPLICATION) += replication.o
-block-obj-y += throttle.o
+block-obj-y += throttle.o copy-on-read.o
block-obj-y += crypto.o
diff --git a/block/copy-on-read.c b/block/copy-on-read.c
new file mode 100644
index 0000000..823ec75
--- /dev/null
+++ b/block/copy-on-read.c
@@ -0,0 +1,171 @@
+/*
+ * Copy-on-read filter block driver
+ *
+ * Copyright (c) 2018 Red Hat, Inc.
+ *
+ * Author:
+ * Max Reitz <mreitz@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "block/block_int.h"
+
+
+static int cor_open(BlockDriverState *bs, QDict *options, int flags,
+ Error **errp)
+{
+ bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false,
+ errp);
+ if (!bs->file) {
+ return -EINVAL;
+ }
+
+ bs->supported_write_flags = BDRV_REQ_FUA &
+ bs->file->bs->supported_write_flags;
+
+ bs->supported_zero_flags = (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
+ bs->file->bs->supported_zero_flags;
+
+ return 0;
+}
+
+
+static void cor_close(BlockDriverState *bs)
+{
+}
+
+
+#define PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \
+ | BLK_PERM_WRITE \
+ | BLK_PERM_RESIZE)
+#define PERM_UNCHANGED (BLK_PERM_ALL & ~PERM_PASSTHROUGH)
+
+static void cor_child_perm(BlockDriverState *bs, BdrvChild *c,
+ const BdrvChildRole *role,
+ BlockReopenQueue *reopen_queue,
+ uint64_t perm, uint64_t shared,
+ uint64_t *nperm, uint64_t *nshared)
+{
+ if (c == NULL) {
+ *nperm = (perm & PERM_PASSTHROUGH) | BLK_PERM_WRITE_UNCHANGED;
+ *nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED;
+ return;
+ }
+
+ *nperm = (perm & PERM_PASSTHROUGH) |
+ (c->perm & PERM_UNCHANGED);
+ *nshared = (shared & PERM_PASSTHROUGH) |
+ (c->shared_perm & PERM_UNCHANGED);
+}
+
+
+static int64_t cor_getlength(BlockDriverState *bs)
+{
+ return bdrv_getlength(bs->file->bs);
+}
+
+
+static int cor_truncate(BlockDriverState *bs, int64_t offset,
+ PreallocMode prealloc, Error **errp)
+{
+ return bdrv_truncate(bs->file, offset, prealloc, errp);
+}
+
+
+static int coroutine_fn cor_co_preadv(BlockDriverState *bs,
+ uint64_t offset, uint64_t bytes,
+ QEMUIOVector *qiov, int flags)
+{
+ return bdrv_co_preadv(bs->file, offset, bytes, qiov,
+ flags | BDRV_REQ_COPY_ON_READ);
+}
+
+
+static int coroutine_fn cor_co_pwritev(BlockDriverState *bs,
+ uint64_t offset, uint64_t bytes,
+ QEMUIOVector *qiov, int flags)
+{
+
+ return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags);
+}
+
+
+static int coroutine_fn cor_co_pwrite_zeroes(BlockDriverState *bs,
+ int64_t offset, int bytes,
+ BdrvRequestFlags flags)
+{
+ return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags);
+}
+
+
+static int coroutine_fn cor_co_pdiscard(BlockDriverState *bs,
+ int64_t offset, int bytes)
+{
+ return bdrv_co_pdiscard(bs->file->bs, offset, bytes);
+}
+
+
+static void cor_eject(BlockDriverState *bs, bool eject_flag)
+{
+ bdrv_eject(bs->file->bs, eject_flag);
+}
+
+
+static void cor_lock_medium(BlockDriverState *bs, bool locked)
+{
+ bdrv_lock_medium(bs->file->bs, locked);
+}
+
+
+static bool cor_recurse_is_first_non_filter(BlockDriverState *bs,
+ BlockDriverState *candidate)
+{
+ return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
+}
+
+
+BlockDriver bdrv_copy_on_read = {
+ .format_name = "copy-on-read",
+
+ .bdrv_open = cor_open,
+ .bdrv_close = cor_close,
+ .bdrv_child_perm = cor_child_perm,
+
+ .bdrv_getlength = cor_getlength,
+ .bdrv_truncate = cor_truncate,
+
+ .bdrv_co_preadv = cor_co_preadv,
+ .bdrv_co_pwritev = cor_co_pwritev,
+ .bdrv_co_pwrite_zeroes = cor_co_pwrite_zeroes,
+ .bdrv_co_pdiscard = cor_co_pdiscard,
+
+ .bdrv_eject = cor_eject,
+ .bdrv_lock_medium = cor_lock_medium,
+
+ .bdrv_co_block_status = bdrv_co_block_status_from_file,
+
+ .bdrv_recurse_is_first_non_filter = cor_recurse_is_first_non_filter,
+
+ .has_variable_length = true,
+ .is_filter = true,
+};
+
+static void bdrv_copy_on_read_init(void)
+{
+ bdrv_register(&bdrv_copy_on_read);
+}
+
+block_init(bdrv_copy_on_read_init);
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 51eafdd..9e4f1ac 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2506,11 +2506,12 @@
# @vxhs: Since 2.10
# @throttle: Since 2.11
# @nvme: Since 2.12
+# @copy-on-read: Since 2.13
#
# Since: 2.9
##
{ 'enum': 'BlockdevDriver',
- 'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop',
+ 'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop', 'copy-on-read',
'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
'null-aio', 'null-co', 'nvme', 'parallels', 'qcow', 'qcow2', 'qed',
@@ -3541,6 +3542,7 @@
'blkverify': 'BlockdevOptionsBlkverify',
'bochs': 'BlockdevOptionsGenericFormat',
'cloop': 'BlockdevOptionsGenericFormat',
+ 'copy-on-read':'BlockdevOptionsGenericFormat',
'dmg': 'BlockdevOptionsGenericFormat',
'file': 'BlockdevOptionsFile',
'ftp': 'BlockdevOptionsCurlFtp',
@@ -4068,6 +4070,7 @@
'blkverify': 'BlockdevCreateNotSupported',
'bochs': 'BlockdevCreateNotSupported',
'cloop': 'BlockdevCreateNotSupported',
+ 'copy-on-read': 'BlockdevCreateNotSupported',
'dmg': 'BlockdevCreateNotSupported',
'file': 'BlockdevCreateOptionsFile',
'ftp': 'BlockdevCreateNotSupported',
--
1.8.3.1

View File

@ -0,0 +1,465 @@
From 26f46c414ca053bfe87cebd9d40107fc4fa6bc1b Mon Sep 17 00:00:00 2001
From: Max Reitz <mreitz@redhat.com>
Date: Mon, 18 Jun 2018 14:59:38 +0200
Subject: [PATCH 065/268] block: Add Error parameter to bdrv_amend_options
RH-Author: Max Reitz <mreitz@redhat.com>
Message-id: <20180618145943.4489-3-mreitz@redhat.com>
Patchwork-id: 80755
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 2/7] block: Add Error parameter to bdrv_amend_options
Bugzilla: 1537956
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Looking at the qcow2 code that is riddled with error_report() calls,
this is really how it should have been from the start.
Along the way, turn the target_version/current_version comparisons at
the beginning of qcow2_downgrade() into assertions (the caller has to
make sure these conditions are met), and rephrase the error message on
using compat=1.1 to get refcount widths other than 16 bits.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20180509210023.20283-3-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit d1402b502691142b9cebadd5cb993dc8858e9071)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block.c | 8 ++++--
block/qcow2.c | 72 ++++++++++++++++++++++++++--------------------
include/block/block.h | 3 +-
include/block/block_int.h | 3 +-
qemu-img.c | 4 +--
tests/qemu-iotests/060.out | 4 +--
tests/qemu-iotests/061.out | 7 -----
tests/qemu-iotests/080.out | 4 +--
tests/qemu-iotests/112.out | 5 +---
9 files changed, 58 insertions(+), 52 deletions(-)
diff --git a/block.c b/block.c
index 982d54e..d991a09 100644
--- a/block.c
+++ b/block.c
@@ -5008,15 +5008,19 @@ void bdrv_remove_aio_context_notifier(BlockDriverState *bs,
}
int bdrv_amend_options(BlockDriverState *bs, QemuOpts *opts,
- BlockDriverAmendStatusCB *status_cb, void *cb_opaque)
+ BlockDriverAmendStatusCB *status_cb, void *cb_opaque,
+ Error **errp)
{
if (!bs->drv) {
+ error_setg(errp, "Node is ejected");
return -ENOMEDIUM;
}
if (!bs->drv->bdrv_amend_options) {
+ error_setg(errp, "Block driver '%s' does not support option amendment",
+ bs->drv->format_name);
return -ENOTSUP;
}
- return bs->drv->bdrv_amend_options(bs, opts, status_cb, cb_opaque);
+ return bs->drv->bdrv_amend_options(bs, opts, status_cb, cb_opaque, errp);
}
/* This function will be called by the bdrv_recurse_is_first_non_filter method
diff --git a/block/qcow2.c b/block/qcow2.c
index 26a6a7f..092db81 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -4039,22 +4039,21 @@ static int qcow2_load_vmstate(BlockDriverState *bs, QEMUIOVector *qiov,
* have to be removed.
*/
static int qcow2_downgrade(BlockDriverState *bs, int target_version,
- BlockDriverAmendStatusCB *status_cb, void *cb_opaque)
+ BlockDriverAmendStatusCB *status_cb, void *cb_opaque,
+ Error **errp)
{
BDRVQcow2State *s = bs->opaque;
int current_version = s->qcow_version;
int ret;
- if (target_version == current_version) {
- return 0;
- } else if (target_version > current_version) {
- return -EINVAL;
- } else if (target_version != 2) {
- return -EINVAL;
- }
+ /* This is qcow2_downgrade(), not qcow2_upgrade() */
+ assert(target_version < current_version);
+
+ /* There are no other versions (now) that you can downgrade to */
+ assert(target_version == 2);
if (s->refcount_order != 4) {
- error_report("compat=0.10 requires refcount_bits=16");
+ error_setg(errp, "compat=0.10 requires refcount_bits=16");
return -ENOTSUP;
}
@@ -4062,6 +4061,7 @@ static int qcow2_downgrade(BlockDriverState *bs, int target_version,
if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) {
ret = qcow2_mark_clean(bs);
if (ret < 0) {
+ error_setg_errno(errp, -ret, "Failed to make the image clean");
return ret;
}
}
@@ -4071,6 +4071,8 @@ static int qcow2_downgrade(BlockDriverState *bs, int target_version,
* best thing to do anyway */
if (s->incompatible_features) {
+ error_setg(errp, "Cannot downgrade an image with incompatible features "
+ "%#" PRIx64 " set", s->incompatible_features);
return -ENOTSUP;
}
@@ -4084,6 +4086,7 @@ static int qcow2_downgrade(BlockDriverState *bs, int target_version,
ret = qcow2_expand_zero_clusters(bs, status_cb, cb_opaque);
if (ret < 0) {
+ error_setg_errno(errp, -ret, "Failed to turn zero into data clusters");
return ret;
}
@@ -4091,6 +4094,7 @@ static int qcow2_downgrade(BlockDriverState *bs, int target_version,
ret = qcow2_update_header(bs);
if (ret < 0) {
s->qcow_version = current_version;
+ error_setg_errno(errp, -ret, "Failed to update the image header");
return ret;
}
return 0;
@@ -4168,7 +4172,8 @@ static void qcow2_amend_helper_cb(BlockDriverState *bs,
static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
BlockDriverAmendStatusCB *status_cb,
- void *cb_opaque)
+ void *cb_opaque,
+ Error **errp)
{
BDRVQcow2State *s = bs->opaque;
int old_version = s->qcow_version, new_version = old_version;
@@ -4180,7 +4185,6 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
bool encrypt;
int encformat;
int refcount_bits = s->refcount_bits;
- Error *local_err = NULL;
int ret;
QemuOptDesc *desc = opts->list->desc;
Qcow2AmendHelperCBInfo helper_cb_info;
@@ -4201,11 +4205,11 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
} else if (!strcmp(compat, "1.1")) {
new_version = 3;
} else {
- error_report("Unknown compatibility level %s", compat);
+ error_setg(errp, "Unknown compatibility level %s", compat);
return -EINVAL;
}
} else if (!strcmp(desc->name, BLOCK_OPT_PREALLOC)) {
- error_report("Cannot change preallocation mode");
+ error_setg(errp, "Cannot change preallocation mode");
return -ENOTSUP;
} else if (!strcmp(desc->name, BLOCK_OPT_SIZE)) {
new_size = qemu_opt_get_size(opts, BLOCK_OPT_SIZE, 0);
@@ -4218,7 +4222,8 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
!!s->crypto);
if (encrypt != !!s->crypto) {
- error_report("Changing the encryption flag is not supported");
+ error_setg(errp,
+ "Changing the encryption flag is not supported");
return -ENOTSUP;
}
} else if (!strcmp(desc->name, BLOCK_OPT_ENCRYPT_FORMAT)) {
@@ -4226,17 +4231,19 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
qemu_opt_get(opts, BLOCK_OPT_ENCRYPT_FORMAT));
if (encformat != s->crypt_method_header) {
- error_report("Changing the encryption format is not supported");
+ error_setg(errp,
+ "Changing the encryption format is not supported");
return -ENOTSUP;
}
} else if (g_str_has_prefix(desc->name, "encrypt.")) {
- error_report("Changing the encryption parameters is not supported");
+ error_setg(errp,
+ "Changing the encryption parameters is not supported");
return -ENOTSUP;
} else if (!strcmp(desc->name, BLOCK_OPT_CLUSTER_SIZE)) {
cluster_size = qemu_opt_get_size(opts, BLOCK_OPT_CLUSTER_SIZE,
cluster_size);
if (cluster_size != s->cluster_size) {
- error_report("Changing the cluster size is not supported");
+ error_setg(errp, "Changing the cluster size is not supported");
return -ENOTSUP;
}
} else if (!strcmp(desc->name, BLOCK_OPT_LAZY_REFCOUNTS)) {
@@ -4249,8 +4256,8 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
if (refcount_bits <= 0 || refcount_bits > 64 ||
!is_power_of_2(refcount_bits))
{
- error_report("Refcount width must be a power of two and may "
- "not exceed 64 bits");
+ error_setg(errp, "Refcount width must be a power of two and "
+ "may not exceed 64 bits");
return -EINVAL;
}
} else {
@@ -4275,6 +4282,7 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
ret = qcow2_update_header(bs);
if (ret < 0) {
s->qcow_version = old_version;
+ error_setg_errno(errp, -ret, "Failed to update the image header");
return ret;
}
}
@@ -4283,18 +4291,17 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
int refcount_order = ctz32(refcount_bits);
if (new_version < 3 && refcount_bits != 16) {
- error_report("Different refcount widths than 16 bits require "
- "compatibility level 1.1 or above (use compat=1.1 or "
- "greater)");
+ error_setg(errp, "Refcount widths other than 16 bits require "
+ "compatibility level 1.1 or above (use compat=1.1 or "
+ "greater)");
return -EINVAL;
}
helper_cb_info.current_operation = QCOW2_CHANGING_REFCOUNT_ORDER;
ret = qcow2_change_refcount_order(bs, refcount_order,
&qcow2_amend_helper_cb,
- &helper_cb_info, &local_err);
+ &helper_cb_info, errp);
if (ret < 0) {
- error_report_err(local_err);
return ret;
}
}
@@ -4304,6 +4311,7 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
backing_file ?: s->image_backing_file,
backing_format ?: s->image_backing_format);
if (ret < 0) {
+ error_setg_errno(errp, -ret, "Failed to change the backing file");
return ret;
}
}
@@ -4311,14 +4319,16 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
if (s->use_lazy_refcounts != lazy_refcounts) {
if (lazy_refcounts) {
if (new_version < 3) {
- error_report("Lazy refcounts only supported with compatibility "
- "level 1.1 and above (use compat=1.1 or greater)");
+ error_setg(errp, "Lazy refcounts only supported with "
+ "compatibility level 1.1 and above (use compat=1.1 "
+ "or greater)");
return -EINVAL;
}
s->compatible_features |= QCOW2_COMPAT_LAZY_REFCOUNTS;
ret = qcow2_update_header(bs);
if (ret < 0) {
s->compatible_features &= ~QCOW2_COMPAT_LAZY_REFCOUNTS;
+ error_setg_errno(errp, -ret, "Failed to update the image header");
return ret;
}
s->use_lazy_refcounts = true;
@@ -4326,6 +4336,7 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
/* make image clean first */
ret = qcow2_mark_clean(bs);
if (ret < 0) {
+ error_setg_errno(errp, -ret, "Failed to make the image clean");
return ret;
}
/* now disallow lazy refcounts */
@@ -4333,6 +4344,7 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
ret = qcow2_update_header(bs);
if (ret < 0) {
s->compatible_features |= QCOW2_COMPAT_LAZY_REFCOUNTS;
+ error_setg_errno(errp, -ret, "Failed to update the image header");
return ret;
}
s->use_lazy_refcounts = false;
@@ -4341,17 +4353,15 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
if (new_size) {
BlockBackend *blk = blk_new(BLK_PERM_RESIZE, BLK_PERM_ALL);
- ret = blk_insert_bs(blk, bs, &local_err);
+ ret = blk_insert_bs(blk, bs, errp);
if (ret < 0) {
- error_report_err(local_err);
blk_unref(blk);
return ret;
}
- ret = blk_truncate(blk, new_size, PREALLOC_MODE_OFF, &local_err);
+ ret = blk_truncate(blk, new_size, PREALLOC_MODE_OFF, errp);
blk_unref(blk);
if (ret < 0) {
- error_report_err(local_err);
return ret;
}
}
@@ -4360,7 +4370,7 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
if (new_version < old_version) {
helper_cb_info.current_operation = QCOW2_DOWNGRADING;
ret = qcow2_downgrade(bs, new_version, &qcow2_amend_helper_cb,
- &helper_cb_info);
+ &helper_cb_info, errp);
if (ret < 0) {
return ret;
}
diff --git a/include/block/block.h b/include/block/block.h
index 06cd772..2d17b09 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -343,7 +343,8 @@ int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix);
typedef void BlockDriverAmendStatusCB(BlockDriverState *bs, int64_t offset,
int64_t total_work_size, void *opaque);
int bdrv_amend_options(BlockDriverState *bs_new, QemuOpts *opts,
- BlockDriverAmendStatusCB *status_cb, void *cb_opaque);
+ BlockDriverAmendStatusCB *status_cb, void *cb_opaque,
+ Error **errp);
/* external snapshots */
bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index c4dd1d4..d913ed1 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -324,7 +324,8 @@ struct BlockDriver {
int (*bdrv_amend_options)(BlockDriverState *bs, QemuOpts *opts,
BlockDriverAmendStatusCB *status_cb,
- void *cb_opaque);
+ void *cb_opaque,
+ Error **errp);
void (*bdrv_debug_event)(BlockDriverState *bs, BlkdebugEvent event);
diff --git a/qemu-img.c b/qemu-img.c
index 2f7c491..e40d6ff 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3761,10 +3761,10 @@ static int img_amend(int argc, char **argv)
/* In case the driver does not call amend_status_cb() */
qemu_progress_print(0.f, 0);
- ret = bdrv_amend_options(bs, opts, &amend_status_cb, NULL);
+ ret = bdrv_amend_options(bs, opts, &amend_status_cb, NULL, &err);
qemu_progress_print(100.f, 0);
if (ret < 0) {
- error_report("Error while amending options: %s", strerror(-ret));
+ error_report_err(err);
goto out;
}
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
index 99234fb..bff023d 100644
--- a/tests/qemu-iotests/060.out
+++ b/tests/qemu-iotests/060.out
@@ -129,7 +129,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 index: 0); further corruption events will be suppressed
-qemu-img: Error while amending options: Input/output error
+qemu-img: Failed to turn zero into data clusters: Input/output error
=== Testing unaligned L2 entry ===
@@ -145,7 +145,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
-qemu-img: Error while amending options: Input/output error
+qemu-img: Failed to turn zero into data clusters: Input/output error
=== Testing unaligned reftable entry ===
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
index e857ef9..183f7dd 100644
--- a/tests/qemu-iotests/061.out
+++ b/tests/qemu-iotests/061.out
@@ -358,18 +358,12 @@ No errors were found on the image.
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
qemu-img: Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
-qemu-img: Error while amending options: Invalid argument
qemu-img: Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
-qemu-img: Error while amending options: Invalid argument
qemu-img: Unknown compatibility level 0.42
-qemu-img: Error while amending options: Invalid argument
qemu-img: Invalid parameter 'foo'
qemu-img: Changing the cluster size is not supported
-qemu-img: Error while amending options: Operation not supported
qemu-img: Changing the encryption flag is not supported
-qemu-img: Error while amending options: Operation not supported
qemu-img: Cannot change preallocation mode
-qemu-img: Error while amending options: Operation not supported
=== Testing correct handling of unset value ===
@@ -377,7 +371,6 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
Should work:
Should not work:
qemu-img: Changing the cluster size is not supported
-qemu-img: Error while amending options: Operation not supported
=== Testing zero expansion on inactive clusters ===
diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out
index 4e0f7f7..281c7e0 100644
--- a/tests/qemu-iotests/080.out
+++ b/tests/qemu-iotests/080.out
@@ -65,7 +65,7 @@ wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid
qemu-img: Snapshot L1 table offset invalid
-qemu-img: Error while amending options: Invalid argument
+qemu-img: Failed to turn zero into data clusters: Invalid argument
Failed to flush the refcount block cache: Invalid argument
write failed: Invalid argument
qemu-img: Snapshot L1 table offset invalid
@@ -88,7 +88,7 @@ wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-img: Failed to load snapshot: Snapshot L1 table too large
qemu-img: Snapshot L1 table too large
-qemu-img: Error while amending options: File too large
+qemu-img: Failed to turn zero into data clusters: File too large
Failed to flush the refcount block cache: File too large
write failed: File too large
qemu-img: Snapshot L1 table too large
diff --git a/tests/qemu-iotests/112.out b/tests/qemu-iotests/112.out
index 86f0410..ae0318c 100644
--- a/tests/qemu-iotests/112.out
+++ b/tests/qemu-iotests/112.out
@@ -99,13 +99,11 @@ refcount bits: 64
=== Amend to compat=0.10 ===
qemu-img: compat=0.10 requires refcount_bits=16
-qemu-img: Error while amending options: Operation not supported
refcount bits: 64
No errors were found on the image.
refcount bits: 16
refcount bits: 16
-qemu-img: Different refcount widths than 16 bits require compatibility level 1.1 or above (use compat=1.1 or greater)
-qemu-img: Error while amending options: Invalid argument
+qemu-img: Refcount widths other than 16 bits require compatibility level 1.1 or above (use compat=1.1 or greater)
refcount bits: 16
=== Amend with snapshot ===
@@ -113,7 +111,6 @@ refcount bits: 16
wrote 16777216/16777216 bytes at offset 0
16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-img: Cannot decrease refcount entry width to 1 bits: Cluster at offset 0x50000 has a refcount of 2
-qemu-img: Error while amending options: Invalid argument
No errors were found on the image.
refcount bits: 16
No errors were found on the image.
--
1.8.3.1

View File

@ -0,0 +1,200 @@
From cff7af832cadce3d5afd2819483b1b61a115ace2 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Thu, 10 Jan 2019 12:44:32 +0000
Subject: [PATCH 02/14] block: Add auto-read-only option
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20190110124442.30132-3-kwolf@redhat.com>
Patchwork-id: 83952
O-Subject: [RHEL-8.0 qemu-kvm PATCH 02/12] block: Add auto-read-only option
Bugzilla: 1644996
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Eric Blake <eblake@redhat.com>
If a management application builds the block graph node by node, the
protocol layer doesn't inherit its read-only option from the format
layer any more, so it must be set explicitly.
Backing files should work on read-only storage, but at the same time, a
block job like commit should be able to reopen them read-write if they
are on read-write storage. However, without option inheritance, reopen
only changes the read-only option for the root node (typically the
format layer), but not the protocol layer, so reopening fails (the
format layer wants to get write permissions, but the protocol layer is
still read-only).
A simple workaround for the problem in the management tool would be to
open the protocol layer always read-write and to make only the format
layer read-only for backing files. However, sometimes the file is
actually stored on read-only storage and we don't know whether the image
can be opened read-write (for example, for NBD it depends on the server
we're trying to connect to). This adds an option that makes QEMU try to
open the image read-write, but allows it to degrade to a read-only mode
without returning an error.
The documentation for this option is consciously phrased in a way that
allows QEMU to switch to a better model eventually: Instead of trying
when the image is first opened, making the read-only flag dynamic and
changing it automatically whenever the first BLK_PERM_WRITE user is
attached or the last one is detached would be much more useful
behaviour.
Unfortunately, this more useful behaviour is also a lot harder to
implement, and libvirt needs a solution now before it can switch to
-blockdev, so let's start with this easier approach for now.
Instead of adding a new auto-read-only option, turning the existing
read-only into an enum (with a bool alternate for compatibility) was
considered, but it complicated the implementation to the point that it
didn't seem to be worth it.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit e35bdc123a4ace9f4d3fccaaf88907014e2438cd)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block.c | 17 +++++++++++++++++
block/vvfat.c | 1 +
blockdev.c | 2 +-
include/block/block.h | 2 ++
qapi/block-core.json | 7 +++++++
5 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 6f1d53b..f357975 100644
--- a/block.c
+++ b/block.c
@@ -905,6 +905,7 @@ static void bdrv_inherited_options(int *child_flags, QDict *child_options,
/* Inherit the read-only option from the parent if it's not set */
qdict_copy_default(child_options, parent_options, BDRV_OPT_READ_ONLY);
+ qdict_copy_default(child_options, parent_options, BDRV_OPT_AUTO_READ_ONLY);
/* Our block drivers take care to send flushes and respect unmap policy,
* so we can default to enable both on lower layers regardless of the
@@ -1028,6 +1029,7 @@ static void bdrv_backing_options(int *child_flags, QDict *child_options,
/* backing files always opened read-only */
qdict_set_default_str(child_options, BDRV_OPT_READ_ONLY, "on");
+ qdict_set_default_str(child_options, BDRV_OPT_AUTO_READ_ONLY, "off");
flags &= ~BDRV_O_COPY_ON_READ;
/* snapshot=on is handled on the top layer */
@@ -1117,6 +1119,10 @@ static void update_flags_from_options(int *flags, QemuOpts *opts)
*flags |= BDRV_O_RDWR;
}
+ assert(qemu_opt_find(opts, BDRV_OPT_AUTO_READ_ONLY));
+ if (qemu_opt_get_bool_del(opts, BDRV_OPT_AUTO_READ_ONLY, false)) {
+ *flags |= BDRV_O_AUTO_RDONLY;
+ }
}
static void update_options_from_flags(QDict *options, int flags)
@@ -1131,6 +1137,10 @@ static void update_options_from_flags(QDict *options, int flags)
if (!qdict_haskey(options, BDRV_OPT_READ_ONLY)) {
qdict_put_bool(options, BDRV_OPT_READ_ONLY, !(flags & BDRV_O_RDWR));
}
+ if (!qdict_haskey(options, BDRV_OPT_AUTO_READ_ONLY)) {
+ qdict_put_bool(options, BDRV_OPT_AUTO_READ_ONLY,
+ flags & BDRV_O_AUTO_RDONLY);
+ }
}
static void bdrv_assign_node_name(BlockDriverState *bs,
@@ -1304,6 +1314,11 @@ QemuOptsList bdrv_runtime_opts = {
.help = "Node is opened in read-only mode",
},
{
+ .name = BDRV_OPT_AUTO_READ_ONLY,
+ .type = QEMU_OPT_BOOL,
+ .help = "Node can become read-only if opening read-write fails",
+ },
+ {
.name = "detect-zeroes",
.type = QEMU_OPT_STRING,
.help = "try to optimize zero writes (off, on, unmap)",
@@ -2490,6 +2505,8 @@ BlockDriverState *bdrv_open_blockdev_ref(BlockdevRef *ref, Error **errp)
qdict_set_default_str(qdict, BDRV_OPT_CACHE_DIRECT, "off");
qdict_set_default_str(qdict, BDRV_OPT_CACHE_NO_FLUSH, "off");
qdict_set_default_str(qdict, BDRV_OPT_READ_ONLY, "off");
+ qdict_set_default_str(qdict, BDRV_OPT_AUTO_READ_ONLY, "off");
+
}
bs = bdrv_open_inherit(NULL, reference, qdict, 0, NULL, NULL, errp);
diff --git a/block/vvfat.c b/block/vvfat.c
index c7d2ed2..3efce9e 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -3130,6 +3130,7 @@ static void vvfat_qcow_options(int *child_flags, QDict *child_options,
int parent_flags, QDict *parent_options)
{
qdict_set_default_str(child_options, BDRV_OPT_READ_ONLY, "off");
+ qdict_set_default_str(child_options, BDRV_OPT_AUTO_READ_ONLY, "off");
qdict_set_default_str(child_options, BDRV_OPT_CACHE_NO_FLUSH, "on");
}
diff --git a/blockdev.c b/blockdev.c
index 56a3d0f..be650d0 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2760,7 +2760,7 @@ void qmp_blockdev_change_medium(bool has_device, const char *device,
bdrv_flags = blk_get_open_flags_from_root_state(blk);
bdrv_flags &= ~(BDRV_O_TEMPORARY | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING |
- BDRV_O_PROTOCOL);
+ BDRV_O_PROTOCOL | BDRV_O_AUTO_RDONLY);
if (!has_read_only) {
read_only = BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN;
diff --git a/include/block/block.h b/include/block/block.h
index 8e78daf..6ee8b2a 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -114,6 +114,7 @@ typedef struct HDGeometry {
select an appropriate protocol driver,
ignoring the format layer */
#define BDRV_O_NO_IO 0x10000 /* don't initialize for I/O */
+#define BDRV_O_AUTO_RDONLY 0x20000 /* degrade to read-only if opening read-write fails */
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH)
@@ -124,6 +125,7 @@ typedef struct HDGeometry {
#define BDRV_OPT_CACHE_DIRECT "cache.direct"
#define BDRV_OPT_CACHE_NO_FLUSH "cache.no-flush"
#define BDRV_OPT_READ_ONLY "read-only"
+#define BDRV_OPT_AUTO_READ_ONLY "auto-read-only"
#define BDRV_OPT_DISCARD "discard"
#define BDRV_OPT_FORCE_SHARE "force-share"
diff --git a/qapi/block-core.json b/qapi/block-core.json
index db47fb8..5e5f4f9 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -3604,6 +3604,12 @@
# either generally or in certain configurations. In this case,
# the default value does not work and the option must be
# specified explicitly.
+# @auto-read-only: if true and @read-only is false, QEMU may automatically
+# decide not to open the image read-write as requested, but
+# fall back to read-only instead (and switch between the modes
+# later), e.g. depending on whether the image file is writable
+# or whether a writing user is attached to the node
+# (default: false, since 3.1)
# @detect-zeroes: detect and optimize zero writes (Since 2.1)
# (default: off)
# @force-share: force share all permission on added nodes.
@@ -3619,6 +3625,7 @@
'*discard': 'BlockdevDiscardOptions',
'*cache': 'BlockdevCacheOptions',
'*read-only': 'bool',
+ '*auto-read-only': 'bool',
'*force-share': 'bool',
'*detect-zeroes': 'BlockdevDetectZeroesOptions' },
'discriminator': 'driver',
--
1.8.3.1

View File

@ -0,0 +1,423 @@
From 8c7a6486578c7d3e95ca72d798a3e2a5c3f8c348 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Mon, 18 Jun 2018 08:43:15 +0200
Subject: [PATCH 017/268] block: Add block-specific QDict header
RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <20180618084330.30009-9-armbru@redhat.com>
Patchwork-id: 80736
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 08/23] block: Add block-specific QDict header
Bugzilla: 1557995
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
From: Max Reitz <mreitz@redhat.com>
There are numerous QDict functions that have been introduced for and are
used only by the block layer. Move their declarations into an own
header file to reflect that.
While qdict_extract_subqdict() is in fact used outside of the block
layer (in util/qemu-config.c), it is still a function related very
closely to how the block layer works with nested QDicts, namely by
sometimes flattening them. Therefore, its declaration is put into this
header as well and util/qemu-config.c includes it with a comment stating
exactly which function it needs.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20180509165530.29561-7-mreitz@redhat.com>
[Copyright note tweaked, superfluous includes dropped]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 609f45ea9507fc1603eaeda7f5066b99beac6721)
[Trivial conflict in block/nbd.c resolved]
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block.c | 1 +
block/gluster.c | 1 +
block/iscsi.c | 1 +
block/nbd.c | 1 +
block/nfs.c | 1 +
block/parallels.c | 1 +
block/qcow.c | 1 +
block/qcow2.c | 1 +
block/qed.c | 1 +
block/quorum.c | 1 +
block/rbd.c | 1 +
block/sheepdog.c | 1 +
block/snapshot.c | 1 +
block/ssh.c | 1 +
block/vhdx.c | 1 +
block/vpc.c | 1 +
block/vvfat.c | 1 +
block/vxhs.c | 1 +
blockdev.c | 1 +
include/block/qdict.h | 32 ++++++++++++++++++++++++++++++++
include/qapi/qmp/qdict.h | 17 -----------------
qobject/qdict.c | 1 +
tests/check-qdict.c | 1 +
tests/check-qobject.c | 1 +
tests/test-replication.c | 1 +
util/qemu-config.c | 1 +
26 files changed, 56 insertions(+), 17 deletions(-)
create mode 100644 include/block/qdict.h
diff --git a/block.c b/block.c
index 676e57f..3c3e8fd 100644
--- a/block.c
+++ b/block.c
@@ -27,6 +27,7 @@
#include "block/block_int.h"
#include "block/blockjob.h"
#include "block/nbd.h"
+#include "block/qdict.h"
#include "qemu/error-report.h"
#include "module_block.h"
#include "qemu/module.h"
diff --git a/block/gluster.c b/block/gluster.c
index 55be566..418bb73 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include <glusterfs/api/glfs.h>
#include "block/block_int.h"
+#include "block/qdict.h"
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
diff --git a/block/iscsi.c b/block/iscsi.c
index 658462b..1705187 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -33,6 +33,7 @@
#include "qemu/bitops.h"
#include "qemu/bitmap.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "scsi/constants.h"
#include "qemu/iov.h"
#include "qemu/option.h"
diff --git a/block/nbd.c b/block/nbd.c
index 3e1693c..f499830 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -28,6 +28,7 @@
#include "qemu/osdep.h"
#include "block/nbd-client.h"
+#include "block/qdict.h"
#include "qapi/error.h"
#include "qemu/uri.h"
#include "block/block_int.h"
diff --git a/block/nfs.c b/block/nfs.c
index 66fddf1..5159ef0 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -29,6 +29,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "trace.h"
#include "qemu/iov.h"
#include "qemu/option.h"
diff --git a/block/parallels.c b/block/parallels.c
index 045810d..0ee1f6a 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -31,6 +31,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include "qemu/option.h"
diff --git a/block/qcow.c b/block/qcow.c
index 4b2f7db..fb821ad 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include "qemu/option.h"
diff --git a/block/qcow2.c b/block/qcow2.c
index 2f36e63..fa9f557 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include <zlib.h>
diff --git a/block/qed.c b/block/qed.c
index 1db8eaf..9a8997a 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -13,6 +13,7 @@
*/
#include "qemu/osdep.h"
+#include "block/qdict.h"
#include "qapi/error.h"
#include "qemu/timer.h"
#include "qemu/bswap.h"
diff --git a/block/quorum.c b/block/quorum.c
index a5051da..f1f39ba 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -17,6 +17,7 @@
#include "qemu/cutils.h"
#include "qemu/option.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "qapi/error.h"
#include "qapi/qapi-events-block.h"
#include "qapi/qmp/qdict.h"
diff --git a/block/rbd.c b/block/rbd.c
index 2842c0e..e695cf2 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -18,6 +18,7 @@
#include "qemu/error-report.h"
#include "qemu/option.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "crypto/secret.h"
#include "qemu/cutils.h"
#include "qapi/qmp/qstring.h"
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 07529f4..fd3876f 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -24,6 +24,7 @@
#include "qemu/option.h"
#include "qemu/sockets.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#include "qemu/bitops.h"
#include "qemu/cutils.h"
diff --git a/block/snapshot.c b/block/snapshot.c
index 2953d96..f9903bc 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "block/snapshot.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
diff --git a/block/ssh.c b/block/ssh.c
index 412a1bf..5931064 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -28,6 +28,7 @@
#include <libssh2_sftp.h>
#include "block/block_int.h"
+#include "block/qdict.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/option.h"
diff --git a/block/vhdx.c b/block/vhdx.c
index c3a4220..26c05aa 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -18,6 +18,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include "qemu/option.h"
diff --git a/block/vpc.c b/block/vpc.c
index 0ebfcd3..41c8c98 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include "qemu/option.h"
diff --git a/block/vvfat.c b/block/vvfat.c
index 662dca0..4595f33 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -27,6 +27,7 @@
#include <dirent.h>
#include "qapi/error.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "qemu/module.h"
#include "qemu/option.h"
#include "qemu/bswap.h"
diff --git a/block/vxhs.c b/block/vxhs.c
index 96e83d9..25fea7f 100644
--- a/block/vxhs.c
+++ b/block/vxhs.c
@@ -13,6 +13,7 @@
#include <gmodule.h>
#include <sys/param.h>
#include "block/block_int.h"
+#include "block/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"
diff --git a/blockdev.c b/blockdev.c
index 3808b1f..19c04d9 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -35,6 +35,7 @@
#include "sysemu/blockdev.h"
#include "hw/block/block.h"
#include "block/blockjob.h"
+#include "block/qdict.h"
#include "block/throttle-groups.h"
#include "monitor/monitor.h"
#include "qemu/error-report.h"
diff --git a/include/block/qdict.h b/include/block/qdict.h
new file mode 100644
index 0000000..71c037a
--- /dev/null
+++ b/include/block/qdict.h
@@ -0,0 +1,32 @@
+/*
+ * Special QDict functions used by the block layer
+ *
+ * Copyright (c) 2013-2018 Red Hat, Inc.
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ */
+
+#ifndef BLOCK_QDICT_H
+#define BLOCK_QDICT_H
+
+#include "qapi/qmp/qdict.h"
+
+void qdict_copy_default(QDict *dst, QDict *src, const char *key);
+void qdict_set_default_str(QDict *dst, const char *key, const char *val);
+
+void qdict_join(QDict *dest, QDict *src, bool overwrite);
+
+void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
+void qdict_array_split(QDict *src, QList **dst);
+int qdict_array_entries(QDict *src, const char *subqdict);
+QObject *qdict_crumple(const QDict *src, Error **errp);
+void qdict_flatten(QDict *qdict);
+
+typedef struct QDictRenames {
+ const char *from;
+ const char *to;
+} QDictRenames;
+bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp);
+
+#endif
diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h
index 921a28d..7f3ec10 100644
--- a/include/qapi/qmp/qdict.h
+++ b/include/qapi/qmp/qdict.h
@@ -67,23 +67,6 @@ int64_t qdict_get_try_int(const QDict *qdict, const char *key,
bool qdict_get_try_bool(const QDict *qdict, const char *key, bool def_value);
const char *qdict_get_try_str(const QDict *qdict, const char *key);
-void qdict_copy_default(QDict *dst, QDict *src, const char *key);
-void qdict_set_default_str(QDict *dst, const char *key, const char *val);
-
QDict *qdict_clone_shallow(const QDict *src);
-void qdict_flatten(QDict *qdict);
-
-void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
-void qdict_array_split(QDict *src, QList **dst);
-int qdict_array_entries(QDict *src, const char *subqdict);
-QObject *qdict_crumple(const QDict *src, Error **errp);
-
-void qdict_join(QDict *dest, QDict *src, bool overwrite);
-
-typedef struct QDictRenames {
- const char *from;
- const char *to;
-} QDictRenames;
-bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp);
#endif /* QDICT_H */
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 22800ee..0554c64 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "block/qdict.h"
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qbool.h"
diff --git a/tests/check-qdict.c b/tests/check-qdict.c
index eba5d35..93e2112 100644
--- a/tests/check-qdict.c
+++ b/tests/check-qdict.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "block/qdict.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qlist.h"
#include "qapi/qmp/qnum.h"
diff --git a/tests/check-qobject.c b/tests/check-qobject.c
index 5cb08fc..16ccbde 100644
--- a/tests/check-qobject.c
+++ b/tests/check-qobject.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "block/qdict.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qlist.h"
diff --git a/tests/test-replication.c b/tests/test-replication.c
index 68c0d04..c8165ae 100644
--- a/tests/test-replication.c
+++ b/tests/test-replication.c
@@ -15,6 +15,7 @@
#include "qemu/option.h"
#include "replication.h"
#include "block/block_int.h"
+#include "block/qdict.h"
#include "sysemu/block-backend.h"
#define IMG_SIZE (64 * 1024 * 1024)
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 14d8402..9d2e278 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -1,4 +1,5 @@
#include "qemu/osdep.h"
+#include "block/qdict.h" /* for qdict_extract_subqdict() */
#include "qapi/error.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qmp/qdict.h"
--
1.8.3.1

View File

@ -0,0 +1,96 @@
From 59f0fc4b8011298bc542eb23cca385d83d1963cd Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Wed, 10 Oct 2018 20:22:02 +0100
Subject: [PATCH 36/49] block: Add missing locking in bdrv_co_drain_bh_cb()
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20181010202213.7372-24-kwolf@redhat.com>
Patchwork-id: 82613
O-Subject: [RHEL-8 qemu-kvm PATCH 33/44] block: Add missing locking in bdrv_co_drain_bh_cb()
Bugzilla: 1637976
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
bdrv_do_drained_begin/end() assume that they are called with the
AioContext lock of bs held. If we call drain functions from a coroutine
with the AioContext lock held, we yield and schedule a BH to move out of
coroutine context. This means that the lock for the home context of the
coroutine is released and must be re-acquired in the bottom half.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit aa1361d54aac43094b98024b8b6c804eb6e41661)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block/io.c | 15 +++++++++++++++
include/qemu/coroutine.h | 5 +++++
util/qemu-coroutine.c | 5 +++++
3 files changed, 25 insertions(+)
diff --git a/block/io.c b/block/io.c
index d404088..19db35e 100644
--- a/block/io.c
+++ b/block/io.c
@@ -286,6 +286,18 @@ static void bdrv_co_drain_bh_cb(void *opaque)
BlockDriverState *bs = data->bs;
if (bs) {
+ AioContext *ctx = bdrv_get_aio_context(bs);
+ AioContext *co_ctx = qemu_coroutine_get_aio_context(co);
+
+ /*
+ * When the coroutine yielded, the lock for its home context was
+ * released, so we need to re-acquire it here. If it explicitly
+ * acquired a different context, the lock is still held and we don't
+ * want to lock it a second time (or AIO_WAIT_WHILE() would hang).
+ */
+ if (ctx == co_ctx) {
+ aio_context_acquire(ctx);
+ }
bdrv_dec_in_flight(bs);
if (data->begin) {
bdrv_do_drained_begin(bs, data->recursive, data->parent,
@@ -294,6 +306,9 @@ static void bdrv_co_drain_bh_cb(void *opaque)
bdrv_do_drained_end(bs, data->recursive, data->parent,
data->ignore_bds_parents);
}
+ if (ctx == co_ctx) {
+ aio_context_release(ctx);
+ }
} else {
assert(data->begin);
bdrv_drain_all_begin();
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
index 6f8a487..9801e7f 100644
--- a/include/qemu/coroutine.h
+++ b/include/qemu/coroutine.h
@@ -90,6 +90,11 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co);
void coroutine_fn qemu_coroutine_yield(void);
/**
+ * Get the AioContext of the given coroutine
+ */
+AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co);
+
+/**
* Get the currently executing coroutine
*/
Coroutine *coroutine_fn qemu_coroutine_self(void);
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
index 1ba4191..2295928 100644
--- a/util/qemu-coroutine.c
+++ b/util/qemu-coroutine.c
@@ -198,3 +198,8 @@ bool qemu_coroutine_entered(Coroutine *co)
{
return co->caller;
}
+
+AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co)
+{
+ return co->ctx;
+}
--
1.8.3.1

Some files were not shown because too many files have changed in this diff Show More