diff --git a/.gitignore b/.gitignore index 53738b3..2673557 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/qemu-2.3.0.tar.bz2 +SOURCES/qemu-2.5.0.tar.bz2 diff --git a/.qemu-guest-agent.metadata b/.qemu-guest-agent.metadata index bfce55b..d3fed97 100644 --- a/.qemu-guest-agent.metadata +++ b/.qemu-guest-agent.metadata @@ -1 +1 @@ -373d74bfafce1ca45f85195190d0a5e22b29299e SOURCES/qemu-2.3.0.tar.bz2 +ed6c02a267f9edf98058743f0f76a25743a0dfe7 SOURCES/qemu-2.5.0.tar.bz2 diff --git a/SOURCES/0001-Initial-redhat-build.patch b/SOURCES/0001-Initial-redhat-build.patch new file mode 100644 index 0000000..91c07a4 --- /dev/null +++ b/SOURCES/0001-Initial-redhat-build.patch @@ -0,0 +1,98 @@ +From 327852f029b9d70613cdce223f57bdc1e97210ac Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina <mrezanin@redhat.com> +Date: Thu, 5 Nov 2015 10:38:15 +0100 +Subject: Initial redhat build + +Switch to new unified build structure. + +Rebase to 2.5: +- New seccomp hadling in configure +- libcacard extracted +- vnc fixes +- libsecomp for aarch64 requirements changed downstream +- guest-agent separated from qemu-kvm + +Rebase to 2.4: + - 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 + +Included commits (rebase 2.4) + - 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 +--- + .gitpublish | 8 + + configure | 4 +- + redhat/.gitignore | 1 + + redhat/99-qemu-guest-agent.rules | 2 + + redhat/Makefile | 72 ++++++ + redhat/Makefile.common | 35 +++ + redhat/build_configure.sh | 116 ++++++++++ + redhat/qemu-ga.sysconfig | 19 ++ + redhat/qemu-guest-agent.service | 21 ++ + redhat/qemu-guest-agent.spec.template | 408 ++++++++++++++++++++++++++++++++++ + 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 | 27 +++ + redhat/scripts/git-backport-diff | 302 +++++++++++++++++++++++++ + redhat/scripts/git-compile-check | 215 ++++++++++++++++++ + redhat/scripts/process-patches.sh | 70 ++++++ + redhat/scripts/tarball_checksum.sh | 3 + + 20 files changed, 1311 insertions(+), 2 deletions(-) + create mode 100644 .gitpublish + create mode 100644 redhat/.gitignore + create mode 100644 redhat/99-qemu-guest-agent.rules + create mode 100644 redhat/Makefile + create mode 100644 redhat/Makefile.common + create mode 100755 redhat/build_configure.sh + create mode 100644 redhat/qemu-ga.sysconfig + create mode 100644 redhat/qemu-guest-agent.service + create mode 100644 redhat/qemu-guest-agent.spec.template + 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 + +diff --git a/configure b/configure +index b9552fd..38e233e 100755 +--- a/configure ++++ b/configure +@@ -1904,10 +1904,10 @@ fi + + if test "$seccomp" != "no" ; then + case "$cpu" in +- i386|x86_64) ++ i386|x86_64|aarch64) + libseccomp_minver="2.1.0" + ;; +- arm|aarch64) ++ arm) + libseccomp_minver="2.2.3" + ;; + *) diff --git a/SOURCES/build_configure.sh b/SOURCES/build_configure.sh index 99881fa..0fd2a66 100755 --- a/SOURCES/build_configure.sh +++ b/SOURCES/build_configure.sh @@ -77,14 +77,12 @@ fi --enable-libusb \ --disable-bzip2 \ --enable-linux-aio \ - --disable-live-block-migration \ --enable-lzo \ - --enable-opengl \ + --disable-opengl \ --enable-pie \ --disable-qom-cast-debug \ - --enable-quorum \ --disable-sdl \ - --enable-smartcard-nss \ + --enable-smartcard \ --enable-snappy \ --disable-sparse \ --disable-strip \ @@ -96,11 +94,9 @@ fi --disable-vhost-scsi \ --disable-virtfs \ --disable-vnc-jpeg \ + --disable-vte \ --enable-vnc-png \ --enable-vnc-sasl \ - --enable-vnc-tls \ - --enable-vnc-ws \ - --disable-vte \ --enable-werror \ --disable-xen \ --disable-xfsctl \ diff --git a/SOURCES/kvm-AArch64-Enable-ACPI.patch b/SOURCES/kvm-AArch64-Enable-ACPI.patch deleted file mode 100644 index c33becf..0000000 --- a/SOURCES/kvm-AArch64-Enable-ACPI.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c05ee89fce30fac6d24e5ece623cab92a4d0d900 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:45 +0200 -Subject: [PATCH 082/217] AArch64: Enable ACPI - -Message-id: <1434455325-23399-34-git-send-email-drjones@redhat.com> -Patchwork-id: 66266 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 33/33] AArch64: Enable ACPI -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -RHELSA Only. Add ACPI to the RHELSA config. - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@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 eeccc6d..fc73c84 100644 ---- a/default-configs/aarch64-softmmu.mak -+++ b/default-configs/aarch64-softmmu.mak -@@ -9,3 +9,4 @@ CONFIG_PL011=y - CONFIG_PL031=y - CONFIG_PFLASH_CFI01=y - CONFIG_PCI_GENERIC=y -+CONFIG_ACPI=y --- -1.8.3.1 - diff --git a/SOURCES/kvm-ACPI-Add-definitions-for-the-SPCR-table.patch b/SOURCES/kvm-ACPI-Add-definitions-for-the-SPCR-table.patch deleted file mode 100644 index af99888..0000000 --- a/SOURCES/kvm-ACPI-Add-definitions-for-the-SPCR-table.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 1a4256f1b60a9f861f2cd36833f840fb999b9a83 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:43 +0200 -Subject: [PATCH 080/217] ACPI: Add definitions for the SPCR table - -Message-id: <1434455325-23399-32-git-send-email-drjones@redhat.com> -Patchwork-id: 66262 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 31/33] ACPI: Add definitions for the SPCR table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -SPCR is the Serial Port Console Redirection Table. See the document -linked from http://uefi.org/acpi. For serial port types, "Interface -Type", see the documentation for the Debug Port Table 2 (DBG2). - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Tested-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Acked-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1433929959-29530-2-git-send-email-drjones@redhat.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit b8a0d75ef85b8f24c92a6c50817fa9579b4a98d9) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/acpi/acpi-defs.h | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h -index f503ec4..f2a200c 100644 ---- a/include/hw/acpi/acpi-defs.h -+++ b/include/hw/acpi/acpi-defs.h -@@ -197,6 +197,38 @@ enum { - }; - - /* -+ * Serial Port Console Redirection Table (SPCR), Rev. 1.02 -+ * -+ * For .interface_type see Debug Port Table 2 (DBG2) serial port -+ * subtypes in Table 3, Rev. May 22, 2012 -+ */ -+struct AcpiSerialPortConsoleRedirection { -+ ACPI_TABLE_HEADER_DEF -+ uint8_t interface_type; -+ uint8_t reserved1[3]; -+ struct AcpiGenericAddress base_address; -+ uint8_t interrupt_types; -+ uint8_t irq; -+ uint32_t gsi; -+ uint8_t baud; -+ uint8_t parity; -+ uint8_t stopbits; -+ uint8_t flowctrl; -+ uint8_t term_type; -+ uint8_t reserved2; -+ uint16_t pci_device_id; -+ uint16_t pci_vendor_id; -+ uint8_t pci_bus; -+ uint8_t pci_slot; -+ uint8_t pci_func; -+ uint32_t pci_flags; -+ uint8_t pci_seg; -+ uint32_t reserved3; -+} QEMU_PACKED; -+typedef struct AcpiSerialPortConsoleRedirection -+ AcpiSerialPortConsoleRedirection; -+ -+/* - * ACPI 1.0 Root System Description Table (RSDT) - */ - struct AcpiRsdtDescriptorRev1 --- -1.8.3.1 - diff --git a/SOURCES/kvm-ACPI-split-CONFIG_ACPI-into-4-pieces.patch b/SOURCES/kvm-ACPI-split-CONFIG_ACPI-into-4-pieces.patch deleted file mode 100644 index 7d0c5d9..0000000 --- a/SOURCES/kvm-ACPI-split-CONFIG_ACPI-into-4-pieces.patch +++ /dev/null @@ -1,165 +0,0 @@ -From b89c862fa8365ec6f2fa82e3f714acee17dd5589 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:40 +0200 -Subject: [PATCH 078/217] ACPI: split CONFIG_ACPI into 4 pieces -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-29-git-send-email-drjones@redhat.com> -Patchwork-id: 66260 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 28/33] ACPI: split CONFIG_ACPI into 4 pieces -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -As core.c, piix4.c, ich9.c and pcihp.c are for x86, add CONFIG_ACPI_X86 -to make it only for x86. ARM doesn't support cpu and memory hotplug, add -CONFIG_ACPI_CPU_HOTPLUG and CONFIG_ACPI_MEMORY_HOTPLUG to exclude them -for target-arm. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-24-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 135a67a692bedb952ea720351026247104da8645) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - default-configs/arm-softmmu.mak | 1 + - default-configs/i386-softmmu.mak | 3 +++ - default-configs/mips-softmmu.mak | 3 +++ - default-configs/mips64-softmmu.mak | 3 +++ - default-configs/mips64el-softmmu.mak | 3 +++ - default-configs/mipsel-softmmu.mak | 3 +++ - default-configs/x86_64-softmmu.mak | 3 +++ - hw/acpi/Makefile.objs | 5 +++-- - hw/i2c/Makefile.objs | 2 +- - 9 files changed, 23 insertions(+), 3 deletions(-) - -diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak -index 0399634..deb788d 100644 ---- a/default-configs/arm-softmmu.mak -+++ b/default-configs/arm-softmmu.mak -@@ -96,3 +96,4 @@ CONFIG_ALLWINNER_A10=y - CONFIG_XIO3130=y - CONFIG_IOH3420=y - CONFIG_I82801B11=y -+CONFIG_ACPI=y -diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak -index 074d0fd..c2b82de 100644 ---- a/default-configs/i386-softmmu.mak -+++ b/default-configs/i386-softmmu.mak -@@ -15,6 +15,9 @@ CONFIG_PCSPK=y - CONFIG_PCKBD=y - CONFIG_FDC=y - CONFIG_ACPI=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_CPU_HOTPLUG=y - CONFIG_APM=y - CONFIG_I8257=y - CONFIG_IDE_ISA=y -diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak -index 46e2a0d..645908e 100644 ---- a/default-configs/mips-softmmu.mak -+++ b/default-configs/mips-softmmu.mak -@@ -15,6 +15,9 @@ CONFIG_PCSPK=y - CONFIG_PCKBD=y - CONFIG_FDC=y - CONFIG_ACPI=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_CPU_HOTPLUG=y - CONFIG_APM=y - CONFIG_I8257=y - CONFIG_PIIX4=y -diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak -index 8e05cd2..2ce9fb3 100644 ---- a/default-configs/mips64-softmmu.mak -+++ b/default-configs/mips64-softmmu.mak -@@ -15,6 +15,9 @@ CONFIG_PCSPK=y - CONFIG_PCKBD=y - CONFIG_FDC=y - CONFIG_ACPI=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_CPU_HOTPLUG=y - CONFIG_APM=y - CONFIG_I8257=y - CONFIG_PIIX4=y -diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak -index cb0afb9..0e978e7 100644 ---- a/default-configs/mips64el-softmmu.mak -+++ b/default-configs/mips64el-softmmu.mak -@@ -15,6 +15,9 @@ CONFIG_PCSPK=y - CONFIG_PCKBD=y - CONFIG_FDC=y - CONFIG_ACPI=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_CPU_HOTPLUG=y - CONFIG_APM=y - CONFIG_I8257=y - CONFIG_PIIX4=y -diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak -index d217d5a..17cce79 100644 ---- a/default-configs/mipsel-softmmu.mak -+++ b/default-configs/mipsel-softmmu.mak -@@ -15,6 +15,9 @@ CONFIG_PCSPK=y - CONFIG_PCKBD=y - CONFIG_FDC=y - CONFIG_ACPI=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_CPU_HOTPLUG=y - CONFIG_APM=y - CONFIG_I8257=y - CONFIG_PIIX4=y -diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak -index 4076f89..f218e06 100644 ---- a/default-configs/x86_64-softmmu.mak -+++ b/default-configs/x86_64-softmmu.mak -@@ -13,6 +13,9 @@ CONFIG_PCSPK=y - CONFIG_PCKBD=y - CONFIG_FDC=y - CONFIG_ACPI=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_CPU_HOTPLUG=y - CONFIG_APM=y - CONFIG_I8257=y - CONFIG_IDE_PIIX=y -diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs -index b9fefa7..29d46d8 100644 ---- a/hw/acpi/Makefile.objs -+++ b/hw/acpi/Makefile.objs -@@ -1,5 +1,6 @@ --common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o --common-obj-$(CONFIG_ACPI) += memory_hotplug.o -+common-obj-$(CONFIG_ACPI_X86) += core.o piix4.o ich9.o pcihp.o -+common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o -+common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o - common-obj-$(CONFIG_ACPI) += acpi_interface.o - common-obj-$(CONFIG_ACPI) += bios-linker-loader.o - common-obj-$(CONFIG_ACPI) += aml-build.o -diff --git a/hw/i2c/Makefile.objs b/hw/i2c/Makefile.objs -index 648278e..0f13060 100644 ---- a/hw/i2c/Makefile.objs -+++ b/hw/i2c/Makefile.objs -@@ -1,6 +1,6 @@ - common-obj-y += core.o smbus.o smbus_eeprom.o - common-obj-$(CONFIG_VERSATILE_I2C) += versatile_i2c.o --common-obj-$(CONFIG_ACPI) += smbus_ich9.o -+common-obj-$(CONFIG_ACPI_X86) += smbus_ich9.o - common-obj-$(CONFIG_APM) += pm_smbus.o - common-obj-$(CONFIG_BITBANG_I2C) += bitbang_i2c.o - common-obj-$(CONFIG_EXYNOS4) += exynos4210_i2c.o --- -1.8.3.1 - diff --git a/SOURCES/kvm-Add-MAINTAINERS-entry-for-virtio-input.patch b/SOURCES/kvm-Add-MAINTAINERS-entry-for-virtio-input.patch deleted file mode 100644 index 0ee418c..0000000 --- a/SOURCES/kvm-Add-MAINTAINERS-entry-for-virtio-input.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f973bd7922365c14d37bb411104ce6cae1f570d5 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:09 +0200 -Subject: [PATCH 181/217] Add MAINTAINERS entry for virtio-input - -Message-id: <1436260751-25015-67-git-send-email-jasowang@redhat.com> -Patchwork-id: 66841 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 66/68] Add MAINTAINERS entry for virtio-input -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit a5d4d7b580f42c47d240a2068c810e4147147f6e) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - MAINTAINERS | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/MAINTAINERS b/MAINTAINERS -index d7e9ba2..a8ec9be 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -715,6 +715,12 @@ S: Supported - F: hw/s390x/virtio-ccw.[hc] - T: git git://github.com/cohuck/qemu virtio-ccw-upstr - -+virtio-input -+M: Gerd Hoffmann <kraxel@redhat.com> -+S: Maintained -+F: hw/input/virtio-input*.c -+F: include/hw/virtio/virtio-input.h -+ - virtio-serial - M: Amit Shah <amit.shah@redhat.com> - S: Supported --- -1.8.3.1 - diff --git a/SOURCES/kvm-Add-MemTxAttrs-to-the-IOTLB.patch b/SOURCES/kvm-Add-MemTxAttrs-to-the-IOTLB.patch deleted file mode 100644 index 63f5962..0000000 --- a/SOURCES/kvm-Add-MemTxAttrs-to-the-IOTLB.patch +++ /dev/null @@ -1,138 +0,0 @@ -From eef48dbd8ff1db034868f2a43ddb580efb8885b7 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:13 +0200 -Subject: [PATCH 125/217] Add MemTxAttrs to the IOTLB -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-11-git-send-email-jasowang@redhat.com> -Patchwork-id: 66785 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 10/68] Add MemTxAttrs to the IOTLB -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Add a MemTxAttrs field to the IOTLB, and allow target-specific -code to set it via a new tlb_set_page_with_attrs() function; -pass the attributes through to the device when making IO accesses. - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit fadc1cbe85c6b032d5842ec0d19d209f50fcb375) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - cputlb.c | 18 +++++++++++++++--- - include/exec/cpu-defs.h | 2 ++ - include/exec/exec-all.h | 3 +++ - softmmu_template.h | 4 ++-- - 4 files changed, 22 insertions(+), 5 deletions(-) - -diff --git a/cputlb.c b/cputlb.c -index 5e1cb8f..7606548 100644 ---- a/cputlb.c -+++ b/cputlb.c -@@ -249,9 +249,9 @@ static void tlb_add_large_page(CPUArchState *env, target_ulong vaddr, - * Called from TCG-generated code, which is under an RCU read-side - * critical section. - */ --void tlb_set_page(CPUState *cpu, target_ulong vaddr, -- hwaddr paddr, int prot, -- int mmu_idx, target_ulong size) -+void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, -+ hwaddr paddr, MemTxAttrs attrs, int prot, -+ int mmu_idx, target_ulong size) - { - CPUArchState *env = cpu->env_ptr; - MemoryRegionSection *section; -@@ -302,6 +302,7 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr, - - /* refill the tlb */ - env->iotlb[mmu_idx][index].addr = iotlb - vaddr; -+ env->iotlb[mmu_idx][index].attrs = attrs; - te->addend = addend - vaddr; - if (prot & PAGE_READ) { - te->addr_read = address; -@@ -331,6 +332,17 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr, - } - } - -+/* Add a new TLB entry, but without specifying the memory -+ * transaction attributes to be used. -+ */ -+void tlb_set_page(CPUState *cpu, target_ulong vaddr, -+ hwaddr paddr, int prot, -+ int mmu_idx, target_ulong size) -+{ -+ tlb_set_page_with_attrs(cpu, vaddr, paddr, MEMTXATTRS_UNSPECIFIED, -+ prot, mmu_idx, size); -+} -+ - /* NOTE: this function can trigger an exception */ - /* NOTE2: the returned address is not exactly the physical address: it - * is actually a ram_addr_t (in system mode; the user mode emulation -diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h -index 7f88185..3f56546 100644 ---- a/include/exec/cpu-defs.h -+++ b/include/exec/cpu-defs.h -@@ -30,6 +30,7 @@ - #ifndef CONFIG_USER_ONLY - #include "exec/hwaddr.h" - #endif -+#include "exec/memattrs.h" - - #ifndef TARGET_LONG_BITS - #error TARGET_LONG_BITS must be defined before including this header -@@ -109,6 +110,7 @@ QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS)); - */ - typedef struct CPUIOTLBEntry { - hwaddr addr; -+ MemTxAttrs attrs; - } CPUIOTLBEntry; - - #define CPU_COMMON_TLB \ -diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h -index ff1bc3e..b58cd47 100644 ---- a/include/exec/exec-all.h -+++ b/include/exec/exec-all.h -@@ -105,6 +105,9 @@ void tlb_flush(CPUState *cpu, int flush_global); - void tlb_set_page(CPUState *cpu, target_ulong vaddr, - hwaddr paddr, int prot, - int mmu_idx, target_ulong size); -+void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, -+ hwaddr paddr, MemTxAttrs attrs, -+ int prot, int mmu_idx, target_ulong size); - void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr); - #else - static inline void tlb_flush_page(CPUState *cpu, target_ulong addr) -diff --git a/softmmu_template.h b/softmmu_template.h -index 0e30986..16b0852 100644 ---- a/softmmu_template.h -+++ b/softmmu_template.h -@@ -160,7 +160,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, - - cpu->mem_io_vaddr = addr; - memory_region_dispatch_read(mr, physaddr, &val, 1 << SHIFT, -- MEMTXATTRS_UNSPECIFIED); -+ iotlbentry->attrs); - return val; - } - #endif -@@ -382,7 +382,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env, - cpu->mem_io_vaddr = addr; - cpu->mem_io_pc = retaddr; - memory_region_dispatch_write(mr, physaddr, val, 1 << SHIFT, -- MEMTXATTRS_UNSPECIFIED); -+ iotlbentry->attrs); - } - - void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val, --- -1.8.3.1 - diff --git a/SOURCES/kvm-Add-flag-for-pre-2.2-migration-compatibility.patch b/SOURCES/kvm-Add-flag-for-pre-2.2-migration-compatibility.patch deleted file mode 100644 index 74d2ec5..0000000 --- a/SOURCES/kvm-Add-flag-for-pre-2.2-migration-compatibility.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 5831f3983480dddaf5a1603bffccb52a749df5b8 Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Wed, 24 Jun 2015 13:39:55 +0200 -Subject: [PATCH 040/217] Add flag for pre-2.2 migration compatibility - -Message-id: <1435153196-26350-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66379 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH v3 1/2] Add flag for pre-2.2 migration compatibility -Bugzilla: 1215087 -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -There are a series of subsections added in some of the older -devices (serial, kbd, rtc etc) in qemu 2.2, and to be sure that -backwards migration doesn't error we need to make sure we don't -generate those. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/pc_piix.c | 4 ++++ - include/migration/migration.h | 6 ++++++ - migration/migration.c | 2 ++ - 3 files changed, 12 insertions(+) - -diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c -index 49a8a12..e24f20a 100644 ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -49,6 +49,7 @@ - #include "hw/acpi/acpi.h" - #include "cpu.h" - #include "qemu/error-report.h" -+#include "migration/migration.h" - #ifdef CONFIG_XEN - # include <xen/hvm/hvm_info_table.h> - #endif -@@ -1074,6 +1075,9 @@ static void pc_compat_rhel710(MachineState *machine) - x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0); - x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM); - pcms->enforce_aligned_dimm = false; -+ -+ /* Disable all the extra subsections that were added in 2.2 */ -+ migrate_pre_2_2 = true; - } - - static void pc_init_rhel710(MachineState *machine) -diff --git a/include/migration/migration.h b/include/migration/migration.h -index bf09968..7e66aed 100644 ---- a/include/migration/migration.h -+++ b/include/migration/migration.h -@@ -170,4 +170,10 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent); - -+ -+/* -+ * Disables a load of subsections that were added in 2.2/rh7.2 for backwards -+ * migration compatibility. -+ */ -+extern bool migrate_pre_2_2; - #endif -diff --git a/migration/migration.c b/migration/migration.c -index b97ce67..8216044 100644 ---- a/migration/migration.c -+++ b/migration/migration.c -@@ -41,6 +41,8 @@ static NotifierList migration_state_notifiers = - - static bool deferred_incoming; - -+bool migrate_pre_2_2; -+ - /* When we add fault tolerance, we could have several - migrations at once. For now we don't need to add - dynamic creation of migration */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-Downstream-only-Add-rhel7.2.0-machine-type.patch b/SOURCES/kvm-Downstream-only-Add-rhel7.2.0-machine-type.patch deleted file mode 100644 index f1b530c..0000000 --- a/SOURCES/kvm-Downstream-only-Add-rhel7.2.0-machine-type.patch +++ /dev/null @@ -1,72 +0,0 @@ -From a465463f907c8344c855b0a2084e36b20f234048 Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Tue, 9 Jun 2015 08:35:41 +0200 -Subject: [PATCH 008/217] Downstream-only: Add rhel7.2.0 machine type - -Message-id: <1433838941-28412-1-git-send-email-lvivier@redhat.com> -Patchwork-id: 65562 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH v3] Downstream-only: Add rhel7.2.0 machine type -Bugzilla: 1228574 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -Replace RHEL 7.1 machine type by RHEL 7.2 machine type. -pseries-rhel7.2.0 is now the default machine type for PPC64. - -/usr/libexec/qemu-kvm -M ? -Supported machines are: -none empty machine -pseries RHEL 7.2.0 pSeries Logical Partition (PAPR compliant) (alias of pseries-rhel7.2.0) -pseries-rhel7.2.0 RHEL 7.2.0 pSeries Logical Partition (PAPR compliant) (default) - -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index d1f7725..3fe98ff 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -1881,21 +1881,20 @@ static const TypeInfo spapr_machine_2_3_info = { - .class_init = spapr_machine_2_3_class_init, - }; - #endif --static void spapr_machine_rhel710_class_init(ObjectClass *oc, void *data) -+static void spapr_machine_rhel720_class_init(ObjectClass *oc, void *data) - { - MachineClass *mc = MACHINE_CLASS(oc); - -- mc->name = "pseries-rhel7.1.0"; -- mc->desc = "RHEL 7.1.0 pSeries Logical Partition (PAPR compliant)"; -+ mc->name = "pseries-rhel7.2.0"; -+ mc->desc = "RHEL 7.2.0 pSeries Logical Partition (PAPR compliant)"; - mc->alias = "pseries"; - mc->is_default = 1; - } - -- --static const TypeInfo spapr_machine_rhel710_info = { -- .name = TYPE_SPAPR_MACHINE "RHEL7.1.0", -+static const TypeInfo spapr_machine_rhel720_info = { -+ .name = TYPE_SPAPR_MACHINE "RHEL7.2.0", - .parent = TYPE_SPAPR_MACHINE, -- .class_init = spapr_machine_rhel710_class_init, -+ .class_init = spapr_machine_rhel720_class_init, - }; - - static void spapr_machine_register_types(void) -@@ -1906,7 +1905,7 @@ static void spapr_machine_register_types(void) - type_register_static(&spapr_machine_2_2_info); - type_register_static(&spapr_machine_2_3_info); - */ -- type_register_static(&spapr_machine_rhel710_info); -+ type_register_static(&spapr_machine_rhel720_info); - } - - type_init(spapr_machine_register_types) --- -1.8.3.1 - diff --git a/SOURCES/kvm-Fix-ich9-intel-hda-compatibility.patch b/SOURCES/kvm-Fix-ich9-intel-hda-compatibility.patch deleted file mode 100644 index 876b024..0000000 --- a/SOURCES/kvm-Fix-ich9-intel-hda-compatibility.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 13a8c029cf9adc800a88e8bc2396a497f8f4c13c Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Thu, 2 Jul 2015 12:08:02 +0200 -Subject: [PATCH 104/217] Fix ich9-intel-hda compatibility - -Message-id: <1435838882-10566-3-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66604 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 2/2] Fix ich9-intel-hda compatibility -Bugzilla: 1209793 -RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com> -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -The MSI address for intel-hda got moved (somewhere around 2.2 ?) -by d209c7440a642ba08bbb0f13e22390460d3661ed which added - a compat entry for 'intel-hda' to keep the MSI address the same. -Unfortunately that only moved 'intel-hda' and not 'ich9-intel-hda'. -This changes the compat entry to 'intel-hda-generic' to catch -both cases. - -This is unfixable upstream, since that would break migrations between -2.2->2.4 while fixing pre-2.2->2.4. Fortunately we never shipped 2.2. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/compat.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/hw/compat.h b/include/hw/compat.h -index 88076f5..ec5d0e6 100644 ---- a/include/hw/compat.h -+++ b/include/hw/compat.h -@@ -37,7 +37,7 @@ - */ - #define HW_COMPAT_RHEL7_1 \ - {\ -- .driver = "intel-hda",\ -+ .driver = "intel-hda-generic",\ - .property = "old_msi_addr",\ - .value = "on",\ - },{\ --- -1.8.3.1 - diff --git a/SOURCES/kvm-HMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch b/SOURCES/kvm-HMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch deleted file mode 100644 index e28383a..0000000 --- a/SOURCES/kvm-HMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 3454f69322f50d9301c7693ece2927bda2002ca4 Mon Sep 17 00:00:00 2001 -From: Markus Armbruster <armbru@redhat.com> -Date: Tue, 17 Dec 2013 06:46:37 +0100 -Subject: HMP: Forward-port __com.redhat_drive_add from RHEL-6 - -RH-Author: Markus Armbruster <armbru@redhat.com> -Message-id: <1387262799-10350-5-git-send-email-armbru@redhat.com> -Patchwork-id: 56295 -O-Subject: [PATCH v2 4/6] HMP: Forward-port __com.redhat_drive_add from RHEL-6 -Bugzilla: 889051 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> - -From: Markus Armbruster <armbru@redhat.com> - -Signed-off-by: Markus Armbruster <armbru@redhat.com> - -diff --git a/blockdev.c b/blockdev.c -index fbb3a79..8347e30 100644 ---- a/blockdev.c -+++ b/blockdev.c -@@ -3040,3 +3040,17 @@ QemuOptsList qemu_drive_opts = { - { /* end of list */ } - }, - }; -+ -+QemuOptsList qemu_simple_drive_opts = { -+ .name = "simple-drive", -+ .implied_opt_name = "format", -+ .head = QTAILQ_HEAD_INITIALIZER(qemu_simple_drive_opts.head), -+ .desc = { -+ /* -+ * no elements => accept any -+ * sanity checking will happen later -+ * when setting device properties -+ */ -+ { /* end if list */ } -+ } -+}; -diff --git a/hmp-commands.hx b/hmp-commands.hx -index 637e133..5224b6b 100644 ---- a/hmp-commands.hx -+++ b/hmp-commands.hx -@@ -1167,6 +1167,27 @@ Add drive to PCI storage controller. - ETEXI - - { -+ .name = RFQDN_REDHAT "drive_add", -+ .args_type = "simple-drive:O", -+ .params = "id=name,[file=file][,format=f][,media=d]...", -+ .help = "Create a drive similar to -device if=none.", -+ .user_print = monitor_user_noop, -+ .mhandler.cmd_new = simple_drive_add, -+ }, -+ -+STEXI -+@item __com.redhat_drive_add -+@findex __com.redhat_drive_add -+Create a drive similar to -device if=none. -+ETEXI -+ -+STEXI -+@item pci_del -+@findex pci_del -+Hot remove PCI device. -+ETEXI -+ -+ { - .name = "pcie_aer_inject_error", - .args_type = "advisory_non_fatal:-a,correctable:-c," - "id:s,error_status:s," -diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h -index ddfaf28..f5e9141 100644 ---- a/include/sysemu/sysemu.h -+++ b/include/sysemu/sysemu.h -@@ -209,6 +209,7 @@ bool usb_enabled(void); - extern QemuOptsList qemu_legacy_drive_opts; - extern QemuOptsList qemu_common_drive_opts; - extern QemuOptsList qemu_drive_opts; -+extern QemuOptsList qemu_simple_drive_opts; - extern QemuOptsList qemu_chardev_opts; - extern QemuOptsList qemu_device_opts; - extern QemuOptsList qemu_netdev_opts; -diff --git a/util/qemu-config.c b/util/qemu-config.c -index 2d32ce7..300dae9 100644 ---- a/util/qemu-config.c -+++ b/util/qemu-config.c -@@ -8,7 +8,7 @@ - #include "qmp-commands.h" - #include "hw/i386/pc.h" - --static QemuOptsList *vm_config_groups[32]; -+static QemuOptsList *vm_config_groups[48]; - static QemuOptsList *drive_config_groups[4]; - - static QemuOptsList *find_list(QemuOptsList **lists, const char *group, -diff --git a/vl.c b/vl.c -index f86d8fe..3d72d21 100644 ---- a/vl.c -+++ b/vl.c -@@ -2783,6 +2783,7 @@ int main(int argc, char **argv, char **envp) - qemu_add_drive_opts(&qemu_legacy_drive_opts); - qemu_add_drive_opts(&qemu_common_drive_opts); - qemu_add_drive_opts(&qemu_drive_opts); -+ qemu_add_opts(&qemu_simple_drive_opts); - qemu_add_opts(&qemu_chardev_opts); - qemu_add_opts(&qemu_device_opts); - qemu_add_opts(&qemu_netdev_opts); diff --git a/SOURCES/kvm-Make-CPU-iotlb-a-structure-rather-than-a-plain-hwadd.patch b/SOURCES/kvm-Make-CPU-iotlb-a-structure-rather-than-a-plain-hwadd.patch deleted file mode 100644 index 6ec0693..0000000 --- a/SOURCES/kvm-Make-CPU-iotlb-a-structure-rather-than-a-plain-hwadd.patch +++ /dev/null @@ -1,208 +0,0 @@ -From 0e2ebc1a3f866c87b525caea2d36a48759a5ecb5 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:12 +0200 -Subject: [PATCH 124/217] Make CPU iotlb a structure rather than a plain hwaddr -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-10-git-send-email-jasowang@redhat.com> -Patchwork-id: 66784 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 09/68] Make CPU iotlb a structure rather than a plain hwaddr -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Make the CPU iotlb a structure rather than a plain hwaddr; -this will allow us to add transaction attributes to it. - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit e469b22ffda40188954fafaf6e3308f58d50f8f8) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - cputlb.c | 4 ++-- - include/exec/cpu-defs.h | 13 +++++++++++-- - softmmu_template.h | 32 +++++++++++++++++--------------- - 3 files changed, 30 insertions(+), 19 deletions(-) - -diff --git a/cputlb.c b/cputlb.c -index 38f2151..5e1cb8f 100644 ---- a/cputlb.c -+++ b/cputlb.c -@@ -301,7 +301,7 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr, - env->iotlb_v[mmu_idx][vidx] = env->iotlb[mmu_idx][index]; - - /* refill the tlb */ -- env->iotlb[mmu_idx][index] = iotlb - vaddr; -+ env->iotlb[mmu_idx][index].addr = iotlb - vaddr; - te->addend = addend - vaddr; - if (prot & PAGE_READ) { - te->addr_read = address; -@@ -349,7 +349,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) - (addr & TARGET_PAGE_MASK))) { - cpu_ldub_code(env1, addr); - } -- pd = env1->iotlb[mmu_idx][page_index] & ~TARGET_PAGE_MASK; -+ pd = env1->iotlb[mmu_idx][page_index].addr & ~TARGET_PAGE_MASK; - mr = iotlb_to_region(cpu, pd); - if (memory_region_is_unassigned(mr)) { - CPUClass *cc = CPU_GET_CLASS(cpu); -diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h -index 0ca6f0b..7f88185 100644 ---- a/include/exec/cpu-defs.h -+++ b/include/exec/cpu-defs.h -@@ -102,12 +102,21 @@ typedef struct CPUTLBEntry { - - QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS)); - -+/* The IOTLB is not accessed directly inline by generated TCG code, -+ * so the CPUIOTLBEntry layout is not as critical as that of the -+ * CPUTLBEntry. (This is also why we don't want to combine the two -+ * structs into one.) -+ */ -+typedef struct CPUIOTLBEntry { -+ hwaddr addr; -+} CPUIOTLBEntry; -+ - #define CPU_COMMON_TLB \ - /* The meaning of the MMU modes is defined in the target code. */ \ - CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \ - CPUTLBEntry tlb_v_table[NB_MMU_MODES][CPU_VTLB_SIZE]; \ -- hwaddr iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; \ -- hwaddr iotlb_v[NB_MMU_MODES][CPU_VTLB_SIZE]; \ -+ CPUIOTLBEntry iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; \ -+ CPUIOTLBEntry iotlb_v[NB_MMU_MODES][CPU_VTLB_SIZE]; \ - target_ulong tlb_flush_addr; \ - target_ulong tlb_flush_mask; \ - target_ulong vtlb_index; \ -diff --git a/softmmu_template.h b/softmmu_template.h -index 9c1d53e..0e30986 100644 ---- a/softmmu_template.h -+++ b/softmmu_template.h -@@ -123,7 +123,7 @@ - * victim tlb. try to refill from the victim tlb before walking the \ - * page table. */ \ - int vidx; \ -- hwaddr tmpiotlb; \ -+ CPUIOTLBEntry tmpiotlb; \ - CPUTLBEntry tmptlb; \ - for (vidx = CPU_VTLB_SIZE-1; vidx >= 0; --vidx) { \ - if (env->tlb_v_table[mmu_idx][vidx].ty == (addr & TARGET_PAGE_MASK)) {\ -@@ -143,12 +143,13 @@ - - #ifndef SOFTMMU_CODE_ACCESS - static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, -- hwaddr physaddr, -+ CPUIOTLBEntry *iotlbentry, - target_ulong addr, - uintptr_t retaddr) - { - uint64_t val; - CPUState *cpu = ENV_GET_CPU(env); -+ hwaddr physaddr = iotlbentry->addr; - MemoryRegion *mr = iotlb_to_region(cpu, physaddr); - - physaddr = (physaddr & TARGET_PAGE_MASK) + addr; -@@ -196,15 +197,15 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx, - - /* Handle an IO access. */ - if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { -- hwaddr ioaddr; -+ CPUIOTLBEntry *iotlbentry; - if ((addr & (DATA_SIZE - 1)) != 0) { - goto do_unaligned_access; - } -- ioaddr = env->iotlb[mmu_idx][index]; -+ iotlbentry = &env->iotlb[mmu_idx][index]; - - /* ??? Note that the io helpers always read data in the target - byte ordering. We should push the LE/BE request down into io. */ -- res = glue(io_read, SUFFIX)(env, ioaddr, addr, retaddr); -+ res = glue(io_read, SUFFIX)(env, iotlbentry, addr, retaddr); - res = TGT_LE(res); - return res; - } -@@ -284,15 +285,15 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx, - - /* Handle an IO access. */ - if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { -- hwaddr ioaddr; -+ CPUIOTLBEntry *iotlbentry; - if ((addr & (DATA_SIZE - 1)) != 0) { - goto do_unaligned_access; - } -- ioaddr = env->iotlb[mmu_idx][index]; -+ iotlbentry = &env->iotlb[mmu_idx][index]; - - /* ??? Note that the io helpers always read data in the target - byte ordering. We should push the LE/BE request down into io. */ -- res = glue(io_read, SUFFIX)(env, ioaddr, addr, retaddr); -+ res = glue(io_read, SUFFIX)(env, iotlbentry, addr, retaddr); - res = TGT_BE(res); - return res; - } -@@ -364,12 +365,13 @@ WORD_TYPE helper_be_lds_name(CPUArchState *env, target_ulong addr, - #endif - - static inline void glue(io_write, SUFFIX)(CPUArchState *env, -- hwaddr physaddr, -+ CPUIOTLBEntry *iotlbentry, - DATA_TYPE val, - target_ulong addr, - uintptr_t retaddr) - { - CPUState *cpu = ENV_GET_CPU(env); -+ hwaddr physaddr = iotlbentry->addr; - MemoryRegion *mr = iotlb_to_region(cpu, physaddr); - - physaddr = (physaddr & TARGET_PAGE_MASK) + addr; -@@ -410,16 +412,16 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val, - - /* Handle an IO access. */ - if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { -- hwaddr ioaddr; -+ CPUIOTLBEntry *iotlbentry; - if ((addr & (DATA_SIZE - 1)) != 0) { - goto do_unaligned_access; - } -- ioaddr = env->iotlb[mmu_idx][index]; -+ iotlbentry = &env->iotlb[mmu_idx][index]; - - /* ??? Note that the io helpers always read data in the target - byte ordering. We should push the LE/BE request down into io. */ - val = TGT_LE(val); -- glue(io_write, SUFFIX)(env, ioaddr, val, addr, retaddr); -+ glue(io_write, SUFFIX)(env, iotlbentry, val, addr, retaddr); - return; - } - -@@ -491,16 +493,16 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val, - - /* Handle an IO access. */ - if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { -- hwaddr ioaddr; -+ CPUIOTLBEntry *iotlbentry; - if ((addr & (DATA_SIZE - 1)) != 0) { - goto do_unaligned_access; - } -- ioaddr = env->iotlb[mmu_idx][index]; -+ iotlbentry = &env->iotlb[mmu_idx][index]; - - /* ??? Note that the io helpers always read data in the target - byte ordering. We should push the LE/BE request down into io. */ - val = TGT_BE(val); -- glue(io_write, SUFFIX)(env, ioaddr, val, addr, retaddr); -+ glue(io_write, SUFFIX)(env, iotlbentry, val, addr, retaddr); - return; - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-Migration-compat-for-fdc.patch b/SOURCES/kvm-Migration-compat-for-fdc.patch deleted file mode 100644 index 1eaaada..0000000 --- a/SOURCES/kvm-Migration-compat-for-fdc.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 4cfd0fcf7420de0c7cddc45e9ffa56f9ce5a23aa Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Fri, 26 Jun 2015 16:19:47 +0200 -Subject: [PATCH 086/217] Migration compat for fdc - -Message-id: <1435335587-14324-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66534 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/1] Migration compat for fdc -Bugzilla: 1215091 -RH-Acked-by: Amit Shah <amit.shah@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Juan Quintela <quintela@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -2.2 added some sections into the fdc and floppy drive, this patch -disables those new sections for reverse migration compatibility. - -There are three pieces of data added to the migration: - 1) 'perpendicular mode' on the drive - i.e. 2.88MB mode, that - was rare as hens teeth and the flag isn't actually used anywhere. - - 2) fdc_reset_sensei - This relates to the state of the fdc just after a reset command; - the fdc produces four 'sense' states internally (corresponding to - one external interrupt) that is there for backwards compatibility - to an older fdc (and to 8" drives!!). This compatibility code - was added to qemu to fix SCO Openserver floppy problems, ~2009. - Migration just after an fdc-reset would get the initial interrupt - but lose the extra 3 sense states. Print a log message since - that's guest visible, but it's not knowingly caused us a problem - so don't fail migration. - - 3) result-timer - The emulation models a delay after the 'read id' command which - is handled by a timer; if we migrate before the timer goes off - we probably wont complete the command. - I'm worried that the most likely time that a 'read id' would be - used would be in a background probe to see if there's a floppy - present, so again, don't fail the migrate, but do print a log - message. With any luck any sane floppy driver will have a - timeout; if we hit problems then a work around would be to - make the pre-save mark the command as finished with error. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/block/fdc.c | 39 +++++++++++++++++++++++++++++++++++++-- - 1 file changed, 37 insertions(+), 2 deletions(-) - -diff --git a/hw/block/fdc.c b/hw/block/fdc.c -index a9de4ab..516a761 100644 ---- a/hw/block/fdc.c -+++ b/hw/block/fdc.c -@@ -33,6 +33,7 @@ - #include "qemu/timer.h" - #include "hw/isa/isa.h" - #include "hw/sysbus.h" -+#include "migration/migration.h" - #include "sysemu/block-backend.h" - #include "sysemu/blockdev.h" - #include "sysemu/sysemu.h" -@@ -700,6 +701,10 @@ static bool fdrive_perpendicular_needed(void *opaque) - { - FDrive *drive = opaque; - -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return drive->perpendicular != 0; - } - -@@ -765,8 +770,20 @@ static int fdc_post_load(void *opaque, int version_id) - static bool fdc_reset_sensei_needed(void *opaque) - { - FDCtrl *s = opaque; -+ bool needed = s->reset_sensei != 0; -+ -+ if (migrate_pre_2_2) { -+ /* -+ * This probably wont matter for most OSs, but it's good to log -+ * it just incase we find it causes problems. -+ */ -+ if (needed) { -+ error_report("INFO: fdc migration just after reset (sensei!=0)"); -+ } -+ return false; -+ } - -- return s->reset_sensei != 0; -+ return needed; - } - - static const VMStateDescription vmstate_fdc_reset_sensei = { -@@ -782,8 +799,26 @@ static const VMStateDescription vmstate_fdc_reset_sensei = { - static bool fdc_result_timer_needed(void *opaque) - { - FDCtrl *s = opaque; -+ bool needed = timer_pending(s->result_timer); -+ -+ if (migrate_pre_2_2) { -+ /* -+ * This could upset some OSs if their read-id command doesn't -+ * complete, so lets log something. -+ */ -+ if (needed) { -+ error_report("INFO: fdc migration just after read-id (timer!=0)"); -+ } -+ /* -+ * However, since it's not apparently caused us problems for many -+ * years, don't fail the migration, especially as this could -+ * happen as part of a background drive-probe which if it fails -+ * won't be a problem. -+ */ -+ return false; -+ } - -- return timer_pending(s->result_timer); -+ return needed; - } - - static const VMStateDescription vmstate_fdc_result_timer = { --- -1.8.3.1 - diff --git a/SOURCES/kvm-Migration-compat-for-mc146818rtc-irq_reinject_on_ack.patch b/SOURCES/kvm-Migration-compat-for-mc146818rtc-irq_reinject_on_ack.patch deleted file mode 100644 index e9661a3..0000000 --- a/SOURCES/kvm-Migration-compat-for-mc146818rtc-irq_reinject_on_ack.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 556c112c7360de0f0cbc2d020439c5ad0a0fd178 Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Wed, 24 Jun 2015 18:59:00 +0200 -Subject: [PATCH 042/217] Migration compat for - mc146818rtc/irq_reinject_on_ack_count subsection - -Message-id: <1435172340-659-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66473 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/1] Migration compat for mc146818rtc/irq_reinject_on_ack_count subsection -Bugzilla: 1215088 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -2.2 added a subsection to migrate the 'irq_reinject_on_ack_count' -value in the rtc which was previously missing, this breaks backwards -migration. - -Short story; this makes backwards migration compatible and makes -it no worse than forward migration; and anyway I don't think it can -ever hit any real bad case. - -Longer story: - -The story of this field is long and tortured, in no way reflects -state on real hardware, but starts it's life in commit ba32edab -in 2009 from Gleb. - -If the RTC is running a periodic timer interrupt at a rate faster -than we can issue interrupts (Win 7 runs it at 1kHz) we increment -a counter of lost interrupts (s->irq_coalesced that is migrated) -to keep a count of the number that we somehow need to make up for. - -Then whenever the guest clears the interrupt, if our counter is -positive then we inject another one. This process is rate limited -to RTC_REINJECT_ON_ACK_COUNT reinjects per periodic cycle (?). -The 'irq_reinject_on_ack_count' is the counter of how many we've -injected in this cycle to see if we hit this limit. - -If we don't migrate the field (which we haven't been doing) -then the worst case is we'd inject 2*RTC_REINJECT_ON_ACK_COUNT -(if we already had a reason to inject them) in one time period -rather than rate limit to RTC_REINJECT_ON_ACK_COUNT. It shouldn't -lose or gain any interrupts; just affect the rate at which we -fix it up. - -RTC_REINJECT_ON_ACK_COUNT was originally set to the arbitrary -value of 1000 but then Gleb changed this to the smaller arbitrary -value of 20 (see dd17765b). The commit message of that -explains that Win7 BSODs if it gets a run of ~100 RTC interrupts -in fast succession. Since the worst case here is 2*20 and it's -still well under the 100, it shouldn't cause any problem. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/timer/mc146818rtc.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c -index f2b77fa..00986a2 100644 ---- a/hw/timer/mc146818rtc.c -+++ b/hw/timer/mc146818rtc.c -@@ -28,6 +28,7 @@ - #include "qapi/visitor.h" - #include "qapi-event.h" - #include "qmp-commands.h" -+#include "migration/migration.h" - - #ifdef TARGET_I386 - #include "hw/i386/apic.h" -@@ -746,6 +747,11 @@ static const VMStateDescription vmstate_rtc_irq_reinject_on_ack_count = { - static bool rtc_irq_reinject_on_ack_count_needed(void *opaque) - { - RTCState *s = (RTCState *)opaque; -+ -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return s->irq_reinject_on_ack_count != 0; - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-Migration-compat-for-pckbd.patch b/SOURCES/kvm-Migration-compat-for-pckbd.patch deleted file mode 100644 index b1cce1f..0000000 --- a/SOURCES/kvm-Migration-compat-for-pckbd.patch +++ /dev/null @@ -1,60 +0,0 @@ -From cfb25df0e4360b4767654a9ef1c1f3546ae7efec Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Thu, 25 Jun 2015 16:34:25 +0200 -Subject: [PATCH 085/217] Migration compat for pckbd - -Message-id: <1435250065-17863-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66497 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/1] Migration compat for pckbd -Bugzilla: 1215092 -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -2.2 added a new subsection to the pc keyboard model to preserve -the value of 'outport' across migration; to maintain migration -backwards compatibility this patch disables it on older machine types. -This leaves us no-worse-off than in older versions. - -Even with the new code, the value migrated in 'outport' isn't used -anywhere in the pckbd model; for example the value migrated doesn't -change the state of the A20 line or potentially do a reset. - -The only effect, as far as I can tell is if the guest were to -explicitly read the outport value it might get a more sensible reply. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/input/pckbd.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c -index 9b9a7d7..d688836 100644 ---- a/hw/input/pckbd.c -+++ b/hw/input/pckbd.c -@@ -25,6 +25,7 @@ - #include "hw/isa/isa.h" - #include "hw/i386/pc.h" - #include "hw/input/ps2.h" -+#include "migration/migration.h" - #include "sysemu/sysemu.h" - - /* debug PC keyboard */ -@@ -405,6 +406,11 @@ static const VMStateDescription vmstate_kbd_outport = { - static bool kbd_outport_needed(void *opaque) - { - KBDState *s = opaque; -+ -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return s->outport != kbd_outport_default(s); - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-Print-error-when-failing-to-load-PCI-config-data.patch b/SOURCES/kvm-Print-error-when-failing-to-load-PCI-config-data.patch deleted file mode 100644 index a3ca071..0000000 --- a/SOURCES/kvm-Print-error-when-failing-to-load-PCI-config-data.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d13503269287470b660436a8a4f7499e7b7bf514 Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Thu, 2 Jul 2015 12:08:01 +0200 -Subject: [PATCH 103/217] Print error when failing to load PCI config data - -Message-id: <1435838882-10566-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66603 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/2] Print error when failing to load PCI config data -Bugzilla: 1209793 -RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com> -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -When loading migration fails due to a disagreement about -PCI config data we don't currently get any errors explaining -that was the cause of the problem or which byte in the config -data was at fault. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> -(cherry picked from commit 7c59364d0329d36a7759033962a469ca714f884d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index e57255e..b51f229 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -398,6 +398,10 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) - for (i = 0; i < size; ++i) { - if ((config[i] ^ s->config[i]) & - s->cmask[i] & ~s->wmask[i] & ~s->w1cmask[i]) { -+ error_report("%s: Bad config data: i=0x%x read: %x device: %x " -+ "cmask: %x wmask: %x w1cmask:%x", __func__, -+ i, config[i], s->config[i], -+ s->cmask[i], s->wmask[i], s->w1cmask[i]); - g_free(config); - return -EINVAL; - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-QMP-Document-throttling-parameters-of-__com-redhat_drive_add.patch b/SOURCES/kvm-QMP-Document-throttling-parameters-of-__com-redhat_drive_add.patch deleted file mode 100644 index 32eb74c..0000000 --- a/SOURCES/kvm-QMP-Document-throttling-parameters-of-__com-redhat_drive_add.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9a725e799990a69c669f7f2a75f105afa679198b Mon Sep 17 00:00:00 2001 -From: Markus Armbruster <armbru@redhat.com> -Date: Tue, 17 Dec 2013 06:46:38 +0100 -Subject: QMP: Document throttling parameters of __com.redhat_drive_add - -RH-Author: Markus Armbruster <armbru@redhat.com> -Message-id: <1387262799-10350-6-git-send-email-armbru@redhat.com> -Patchwork-id: 56296 -O-Subject: [PATCH v2 5/6] QMP: Document throttling parameters of __com.redhat_drive_add -Bugzilla: 889051 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> - -From: Markus Armbruster <armbru@redhat.com> - -The previous commit copied the code from RHEL-6, including the -throttling parameters added in RHEL-6 commit ea4348a "block: Allow IO -throttling fields in __com.redhat_drive_add". That commit neglected -to update documentation, then in qemu-monitor.hx, now in -qmp-commands.hx. Update it, so that qmp-commands.txt is complete. - -Signed-off-by: Markus Armbruster <armbru@redhat.com> - -diff --git a/qmp-commands.hx b/qmp-commands.hx -index 6d47a99..a40dd7d 100644 ---- a/qmp-commands.hx -+++ b/qmp-commands.hx -@@ -137,6 +137,12 @@ Arguments: - - "serial": Drive serial number (json-string, optional) - - "snapshot": Enable snapshot mode (json-bool, optional) - - "copy-on-read": Enable copy-on-read mode (json-bool, optional) -+- "bps": total throughput limit in bytes per second is specified -+- "bps_rd": read throughput limit in bytes per second is specified -+- "bps_wr": write throughput limit in bytes per second is specified -+- "iops": total I/O operations per second is specified -+- "iops_rd": read I/O operations per second is specified -+- "iops_wr": write I/O operations per second is specified - - Example: - diff --git a/SOURCES/kvm-QMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch b/SOURCES/kvm-QMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch deleted file mode 100644 index 88cf486..0000000 --- a/SOURCES/kvm-QMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch +++ /dev/null @@ -1,187 +0,0 @@ -From c466d0a410e2618c6a69ec4d7179ea5be97121a5 Mon Sep 17 00:00:00 2001 -From: Markus Armbruster <armbru@redhat.com> -Date: Tue, 17 Dec 2013 06:46:36 +0100 -Subject: QMP: Forward-port __com.redhat_drive_add from RHEL-6 - -RH-Author: Markus Armbruster <armbru@redhat.com> -Message-id: <1387262799-10350-4-git-send-email-armbru@redhat.com> -Patchwork-id: 56294 -O-Subject: [PATCH v2 3/6] QMP: Forward-port __com.redhat_drive_add from RHEL-6 -Bugzilla: 889051 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> - -From: Markus Armbruster <armbru@redhat.com> - -Code taken from RHEL-6 as of qemu-kvm-0.12.1.2-2.418.el6, backported -and fixed up as follows: - -* Update simple_drive_add() for commit 4e89978 "qemu-option: - qemu_opts_from_qdict(): use error_set()". - -* Update simple_drive_add() for commit 2d0d283 "Support default block - interfaces per QEMUMachine". - -* Add comment explaining drive_init() error reporting hacks to - simple_drive_add(). - -* qemu-monitor.hx has been split into qmp-commands.hx and - hmp-commands.hx. Copy the QMP parts to qmp-commands.hx. Clean up - second example slightly. - -* Trailing whitespace cleaned up. - -Signed-off-by: Markus Armbruster <armbru@redhat.com> - -diff --git a/device-hotplug.c b/device-hotplug.c -index 68b9496..7d4dc92 100644 ---- a/device-hotplug.c -+++ b/device-hotplug.c -@@ -79,3 +79,78 @@ err: - blk_unref(blk_by_legacy_dinfo(dinfo)); - } - } -+ -+static void check_parm(const char *key, QObject *obj, void *opaque) -+{ -+ static const char *valid_keys[] = { -+ "id", "cyls", "heads", "secs", "trans", "media", "snapshot", -+ "file", "cache", "aio", "format", "serial", "rerror", "werror", -+ "readonly", "copy-on-read", -+#ifdef CONFIG_BLOCK_IO_THROTTLING -+ "bps", "bps_rd", "bps_wr", "iops", "iops_rd", "iops_wr", -+#endif -+ NULL -+ -+ }; -+ int *stopped = opaque; -+ const char **p; -+ -+ if (*stopped) { -+ return; -+ } -+ -+ for (p = valid_keys; *p; p++) { -+ if (!strcmp(key, *p)) { -+ return; -+ } -+ } -+ -+ qerror_report(QERR_INVALID_PARAMETER, key); -+ *stopped = 1; -+} -+ -+int simple_drive_add(Monitor *mon, const QDict *qdict, QObject **ret_data) -+{ -+ int stopped; -+ Error *local_err = NULL; -+ QemuOpts *opts; -+ DriveInfo *dinfo; -+ MachineClass *mc; -+ -+ if (!qdict_haskey(qdict, "id")) { -+ qerror_report(QERR_MISSING_PARAMETER, "id"); -+ return -1; -+ } -+ -+ stopped = 0; -+ qdict_iter(qdict, check_parm, &stopped); -+ if (stopped) { -+ return -1; -+ } -+ -+ opts = qemu_opts_from_qdict(&qemu_drive_opts, qdict, &local_err); -+ if (!opts) { -+ qerror_report_err(local_err); -+ error_free(local_err); -+ return -1; -+ } -+ qemu_opt_set(opts, "if", "none", &error_abort); -+ mc = MACHINE_GET_CLASS(current_machine); -+ dinfo = drive_new(opts, mc->block_default_type); -+ if (!dinfo) { -+ /* -+ * drive_new() reports some errors with qerror_report_err(), -+ * and some with error_report(). The latter vanish without -+ * trace in monitor_vprintf(). See also the rather optimistic -+ * upstream commit 74ee59a. Emit a generic error here. If a -+ * prior error from qerror_report_err() is pending, it'll get -+ * ignored. -+ */ -+ qerror_report(QERR_DEVICE_INIT_FAILED, -+ qemu_opts_id(opts)); -+ qemu_opts_del(opts); -+ return -1; -+ } -+ -+ return 0; -+} -diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h -index 7ca59b5..4478fc8 100644 ---- a/include/sysemu/blockdev.h -+++ b/include/sysemu/blockdev.h -@@ -67,4 +67,6 @@ void qmp_change_blockdev(const char *device, const char *filename, - const char *format, Error **errp); - void hmp_commit(Monitor *mon, const QDict *qdict); - int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data); -+ -+int simple_drive_add(Monitor *mon, const QDict *qdict, QObject **ret_data); - #endif -diff --git a/qmp-commands.hx b/qmp-commands.hx -index 514ef73..6d47a99 100644 ---- a/qmp-commands.hx -+++ b/qmp-commands.hx -@@ -106,6 +106,52 @@ Example: - Note: The "force" argument defaults to false. - - EQMP -+ { -+ .name = RFQDN_REDHAT "drive_add", -+ .args_type = "simple-drive:O", -+ .params = "id=name,[file=file][,format=f][,media=d]...", -+ .help = "Create a drive similar to -device if=none.", -+ .user_print = monitor_user_noop, -+ .mhandler.cmd_new = simple_drive_add, -+ }, -+ -+SQMP -+__com.redhat_drive_add -+---------------------- -+ -+Create a drive similar to -device if=none. -+ -+Arguments: -+ -+- "id": Drive ID, must be unique (json-string) -+- "file": Disk image (json-string, optional) -+- "format": Disk format (json-string, optional) -+- "aio": How to perform asynchronous disk I/O (json-string, optional) -+- "cache": Host cache use policy (json-string, optional) -+- "cyls", "heads", "secs": Disk geometry (json-int, optional) -+- "trans": BIOS translation mode (json-string, optional) -+- "media": Media type (json-string, optional) -+- "readonly": Open image read-only (json-bool, optional) -+- "rerror": What to do on read error (json-string, optional) -+- "werror": What to do on write error (json-string, optional) -+- "serial": Drive serial number (json-string, optional) -+- "snapshot": Enable snapshot mode (json-bool, optional) -+- "copy-on-read": Enable copy-on-read mode (json-bool, optional) -+ -+Example: -+ -+1. Add a drive without medium: -+ -+-> { "execute": "__com.redhat_drive_add", "arguments": { "id": "foo" } } -+<- {"return": {}} -+ -+2. Add a drive with medium: -+ -+-> { "execute": "__com.redhat_drive_add", -+ "arguments": { "id": "bar", "file": "tmp.qcow2", "format": "qcow2" } } -+<- {"return": {}} -+ -+EQMP - - { - .name = RFQDN_REDHAT "drive_del", diff --git a/SOURCES/kvm-QMP-Forward-port-__com-redhat_drive_del-from-RHEL-6.patch b/SOURCES/kvm-QMP-Forward-port-__com-redhat_drive_del-from-RHEL-6.patch deleted file mode 100644 index 678b28a..0000000 --- a/SOURCES/kvm-QMP-Forward-port-__com-redhat_drive_del-from-RHEL-6.patch +++ /dev/null @@ -1,76 +0,0 @@ -From af6da2063b85befa76443464de02b6bb08f5e9b7 Mon Sep 17 00:00:00 2001 -From: Markus Armbruster <armbru@redhat.com> -Date: Tue, 17 Dec 2013 06:46:35 +0100 -Subject: QMP: Forward-port __com.redhat_drive_del from RHEL-6 - -RH-Author: Markus Armbruster <armbru@redhat.com> -Message-id: <1387262799-10350-3-git-send-email-armbru@redhat.com> -Patchwork-id: 56292 -O-Subject: [PATCH v2 2/6] QMP: Forward-port __com.redhat_drive_del from RHEL-6 -Bugzilla: 889051 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> - -From: Markus Armbruster <armbru@redhat.com> - -Upstream has drive_del, but only in HMP. The backport to RHEL-6 added -it to QMP as well. Since the QMP command is a downstream extension, -it needs the __com.redhat_ prefix. Since RHEL-6 doesn't have separate -definition of QMP and HMP commands, both the QMP and the HMP command -got the prefix. - -RHEL-7 inherits HMP command drive_del from upstream. Add QMP command -__com.redhat_drive_del for RHEL-6 compatibility. - -If we needed similar compatibility for the HMP command, we'd have to -add __com.redhat_drive_del as alias for drive_del. But we don't. - -Code copied from RHEL-6's qemu-monitor.hx as of -qemu-kvm-0.12.1.2-2.418.el6. It has a "drive_del" without the prefix -in the documentation. Fixed here. Hardly worth fixing in RHEL-6 now. - -Signed-off-by: Markus Armbruster <armbru@redhat.com> - -diff --git a/qmp-commands.hx b/qmp-commands.hx -index c091d59..514ef73 100644 ---- a/qmp-commands.hx -+++ b/qmp-commands.hx -@@ -108,6 +108,37 @@ Note: The "force" argument defaults to false. - EQMP - - { -+ .name = RFQDN_REDHAT "drive_del", -+ .args_type = "id:s", -+ .params = "device", -+ .help = "remove host block device", -+ .user_print = monitor_user_noop, -+ .mhandler.cmd_new = hmp_drive_del, -+ }, -+ -+SQMP -+__com.redhat_drive_del -+---------- -+ -+Remove host block device. The result is that guest generated IO is no longer -+submitted against the host device underlying the disk. Once a drive has -+been deleted, the QEMU Block layer returns -EIO which results in IO -+errors in the guest for applications that are reading/writing to the device. -+These errors are always reported to the guest, regardless of the drive's error -+actions (drive options rerror, werror). -+ -+Arguments: -+ -+- "id": the device's ID (json-string) -+ -+Example: -+ -+-> { "execute": "__com.redhat_drive_del", "arguments": { "id": "block1" } } -+<- { "return": {} } -+ -+EQMP -+ -+ { - .name = "change", - .args_type = "device:B,target:F,arg:s?", - .mhandler.cmd_new = qmp_marshal_input_change, diff --git a/SOURCES/kvm-QMP-Relax-__com-redhat_drive_add-parameter-checking.patch b/SOURCES/kvm-QMP-Relax-__com-redhat_drive_add-parameter-checking.patch deleted file mode 100644 index ab6b093..0000000 --- a/SOURCES/kvm-QMP-Relax-__com-redhat_drive_add-parameter-checking.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 99543ca6a3c2f78e84c3c74addde3c7bfa89b1f7 Mon Sep 17 00:00:00 2001 -From: Markus Armbruster <armbru@redhat.com> -Date: Wed, 5 Mar 2014 17:32:58 +0100 -Subject: QMP: Relax __com.redhat_drive_add parameter checking - -RH-Author: Markus Armbruster <armbru@redhat.com> -Message-id: <1394040778-1544-2-git-send-email-armbru@redhat.com> -Patchwork-id: 58021 -O-Subject: [PATCH 7.0 qemu-kvm 1/1] QMP: Relax __com.redhat_drive_add parameter checking -Bugzilla: 1057471 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Amos Kong <akong@redhat.com> -RH-Acked-by: Kevin Wolf <kwolf@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -I/O throttling and many new features are unavailable with this -command, because its parameter checking is overly restrictive. -Relax it. - -The command was forward-ported from RHEL-6 (commit 75ad257). It -provides access to drive_init() via QMP with the parameters restricted -to a subset of the ones recognized by drive_init(). We did that -because some parameters make sense only when configuring a frontend in -addition to a backend, and the command doesn't do that. - -The parameter filtering is implemented as a whitelist. The -forward-port neglected to update the whitelist for all the stuff that -has changed since RHEL-6. - -Due to new features like driver-specific parameters, a whitelist is no -longer convenient. Replace by a blacklist that contains exactly the -drive_init() parameters that are already filtered out on RHEL-6. - -Signed-off-by: Markus Armbruster <armbru@redhat.com> - -diff --git a/device-hotplug.c b/device-hotplug.c -index 7d4dc92..c11eac8 100644 ---- a/device-hotplug.c -+++ b/device-hotplug.c -@@ -82,13 +82,8 @@ err: - - static void check_parm(const char *key, QObject *obj, void *opaque) - { -- static const char *valid_keys[] = { -- "id", "cyls", "heads", "secs", "trans", "media", "snapshot", -- "file", "cache", "aio", "format", "serial", "rerror", "werror", -- "readonly", "copy-on-read", --#ifdef CONFIG_BLOCK_IO_THROTTLING -- "bps", "bps_rd", "bps_wr", "iops", "iops_rd", "iops_wr", --#endif -+ static const char *unwanted_keys[] = { -+ "bus", "unit", "index", "if", "boot", "addr", - NULL - - }; -@@ -99,14 +94,14 @@ static void check_parm(const char *key, QObject *obj, void *opaque) - return; - } - -- for (p = valid_keys; *p; p++) { -+ for (p = unwanted_keys; *p; p++) { - if (!strcmp(key, *p)) { -+ qerror_report(QERR_INVALID_PARAMETER, key); -+ *stopped = 1; - return; - } - } - -- qerror_report(QERR_INVALID_PARAMETER, key); -- *stopped = 1; - } - - int simple_drive_add(Monitor *mon, const QDict *qdict, QObject **ret_data) diff --git a/SOURCES/kvm-RHEL-Disable-remaining-unsupported-devices-for-ppc.patch b/SOURCES/kvm-RHEL-Disable-remaining-unsupported-devices-for-ppc.patch deleted file mode 100644 index 46063a9..0000000 --- a/SOURCES/kvm-RHEL-Disable-remaining-unsupported-devices-for-ppc.patch +++ /dev/null @@ -1,58 +0,0 @@ -From bb3e874e4d5e17b66be70cf2af9a3a7fa7b3e9d1 Mon Sep 17 00:00:00 2001 -From: David Gibson <dgibson@redhat.com> -Date: Fri, 3 Jul 2015 06:45:06 +0200 -Subject: [PATCH 108/217] RHEL: Disable remaining unsupported devices for ppc - -Message-id: <1435905906-24552-4-git-send-email-dgibson@redhat.com> -Patchwork-id: 66688 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 3/3] RHEL: Disable remaining unsupported devices for ppc -Bugzilla: 1191845 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -This is a downstream only patch for the configuration, removing the -remaining qemu devices which we don't want to support on Power. - -CONFIG_ISA_BUS: No ISA on Power -CONFIG_ISA_MMIO: This option doesn't actually do anything, anyway -CONFIG_I8259: With no ISA, we don't need the legacy i8259 PIC -CONFIG_PLATFORM_BUS: Only used on ppc embedded machine types -CONFIG_SERIAL_ISA: No ISA, so no legacy serial ports -CONFIG_ISA_TESTDEV: No ISA - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1191845 - -Signed-off-by: David Gibson <dgibson@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - default-configs/ppc64-softmmu.mak | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak -index e18d808..037064b 100644 ---- a/default-configs/ppc64-softmmu.mak -+++ b/default-configs/ppc64-softmmu.mak -@@ -11,19 +11,12 @@ CONFIG_PCI_TESTDEV=y - - include sound.mak - include usb.mak --CONFIG_ISA_BUS=y --CONFIG_ISA_MMIO=y - CONFIG_VGA=y - CONFIG_VGA_PCI=y - CONFIG_SERIAL=y --CONFIG_I8259=y - CONFIG_PSERIES=y --CONFIG_PLATFORM_BUS=y - CONFIG_LIBDECNUMBER=y - CONFIG_USB_OHCI=y - # For pSeries - CONFIG_XICS=$(CONFIG_PSERIES) - CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) --CONFIG_I8259=y --CONFIG_SERIAL_ISA=y --CONFIG_ISA_TESTDEV=y --- -1.8.3.1 - diff --git a/SOURCES/kvm-Serial-Migration-compatibility-pre-2.2-7.2.patch b/SOURCES/kvm-Serial-Migration-compatibility-pre-2.2-7.2.patch deleted file mode 100644 index f476b90..0000000 --- a/SOURCES/kvm-Serial-Migration-compatibility-pre-2.2-7.2.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 1ed13b9373d2fdfdf898ac864b024d55ef28890d Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Wed, 24 Jun 2015 13:39:56 +0200 -Subject: [PATCH 041/217] Serial: Migration compatibility pre 2.2/7.2 - -Message-id: <1435153196-26350-3-git-send-email-dgilbert@redhat.com> -Patchwork-id: 66380 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH v3 2/2] Serial: Migration compatibility pre 2.2/7.2 -Bugzilla: 1215087 -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -Disable subsections added in qemu 2.3 - -Newer qemu fixed migration corner cases for serial by adding subsections, -however if these are generated it will break backwards migration. -Disabling these subsections on older machine types should leave it no -worse than existing qemu, from which we're not aware of having any reports -of problems, and still allow these improvements on new machine types. -Even when a user isn't actively using a serial port a guest will -probably initialise it and may send stuff (e.g. a copy of the console messages -or the login: prompt). - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/char/serial.c | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -diff --git a/hw/char/serial.c b/hw/char/serial.c -index 55011cf..248bf8b 100644 ---- a/hw/char/serial.c -+++ b/hw/char/serial.c -@@ -28,6 +28,7 @@ - #include "qemu/timer.h" - #include "exec/address-spaces.h" - #include "qemu/error-report.h" -+#include "migration/migration.h" - - //#define DEBUG_SERIAL - -@@ -646,6 +647,10 @@ static bool serial_thr_ipending_needed(void *opaque) - { - SerialState *s = opaque; - -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - if (s->ier & UART_IER_THRI) { - bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI); - return s->thr_ipending != expected_value; -@@ -671,6 +676,10 @@ static const VMStateDescription vmstate_serial_thr_ipending = { - static bool serial_tsr_needed(void *opaque) - { - SerialState *s = (SerialState *)opaque; -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return s->tsr_retry != 0; - } - -@@ -689,6 +698,10 @@ static const VMStateDescription vmstate_serial_tsr = { - static bool serial_recv_fifo_needed(void *opaque) - { - SerialState *s = (SerialState *)opaque; -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return !fifo8_is_empty(&s->recv_fifo); - - } -@@ -706,6 +719,10 @@ static const VMStateDescription vmstate_serial_recv_fifo = { - static bool serial_xmit_fifo_needed(void *opaque) - { - SerialState *s = (SerialState *)opaque; -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return !fifo8_is_empty(&s->xmit_fifo); - } - -@@ -722,6 +739,10 @@ static const VMStateDescription vmstate_serial_xmit_fifo = { - static bool serial_fifo_timeout_timer_needed(void *opaque) - { - SerialState *s = (SerialState *)opaque; -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return timer_pending(s->fifo_timeout_timer); - } - -@@ -738,6 +759,10 @@ static const VMStateDescription vmstate_serial_fifo_timeout_timer = { - static bool serial_timeout_ipending_needed(void *opaque) - { - SerialState *s = (SerialState *)opaque; -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return s->timeout_ipending != 0; - } - -@@ -754,6 +779,10 @@ static const VMStateDescription vmstate_serial_timeout_ipending = { - static bool serial_poll_needed(void *opaque) - { - SerialState *s = (SerialState *)opaque; -+ if (migrate_pre_2_2) { -+ return false; -+ } -+ - return s->poll_msl >= 0; - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-Split-serial-isa-into-its-own-config-option.patch b/SOURCES/kvm-Split-serial-isa-into-its-own-config-option.patch deleted file mode 100644 index 3f7e71c..0000000 --- a/SOURCES/kvm-Split-serial-isa-into-its-own-config-option.patch +++ /dev/null @@ -1,241 +0,0 @@ -From c4320d88859082344222fb2379fea9c39956fa7e Mon Sep 17 00:00:00 2001 -From: David Gibson <dgibson@redhat.com> -Date: Fri, 3 Jul 2015 06:45:04 +0200 -Subject: [PATCH 106/217] Split serial-isa into its own config option - -Message-id: <1435905906-24552-2-git-send-email-dgibson@redhat.com> -Patchwork-id: 66686 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/3] Split serial-isa into its own config option -Bugzilla: 1191845 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -At present, the core device model code for 8250-like serial ports -(serial.c) and the code for serial ports attached to ISA-style legacy IO -(serial-isa.c) are both controlled by the CONFIG_SERIAL variable. - -There are lots and lots of embedded platforms that have 8250-like serial -ports but have never had anything resembling ISA legacy IO. Therefore, -split serial-isa into its own CONFIG_SERIAL_ISA option so it can be -disabled for platforms where it's not appropriate. - -For now, I enabled CONFIG_SERIAL_ISA in every default-config where -CONFIG_SERIAL is enabled, excepting microblaze, moxie, or32, and -xtensa. As best as I can tell, those platforms never used legacy ISA, -and also don't include PCI support (which would allow connection of a -PCI->ISA bridge and/or a southbridge including legacy ISA serial -ports). - -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> - -Upstream: Pending (posted, but not merged) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - default-configs/ppc64-softmmu.mak - default-configs/x86_64-softmmu.mak - -Downstream configs are different from upstream, hence the conflicts. - -Signed-off-by: David Gibson <dgibson@redhat.com> ---- - default-configs/alpha-softmmu.mak | 1 + - default-configs/arm-softmmu.mak | 1 + - default-configs/i386-softmmu.mak | 1 + - default-configs/mips-softmmu.mak | 1 + - default-configs/mips64-softmmu.mak | 1 + - default-configs/mips64el-softmmu.mak | 1 + - default-configs/mipsel-softmmu.mak | 1 + - default-configs/ppc-softmmu.mak | 1 + - default-configs/ppc64-softmmu.mak | 1 + - default-configs/ppcemb-softmmu.mak | 1 + - default-configs/sh4-softmmu.mak | 1 + - default-configs/sh4eb-softmmu.mak | 1 + - default-configs/sparc64-softmmu.mak | 1 + - default-configs/x86_64-softmmu.mak | 1 + - hw/char/Makefile.objs | 3 ++- - 15 files changed, 16 insertions(+), 1 deletion(-) - -diff --git a/default-configs/alpha-softmmu.mak b/default-configs/alpha-softmmu.mak -index 7f6161e..e0d75e3 100644 ---- a/default-configs/alpha-softmmu.mak -+++ b/default-configs/alpha-softmmu.mak -@@ -3,6 +3,7 @@ - include pci.mak - include usb.mak - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_I8254=y - CONFIG_PCKBD=y - CONFIG_VGA_CIRRUS=y -diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak -index deb788d..f8a24d8 100644 ---- a/default-configs/arm-softmmu.mak -+++ b/default-configs/arm-softmmu.mak -@@ -7,6 +7,7 @@ CONFIG_ISA_MMIO=y - CONFIG_NAND=y - CONFIG_ECC=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PTIMER=y - CONFIG_SD=y - CONFIG_MAX7310=y -diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak -index c2b82de..34c1725 100644 ---- a/default-configs/i386-softmmu.mak -+++ b/default-configs/i386-softmmu.mak -@@ -9,6 +9,7 @@ CONFIG_VGA_CIRRUS=y - CONFIG_VMWARE_VGA=y - CONFIG_VMMOUSE=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PARALLEL=y - CONFIG_I8254=y - CONFIG_PCSPK=y -diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak -index 645908e..b2cc12d 100644 ---- a/default-configs/mips-softmmu.mak -+++ b/default-configs/mips-softmmu.mak -@@ -9,6 +9,7 @@ CONFIG_VGA_ISA_MM=y - CONFIG_VGA_CIRRUS=y - CONFIG_VMWARE_VGA=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PARALLEL=y - CONFIG_I8254=y - CONFIG_PCSPK=y -diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak -index 2ce9fb3..c3b1ee5 100644 ---- a/default-configs/mips64-softmmu.mak -+++ b/default-configs/mips64-softmmu.mak -@@ -9,6 +9,7 @@ CONFIG_VGA_ISA_MM=y - CONFIG_VGA_CIRRUS=y - CONFIG_VMWARE_VGA=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PARALLEL=y - CONFIG_I8254=y - CONFIG_PCSPK=y -diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak -index 0e978e7..b0922c1 100644 ---- a/default-configs/mips64el-softmmu.mak -+++ b/default-configs/mips64el-softmmu.mak -@@ -9,6 +9,7 @@ CONFIG_VGA_ISA_MM=y - CONFIG_VGA_CIRRUS=y - CONFIG_VMWARE_VGA=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PARALLEL=y - CONFIG_I8254=y - CONFIG_PCSPK=y -diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak -index 17cce79..b494ef9 100644 ---- a/default-configs/mipsel-softmmu.mak -+++ b/default-configs/mipsel-softmmu.mak -@@ -9,6 +9,7 @@ CONFIG_VGA_ISA_MM=y - CONFIG_VGA_CIRRUS=y - CONFIG_VMWARE_VGA=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PARALLEL=y - CONFIG_I8254=y - CONFIG_PCSPK=y -diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak -index ca9f50f..6ece4c6 100644 ---- a/default-configs/ppc-softmmu.mak -+++ b/default-configs/ppc-softmmu.mak -@@ -45,5 +45,6 @@ CONFIG_PLATFORM_BUS=y - CONFIG_ETSEC=y - CONFIG_LIBDECNUMBER=y - # For PReP -+CONFIG_SERIAL_ISA=y - CONFIG_MC146818RTC=y - CONFIG_ISA_TESTDEV=y -diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak -index 5a91208..e18d808 100644 ---- a/default-configs/ppc64-softmmu.mak -+++ b/default-configs/ppc64-softmmu.mak -@@ -25,4 +25,5 @@ CONFIG_USB_OHCI=y - CONFIG_XICS=$(CONFIG_PSERIES) - CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) - CONFIG_I8259=y -+CONFIG_SERIAL_ISA=y - CONFIG_ISA_TESTDEV=y -diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak -index 4fc5464..b261e07 100644 ---- a/default-configs/ppcemb-softmmu.mak -+++ b/default-configs/ppcemb-softmmu.mak -@@ -5,6 +5,7 @@ include sound.mak - include usb.mak - CONFIG_M48T59=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_I8257=y - CONFIG_OPENPIC=y - CONFIG_MACIO=y -diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak -index 8e00390..546d855 100644 ---- a/default-configs/sh4-softmmu.mak -+++ b/default-configs/sh4-softmmu.mak -@@ -3,6 +3,7 @@ - include pci.mak - include usb.mak - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PTIMER=y - CONFIG_PFLASH_CFI02=y - CONFIG_SH4=y -diff --git a/default-configs/sh4eb-softmmu.mak b/default-configs/sh4eb-softmmu.mak -index efdd058..2d3fd49 100644 ---- a/default-configs/sh4eb-softmmu.mak -+++ b/default-configs/sh4eb-softmmu.mak -@@ -3,6 +3,7 @@ - include pci.mak - include usb.mak - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PTIMER=y - CONFIG_PFLASH_CFI02=y - CONFIG_SH4=y -diff --git a/default-configs/sparc64-softmmu.mak b/default-configs/sparc64-softmmu.mak -index 123bb99..b79272c 100644 ---- a/default-configs/sparc64-softmmu.mak -+++ b/default-configs/sparc64-softmmu.mak -@@ -6,6 +6,7 @@ CONFIG_ISA_MMIO=y - CONFIG_M48T59=y - CONFIG_PTIMER=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_PARALLEL=y - CONFIG_PCKBD=y - CONFIG_FDC=y -diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak -index f218e06..6f54c49 100644 ---- a/default-configs/x86_64-softmmu.mak -+++ b/default-configs/x86_64-softmmu.mak -@@ -8,6 +8,7 @@ CONFIG_VGA_PCI=y - CONFIG_VGA_CIRRUS=y - CONFIG_VMMOUSE=y - CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y - CONFIG_I8254=y - CONFIG_PCSPK=y - CONFIG_PCKBD=y -diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs -index 5931cc8..be42d2f 100644 ---- a/hw/char/Makefile.objs -+++ b/hw/char/Makefile.objs -@@ -2,7 +2,8 @@ common-obj-$(CONFIG_IPACK) += ipoctal232.o - common-obj-$(CONFIG_ESCC) += escc.o - common-obj-$(CONFIG_PARALLEL) += parallel.o - common-obj-$(CONFIG_PL011) += pl011.o --common-obj-$(CONFIG_SERIAL) += serial.o serial-isa.o -+common-obj-$(CONFIG_SERIAL) += serial.o -+common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o - common-obj-$(CONFIG_SERIAL_PCI) += serial-pci.o - common-obj-$(CONFIG_VIRTIO) += virtio-console.o - common-obj-$(CONFIG_XILINX) += xilinx_uartlite.o --- -1.8.3.1 - diff --git a/SOURCES/kvm-Strip-brackets-from-vnc-host.patch b/SOURCES/kvm-Strip-brackets-from-vnc-host.patch deleted file mode 100644 index b44d1ef..0000000 --- a/SOURCES/kvm-Strip-brackets-from-vnc-host.patch +++ /dev/null @@ -1,59 +0,0 @@ -From f6fc306aa623bcc6ce38668c237273d516c017e7 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Mon, 15 Jun 2015 07:14:18 +0200 -Subject: [PATCH 011/217] Strip brackets from vnc host -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434352458-9252-2-git-send-email-kraxel@redhat.com> -Patchwork-id: 66129 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/1] Strip brackets from vnc host -Bugzilla: 1229073 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Bandan Das <bsd@redhat.com> -RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> - -From: Ján Tomko <jtomko@redhat.com> - -Commit v2.2.0-1530-ge556032 vnc: switch to inet_listen_opts -bypassed the use of inet_parse in inet_listen, making literal -IPv6 addresses enclosed in brackets fail: - -qemu-kvm: -vnc [::1]:0: Failed to start VNC server on `(null)': address -resolution failed for [::1]:5900: Name or service not known - -Strip the brackets to make it work again. - -Signed-off-by: Ján Tomko <jtomko@redhat.com> -Reviewed-by: Eric Blake <eblake@redhat.com> -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 274c3b52e10466a4771d591f6298ef61e8354ce0) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - ui/vnc.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/ui/vnc.c b/ui/vnc.c -index bd6f8a7..14c0037 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -3482,7 +3482,14 @@ void vnc_display_open(const char *id, Error **errp) - - h = strrchr(vnc, ':'); - if (h) { -- char *host = g_strndup(vnc, h - vnc); -+ char *host; -+ size_t hlen = h - vnc; -+ -+ if (vnc[0] == '[' && vnc[hlen - 1] == ']') { -+ host = g_strndup(vnc + 1, hlen - 2); -+ } else { -+ host = g_strndup(vnc, hlen); -+ } - qemu_opt_set(sopts, "host", host, &error_abort); - qemu_opt_set(wsopts, "host", host, &error_abort); - qemu_opt_set(sopts, "port", h+1, &error_abort); --- -1.8.3.1 - diff --git a/SOURCES/kvm-Switch-non-CPU-callers-from-ld-st-_phys-to-address_s.patch b/SOURCES/kvm-Switch-non-CPU-callers-from-ld-st-_phys-to-address_s.patch deleted file mode 100644 index fc27c8c..0000000 --- a/SOURCES/kvm-Switch-non-CPU-callers-from-ld-st-_phys-to-address_s.patch +++ /dev/null @@ -1,797 +0,0 @@ -From 7747e2c4dcbd948be5c392f11c45a8d90fbf44ed Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:17 +0200 -Subject: [PATCH 129/217] Switch non-CPU callers from ld/st*_phys to - address_space_ld/st* -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-15-git-send-email-jasowang@redhat.com> -Patchwork-id: 66790 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 14/68] Switch non-CPU callers from ld/st*_phys to address_space_ld/st* -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Notes: conflicts since commit 8dfbaa6ac450c4ec2646b1ca08a4017052a90c1d - ("virtio-ccw: introduce ccw specific queue limit") was - backported before this commit. - -Switch all the uses of ld/st*_phys to address_space_ld/st*, -except for those cases where the address space is the CPU's -(ie cs->as). This was done with the following script which -generates a Coccinelle patch. - -A few over-80-columns lines in the result were rewrapped by -hand where Coccinelle failed to do the wrapping automatically, -as well as one location where it didn't put a line-continuation -'\' when wrapping lines on a change made to a match inside -a macro definition. - -===begin=== -#!/bin/sh -e -# Usage: -# ./ldst-phys.spatch.sh > ldst-phys.spatch -# spatch -sp_file ldst-phys.spatch -dir . | sed -e '/^+/s/\t/ /g' > out.patch -# patch -p1 < out.patch - -for FN in ub uw_le uw_be l_le l_be q_le q_be uw l q; do -cat <<EOF -@ cpu_matches_ld_${FN} @ -expression E1,E2; -identifier as; -@@ - -ld${FN}_phys(E1->as,E2) - -@ other_matches_ld_${FN} depends on !cpu_matches_ld_${FN} @ -expression E1,E2; -@@ - --ld${FN}_phys(E1,E2) -+address_space_ld${FN}(E1,E2, MEMTXATTRS_UNSPECIFIED, NULL) - -EOF - -done - -for FN in b w_le w_be l_le l_be q_le q_be w l q; do -cat <<EOF -@ cpu_matches_st_${FN} @ -expression E1,E2,E3; -identifier as; -@@ - -st${FN}_phys(E1->as,E2,E3) - -@ other_matches_st_${FN} depends on !cpu_matches_st_${FN} @ -expression E1,E2,E3; -@@ - --st${FN}_phys(E1,E2,E3) -+address_space_st${FN}(E1,E2,E3, MEMTXATTRS_UNSPECIFIED, NULL) - -EOF - -done -===endit=== - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit 42874d3a8c6267ff7789a0396843c884b1d0933a) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/s390x/virtio-ccw.c ---- - hw/alpha/dp264.c | 9 ++-- - hw/alpha/typhoon.c | 3 +- - hw/arm/boot.c | 6 ++- - hw/arm/highbank.c | 12 ++++-- - hw/dma/pl080.c | 20 +++++++-- - hw/dma/sun4m_iommu.c | 3 +- - hw/i386/intel_iommu.c | 3 +- - hw/pci-host/apb.c | 3 +- - hw/pci/msi.c | 3 +- - hw/pci/msix.c | 3 +- - hw/s390x/css.c | 19 ++++++--- - hw/s390x/s390-pci-bus.c | 9 ++-- - hw/s390x/s390-virtio-bus.c | 73 +++++++++++++++++++++----------- - hw/s390x/s390-virtio.c | 4 +- - hw/s390x/virtio-ccw.c | 87 +++++++++++++++++++++++++++------------ - hw/sh4/r2d.c | 6 ++- - hw/timer/hpet.c | 5 ++- - monitor.c | 3 +- - target-i386/arch_memory_mapping.c | 15 +++---- - 19 files changed, 195 insertions(+), 91 deletions(-) - -diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c -index e82d61d..9fe7e8b 100644 ---- a/hw/alpha/dp264.c -+++ b/hw/alpha/dp264.c -@@ -157,9 +157,12 @@ static void clipper_init(MachineState *machine) - load_image_targphys(initrd_filename, initrd_base, - ram_size - initrd_base); - -- stq_phys(&address_space_memory, -- param_offset + 0x100, initrd_base + 0xfffffc0000000000ULL); -- stq_phys(&address_space_memory, param_offset + 0x108, initrd_size); -+ address_space_stq(&address_space_memory, param_offset + 0x100, -+ initrd_base + 0xfffffc0000000000ULL, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ address_space_stq(&address_space_memory, param_offset + 0x108, -+ initrd_size, MEMTXATTRS_UNSPECIFIED, NULL); - } - } - } -diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c -index a6044f2..7df842d 100644 ---- a/hw/alpha/typhoon.c -+++ b/hw/alpha/typhoon.c -@@ -613,7 +613,8 @@ static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, IOMMUTLBEntry *ret) - translation, given the address of the PTE. */ - static bool pte_translate(hwaddr pte_addr, IOMMUTLBEntry *ret) - { -- uint64_t pte = ldq_phys(&address_space_memory, pte_addr); -+ uint64_t pte = address_space_ldq(&address_space_memory, pte_addr, -+ MEMTXATTRS_UNSPECIFIED, NULL); - - /* Check valid bit. */ - if ((pte & 1) == 0) { -diff --git a/hw/arm/boot.c b/hw/arm/boot.c -index a48d1b2..fa69503 100644 ---- a/hw/arm/boot.c -+++ b/hw/arm/boot.c -@@ -170,7 +170,8 @@ static void default_reset_secondary(ARMCPU *cpu, - { - CPUARMState *env = &cpu->env; - -- stl_phys_notdirty(&address_space_memory, info->smp_bootreg_addr, 0); -+ address_space_stl_notdirty(&address_space_memory, info->smp_bootreg_addr, -+ 0, MEMTXATTRS_UNSPECIFIED, NULL); - env->regs[15] = info->smp_loader_start; - } - -@@ -180,7 +181,8 @@ static inline bool have_dtb(const struct arm_boot_info *info) - } - - #define WRITE_WORD(p, value) do { \ -- stl_phys_notdirty(&address_space_memory, p, value); \ -+ address_space_stl_notdirty(&address_space_memory, p, value, \ -+ MEMTXATTRS_UNSPECIFIED, NULL); \ - p += 4; \ - } while (0) - -diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c -index dd2a67b..b2d048b 100644 ---- a/hw/arm/highbank.c -+++ b/hw/arm/highbank.c -@@ -69,11 +69,17 @@ static void hb_reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info) - - switch (info->nb_cpus) { - case 4: -- stl_phys_notdirty(&address_space_memory, SMP_BOOT_REG + 0x30, 0); -+ address_space_stl_notdirty(&address_space_memory, -+ SMP_BOOT_REG + 0x30, 0, -+ MEMTXATTRS_UNSPECIFIED, NULL); - case 3: -- stl_phys_notdirty(&address_space_memory, SMP_BOOT_REG + 0x20, 0); -+ address_space_stl_notdirty(&address_space_memory, -+ SMP_BOOT_REG + 0x20, 0, -+ MEMTXATTRS_UNSPECIFIED, NULL); - case 2: -- stl_phys_notdirty(&address_space_memory, SMP_BOOT_REG + 0x10, 0); -+ address_space_stl_notdirty(&address_space_memory, -+ SMP_BOOT_REG + 0x10, 0, -+ MEMTXATTRS_UNSPECIFIED, NULL); - env->regs[15] = SMP_BOOT_ADDR; - break; - default: -diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c -index 741dd20..b89b474 100644 ---- a/hw/dma/pl080.c -+++ b/hw/dma/pl080.c -@@ -205,10 +205,22 @@ again: - if (size == 0) { - /* Transfer complete. */ - if (ch->lli) { -- ch->src = ldl_le_phys(&address_space_memory, ch->lli); -- ch->dest = ldl_le_phys(&address_space_memory, ch->lli + 4); -- ch->ctrl = ldl_le_phys(&address_space_memory, ch->lli + 12); -- ch->lli = ldl_le_phys(&address_space_memory, ch->lli + 8); -+ ch->src = address_space_ldl_le(&address_space_memory, -+ ch->lli, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ ch->dest = address_space_ldl_le(&address_space_memory, -+ ch->lli + 4, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ ch->ctrl = address_space_ldl_le(&address_space_memory, -+ ch->lli + 12, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ ch->lli = address_space_ldl_le(&address_space_memory, -+ ch->lli + 8, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - } else { - ch->conf &= ~PL080_CCONF_E; - } -diff --git a/hw/dma/sun4m_iommu.c b/hw/dma/sun4m_iommu.c -index ec7c2ef..9a488bc 100644 ---- a/hw/dma/sun4m_iommu.c -+++ b/hw/dma/sun4m_iommu.c -@@ -263,7 +263,8 @@ static uint32_t iommu_page_get_flags(IOMMUState *s, hwaddr addr) - iopte = s->regs[IOMMU_BASE] << 4; - addr &= ~s->iostart; - iopte += (addr >> (IOMMU_PAGE_SHIFT - 2)) & ~3; -- ret = ldl_be_phys(&address_space_memory, iopte); -+ ret = address_space_ldl_be(&address_space_memory, iopte, -+ MEMTXATTRS_UNSPECIFIED, NULL); - trace_sun4m_iommu_page_get_flags(pa, iopte, ret); - return ret; - } -diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c -index 7da70ff..08055a8 100644 ---- a/hw/i386/intel_iommu.c -+++ b/hw/i386/intel_iommu.c -@@ -246,7 +246,8 @@ static void vtd_generate_interrupt(IntelIOMMUState *s, hwaddr mesg_addr_reg, - data = vtd_get_long_raw(s, mesg_data_reg); - - VTD_DPRINTF(FLOG, "msi: addr 0x%"PRIx64 " data 0x%"PRIx32, addr, data); -- stl_le_phys(&address_space_memory, addr, data); -+ address_space_stl_le(&address_space_memory, addr, data, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* Generate a fault event to software via MSI if conditions are met. -diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c -index 312fa70..599768e 100644 ---- a/hw/pci-host/apb.c -+++ b/hw/pci-host/apb.c -@@ -289,7 +289,8 @@ static IOMMUTLBEntry pbm_translate_iommu(MemoryRegion *iommu, hwaddr addr, - } - } - -- tte = ldq_be_phys(&address_space_memory, baseaddr + offset); -+ tte = address_space_ldq_be(&address_space_memory, baseaddr + offset, -+ MEMTXATTRS_UNSPECIFIED, NULL); - - if (!(tte & IOMMU_TTE_DATA_V)) { - /* Invalid mapping */ -diff --git a/hw/pci/msi.c b/hw/pci/msi.c -index 52d2313..916e1a1 100644 ---- a/hw/pci/msi.c -+++ b/hw/pci/msi.c -@@ -291,7 +291,8 @@ void msi_notify(PCIDevice *dev, unsigned int vector) - "notify vector 0x%x" - " address: 0x%"PRIx64" data: 0x%"PRIx32"\n", - vector, msg.address, msg.data); -- stl_le_phys(&dev->bus_master_as, msg.address, msg.data); -+ address_space_stl_le(&dev->bus_master_as, msg.address, msg.data, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* Normally called by pci_default_write_config(). */ -diff --git a/hw/pci/msix.c b/hw/pci/msix.c -index f8748cf..9935f98 100644 ---- a/hw/pci/msix.c -+++ b/hw/pci/msix.c -@@ -443,7 +443,8 @@ void msix_notify(PCIDevice *dev, unsigned vector) - - msg = msix_get_message(dev, vector); - -- stl_le_phys(&dev->bus_master_as, msg.address, msg.data); -+ address_space_stl_le(&dev->bus_master_as, msg.address, msg.data, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } - - void msix_reset(PCIDevice *dev) -diff --git a/hw/s390x/css.c b/hw/s390x/css.c -index 9a13b00..5561d80 100644 ---- a/hw/s390x/css.c -+++ b/hw/s390x/css.c -@@ -745,20 +745,27 @@ static void css_update_chnmon(SubchDev *sch) - /* Format 1, per-subchannel area. */ - uint32_t count; - -- count = ldl_phys(&address_space_memory, sch->curr_status.mba); -+ count = address_space_ldl(&address_space_memory, -+ sch->curr_status.mba, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - count++; -- stl_phys(&address_space_memory, sch->curr_status.mba, count); -+ address_space_stl(&address_space_memory, sch->curr_status.mba, count, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } else { - /* Format 0, global area. */ - uint32_t offset; - uint16_t count; - - offset = sch->curr_status.pmcw.mbi << 5; -- count = lduw_phys(&address_space_memory, -- channel_subsys->chnmon_area + offset); -+ count = address_space_lduw(&address_space_memory, -+ channel_subsys->chnmon_area + offset, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - count++; -- stw_phys(&address_space_memory, -- channel_subsys->chnmon_area + offset, count); -+ address_space_stw(&address_space_memory, -+ channel_subsys->chnmon_area + offset, count, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } - } - -diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c -index 3c086f6..560b66a 100644 ---- a/hw/s390x/s390-pci-bus.c -+++ b/hw/s390x/s390-pci-bus.c -@@ -278,7 +278,8 @@ static uint64_t s390_guest_io_table_walk(uint64_t guest_iota, - px = calc_px(guest_dma_address); - - sto_a = guest_iota + rtx * sizeof(uint64_t); -- sto = ldq_phys(&address_space_memory, sto_a); -+ sto = address_space_ldq(&address_space_memory, sto_a, -+ MEMTXATTRS_UNSPECIFIED, NULL); - sto = get_rt_sto(sto); - if (!sto) { - pte = 0; -@@ -286,7 +287,8 @@ static uint64_t s390_guest_io_table_walk(uint64_t guest_iota, - } - - pto_a = sto + sx * sizeof(uint64_t); -- pto = ldq_phys(&address_space_memory, pto_a); -+ pto = address_space_ldq(&address_space_memory, pto_a, -+ MEMTXATTRS_UNSPECIFIED, NULL); - pto = get_st_pto(pto); - if (!pto) { - pte = 0; -@@ -294,7 +296,8 @@ static uint64_t s390_guest_io_table_walk(uint64_t guest_iota, - } - - px_a = pto + px * sizeof(uint64_t); -- pte = ldq_phys(&address_space_memory, px_a); -+ pte = address_space_ldq(&address_space_memory, px_a, -+ MEMTXATTRS_UNSPECIFIED, NULL); - - out: - return pte; -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index 04ed89f..5a96ecc 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -77,10 +77,12 @@ void s390_virtio_reset_idx(VirtIOS390Device *dev) - for (i = 0; i < num_vq; i++) { - idx_addr = virtio_queue_get_avail_addr(dev->vdev, i) + - VIRTIO_VRING_AVAIL_IDX_OFFS; -- stw_phys(&address_space_memory, idx_addr, 0); -+ address_space_stw(&address_space_memory, idx_addr, 0, -+ MEMTXATTRS_UNSPECIFIED, NULL); - idx_addr = virtio_queue_get_used_addr(dev->vdev, i) + - VIRTIO_VRING_USED_IDX_OFFS; -- stw_phys(&address_space_memory, idx_addr, 0); -+ address_space_stw(&address_space_memory, idx_addr, 0, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } - } - -@@ -337,7 +339,8 @@ static uint64_t s390_virtio_device_vq_token(VirtIOS390Device *dev, int vq) - (vq * VIRTIO_VQCONFIG_LEN) + - VIRTIO_VQCONFIG_OFFS_TOKEN; - -- return ldq_be_phys(&address_space_memory, token_off); -+ return address_space_ldq_be(&address_space_memory, token_off, -+ MEMTXATTRS_UNSPECIFIED, NULL); - } - - static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev) -@@ -372,21 +375,33 @@ void s390_virtio_device_sync(VirtIOS390Device *dev) - virtio_reset(dev->vdev); - - /* Sync dev space */ -- stb_phys(&address_space_memory, -- dev->dev_offs + VIRTIO_DEV_OFFS_TYPE, dev->vdev->device_id); -- -- stb_phys(&address_space_memory, -- dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, -- s390_virtio_device_num_vq(dev)); -- stb_phys(&address_space_memory, -- dev->dev_offs + VIRTIO_DEV_OFFS_FEATURE_LEN, dev->feat_len); -- -- stb_phys(&address_space_memory, -- dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG_LEN, dev->vdev->config_len); -+ address_space_stb(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_TYPE, -+ dev->vdev->device_id, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ -+ address_space_stb(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, -+ s390_virtio_device_num_vq(dev), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ address_space_stb(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_FEATURE_LEN, -+ dev->feat_len, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ -+ address_space_stb(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG_LEN, -+ dev->vdev->config_len, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - - num_vq = s390_virtio_device_num_vq(dev); -- stb_phys(&address_space_memory, -- dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, num_vq); -+ address_space_stb(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, num_vq, -+ MEMTXATTRS_UNSPECIFIED, NULL); - - /* Sync virtqueues */ - for (i = 0; i < num_vq; i++) { -@@ -397,11 +412,14 @@ void s390_virtio_device_sync(VirtIOS390Device *dev) - vring = s390_virtio_next_ring(bus); - virtio_queue_set_addr(dev->vdev, i, vring); - virtio_queue_set_vector(dev->vdev, i, i); -- stq_be_phys(&address_space_memory, -- vq + VIRTIO_VQCONFIG_OFFS_ADDRESS, vring); -- stw_be_phys(&address_space_memory, -- vq + VIRTIO_VQCONFIG_OFFS_NUM, -- virtio_queue_get_num(dev->vdev, i)); -+ address_space_stq_be(&address_space_memory, -+ vq + VIRTIO_VQCONFIG_OFFS_ADDRESS, vring, -+ MEMTXATTRS_UNSPECIFIED, NULL); -+ address_space_stw_be(&address_space_memory, -+ vq + VIRTIO_VQCONFIG_OFFS_NUM, -+ virtio_queue_get_num(dev->vdev, i), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - } - - cur_offs = dev->dev_offs; -@@ -409,7 +427,8 @@ void s390_virtio_device_sync(VirtIOS390Device *dev) - cur_offs += num_vq * VIRTIO_VQCONFIG_LEN; - - /* Sync feature bitmap */ -- stl_le_phys(&address_space_memory, cur_offs, dev->host_features); -+ address_space_stl_le(&address_space_memory, cur_offs, dev->host_features, -+ MEMTXATTRS_UNSPECIFIED, NULL); - - dev->feat_offs = cur_offs + dev->feat_len; - cur_offs += dev->feat_len * 2; -@@ -427,12 +446,16 @@ void s390_virtio_device_update_status(VirtIOS390Device *dev) - VirtIODevice *vdev = dev->vdev; - uint32_t features; - -- virtio_set_status(vdev, ldub_phys(&address_space_memory, -- dev->dev_offs + VIRTIO_DEV_OFFS_STATUS)); -+ virtio_set_status(vdev, -+ address_space_ldub(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, -+ MEMTXATTRS_UNSPECIFIED, NULL)); - - /* Update guest supported feature bitmap */ - -- features = bswap32(ldl_be_phys(&address_space_memory, dev->feat_offs)); -+ features = bswap32(address_space_ldl_be(&address_space_memory, -+ dev->feat_offs, -+ MEMTXATTRS_UNSPECIFIED, NULL)); - virtio_set_features(vdev, features); - } - -diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c -index bdb5388..3a1b9ee 100644 ---- a/hw/s390x/s390-virtio.c -+++ b/hw/s390x/s390-virtio.c -@@ -97,7 +97,9 @@ static int s390_virtio_hcall_reset(const uint64_t *args) - return -EINVAL; - } - virtio_reset(dev->vdev); -- stb_phys(&address_space_memory, dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, 0); -+ address_space_stb(&address_space_memory, -+ dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, 0, -+ MEMTXATTRS_UNSPECIFIED, NULL); - s390_virtio_device_sync(dev); - s390_virtio_reset_idx(dev); - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index e15e2b3..18fc697 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -335,16 +335,23 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- info.queue = ldq_phys(&address_space_memory, ccw.cda); -- info.align = ldl_phys(&address_space_memory, -- ccw.cda + sizeof(info.queue)); -- info.index = lduw_phys(&address_space_memory, -- ccw.cda + sizeof(info.queue) -- + sizeof(info.align)); -- info.num = lduw_phys(&address_space_memory, -- ccw.cda + sizeof(info.queue) -- + sizeof(info.align) -- + sizeof(info.index)); -+ info.queue = address_space_ldq(&address_space_memory, ccw.cda, -+ MEMTXATTRS_UNSPECIFIED, NULL); -+ info.align = address_space_ldl(&address_space_memory, -+ ccw.cda + sizeof(info.queue), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ info.index = address_space_lduw(&address_space_memory, -+ ccw.cda + sizeof(info.queue) -+ + sizeof(info.align), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ info.num = address_space_lduw(&address_space_memory, -+ ccw.cda + sizeof(info.queue) -+ + sizeof(info.align) -+ + sizeof(info.index), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - ret = virtio_ccw_set_vqs(sch, info.queue, info.align, info.index, - info.num); - sch->curr_status.scsw.count = 0; -@@ -369,15 +376,20 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- features.index = ldub_phys(&address_space_memory, -- ccw.cda + sizeof(features.features)); -+ features.index = address_space_ldub(&address_space_memory, -+ ccw.cda -+ + sizeof(features.features), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - if (features.index < ARRAY_SIZE(dev->host_features)) { - features.features = dev->host_features[features.index]; - } else { - /* Return zeroes if the guest supports more feature bits. */ - features.features = 0; - } -- stl_le_phys(&address_space_memory, ccw.cda, features.features); -+ address_space_stl_le(&address_space_memory, ccw.cda, -+ features.features, MEMTXATTRS_UNSPECIFIED, -+ NULL); - sch->curr_status.scsw.count = ccw.count - sizeof(features); - ret = 0; - } -@@ -396,9 +408,15 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- features.index = ldub_phys(&address_space_memory, -- ccw.cda + sizeof(features.features)); -- features.features = ldl_le_phys(&address_space_memory, ccw.cda); -+ features.index = address_space_ldub(&address_space_memory, -+ ccw.cda -+ + sizeof(features.features), -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); -+ features.features = address_space_ldl_le(&address_space_memory, -+ ccw.cda, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - if (features.index < ARRAY_SIZE(dev->host_features)) { - virtio_set_features(vdev, features.features); - } else { -@@ -474,7 +492,8 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- status = ldub_phys(&address_space_memory, ccw.cda); -+ status = address_space_ldub(&address_space_memory, ccw.cda, -+ MEMTXATTRS_UNSPECIFIED, NULL); - if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { - virtio_ccw_stop_ioeventfd(dev); - } -@@ -508,7 +527,8 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- indicators = ldq_be_phys(&address_space_memory, ccw.cda); -+ indicators = address_space_ldq_be(&address_space_memory, ccw.cda, -+ MEMTXATTRS_UNSPECIFIED, NULL); - dev->indicators = get_indicator(indicators, sizeof(uint64_t)); - sch->curr_status.scsw.count = ccw.count - sizeof(indicators); - ret = 0; -@@ -528,7 +548,8 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- indicators = ldq_be_phys(&address_space_memory, ccw.cda); -+ indicators = address_space_ldq_be(&address_space_memory, ccw.cda, -+ MEMTXATTRS_UNSPECIFIED, NULL); - dev->indicators2 = get_indicator(indicators, sizeof(uint64_t)); - sch->curr_status.scsw.count = ccw.count - sizeof(indicators); - ret = 0; -@@ -548,15 +569,21 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!ccw.cda) { - ret = -EFAULT; - } else { -- vq_config.index = lduw_be_phys(&address_space_memory, ccw.cda); -+ vq_config.index = address_space_lduw_be(&address_space_memory, -+ ccw.cda, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - if (vq_config.index >= VIRTIO_CCW_QUEUE_MAX) { - ret = -EINVAL; - break; - } - vq_config.num_max = virtio_queue_get_num(vdev, - vq_config.index); -- stw_be_phys(&address_space_memory, -- ccw.cda + sizeof(vq_config.index), vq_config.num_max); -+ address_space_stw_be(&address_space_memory, -+ ccw.cda + sizeof(vq_config.index), -+ vq_config.num_max, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - sch->curr_status.scsw.count = ccw.count - sizeof(vq_config); - ret = 0; - } -@@ -1046,9 +1073,13 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) - css_adapter_interrupt(dev->thinint_isc); - } - } else { -- indicators = ldq_phys(&address_space_memory, dev->indicators->addr); -+ indicators = address_space_ldq(&address_space_memory, -+ dev->indicators->addr, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - indicators |= 1ULL << vector; -- stq_phys(&address_space_memory, dev->indicators->addr, indicators); -+ address_space_stq(&address_space_memory, dev->indicators->addr, -+ indicators, MEMTXATTRS_UNSPECIFIED, NULL); - css_conditional_io_interrupt(sch); - } - } else { -@@ -1056,9 +1087,13 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) - return; - } - vector = 0; -- indicators = ldq_phys(&address_space_memory, dev->indicators2->addr); -+ indicators = address_space_ldq(&address_space_memory, -+ dev->indicators2->addr, -+ MEMTXATTRS_UNSPECIFIED, -+ NULL); - indicators |= 1ULL << vector; -- stq_phys(&address_space_memory, dev->indicators2->addr, indicators); -+ address_space_stq(&address_space_memory, dev->indicators2->addr, -+ indicators, MEMTXATTRS_UNSPECIFIED, NULL); - css_conditional_io_interrupt(sch); - } - } -diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c -index d1d0847..4221060 100644 ---- a/hw/sh4/r2d.c -+++ b/hw/sh4/r2d.c -@@ -318,8 +318,10 @@ static void r2d_init(MachineState *machine) - } - - /* initialization which should be done by firmware */ -- stl_phys(&address_space_memory, SH7750_BCR1, 1<<3); /* cs3 SDRAM */ -- stw_phys(&address_space_memory, SH7750_BCR2, 3<<(3*2)); /* cs3 32bit */ -+ address_space_stl(&address_space_memory, SH7750_BCR1, 1 << 3, -+ MEMTXATTRS_UNSPECIFIED, NULL); /* cs3 SDRAM */ -+ address_space_stw(&address_space_memory, SH7750_BCR2, 3 << (3 * 2), -+ MEMTXATTRS_UNSPECIFIED, NULL); /* cs3 32bit */ - reset_info->vector = (SDRAM_BASE + LINUX_LOAD_OFFSET) | 0xa0000000; /* Start from P2 area */ - } - -diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c -index 78d86be..b6b8a20 100644 ---- a/hw/timer/hpet.c -+++ b/hw/timer/hpet.c -@@ -206,8 +206,9 @@ static void update_irq(struct HPETTimer *timer, int set) - } - } - } else if (timer_fsb_route(timer)) { -- stl_le_phys(&address_space_memory, -- timer->fsb >> 32, timer->fsb & 0xffffffff); -+ address_space_stl_le(&address_space_memory, timer->fsb >> 32, -+ timer->fsb & 0xffffffff, MEMTXATTRS_UNSPECIFIED, -+ NULL); - } else if (timer->config & HPET_TN_TYPE_LEVEL) { - s->isr |= mask; - /* fold the ICH PIRQ# pin's internal inversion logic into hpet */ -diff --git a/monitor.c b/monitor.c -index 060248a..9aaae88 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -1385,7 +1385,8 @@ static void hmp_sum(Monitor *mon, const QDict *qdict) - - sum = 0; - for(addr = start; addr < (start + size); addr++) { -- uint8_t val = ldub_phys(&address_space_memory, addr); -+ uint8_t val = address_space_ldub(&address_space_memory, addr, -+ MEMTXATTRS_UNSPECIFIED, NULL); - /* BSD sum algorithm ('sum' Unix command) */ - sum = (sum >> 1) | (sum << 15); - sum += val; -diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c -index 2d35f63..01563fe 100644 ---- a/target-i386/arch_memory_mapping.c -+++ b/target-i386/arch_memory_mapping.c -@@ -27,7 +27,7 @@ static void walk_pte(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 512; i++) { - pte_addr = (pte_start_addr + i * 8) & a20_mask; -- pte = ldq_phys(as, pte_addr); -+ pte = address_space_ldq(as, pte_addr, MEMTXATTRS_UNSPECIFIED, NULL); - if (!(pte & PG_PRESENT_MASK)) { - /* not present */ - continue; -@@ -57,7 +57,7 @@ static void walk_pte2(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 1024; i++) { - pte_addr = (pte_start_addr + i * 4) & a20_mask; -- pte = ldl_phys(as, pte_addr); -+ pte = address_space_ldl(as, pte_addr, MEMTXATTRS_UNSPECIFIED, NULL); - if (!(pte & PG_PRESENT_MASK)) { - /* not present */ - continue; -@@ -89,7 +89,7 @@ static void walk_pde(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 512; i++) { - pde_addr = (pde_start_addr + i * 8) & a20_mask; -- pde = ldq_phys(as, pde_addr); -+ pde = address_space_ldq(as, pde_addr, MEMTXATTRS_UNSPECIFIED, NULL); - if (!(pde & PG_PRESENT_MASK)) { - /* not present */ - continue; -@@ -126,7 +126,7 @@ static void walk_pde2(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 1024; i++) { - pde_addr = (pde_start_addr + i * 4) & a20_mask; -- pde = ldl_phys(as, pde_addr); -+ pde = address_space_ldl(as, pde_addr, MEMTXATTRS_UNSPECIFIED, NULL); - if (!(pde & PG_PRESENT_MASK)) { - /* not present */ - continue; -@@ -167,7 +167,7 @@ static void walk_pdpe2(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 4; i++) { - pdpe_addr = (pdpe_start_addr + i * 8) & a20_mask; -- pdpe = ldq_phys(as, pdpe_addr); -+ pdpe = address_space_ldq(as, pdpe_addr, MEMTXATTRS_UNSPECIFIED, NULL); - if (!(pdpe & PG_PRESENT_MASK)) { - /* not present */ - continue; -@@ -192,7 +192,7 @@ static void walk_pdpe(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 512; i++) { - pdpe_addr = (pdpe_start_addr + i * 8) & a20_mask; -- pdpe = ldq_phys(as, pdpe_addr); -+ pdpe = address_space_ldq(as, pdpe_addr, MEMTXATTRS_UNSPECIFIED, NULL); - if (!(pdpe & PG_PRESENT_MASK)) { - /* not present */ - continue; -@@ -228,7 +228,8 @@ static void walk_pml4e(MemoryMappingList *list, AddressSpace *as, - - for (i = 0; i < 512; i++) { - pml4e_addr = (pml4e_start_addr + i * 8) & a20_mask; -- pml4e = ldq_phys(as, pml4e_addr); -+ pml4e = address_space_ldq(as, pml4e_addr, MEMTXATTRS_UNSPECIFIED, -+ NULL); - if (!(pml4e & PG_PRESENT_MASK)) { - /* not present */ - continue; --- -1.8.3.1 - diff --git a/SOURCES/kvm-__com-redhat_qxl_screendump-add-docs.patch b/SOURCES/kvm-__com-redhat_qxl_screendump-add-docs.patch deleted file mode 100644 index 430b8ef..0000000 --- a/SOURCES/kvm-__com-redhat_qxl_screendump-add-docs.patch +++ /dev/null @@ -1,87 +0,0 @@ -From d242b46a7c2ac6ff68dfc257cb779b9df793ea39 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Wed, 11 Dec 2013 09:36:11 +0100 -Subject: __com.redhat_qxl_screendump: add docs - -RH-Author: Gerd Hoffmann <kraxel@redhat.com> -Message-id: <1386754571-21520-2-git-send-email-kraxel@redhat.com> -Patchwork-id: 56149 -O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] __com.redhat_qxl_screendump: add docs -Bugzilla: 903910 -RH-Acked-by: Markus Armbruster <armbru@redhat.com> -RH-Acked-by: Orit Wasserman <owasserm@redhat.com> -RH-Acked-by: Juan Quintela <quintela@redhat.com> - -$subject says all. -Patch by armbru, thanks. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> - -diff --git a/hmp-commands.hx b/hmp-commands.hx -index 5224b6b..2697fa9 100644 ---- a/hmp-commands.hx -+++ b/hmp-commands.hx -@@ -245,6 +245,13 @@ ETEXI - .help = "save screen into PPM image 'filename'", - .mhandler.cmd = hmp_screendump, - }, -+ -+STEXI -+@item screendump @var{filename} -+@findex screendump -+Save screen into PPM image @var{filename}. -+ETEXI -+ - { - .name = "__com.redhat_qxl_screendump", - .args_type = "id:s,filename:F", -@@ -254,9 +261,9 @@ ETEXI - }, - - STEXI --@item screendump @var{filename} --@findex screendump --Save screen into PPM image @var{filename}. -+@item __com.redhat_screendump @var{id} @var{filename} -+@findex __com.redhat_screendump -+Save screen from qxl device @var{id} into PPM image @var{filename}. - ETEXI - - { -diff --git a/qmp-commands.hx b/qmp-commands.hx -index a40dd7d..4abb90d 100644 ---- a/qmp-commands.hx -+++ b/qmp-commands.hx -@@ -231,11 +231,6 @@ EQMP - .args_type = "filename:F", - .mhandler.cmd_new = qmp_marshal_input_screendump, - }, -- { -- .name = "__com.redhat_qxl_screendump", -- .args_type = "id:s,filename:F", -- .mhandler.cmd_new = qmp_marshal_input___com_redhat_qxl_screendump, -- }, - - SQMP - screendump -@@ -255,6 +250,20 @@ Example: - EQMP - - { -+ .name = "__com.redhat_qxl_screendump", -+ .args_type = "id:s,filename:F", -+ .mhandler.cmd_new = qmp_marshal_input___com_redhat_qxl_screendump, -+ }, -+ -+SQMP -+__com.redhat_qxl_screendump -+--------------------------- -+ -+Save screen from qxl device @var{id} into PPM image @var{filename}. -+ -+EQMP -+ -+ { - .name = "stop", - .args_type = "", - .mhandler.cmd_new = qmp_marshal_input_stop, diff --git a/SOURCES/kvm-aarch64-allow-enable-seccomp.patch b/SOURCES/kvm-aarch64-allow-enable-seccomp.patch deleted file mode 100644 index c569ddc..0000000 --- a/SOURCES/kvm-aarch64-allow-enable-seccomp.patch +++ /dev/null @@ -1,68 +0,0 @@ -From ffde963f2cef76ae0b1bff475e970422ebd41c8a Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Thu, 2 Jul 2015 13:43:57 +0200 -Subject: [PATCH 184/217] aarch64: allow --enable-seccomp - -Message-id: <1435844638-28460-2-git-send-email-drjones@redhat.com> -Patchwork-id: 66606 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 1/2] aarch64: allow --enable-seccomp -Bugzilla: 1174861 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Jeff Nelson <jenelson@redhat.com> - -RHEL-only - -This is a few character patch that needs a long commit message -to explain why it's downstream only. So, here we go... - -Once upon a time arm and aarch64 builds were allowed to use ---enable-seccomp, but a problem with arm builds resulted in -upstream commit ae6e8ef11e6c: "Revert seccomp tests that allow -it to be used on non-x86 architectures". Now, the only way to -revert that revert is to get the seccomp whitelist working -for all architectures that have libseccomp, which means arm, -aarch64, and even mips and mips64 (but nobody mentioned mips -upstream yet, so shh...) For arm, we needed to patch libseccomp -and qemu to get things working. That's done now, but it'll be -a while before we have upstream commit hashes to reference, and, -even if we did, RHELSA wouldn't have a late enough libseccomp in -its compose to pass the atleast-version test in qemu's configure, -since that version will be bumped to the one containing the -libseccomp patch for arm, thus we'd need a downstream-only patch -anyway. - -Now, we want to turn libseccomp on for the obvious security reasons, -and also because the sooner we run with it on, the sooner we'll find -bugs with it on. - -Oh, and we actually don't have to worry about the atleast-version, -which is currently is in configure, even though it's old. This is -because this patch is for building RHELSA's qemu-kvm-rhev, which is -only for RHELSA, and the earliest libseccomp version installable on -RHELSA is late enough. - -The end. - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure b/configure -index bebae4c..f054934 100755 ---- a/configure -+++ b/configure -@@ -1857,7 +1857,7 @@ fi - # libseccomp check - - if test "$seccomp" != "no" ; then -- if test "$cpu" = "i386" || test "$cpu" = "x86_64" && -+ if test "$cpu" = "i386" || test "$cpu" = "x86_64" || test "$cpu" = "aarch64" && - $pkg_config --atleast-version=2.1.1 libseccomp; then - libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`" - QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`" --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-Simplify-printing-to-dynamic-string.patch b/SOURCES/kvm-acpi-Simplify-printing-to-dynamic-string.patch deleted file mode 100644 index d65bd93..0000000 --- a/SOURCES/kvm-acpi-Simplify-printing-to-dynamic-string.patch +++ /dev/null @@ -1,105 +0,0 @@ -From c9cedcc1f34103e60ec5590698208384cfd956e3 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:11 +0200 -Subject: [PATCH 189/217] acpi: Simplify printing to dynamic string - -Message-id: <1435154016-26233-19-git-send-email-marcel@redhat.com> -Patchwork-id: 66446 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 18/43] acpi: Simplify printing to dynamic string -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Markus Armbruster <armbru@redhat.com> - -build_append_namestringv() and aml_string() first calculate the -resulting string's length with vsnprintf(NULL, ...), then allocate, -then print for real. Simply use g_strdup_vprintf() or g_vasprintf() -instead. - -Signed-off-by: Markus Armbruster <armbru@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: John Snow <jsnow@redhat.com> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -(cherry picked from commit c3bdc56c183f6ca6baa502bd7861583ca98b333b) -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 27 +++++---------------------- - 1 file changed, 5 insertions(+), 22 deletions(-) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 9efef70..709ddc3 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -19,6 +19,7 @@ - * with this program; if not, see <http://www.gnu.org/licenses/>. - */ - -+#include <glib/gprintf.h> - #include <stdio.h> - #include <stdarg.h> - #include <assert.h> -@@ -59,7 +60,6 @@ static void build_append_array(GArray *array, GArray *val) - static void - build_append_nameseg(GArray *array, const char *seg) - { -- /* It would be nicer to use g_string_vprintf but it's only there in 2.22 */ - int len; - - len = strlen(seg); -@@ -73,22 +73,12 @@ build_append_nameseg(GArray *array, const char *seg) - static void GCC_FMT_ATTR(2, 0) - build_append_namestringv(GArray *array, const char *format, va_list ap) - { -- /* It would be nicer to use g_string_vprintf but it's only there in 2.22 */ - char *s; -- int len; -- va_list va_len; - char **segs; - char **segs_iter; - int seg_count = 0; - -- va_copy(va_len, ap); -- len = vsnprintf(NULL, 0, format, va_len); -- va_end(va_len); -- len += 1; -- s = g_new(typeof(*s), len); -- -- len = vsnprintf(s, len, format, ap); -- -+ s = g_strdup_vprintf(format, ap); - segs = g_strsplit(s, ".", 0); - g_free(s); - -@@ -754,22 +744,15 @@ Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name) - Aml *aml_string(const char *name_format, ...) - { - Aml *var = aml_opcode(0x0D /* StringPrefix */); -- va_list ap, va_len; -+ va_list ap; - char *s; - int len; - - va_start(ap, name_format); -- va_copy(va_len, ap); -- len = vsnprintf(NULL, 0, name_format, va_len); -- va_end(va_len); -- len += 1; -- s = g_new0(typeof(*s), len); -- -- len = vsnprintf(s, len, name_format, ap); -+ len = g_vasprintf(&s, name_format, ap); - va_end(ap); - -- g_array_append_vals(var->buf, s, len); -- build_append_byte(var->buf, 0x0); /* NullChar */ -+ g_array_append_vals(var->buf, s, len + 1); - g_free(s); - - return var; --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-Use-apic_id_limit-when-calculating-legacy-ACPI-table-size.patch b/SOURCES/kvm-acpi-Use-apic_id_limit-when-calculating-legacy-ACPI-table-size.patch deleted file mode 100644 index 3fa7cad..0000000 --- a/SOURCES/kvm-acpi-Use-apic_id_limit-when-calculating-legacy-ACPI-table-size.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8c85def0d1f4312893a679873e0ac4e72de3aa61 Mon Sep 17 00:00:00 2001 -From: Eduardo Habkost <ehabkost@redhat.com> -Date: Fri, 12 Dec 2014 16:53:22 -0600 -Subject: acpi: Use apic_id_limit when calculating legacy ACPI table size - -RH-Author: Eduardo Habkost <ehabkost@redhat.com> -Message-id: <1418403202-5444-1-git-send-email-ehabkost@redhat.com> -Patchwork-id: 62851 -O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCH] acpi: Use apic_id_limit when calculating legacy ACPI table size -Bugzilla: 1173167 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -The code that calculates the legacy ACPI table size for migration -compatibility uses max_cpus when calculating legacy_aml_len (the size of -the DSDT and SSDT tables). However, the SSDT grows according to APIC ID -limit, not max_cpus. - -The bug is not triggered very often because of the 4k alignment on the -table size. But it can be triggered if you are unlucky enough to cross a -4k boundary. For example, using the following: - - $ qemu-system-x86_64 -machine pc-i440fx-2.0 -smp 99,sockets=3,cores=33,threads=1 - qemu-system-x86_64: Warning: migration may not work. - -Change the legacy_aml_len calculation to use apic_id_limit, to calculate -the right size. - -Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> -Signed-off-by: Jeff E. Nelson <jen@redhat.com> - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index e761005..8773e8f 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -1486,7 +1486,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) - */ - int legacy_aml_len = - guest_info->legacy_acpi_table_size + -- ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus; -+ ACPI_BUILD_LEGACY_CPU_AML_SIZE * guest_info->apic_id_limit; - int legacy_table_size = - ROUND_UP(tables_blob->len - aml_len + legacy_aml_len, - ACPI_BUILD_ALIGN_SIZE); diff --git a/SOURCES/kvm-acpi-add-a-missing-backslash-to-the-_SB-scope.patch b/SOURCES/kvm-acpi-add-a-missing-backslash-to-the-_SB-scope.patch deleted file mode 100644 index 67710b5..0000000 --- a/SOURCES/kvm-acpi-add-a-missing-backslash-to-the-_SB-scope.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 2eb0cc4842234570239c20ad737818612f8cd120 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:52:58 +0200 -Subject: [PATCH 187/217] acpi: add a missing backslash to the \_SB scope. - -Message-id: <1435154016-26233-6-git-send-email-marcel@redhat.com> -Patchwork-id: 66433 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 05/43] acpi: add a missing backslash to the \_SB scope. -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Gal Hammer <ghammer@redhat.com> - -A predefined scope in the ACPI specs is precede with a backslash. - -Signed-off-by: Gal Hammer <ghammer@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -(cherry picked from commit 7824df3889499acc7466317175a3fb24a0824002) -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 2 +- - include/hw/acpi/aml-build.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 061a9ba..c9d4545 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -765,7 +765,7 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(ssdt, scope); - } - -- sb_scope = aml_scope("_SB"); -+ sb_scope = aml_scope("\\_SB"); - { - /* create PCI0.PRES device and its _CRS to reserve CPU hotplug MMIO */ - dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE)); -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 82242ec..9773bfd 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -184,7 +184,7 @@ void free_aml_allocator(void); - * Joins Aml elements together and helps to construct AML tables - * Examle of usage: - * Aml *table = aml_def_block("SSDT", ...); -- * Aml *sb = aml_scope("\_SB"); -+ * Aml *sb = aml_scope("\\_SB"); - * Aml *dev = aml_device("PCI0"); - * - * aml_append(dev, aml_name_decl("HID", aml_eisaid("PNP0A03"))); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_add-term.patch b/SOURCES/kvm-acpi-add-aml_add-term.patch deleted file mode 100644 index cde9228..0000000 --- a/SOURCES/kvm-acpi-add-aml_add-term.patch +++ /dev/null @@ -1,63 +0,0 @@ -From b452def070ce6b698641f9f572fa5059ecfd5ca3 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:12 +0200 -Subject: [PATCH 190/217] acpi: add aml_add() term - -Message-id: <1435154016-26233-20-git-send-email-marcel@redhat.com> -Patchwork-id: 66449 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 19/43] acpi: add aml_add() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefAdd Opcode. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> -(cherry picked from commit c08cf0704247aa55e9b0bb14cf34d845629e0e3e) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 10 ++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 11 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 709ddc3..19c81dd 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -456,6 +456,16 @@ Aml *aml_or(Aml *arg1, Aml *arg2) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */ -+Aml *aml_add(Aml *arg1, Aml *arg2) -+{ -+ Aml *var = aml_opcode(0x72 /* AddOp */); -+ aml_append(var, arg1); -+ aml_append(var, arg2); -+ build_append_byte(var->buf, 0x00 /* NullNameOp */); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */ - Aml *aml_notify(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 9773bfd..42448ae 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -202,6 +202,7 @@ Aml *aml_arg(int pos); - Aml *aml_store(Aml *val, Aml *target); - Aml *aml_and(Aml *arg1, Aml *arg2); - Aml *aml_or(Aml *arg1, Aml *arg2); -+Aml *aml_add(Aml *arg1, Aml *arg2); - Aml *aml_notify(Aml *arg1, Aml *arg2); - Aml *aml_call1(const char *method, Aml *arg1); - Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_increment-term.patch b/SOURCES/kvm-acpi-add-aml_increment-term.patch deleted file mode 100644 index e19e07d..0000000 --- a/SOURCES/kvm-acpi-add-aml_increment-term.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 9e53bc8954f43af1cff901184d70bc514f921f91 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:17 +0200 -Subject: [PATCH 195/217] acpi: add aml_increment() term - -Message-id: <1435154016-26233-25-git-send-email-marcel@redhat.com> -Patchwork-id: 66451 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 24/43] acpi: add aml_increment() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefIncrement Opcode. - -Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit af39d5363f373e6c1168a0e84658d6e4ef57fa8c) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 8 ++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 9 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 57e6cf4..2bebf23 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -495,6 +495,14 @@ Aml *aml_add(Aml *arg1, Aml *arg2) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */ -+Aml *aml_increment(Aml *arg) -+{ -+ Aml *var = aml_opcode(0x75 /* IncrementOp */); -+ aml_append(var, arg); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */ - Aml *aml_index(Aml *arg1, Aml *idx) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 9abb4c3..1a891a2 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -206,6 +206,7 @@ Aml *aml_shiftleft(Aml *arg1, Aml *count); - Aml *aml_shiftright(Aml *arg1, Aml *count); - Aml *aml_lless(Aml *arg1, Aml *arg2); - Aml *aml_add(Aml *arg1, Aml *arg2); -+Aml *aml_increment(Aml *arg); - Aml *aml_index(Aml *arg1, Aml *idx); - Aml *aml_notify(Aml *arg1, Aml *arg2); - Aml *aml_call1(const char *method, Aml *arg1); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_index-term.patch b/SOURCES/kvm-acpi-add-aml_index-term.patch deleted file mode 100644 index 5c510ec..0000000 --- a/SOURCES/kvm-acpi-add-aml_index-term.patch +++ /dev/null @@ -1,62 +0,0 @@ -From a27bc2d9b2b7ad55c5eb35e98890889aafb216cc Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:14 +0200 -Subject: [PATCH 192/217] acpi: add aml_index() term - -Message-id: <1435154016-26233-22-git-send-email-marcel@redhat.com> -Patchwork-id: 66447 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 21/43] acpi: add aml_index() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefIndex Opcode. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> -(cherry picked from commit 928b8996576875f9364f77c5a41f12cd55c7b9f7) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 10 ++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 11 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 5423001..b5ef9d7 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -475,6 +475,16 @@ Aml *aml_add(Aml *arg1, Aml *arg2) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */ -+Aml *aml_index(Aml *arg1, Aml *idx) -+{ -+ Aml *var = aml_opcode(0x88 /* IndexOp */); -+ aml_append(var, arg1); -+ aml_append(var, idx); -+ build_append_byte(var->buf, 0x00 /* NullNameOp */); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */ - Aml *aml_notify(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 3007cb5..d0de08f 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -204,6 +204,7 @@ Aml *aml_and(Aml *arg1, Aml *arg2); - Aml *aml_or(Aml *arg1, Aml *arg2); - Aml *aml_lless(Aml *arg1, Aml *arg2); - Aml *aml_add(Aml *arg1, Aml *arg2); -+Aml *aml_index(Aml *arg1, Aml *idx); - Aml *aml_notify(Aml *arg1, Aml *arg2); - Aml *aml_call1(const char *method, Aml *arg1); - Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_lless-term.patch b/SOURCES/kvm-acpi-add-aml_lless-term.patch deleted file mode 100644 index c738e41..0000000 --- a/SOURCES/kvm-acpi-add-aml_lless-term.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 96dbc9ba555856a0a37694027acef0d073546719 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:13 +0200 -Subject: [PATCH 191/217] acpi: add aml_lless() term - -Message-id: <1435154016-26233-21-git-send-email-marcel@redhat.com> -Patchwork-id: 66448 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 20/43] acpi: add aml_lless() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefLLess Opcode. - -Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 96396e2858fd8a0b4ee218c9894b5a67d22d97d9) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 9 +++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 10 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 19c81dd..5423001 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -456,6 +456,15 @@ Aml *aml_or(Aml *arg1, Aml *arg2) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */ -+Aml *aml_lless(Aml *arg1, Aml *arg2) -+{ -+ Aml *var = aml_opcode(0x95 /* LLessOp */); -+ aml_append(var, arg1); -+ aml_append(var, arg2); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */ - Aml *aml_add(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 42448ae..3007cb5 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -202,6 +202,7 @@ Aml *aml_arg(int pos); - Aml *aml_store(Aml *val, Aml *target); - Aml *aml_and(Aml *arg1, Aml *arg2); - Aml *aml_or(Aml *arg1, Aml *arg2); -+Aml *aml_lless(Aml *arg1, Aml *arg2); - Aml *aml_add(Aml *arg1, Aml *arg2); - Aml *aml_notify(Aml *arg1, Aml *arg2); - Aml *aml_call1(const char *method, Aml *arg1); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_shiftleft-term.patch b/SOURCES/kvm-acpi-add-aml_shiftleft-term.patch deleted file mode 100644 index 60f052c..0000000 --- a/SOURCES/kvm-acpi-add-aml_shiftleft-term.patch +++ /dev/null @@ -1,63 +0,0 @@ -From eb25b0a8c699f1ae47329852571d7057ecebaf39 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:15 +0200 -Subject: [PATCH 193/217] acpi: add aml_shiftleft() term - -Message-id: <1435154016-26233-23-git-send-email-marcel@redhat.com> -Patchwork-id: 66450 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 22/43] acpi: add aml_shiftleft() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefShiftLeft Opcode. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> -(cherry picked from commit a57dddddd2f93b87852fac2ed41a31c45e6d192a) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 10 ++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 11 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index b5ef9d7..0d98c7b 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -456,6 +456,16 @@ Aml *aml_or(Aml *arg1, Aml *arg2) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftLeft */ -+Aml *aml_shiftleft(Aml *arg1, Aml *count) -+{ -+ Aml *var = aml_opcode(0x79 /* ShiftLeftOp */); -+ aml_append(var, arg1); -+ aml_append(var, count); -+ build_append_byte(var->buf, 0x00); /* NullNameOp */ -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */ - Aml *aml_lless(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index d0de08f..f2100cb 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -202,6 +202,7 @@ Aml *aml_arg(int pos); - Aml *aml_store(Aml *val, Aml *target); - Aml *aml_and(Aml *arg1, Aml *arg2); - Aml *aml_or(Aml *arg1, Aml *arg2); -+Aml *aml_shiftleft(Aml *arg1, Aml *count); - Aml *aml_lless(Aml *arg1, Aml *arg2); - Aml *aml_add(Aml *arg1, Aml *arg2); - Aml *aml_index(Aml *arg1, Aml *idx); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_shiftright-term.patch b/SOURCES/kvm-acpi-add-aml_shiftright-term.patch deleted file mode 100644 index 0169ccc..0000000 --- a/SOURCES/kvm-acpi-add-aml_shiftright-term.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 50544d5cac062146d5c635819aebb622afe059c6 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:16 +0200 -Subject: [PATCH 194/217] acpi: add aml_shiftright() term - -Message-id: <1435154016-26233-24-git-send-email-marcel@redhat.com> -Patchwork-id: 66456 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 23/43] acpi: add aml_shiftright() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefShiftRight Opcode. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> -(cherry picked from commit f7bd7b8eb6573ed22bfc51e148455a1c0a1e36d0) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 10 ++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 11 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 0d98c7b..57e6cf4 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -466,6 +466,16 @@ Aml *aml_shiftleft(Aml *arg1, Aml *count) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftRight */ -+Aml *aml_shiftright(Aml *arg1, Aml *count) -+{ -+ Aml *var = aml_opcode(0x7A /* ShiftRightOp */); -+ aml_append(var, arg1); -+ aml_append(var, count); -+ build_append_byte(var->buf, 0x00); /* NullNameOp */ -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */ - Aml *aml_lless(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index f2100cb..9abb4c3 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -203,6 +203,7 @@ Aml *aml_store(Aml *val, Aml *target); - Aml *aml_and(Aml *arg1, Aml *arg2); - Aml *aml_or(Aml *arg1, Aml *arg2); - Aml *aml_shiftleft(Aml *arg1, Aml *count); -+Aml *aml_shiftright(Aml *arg1, Aml *count); - Aml *aml_lless(Aml *arg1, Aml *arg2); - Aml *aml_add(Aml *arg1, Aml *arg2); - Aml *aml_index(Aml *arg1, Aml *idx); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-aml_while-term.patch b/SOURCES/kvm-acpi-add-aml_while-term.patch deleted file mode 100644 index 1879427..0000000 --- a/SOURCES/kvm-acpi-add-aml_while-term.patch +++ /dev/null @@ -1,41 +0,0 @@ -From aa3bad4cfe98c5c9ab76583a68e0e4a66d768003 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:18 +0200 -Subject: [PATCH 196/217] acpi: add aml_while() term - -Message-id: <1435154016-26233-26-git-send-email-marcel@redhat.com> -Patchwork-id: 66452 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 25/43] acpi: add aml_while() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Add encoding for ACPI DefWhile Opcode. - -Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 68e6b0af784dda4efd9d4e2e9d3b03a31ca1408c) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/acpi/aml-build.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 1a891a2..e3afa13 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -266,6 +266,7 @@ Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); - Aml *aml_method(const char *name, int arg_count); - Aml *aml_if(Aml *predicate); - Aml *aml_else(void); -+Aml *aml_while(Aml *predicate); - Aml *aml_package(uint8_t num_elements); - Aml *aml_buffer(int buffer_size, uint8_t *byte_list); - Aml *aml_resource_template(void); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-hardware-implementation-for-memory-hot-unpl.patch b/SOURCES/kvm-acpi-add-hardware-implementation-for-memory-hot-unpl.patch deleted file mode 100644 index e2b5fac..0000000 --- a/SOURCES/kvm-acpi-add-hardware-implementation-for-memory-hot-unpl.patch +++ /dev/null @@ -1,257 +0,0 @@ -From 97665891e90a05207b28ac69e40eaa0a81c2047e Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:05 +0200 -Subject: [PATCH 049/217] acpi: add hardware implementation for memory hot - unplug - -Message-id: <1433724727-46928-8-git-send-email-imammedo@redhat.com> -Patchwork-id: 65393 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 7/9] acpi: add hardware implementation for memory hot unplug -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> - -- implements QEMU hardware part of memory hot unplug protocol - described at "docs/spec/acpi_mem_hotplug.txt" -- handles memory remove notification event -- handles device eject notification - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit c06b2ffb02bfcc642c67300d2c4dffd5aa54932b) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - docs/specs/acpi_mem_hotplug.txt | 11 +++++++++-- - hw/acpi/memory_hotplug.c | 21 ++++++++++++++++++++- - hw/core/qdev.c | 2 +- - hw/i386/acpi-build.c | 12 ++++++++++++ - hw/i386/acpi-dsdt-mem-hotplug.dsl | 13 ++++++++++++- - include/hw/acpi/pc-hotplug.h | 3 +++ - include/hw/qdev-core.h | 1 + - trace-events | 3 +++ - 8 files changed, 61 insertions(+), 5 deletions(-) - -diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt -index 68daa14..3df3620 100644 ---- a/docs/specs/acpi_mem_hotplug.txt -+++ b/docs/specs/acpi_mem_hotplug.txt -@@ -19,7 +19,9 @@ Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access): - 1: Device insert event, used to distinguish device for which - no device check event to OSPM was issued. - It's valid only when bit 1 is set. -- 2-7: reserved and should be ignored by OSPM -+ 2: Device remove event, used to distinguish device for which -+ no device eject request to OSPM was issued. -+ 3-7: reserved and should be ignored by OSPM - [0x15-0x17] reserved - - write access: -@@ -38,7 +40,12 @@ Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access): - 1: if set to 1 clears device insert event, set by OSPM - after it has emitted device check event for the - selected memory device -- 2-7: reserved, OSPM must clear them before writing to register -+ 2: if set to 1 clears device remove event, set by OSPM -+ after it has emitted device eject request for the -+ selected memory device -+ 3: if set to 1 initiates device eject, set by OSPM when it -+ triggers memory device removal and calls _EJ0 method -+ 4-7: reserved, OSPM must clear them before writing to register - - Selecting memory device slot beyond present range has no effect on platform: - - write accesses to memory hot-plug registers not documented above are -diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c -index 07e281f..35bbfeb 100644 ---- a/hw/acpi/memory_hotplug.c -+++ b/hw/acpi/memory_hotplug.c -@@ -2,6 +2,7 @@ - #include "hw/acpi/pc-hotplug.h" - #include "hw/mem/pc-dimm.h" - #include "hw/boards.h" -+#include "hw/qdev-core.h" - #include "trace.h" - #include "qapi-event.h" - -@@ -91,6 +92,8 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, - MemHotplugState *mem_st = opaque; - MemStatus *mdev; - ACPIOSTInfo *info; -+ DeviceState *dev = NULL; -+ HotplugHandler *hotplug_ctrl = NULL; - - if (!mem_st->dev_count) { - return; -@@ -128,13 +131,29 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, - qapi_event_send_acpi_device_ost(info, &error_abort); - qapi_free_ACPIOSTInfo(info); - break; -- case 0x14: -+ case 0x14: /* set is_* fields */ - mdev = &mem_st->devs[mem_st->selector]; - if (data & 2) { /* clear insert event */ - mdev->is_inserting = false; - trace_mhp_acpi_clear_insert_evt(mem_st->selector); -+ } else if (data & 4) { -+ mdev->is_removing = false; -+ trace_mhp_acpi_clear_remove_evt(mem_st->selector); -+ } else if (data & 8) { -+ if (!mdev->is_enabled) { -+ trace_mhp_acpi_ejecting_invalid_slot(mem_st->selector); -+ break; -+ } -+ -+ dev = DEVICE(mdev->dimm); -+ hotplug_ctrl = qdev_get_hotplug_handler(dev); -+ /* call pc-dimm unplug cb */ -+ hotplug_handler_unplug(hotplug_ctrl, dev, NULL); -+ trace_mhp_acpi_pc_dimm_deleted(mem_st->selector); - } - break; -+ default: -+ break; - } - - } -diff --git a/hw/core/qdev.c b/hw/core/qdev.c -index 6e6a65d..b0f0f84 100644 ---- a/hw/core/qdev.c -+++ b/hw/core/qdev.c -@@ -273,7 +273,7 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, - dev->alias_required_for_version = required_for_version; - } - --static HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) -+HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) - { - HotplugHandler *hotplug_ctrl = NULL; - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 795af4e..6f29e7d 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -934,6 +934,12 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(field, - /*(read) 1 if has a insert event. (write) 1 to clear event */ - aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1)); -+ aml_append(field, -+ /* (read) 1 if has a remove event. (write) 1 to clear event */ -+ aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1)); -+ aml_append(field, -+ /* initiates device eject, write only */ -+ aml_named_field(stringify(MEMORY_SLOT_EJECT), 1)); - aml_append(scope, field); - - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc, -@@ -978,6 +984,12 @@ build_ssdt(GArray *table_data, GArray *linker, - ))); - aml_append(dev, method); - -+ method = aml_method("_EJ0", 1); -+ s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD); -+ aml_append(method, aml_return(aml_call2( -+ s, aml_name("_UID"), aml_arg(0)))); -+ aml_append(dev, method); -+ - aml_append(sb_scope, dev); - } - -diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl -index 1e9ec39..c2bb6a1 100644 ---- a/hw/i386/acpi-dsdt-mem-hotplug.dsl -+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl -@@ -29,6 +29,8 @@ - External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only - External(MEMORY_SLOT_ENABLED, FieldUnitObj) // 1 if enabled, read only - External(MEMORY_SLOT_INSERT_EVENT, FieldUnitObj) // (read) 1 if has a insert event. (write) 1 to clear event -+ External(MEMORY_SLOT_REMOVE_EVENT, FieldUnitObj) // (read) 1 if has a remove event. (write) 1 to clear event -+ External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only - External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only - External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only - External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only -@@ -55,8 +57,10 @@ - If (LEqual(MEMORY_SLOT_INSERT_EVENT, One)) { // Memory device needs check - MEMORY_SLOT_NOTIFY_METHOD(Local0, 1) - Store(1, MEMORY_SLOT_INSERT_EVENT) -+ } Elseif (LEqual(MEMORY_SLOT_REMOVE_EVENT, One)) { // Ejection request -+ MEMORY_SLOT_NOTIFY_METHOD(Local0, 3) -+ Store(1, MEMORY_SLOT_REMOVE_EVENT) - } -- // TODO: handle memory eject request - Add(Local0, One, Local0) // goto next DIMM - } - Release(MEMORY_SLOT_LOCK) -@@ -156,5 +160,12 @@ - Store(Arg2, MEMORY_SLOT_OST_STATUS) - Release(MEMORY_SLOT_LOCK) - } -+ -+ Method(MEMORY_SLOT_EJECT_METHOD, 2) { -+ Acquire(MEMORY_SLOT_LOCK, 0xFFFF) -+ Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM -+ Store(1, MEMORY_SLOT_EJECT) -+ Release(MEMORY_SLOT_LOCK) -+ } - } // Device() - } // Scope() -diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h -index efa6ed7..0513c1c 100644 ---- a/include/hw/acpi/pc-hotplug.h -+++ b/include/hw/acpi/pc-hotplug.h -@@ -43,6 +43,8 @@ - #define MEMORY_SLOT_PROXIMITY MPX - #define MEMORY_SLOT_ENABLED MES - #define MEMORY_SLOT_INSERT_EVENT MINS -+#define MEMORY_SLOT_REMOVE_EVENT MRMV -+#define MEMORY_SLOT_EJECT MEJ - #define MEMORY_SLOT_SLECTOR MSEL - #define MEMORY_SLOT_OST_EVENT MOEV - #define MEMORY_SLOT_OST_STATUS MOSC -@@ -51,6 +53,7 @@ - #define MEMORY_SLOT_CRS_METHOD MCRS - #define MEMORY_SLOT_OST_METHOD MOST - #define MEMORY_SLOT_PROXIMITY_METHOD MPXM -+#define MEMORY_SLOT_EJECT_METHOD MEJ0 - #define MEMORY_SLOT_NOTIFY_METHOD MTFY - #define MEMORY_SLOT_SCAN_METHOD MSCN - -diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h -index 4e673f9..5b7acf1 100644 ---- a/include/hw/qdev-core.h -+++ b/include/hw/qdev-core.h -@@ -266,6 +266,7 @@ int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT; - void qdev_init_nofail(DeviceState *dev); - void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, - int required_for_version); -+HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev); - void qdev_unplug(DeviceState *dev, Error **errp); - void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp); -diff --git a/trace-events b/trace-events -index 30eba92..46f6ef0 100644 ---- a/trace-events -+++ b/trace-events -@@ -1562,6 +1562,7 @@ vfio_put_base_device(int fd) "close vdev->fd=%d" - - #hw/acpi/memory_hotplug.c - mhp_acpi_invalid_slot_selected(uint32_t slot) "0x%"PRIx32 -+mhp_acpi_ejecting_invalid_slot(uint32_t slot) "0x%"PRIx32 - mhp_acpi_read_addr_lo(uint32_t slot, uint32_t addr) "slot[0x%"PRIx32"] addr lo: 0x%"PRIx32 - mhp_acpi_read_addr_hi(uint32_t slot, uint32_t addr) "slot[0x%"PRIx32"] addr hi: 0x%"PRIx32 - mhp_acpi_read_size_lo(uint32_t slot, uint32_t size) "slot[0x%"PRIx32"] size lo: 0x%"PRIx32 -@@ -1572,6 +1573,8 @@ mhp_acpi_write_slot(uint32_t slot) "set active slot: 0x%"PRIx32 - mhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "slot[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 - mhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "slot[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 - mhp_acpi_clear_insert_evt(uint32_t slot) "slot[0x%"PRIx32"] clear insert event" -+mhp_acpi_clear_remove_evt(uint32_t slot) "slot[0x%"PRIx32"] clear remove event" -+mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted" - - # hw/i386/pc.c - mhp_pc_dimm_assigned_slot(int slot) "0x%d" --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-add-implementation-of-aml_while-term.patch b/SOURCES/kvm-acpi-add-implementation-of-aml_while-term.patch deleted file mode 100644 index d006911..0000000 --- a/SOURCES/kvm-acpi-add-implementation-of-aml_while-term.patch +++ /dev/null @@ -1,49 +0,0 @@ -From afbd66c6e12ee98bbdfd02966742306484623989 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:20 +0200 -Subject: [PATCH 197/217] acpi: add implementation of aml_while() term - -Message-id: <1435154016-26233-28-git-send-email-marcel@redhat.com> -Patchwork-id: 66454 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 27/43] acpi: add implementation of aml_while() term -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Commit 68e6b0af7 (acpi: add aml_while() term) added -the definition of aml_while without the actual implementation. -Implement the term. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 32d9ca15bac63e8a7bad6dc1a4ab624e6d6d3b0f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 2bebf23..0d4b324 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -687,6 +687,14 @@ Aml *aml_else(void) - return var; - } - -+/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefWhile */ -+Aml *aml_while(Aml *predicate) -+{ -+ Aml *var = aml_bundle(0xA2 /* WhileOp */, AML_PACKAGE); -+ aml_append(var, predicate); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ - Aml *aml_method(const char *name, int arg_count) - { --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-build-remove-dependency-from-ram_addr.h.patch b/SOURCES/kvm-acpi-build-remove-dependency-from-ram_addr.h.patch deleted file mode 100644 index b7aa494..0000000 --- a/SOURCES/kvm-acpi-build-remove-dependency-from-ram_addr.h.patch +++ /dev/null @@ -1,199 +0,0 @@ -From e5e9d076966db4d9cc95cc81deda467cb59e774b Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:14 +0200 -Subject: [PATCH 053/217] acpi-build: remove dependency from ram_addr.h - -Message-id: <1434455325-23399-3-git-send-email-drjones@redhat.com> -Patchwork-id: 66235 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 02/33] acpi-build: remove dependency from ram_addr.h -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Paolo Bonzini <pbonzini@redhat.com> - -ram_addr_t is an internal interface, everyone should go through -MemoryRegion. Clean it up by making rom_add_blob return a -MemoryRegion* and using the new qemu_ram_resize infrastructure. - -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -(cherry picked from commit 339240b5cd42bd13d4f6629f2aedf8b4b07459fb) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/core/loader.c | 8 ++++---- - hw/i386/acpi-build.c | 36 ++++++++++++++++++------------------ - include/hw/loader.h | 8 +++++--- - 3 files changed, 27 insertions(+), 25 deletions(-) - -diff --git a/hw/core/loader.c b/hw/core/loader.c -index d4c441f..7ee675c 100644 ---- a/hw/core/loader.c -+++ b/hw/core/loader.c -@@ -835,12 +835,12 @@ err: - return -1; - } - --ram_addr_t rom_add_blob(const char *name, const void *blob, size_t len, -+MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len, - size_t max_len, hwaddr addr, const char *fw_file_name, - FWCfgReadCallback fw_callback, void *callback_opaque) - { - Rom *rom; -- ram_addr_t ret = RAM_ADDR_MAX; -+ MemoryRegion *mr = NULL; - - rom = g_malloc0(sizeof(*rom)); - rom->name = g_strdup(name); -@@ -858,7 +858,7 @@ ram_addr_t rom_add_blob(const char *name, const void *blob, size_t len, - - if (rom_file_has_mr) { - data = rom_set_mr(rom, OBJECT(fw_cfg), devpath); -- ret = memory_region_get_ram_addr(rom->mr); -+ mr = rom->mr; - } else { - data = rom->data; - } -@@ -867,7 +867,7 @@ ram_addr_t rom_add_blob(const char *name, const void *blob, size_t len, - fw_callback, callback_opaque, - data, rom->datasize); - } -- return ret; -+ return mr; - } - - /* This function is specific for elf program because we don't need to allocate -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 6f29e7d..8a356b2 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -58,7 +58,6 @@ - - #include "qapi/qmp/qint.h" - #include "qom/qom-qobject.h" --#include "exec/ram_addr.h" - - /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and - * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows -@@ -1341,13 +1340,13 @@ static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) - typedef - struct AcpiBuildState { - /* Copy of table in RAM (for patching). */ -- ram_addr_t table_ram; -+ MemoryRegion *table_mr; - /* Is table patched? */ - uint8_t patched; - PcGuestInfo *guest_info; - void *rsdp; -- ram_addr_t rsdp_ram; -- ram_addr_t linker_ram; -+ MemoryRegion *rsdp_mr; -+ MemoryRegion *linker_mr; - } AcpiBuildState; - - static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) -@@ -1531,15 +1530,15 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) - g_array_free(table_offsets, true); - } - --static void acpi_ram_update(ram_addr_t ram, GArray *data) -+static void acpi_ram_update(MemoryRegion *mr, GArray *data) - { - uint32_t size = acpi_data_len(data); - - /* Make sure RAM size is correct - in case it got changed e.g. by migration */ -- qemu_ram_resize(ram, size, &error_abort); -+ memory_region_ram_resize(mr, size, &error_abort); - -- memcpy(qemu_get_ram_ptr(ram), data->data, size); -- cpu_physical_memory_set_dirty_range_nocode(ram, size); -+ memcpy(memory_region_get_ram_ptr(mr), data->data, size); -+ memory_region_set_dirty(mr, 0, size); - } - - static void acpi_build_update(void *build_opaque, uint32_t offset) -@@ -1557,15 +1556,15 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) - - acpi_build(build_state->guest_info, &tables); - -- acpi_ram_update(build_state->table_ram, tables.table_data); -+ acpi_ram_update(build_state->table_mr, tables.table_data); - - if (build_state->rsdp) { - memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp)); - } else { -- acpi_ram_update(build_state->rsdp_ram, tables.rsdp); -+ acpi_ram_update(build_state->rsdp_mr, tables.rsdp); - } - -- acpi_ram_update(build_state->linker_ram, tables.linker); -+ acpi_ram_update(build_state->linker_mr, tables.linker); - acpi_build_tables_cleanup(&tables, true); - } - -@@ -1575,8 +1574,9 @@ static void acpi_build_reset(void *build_opaque) - build_state->patched = 0; - } - --static ram_addr_t acpi_add_rom_blob(AcpiBuildState *build_state, GArray *blob, -- const char *name, uint64_t max_size) -+static MemoryRegion *acpi_add_rom_blob(AcpiBuildState *build_state, -+ GArray *blob, const char *name, -+ uint64_t max_size) - { - return rom_add_blob(name, blob->data, acpi_data_len(blob), max_size, -1, - name, acpi_build_update, build_state); -@@ -1622,12 +1622,12 @@ void acpi_setup(PcGuestInfo *guest_info) - acpi_build(build_state->guest_info, &tables); - - /* Now expose it all to Guest */ -- build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, -+ build_state->table_mr = acpi_add_rom_blob(build_state, tables.table_data, - ACPI_BUILD_TABLE_FILE, - ACPI_BUILD_TABLE_MAX_SIZE); -- assert(build_state->table_ram != RAM_ADDR_MAX); -+ assert(build_state->table_mr != NULL); - -- build_state->linker_ram = -+ build_state->linker_mr = - acpi_add_rom_blob(build_state, tables.linker, "etc/table-loader", 0); - - fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, -@@ -1645,10 +1645,10 @@ void acpi_setup(PcGuestInfo *guest_info) - fw_cfg_add_file_callback(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE, - acpi_build_update, build_state, - build_state->rsdp, rsdp_size); -- build_state->rsdp_ram = (ram_addr_t)-1; -+ build_state->rsdp_mr = NULL; - } else { - build_state->rsdp = NULL; -- build_state->rsdp_ram = acpi_add_rom_blob(build_state, tables.rsdp, -+ build_state->rsdp_mr = acpi_add_rom_blob(build_state, tables.rsdp, - ACPI_BUILD_RSDP_FILE, 0); - } - -diff --git a/include/hw/loader.h b/include/hw/loader.h -index 4f0681b..485ff8f 100644 ---- a/include/hw/loader.h -+++ b/include/hw/loader.h -@@ -68,9 +68,11 @@ extern bool rom_file_has_mr; - int rom_add_file(const char *file, const char *fw_dir, - hwaddr addr, int32_t bootindex, - bool option_rom); --ram_addr_t rom_add_blob(const char *name, const void *blob, size_t len, -- size_t max_len, hwaddr addr, const char *fw_file_name, -- FWCfgReadCallback fw_callback, void *callback_opaque); -+MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len, -+ size_t max_len, hwaddr addr, -+ const char *fw_file_name, -+ FWCfgReadCallback fw_callback, -+ void *callback_opaque); - int rom_add_elf_program(const char *name, void *data, size_t datasize, - size_t romsize, hwaddr addr); - int rom_load_all(void); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-extend-aml_field-to-support-UpdateRule.patch b/SOURCES/kvm-acpi-extend-aml_field-to-support-UpdateRule.patch deleted file mode 100644 index cc5cfa2..0000000 --- a/SOURCES/kvm-acpi-extend-aml_field-to-support-UpdateRule.patch +++ /dev/null @@ -1,131 +0,0 @@ -From c0058e0050190303c31d79d9875ab9e0d1d5cb25 Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:03 +0200 -Subject: [PATCH 047/217] acpi: extend aml_field() to support UpdateRule - -Message-id: <1433724727-46928-6-git-send-email-imammedo@redhat.com> -Patchwork-id: 65392 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 5/9] acpi: extend aml_field() to support UpdateRule -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> - -The flags field is declared with default update rule 'Preserve', -this patch extends aml_field() to support UpdateRule so that we -can specify different values per field. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit af5098973136029211848b4999ad5d38bc90180f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 4 +++- - hw/i386/acpi-build.c | 13 ++++++++----- - include/hw/acpi/aml-build.h | 10 ++++++++-- - 3 files changed, 19 insertions(+), 8 deletions(-) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index d7945f6..f926c9a 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -635,9 +635,11 @@ Aml *aml_reserved_field(unsigned length) - } - - /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefField */ --Aml *aml_field(const char *name, AmlFieldFlags flags) -+Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule) - { - Aml *var = aml_bundle(0x81 /* FieldOp */, AML_EXT_PACKAGE); -+ uint8_t flags = rule << 5 | type; -+ - build_append_namestring(var->buf, "%s", name); - build_append_byte(var->buf, flags); - return var; -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index d7f0a4e..5977a5b 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -798,7 +798,7 @@ build_ssdt(GArray *table_data, GArray *linker, - - aml_append(dev, aml_operation_region("PEOR", aml_system_io, - misc->pvpanic_port, 1)); -- field = aml_field("PEOR", aml_byte_acc); -+ field = aml_field("PEOR", aml_byte_acc, aml_preserve); - aml_append(field, aml_named_field("PEPT", 8)); - aml_append(dev, field); - -@@ -838,7 +838,7 @@ build_ssdt(GArray *table_data, GArray *linker, - /* declare CPU hotplug MMIO region and PRS field to access it */ - aml_append(sb_scope, aml_operation_region( - "PRST", aml_system_io, pm->cpu_hp_io_base, pm->cpu_hp_io_len)); -- field = aml_field("PRST", aml_byte_acc); -+ field = aml_field("PRST", aml_byte_acc, aml_preserve); - aml_append(field, aml_named_field("PRS", 256)); - aml_append(sb_scope, field); - -@@ -912,7 +912,8 @@ build_ssdt(GArray *table_data, GArray *linker, - pm->mem_hp_io_base, pm->mem_hp_io_len) - ); - -- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc); -+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc, -+ aml_preserve); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32)); - aml_append(field, /* read only */ -@@ -925,7 +926,8 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32)); - aml_append(scope, field); - -- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_byte_acc); -+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_byte_acc, -+ aml_preserve); - aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */)); - aml_append(field, /* 1 if enabled, read only */ - aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1)); -@@ -934,7 +936,8 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1)); - aml_append(scope, field); - -- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc); -+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc, -+ aml_preserve); - aml_append(field, /* DIMM selector, write only */ - aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32)); - aml_append(field, /* _OST event code, write only */ -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 17d3beb..5aa5e7a 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -35,7 +35,13 @@ typedef enum { - aml_dword_acc = 3, - aml_qword_acc = 4, - aml_buffer_acc = 5, --} AmlFieldFlags; -+} AmlAccessType; -+ -+typedef enum { -+ aml_preserve = 0, -+ aml_write_as_ones = 1, -+ aml_write_as_zeros = 2, -+} AmlUpdateRule; - - typedef enum { - aml_system_memory = 0x00, -@@ -185,7 +191,7 @@ Aml *aml_if(Aml *predicate); - Aml *aml_package(uint8_t num_elements); - Aml *aml_buffer(void); - Aml *aml_resource_template(void); --Aml *aml_field(const char *name, AmlFieldFlags flags); -+Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); - Aml *aml_varpackage(uint32_t num_elements); - - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-fix-Memory-device-control-fields-register.patch b/SOURCES/kvm-acpi-fix-Memory-device-control-fields-register.patch deleted file mode 100644 index 816795c..0000000 --- a/SOURCES/kvm-acpi-fix-Memory-device-control-fields-register.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 3c25dd23dd3a83072352685e1fdc00c9f0eb052b Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:04 +0200 -Subject: [PATCH 048/217] acpi: fix "Memory device control fields" register - -Message-id: <1433724727-46928-7-git-send-email-imammedo@redhat.com> -Patchwork-id: 65395 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 6/9] acpi: fix "Memory device control fields" register -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> - -0 bit in Memory device control fields must be cleared before writing to -register. But now this field isn't cleared when other fields are written. - -To solve this bug, This patch fixes UpdateRule to WriteAsZeros in "Memory -device control fields" register. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 660e8ec70065c8b1fd68b2cb137de16d831959f4) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - docs/specs/acpi_mem_hotplug.txt | 5 ++++- - hw/i386/acpi-build.c | 2 +- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt -index dcc4808..68daa14 100644 ---- a/docs/specs/acpi_mem_hotplug.txt -+++ b/docs/specs/acpi_mem_hotplug.txt -@@ -31,7 +31,10 @@ Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access): - [0xc-0x13] reserved, writes into it are ignored - [0x14] Memory device control fields - bits: -- 0: reserved, OSPM must clear it before writing to register -+ 0: reserved, OSPM must clear it before writing to register. -+ Due to BUG in versions prior 2.4 that field isn't cleared -+ when other fields are written. Keep it reserved and don't -+ try to reuse it. - 1: if set to 1 clears device insert event, set by OSPM - after it has emitted device check event for the - selected memory device -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 5977a5b..795af4e 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -927,7 +927,7 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(scope, field); - - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_byte_acc, -- aml_preserve); -+ aml_write_as_zeros); - aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */)); - aml_append(field, /* 1 if enabled, read only */ - aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1)); --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-mem-hotplug-add-acpi_memory_slot_status-to-get-.patch b/SOURCES/kvm-acpi-mem-hotplug-add-acpi_memory_slot_status-to-get-.patch deleted file mode 100644 index 9e94de5..0000000 --- a/SOURCES/kvm-acpi-mem-hotplug-add-acpi_memory_slot_status-to-get-.patch +++ /dev/null @@ -1,96 +0,0 @@ -From b9e7babd1879dea3b2703f94e5a628bbe4b96889 Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:00 +0200 -Subject: [PATCH 044/217] acpi, mem-hotplug: add acpi_memory_slot_status() to - get MemStatus - -Message-id: <1433724727-46928-3-git-send-email-imammedo@redhat.com> -Patchwork-id: 65389 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 2/9] acpi, mem-hotplug: add acpi_memory_slot_status() to get MemStatus -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Tang Chen <tangchen@cn.fujitsu.com> - -Add a new API named acpi_memory_slot_status() to obtain a single memory -slot status. Doing this is because this procedure will be used by other -functions in the next coming patches. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 4aae99b63333e71b2097b106bb15a6fde7f9b55b) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/memory_hotplug.c | 34 ++++++++++++++++++++++++++++------ - 1 file changed, 28 insertions(+), 6 deletions(-) - -diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c -index c6580da..6af9303 100644 ---- a/hw/acpi/memory_hotplug.c -+++ b/hw/acpi/memory_hotplug.c -@@ -163,29 +163,51 @@ void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner, - memory_region_add_subregion(as, ACPI_MEMORY_HOTPLUG_BASE, &state->io); - } - --void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, -- DeviceState *dev, Error **errp) -+/** -+ * acpi_memory_slot_status: -+ * @mem_st: memory hotplug state -+ * @dev: device -+ * @errp: set in case of an error -+ * -+ * Obtain a single memory slot status. -+ * -+ * This function will be called by memory unplug request cb and unplug cb. -+ */ -+static MemStatus * -+acpi_memory_slot_status(MemHotplugState *mem_st, -+ DeviceState *dev, Error **errp) - { -- MemStatus *mdev; - Error *local_err = NULL; - int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP, - &local_err); - - if (local_err) { - error_propagate(errp, local_err); -- return; -+ return NULL; - } - - if (slot >= mem_st->dev_count) { - char *dev_path = object_get_canonical_path(OBJECT(dev)); -- error_setg(errp, "acpi_memory_plug_cb: " -+ error_setg(errp, "acpi_memory_slot_status: " - "device [%s] returned invalid memory slot[%d]", - dev_path, slot); - g_free(dev_path); -+ return NULL; -+ } -+ -+ return &mem_st->devs[slot]; -+} -+ -+void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, -+ DeviceState *dev, Error **errp) -+{ -+ MemStatus *mdev; -+ -+ mdev = acpi_memory_slot_status(mem_st, dev, errp); -+ if (!mdev) { - return; - } - -- mdev = &mem_st->devs[slot]; - mdev->dimm = dev; - mdev->is_enabled = true; - mdev->is_inserting = true; --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-mem-hotplug-add-unplug-cb-for-memory-device.patch b/SOURCES/kvm-acpi-mem-hotplug-add-unplug-cb-for-memory-device.patch deleted file mode 100644 index b214358..0000000 --- a/SOURCES/kvm-acpi-mem-hotplug-add-unplug-cb-for-memory-device.patch +++ /dev/null @@ -1,169 +0,0 @@ -From fdac831421d2f4d913e53cfca35358ced2534e5b Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:02 +0200 -Subject: [PATCH 046/217] acpi, mem-hotplug: add unplug cb for memory device - -Message-id: <1433724727-46928-5-git-send-email-imammedo@redhat.com> -Patchwork-id: 65390 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 4/9] acpi, mem-hotplug: add unplug cb for memory device -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Tang Chen <tangchen@cn.fujitsu.com> - -This patch adds unplug cb for memory device. It resets memory status -"is_enabled" in acpi_memory_unplug_cb(), removes the corresponding -memory region, unregisters vmstate, and unparents the object. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit f7d3e29db5a5900a1f0ed10f8313f7c3f28e5b59) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/ich9.c | 9 +++++++-- - hw/acpi/memory_hotplug.c | 14 ++++++++++++++ - hw/acpi/piix4.c | 11 +++++++++-- - hw/i386/pc.c | 34 ++++++++++++++++++++++++++++++++-- - include/hw/acpi/memory_hotplug.h | 2 ++ - 5 files changed, 64 insertions(+), 6 deletions(-) - -diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c -index b85eed4..84e5bb8 100644 ---- a/hw/acpi/ich9.c -+++ b/hw/acpi/ich9.c -@@ -413,8 +413,13 @@ void ich9_pm_device_unplug_request_cb(ICH9LPCPMRegs *pm, DeviceState *dev, - void ich9_pm_device_unplug_cb(ICH9LPCPMRegs *pm, DeviceState *dev, - Error **errp) - { -- error_setg(errp, "acpi: device unplug for not supported device" -- " type: %s", object_get_typename(OBJECT(dev))); -+ if (pm->acpi_memory_hotplug.is_enabled && -+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { -+ acpi_memory_unplug_cb(&pm->acpi_memory_hotplug, dev, errp); -+ } else { -+ error_setg(errp, "acpi: device unplug for not supported device" -+ " type: %s", object_get_typename(OBJECT(dev))); -+ } - } - - void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) -diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c -index 42fe668..07e281f 100644 ---- a/hw/acpi/memory_hotplug.c -+++ b/hw/acpi/memory_hotplug.c -@@ -237,6 +237,20 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, - acpi_update_sci(ar, irq); - } - -+void acpi_memory_unplug_cb(MemHotplugState *mem_st, -+ DeviceState *dev, Error **errp) -+{ -+ MemStatus *mdev; -+ -+ mdev = acpi_memory_slot_status(mem_st, dev, errp); -+ if (!mdev) { -+ return; -+ } -+ -+ mdev->is_enabled = false; -+ mdev->dimm = NULL; -+} -+ - static const VMStateDescription vmstate_memhp_sts = { - .name = "memory hotplug device state", - .version_id = 1, -diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c -index 66ecfca..d20c1e8 100644 ---- a/hw/acpi/piix4.c -+++ b/hw/acpi/piix4.c -@@ -377,8 +377,15 @@ static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev, - static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) - { -- error_setg(errp, "acpi: device unplug for not supported device" -- " type: %s", object_get_typename(OBJECT(dev))); -+ PIIX4PMState *s = PIIX4_PM(hotplug_dev); -+ -+ if (s->acpi_memory_hotplug.is_enabled && -+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { -+ acpi_memory_unplug_cb(&s->acpi_memory_hotplug, dev, errp); -+ } else { -+ error_setg(errp, "acpi: device unplug for not supported device" -+ " type: %s", object_get_typename(OBJECT(dev))); -+ } - } - - static void piix4_update_bus_hotplug(PCIBus *pci_bus, void *opaque) -diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index 2e3158a..a946976 100644 ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -1699,6 +1699,32 @@ out: - error_propagate(errp, local_err); - } - -+static void pc_dimm_unplug(HotplugHandler *hotplug_dev, -+ DeviceState *dev, Error **errp) -+{ -+ PCMachineState *pcms = PC_MACHINE(hotplug_dev); -+ PCDIMMDevice *dimm = PC_DIMM(dev); -+ PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); -+ MemoryRegion *mr = ddc->get_memory_region(dimm); -+ HotplugHandlerClass *hhc; -+ Error *local_err = NULL; -+ -+ hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); -+ hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); -+ -+ if (local_err) { -+ goto out; -+ } -+ -+ memory_region_del_subregion(&pcms->hotplug_memory, mr); -+ vmstate_unregister_ram(mr, dev); -+ -+ object_unparent(OBJECT(dev)); -+ -+ out: -+ error_propagate(errp, local_err); -+} -+ - static void pc_cpu_plug(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) - { -@@ -1752,8 +1778,12 @@ static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev, - static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) - { -- error_setg(errp, "acpi: device unplug for not supported device" -- " type: %s", object_get_typename(OBJECT(dev))); -+ if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { -+ pc_dimm_unplug(hotplug_dev, dev, errp); -+ } else { -+ error_setg(errp, "acpi: device unplug for not supported device" -+ " type: %s", object_get_typename(OBJECT(dev))); -+ } - } - - static HotplugHandler *pc_get_hotpug_handler(MachineState *machine, -diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h -index 9d7eee9..986223b 100644 ---- a/include/hw/acpi/memory_hotplug.h -+++ b/include/hw/acpi/memory_hotplug.h -@@ -38,6 +38,8 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, - void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, - MemHotplugState *mem_st, - DeviceState *dev, Error **errp); -+void acpi_memory_unplug_cb(MemHotplugState *mem_st, -+ DeviceState *dev, Error **errp); - - extern const VMStateDescription vmstate_memory_hotplug; - #define VMSTATE_MEMORY_HOTPLUG(memhp, state) \ --- -1.8.3.1 - diff --git a/SOURCES/kvm-acpi-mem-hotplug-add-unplug-request-cb-for-memory-de.patch b/SOURCES/kvm-acpi-mem-hotplug-add-unplug-request-cb-for-memory-de.patch deleted file mode 100644 index df42889..0000000 --- a/SOURCES/kvm-acpi-mem-hotplug-add-unplug-request-cb-for-memory-de.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 58e2e2c775c8a5af1933a289c9bbd9a2e1a912a9 Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:01 +0200 -Subject: [PATCH 045/217] acpi, mem-hotplug: add unplug request cb for memory - device - -Message-id: <1433724727-46928-4-git-send-email-imammedo@redhat.com> -Patchwork-id: 65391 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 3/9] acpi, mem-hotplug: add unplug request cb for memory device -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Tang Chen <tangchen@cn.fujitsu.com> - -This patch adds unplug request cb for memory device, and adds the -is_removing boolean field to MemStatus. This field is used to indicate -whether the memory device in slot has been requested to be ejected. -This field is set to true in acpi_memory_unplug_request_cb(). - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 64fec58e8ab62490edd2638e4214d8c9f84518c9) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/ich9.c | 10 ++++++++-- - hw/acpi/memory_hotplug.c | 19 +++++++++++++++++++ - hw/acpi/piix4.c | 6 +++++- - hw/i386/pc.c | 28 ++++++++++++++++++++++++++-- - include/hw/acpi/memory_hotplug.h | 10 ++++++++++ - 5 files changed, 68 insertions(+), 5 deletions(-) - -diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c -index 5352e19..b85eed4 100644 ---- a/hw/acpi/ich9.c -+++ b/hw/acpi/ich9.c -@@ -400,8 +400,14 @@ void ich9_pm_device_plug_cb(ICH9LPCPMRegs *pm, DeviceState *dev, Error **errp) - void ich9_pm_device_unplug_request_cb(ICH9LPCPMRegs *pm, DeviceState *dev, - Error **errp) - { -- error_setg(errp, "acpi: device unplug request for not supported device" -- " type: %s", object_get_typename(OBJECT(dev))); -+ if (pm->acpi_memory_hotplug.is_enabled && -+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { -+ acpi_memory_unplug_request_cb(&pm->acpi_regs, pm->irq, -+ &pm->acpi_memory_hotplug, dev, errp); -+ } else { -+ error_setg(errp, "acpi: device unplug request for not supported device" -+ " type: %s", object_get_typename(OBJECT(dev))); -+ } - } - - void ich9_pm_device_unplug_cb(ICH9LPCPMRegs *pm, DeviceState *dev, -diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c -index 6af9303..42fe668 100644 ---- a/hw/acpi/memory_hotplug.c -+++ b/hw/acpi/memory_hotplug.c -@@ -75,6 +75,7 @@ static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr, - case 0x14: /* pack and return is_* fields */ - val |= mdev->is_enabled ? 1 : 0; - val |= mdev->is_inserting ? 2 : 0; -+ val |= mdev->is_removing ? 4 : 0; - trace_mhp_acpi_read_flags(mem_st->selector, val); - break; - default: -@@ -218,6 +219,24 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, - return; - } - -+void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, -+ MemHotplugState *mem_st, -+ DeviceState *dev, Error **errp) -+{ -+ MemStatus *mdev; -+ -+ mdev = acpi_memory_slot_status(mem_st, dev, errp); -+ if (!mdev) { -+ return; -+ } -+ -+ mdev->is_removing = true; -+ -+ /* Do ACPI magic */ -+ ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS; -+ acpi_update_sci(ar, irq); -+} -+ - static const VMStateDescription vmstate_memhp_sts = { - .name = "memory hotplug device state", - .version_id = 1, -diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c -index 910b5ad..66ecfca 100644 ---- a/hw/acpi/piix4.c -+++ b/hw/acpi/piix4.c -@@ -361,7 +361,11 @@ static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev, - { - PIIX4PMState *s = PIIX4_PM(hotplug_dev); - -- if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { -+ if (s->acpi_memory_hotplug.is_enabled && -+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { -+ acpi_memory_unplug_request_cb(&s->ar, s->irq, &s->acpi_memory_hotplug, -+ dev, errp); -+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { - acpi_pcihp_device_unplug_cb(&s->ar, s->irq, &s->acpi_pci_hotplug, dev, - errp); - } else { -diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index 32dccd3..2e3158a 100644 ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -1679,6 +1679,26 @@ out: - error_propagate(errp, local_err); - } - -+static void pc_dimm_unplug_request(HotplugHandler *hotplug_dev, -+ DeviceState *dev, Error **errp) -+{ -+ HotplugHandlerClass *hhc; -+ Error *local_err = NULL; -+ PCMachineState *pcms = PC_MACHINE(hotplug_dev); -+ -+ if (!pcms->acpi_dev) { -+ error_setg(&local_err, -+ "memory hotplug is not enabled: missing acpi device"); -+ goto out; -+ } -+ -+ hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); -+ hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); -+ -+out: -+ error_propagate(errp, local_err); -+} -+ - static void pc_cpu_plug(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) - { -@@ -1721,8 +1741,12 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, - static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) - { -- error_setg(errp, "acpi: device unplug request for not supported device" -- " type: %s", object_get_typename(OBJECT(dev))); -+ if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { -+ pc_dimm_unplug_request(hotplug_dev, dev, errp); -+ } else { -+ error_setg(errp, "acpi: device unplug request for not supported device" -+ " type: %s", object_get_typename(OBJECT(dev))); -+ } - } - - static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev, -diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h -index 7bbf8a0..9d7eee9 100644 ---- a/include/hw/acpi/memory_hotplug.h -+++ b/include/hw/acpi/memory_hotplug.h -@@ -7,10 +7,17 @@ - - #define ACPI_MEMORY_HOTPLUG_STATUS 8 - -+/** -+ * MemStatus: -+ * @is_removing: the memory device in slot has been requested to be ejected. -+ * -+ * This structure stores memory device's status. -+ */ - typedef struct MemStatus { - DeviceState *dimm; - bool is_enabled; - bool is_inserting; -+ bool is_removing; - uint32_t ost_event; - uint32_t ost_status; - } MemStatus; -@@ -28,6 +35,9 @@ void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner, - - void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, - DeviceState *dev, Error **errp); -+void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, -+ MemHotplugState *mem_st, -+ DeviceState *dev, Error **errp); - - extern const VMStateDescription vmstate_memory_hotplug; - #define VMSTATE_MEMORY_HOTPLUG(memhp, state) \ --- -1.8.3.1 - diff --git a/SOURCES/kvm-aio_notify-force-main-loop-wakeup-with-SIGIO-aarch64-host-only.patch b/SOURCES/kvm-aio_notify-force-main-loop-wakeup-with-SIGIO-aarch64-host-only.patch deleted file mode 100644 index 143c8f2..0000000 --- a/SOURCES/kvm-aio_notify-force-main-loop-wakeup-with-SIGIO-aarch64-host-only.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 90b21e81363ecf960f157474df84004938dcbc39 Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek <lersek@redhat.com> -Date: Thu, 5 Feb 2015 15:35:06 +0100 -Subject: aio_notify(): force main loop wakeup with SIGIO (aarch64 host only) - -Message-id: <1423150507-19999-2-git-send-email-lersek@redhat.com> -Patchwork-id: 63729 -O-Subject: [RHELSA qemu-kvm-rhev PATCH 1/2] aio_notify(): force main loop wakeup with SIGIO (aarch64 host only) -Bugzilla: 1184405 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Richard Jones <rjones@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> - -This should be happening, before the patch: - - thread pool worker thread main iothread - ------------------------- ------------- - aio_notify() - | - write() ------------------[eventfd]---------------> g_poll() - -But g_poll is not woken(). The notification is lost on aarch64/KVM, and we -don't know why. - -The patch introduces the following (theoretically superfluous) additional -notification chain, activated under the same circumstances: - - thread pool worker thread sigwait_compat() thread main iothread - ------------------------- ----------------------- ------------- - aio_notify() - | - kill() -----[SIGIO]-----> sigwait() - | - write() -----[pipe]---> g_poll() - -(The SIGIO signal is generated for the entire process, but it can only be -consumed by the sigwait() call in sigwait_compat(), because that's the -only thread and section of code where SIGIO is unblocked. - -After the main iothread wakes, it dispatches the sigfd_compat_info -received over the pipe to the sigfd_handler() function, which (seeing the -SIG_DFL disposition for SIGIO, which coincides with NULL) simply throws it -away.) - -This patch should make no difference (beyond a minuscule performance hit), -but in practice it makes the hang go away, by reliably waking g_poll(). - -Signed-off-by: Laszlo Ersek <lersek@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/async.c b/async.c -index 2b51e87..66790c6 100644 ---- a/async.c -+++ b/async.c -@@ -273,6 +273,9 @@ void aio_notify(AioContext *ctx) - smp_mb(); - if (!ctx->dispatching) { - event_notifier_set(&ctx->notifier); -+#ifdef HOST_AARCH64 -+ kill(getpid(), SIGIO); -+#endif - } - } - diff --git a/SOURCES/kvm-apci-fix-PXB-behaviour-if-used-with-unsupported-BIOS.patch b/SOURCES/kvm-apci-fix-PXB-behaviour-if-used-with-unsupported-BIOS.patch deleted file mode 100644 index ae682e7..0000000 --- a/SOURCES/kvm-apci-fix-PXB-behaviour-if-used-with-unsupported-BIOS.patch +++ /dev/null @@ -1,149 +0,0 @@ -From edbd1f6bfeda1a74c59aaa4396aed88a0af73e67 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:35 +0200 -Subject: [PATCH 212/217] apci: fix PXB behaviour if used with unsupported BIOS - -Message-id: <1435154016-26233-43-git-send-email-marcel@redhat.com> -Patchwork-id: 66471 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 42/43] apci: fix PXB behaviour if used with unsupported BIOS -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -PXB does not work with unsupported bioses, but should -not interfere with normal OS operation. -We don't ship them anymore, but it's reasonable -to keep the work-around until we update the bios in qemu. - -Fix this by not adding PXB mem/IO chunks to _CRS -if they weren't configured by BIOS. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 0f6dd8e1d514b8c24689499ed72ea89fd0d967f3) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 87 ++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 58 insertions(+), 29 deletions(-) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index dbd0d8d..589534e 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -784,6 +784,14 @@ static Aml *build_crs(PCIHostState *host, - range_base = r->addr; - range_limit = r->addr + r->size - 1; - -+ /* -+ * Work-around for old bioses -+ * that do not support multiple root buses -+ */ -+ if (!range_base || range_base > range_limit) { -+ continue; -+ } -+ - if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { - aml_append(crs, - aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -@@ -817,45 +825,66 @@ static Aml *build_crs(PCIHostState *host, - - range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO); - range_limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO); -- aml_append(crs, -- aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -- AML_POS_DECODE, AML_ENTIRE_RANGE, -- 0, -- range_base, -- range_limit, -- 0, -- range_limit - range_base + 1)); -- crs_range_insert(io_ranges, range_base, range_limit); -+ -+ /* -+ * Work-around for old bioses -+ * that do not support multiple root buses -+ */ -+ if (range_base || range_base > range_limit) { -+ aml_append(crs, -+ aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_POS_DECODE, AML_ENTIRE_RANGE, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(io_ranges, range_base, range_limit); -+ } - - range_base = - pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); - range_limit = - pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); -- aml_append(crs, -- aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -- AML_MAX_FIXED, AML_NON_CACHEABLE, -- AML_READ_WRITE, -- 0, -- range_base, -- range_limit, -- 0, -- range_limit - range_base + 1)); -- crs_range_insert(mem_ranges, range_base, range_limit); -+ -+ /* -+ * Work-around for old bioses -+ * that do not support multiple root buses -+ */ -+ if (range_base || range_base > range_limit) { -+ aml_append(crs, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -+ AML_MAX_FIXED, AML_NON_CACHEABLE, -+ AML_READ_WRITE, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(mem_ranges, range_base, range_limit); -+ } - - range_base = - pci_bridge_get_base(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); - range_limit = - pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); -- aml_append(crs, -- aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -- AML_MAX_FIXED, AML_NON_CACHEABLE, -- AML_READ_WRITE, -- 0, -- range_base, -- range_limit, -- 0, -- range_limit - range_base + 1)); -- crs_range_insert(mem_ranges, range_base, range_limit); -+ -+ /* -+ * Work-around for old bioses -+ * that do not support multiple root buses -+ */ -+ if (range_base || range_base > range_limit) { -+ aml_append(crs, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -+ AML_MAX_FIXED, AML_NON_CACHEABLE, -+ AML_READ_WRITE, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(mem_ranges, range_base, range_limit); -+ } - } - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-atomics-add-explicit-compiler-fence-in-__atomic-memo.patch b/SOURCES/kvm-atomics-add-explicit-compiler-fence-in-__atomic-memo.patch deleted file mode 100644 index aa805fb..0000000 --- a/SOURCES/kvm-atomics-add-explicit-compiler-fence-in-__atomic-memo.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 6d36fa4f9f9b39522fe36c9fac82f495b5804cdf Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini <pbonzini@redhat.com> -Date: Fri, 19 Jun 2015 10:45:30 +0200 -Subject: [PATCH 036/217] atomics: add explicit compiler fence in __atomic - memory barriers - -Message-id: <1434710730-26183-2-git-send-email-pbonzini@redhat.com> -Patchwork-id: 66334 -O-Subject: [RHEL7.2/7.1.z qemu-kvm-rhev PATCH] atomics: add explicit compiler fence in __atomic memory barriers -Bugzilla: 1231335 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> - -Bugzilla: 1231335 - -Brew build: 9393734 - -__atomic_thread_fence does not include a compiler barrier; in the -C++11 memory model, fences take effect in combination with other -atomic operations. GCC implements this by making __atomic_load and -__atomic_store access memory as if the pointer was volatile, and -leaves no trace whatsoever of acquire and release fences in the -compiler's intermediate representation. - -In QEMU, we want memory barriers to act on all memory, but at the same -time we would like to use __atomic_thread_fence for portability reasons. -Add compiler barriers manually around the __atomic_thread_fence. - -Thanks to Uli and Kevin for analyzing this bug! - -Message-Id: <1433334080-14912-1-git-send-email-pbonzini@redhat.com> -Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -(cherry picked from commit 3bbf572345c65813f86a8fc434ea1b23beb08e16) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/qemu/atomic.h | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h -index 98e05ca..bd2c075 100644 ---- a/include/qemu/atomic.h -+++ b/include/qemu/atomic.h -@@ -99,7 +99,13 @@ - - #ifndef smp_wmb - #ifdef __ATOMIC_RELEASE --#define smp_wmb() __atomic_thread_fence(__ATOMIC_RELEASE) -+/* __atomic_thread_fence does not include a compiler barrier; instead, -+ * the barrier is part of __atomic_load/__atomic_store's "volatile-like" -+ * semantics. If smp_wmb() is a no-op, absence of the barrier means that -+ * the compiler is free to reorder stores on each side of the barrier. -+ * Add one here, and similarly in smp_rmb() and smp_read_barrier_depends(). -+ */ -+#define smp_wmb() ({ barrier(); __atomic_thread_fence(__ATOMIC_RELEASE); barrier(); }) - #else - #define smp_wmb() __sync_synchronize() - #endif -@@ -107,7 +113,7 @@ - - #ifndef smp_rmb - #ifdef __ATOMIC_ACQUIRE --#define smp_rmb() __atomic_thread_fence(__ATOMIC_ACQUIRE) -+#define smp_rmb() ({ barrier(); __atomic_thread_fence(__ATOMIC_ACQUIRE); barrier(); }) - #else - #define smp_rmb() __sync_synchronize() - #endif -@@ -115,7 +121,7 @@ - - #ifndef smp_read_barrier_depends - #ifdef __ATOMIC_CONSUME --#define smp_read_barrier_depends() __atomic_thread_fence(__ATOMIC_CONSUME) -+#define smp_read_barrier_depends() ({ barrier(); __atomic_thread_fence(__ATOMIC_CONSUME); barrier(); }) - #else - #define smp_read_barrier_depends() barrier() - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-balloon-improve-error-msg-when-adding-second-device.patch b/SOURCES/kvm-balloon-improve-error-msg-when-adding-second-device.patch deleted file mode 100644 index 47f6575..0000000 --- a/SOURCES/kvm-balloon-improve-error-msg-when-adding-second-device.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 7c702fa65cd9b35dcb3933de7b6c222d96863f65 Mon Sep 17 00:00:00 2001 -From: Luiz Capitulino <lcapitulino@redhat.com> -Date: Fri, 1 May 2015 13:30:23 +0200 -Subject: [PATCH 001/217] balloon: improve error msg when adding second device - -Message-id: <20150501093023.6d3884b5@redhat.com> -Patchwork-id: 64967 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH] balloon: improve error msg when adding second device -Bugzilla: 1165534 -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: Markus Armbruster <armbru@redhat.com> -RH-Acked-by: Amit Shah <amit.shah@redhat.com> - -A VM supports only one balloon device, but due to several changes -in infrastructure the error message got messed up when trying -to add a second device. Fix it. - -Before this fix - -Command-line: - -qemu-qmp: -device virtio-balloon-pci,id=balloon0: Another balloon device already registered -qemu-qmp: -device virtio-balloon-pci,id=balloon0: Adding balloon handler failed -qemu-qmp: -device virtio-balloon-pci,id=balloon0: Device 'virtio-balloon-pci' could not be initialized - -HMP: - -Another balloon device already registered -Adding balloon handler failed -Device 'virtio-balloon-pci' could not be initialized - -QMP: - -{ "execute": "device_add", "arguments": { "driver": "virtio-balloon-pci", "id": "balloon0" } } -{ - "error": { - "class": "GenericError", - "desc": "Adding balloon handler failed" - } -} - -After this fix - -Command-line: - -qemu-qmp: -device virtio-balloon-pci,id=balloon0: Only one balloon device is supported -qemu-qmp: -device virtio-balloon-pci,id=balloon0: Device 'virtio-balloon-pci' could not be initialized - -HMP: - -(qemu) device_add virtio-balloon-pci,id=balloon0 -Only one balloon device is supported -Device 'virtio-balloon-pci' could not be initialized -(qemu) - -QMP: - -{ "execute": "device_add", - "arguments": { "driver": "virtio-balloon-pci", "id": "balloon0" } } -{ - "error": { - "class": "GenericError", - "desc": "Only one balloon device is supported" - } -} - -Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> -Reviewed-by: Eric Blake <eblake@redhat.com> -(cherry picked from commit 46abb8124006887d071921c5e657eeec3c50a9e2) -Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - balloon.c | 1 - - hw/virtio/virtio-balloon.c | 2 +- - 2 files changed, 1 insertion(+), 2 deletions(-) - -diff --git a/balloon.c b/balloon.c -index 70c00f5..c7033e3 100644 ---- a/balloon.c -+++ b/balloon.c -@@ -58,7 +58,6 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, - /* We're already registered one balloon handler. How many can - * a guest really have? - */ -- error_report("Another balloon device already registered"); - return -1; - } - balloon_event_fn = event_func; -diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index 95b0643..484c3c3 100644 ---- a/hw/virtio/virtio-balloon.c -+++ b/hw/virtio/virtio-balloon.c -@@ -383,7 +383,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp) - virtio_balloon_stat, s); - - if (ret < 0) { -- error_setg(errp, "Adding balloon handler failed"); -+ error_setg(errp, "Only one balloon device is supported"); - virtio_cleanup(vdev); - return; - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-block-Fix-NULL-deference-for-unaligned-write-if-qiov.patch b/SOURCES/kvm-block-Fix-NULL-deference-for-unaligned-write-if-qiov.patch deleted file mode 100644 index 15c18ab..0000000 --- a/SOURCES/kvm-block-Fix-NULL-deference-for-unaligned-write-if-qiov.patch +++ /dev/null @@ -1,175 +0,0 @@ -From ecdec4f43fcdff0b33f9865f049c04fb5732ce98 Mon Sep 17 00:00:00 2001 -From: Fam Zheng <famz@redhat.com> -Date: Wed, 27 May 2015 06:53:51 +0200 -Subject: [PATCH 087/217] block: Fix NULL deference for unaligned write if qiov - is NULL - -Message-id: <1432709632-27105-2-git-send-email-famz@redhat.com> -Patchwork-id: 65133 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/2] block: Fix NULL deference for unaligned write if qiov is NULL -Bugzilla: 1207034 -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Max Reitz <mreitz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -For zero write, callers pass in NULL qiov (qemu-io "write -z" or -scsi-disk "write same"). - -Commit fc3959e466 fixed bdrv_co_write_zeroes which is the common case -for this bug, but it still exists in bdrv_aio_write_zeroes. A simpler -fix would be in bdrv_co_do_pwritev which is the NULL dereference point -and covers both cases. - -So don't access it in bdrv_co_do_pwritev in this case, use three aligned -writes. - -[Initialize ret to 0 in bdrv_co_do_zero_pwritev() to avoid uninitialized -variable warning with gcc 4.9.2. ---Stefan] - -Signed-off-by: Fam Zheng <famz@redhat.com> -Message-id: 1431522721-3266-3-git-send-email-famz@redhat.com -Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> -(cherry picked from commit 9eeb6dd1b27bd57eb4e3869290e87feac8e8b226) - -We don't have block/io.c in downstream, applied the changed to -block.c - -Signed-off-by: Fam Zheng <famz@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - block.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 95 insertions(+), 2 deletions(-) - -diff --git a/block.c b/block.c -index 2193868..d49599b 100644 ---- a/block.c -+++ b/block.c -@@ -3375,6 +3375,94 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, - return ret; - } - -+static int coroutine_fn bdrv_co_do_zero_pwritev(BlockDriverState *bs, -+ int64_t offset, -+ unsigned int bytes, -+ BdrvRequestFlags flags, -+ BdrvTrackedRequest *req) -+{ -+ uint8_t *buf = NULL; -+ QEMUIOVector local_qiov; -+ struct iovec iov; -+ uint64_t align = MAX(BDRV_SECTOR_SIZE, bs->request_alignment); -+ unsigned int head_padding_bytes, tail_padding_bytes; -+ int ret = 0; -+ -+ head_padding_bytes = offset & (align - 1); -+ tail_padding_bytes = align - ((offset + bytes) & (align - 1)); -+ -+ -+ assert(flags & BDRV_REQ_ZERO_WRITE); -+ if (head_padding_bytes || tail_padding_bytes) { -+ buf = qemu_blockalign(bs, align); -+ iov = (struct iovec) { -+ .iov_base = buf, -+ .iov_len = align, -+ }; -+ qemu_iovec_init_external(&local_qiov, &iov, 1); -+ } -+ if (head_padding_bytes) { -+ uint64_t zero_bytes = MIN(bytes, align - head_padding_bytes); -+ -+ /* RMW the unaligned part before head. */ -+ mark_request_serialising(req, align); -+ wait_serialising_requests(req); -+ BLKDBG_EVENT(bs, BLKDBG_PWRITEV_RMW_HEAD); -+ ret = bdrv_aligned_preadv(bs, req, offset & ~(align - 1), align, -+ align, &local_qiov, 0); -+ if (ret < 0) { -+ goto fail; -+ } -+ BLKDBG_EVENT(bs, BLKDBG_PWRITEV_RMW_AFTER_HEAD); -+ -+ memset(buf + head_padding_bytes, 0, zero_bytes); -+ ret = bdrv_aligned_pwritev(bs, req, offset & ~(align - 1), align, -+ &local_qiov, -+ flags & ~BDRV_REQ_ZERO_WRITE); -+ if (ret < 0) { -+ goto fail; -+ } -+ offset += zero_bytes; -+ bytes -= zero_bytes; -+ } -+ -+ assert(!bytes || (offset & (align - 1)) == 0); -+ if (bytes >= align) { -+ /* Write the aligned part in the middle. */ -+ uint64_t aligned_bytes = bytes & ~(align - 1); -+ ret = bdrv_aligned_pwritev(bs, req, offset, aligned_bytes, -+ NULL, flags); -+ if (ret < 0) { -+ goto fail; -+ } -+ bytes -= aligned_bytes; -+ offset += aligned_bytes; -+ } -+ -+ assert(!bytes || (offset & (align - 1)) == 0); -+ if (bytes) { -+ assert(align == tail_padding_bytes + bytes); -+ /* RMW the unaligned part after tail. */ -+ mark_request_serialising(req, align); -+ wait_serialising_requests(req); -+ BLKDBG_EVENT(bs, BLKDBG_PWRITEV_RMW_TAIL); -+ ret = bdrv_aligned_preadv(bs, req, offset, align, -+ align, &local_qiov, 0); -+ if (ret < 0) { -+ goto fail; -+ } -+ BLKDBG_EVENT(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL); -+ -+ memset(buf, 0, bytes); -+ ret = bdrv_aligned_pwritev(bs, req, offset, align, -+ &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); -+ } -+fail: -+ qemu_vfree(buf); -+ return ret; -+ -+} -+ - /* - * Handle a write request in coroutine context - */ -@@ -3414,6 +3502,11 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, - */ - tracked_request_begin(&req, bs, offset, bytes, true); - -+ if (!qiov) { -+ ret = bdrv_co_do_zero_pwritev(bs, offset, bytes, flags, &req); -+ goto out; -+ } -+ - if (offset & (align - 1)) { - QEMUIOVector head_qiov; - struct iovec head_iov; -@@ -3491,14 +3584,14 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, - flags); - - fail: -- tracked_request_end(&req); - - if (use_local_qiov) { - qemu_iovec_destroy(&local_qiov); - } - qemu_vfree(head_buf); - qemu_vfree(tail_buf); -- -+out: -+ tracked_request_end(&req); - return ret; - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-configure-Add-support-for-tcmalloc.patch b/SOURCES/kvm-configure-Add-support-for-tcmalloc.patch deleted file mode 100644 index 1ce4f42..0000000 --- a/SOURCES/kvm-configure-Add-support-for-tcmalloc.patch +++ /dev/null @@ -1,145 +0,0 @@ -From d8b57549d50ec4ffed51ac6dcc1e80a06c69e3f3 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini <pbonzini@redhat.com> -Date: Wed, 1 Jul 2015 20:46:00 +0200 -Subject: [PATCH 217/217] configure: Add support for tcmalloc - -Message-id: <1435783560-22369-1-git-send-email-pbonzini@redhat.com> -Patchwork-id: 66599 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH v2] configure: Add support for tcmalloc -Bugzilla: 1213882 -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -From: Fam Zheng <famz@redhat.com> - -Bugzilla: 1213882 - -Brew build: - http://brewweb.devel.redhat.com/brew/taskinfo?taskID=9451417 (qemu-ga) - http://brewweb.devel.redhat.com/brew/taskinfo?taskID=9451418 (qemu-kvm-rhev) - -This adds "--enable-tcmalloc" and "--disable-tcmalloc" to allow linking -to libtcmalloc from gperftools. - -tcmalloc is a malloc implementation that works well with threads and is -fast, so it is good for performance. - -It is disabled by default, because the MALLOC_PERTURB_ flag we use in -tests doesn't work with tcmalloc. However we can enable tcmalloc -specific heap checker and profilers later. - -An IOPS gain can be observed with virtio-blk-dataplane, other parts of -QEMU will directly benefit from it as well: - -========================================================== - glibc malloc ----------------------------------------------------------- -rw bs iodepth bw iops latency -read 4k 1 150 38511 24 ----------------------------------------------------------- - -========================================================== - tcmalloc ----------------------------------------------------------- -rw bs iodepth bw iops latency -read 4k 1 156 39969 23 ----------------------------------------------------------- - -Signed-off-by: Fam Zheng <famz@redhat.com> -Message-Id: <1427338992-27057-1-git-send-email-famz@redhat.com> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -(cherry picked from commit 2847b46958ab0bd604e1b3fcafba0f5ba4375833) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - configure - -Note on the RHEL7 part: - malloc(1) would fail to compile due to -D_FORTIFY_SOURCE=2 that - configure passes in --extra-cflags. The flag enables warnings - for unused result of malloc. However, QEMU already knows about - -D_FORTIFY_SOURCE and enables it after configure tests are run. - So, remove it from --extra-cflags and trust configure to do the - right thing. - - The have_ flags are a bit messy. ---- - configure | 24 ++++++++++++++++++++++++ - redhat/build_configure.sh | 3 +++ - redhat/qemu-guest-agent.spec.template | 13 +++++++++++++ - redhat/qemu-kvm.spec.template | 15 +++++++++++++++ - 4 files changed, 55 insertions(+) ---- - configure | 24 ++++++++++++++++++++++++ - redhat/build_configure.sh | 3 +++ - redhat/qemu-guest-agent.spec.template | 13 +++++++++++++ - redhat/qemu-kvm.spec.template | 15 +++++++++++++++ - 4 files changed, 55 insertions(+) - -diff --git a/configure b/configure -index f054934..280a1c2 100755 ---- a/configure -+++ b/configure -@@ -337,6 +337,7 @@ vhdx="" - quorum="" - live_block_migration="no" - numa="" -+tcmalloc="no" - - - # parse CC options first -@@ -1140,6 +1141,10 @@ for opt do - ;; - --enable-live-block-migration) live_block_migration="yes" - ;; -+ --disable-tcmalloc) tcmalloc="no" -+ ;; -+ --enable-tcmalloc) tcmalloc="yes" -+ ;; - *) - echo "ERROR: unknown option $opt" - echo "Try '$0 --help' for more information" -@@ -1416,6 +1421,8 @@ Advanced options (experts only): - --enable-live-block-migration enable live block migration - --disable-numa disable libnuma support - --enable-numa enable libnuma support -+ --disable-tcmalloc disable tcmalloc support -+ --enable-tcmalloc enable tcmalloc support - - NOTE: The object files are built at the place where configure is launched - EOF -@@ -3340,6 +3347,22 @@ EOF - fi - - ########################################## -+# tcmalloc probe -+ -+if test "$tcmalloc" = "yes" ; then -+ cat > $TMPC << EOF -+#include <stdlib.h> -+int main(void) { malloc(1); return 0; } -+EOF -+ -+ if compile_prog "" "-ltcmalloc" ; then -+ LIBS="-ltcmalloc $LIBS" -+ else -+ feature_not_found "tcmalloc" "install gperftools devel" -+ fi -+fi -+ -+########################################## - # signalfd probe - signalfd="no" - cat > $TMPC << EOF -@@ -4451,6 +4474,7 @@ echo "snappy support $snappy" - echo "bzip2 support $bzip2" - echo "Live block migration $live_block_migration" - echo "NUMA host support $numa" -+echo "tcmalloc support $tcmalloc" - - if test "$sdl_too_old" = "yes"; then - echo "-> Your SDL version is too old - please upgrade to have SDL support" --- -1.8.3.1 - diff --git a/SOURCES/kvm-configure-add-option-to-disable-fstack-protect.patch b/SOURCES/kvm-configure-add-option-to-disable-fstack-protect.patch deleted file mode 100644 index 3992b22..0000000 --- a/SOURCES/kvm-configure-add-option-to-disable-fstack-protect.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 4d3e13ce3849bc1c5e9ce3b4ab6f40f0b37f2bfe Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina <mrezanin@redhat.com> -Date: Wed, 5 Feb 2014 15:02:19 +0100 -Subject: configure: add option to disable -fstack-protect - -RH-Author: Miroslav Rezanina <mrezanin@redhat.com> -Message-id: <fbd17542d86a4fd4beb4d9c672df14f237b51a62.1391612088.git.mrezanin@redhat.com> -Patchwork-id: 57118 -O-Subject: [RHEL7 qemu-kvm PATCH 1/2] configure: add option to disable -fstack-protect -Bugzilla: 1044182 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com> -RH-Acked-by: Markus Armbruster <armbru@redhat.com> - -From: Miroslav Rezanina <mrezanin@redhat.com> - -upstream: submitted -(Do not wait for apply to get to RHEL 7.0 before Snapshot 8) - -The -fstack-protector flag family is useful for ensuring safety and for -debugging, but has a performance impact. Here are some boot time comparisons -of the various versions of -fstack-protector using qemu-system-arm on an -x86_64 host: - # -fstack-protector-all - Startup finished in 1.810s (kernel) + 12.331s (initrd) + 49.016s -(userspace) = 1min 3.159s - Startup finished in 1.801s (kernel) + 12.287s (initrd) + 47.925s -(userspace) = 1min 2.013s - Startup finished in 1.812s (kernel) + 12.302s (initrd) + 47.995s -(userspace) = 1min 2.111s - - # -fstack-protector-strong - Startup finished in 1.744s (kernel) + 11.223s (initrd) + 44.688s -(userspace) = 57.657s - Startup finished in 1.721s (kernel) + 11.222s (initrd) + 44.194s -(userspace) = 57.138s - Startup finished in 1.693s (kernel) + 11.250s (initrd) + 44.426s -(userspace) = 57.370s - - # -fstack-protector - Startup finished in 1.705s (kernel) + 11.409s (initrd) + 43.563s -(userspace) = 56.677s - Startup finished in 1.877s (kernel) + 11.137s (initrd) + 43.719s -(userspace) = 56.734s - Startup finished in 1.708s (kernel) + 11.141s (initrd) + 43.628s -(userspace) = 56.478s - - # no stack protector - Startup finished in 1.743s (kernel) + 11.190s (initrd) + 43.709s -(userspace) = 56.643s - Startup finished in 1.763s (kernel) + 11.216s (initrd) + 43.767s -(userspace) = 56.747s - Startup finished in 1.711s (kernel) + 11.283s (initrd) + 43.878s -(userspace) = 56.873s - -This patch introduces a configure option to disable the stack protector -entirely, and conditional stack protector flag selection (in order, based on -availability): -fstack-protector-strong, -fstack-protector, no stack protector. - -Signed-off-by: Steven Noonan <address@hidden> -Cc: Anthony Liguori <address@hidden> -Reviewed-by: Stefan Weil <address@hidden> - -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/configure b/configure -index 3cb1298..bebae4c 100755 ---- a/configure -+++ b/configure -@@ -1281,6 +1281,7 @@ Advanced options (experts only): - --disable-strip disable stripping binaries - --disable-werror disable compilation abort on warning - --disable-stack-protector disable compiler-provided stack protection -+ --enable-stack-protector enable compiler-provided stack protection - --disable-sdl disable SDL - --enable-sdl enable SDL - --with-sdlabi select preferred SDL ABI 1.2 or 2.0 diff --git a/SOURCES/kvm-dataplane-fix-cross-endian-issues.patch b/SOURCES/kvm-dataplane-fix-cross-endian-issues.patch deleted file mode 100644 index c942390..0000000 --- a/SOURCES/kvm-dataplane-fix-cross-endian-issues.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 7ce4ae28726f5ff1803bec0fc9f2d47b0aabf3db Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:11 +0200 -Subject: [PATCH 183/217] dataplane: fix cross-endian issues - -Message-id: <1436260751-25015-69-git-send-email-jasowang@redhat.com> -Patchwork-id: 66843 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 68/68] dataplane: fix cross-endian issues -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Greg Kurz <gkurz@linux.vnet.ibm.com> - -Accesses to vring_avail_event and vring_used_event must honor the queue -endianness. - -This patch allows cross-endian setups to use dataplane (tested with ppc64 -on ppc64le, and vice-versa). - -Suggested-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> - -(cherry picked from commit 1103bac4c86a7e9854af62a2fb10d9733db0450a - from Michael's tree) - -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/dataplane/vring.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c -index 5c7b8c2..d9614da 100644 ---- a/hw/virtio/dataplane/vring.c -+++ b/hw/virtio/dataplane/vring.c -@@ -153,7 +153,8 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring) - return true; - } - -- return vring_need_event(vring_used_event(&vring->vr), new, old); -+ return vring_need_event(virtio_tswap16(vdev, vring_used_event(&vring->vr)), -+ new, old); - } - - -@@ -402,7 +403,8 @@ int vring_pop(VirtIODevice *vdev, Vring *vring, - /* On success, increment avail index. */ - vring->last_avail_idx++; - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { -- vring_avail_event(&vring->vr) = vring->last_avail_idx; -+ vring_avail_event(&vring->vr) = -+ virtio_tswap16(vdev, vring->last_avail_idx); - } - - return head; --- -1.8.3.1 - diff --git a/SOURCES/kvm-docs-Add-PXB-documentation.patch b/SOURCES/kvm-docs-Add-PXB-documentation.patch deleted file mode 100644 index 61714f1..0000000 --- a/SOURCES/kvm-docs-Add-PXB-documentation.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 5bbadf30a3ac2651b67b71aa105fe3f854e4d2ef Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:36 +0200 -Subject: [PATCH 213/217] docs: Add PXB documentation - -Message-id: <1435154016-26233-44-git-send-email-marcel@redhat.com> -Patchwork-id: 66470 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 43/43] docs: Add PXB documentation -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 814550d73a94dcf9f2c9f8d2ee280226f1145388) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - docs/pci_expander_bridge.txt | 58 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 58 insertions(+) - create mode 100644 docs/pci_expander_bridge.txt - -diff --git a/docs/pci_expander_bridge.txt b/docs/pci_expander_bridge.txt -new file mode 100644 -index 0000000..d7913fb ---- /dev/null -+++ b/docs/pci_expander_bridge.txt -@@ -0,0 +1,58 @@ -+PCI EXPANDER BRIDGE (PXB) -+========================= -+ -+Description -+=========== -+PXB is a "light-weight" host bridge in the same PCI domain -+as the main host bridge whose purpose is to enable -+the main host bridge to support multiple PCI root buses. -+It is implemented only for i440fx and can be placed only -+on bus 0 (pci.0). -+ -+As opposed to PCI-2-PCI bridge's secondary bus, PXB's bus -+is a primary bus and can be associated with a NUMA node -+(different from the main host bridge) allowing the guest OS -+to recognize the proximity of a pass-through device to -+other resources as RAM and CPUs. -+ -+Usage -+===== -+A detailed command line would be: -+ -+[qemu-bin + storage options] -+-m 2G -+-object memory-backend-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0 -+-object memory-backend-ram,size=1024M,policy=bind,host-nodes=1,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1 -+-device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd -+-device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0 -device e1000,bus=bridge2,addr=0x3 -+-device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1 -+ -+Here you have: -+ - 2 NUMA nodes for the guest, 0 and 1. (both mapped to the same NUMA node in host, but you can and should put it in different host NUMA nodes) -+ - a pxb host bridge attached to NUMA 1 with an e1000 behind it -+ - a pxb host bridge attached to NUMA 0 with an e1000 behind it -+ - a pxb host bridge not attached to any NUMA with a hard drive behind it. -+ -+Limitations -+=========== -+Please observe that we specified the bus "pci.0" for the second and third pxb. -+This is because when no bus is given, another pxb can be selected by QEMU as default bus, -+however, PXBs can be placed only under the root bus. -+ -+Implementation -+============== -+The PXB is composed by: -+- HostBridge (TYPE_PXB_HOST) -+ The host bridge allows to register and query the PXB's rPCI root bus in QEMU. -+- PXBDev(TYPE_PXB_DEVICE) -+ It is a regular PCI Device that resides on the piix host-bridge bus and its bus uses the same PCI domain. -+ However, the bus behind is exposed through ACPI as a primary PCI bus and starts a new PCI hierarchy. -+ The interrupts from devices behind the PXB are routed through this device the same as if it were a -+ PCI-2-PCI bridge. The _PRT follows the i440fx model. -+- PCIBridgeDev(TYPE_PCI_BRIDGE_DEV) -+ Created automatically as part of init sequence. -+ When adding a device to PXB it is attached to the bridge for two reasons: -+ - Using the bridge will enable hotplug support -+ - All the devices behind the bridge will use bridge's IO/MEM windows compacting -+ the PCI address space. -+ --- -1.8.3.1 - diff --git a/SOURCES/kvm-docs-update-documentation-for-memory-hot-unplug.patch b/SOURCES/kvm-docs-update-documentation-for-memory-hot-unplug.patch deleted file mode 100644 index 7473f6f..0000000 --- a/SOURCES/kvm-docs-update-documentation-for-memory-hot-unplug.patch +++ /dev/null @@ -1,127 +0,0 @@ -From b494cdff797f8617dc7e37e2bdf4abe6f2885d8a Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:51:59 +0200 -Subject: [PATCH 043/217] docs: update documentation for memory hot unplug - -Message-id: <1433724727-46928-2-git-send-email-imammedo@redhat.com> -Patchwork-id: 65388 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/9] docs: update documentation for memory hot unplug -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> - -Add specification about how to use memory hot unplug, and add -a flow diagram to explain memory hot unplug process. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 4fccb4834d0455519ff6d7a81551a8dfd360fefa) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - docs/memory-hotplug.txt | 23 +++++++++++++++++++--- - docs/specs/acpi_mem_hotplug.txt | 42 ++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 61 insertions(+), 4 deletions(-) - -diff --git a/docs/memory-hotplug.txt b/docs/memory-hotplug.txt -index f70571d..56bdd0a 100644 ---- a/docs/memory-hotplug.txt -+++ b/docs/memory-hotplug.txt -@@ -4,9 +4,7 @@ QEMU memory hotplug - This document explains how to use the memory hotplug feature in QEMU, - which is present since v2.1.0. - --Please, note that memory hotunplug is not supported yet. This means --that you're able to add memory, but you're not able to remove it. --Also, proper guest support is required for memory hotplug to work. -+Guest support is required for memory hotplug to work. - - Basic RAM hotplug - ----------------- -@@ -74,3 +72,22 @@ comes from regular RAM, 1GB is a 1GB hugepage page and 256MB is from - -device pc-dimm,id=dimm1,memdev=mem1 \ - -object memory-backend-file,id=mem2,size=256M,mem-path=/mnt/hugepages-2MB \ - -device pc-dimm,id=dimm2,memdev=mem2 -+ -+ -+RAM hot-unplug -+--------------- -+ -+In order to be able to hot unplug pc-dimm device, QEMU has to be told the ids -+of pc-dimm device and memory backend object. The ids were assigned when you hot -+plugged memory. -+ -+Two monitor commands are used to hot unplug memory: -+ -+ - "device_del": deletes a front-end pc-dimm device -+ - "object_del": deletes a memory backend object -+ -+For example, assuming that the pc-dimm device with id "dimm1" exists, and its memory -+backend is "mem1", the following commands tries to remove it. -+ -+ (qemu) device_del dimm1 -+ (qemu) object_del mem1 -diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt -index 1290994..dcc4808 100644 ---- a/docs/specs/acpi_mem_hotplug.txt -+++ b/docs/specs/acpi_mem_hotplug.txt -@@ -2,7 +2,7 @@ QEMU<->ACPI BIOS memory hotplug interface - -------------------------------------- - - ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add --events. -+and hot-remove events. - - Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access): - --------------------------------------------------------------- -@@ -42,3 +42,43 @@ Selecting memory device slot beyond present range has no effect on platform: - ignored - - read accesses to memory hot-plug registers not documented above return - all bits set to 1. -+ -+Memory hot remove process diagram: -+---------------------------------- -+ +-------------+ +-----------------------+ +------------------+ -+ | 1. QEMU | | 2. QEMU | |3. QEMU | -+ | device_del +---->+ device unplug request +----->+Send SCI to guest,| -+ | | | cb | |return control to | -+ +-------------+ +-----------------------+ |management | -+ +------------------+ -+ -+ +---------------------------------------------------------------------+ -+ -+ +---------------------+ +-------------------------+ -+ | OSPM: | remove event | OSPM: | -+ | send Eject Request, | | Scan memory devices | -+ | clear remove event +<-------------+ for event flags | -+ | | | | -+ +---------------------+ +-------------------------+ -+ | -+ | -+ +---------v--------+ +-----------------------+ -+ | Guest OS: | success | OSPM: | -+ | process Ejection +----------->+ Execute _EJ0 method, | -+ | request | | set eject bit in flags| -+ +------------------+ +-----------------------+ -+ |failure | -+ v v -+ +------------------------+ +-----------------------+ -+ | OSPM: | | QEMU: | -+ | set OST event & status | | call device unplug cb | -+ | fields | | | -+ +------------------------+ +-----------------------+ -+ | | -+ v v -+ +------------------+ +-------------------+ -+ |QEMU: | |QEMU: | -+ |Send OST QMP event| |Send device deleted| -+ | | |QMP event | -+ +------------------+ | | -+ +-------------------+ --- -1.8.3.1 - diff --git a/SOURCES/kvm-exec.c-Add-new-address_space_ld-st-functions.patch b/SOURCES/kvm-exec.c-Add-new-address_space_ld-st-functions.patch deleted file mode 100644 index e17f4d6..0000000 --- a/SOURCES/kvm-exec.c-Add-new-address_space_ld-st-functions.patch +++ /dev/null @@ -1,643 +0,0 @@ -From 3154c2f552858354b17a3bab95120b5138b436f0 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:16 +0200 -Subject: [PATCH 128/217] exec.c: Add new address_space_ld*/st* functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-14-git-send-email-jasowang@redhat.com> -Patchwork-id: 66788 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 13/68] exec.c: Add new address_space_ld*/st* functions -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Add new address_space_ld*/st* functions which allow transaction -attributes and error reporting for basic load and stores. These -are named to be in line with the address_space_read/write/rw -buffer operations. - -The existing ld/st*_phys functions are now wrappers around -the new functions. - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit 500131154d677930fce35ec3a6f0b5a26bcd2973) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - exec.c | 297 +++++++++++++++++++++++++++++++++++++++++--------- - include/exec/memory.h | 67 ++++++++++++ - 2 files changed, 314 insertions(+), 50 deletions(-) - -diff --git a/exec.c b/exec.c -index 9811a9c..399543e 100644 ---- a/exec.c -+++ b/exec.c -@@ -2679,20 +2679,22 @@ void cpu_physical_memory_unmap(void *buffer, hwaddr len, - } - - /* warning: addr must be aligned */ --static inline uint32_t ldl_phys_internal(AddressSpace *as, hwaddr addr, -- enum device_endian endian) -+static inline uint32_t address_space_ldl_internal(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, -+ MemTxResult *result, -+ enum device_endian endian) - { - uint8_t *ptr; - uint64_t val; - MemoryRegion *mr; - hwaddr l = 4; - hwaddr addr1; -+ MemTxResult r; - - mr = address_space_translate(as, addr, &addr1, &l, false); - if (l < 4 || !memory_access_is_direct(mr, false)) { - /* I/O case */ -- memory_region_dispatch_read(mr, addr1, &val, 4, -- MEMTXATTRS_UNSPECIFIED); -+ r = memory_region_dispatch_read(mr, addr1, &val, 4, attrs); - #if defined(TARGET_WORDS_BIGENDIAN) - if (endian == DEVICE_LITTLE_ENDIAN) { - val = bswap32(val); -@@ -2718,41 +2720,68 @@ static inline uint32_t ldl_phys_internal(AddressSpace *as, hwaddr addr, - val = ldl_p(ptr); - break; - } -+ r = MEMTX_OK; -+ } -+ if (result) { -+ *result = r; - } - return val; - } - -+uint32_t address_space_ldl(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_ldl_internal(as, addr, attrs, result, -+ DEVICE_NATIVE_ENDIAN); -+} -+ -+uint32_t address_space_ldl_le(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_ldl_internal(as, addr, attrs, result, -+ DEVICE_LITTLE_ENDIAN); -+} -+ -+uint32_t address_space_ldl_be(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_ldl_internal(as, addr, attrs, result, -+ DEVICE_BIG_ENDIAN); -+} -+ - uint32_t ldl_phys(AddressSpace *as, hwaddr addr) - { -- return ldl_phys_internal(as, addr, DEVICE_NATIVE_ENDIAN); -+ return address_space_ldl(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - uint32_t ldl_le_phys(AddressSpace *as, hwaddr addr) - { -- return ldl_phys_internal(as, addr, DEVICE_LITTLE_ENDIAN); -+ return address_space_ldl_le(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - uint32_t ldl_be_phys(AddressSpace *as, hwaddr addr) - { -- return ldl_phys_internal(as, addr, DEVICE_BIG_ENDIAN); -+ return address_space_ldl_be(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* warning: addr must be aligned */ --static inline uint64_t ldq_phys_internal(AddressSpace *as, hwaddr addr, -- enum device_endian endian) -+static inline uint64_t address_space_ldq_internal(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, -+ MemTxResult *result, -+ enum device_endian endian) - { - uint8_t *ptr; - uint64_t val; - MemoryRegion *mr; - hwaddr l = 8; - hwaddr addr1; -+ MemTxResult r; - - mr = address_space_translate(as, addr, &addr1, &l, - false); - if (l < 8 || !memory_access_is_direct(mr, false)) { - /* I/O case */ -- memory_region_dispatch_read(mr, addr1, &val, 8, -- MEMTXATTRS_UNSPECIFIED); -+ r = memory_region_dispatch_read(mr, addr1, &val, 8, attrs); - #if defined(TARGET_WORDS_BIGENDIAN) - if (endian == DEVICE_LITTLE_ENDIAN) { - val = bswap64(val); -@@ -2778,49 +2807,88 @@ static inline uint64_t ldq_phys_internal(AddressSpace *as, hwaddr addr, - val = ldq_p(ptr); - break; - } -+ r = MEMTX_OK; -+ } -+ if (result) { -+ *result = r; - } - return val; - } - -+uint64_t address_space_ldq(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_ldq_internal(as, addr, attrs, result, -+ DEVICE_NATIVE_ENDIAN); -+} -+ -+uint64_t address_space_ldq_le(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_ldq_internal(as, addr, attrs, result, -+ DEVICE_LITTLE_ENDIAN); -+} -+ -+uint64_t address_space_ldq_be(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_ldq_internal(as, addr, attrs, result, -+ DEVICE_BIG_ENDIAN); -+} -+ - uint64_t ldq_phys(AddressSpace *as, hwaddr addr) - { -- return ldq_phys_internal(as, addr, DEVICE_NATIVE_ENDIAN); -+ return address_space_ldq(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - uint64_t ldq_le_phys(AddressSpace *as, hwaddr addr) - { -- return ldq_phys_internal(as, addr, DEVICE_LITTLE_ENDIAN); -+ return address_space_ldq_le(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - uint64_t ldq_be_phys(AddressSpace *as, hwaddr addr) - { -- return ldq_phys_internal(as, addr, DEVICE_BIG_ENDIAN); -+ return address_space_ldq_be(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* XXX: optimize */ --uint32_t ldub_phys(AddressSpace *as, hwaddr addr) -+uint32_t address_space_ldub(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) - { - uint8_t val; -- address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, &val, 1, 0); -+ MemTxResult r; -+ -+ r = address_space_rw(as, addr, attrs, &val, 1, 0); -+ if (result) { -+ *result = r; -+ } - return val; - } - -+uint32_t ldub_phys(AddressSpace *as, hwaddr addr) -+{ -+ return address_space_ldub(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); -+} -+ - /* warning: addr must be aligned */ --static inline uint32_t lduw_phys_internal(AddressSpace *as, hwaddr addr, -- enum device_endian endian) -+static inline uint32_t address_space_lduw_internal(AddressSpace *as, -+ hwaddr addr, -+ MemTxAttrs attrs, -+ MemTxResult *result, -+ enum device_endian endian) - { - uint8_t *ptr; - uint64_t val; - MemoryRegion *mr; - hwaddr l = 2; - hwaddr addr1; -+ MemTxResult r; - - mr = address_space_translate(as, addr, &addr1, &l, - false); - if (l < 2 || !memory_access_is_direct(mr, false)) { - /* I/O case */ -- memory_region_dispatch_read(mr, addr1, &val, 2, -- MEMTXATTRS_UNSPECIFIED); -+ r = memory_region_dispatch_read(mr, addr1, &val, 2, attrs); - #if defined(TARGET_WORDS_BIGENDIAN) - if (endian == DEVICE_LITTLE_ENDIAN) { - val = bswap16(val); -@@ -2846,40 +2914,66 @@ static inline uint32_t lduw_phys_internal(AddressSpace *as, hwaddr addr, - val = lduw_p(ptr); - break; - } -+ r = MEMTX_OK; -+ } -+ if (result) { -+ *result = r; - } - return val; - } - -+uint32_t address_space_lduw(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_lduw_internal(as, addr, attrs, result, -+ DEVICE_NATIVE_ENDIAN); -+} -+ -+uint32_t address_space_lduw_le(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_lduw_internal(as, addr, attrs, result, -+ DEVICE_LITTLE_ENDIAN); -+} -+ -+uint32_t address_space_lduw_be(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ return address_space_lduw_internal(as, addr, attrs, result, -+ DEVICE_BIG_ENDIAN); -+} -+ - uint32_t lduw_phys(AddressSpace *as, hwaddr addr) - { -- return lduw_phys_internal(as, addr, DEVICE_NATIVE_ENDIAN); -+ return address_space_lduw(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - uint32_t lduw_le_phys(AddressSpace *as, hwaddr addr) - { -- return lduw_phys_internal(as, addr, DEVICE_LITTLE_ENDIAN); -+ return address_space_lduw_le(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - uint32_t lduw_be_phys(AddressSpace *as, hwaddr addr) - { -- return lduw_phys_internal(as, addr, DEVICE_BIG_ENDIAN); -+ return address_space_lduw_be(as, addr, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* warning: addr must be aligned. The ram page is not masked as dirty - and the code inside is not invalidated. It is useful if the dirty - bits are used to track modified PTEs */ --void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) -+void address_space_stl_notdirty(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) - { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 4; - hwaddr addr1; -+ MemTxResult r; - - mr = address_space_translate(as, addr, &addr1, &l, - true); - if (l < 4 || !memory_access_is_direct(mr, true)) { -- memory_region_dispatch_write(mr, addr1, val, 4, -- MEMTXATTRS_UNSPECIFIED); -+ r = memory_region_dispatch_write(mr, addr1, val, 4, attrs); - } else { - addr1 += memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK; - ptr = qemu_get_ram_ptr(addr1); -@@ -2893,18 +2987,30 @@ void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) - cpu_physical_memory_set_dirty_range_nocode(addr1, 4); - } - } -+ r = MEMTX_OK; -+ } -+ if (result) { -+ *result = r; - } - } - -+void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) -+{ -+ address_space_stl_notdirty(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); -+} -+ - /* warning: addr must be aligned */ --static inline void stl_phys_internal(AddressSpace *as, -- hwaddr addr, uint32_t val, -- enum device_endian endian) -+static inline void address_space_stl_internal(AddressSpace *as, -+ hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, -+ MemTxResult *result, -+ enum device_endian endian) - { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 4; - hwaddr addr1; -+ MemTxResult r; - - mr = address_space_translate(as, addr, &addr1, &l, - true); -@@ -2918,8 +3024,7 @@ static inline void stl_phys_internal(AddressSpace *as, - val = bswap32(val); - } - #endif -- memory_region_dispatch_write(mr, addr1, val, 4, -- MEMTXATTRS_UNSPECIFIED); -+ r = memory_region_dispatch_write(mr, addr1, val, 4, attrs); - } else { - /* RAM case */ - addr1 += memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK; -@@ -2936,40 +3041,79 @@ static inline void stl_phys_internal(AddressSpace *as, - break; - } - invalidate_and_set_dirty(addr1, 4); -+ r = MEMTX_OK; -+ } -+ if (result) { -+ *result = r; - } - } - -+void address_space_stl(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ address_space_stl_internal(as, addr, val, attrs, result, -+ DEVICE_NATIVE_ENDIAN); -+} -+ -+void address_space_stl_le(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ address_space_stl_internal(as, addr, val, attrs, result, -+ DEVICE_LITTLE_ENDIAN); -+} -+ -+void address_space_stl_be(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ address_space_stl_internal(as, addr, val, attrs, result, -+ DEVICE_BIG_ENDIAN); -+} -+ - void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { -- stl_phys_internal(as, addr, val, DEVICE_NATIVE_ENDIAN); -+ address_space_stl(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - void stl_le_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { -- stl_phys_internal(as, addr, val, DEVICE_LITTLE_ENDIAN); -+ address_space_stl_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - void stl_be_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { -- stl_phys_internal(as, addr, val, DEVICE_BIG_ENDIAN); -+ address_space_stl_be(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* XXX: optimize */ --void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val) -+void address_space_stb(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) - { - uint8_t v = val; -- address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, &v, 1, 1); -+ MemTxResult r; -+ -+ r = address_space_rw(as, addr, attrs, &v, 1, 1); -+ if (result) { -+ *result = r; -+ } -+} -+ -+void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val) -+{ -+ address_space_stb(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* warning: addr must be aligned */ --static inline void stw_phys_internal(AddressSpace *as, -- hwaddr addr, uint32_t val, -- enum device_endian endian) -+static inline void address_space_stw_internal(AddressSpace *as, -+ hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, -+ MemTxResult *result, -+ enum device_endian endian) - { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 2; - hwaddr addr1; -+ MemTxResult r; - - mr = address_space_translate(as, addr, &addr1, &l, true); - if (l < 2 || !memory_access_is_direct(mr, true)) { -@@ -2982,8 +3126,7 @@ static inline void stw_phys_internal(AddressSpace *as, - val = bswap16(val); - } - #endif -- memory_region_dispatch_write(mr, addr1, val, 2, -- MEMTXATTRS_UNSPECIFIED); -+ r = memory_region_dispatch_write(mr, addr1, val, 2, attrs); - } else { - /* RAM case */ - addr1 += memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK; -@@ -3000,41 +3143,95 @@ static inline void stw_phys_internal(AddressSpace *as, - break; - } - invalidate_and_set_dirty(addr1, 2); -+ r = MEMTX_OK; -+ } -+ if (result) { -+ *result = r; - } - } - -+void address_space_stw(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ address_space_stw_internal(as, addr, val, attrs, result, -+ DEVICE_NATIVE_ENDIAN); -+} -+ -+void address_space_stw_le(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ address_space_stw_internal(as, addr, val, attrs, result, -+ DEVICE_LITTLE_ENDIAN); -+} -+ -+void address_space_stw_be(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ address_space_stw_internal(as, addr, val, attrs, result, -+ DEVICE_BIG_ENDIAN); -+} -+ - void stw_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { -- stw_phys_internal(as, addr, val, DEVICE_NATIVE_ENDIAN); -+ address_space_stw(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - void stw_le_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { -- stw_phys_internal(as, addr, val, DEVICE_LITTLE_ENDIAN); -+ address_space_stw_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - void stw_be_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { -- stw_phys_internal(as, addr, val, DEVICE_BIG_ENDIAN); -+ address_space_stw_be(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* XXX: optimize */ --void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val) -+void address_space_stq(AddressSpace *as, hwaddr addr, uint64_t val, -+ MemTxAttrs attrs, MemTxResult *result) - { -+ MemTxResult r; - val = tswap64(val); -- address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, (void *) &val, 8, 1); -+ r = address_space_rw(as, addr, attrs, (void *) &val, 8, 1); -+ if (result) { -+ *result = r; -+ } - } - --void stq_le_phys(AddressSpace *as, hwaddr addr, uint64_t val) -+void address_space_stq_le(AddressSpace *as, hwaddr addr, uint64_t val, -+ MemTxAttrs attrs, MemTxResult *result) - { -+ MemTxResult r; - val = cpu_to_le64(val); -- address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, (void *) &val, 8, 1); -+ r = address_space_rw(as, addr, attrs, (void *) &val, 8, 1); -+ if (result) { -+ *result = r; -+ } -+} -+void address_space_stq_be(AddressSpace *as, hwaddr addr, uint64_t val, -+ MemTxAttrs attrs, MemTxResult *result) -+{ -+ MemTxResult r; -+ val = cpu_to_be64(val); -+ r = address_space_rw(as, addr, attrs, (void *) &val, 8, 1); -+ if (result) { -+ *result = r; -+ } -+} -+ -+void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val) -+{ -+ address_space_stq(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); -+} -+ -+void stq_le_phys(AddressSpace *as, hwaddr addr, uint64_t val) -+{ -+ address_space_stq_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - void stq_be_phys(AddressSpace *as, hwaddr addr, uint64_t val) - { -- val = cpu_to_be64(val); -- address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, (void *) &val, 8, 1); -+ address_space_stq_be(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); - } - - /* virtual memory access for debug (includes writing to ROM) */ -diff --git a/include/exec/memory.h b/include/exec/memory.h -index 660908e..0ccfd3b 100644 ---- a/include/exec/memory.h -+++ b/include/exec/memory.h -@@ -1165,6 +1165,73 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr, - MemTxResult address_space_read(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, - uint8_t *buf, int len); - -+/** -+ * address_space_ld*: load from an address space -+ * address_space_st*: store to an address space -+ * -+ * These functions perform a load or store of the byte, word, -+ * longword or quad to the specified address within the AddressSpace. -+ * The _le suffixed functions treat the data as little endian; -+ * _be indicates big endian; no suffix indicates "same endianness -+ * as guest CPU". -+ * -+ * The "guest CPU endianness" accessors are deprecated for use outside -+ * target-* code; devices should be CPU-agnostic and use either the LE -+ * or the BE accessors. -+ * -+ * @as #AddressSpace to be accessed -+ * @addr: address within that address space -+ * @val: data value, for stores -+ * @attrs: memory transaction attributes -+ * @result: location to write the success/failure of the transaction; -+ * if NULL, this information is discarded -+ */ -+uint32_t address_space_ldub(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint32_t address_space_lduw_le(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint32_t address_space_lduw_be(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint32_t address_space_ldl_le(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint32_t address_space_ldl_be(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint64_t address_space_ldq_le(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint64_t address_space_ldq_be(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stb(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stw_le(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stw_be(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stl_le(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stl_be(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stq_le(AddressSpace *as, hwaddr addr, uint64_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stq_be(AddressSpace *as, hwaddr addr, uint64_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+ -+#ifdef NEED_CPU_H -+uint32_t address_space_lduw(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint32_t address_space_ldl(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+uint64_t address_space_ldq(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stl_notdirty(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stw(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stl(AddressSpace *as, hwaddr addr, uint32_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+void address_space_stq(AddressSpace *as, hwaddr addr, uint64_t val, -+ MemTxAttrs attrs, MemTxResult *result); -+#endif -+ - /* address_space_translate: translate an address range into an address space - * into a MemoryRegion and an address range into that section - * --- -1.8.3.1 - diff --git a/SOURCES/kvm-exec.c-Convert-subpage-memory-ops-to-_with_attrs.patch b/SOURCES/kvm-exec.c-Convert-subpage-memory-ops-to-_with_attrs.patch deleted file mode 100644 index 0b9395c..0000000 --- a/SOURCES/kvm-exec.c-Convert-subpage-memory-ops-to-_with_attrs.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 552d0c2acd6e04a26424f64db3ec9b8e53a8905b Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:14 +0200 -Subject: [PATCH 126/217] exec.c: Convert subpage memory ops to _with_attrs - -Message-id: <1436260751-25015-12-git-send-email-jasowang@redhat.com> -Patchwork-id: 66786 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 11/68] exec.c: Convert subpage memory ops to _with_attrs -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Convert the subpage memory ops to _with_attrs; this will allow -us to pass the attributes through to the underlying access -functions. (Nothing uses the attributes yet.) - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> -(cherry picked from commit f25a49e0057bbfcc2b1111f60785d919b6ddaeea) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - exec.c | 33 +++++++++++++++++++++------------ - 1 file changed, 21 insertions(+), 12 deletions(-) - -diff --git a/exec.c b/exec.c -index 34dafd2..bba6f26 100644 ---- a/exec.c -+++ b/exec.c -@@ -1941,8 +1941,8 @@ static const MemoryRegionOps watch_mem_ops = { - .endianness = DEVICE_NATIVE_ENDIAN, - }; - --static uint64_t subpage_read(void *opaque, hwaddr addr, -- unsigned len) -+static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, -+ unsigned len, MemTxAttrs attrs) - { - subpage_t *subpage = opaque; - uint8_t buf[8]; -@@ -1951,23 +1951,29 @@ static uint64_t subpage_read(void *opaque, hwaddr addr, - printf("%s: subpage %p len %u addr " TARGET_FMT_plx "\n", __func__, - subpage, len, addr); - #endif -- address_space_read(subpage->as, addr + subpage->base, buf, len); -+ if (address_space_read(subpage->as, addr + subpage->base, buf, len)) { -+ return MEMTX_DECODE_ERROR; -+ } - switch (len) { - case 1: -- return ldub_p(buf); -+ *data = ldub_p(buf); -+ return MEMTX_OK; - case 2: -- return lduw_p(buf); -+ *data = lduw_p(buf); -+ return MEMTX_OK; - case 4: -- return ldl_p(buf); -+ *data = ldl_p(buf); -+ return MEMTX_OK; - case 8: -- return ldq_p(buf); -+ *data = ldq_p(buf); -+ return MEMTX_OK; - default: - abort(); - } - } - --static void subpage_write(void *opaque, hwaddr addr, -- uint64_t value, unsigned len) -+static MemTxResult subpage_write(void *opaque, hwaddr addr, -+ uint64_t value, unsigned len, MemTxAttrs attrs) - { - subpage_t *subpage = opaque; - uint8_t buf[8]; -@@ -1993,7 +1999,10 @@ static void subpage_write(void *opaque, hwaddr addr, - default: - abort(); - } -- address_space_write(subpage->as, addr + subpage->base, buf, len); -+ if (address_space_write(subpage->as, addr + subpage->base, buf, len)) { -+ return MEMTX_DECODE_ERROR; -+ } -+ return MEMTX_OK; - } - - static bool subpage_accepts(void *opaque, hwaddr addr, -@@ -2010,8 +2019,8 @@ static bool subpage_accepts(void *opaque, hwaddr addr, - } - - static const MemoryRegionOps subpage_ops = { -- .read = subpage_read, -- .write = subpage_write, -+ .read_with_attrs = subpage_read, -+ .write_with_attrs = subpage_write, - .impl.min_access_size = 1, - .impl.max_access_size = 8, - .valid.min_access_size = 1, --- -1.8.3.1 - diff --git a/SOURCES/kvm-exec.c-Make-address_space_rw-take-transaction-attrib.patch b/SOURCES/kvm-exec.c-Make-address_space_rw-take-transaction-attrib.patch deleted file mode 100644 index b75830b..0000000 --- a/SOURCES/kvm-exec.c-Make-address_space_rw-take-transaction-attrib.patch +++ /dev/null @@ -1,445 +0,0 @@ -From 84f7ad852df7090dcb915cfe774918954c011891 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:15 +0200 -Subject: [PATCH 127/217] exec.c: Make address_space_rw take transaction - attributes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-13-git-send-email-jasowang@redhat.com> -Patchwork-id: 66787 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 12/68] exec.c: Make address_space_rw take transaction attributes -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Make address_space_rw take transaction attributes, rather -than always using the 'unspecified' attributes. - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit 5c9eb0286c819c1836220a32f2e1a7b5004ac79a) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - dma-helpers.c | 3 ++- - exec.c | 51 ++++++++++++++++++++++++++---------------------- - hw/mips/mips_jazz.c | 6 ++++-- - hw/pci-host/prep.c | 6 ++++-- - include/exec/memory.h | 31 ++++++++++++++++++----------- - include/sysemu/dma.h | 3 ++- - ioport.c | 16 +++++++++------ - kvm-all.c | 3 ++- - scripts/coverity-model.c | 8 +++++--- - 9 files changed, 77 insertions(+), 50 deletions(-) - -diff --git a/dma-helpers.c b/dma-helpers.c -index 6918572..33b1983 100644 ---- a/dma-helpers.c -+++ b/dma-helpers.c -@@ -28,7 +28,8 @@ int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_t len) - memset(fillbuf, c, FILLBUF_SIZE); - while (len > 0) { - l = len < FILLBUF_SIZE ? len : FILLBUF_SIZE; -- error |= address_space_rw(as, addr, fillbuf, l, true); -+ error |= address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, -+ fillbuf, l, true); - len -= l; - addr += l; - } -diff --git a/exec.c b/exec.c -index bba6f26..9811a9c 100644 ---- a/exec.c -+++ b/exec.c -@@ -1946,13 +1946,16 @@ static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, - { - subpage_t *subpage = opaque; - uint8_t buf[8]; -+ MemTxResult res; - - #if defined(DEBUG_SUBPAGE) - printf("%s: subpage %p len %u addr " TARGET_FMT_plx "\n", __func__, - subpage, len, addr); - #endif -- if (address_space_read(subpage->as, addr + subpage->base, buf, len)) { -- return MEMTX_DECODE_ERROR; -+ res = address_space_read(subpage->as, addr + subpage->base, -+ attrs, buf, len); -+ if (res) { -+ return res; - } - switch (len) { - case 1: -@@ -1999,10 +2002,8 @@ static MemTxResult subpage_write(void *opaque, hwaddr addr, - default: - abort(); - } -- if (address_space_write(subpage->as, addr + subpage->base, buf, len)) { -- return MEMTX_DECODE_ERROR; -- } -- return MEMTX_OK; -+ return address_space_write(subpage->as, addr + subpage->base, -+ attrs, buf, len); - } - - static bool subpage_accepts(void *opaque, hwaddr addr, -@@ -2313,8 +2314,8 @@ static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr) - return l; - } - --bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, -- int len, bool is_write) -+MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, -+ uint8_t *buf, int len, bool is_write) - { - hwaddr l; - uint8_t *ptr; -@@ -2322,7 +2323,6 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, - hwaddr addr1; - MemoryRegion *mr; - MemTxResult result = MEMTX_OK; -- MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; - - while (len > 0) { - l = len; -@@ -2414,22 +2414,24 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, - return result; - } - --bool address_space_write(AddressSpace *as, hwaddr addr, -- const uint8_t *buf, int len) -+MemTxResult address_space_write(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, -+ const uint8_t *buf, int len) - { -- return address_space_rw(as, addr, (uint8_t *)buf, len, true); -+ return address_space_rw(as, addr, attrs, (uint8_t *)buf, len, true); - } - --bool address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len) -+MemTxResult address_space_read(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, -+ uint8_t *buf, int len) - { -- return address_space_rw(as, addr, buf, len, false); -+ return address_space_rw(as, addr, attrs, buf, len, false); - } - - - void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf, - int len, int is_write) - { -- address_space_rw(&address_space_memory, addr, buf, len, is_write); -+ address_space_rw(&address_space_memory, addr, MEMTXATTRS_UNSPECIFIED, -+ buf, len, is_write); - } - - enum write_rom_type { -@@ -2600,7 +2602,8 @@ void *address_space_map(AddressSpace *as, - memory_region_ref(mr); - bounce.mr = mr; - if (!is_write) { -- address_space_read(as, addr, bounce.buffer, l); -+ address_space_read(as, addr, MEMTXATTRS_UNSPECIFIED, -+ bounce.buffer, l); - } - - *plen = l; -@@ -2653,7 +2656,8 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, - return; - } - if (is_write) { -- address_space_write(as, bounce.addr, bounce.buffer, access_len); -+ address_space_write(as, bounce.addr, MEMTXATTRS_UNSPECIFIED, -+ bounce.buffer, access_len); - } - qemu_vfree(bounce.buffer); - bounce.buffer = NULL; -@@ -2797,7 +2801,7 @@ uint64_t ldq_be_phys(AddressSpace *as, hwaddr addr) - uint32_t ldub_phys(AddressSpace *as, hwaddr addr) - { - uint8_t val; -- address_space_rw(as, addr, &val, 1, 0); -+ address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, &val, 1, 0); - return val; - } - -@@ -2954,7 +2958,7 @@ void stl_be_phys(AddressSpace *as, hwaddr addr, uint32_t val) - void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val) - { - uint8_t v = val; -- address_space_rw(as, addr, &v, 1, 1); -+ address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, &v, 1, 1); - } - - /* warning: addr must be aligned */ -@@ -3018,19 +3022,19 @@ void stw_be_phys(AddressSpace *as, hwaddr addr, uint32_t val) - void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val) - { - val = tswap64(val); -- address_space_rw(as, addr, (void *) &val, 8, 1); -+ address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, (void *) &val, 8, 1); - } - - void stq_le_phys(AddressSpace *as, hwaddr addr, uint64_t val) - { - val = cpu_to_le64(val); -- address_space_rw(as, addr, (void *) &val, 8, 1); -+ address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, (void *) &val, 8, 1); - } - - void stq_be_phys(AddressSpace *as, hwaddr addr, uint64_t val) - { - val = cpu_to_be64(val); -- address_space_rw(as, addr, (void *) &val, 8, 1); -+ address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, (void *) &val, 8, 1); - } - - /* virtual memory access for debug (includes writing to ROM) */ -@@ -3054,7 +3058,8 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, - if (is_write) { - cpu_physical_memory_write_rom(cpu->as, phys_addr, buf, l); - } else { -- address_space_rw(cpu->as, phys_addr, buf, l, 0); -+ address_space_rw(cpu->as, phys_addr, MEMTXATTRS_UNSPECIFIED, -+ buf, l, 0); - } - len -= l; - buf += l; -diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c -index 07f3c27..2c153e0 100644 ---- a/hw/mips/mips_jazz.c -+++ b/hw/mips/mips_jazz.c -@@ -61,7 +61,8 @@ static void main_cpu_reset(void *opaque) - static uint64_t rtc_read(void *opaque, hwaddr addr, unsigned size) - { - uint8_t val; -- address_space_read(&address_space_memory, 0x90000071, &val, 1); -+ address_space_read(&address_space_memory, 0x90000071, -+ MEMTXATTRS_UNSPECIFIED, &val, 1); - return val; - } - -@@ -69,7 +70,8 @@ static void rtc_write(void *opaque, hwaddr addr, - uint64_t val, unsigned size) - { - uint8_t buf = val & 0xff; -- address_space_write(&address_space_memory, 0x90000071, &buf, 1); -+ address_space_write(&address_space_memory, 0x90000071, -+ MEMTXATTRS_UNSPECIFIED, &buf, 1); - } - - static const MemoryRegionOps rtc_ops = { -diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c -index 6cea6ff..c63f45d 100644 ---- a/hw/pci-host/prep.c -+++ b/hw/pci-host/prep.c -@@ -140,7 +140,8 @@ static uint64_t raven_io_read(void *opaque, hwaddr addr, - uint8_t buf[4]; - - addr = raven_io_address(s, addr); -- address_space_read(&s->pci_io_as, addr + 0x80000000, buf, size); -+ address_space_read(&s->pci_io_as, addr + 0x80000000, -+ MEMTXATTRS_UNSPECIFIED, buf, size); - - if (size == 1) { - return buf[0]; -@@ -171,7 +172,8 @@ static void raven_io_write(void *opaque, hwaddr addr, - g_assert_not_reached(); - } - -- address_space_write(&s->pci_io_as, addr + 0x80000000, buf, size); -+ address_space_write(&s->pci_io_as, addr + 0x80000000, -+ MEMTXATTRS_UNSPECIFIED, buf, size); - } - - static const MemoryRegionOps raven_io_ops = { -diff --git a/include/exec/memory.h b/include/exec/memory.h -index a289eec..660908e 100644 ---- a/include/exec/memory.h -+++ b/include/exec/memory.h -@@ -1120,41 +1120,50 @@ void address_space_destroy(AddressSpace *as); - /** - * address_space_rw: read from or write to an address space. - * -- * Return true if the operation hit any unassigned memory or encountered an -- * IOMMU fault. -+ * Return a MemTxResult indicating whether the operation succeeded -+ * or failed (eg unassigned memory, device rejected the transaction, -+ * IOMMU fault). - * - * @as: #AddressSpace to be accessed - * @addr: address within that address space -+ * @attrs: memory transaction attributes - * @buf: buffer with the data transferred - * @is_write: indicates the transfer direction - */ --bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, -- int len, bool is_write); -+MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, uint8_t *buf, -+ int len, bool is_write); - - /** - * address_space_write: write to address space. - * -- * Return true if the operation hit any unassigned memory or encountered an -- * IOMMU fault. -+ * Return a MemTxResult indicating whether the operation succeeded -+ * or failed (eg unassigned memory, device rejected the transaction, -+ * IOMMU fault). - * - * @as: #AddressSpace to be accessed - * @addr: address within that address space -+ * @attrs: memory transaction attributes - * @buf: buffer with the data transferred - */ --bool address_space_write(AddressSpace *as, hwaddr addr, -- const uint8_t *buf, int len); -+MemTxResult address_space_write(AddressSpace *as, hwaddr addr, -+ MemTxAttrs attrs, -+ const uint8_t *buf, int len); - - /** - * address_space_read: read from an address space. - * -- * Return true if the operation hit any unassigned memory or encountered an -- * IOMMU fault. -+ * Return a MemTxResult indicating whether the operation succeeded -+ * or failed (eg unassigned memory, device rejected the transaction, -+ * IOMMU fault). - * - * @as: #AddressSpace to be accessed - * @addr: address within that address space -+ * @attrs: memory transaction attributes - * @buf: buffer with the data transferred - */ --bool address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len); -+MemTxResult address_space_read(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, -+ uint8_t *buf, int len); - - /* address_space_translate: translate an address range into an address space - * into a MemoryRegion and an address range into that section -diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h -index 3f2f4c8..efa8b99 100644 ---- a/include/sysemu/dma.h -+++ b/include/sysemu/dma.h -@@ -88,7 +88,8 @@ static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, - void *buf, dma_addr_t len, - DMADirection dir) - { -- return address_space_rw(as, addr, buf, len, dir == DMA_DIRECTION_FROM_DEVICE); -+ return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, -+ buf, len, dir == DMA_DIRECTION_FROM_DEVICE); - } - - static inline int dma_memory_read_relaxed(AddressSpace *as, dma_addr_t addr, -diff --git a/ioport.c b/ioport.c -index 783a3ae..b345bd9 100644 ---- a/ioport.c -+++ b/ioport.c -@@ -64,7 +64,8 @@ void cpu_outb(pio_addr_t addr, uint8_t val) - { - LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); - trace_cpu_out(addr, val); -- address_space_write(&address_space_io, addr, &val, 1); -+ address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, -+ &val, 1); - } - - void cpu_outw(pio_addr_t addr, uint16_t val) -@@ -74,7 +75,8 @@ void cpu_outw(pio_addr_t addr, uint16_t val) - LOG_IOPORT("outw: %04"FMT_pioaddr" %04"PRIx16"\n", addr, val); - trace_cpu_out(addr, val); - stw_p(buf, val); -- address_space_write(&address_space_io, addr, buf, 2); -+ address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, -+ buf, 2); - } - - void cpu_outl(pio_addr_t addr, uint32_t val) -@@ -84,14 +86,16 @@ void cpu_outl(pio_addr_t addr, uint32_t val) - LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", addr, val); - trace_cpu_out(addr, val); - stl_p(buf, val); -- address_space_write(&address_space_io, addr, buf, 4); -+ address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, -+ buf, 4); - } - - uint8_t cpu_inb(pio_addr_t addr) - { - uint8_t val; - -- address_space_read(&address_space_io, addr, &val, 1); -+ address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, -+ &val, 1); - trace_cpu_in(addr, val); - LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); - return val; -@@ -102,7 +106,7 @@ uint16_t cpu_inw(pio_addr_t addr) - uint8_t buf[2]; - uint16_t val; - -- address_space_read(&address_space_io, addr, buf, 2); -+ address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 2); - val = lduw_p(buf); - trace_cpu_in(addr, val); - LOG_IOPORT("inw : %04"FMT_pioaddr" %04"PRIx16"\n", addr, val); -@@ -114,7 +118,7 @@ uint32_t cpu_inl(pio_addr_t addr) - uint8_t buf[4]; - uint32_t val; - -- address_space_read(&address_space_io, addr, buf, 4); -+ address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 4); - val = ldl_p(buf); - trace_cpu_in(addr, val); - LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val); -diff --git a/kvm-all.c b/kvm-all.c -index adf442d..365ad3f 100644 ---- a/kvm-all.c -+++ b/kvm-all.c -@@ -1670,7 +1670,8 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size, - uint8_t *ptr = data; - - for (i = 0; i < count; i++) { -- address_space_rw(&address_space_io, port, ptr, size, -+ address_space_rw(&address_space_io, port, MEMTXATTRS_UNSPECIFIED, -+ ptr, size, - direction == KVM_EXIT_IO_OUT); - ptr += size; - } -diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c -index cdda259..224d2d1 100644 ---- a/scripts/coverity-model.c -+++ b/scripts/coverity-model.c -@@ -46,6 +46,8 @@ typedef struct va_list_str *va_list; - - typedef struct AddressSpace AddressSpace; - typedef uint64_t hwaddr; -+typedef uint32_t MemTxResult; -+typedef uint64_t MemTxAttrs; - - static void __write(uint8_t *buf, ssize_t len) - { -@@ -65,10 +67,10 @@ static void __read(uint8_t *buf, ssize_t len) - int last = buf[len-1]; - } - --bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, -- int len, bool is_write) -+MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, -+ uint8_t *buf, int len, bool is_write) - { -- bool result; -+ MemTxResult result; - - // TODO: investigate impact of treating reads as producing - // tainted data, with __coverity_tainted_data_argument__(buf). --- -1.8.3.1 - diff --git a/SOURCES/kvm-fdc-force-the-fifo-access-to-be-in-bounds-of-the-all.patch b/SOURCES/kvm-fdc-force-the-fifo-access-to-be-in-bounds-of-the-all.patch deleted file mode 100644 index 802bfc0..0000000 --- a/SOURCES/kvm-fdc-force-the-fifo-access-to-be-in-bounds-of-the-all.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 043efb9153723f03d192e1942f4b5d20420b4161 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina <mrezanin@redhat.com> -Date: Wed, 27 May 2015 10:26:39 +0200 -Subject: [PATCH 006/217] fdc: force the fifo access to be in bounds of the - allocated buffer - -Message-id: <1431334649-3906-1-git-send-email-mrezanin@redhat.com> -O-Subject: [RHEV-7.2 qemu-kvm-rhev EMBARGOED PATCH] fdc: force - the fifo access to be in bounds of the allocated buffer -Bugzilla: 1219272 -RH-Acked-by: Markus Armbruster <armbru@redhat.com> -RH-Acked-by: Kevin Wolf <kwolf@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -During processing of certain commands such as FD_CMD_READ_ID and -FD_CMD_DRIVE_SPECIFICATION_COMMAND the fifo memory access could -get out of bounds leading to memory corruption with values coming -from the guest. - -Fix this by making sure that the index is always bounded by the -allocated memory. - -This is CVE-2015-3456. - -Signed-off-by: Petr Matousek <pmatouse@redhat.com> ---- - hw/block/fdc.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/hw/block/fdc.c b/hw/block/fdc.c -index 2bf87c9..a9de4ab 100644 ---- a/hw/block/fdc.c -+++ b/hw/block/fdc.c -@@ -1512,7 +1512,7 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl) - { - FDrive *cur_drv; - uint32_t retval = 0; -- int pos; -+ uint32_t pos; - - cur_drv = get_cur_drv(fdctrl); - fdctrl->dsr &= ~FD_DSR_PWRDOWN; -@@ -1521,8 +1521,8 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl) - return 0; - } - pos = fdctrl->data_pos; -+ pos %= FD_SECTOR_LEN; - if (fdctrl->msr & FD_MSR_NONDMA) { -- pos %= FD_SECTOR_LEN; - if (pos == 0) { - if (fdctrl->data_pos != 0) - if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { -@@ -1867,10 +1867,13 @@ static void fdctrl_handle_option(FDCtrl *fdctrl, int direction) - static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction) - { - FDrive *cur_drv = get_cur_drv(fdctrl); -+ uint32_t pos; - -- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) { -+ pos = fdctrl->data_pos - 1; -+ pos %= FD_SECTOR_LEN; -+ if (fdctrl->fifo[pos] & 0x80) { - /* Command parameters done */ -- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) { -+ if (fdctrl->fifo[pos] & 0x40) { - fdctrl->fifo[0] = fdctrl->fifo[1]; - fdctrl->fifo[2] = 0; - fdctrl->fifo[3] = 0; -@@ -1970,7 +1973,7 @@ static uint8_t command_to_handler[256]; - static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value) - { - FDrive *cur_drv; -- int pos; -+ uint32_t pos; - - /* Reset mode */ - if (!(fdctrl->dor & FD_DOR_nRESET)) { -@@ -2019,7 +2022,9 @@ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value) - } - - FLOPPY_DPRINTF("%s: %02x\n", __func__, value); -- fdctrl->fifo[fdctrl->data_pos++] = value; -+ pos = fdctrl->data_pos++; -+ pos %= FD_SECTOR_LEN; -+ fdctrl->fifo[pos] = value; - if (fdctrl->data_pos == fdctrl->data_len) { - /* We now have all parameters - * and will be able to treat the command --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-add-_CRS-method-for-extra-root-busses.patch b/SOURCES/kvm-hw-acpi-add-_CRS-method-for-extra-root-busses.patch deleted file mode 100644 index f2bda6e..0000000 --- a/SOURCES/kvm-hw-acpi-add-_CRS-method-for-extra-root-busses.patch +++ /dev/null @@ -1,196 +0,0 @@ -From d945811dfd843f81bb44a493d7c9ff57a471e2a6 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:27 +0200 -Subject: [PATCH 204/217] hw/acpi: add _CRS method for extra root busses - -Message-id: <1435154016-26233-35-git-send-email-marcel@redhat.com> -Patchwork-id: 66460 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 34/43] hw/acpi: add _CRS method for extra root busses -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Save the IO/mem/bus numbers ranges assigned to the extra root busses -to be removed from the root bus 0 range. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit a43c6e276231e8040203940cb07be00387686e87) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 139 insertions(+) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index ccc4f00..8db7983 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -695,6 +695,137 @@ static Aml *build_prt(void) - return method; - } - -+typedef struct CrsRangeEntry { -+ uint64_t base; -+ uint64_t limit; -+} CrsRangeEntry; -+ -+static void crs_range_insert(GPtrArray *ranges, uint64_t base, uint64_t limit) -+{ -+ CrsRangeEntry *entry; -+ -+ entry = g_malloc(sizeof(*entry)); -+ entry->base = base; -+ entry->limit = limit; -+ -+ g_ptr_array_add(ranges, entry); -+} -+ -+static void crs_range_free(gpointer data) -+{ -+ CrsRangeEntry *entry = (CrsRangeEntry *)data; -+ g_free(entry); -+} -+ -+static Aml *build_crs(PCIHostState *host, -+ GPtrArray *io_ranges, GPtrArray *mem_ranges) -+{ -+ Aml *crs = aml_resource_template(); -+ uint8_t max_bus = pci_bus_num(host->bus); -+ uint8_t type; -+ int devfn; -+ -+ for (devfn = 0; devfn < ARRAY_SIZE(host->bus->devices); devfn++) { -+ int i; -+ uint64_t range_base, range_limit; -+ PCIDevice *dev = host->bus->devices[devfn]; -+ -+ if (!dev) { -+ continue; -+ } -+ -+ for (i = 0; i < PCI_NUM_REGIONS; i++) { -+ PCIIORegion *r = &dev->io_regions[i]; -+ -+ range_base = r->addr; -+ range_limit = r->addr + r->size - 1; -+ -+ if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { -+ aml_append(crs, -+ aml_word_io(aml_min_fixed, aml_max_fixed, -+ aml_pos_decode, aml_entire_range, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(io_ranges, range_base, range_limit); -+ } else { /* "memory" */ -+ aml_append(crs, -+ aml_dword_memory(aml_pos_decode, aml_min_fixed, -+ aml_max_fixed, aml_non_cacheable, -+ aml_ReadWrite, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(mem_ranges, range_base, range_limit); -+ } -+ } -+ -+ type = dev->config[PCI_HEADER_TYPE] & ~PCI_HEADER_TYPE_MULTI_FUNCTION; -+ if (type == PCI_HEADER_TYPE_BRIDGE) { -+ uint8_t subordinate = dev->config[PCI_SUBORDINATE_BUS]; -+ if (subordinate > max_bus) { -+ max_bus = subordinate; -+ } -+ -+ range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO); -+ range_limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO); -+ aml_append(crs, -+ aml_word_io(aml_min_fixed, aml_max_fixed, -+ aml_pos_decode, aml_entire_range, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(io_ranges, range_base, range_limit); -+ -+ range_base = -+ pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); -+ range_limit = -+ pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); -+ aml_append(crs, -+ aml_dword_memory(aml_pos_decode, aml_min_fixed, -+ aml_max_fixed, aml_non_cacheable, -+ aml_ReadWrite, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(mem_ranges, range_base, range_limit); -+ -+ range_base = -+ pci_bridge_get_base(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); -+ range_limit = -+ pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); -+ aml_append(crs, -+ aml_dword_memory(aml_pos_decode, aml_min_fixed, -+ aml_max_fixed, aml_non_cacheable, -+ aml_ReadWrite, -+ 0, -+ range_base, -+ range_limit, -+ 0, -+ range_limit - range_base + 1)); -+ crs_range_insert(mem_ranges, range_base, range_limit); -+ } -+ } -+ -+ aml_append(crs, -+ aml_word_bus_number(aml_min_fixed, aml_max_fixed, aml_pos_decode, -+ 0, -+ pci_bus_num(host->bus), -+ max_bus, -+ 0, -+ max_bus - pci_bus_num(host->bus) + 1)); -+ -+ return crs; -+} -+ - static void - build_ssdt(GArray *table_data, GArray *linker, - AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, -@@ -705,6 +836,8 @@ build_ssdt(GArray *table_data, GArray *linker, - unsigned acpi_cpus = guest_info->apic_id_limit; - Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx; - PCIBus *bus = NULL; -+ GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free); -+ GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free); - int i; - - ssdt = init_aml_allocator(); -@@ -734,9 +867,15 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A03"))); - aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); - aml_append(dev, build_prt()); -+ crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent), -+ io_ranges, mem_ranges); -+ aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(scope, dev); - aml_append(ssdt, scope); - } -+ -+ g_ptr_array_free(io_ranges, true); -+ g_ptr_array_free(mem_ranges, true); - } - - scope = aml_scope("\\_SB.PCI0"); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-add-support-for-i440fx-snooping-root-busses.patch b/SOURCES/kvm-hw-acpi-add-support-for-i440fx-snooping-root-busses.patch deleted file mode 100644 index 0b15fd1..0000000 --- a/SOURCES/kvm-hw-acpi-add-support-for-i440fx-snooping-root-busses.patch +++ /dev/null @@ -1,72 +0,0 @@ -From b846d2f88b2981993b4c2ed5b9dcba945959581d Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:25 +0200 -Subject: [PATCH 202/217] hw/acpi: add support for i440fx 'snooping' root - busses - -Message-id: <1435154016-26233-33-git-send-email-marcel@redhat.com> -Patchwork-id: 66458 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 32/43] hw/acpi: add support for i440fx 'snooping' root busses -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -If the machine has extra root busses that are snooping to -the i440fx host bridge, we need to add them to -acpi in order to be properly detected by guests. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit a4894206e3672f8a5e5443d72b705495e022b638) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index ea77a3f..ea6abe6 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -624,6 +624,7 @@ build_ssdt(GArray *table_data, GArray *linker, - uint32_t nr_mem = machine->ram_slots; - unsigned acpi_cpus = guest_info->apic_id_limit; - Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx; -+ PCIBus *bus = NULL; - int i; - - ssdt = init_aml_allocator(); -@@ -635,6 +636,28 @@ build_ssdt(GArray *table_data, GArray *linker, - /* Reserve space for header */ - acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); - -+ /* Extra PCI root buses are implemented only for i440fx */ -+ bus = find_i440fx(); -+ if (bus) { -+ QLIST_FOREACH(bus, &bus->child, sibling) { -+ uint8_t bus_num = pci_bus_num(bus); -+ -+ /* look only for expander root buses */ -+ if (!pci_bus_is_root(bus)) { -+ continue; -+ } -+ -+ scope = aml_scope("\\_SB"); -+ dev = aml_device("PC%.02X", bus_num); -+ aml_append(dev, -+ aml_name_decl("_UID", aml_string("PC%.02X", bus_num))); -+ aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A03"))); -+ aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); -+ aml_append(scope, dev); -+ aml_append(ssdt, scope); -+ } -+ } -+ - scope = aml_scope("\\_SB.PCI0"); - /* build PCI0._CRS */ - crs = aml_resource_template(); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-ToUUID-macro.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-ToUUID-macro.patch deleted file mode 100644 index 7040b3c..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-ToUUID-macro.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 7368a6605ffe512aa0f045311a88d4ad126ecbd3 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:32 +0200 -Subject: [PATCH 070/217] hw/acpi/aml-build: Add ToUUID macro - -Message-id: <1434455325-23399-21-git-send-email-drjones@redhat.com> -Patchwork-id: 66251 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 20/33] hw/acpi/aml-build: Add ToUUID macro -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Add ToUUID macro, this is useful for generating PCIe ACPI table. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-16-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit b930fb9db4aa07abb8f3871eb7379242edbdf2a5) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 54 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 82a8306..e2f5845 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -963,6 +963,59 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, - addr_trans, len, flags); - } - -+static uint8_t Hex2Byte(const char *src) -+{ -+ int hi, lo; -+ -+ hi = Hex2Digit(src[0]); -+ assert(hi >= 0); -+ assert(hi <= 15); -+ -+ lo = Hex2Digit(src[1]); -+ assert(lo >= 0); -+ assert(lo <= 15); -+ return (hi << 4) | lo; -+} -+ -+/* -+ * ACPI 3.0: 17.5.124 ToUUID (Convert String to UUID Macro) -+ * e.g. UUID: aabbccdd-eeff-gghh-iijj-kkllmmnnoopp -+ * call aml_touuid("aabbccdd-eeff-gghh-iijj-kkllmmnnoopp"); -+ */ -+Aml *aml_touuid(const char *uuid) -+{ -+ Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); -+ -+ assert(strlen(uuid) == 36); -+ assert(uuid[8] == '-'); -+ assert(uuid[13] == '-'); -+ assert(uuid[18] == '-'); -+ assert(uuid[23] == '-'); -+ -+ build_append_byte(var->buf, Hex2Byte(uuid + 6)); /* dd - at offset 00 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 4)); /* cc - at offset 01 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 2)); /* bb - at offset 02 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 0)); /* aa - at offset 03 */ -+ -+ build_append_byte(var->buf, Hex2Byte(uuid + 11)); /* ff - at offset 04 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 9)); /* ee - at offset 05 */ -+ -+ build_append_byte(var->buf, Hex2Byte(uuid + 16)); /* hh - at offset 06 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 14)); /* gg - at offset 07 */ -+ -+ build_append_byte(var->buf, Hex2Byte(uuid + 19)); /* ii - at offset 08 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 21)); /* jj - at offset 09 */ -+ -+ build_append_byte(var->buf, Hex2Byte(uuid + 24)); /* kk - at offset 10 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 26)); /* ll - at offset 11 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 28)); /* mm - at offset 12 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 30)); /* nn - at offset 13 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 32)); /* oo - at offset 14 */ -+ build_append_byte(var->buf, Hex2Byte(uuid + 34)); /* pp - at offset 15 */ -+ -+ return var; -+} -+ - void - build_header(GArray *linker, GArray *table_data, - AcpiTableHeader *h, const char *sig, int len, uint8_t rev) -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index d6388de..29b7dbe 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -257,6 +257,7 @@ Aml *aml_buffer(int buffer_size, uint8_t *byte_list); - Aml *aml_resource_template(void); - Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); - Aml *aml_varpackage(uint32_t num_elements); -+Aml *aml_touuid(const char *uuid); - - void - build_header(GArray *linker, GArray *table_data, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-Unicode-macro.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-Unicode-macro.patch deleted file mode 100644 index 08aec54..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-Unicode-macro.patch +++ /dev/null @@ -1,73 +0,0 @@ -From b619c271c91435ef4f855525aadbb42e42fcef6b Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:38 +0200 -Subject: [PATCH 076/217] hw/acpi/aml-build: Add Unicode macro - -Message-id: <1434455325-23399-27-git-send-email-drjones@redhat.com> -Patchwork-id: 66259 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 26/33] hw/acpi/aml-build: Add Unicode macro -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-22-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit e1f776c434f8f18079b82d8121c166fb53a63451) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 17 +++++++++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 18 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 439c24e..9efef70 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -1070,6 +1070,23 @@ Aml *aml_touuid(const char *uuid) - return var; - } - -+/* -+ * ACPI 2.0b: 16.2.3.6.4.3 Unicode Macro (Convert Ascii String To Unicode) -+ */ -+Aml *aml_unicode(const char *str) -+{ -+ int i = 0; -+ Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); -+ -+ do { -+ build_append_byte(var->buf, str[i]); -+ build_append_byte(var->buf, 0); -+ i++; -+ } while (i <= strlen(str)); -+ -+ return var; -+} -+ - void - build_header(GArray *linker, GArray *table_data, - AcpiTableHeader *h, const char *sig, int len, uint8_t rev) -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 5fce62c..82242ec 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -267,6 +267,7 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); - Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name); - Aml *aml_varpackage(uint32_t num_elements); - Aml *aml_touuid(const char *uuid); -+Aml *aml_unicode(const char *str); - - void - build_header(GArray *linker, GArray *table_data, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_create_dword_field-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_create_dword_field-term.patch deleted file mode 100644 index d3ee113..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_create_dword_field-term.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 3d4b62d3c42701773dad5171d689d35affeb7786 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:36 +0200 -Subject: [PATCH 074/217] hw/acpi/aml-build: Add aml_create_dword_field() term -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-25-git-send-email-drjones@redhat.com> -Patchwork-id: 66257 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 24/33] hw/acpi/aml-build: Add aml_create_dword_field() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-20-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit ed8176a37a8f227e61daddbcf92dc5d1cad45818) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 11 +++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 12 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 3b06349..54d652d 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -739,6 +739,17 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule) - return var; - } - -+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefCreateDWordField */ -+Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name) -+{ -+ Aml *var = aml_alloc(); -+ build_append_byte(var->buf, 0x8A); /* CreateDWordFieldOp */ -+ aml_append(var, srcbuf); -+ aml_append(var, index); -+ build_append_namestring(var->buf, "%s", name); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.3 Data Objects Encoding: String */ - Aml *aml_string(const char *name_format, ...) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 356484a..e02010d 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -259,6 +259,7 @@ Aml *aml_package(uint8_t num_elements); - Aml *aml_buffer(int buffer_size, uint8_t *byte_list); - Aml *aml_resource_template(void); - Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); -+Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name); - Aml *aml_varpackage(uint32_t num_elements); - Aml *aml_touuid(const char *uuid); - --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_dword_io-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_dword_io-term.patch deleted file mode 100644 index 93ed4fc..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_dword_io-term.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 70a822b469baa1383df12db562270591fcb6ec57 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:37 +0200 -Subject: [PATCH 075/217] hw/acpi/aml-build: Add aml_dword_io() term -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-26-git-send-email-drjones@redhat.com> -Patchwork-id: 66258 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 25/33] hw/acpi/aml-build: Add aml_dword_io() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-21-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 616ef329adbb671be783a1dba96d881b9218ff80) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 18 ++++++++++++++++++ - include/hw/acpi/aml-build.h | 5 +++++ - 2 files changed, 23 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 54d652d..439c24e 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -960,6 +960,24 @@ Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, - } - - /* -+ * ACPI 1.0b: 6.4.3.5.4 ASL Macros for DWORD Address Descriptor -+ * -+ * More verbose description at: -+ * ACPI 5.0: 19.5.33 DWordIO (DWord IO Resource Descriptor Macro) -+ */ -+Aml *aml_dword_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, -+ AmlDecode dec, AmlISARanges isa_ranges, -+ uint32_t addr_gran, uint32_t addr_min, -+ uint32_t addr_max, uint32_t addr_trans, -+ uint32_t len) -+ -+{ -+ return aml_dword_as_desc(AML_IO_RANGE, min_fixed, max_fixed, dec, -+ addr_gran, addr_min, addr_max, addr_trans, len, -+ isa_ranges); -+} -+ -+/* - * ACPI 1.0b: 6.4.3.5.4 ASL Macros for DWORD Address Space Descriptor - * - * More verbose description at: -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index e02010d..5fce62c 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -236,6 +236,11 @@ Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, - uint16_t addr_gran, uint16_t addr_min, - uint16_t addr_max, uint16_t addr_trans, - uint16_t len); -+Aml *aml_dword_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, -+ AmlDecode dec, AmlISARanges isa_ranges, -+ uint32_t addr_gran, uint32_t addr_min, -+ uint32_t addr_max, uint32_t addr_trans, -+ uint32_t len); - Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed, - AmlMaxFixed max_fixed, AmlCacheable cacheable, - AmlReadAndWrite read_and_write, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_else-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_else-term.patch deleted file mode 100644 index 3005854..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_else-term.patch +++ /dev/null @@ -1,67 +0,0 @@ -From baf974407209ab084a5bf4aa12e00d6a99cca61d Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:35 +0200 -Subject: [PATCH 073/217] hw/acpi/aml-build: Add aml_else() term -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-24-git-send-email-drjones@redhat.com> -Patchwork-id: 66253 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 23/33] hw/acpi/aml-build: Add aml_else() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-19-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 467b07dfae6087381d0993ab910253a6c1850457) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 7 +++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 8 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index e925fd9..3b06349 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -633,6 +633,13 @@ Aml *aml_if(Aml *predicate) - return var; - } - -+/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefElse */ -+Aml *aml_else(void) -+{ -+ Aml *var = aml_bundle(0xA1 /* ElseOp */, AML_PACKAGE); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ - Aml *aml_method(const char *name, int arg_count) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index fdc5f4a..356484a 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -254,6 +254,7 @@ Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); - Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); - Aml *aml_method(const char *name, int arg_count); - Aml *aml_if(Aml *predicate); -+Aml *aml_else(void); - Aml *aml_package(uint8_t num_elements); - Aml *aml_buffer(int buffer_size, uint8_t *byte_list); - Aml *aml_resource_template(void); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_interrupt-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_interrupt-term.patch deleted file mode 100644 index e5270bc..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_interrupt-term.patch +++ /dev/null @@ -1,133 +0,0 @@ -From f0ee5fc4a71e52400a15b90e8b6e56f0c1af7461 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:23 +0200 -Subject: [PATCH 061/217] hw/acpi/aml-build: Add aml_interrupt() term - -Message-id: <1434455325-23399-12-git-send-email-drjones@redhat.com> -Patchwork-id: 66244 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 11/33] hw/acpi/aml-build: Add aml_interrupt() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Add aml_interrupt() for describing device interrupt in resource template. -These can be used to generating DSDT table for ACPI on ARM. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Message-id: 1432522520-8068-7-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 205d1d1c04033b1be4c925e687b6865d1fc1b26b) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 27 +++++++++++++++++++++++++++ - include/hw/acpi/aml-build.h | 42 ++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 69 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index ebfcf90..20eeaf9 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -534,6 +534,33 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size, - return var; - } - -+/* -+ * ACPI 5.0: 6.4.3.6 Extended Interrupt Descriptor -+ * Type 1, Large Item Name 0x9 -+ */ -+Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro, -+ AmlLevelAndEdge level_and_edge, -+ AmlActiveHighAndLow high_and_low, AmlShared shared, -+ uint32_t irq) -+{ -+ Aml *var = aml_alloc(); -+ uint8_t irq_flags = con_and_pro | (level_and_edge << 1) -+ | (high_and_low << 2) | (shared << 3); -+ -+ build_append_byte(var->buf, 0x89); /* Extended irq descriptor */ -+ build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */ -+ build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */ -+ build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */ -+ build_append_byte(var->buf, 0x01); /* Interrupt table length = 1 */ -+ -+ /* Interrupt Number */ -+ build_append_byte(var->buf, extract32(irq, 0, 8)); /* bits[7:0] */ -+ build_append_byte(var->buf, extract32(irq, 8, 8)); /* bits[15:8] */ -+ build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */ -+ build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */ -+ return var; -+} -+ - /* ACPI 1.0b: 6.4.2.5 I/O Port Descriptor */ - Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, - uint8_t aln, uint8_t len) -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 1c3cbd2..2142d54 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -111,6 +111,44 @@ typedef enum { - AML_READ_WRITE = 1, - } AmlReadAndWrite; - -+/* -+ * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition -+ * Interrupt Vector Flags Bits[0] Consumer/Producer -+ */ -+typedef enum { -+ AML_CONSUMER_PRODUCER = 0, -+ AML_CONSUMER = 1, -+} AmlConsumerAndProducer; -+ -+/* -+ * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition -+ * _HE field definition -+ */ -+typedef enum { -+ AML_LEVEL = 0, -+ AML_EDGE = 1, -+} AmlLevelAndEdge; -+ -+/* -+ * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition -+ * _LL field definition -+ */ -+typedef enum { -+ AML_ACTIVE_HIGH = 0, -+ AML_ACTIVE_LOW = 1, -+} AmlActiveHighAndLow; -+ -+/* -+ * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition -+ * _SHR field definition -+ */ -+typedef enum { -+ AML_EXCLUSIVE = 0, -+ AML_SHARED = 1, -+ AML_EXCLUSIVE_AND_WAKE = 2, -+ AML_SHARED_AND_WAKE = 3, -+} AmlShared; -+ - typedef - struct AcpiBuildTables { - GArray *table_data; -@@ -170,6 +208,10 @@ Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3); - Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4); - Aml *aml_memory32_fixed(uint32_t addr, uint32_t size, - AmlReadAndWrite read_and_write); -+Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro, -+ AmlLevelAndEdge level_and_edge, -+ AmlActiveHighAndLow high_and_low, AmlShared shared, -+ uint32_t irq); - Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, - uint8_t aln, uint8_t len); - Aml *aml_operation_region(const char *name, AmlRegionSpace rs, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_lnot-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_lnot-term.patch deleted file mode 100644 index b5b08ec..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_lnot-term.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 2f6d65f802d02f866b4f751d3479d0f6693890dc Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:34 +0200 -Subject: [PATCH 072/217] hw/acpi/aml-build: Add aml_lnot() term -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-23-git-send-email-drjones@redhat.com> -Patchwork-id: 66256 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 22/33] hw/acpi/aml-build: Add aml_lnot() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-18-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit ea7df04a0217fe6314a1520dde1883c45fefcaaa) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 8 ++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 9 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 882f34c..e925fd9 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -608,6 +608,14 @@ Aml *aml_irq_no_flags(uint8_t irq) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLNot */ -+Aml *aml_lnot(Aml *arg) -+{ -+ Aml *var = aml_opcode(0x92 /* LNotOp */); -+ aml_append(var, arg); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLEqual */ - Aml *aml_equal(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index fbd0d0c..fdc5f4a 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -222,6 +222,7 @@ Aml *aml_named_field(const char *name, unsigned length); - Aml *aml_reserved_field(unsigned length); - Aml *aml_local(int num); - Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2); -+Aml *aml_lnot(Aml *arg); - Aml *aml_equal(Aml *arg1, Aml *arg2); - Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len, - const char *name_format, ...) GCC_FMT_ATTR(4, 5); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_memory32_fixed-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_memory32_fixed-term.patch deleted file mode 100644 index da765a0..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_memory32_fixed-term.patch +++ /dev/null @@ -1,99 +0,0 @@ -From acf554391f232b5546cd6f22b229b73c46ccb184 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:22 +0200 -Subject: [PATCH 060/217] hw/acpi/aml-build: Add aml_memory32_fixed() term -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-11-git-send-email-drjones@redhat.com> -Patchwork-id: 66243 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 10/33] hw/acpi/aml-build: Add aml_memory32_fixed() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Add aml_memory32_fixed() for describing device mmio region in resource -template. These can be used to generating DSDT table for ACPI on ARM. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-6-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit dc17ab1de53d37ddcca81b16dfeae839322fbe5a) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 28 ++++++++++++++++++++++++++++ - include/hw/acpi/aml-build.h | 2 ++ - 2 files changed, 30 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index ab649bb..ebfcf90 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -26,6 +26,7 @@ - #include <string.h> - #include "hw/acpi/aml-build.h" - #include "qemu/bswap.h" -+#include "qemu/bitops.h" - #include "hw/acpi/bios-linker-loader.h" - - static GArray *build_alloc_array(void) -@@ -506,6 +507,33 @@ Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4) - return var; - } - -+/* -+ * ACPI 1.0b: 6.4.3.4 32-Bit Fixed Location Memory Range Descriptor -+ * (Type 1, Large Item Name 0x6) -+ */ -+Aml *aml_memory32_fixed(uint32_t addr, uint32_t size, -+ AmlReadAndWrite read_and_write) -+{ -+ Aml *var = aml_alloc(); -+ build_append_byte(var->buf, 0x86); /* Memory32Fixed Resource Descriptor */ -+ build_append_byte(var->buf, 9); /* Length, bits[7:0] value = 9 */ -+ build_append_byte(var->buf, 0); /* Length, bits[15:8] value = 0 */ -+ build_append_byte(var->buf, read_and_write); /* Write status, 1 rw 0 ro */ -+ -+ /* Range base address */ -+ build_append_byte(var->buf, extract32(addr, 0, 8)); /* bits[7:0] */ -+ build_append_byte(var->buf, extract32(addr, 8, 8)); /* bits[15:8] */ -+ build_append_byte(var->buf, extract32(addr, 16, 8)); /* bits[23:16] */ -+ build_append_byte(var->buf, extract32(addr, 24, 8)); /* bits[31:24] */ -+ -+ /* Range length */ -+ build_append_byte(var->buf, extract32(size, 0, 8)); /* bits[7:0] */ -+ build_append_byte(var->buf, extract32(size, 8, 8)); /* bits[15:8] */ -+ build_append_byte(var->buf, extract32(size, 16, 8)); /* bits[23:16] */ -+ build_append_byte(var->buf, extract32(size, 24, 8)); /* bits[31:24] */ -+ return var; -+} -+ - /* ACPI 1.0b: 6.4.2.5 I/O Port Descriptor */ - Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, - uint8_t aln, uint8_t len) -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 98cdf9e..1c3cbd2 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -168,6 +168,8 @@ Aml *aml_call1(const char *method, Aml *arg1); - Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); - Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3); - Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4); -+Aml *aml_memory32_fixed(uint32_t addr, uint32_t size, -+ AmlReadAndWrite read_and_write); - Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, - uint8_t aln, uint8_t len); - Aml *aml_operation_region(const char *name, AmlRegionSpace rs, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_or-term.patch b/SOURCES/kvm-hw-acpi-aml-build-Add-aml_or-term.patch deleted file mode 100644 index 9e41bdd..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Add-aml_or-term.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 73b5c1135210b7fc12743bf8e92089e7e1a869ec Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:33 +0200 -Subject: [PATCH 071/217] hw/acpi/aml-build: Add aml_or() term - -Message-id: <1434455325-23399-22-git-send-email-drjones@redhat.com> -Patchwork-id: 66255 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 21/33] hw/acpi/aml-build: Add aml_or() term -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-17-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 922cc8823e484733021a7be5b0e876eba2218623) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 10 ++++++++++ - include/hw/acpi/aml-build.h | 1 + - 2 files changed, 11 insertions(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index e2f5845..882f34c 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -456,6 +456,16 @@ Aml *aml_and(Aml *arg1, Aml *arg2) - return var; - } - -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */ -+Aml *aml_or(Aml *arg1, Aml *arg2) -+{ -+ Aml *var = aml_opcode(0x7D /* OrOp */); -+ aml_append(var, arg1); -+ aml_append(var, arg2); -+ build_append_byte(var->buf, 0x00 /* NullNameOp */); -+ return var; -+} -+ - /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */ - Aml *aml_notify(Aml *arg1, Aml *arg2) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 29b7dbe..fbd0d0c 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -201,6 +201,7 @@ Aml *aml_int(const uint64_t val); - Aml *aml_arg(int pos); - Aml *aml_store(Aml *val, Aml *target); - Aml *aml_and(Aml *arg1, Aml *arg2); -+Aml *aml_or(Aml *arg1, Aml *arg2); - Aml *aml_notify(Aml *arg1, Aml *arg2); - Aml *aml_call1(const char *method, Aml *arg1); - Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Fix-memory-leak.patch b/SOURCES/kvm-hw-acpi-aml-build-Fix-memory-leak.patch deleted file mode 100644 index 0923f60..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Fix-memory-leak.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0a234c201cccbf862b44c2044349e3f81b72cdd3 Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:07 +0200 -Subject: [PATCH 051/217] hw/acpi/aml-build: Fix memory leak - -Message-id: <1433724727-46928-10-git-send-email-imammedo@redhat.com> -Patchwork-id: 65394 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 9/9] hw/acpi/aml-build: Fix memory leak -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -(cherry picked from commit afcf905cff7971324c2706600ead35a1f41f417a) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index f926c9a..b8591b1 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -304,6 +304,7 @@ static void aml_free(gpointer data, gpointer user_data) - { - Aml *var = data; - build_free_array(var->buf); -+ g_free(var); - } - - Aml *init_aml_allocator(void) --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Make-aml_buffer-definition-consist.patch b/SOURCES/kvm-hw-acpi-aml-build-Make-aml_buffer-definition-consist.patch deleted file mode 100644 index 88ddaed..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Make-aml_buffer-definition-consist.patch +++ /dev/null @@ -1,80 +0,0 @@ -From faf281bba78b1ba279be940d0f56f309754d8664 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:31 +0200 -Subject: [PATCH 069/217] hw/acpi/aml-build: Make aml_buffer() definition - consistent with the spec - -Message-id: <1434455325-23399-20-git-send-email-drjones@redhat.com> -Patchwork-id: 66254 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 19/33] hw/acpi/aml-build: Make aml_buffer() definition consistent with the spec -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -According to ACPI spec, DefBuffer can take two parameters: BufferSize -and ByteList. Make it consistent with the spec. Uninitialized buffer -could be requested by passing ByteList as NULL to reserve space. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1432522520-8068-15-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit ed8b5847e46c24d6e9c286892a00a34bee9b0835) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 16 ++++++++++++++-- - include/hw/acpi/aml-build.h | 2 +- - 2 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 2c890c8..82a8306 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -643,10 +643,22 @@ Aml *aml_resource_template(void) - return var; - } - --/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefBuffer */ --Aml *aml_buffer(void) -+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefBuffer -+ * Pass byte_list as NULL to request uninitialized buffer to reserve space. -+ */ -+Aml *aml_buffer(int buffer_size, uint8_t *byte_list) - { -+ int i; - Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); -+ -+ for (i = 0; i < buffer_size; i++) { -+ if (byte_list == NULL) { -+ build_append_byte(var->buf, 0x0); -+ } else { -+ build_append_byte(var->buf, byte_list[i]); -+ } -+ } -+ - return var; - } - -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 2c07a43..d6388de 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -253,7 +253,7 @@ Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); - Aml *aml_method(const char *name, int arg_count); - Aml *aml_if(Aml *predicate); - Aml *aml_package(uint8_t num_elements); --Aml *aml_buffer(void); -+Aml *aml_buffer(int buffer_size, uint8_t *byte_list); - Aml *aml_resource_template(void); - Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); - Aml *aml_varpackage(uint32_t num_elements); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-aml-build-Make-enum-values-to-be-upper-case-.patch b/SOURCES/kvm-hw-acpi-aml-build-Make-enum-values-to-be-upper-case-.patch deleted file mode 100644 index 7668ccf..0000000 --- a/SOURCES/kvm-hw-acpi-aml-build-Make-enum-values-to-be-upper-case-.patch +++ /dev/null @@ -1,379 +0,0 @@ -From 08b0cf2e9a071f01e4e5e3f7a16c41d6648c56dd Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 23 Jun 2015 08:11:50 +0200 -Subject: [PATCH 056/217] hw/acpi/aml-build: Make enum values to be upper case - to match coding style - -Message-id: <1435047110-16613-1-git-send-email-drjones@redhat.com> -Patchwork-id: 66361 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH v2 06/33] hw/acpi/aml-build: Make enum values to be upper case to match coding style -Bugzilla: 1231719 -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Message-id: 1432522520-8068-2-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit ff80dc7fa8045e2b2531888d965424d2b0e1d1b6) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 12 ++++---- - hw/i386/acpi-build.c | 58 +++++++++++++++++++------------------- - include/hw/acpi/aml-build.h | 68 ++++++++++++++++++++++----------------------- - 3 files changed, 69 insertions(+), 69 deletions(-) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 295fde2..ab649bb 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -834,7 +834,7 @@ Aml *aml_word_bus_number(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, - uint16_t addr_trans, uint16_t len) - - { -- return aml_word_as_desc(aml_bus_number_range, min_fixed, max_fixed, dec, -+ return aml_word_as_desc(AML_BUS_NUMBER_RANGE, min_fixed, max_fixed, dec, - addr_gran, addr_min, addr_max, addr_trans, len, 0); - } - -@@ -851,7 +851,7 @@ Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, - uint16_t len) - - { -- return aml_word_as_desc(aml_io_range, min_fixed, max_fixed, dec, -+ return aml_word_as_desc(AML_IO_RANGE, min_fixed, max_fixed, dec, - addr_gran, addr_min, addr_max, addr_trans, len, - isa_ranges); - } -@@ -863,7 +863,7 @@ Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, - * ACPI 5.0: 19.5.34 DWordMemory (DWord Memory Resource Descriptor Macro) - */ - Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed, -- AmlMaxFixed max_fixed, AmlCacheble cacheable, -+ AmlMaxFixed max_fixed, AmlCacheable cacheable, - AmlReadAndWrite read_and_write, - uint32_t addr_gran, uint32_t addr_min, - uint32_t addr_max, uint32_t addr_trans, -@@ -871,7 +871,7 @@ Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed, - { - uint8_t flags = read_and_write | (cacheable << 1); - -- return aml_dword_as_desc(aml_memory_range, min_fixed, max_fixed, -+ return aml_dword_as_desc(AML_MEMORY_RANGE, min_fixed, max_fixed, - dec, addr_gran, addr_min, addr_max, - addr_trans, len, flags); - } -@@ -883,7 +883,7 @@ Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed, - * ACPI 5.0: 19.5.102 QWordMemory (QWord Memory Resource Descriptor Macro) - */ - Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, -- AmlMaxFixed max_fixed, AmlCacheble cacheable, -+ AmlMaxFixed max_fixed, AmlCacheable cacheable, - AmlReadAndWrite read_and_write, - uint64_t addr_gran, uint64_t addr_min, - uint64_t addr_max, uint64_t addr_trans, -@@ -891,7 +891,7 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, - { - uint8_t flags = read_and_write | (cacheable << 1); - -- return aml_qword_as_desc(aml_memory_range, min_fixed, max_fixed, -+ return aml_qword_as_desc(AML_MEMORY_RANGE, min_fixed, max_fixed, - dec, addr_gran, addr_min, addr_max, - addr_trans, len, flags); - } -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index eb6296c..fa3372b 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -621,31 +621,31 @@ build_ssdt(GArray *table_data, GArray *linker, - /* build PCI0._CRS */ - crs = aml_resource_template(); - aml_append(crs, -- aml_word_bus_number(aml_min_fixed, aml_max_fixed, aml_pos_decode, -+ aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, - 0x0000, 0x0000, 0x00FF, 0x0000, 0x0100)); -- aml_append(crs, aml_io(aml_decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)); -+ aml_append(crs, aml_io(AML_DECODE16, 0x0CF8, 0x0CF8, 0x01, 0x08)); - - aml_append(crs, -- aml_word_io(aml_min_fixed, aml_max_fixed, -- aml_pos_decode, aml_entire_range, -+ aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_POS_DECODE, AML_ENTIRE_RANGE, - 0x0000, 0x0000, 0x0CF7, 0x0000, 0x0CF8)); - aml_append(crs, -- aml_word_io(aml_min_fixed, aml_max_fixed, -- aml_pos_decode, aml_entire_range, -+ aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_POS_DECODE, AML_ENTIRE_RANGE, - 0x0000, 0x0D00, 0xFFFF, 0x0000, 0xF300)); - aml_append(crs, -- aml_dword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed, -- aml_cacheable, aml_ReadWrite, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_CACHEABLE, AML_READ_WRITE, - 0, 0x000A0000, 0x000BFFFF, 0, 0x00020000)); - aml_append(crs, -- aml_dword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed, -- aml_non_cacheable, aml_ReadWrite, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_NON_CACHEABLE, AML_READ_WRITE, - 0, pci->w32.begin, pci->w32.end - 1, 0, - pci->w32.end - pci->w32.begin)); - if (pci->w64.begin) { - aml_append(crs, -- aml_qword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed, -- aml_cacheable, aml_ReadWrite, -+ aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_CACHEABLE, AML_READ_WRITE, - 0, pci->w64.begin, pci->w64.end - 1, 0, - pci->w64.end - pci->w64.begin)); - } -@@ -659,7 +659,7 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); - crs = aml_resource_template(); - aml_append(crs, -- aml_io(aml_decode16, pm->gpe0_blk, pm->gpe0_blk, 1, pm->gpe0_blk_len) -+ aml_io(AML_DECODE16, pm->gpe0_blk, pm->gpe0_blk, 1, pm->gpe0_blk_len) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(scope, dev); -@@ -674,7 +674,7 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); - crs = aml_resource_template(); - aml_append(crs, -- aml_io(aml_decode16, pm->pcihp_io_base, pm->pcihp_io_base, 1, -+ aml_io(AML_DECODE16, pm->pcihp_io_base, pm->pcihp_io_base, 1, - pm->pcihp_io_len) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); -@@ -721,7 +721,7 @@ build_ssdt(GArray *table_data, GArray *linker, - - crs = aml_resource_template(); - aml_append(crs, -- aml_io(aml_decode16, misc->applesmc_io_base, misc->applesmc_io_base, -+ aml_io(AML_DECODE16, misc->applesmc_io_base, misc->applesmc_io_base, - 0x01, APPLESMC_MAX_DATA_LENGTH) - ); - aml_append(crs, aml_irq_no_flags(6)); -@@ -739,13 +739,13 @@ build_ssdt(GArray *table_data, GArray *linker, - - crs = aml_resource_template(); - aml_append(crs, -- aml_io(aml_decode16, misc->pvpanic_port, misc->pvpanic_port, 1, 1) -+ aml_io(AML_DECODE16, misc->pvpanic_port, misc->pvpanic_port, 1, 1) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); - -- aml_append(dev, aml_operation_region("PEOR", aml_system_io, -+ aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO, - misc->pvpanic_port, 1)); -- field = aml_field("PEOR", aml_byte_acc, aml_preserve); -+ field = aml_field("PEOR", AML_BYTE_ACC, AML_PRESERVE); - aml_append(field, aml_named_field("PEPT", 8)); - aml_append(dev, field); - -@@ -777,15 +777,15 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); - crs = aml_resource_template(); - aml_append(crs, -- aml_io(aml_decode16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1, -+ aml_io(AML_DECODE16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1, - pm->cpu_hp_io_len) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(sb_scope, dev); - /* declare CPU hotplug MMIO region and PRS field to access it */ - aml_append(sb_scope, aml_operation_region( -- "PRST", aml_system_io, pm->cpu_hp_io_base, pm->cpu_hp_io_len)); -- field = aml_field("PRST", aml_byte_acc, aml_preserve); -+ "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len)); -+ field = aml_field("PRST", AML_BYTE_ACC, AML_PRESERVE); - aml_append(field, aml_named_field("PRS", 256)); - aml_append(sb_scope, field); - -@@ -849,18 +849,18 @@ build_ssdt(GArray *table_data, GArray *linker, - - crs = aml_resource_template(); - aml_append(crs, -- aml_io(aml_decode16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0, -+ aml_io(AML_DECODE16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0, - pm->mem_hp_io_len) - ); - aml_append(scope, aml_name_decl("_CRS", crs)); - - aml_append(scope, aml_operation_region( -- stringify(MEMORY_HOTPLUG_IO_REGION), aml_system_io, -+ stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO, - pm->mem_hp_io_base, pm->mem_hp_io_len) - ); - -- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc, -- aml_preserve); -+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, -+ AML_PRESERVE); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32)); - aml_append(field, /* read only */ -@@ -873,8 +873,8 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32)); - aml_append(scope, field); - -- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_byte_acc, -- aml_write_as_zeros); -+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC, -+ AML_WRITE_AS_ZEROS); - aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */)); - aml_append(field, /* 1 if enabled, read only */ - aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1)); -@@ -889,8 +889,8 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_named_field(stringify(MEMORY_SLOT_EJECT), 1)); - aml_append(scope, field); - -- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc, -- aml_preserve); -+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, -+ AML_PRESERVE); - aml_append(field, /* DIMM selector, write only */ - aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32)); - aml_append(field, /* _OST event code, write only */ -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 15579e6..98cdf9e 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -36,49 +36,49 @@ struct Aml { - typedef struct Aml Aml; - - typedef enum { -- aml_decode10 = 0, -- aml_decode16 = 1, -+ AML_DECODE10 = 0, -+ AML_DECODE16 = 1, - } AmlIODecode; - - typedef enum { -- aml_any_acc = 0, -- aml_byte_acc = 1, -- aml_word_acc = 2, -- aml_dword_acc = 3, -- aml_qword_acc = 4, -- aml_buffer_acc = 5, -+ AML_ANY_ACC = 0, -+ AML_BYTE_ACC = 1, -+ AML_WORD_ACC = 2, -+ AML_DWORD_ACC = 3, -+ AML_QWORD_ACC = 4, -+ AML_BUFFER_ACC = 5, - } AmlAccessType; - - typedef enum { -- aml_preserve = 0, -- aml_write_as_ones = 1, -- aml_write_as_zeros = 2, -+ AML_PRESERVE = 0, -+ AML_WRITE_AS_ONES = 1, -+ AML_WRITE_AS_ZEROS = 2, - } AmlUpdateRule; - - typedef enum { -- aml_system_memory = 0x00, -- aml_system_io = 0x01, -+ AML_SYSTEM_MEMORY = 0X00, -+ AML_SYSTEM_IO = 0X01, - } AmlRegionSpace; - - typedef enum { -- aml_memory_range = 0, -- aml_io_range = 1, -- aml_bus_number_range = 2, -+ AML_MEMORY_RANGE = 0, -+ AML_IO_RANGE = 1, -+ AML_BUS_NUMBER_RANGE = 2, - } AmlResourceType; - - typedef enum { -- aml_sub_decode = 1 << 1, -- aml_pos_decode = 0 -+ AML_SUB_DECODE = 1 << 1, -+ AML_POS_DECODE = 0 - } AmlDecode; - - typedef enum { -- aml_max_fixed = 1 << 3, -- aml_max_not_fixed = 0, -+ AML_MAX_FIXED = 1 << 3, -+ AML_MAX_NOT_FIXED = 0, - } AmlMaxFixed; - - typedef enum { -- aml_min_fixed = 1 << 2, -- aml_min_not_fixed = 0 -+ AML_MIN_FIXED = 1 << 2, -+ AML_MIN_NOT_FIXED = 0 - } AmlMinFixed; - - /* -@@ -86,9 +86,9 @@ typedef enum { - * _RNG field definition - */ - typedef enum { -- aml_isa_only = 1, -- aml_non_isa_only = 2, -- aml_entire_range = 3, -+ AML_ISA_ONLY = 1, -+ AML_NON_ISA_ONLY = 2, -+ AML_ENTIRE_RANGE = 3, - } AmlISARanges; - - /* -@@ -96,19 +96,19 @@ typedef enum { - * _MEM field definition - */ - typedef enum { -- aml_non_cacheable = 0, -- aml_cacheable = 1, -- aml_write_combining = 2, -- aml_prefetchable = 3, --} AmlCacheble; -+ AML_NON_CACHEABLE = 0, -+ AML_CACHEABLE = 1, -+ AML_WRITE_COMBINING = 2, -+ AML_PREFETCHABLE = 3, -+} AmlCacheable; - - /* - * ACPI 1.0b: Table 6-25 Memory Resource Flag (Resource Type = 0) Definitions - * _RW field definition - */ - typedef enum { -- aml_ReadOnly = 0, -- aml_ReadWrite = 1, -+ AML_READ_ONLY = 0, -+ AML_READ_WRITE = 1, - } AmlReadAndWrite; - - typedef -@@ -191,13 +191,13 @@ Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed, - uint16_t addr_max, uint16_t addr_trans, - uint16_t len); - Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed, -- AmlMaxFixed max_fixed, AmlCacheble cacheable, -+ AmlMaxFixed max_fixed, AmlCacheable cacheable, - AmlReadAndWrite read_and_write, - uint32_t addr_gran, uint32_t addr_min, - uint32_t addr_max, uint32_t addr_trans, - uint32_t len); - Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, -- AmlMaxFixed max_fixed, AmlCacheble cacheable, -+ AmlMaxFixed max_fixed, AmlCacheable cacheable, - AmlReadAndWrite read_and_write, - uint64_t addr_gran, uint64_t addr_min, - uint64_t addr_max, uint64_t addr_trans, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-acpi-remove-from-root-bus-0-the-crs-resources-use.patch b/SOURCES/kvm-hw-acpi-remove-from-root-bus-0-the-crs-resources-use.patch deleted file mode 100644 index d9a018c..0000000 --- a/SOURCES/kvm-hw-acpi-remove-from-root-bus-0-the-crs-resources-use.patch +++ /dev/null @@ -1,247 +0,0 @@ -From 3a93898ee05b27444541142d76c92c64d9bb7e4a Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:28 +0200 -Subject: [PATCH 205/217] hw/acpi: remove from root bus 0 the crs resources - used by other buses. - -Message-id: <1435154016-26233-36-git-send-email-marcel@redhat.com> -Patchwork-id: 66462 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 35/43] hw/acpi: remove from root bus 0 the crs resources used by other buses. -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -If multiple root buses are used, root bus 0 cannot use all the -pci holes ranges. Remove the IO/mem ranges used by the other -primary buses. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit dcdca29655f774568f30a82b7fe0190b4bd38802) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 118 +++++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 91 insertions(+), 27 deletions(-) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 8db7983..de2aea0 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -717,6 +717,50 @@ static void crs_range_free(gpointer data) - g_free(entry); - } - -+static gint crs_range_compare(gconstpointer a, gconstpointer b) -+{ -+ CrsRangeEntry *entry_a = *(CrsRangeEntry **)a; -+ CrsRangeEntry *entry_b = *(CrsRangeEntry **)b; -+ -+ return (int64_t)entry_a->base - (int64_t)entry_b->base; -+} -+ -+/* -+ * crs_replace_with_free_ranges - given the 'used' ranges within [start - end] -+ * interval, computes the 'free' ranges from the same interval. -+ * Example: If the input array is { [a1 - a2],[b1 - b2] }, the function -+ * will return { [base - a1], [a2 - b1], [b2 - limit] }. -+ */ -+static void crs_replace_with_free_ranges(GPtrArray *ranges, -+ uint64_t start, uint64_t end) -+{ -+ GPtrArray *free_ranges = g_ptr_array_new_with_free_func(crs_range_free); -+ uint64_t free_base = start; -+ int i; -+ -+ g_ptr_array_sort(ranges, crs_range_compare); -+ for (i = 0; i < ranges->len; i++) { -+ CrsRangeEntry *used = g_ptr_array_index(ranges, i); -+ -+ if (free_base < used->base) { -+ crs_range_insert(free_ranges, free_base, used->base - 1); -+ } -+ -+ free_base = used->limit + 1; -+ } -+ -+ if (free_base < end) { -+ crs_range_insert(free_ranges, free_base, end); -+ } -+ -+ g_ptr_array_set_size(ranges, 0); -+ for (i = 0; i < free_ranges->len; i++) { -+ g_ptr_array_add(ranges, g_ptr_array_index(free_ranges, i)); -+ } -+ -+ g_ptr_array_free(free_ranges, false); -+} -+ - static Aml *build_crs(PCIHostState *host, - GPtrArray *io_ranges, GPtrArray *mem_ranges) - { -@@ -742,8 +786,8 @@ static Aml *build_crs(PCIHostState *host, - - if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { - aml_append(crs, -- aml_word_io(aml_min_fixed, aml_max_fixed, -- aml_pos_decode, aml_entire_range, -+ aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_POS_DECODE, AML_ENTIRE_RANGE, - 0, - range_base, - range_limit, -@@ -752,9 +796,9 @@ static Aml *build_crs(PCIHostState *host, - crs_range_insert(io_ranges, range_base, range_limit); - } else { /* "memory" */ - aml_append(crs, -- aml_dword_memory(aml_pos_decode, aml_min_fixed, -- aml_max_fixed, aml_non_cacheable, -- aml_ReadWrite, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -+ AML_MAX_FIXED, AML_NON_CACHEABLE, -+ AML_READ_WRITE, - 0, - range_base, - range_limit, -@@ -774,8 +818,8 @@ static Aml *build_crs(PCIHostState *host, - range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO); - range_limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO); - aml_append(crs, -- aml_word_io(aml_min_fixed, aml_max_fixed, -- aml_pos_decode, aml_entire_range, -+ aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_POS_DECODE, AML_ENTIRE_RANGE, - 0, - range_base, - range_limit, -@@ -788,9 +832,9 @@ static Aml *build_crs(PCIHostState *host, - range_limit = - pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); - aml_append(crs, -- aml_dword_memory(aml_pos_decode, aml_min_fixed, -- aml_max_fixed, aml_non_cacheable, -- aml_ReadWrite, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -+ AML_MAX_FIXED, AML_NON_CACHEABLE, -+ AML_READ_WRITE, - 0, - range_base, - range_limit, -@@ -803,9 +847,9 @@ static Aml *build_crs(PCIHostState *host, - range_limit = - pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); - aml_append(crs, -- aml_dword_memory(aml_pos_decode, aml_min_fixed, -- aml_max_fixed, aml_non_cacheable, -- aml_ReadWrite, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, -+ AML_MAX_FIXED, AML_NON_CACHEABLE, -+ AML_READ_WRITE, - 0, - range_base, - range_limit, -@@ -816,7 +860,7 @@ static Aml *build_crs(PCIHostState *host, - } - - aml_append(crs, -- aml_word_bus_number(aml_min_fixed, aml_max_fixed, aml_pos_decode, -+ aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, - 0, - pci_bus_num(host->bus), - max_bus, -@@ -838,6 +882,8 @@ build_ssdt(GArray *table_data, GArray *linker, - PCIBus *bus = NULL; - GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free); - GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free); -+ CrsRangeEntry *entry; -+ int root_bus_limit = 0xFF; - int i; - - ssdt = init_aml_allocator(); -@@ -860,6 +906,10 @@ build_ssdt(GArray *table_data, GArray *linker, - continue; - } - -+ if (bus_num < root_bus_limit) { -+ root_bus_limit = bus_num - 1; -+ } -+ - scope = aml_scope("\\_SB"); - dev = aml_device("PC%.02X", bus_num); - aml_append(dev, -@@ -873,9 +923,6 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(scope, dev); - aml_append(ssdt, scope); - } -- -- g_ptr_array_free(io_ranges, true); -- g_ptr_array_free(mem_ranges, true); - } - - scope = aml_scope("\\_SB.PCI0"); -@@ -883,26 +930,40 @@ build_ssdt(GArray *table_data, GArray *linker, - crs = aml_resource_template(); - aml_append(crs, - aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, -- 0x0000, 0x0000, 0x00FF, 0x0000, 0x0100)); -+ 0x0000, 0x0, root_bus_limit, -+ 0x0000, root_bus_limit + 1)); - aml_append(crs, aml_io(AML_DECODE16, 0x0CF8, 0x0CF8, 0x01, 0x08)); - - aml_append(crs, - aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, - AML_POS_DECODE, AML_ENTIRE_RANGE, - 0x0000, 0x0000, 0x0CF7, 0x0000, 0x0CF8)); -- aml_append(crs, -- aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -- AML_POS_DECODE, AML_ENTIRE_RANGE, -- 0x0000, 0x0D00, 0xFFFF, 0x0000, 0xF300)); -+ -+ crs_replace_with_free_ranges(io_ranges, 0x0D00, 0xFFFF); -+ for (i = 0; i < io_ranges->len; i++) { -+ entry = g_ptr_array_index(io_ranges, i); -+ aml_append(crs, -+ aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_POS_DECODE, AML_ENTIRE_RANGE, -+ 0x0000, entry->base, entry->limit, -+ 0x0000, entry->limit - entry->base + 1)); -+ } -+ - aml_append(crs, - aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, - AML_CACHEABLE, AML_READ_WRITE, - 0, 0x000A0000, 0x000BFFFF, 0, 0x00020000)); -- aml_append(crs, -- aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -- AML_NON_CACHEABLE, AML_READ_WRITE, -- 0, pci->w32.begin, pci->w32.end - 1, 0, -- pci->w32.end - pci->w32.begin)); -+ -+ crs_replace_with_free_ranges(mem_ranges, pci->w32.begin, pci->w32.end - 1); -+ for (i = 0; i < mem_ranges->len; i++) { -+ entry = g_ptr_array_index(mem_ranges, i); -+ aml_append(crs, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_NON_CACHEABLE, AML_READ_WRITE, -+ 0, entry->base, entry->limit, -+ 0, entry->limit - entry->base + 1)); -+ } -+ - if (pci->w64.begin) { - aml_append(crs, - aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -@@ -925,6 +986,9 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(scope, dev); - -+ g_ptr_array_free(io_ranges, true); -+ g_ptr_array_free(mem_ranges, true); -+ - /* reserve PCIHP resources */ - if (pm->pcihp_io_len) { - dev = aml_device("PHPR"); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-apci-add-_PRT-method-for-extra-PCI-root-busses.patch b/SOURCES/kvm-hw-apci-add-_PRT-method-for-extra-PCI-root-busses.patch deleted file mode 100644 index 9e28fc2..0000000 --- a/SOURCES/kvm-hw-apci-add-_PRT-method-for-extra-PCI-root-busses.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0a4960f90730ec3be1117086a8cdf3dc3cb7b6c6 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:26 +0200 -Subject: [PATCH 203/217] hw/apci: add _PRT method for extra PCI root busses - -Message-id: <1435154016-26233-34-git-send-email-marcel@redhat.com> -Patchwork-id: 66461 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 33/43] hw/apci: add _PRT method for extra PCI root busses -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 0d8935e3370e07f57651e43d2de9011d75c2a066) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 81 insertions(+) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index ea6abe6..ccc4f00 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -615,6 +615,86 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, - aml_append(parent_scope, method); - } - -+/* -+ * initialize_route - Initialize the interrupt routing rule -+ * through a specific LINK: -+ * if (lnk_idx == idx) -+ * route using link 'link_name' -+ */ -+static Aml *initialize_route(Aml *route, const char *link_name, -+ Aml *lnk_idx, int idx) -+{ -+ Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx))); -+ Aml *pkg = aml_package(4); -+ -+ aml_append(pkg, aml_int(0)); -+ aml_append(pkg, aml_int(0)); -+ aml_append(pkg, aml_name("%s", link_name)); -+ aml_append(pkg, aml_int(0)); -+ aml_append(if_ctx, aml_store(pkg, route)); -+ -+ return if_ctx; -+} -+ -+/* -+ * build_prt - Define interrupt rounting rules -+ * -+ * Returns an array of 128 routes, one for each device, -+ * based on device location. -+ * The main goal is to equaly distribute the interrupts -+ * over the 4 existing ACPI links (works only for i440fx). -+ * The hash function is (slot + pin) & 3 -> "LNK[D|A|B|C]". -+ * -+ */ -+static Aml *build_prt(void) -+{ -+ Aml *method, *while_ctx, *pin, *res; -+ -+ method = aml_method("_PRT", 0); -+ res = aml_local(0); -+ pin = aml_local(1); -+ aml_append(method, aml_store(aml_package(128), res)); -+ aml_append(method, aml_store(aml_int(0), pin)); -+ -+ /* while (pin < 128) */ -+ while_ctx = aml_while(aml_lless(pin, aml_int(128))); -+ { -+ Aml *slot = aml_local(2); -+ Aml *lnk_idx = aml_local(3); -+ Aml *route = aml_local(4); -+ -+ /* slot = pin >> 2 */ -+ aml_append(while_ctx, -+ aml_store(aml_shiftright(pin, aml_int(2)), slot)); -+ /* lnk_idx = (slot + pin) & 3 */ -+ aml_append(while_ctx, -+ aml_store(aml_and(aml_add(pin, slot), aml_int(3)), lnk_idx)); -+ -+ /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3 */ -+ aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0)); -+ aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1)); -+ aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2)); -+ aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3)); -+ -+ /* route[0] = 0x[slot]FFFF */ -+ aml_append(while_ctx, -+ aml_store(aml_or(aml_shiftleft(slot, aml_int(16)), aml_int(0xFFFF)), -+ aml_index(route, aml_int(0)))); -+ /* route[1] = pin & 3 */ -+ aml_append(while_ctx, -+ aml_store(aml_and(pin, aml_int(3)), aml_index(route, aml_int(1)))); -+ /* res[pin] = route */ -+ aml_append(while_ctx, aml_store(route, aml_index(res, pin))); -+ /* pin++ */ -+ aml_append(while_ctx, aml_increment(pin)); -+ } -+ aml_append(method, while_ctx); -+ /* return res*/ -+ aml_append(method, aml_return(res)); -+ -+ return method; -+} -+ - static void - build_ssdt(GArray *table_data, GArray *linker, - AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, -@@ -653,6 +733,7 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_name_decl("_UID", aml_string("PC%.02X", bus_num))); - aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A03"))); - aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); -+ aml_append(dev, build_prt()); - aml_append(scope, dev); - aml_append(ssdt, scope); - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-Enable-dynamic-generation-of-ACPI-v5.1-t.patch b/SOURCES/kvm-hw-arm-virt-Enable-dynamic-generation-of-ACPI-v5.1-t.patch deleted file mode 100644 index 7025b52..0000000 --- a/SOURCES/kvm-hw-arm-virt-Enable-dynamic-generation-of-ACPI-v5.1-t.patch +++ /dev/null @@ -1,85 +0,0 @@ -From f0ead466b2c3bdc13b41eb63d14b4f201a0672e1 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:41 +0200 -Subject: [PATCH 079/217] hw/arm/virt: Enable dynamic generation of ACPI v5.1 - tables - -Message-id: <1434455325-23399-30-git-send-email-drjones@redhat.com> -Patchwork-id: 66265 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 29/33] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Initialize VirtGuestInfoState and register a machine_init_done notify to -call virt_acpi_build(). - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Message-id: 1432522520-8068-25-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit d7c2e2db28eb7e8f2ed7467fa2f2c59026b206d1) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 13c169b..bc5b262 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -44,6 +44,7 @@ - #include "qemu/bitops.h" - #include "qemu/error-report.h" - #include "hw/pci-host/gpex.h" -+#include "hw/arm/virt-acpi-build.h" - - /* Number of external interrupt lines to configure the GIC with */ - #define NUM_IRQS 128 -@@ -700,6 +701,14 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) - return board->fdt; - } - -+static -+void virt_guest_info_machine_done(Notifier *notifier, void *data) -+{ -+ VirtGuestInfoState *guest_info_state = container_of(notifier, -+ VirtGuestInfoState, machine_done); -+ virt_acpi_setup(&guest_info_state->info); -+} -+ - static void machvirt_init(MachineState *machine) - { - VirtMachineState *vms = VIRT_MACHINE(machine); -@@ -709,6 +718,8 @@ static void machvirt_init(MachineState *machine) - MemoryRegion *ram = g_new(MemoryRegion, 1); - const char *cpu_model = machine->cpu_model; - VirtBoardInfo *vbi; -+ VirtGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state); -+ VirtGuestInfo *guest_info = &guest_info_state->info; - uint32_t gic_phandle; - char **cpustr; - -@@ -801,6 +812,14 @@ static void machvirt_init(MachineState *machine) - create_virtio_devices(vbi, pic); - - create_fw_cfg(vbi); -+ rom_set_fw(fw_cfg_find()); -+ -+ guest_info->smp_cpus = smp_cpus; -+ guest_info->fw_cfg = fw_cfg_find(); -+ guest_info->memmap = vbi->memmap; -+ guest_info->irqmap = vbi->irqmap; -+ guest_info_state->machine_done.notify = virt_guest_info_machine_done; -+ qemu_add_machine_init_done_notifier(&guest_info_state->machine_done); - - vbi->bootinfo.ram_size = machine->ram_size; - vbi->bootinfo.kernel_filename = machine->kernel_filename; --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-Move-common-definitions-to-virt.h.patch b/SOURCES/kvm-hw-arm-virt-Move-common-definitions-to-virt.h.patch deleted file mode 100644 index 17d0f0b..0000000 --- a/SOURCES/kvm-hw-arm-virt-Move-common-definitions-to-virt.h.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 0d72647a4386e7d5b52a201fcf673d96cf739da8 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:19 +0200 -Subject: [PATCH 057/217] hw/arm/virt: Move common definitions to virt.h -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-8-git-send-email-drjones@redhat.com> -Patchwork-id: 66239 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 07/33] hw/arm/virt: Move common definitions to virt.h -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Move some common definitions to virt.h. These will be used by -generating ACPI tables. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-3-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit afe0b3803f1a5fffe618af5a483d4c9567b5c5b7) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt.c | 21 +------------------ - include/hw/arm/virt.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 57 insertions(+), 20 deletions(-) - create mode 100644 include/hw/arm/virt.h - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 71f1ce1..7f4ae74 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -31,6 +31,7 @@ - #include "hw/sysbus.h" - #include "hw/arm/arm.h" - #include "hw/arm/primecell.h" -+#include "hw/arm/virt.h" - #include "hw/devices.h" - #include "net/net.h" - #include "sysemu/block-backend.h" -@@ -44,8 +45,6 @@ - #include "qemu/error-report.h" - #include "hw/pci-host/gpex.h" - --#define NUM_VIRTIO_TRANSPORTS 32 -- - /* Number of external interrupt lines to configure the GIC with */ - #define NUM_IRQS 128 - -@@ -60,24 +59,6 @@ - #define GIC_FDT_IRQ_PPI_CPU_START 8 - #define GIC_FDT_IRQ_PPI_CPU_WIDTH 8 - --enum { -- VIRT_FLASH, -- VIRT_MEM, -- VIRT_CPUPERIPHS, -- VIRT_GIC_DIST, -- VIRT_GIC_CPU, -- VIRT_UART, -- VIRT_MMIO, -- VIRT_RTC, -- VIRT_FW_CFG, -- VIRT_PCIE, --}; -- --typedef struct MemMapEntry { -- hwaddr base; -- hwaddr size; --} MemMapEntry; -- - typedef struct VirtBoardInfo { - struct arm_boot_info bootinfo; - const char *cpu_model; -diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h -new file mode 100644 -index 0000000..2fe0d2e ---- /dev/null -+++ b/include/hw/arm/virt.h -@@ -0,0 +1,56 @@ -+/* -+ * -+ * Copyright (c) 2015 Linaro Limited -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms and conditions of the GNU General Public License, -+ * version 2 or later, as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope 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/>. -+ * -+ * Emulate a virtual board which works by passing Linux all the information -+ * it needs about what devices are present via the device tree. -+ * There are some restrictions about what we can do here: -+ * + we can only present devices whose Linux drivers will work based -+ * purely on the device tree with no platform data at all -+ * + we want to present a very stripped-down minimalist platform, -+ * both because this reduces the security attack surface from the guest -+ * and also because it reduces our exposure to being broken when -+ * the kernel updates its device tree bindings and requires further -+ * information in a device binding that we aren't providing. -+ * This is essentially the same approach kvmtool uses. -+ */ -+ -+#ifndef QEMU_ARM_VIRT_H -+#define QEMU_ARM_VIRT_H -+ -+#include "qemu-common.h" -+ -+#define NUM_VIRTIO_TRANSPORTS 32 -+ -+enum { -+ VIRT_FLASH, -+ VIRT_MEM, -+ VIRT_CPUPERIPHS, -+ VIRT_GIC_DIST, -+ VIRT_GIC_CPU, -+ VIRT_UART, -+ VIRT_MMIO, -+ VIRT_RTC, -+ VIRT_FW_CFG, -+ VIRT_PCIE, -+}; -+ -+typedef struct MemMapEntry { -+ hwaddr base; -+ hwaddr size; -+} MemMapEntry; -+ -+ -+#endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-Record-PCIe-ranges-in-MemMapEntry-array.patch b/SOURCES/kvm-hw-arm-virt-Record-PCIe-ranges-in-MemMapEntry-array.patch deleted file mode 100644 index 78723dd..0000000 --- a/SOURCES/kvm-hw-arm-virt-Record-PCIe-ranges-in-MemMapEntry-array.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 50425d28e802744c01051a3617c581eeaccff666 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:20 +0200 -Subject: [PATCH 058/217] hw/arm/virt: Record PCIe ranges in MemMapEntry array - -Message-id: <1434455325-23399-9-git-send-email-drjones@redhat.com> -Patchwork-id: 66240 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 08/33] hw/arm/virt: Record PCIe ranges in MemMapEntry array -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -To generate ACPI table for PCIe controller, we need the base and size of -the PCIe ranges. Record these ranges in MemMapEntry array, then we could -share and use them for generating ACPI table. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Message-id: 1432522520-8068-4-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 6a1f001be3ea7478cac803d03149cfcfc1fa2094) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt.c | 37 +++++++++++++------------------------ - include/hw/arm/virt.h | 3 +++ - 2 files changed, 16 insertions(+), 24 deletions(-) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 7f4ae74..59635a1 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -117,14 +117,9 @@ static const MemMapEntry a15memmap[] = { - [VIRT_FW_CFG] = { 0x09020000, 0x0000000a }, - [VIRT_MMIO] = { 0x0a000000, 0x00000200 }, - /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */ -- /* -- * PCIE verbose map: -- * -- * MMIO window { 0x10000000, 0x2eff0000 }, -- * PIO window { 0x3eff0000, 0x00010000 }, -- * ECAM { 0x3f000000, 0x01000000 }, -- */ -- [VIRT_PCIE] = { 0x10000000, 0x30000000 }, -+ [VIRT_PCIE_MMIO] = { 0x10000000, 0x2eff0000 }, -+ [VIRT_PCIE_PIO] = { 0x3eff0000, 0x00010000 }, -+ [VIRT_PCIE_ECAM] = { 0x3f000000, 0x01000000 }, - [VIRT_MEM] = { 0x40000000, 30ULL * 1024 * 1024 * 1024 }, - }; - -@@ -628,16 +623,14 @@ static void create_pcie_irq_map(const VirtBoardInfo *vbi, uint32_t gic_phandle, - static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, - uint32_t gic_phandle) - { -- hwaddr base = vbi->memmap[VIRT_PCIE].base; -- hwaddr size = vbi->memmap[VIRT_PCIE].size; -- hwaddr end = base + size; -- hwaddr size_mmio; -- hwaddr size_ioport = 64 * 1024; -- int nr_pcie_buses = 16; -- hwaddr size_ecam = PCIE_MMCFG_SIZE_MIN * nr_pcie_buses; -- hwaddr base_mmio = base; -- hwaddr base_ioport; -- hwaddr base_ecam; -+ hwaddr base_mmio = vbi->memmap[VIRT_PCIE_MMIO].base; -+ hwaddr size_mmio = vbi->memmap[VIRT_PCIE_MMIO].size; -+ hwaddr base_pio = vbi->memmap[VIRT_PCIE_PIO].base; -+ hwaddr size_pio = vbi->memmap[VIRT_PCIE_PIO].size; -+ hwaddr base_ecam = vbi->memmap[VIRT_PCIE_ECAM].base; -+ hwaddr size_ecam = vbi->memmap[VIRT_PCIE_ECAM].size; -+ hwaddr base = base_mmio; -+ int nr_pcie_buses = size_ecam / PCIE_MMCFG_SIZE_MIN; - int irq = vbi->irqmap[VIRT_PCIE]; - MemoryRegion *mmio_alias; - MemoryRegion *mmio_reg; -@@ -647,10 +640,6 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, - char *nodename; - int i; - -- base_ecam = QEMU_ALIGN_DOWN(end - size_ecam, size_ecam); -- base_ioport = QEMU_ALIGN_DOWN(base_ecam - size_ioport, size_ioport); -- size_mmio = base_ioport - base; -- - dev = qdev_create(NULL, TYPE_GPEX_HOST); - qdev_init_nofail(dev); - -@@ -673,7 +662,7 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, - memory_region_add_subregion(get_system_memory(), base_mmio, mmio_alias); - - /* Map IO port space */ -- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_ioport); -+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_pio); - - for (i = 0; i < GPEX_NUM_IRQS; i++) { - sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]); -@@ -693,7 +682,7 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, - 2, base_ecam, 2, size_ecam); - qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "ranges", - 1, FDT_PCI_RANGE_IOPORT, 2, 0, -- 2, base_ioport, 2, size_ioport, -+ 2, base_pio, 2, size_pio, - 1, FDT_PCI_RANGE_MMIO, 2, base_mmio, - 2, base_mmio, 2, size_mmio); - -diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h -index 2fe0d2e..49a85cc 100644 ---- a/include/hw/arm/virt.h -+++ b/include/hw/arm/virt.h -@@ -45,6 +45,9 @@ enum { - VIRT_RTC, - VIRT_FW_CFG, - VIRT_PCIE, -+ VIRT_PCIE_MMIO, -+ VIRT_PCIE_PIO, -+ VIRT_PCIE_ECAM, - }; - - typedef struct MemMapEntry { --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Add-PCIe-controller-in-ACPI-D.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Add-PCIe-controller-in-ACPI-D.patch deleted file mode 100644 index 60c7ad0..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Add-PCIe-controller-in-ACPI-D.patch +++ /dev/null @@ -1,213 +0,0 @@ -From 6ce06ddd99177a9ea26724767cb6823d1bef1ed4 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:39 +0200 -Subject: [PATCH 077/217] hw/arm/virt-acpi-build: Add PCIe controller in ACPI - DSDT table - -Message-id: <1434455325-23399-28-git-send-email-drjones@redhat.com> -Patchwork-id: 66261 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 27/33] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Add PCIe controller in ACPI DSDT table, so the guest can detect -the PCIe. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Message-id: 1432522520-8068-23-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit d4e5de1ae02f6b47eb088531d3d4d047b4db6cfa) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 154 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 154 insertions(+) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index 95c83ee..a9373cc 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -40,6 +40,7 @@ - #include "hw/hw.h" - #include "hw/acpi/aml-build.h" - #include "hw/pci/pcie_host.h" -+#include "hw/pci/pci.h" - - #define ARM_SPI_BASE 32 - -@@ -152,6 +153,157 @@ static void acpi_dsdt_add_virtio(Aml *scope, - } - } - -+static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq) -+{ -+ Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf; -+ int i, bus_no; -+ hwaddr base_mmio = memmap[VIRT_PCIE_MMIO].base; -+ hwaddr size_mmio = memmap[VIRT_PCIE_MMIO].size; -+ hwaddr base_pio = memmap[VIRT_PCIE_PIO].base; -+ hwaddr size_pio = memmap[VIRT_PCIE_PIO].size; -+ hwaddr base_ecam = memmap[VIRT_PCIE_ECAM].base; -+ hwaddr size_ecam = memmap[VIRT_PCIE_ECAM].size; -+ int nr_pcie_buses = size_ecam / PCIE_MMCFG_SIZE_MIN; -+ -+ Aml *dev = aml_device("%s", "PCI0"); -+ aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A08"))); -+ aml_append(dev, aml_name_decl("_CID", aml_string("PNP0A03"))); -+ aml_append(dev, aml_name_decl("_SEG", aml_int(0))); -+ aml_append(dev, aml_name_decl("_BBN", aml_int(0))); -+ aml_append(dev, aml_name_decl("_ADR", aml_int(0))); -+ aml_append(dev, aml_name_decl("_UID", aml_string("PCI0"))); -+ aml_append(dev, aml_name_decl("_STR", aml_unicode("PCIe 0 Device"))); -+ -+ /* Declare the PCI Routing Table. */ -+ Aml *rt_pkg = aml_package(nr_pcie_buses * PCI_NUM_PINS); -+ for (bus_no = 0; bus_no < nr_pcie_buses; bus_no++) { -+ for (i = 0; i < PCI_NUM_PINS; i++) { -+ int gsi = (i + bus_no) % PCI_NUM_PINS; -+ Aml *pkg = aml_package(4); -+ aml_append(pkg, aml_int((bus_no << 16) | 0xFFFF)); -+ aml_append(pkg, aml_int(i)); -+ aml_append(pkg, aml_name("GSI%d", gsi)); -+ aml_append(pkg, aml_int(0)); -+ aml_append(rt_pkg, pkg); -+ } -+ } -+ aml_append(dev, aml_name_decl("_PRT", rt_pkg)); -+ -+ /* Create GSI link device */ -+ for (i = 0; i < PCI_NUM_PINS; i++) { -+ Aml *dev_gsi = aml_device("GSI%d", i); -+ aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F"))); -+ aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0))); -+ crs = aml_resource_template(); -+ aml_append(crs, -+ aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, -+ AML_EXCLUSIVE, irq + i)); -+ aml_append(dev_gsi, aml_name_decl("_PRS", crs)); -+ crs = aml_resource_template(); -+ aml_append(crs, -+ aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, -+ AML_EXCLUSIVE, irq + i)); -+ aml_append(dev_gsi, aml_name_decl("_CRS", crs)); -+ method = aml_method("_SRS", 1); -+ aml_append(dev_gsi, method); -+ aml_append(dev, dev_gsi); -+ } -+ -+ method = aml_method("_CBA", 0); -+ aml_append(method, aml_return(aml_int(base_ecam))); -+ aml_append(dev, method); -+ -+ method = aml_method("_CRS", 0); -+ Aml *rbuf = aml_resource_template(); -+ aml_append(rbuf, -+ aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, -+ 0x0000, 0x0000, nr_pcie_buses - 1, 0x0000, -+ nr_pcie_buses)); -+ aml_append(rbuf, -+ aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, -+ AML_NON_CACHEABLE, AML_READ_WRITE, 0x0000, base_mmio, -+ base_mmio + size_mmio - 1, 0x0000, size_mmio)); -+ aml_append(rbuf, -+ aml_dword_io(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, -+ AML_ENTIRE_RANGE, 0x0000, 0x0000, size_pio - 1, base_pio, -+ size_pio)); -+ -+ aml_append(method, aml_name_decl("RBUF", rbuf)); -+ aml_append(method, aml_return(rbuf)); -+ aml_append(dev, method); -+ -+ /* Declare an _OSC (OS Control Handoff) method */ -+ aml_append(dev, aml_name_decl("SUPP", aml_int(0))); -+ aml_append(dev, aml_name_decl("CTRL", aml_int(0))); -+ method = aml_method("_OSC", 4); -+ aml_append(method, -+ aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1")); -+ -+ /* PCI Firmware Specification 3.0 -+ * 4.5.1. _OSC Interface for PCI Host Bridge Devices -+ * The _OSC interface for a PCI/PCI-X/PCI Express hierarchy is -+ * identified by the Universal Unique IDentifier (UUID) -+ * 33DB4D5B-1FF7-401C-9657-7441C03DD766 -+ */ -+ UUID = aml_touuid("33DB4D5B-1FF7-401C-9657-7441C03DD766"); -+ ifctx = aml_if(aml_equal(aml_arg(0), UUID)); -+ aml_append(ifctx, -+ aml_create_dword_field(aml_arg(3), aml_int(4), "CDW2")); -+ aml_append(ifctx, -+ aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3")); -+ aml_append(ifctx, aml_store(aml_name("CDW2"), aml_name("SUPP"))); -+ aml_append(ifctx, aml_store(aml_name("CDW3"), aml_name("CTRL"))); -+ aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1D)), -+ aml_name("CTRL"))); -+ -+ ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1)))); -+ aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x08)), -+ aml_name("CDW1"))); -+ aml_append(ifctx, ifctx1); -+ -+ ifctx1 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), aml_name("CTRL")))); -+ aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x10)), -+ aml_name("CDW1"))); -+ aml_append(ifctx, ifctx1); -+ -+ aml_append(ifctx, aml_store(aml_name("CTRL"), aml_name("CDW3"))); -+ aml_append(ifctx, aml_return(aml_arg(3))); -+ aml_append(method, ifctx); -+ -+ elsectx = aml_else(); -+ aml_append(elsectx, aml_store(aml_or(aml_name("CDW1"), aml_int(4)), -+ aml_name("CDW1"))); -+ aml_append(elsectx, aml_return(aml_arg(3))); -+ aml_append(method, elsectx); -+ aml_append(dev, method); -+ -+ method = aml_method("_DSM", 4); -+ -+ /* PCI Firmware Specification 3.0 -+ * 4.6.1. _DSM for PCI Express Slot Information -+ * The UUID in _DSM in this context is -+ * {E5C937D0-3553-4D7A-9117-EA4D19C3434D} -+ */ -+ UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D"); -+ ifctx = aml_if(aml_equal(aml_arg(0), UUID)); -+ ifctx1 = aml_if(aml_equal(aml_arg(2), aml_int(0))); -+ uint8_t byte_list[1] = {1}; -+ buf = aml_buffer(1, byte_list); -+ aml_append(ifctx1, aml_return(buf)); -+ aml_append(ifctx, ifctx1); -+ aml_append(method, ifctx); -+ -+ byte_list[0] = 0; -+ buf = aml_buffer(1, byte_list); -+ aml_append(method, aml_return(buf)); -+ aml_append(dev, method); -+ -+ Aml *dev_rp0 = aml_device("%s", "RP0"); -+ aml_append(dev_rp0, aml_name_decl("_ADR", aml_int(0))); -+ aml_append(dev, dev_rp0); -+ aml_append(scope, dev); -+} -+ - /* RSDP */ - static GArray * - build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) -@@ -309,6 +461,8 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) - acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); - acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], - (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); -+ acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE)); -+ - aml_append(dsdt, scope); - - /* copy AML table into ACPI tables blob and patch header there */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Add-SPCR-table.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Add-SPCR-table.patch deleted file mode 100644 index f2ec96c..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Add-SPCR-table.patch +++ /dev/null @@ -1,104 +0,0 @@ -From b42f2df70672749e297adb3380480035be89c6a7 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:44 +0200 -Subject: [PATCH 081/217] hw/arm/virt-acpi-build: Add SPCR table - -Message-id: <1434455325-23399-33-git-send-email-drjones@redhat.com> -Patchwork-id: 66264 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 32/33] hw/arm/virt-acpi-build: Add SPCR table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Tested-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Acked-by: Michael S. Tsirkin <mst@redhat.com> -Message-id: 1433929959-29530-3-git-send-email-drjones@redhat.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit f264d51d8ad939d7fb339d61a8cf680ed0cb21a2) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 43 ++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 42 insertions(+), 1 deletion(-) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index a9373cc..d5a8b9c 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -84,6 +84,12 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap, - aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, - AML_EXCLUSIVE, uart_irq)); - aml_append(dev, aml_name_decl("_CRS", crs)); -+ -+ /* The _ADR entry is used to link this device to the UART described -+ * in the SPCR table, i.e. SPCR.base_address.address == _ADR. -+ */ -+ aml_append(dev, aml_name_decl("_ADR", aml_int(uart_memmap->base))); -+ - aml_append(scope, dev); - } - -@@ -334,6 +340,38 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) - } - - static void -+build_spcr(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) -+{ -+ AcpiSerialPortConsoleRedirection *spcr; -+ const MemMapEntry *uart_memmap = &guest_info->memmap[VIRT_UART]; -+ int irq = guest_info->irqmap[VIRT_UART] + ARM_SPI_BASE; -+ -+ spcr = acpi_data_push(table_data, sizeof(*spcr)); -+ -+ spcr->interface_type = 0x3; /* ARM PL011 UART */ -+ -+ spcr->base_address.space_id = AML_SYSTEM_MEMORY; -+ spcr->base_address.bit_width = 8; -+ spcr->base_address.bit_offset = 0; -+ spcr->base_address.access_width = 1; -+ spcr->base_address.address = cpu_to_le64(uart_memmap->base); -+ -+ spcr->interrupt_types = (1 << 3); /* Bit[3] ARMH GIC interrupt */ -+ spcr->gsi = cpu_to_le32(irq); /* Global System Interrupt */ -+ -+ spcr->baud = 3; /* Baud Rate: 3 = 9600 */ -+ spcr->parity = 0; /* No Parity */ -+ spcr->stopbits = 1; /* 1 Stop bit */ -+ spcr->flowctrl = (1 << 1); /* Bit[1] = RTS/CTS hardware flow control */ -+ spcr->term_type = 0; /* Terminal Type: 0 = VT100 */ -+ -+ spcr->pci_device_id = 0xffff; /* PCI Device ID: not a PCI device */ -+ spcr->pci_vendor_id = 0xffff; /* PCI Vendor ID: not a PCI device */ -+ -+ build_header(linker, table_data, (void *)spcr, "SPCR", sizeof(*spcr), 2); -+} -+ -+static void - build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) - { - AcpiTableMcfg *mcfg; -@@ -514,7 +552,7 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - dsdt = tables_blob->len; - build_dsdt(tables_blob, tables->linker, guest_info); - -- /* FADT MADT GTDT pointed to by RSDT */ -+ /* FADT MADT GTDT SPCR pointed to by RSDT */ - acpi_add_table(table_offsets, tables_blob); - build_fadt(tables_blob, tables->linker, dsdt); - -@@ -527,6 +565,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - acpi_add_table(table_offsets, tables_blob); - build_mcfg(tables_blob, tables->linker, guest_info); - -+ acpi_add_table(table_offsets, tables_blob); -+ build_spcr(tables_blob, tables->linker, guest_info); -+ - /* RSDT is pointed to by RSDP */ - rsdt = tables_blob->len; - build_rsdt(tables_blob, tables->linker, table_offsets); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Basic-framework-for-building-.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Basic-framework-for-building-.patch deleted file mode 100644 index fb6bde3..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Basic-framework-for-building-.patch +++ /dev/null @@ -1,320 +0,0 @@ -From 9d38edee9bab72e6abbd90f44a5da3ed75ea111b Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:21 +0200 -Subject: [PATCH 059/217] hw/arm/virt-acpi-build: Basic framework for building - ACPI tables on ARM -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-10-git-send-email-drjones@redhat.com> -Patchwork-id: 66241 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 09/33] hw/arm/virt-acpi-build: Basic framework for building ACPI tables on ARM -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Introduce a preliminary framework in virt-acpi-build.c with the main -ACPI build functions. It exposes the generated ACPI contents to -guest over fw_cfg. - -The required ACPI v5.1 tables for ARM are: -- RSDP: Initial table that points to XSDT -- RSDT: Points to FADT GTDT MADT tables -- FADT: Generic information about the machine -- GTDT: Generic timer description table -- MADT: Multiple APIC description table -- DSDT: Holds all information about system devices/peripherals, pointed by FADT - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Message-id: 1432522520-8068-5-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit f5d8c8cd792b3712f85a1f9a3a9a719015691975) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/Makefile.objs | 1 + - hw/arm/virt-acpi-build.c | 182 +++++++++++++++++++++++++++++++++++++++ - include/hw/arm/virt-acpi-build.h | 41 +++++++++ - qemu-options.hx | 2 +- - trace-events | 3 + - 5 files changed, 228 insertions(+), 1 deletion(-) - create mode 100644 hw/arm/virt-acpi-build.c - create mode 100644 include/hw/arm/virt-acpi-build.h - -diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs -index 8b10e38..6c4c214 100644 ---- a/hw/arm/Makefile.objs -+++ b/hw/arm/Makefile.objs -@@ -1 +1,2 @@ - obj-y += boot.o virt.o -+obj-$(CONFIG_ACPI) += virt-acpi-build.o -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -new file mode 100644 -index 0000000..b8a5bd8 ---- /dev/null -+++ b/hw/arm/virt-acpi-build.c -@@ -0,0 +1,182 @@ -+/* Support for generating ACPI tables and passing them to Guests -+ * -+ * ARM virt ACPI generation -+ * -+ * Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net> -+ * Copyright (C) 2006 Fabrice Bellard -+ * Copyright (C) 2013 Red Hat Inc -+ * -+ * Author: Michael S. Tsirkin <mst@redhat.com> -+ * -+ * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD. -+ * -+ * Author: Shannon Zhao <zhaoshenglong@huawei.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 of the License, or -+ * (at your option) any later version. -+ -+ * 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-common.h" -+#include "hw/arm/virt-acpi-build.h" -+#include "qemu/bitmap.h" -+#include "trace.h" -+#include "qom/cpu.h" -+#include "target-arm/cpu.h" -+#include "hw/acpi/acpi-defs.h" -+#include "hw/acpi/acpi.h" -+#include "hw/nvram/fw_cfg.h" -+#include "hw/acpi/bios-linker-loader.h" -+#include "hw/loader.h" -+#include "hw/hw.h" -+#include "hw/acpi/aml-build.h" -+ -+typedef -+struct AcpiBuildState { -+ /* Copy of table in RAM (for patching). */ -+ MemoryRegion *table_mr; -+ MemoryRegion *rsdp_mr; -+ MemoryRegion *linker_mr; -+ /* Is table patched? */ -+ bool patched; -+ VirtGuestInfo *guest_info; -+} AcpiBuildState; -+ -+static -+void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) -+{ -+ GArray *table_offsets; -+ -+ table_offsets = g_array_new(false, true /* clear */, -+ sizeof(uint32_t)); -+ -+ bios_linker_loader_alloc(tables->linker, ACPI_BUILD_TABLE_FILE, -+ 64, false /* high memory */); -+ -+ /* -+ * The ACPI v5.1 tables for Hardware-reduced ACPI platform are: -+ * RSDP -+ * RSDT -+ * FADT -+ * GTDT -+ * MADT -+ * DSDT -+ */ -+ -+ /* Cleanup memory that's no longer used. */ -+ g_array_free(table_offsets, true); -+} -+ -+static void acpi_ram_update(MemoryRegion *mr, GArray *data) -+{ -+ uint32_t size = acpi_data_len(data); -+ -+ /* Make sure RAM size is correct - in case it got changed -+ * e.g. by migration */ -+ memory_region_ram_resize(mr, size, &error_abort); -+ -+ memcpy(memory_region_get_ram_ptr(mr), data->data, size); -+ memory_region_set_dirty(mr, 0, size); -+} -+ -+static void virt_acpi_build_update(void *build_opaque, uint32_t offset) -+{ -+ AcpiBuildState *build_state = build_opaque; -+ AcpiBuildTables tables; -+ -+ /* No state to update or already patched? Nothing to do. */ -+ if (!build_state || build_state->patched) { -+ return; -+ } -+ build_state->patched = true; -+ -+ acpi_build_tables_init(&tables); -+ -+ virt_acpi_build(build_state->guest_info, &tables); -+ -+ acpi_ram_update(build_state->table_mr, tables.table_data); -+ acpi_ram_update(build_state->rsdp_mr, tables.rsdp); -+ acpi_ram_update(build_state->linker_mr, tables.linker); -+ -+ -+ acpi_build_tables_cleanup(&tables, true); -+} -+ -+static void virt_acpi_build_reset(void *build_opaque) -+{ -+ AcpiBuildState *build_state = build_opaque; -+ build_state->patched = false; -+} -+ -+static MemoryRegion *acpi_add_rom_blob(AcpiBuildState *build_state, -+ GArray *blob, const char *name, -+ uint64_t max_size) -+{ -+ return rom_add_blob(name, blob->data, acpi_data_len(blob), max_size, -1, -+ name, virt_acpi_build_update, build_state); -+} -+ -+static const VMStateDescription vmstate_virt_acpi_build = { -+ .name = "virt_acpi_build", -+ .version_id = 1, -+ .minimum_version_id = 1, -+ .fields = (VMStateField[]) { -+ VMSTATE_BOOL(patched, AcpiBuildState), -+ VMSTATE_END_OF_LIST() -+ }, -+}; -+ -+void virt_acpi_setup(VirtGuestInfo *guest_info) -+{ -+ AcpiBuildTables tables; -+ AcpiBuildState *build_state; -+ -+ if (!guest_info->fw_cfg) { -+ trace_virt_acpi_setup(); -+ return; -+ } -+ -+ if (!acpi_enabled) { -+ trace_virt_acpi_setup(); -+ return; -+ } -+ -+ build_state = g_malloc0(sizeof *build_state); -+ build_state->guest_info = guest_info; -+ -+ acpi_build_tables_init(&tables); -+ virt_acpi_build(build_state->guest_info, &tables); -+ -+ /* Now expose it all to Guest */ -+ build_state->table_mr = acpi_add_rom_blob(build_state, tables.table_data, -+ ACPI_BUILD_TABLE_FILE, -+ ACPI_BUILD_TABLE_MAX_SIZE); -+ assert(build_state->table_mr != NULL); -+ -+ build_state->linker_mr = -+ acpi_add_rom_blob(build_state, tables.linker, "etc/table-loader", 0); -+ -+ fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, -+ tables.tcpalog->data, acpi_data_len(tables.tcpalog)); -+ -+ build_state->rsdp_mr = acpi_add_rom_blob(build_state, tables.rsdp, -+ ACPI_BUILD_RSDP_FILE, 0); -+ -+ qemu_register_reset(virt_acpi_build_reset, build_state); -+ virt_acpi_build_reset(build_state); -+ vmstate_register(NULL, 0, &vmstate_virt_acpi_build, build_state); -+ -+ /* Cleanup tables but don't free the memory: we track it -+ * in build_state. -+ */ -+ acpi_build_tables_cleanup(&tables, false); -+} -diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h -new file mode 100644 -index 0000000..ff00121 ---- /dev/null -+++ b/include/hw/arm/virt-acpi-build.h -@@ -0,0 +1,41 @@ -+/* -+ * -+ * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD. -+ * -+ * Author: Shannon Zhao <zhaoshenglong@huawei.com> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms and conditions of the GNU General Public License, -+ * version 2 or later, as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope 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/>. -+ */ -+ -+#ifndef QEMU_VIRT_ACPI_BUILD_H -+#define QEMU_VIRT_ACPI_BUILD_H -+ -+#include "qemu-common.h" -+#include "hw/arm/virt.h" -+ -+typedef struct VirtGuestInfo { -+ int smp_cpus; -+ FWCfgState *fw_cfg; -+ const MemMapEntry *memmap; -+ const int *irqmap; -+} VirtGuestInfo; -+ -+ -+typedef struct VirtGuestInfoState { -+ VirtGuestInfo info; -+ Notifier machine_done; -+} VirtGuestInfoState; -+ -+void virt_acpi_setup(VirtGuestInfo *guest_info); -+ -+#endif -diff --git a/qemu-options.hx b/qemu-options.hx -index 7a778f6..b7c4c7d 100644 ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -1352,7 +1352,7 @@ be needed to boot from old floppy disks. - ETEXI - - DEF("no-acpi", 0, QEMU_OPTION_no_acpi, -- "-no-acpi disable ACPI\n", QEMU_ARCH_I386) -+ "-no-acpi disable ACPI\n", QEMU_ARCH_I386 | QEMU_ARCH_ARM) - STEXI - @item -no-acpi - @findex -no-acpi -diff --git a/trace-events b/trace-events -index 11387c3..3bb1f04 100644 ---- a/trace-events -+++ b/trace-events -@@ -1594,3 +1594,6 @@ i8257_unregistered_dma(int nchan, int dma_pos, int dma_len) "unregistered DMA ch - cpu_set_state(int cpu_index, uint8_t state) "setting cpu %d state to %" PRIu8 - cpu_halt(int cpu_index) "halting cpu %d" - cpu_unhalt(int cpu_index) "unhalting cpu %d" -+ -+# hw/arm/virt-acpi-build.c -+virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out." --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-FADT-table-and-updat.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-FADT-table-and-updat.patch deleted file mode 100644 index f728834..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-FADT-table-and-updat.patch +++ /dev/null @@ -1,253 +0,0 @@ -From 1dcdcd07fd0c472cf6ec1f8ad8f9f1d2a9637be8 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:25 +0200 -Subject: [PATCH 063/217] hw/arm/virt-acpi-build: Generate FADT table and - update ACPI headers - -Message-id: <1434455325-23399-14-git-send-email-drjones@redhat.com> -Patchwork-id: 66246 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 13/33] hw/arm/virt-acpi-build: Generate FADT table and update ACPI headers -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -In the case of mach virt, it is used to set the Hardware Reduced bit -and enable PSCI SMP booting through HVC. So ignore FACS and FADT -points to DSDT. - -Update the header definitions for FADT taking into account the new -additions of ACPI v5.1 in `include/hw/acpi/acpi-defs.h` - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Message-id: 1432522520-8068-9-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit c2f7c0c306dcd56725b506d3743eed421e6d0994) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 31 ++++++++++ - include/hw/acpi/acpi-defs.h | 135 ++++++++++++++++++++++++++++++++------------ - 2 files changed, 129 insertions(+), 37 deletions(-) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index 2cf2cc5..0791501 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -137,6 +137,31 @@ static void acpi_dsdt_add_virtio(Aml *scope, - } - } - -+/* FADT */ -+static void -+build_fadt(GArray *table_data, GArray *linker, unsigned dsdt) -+{ -+ AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt)); -+ -+ /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */ -+ fadt->flags = cpu_to_le32(1 << ACPI_FADT_F_HW_REDUCED_ACPI); -+ fadt->arm_boot_flags = cpu_to_le16((1 << ACPI_FADT_ARM_USE_PSCI_G_0_2) | -+ (1 << ACPI_FADT_ARM_PSCI_USE_HVC)); -+ -+ /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */ -+ fadt->minor_revision = 0x1; -+ -+ fadt->dsdt = cpu_to_le32(dsdt); -+ /* DSDT address to be filled by Guest linker */ -+ bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, -+ ACPI_BUILD_TABLE_FILE, -+ table_data, &fadt->dsdt, -+ sizeof fadt->dsdt); -+ -+ build_header(linker, table_data, -+ (void *)fadt, "FACP", sizeof(*fadt), 5); -+} -+ - /* DSDT */ - static void - build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) -@@ -183,6 +208,7 @@ static - void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - { - GArray *table_offsets; -+ unsigned dsdt; - GArray *tables_blob = tables->table_data; - - table_offsets = g_array_new(false, true /* clear */, -@@ -202,8 +228,13 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - */ - - /* DSDT is pointed to by FADT */ -+ dsdt = tables_blob->len; - build_dsdt(tables_blob, tables->linker, guest_info); - -+ /* FADT MADT GTDT pointed to by RSDT */ -+ acpi_add_table(table_offsets, tables_blob); -+ build_fadt(tables_blob, tables->linker, dsdt); -+ - /* Cleanup memory that's no longer used. */ - g_array_free(table_offsets, true); - } -diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h -index c4468f8..fadcf84 100644 ---- a/include/hw/acpi/acpi-defs.h -+++ b/include/hw/acpi/acpi-defs.h -@@ -88,46 +88,54 @@ struct AcpiTableHeader /* ACPI common table header */ - typedef struct AcpiTableHeader AcpiTableHeader; - - /* -- * ACPI 1.0 Fixed ACPI Description Table (FADT) -+ * ACPI Fixed ACPI Description Table (FADT) - */ -+#define ACPI_FADT_COMMON_DEF /* FADT common definition */ \ -+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ -+ uint32_t firmware_ctrl; /* Physical address of FACS */ \ -+ uint32_t dsdt; /* Physical address of DSDT */ \ -+ uint8_t model; /* System Interrupt Model */ \ -+ uint8_t reserved1; /* Reserved */ \ -+ uint16_t sci_int; /* System vector of SCI interrupt */ \ -+ uint32_t smi_cmd; /* Port address of SMI command port */ \ -+ uint8_t acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ -+ uint8_t acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ -+ /* Value to write to SMI CMD to enter S4BIOS state */ \ -+ uint8_t S4bios_req; \ -+ uint8_t reserved2; /* Reserved - must be zero */ \ -+ /* Port address of Power Mgt 1a acpi_event Reg Blk */ \ -+ uint32_t pm1a_evt_blk; \ -+ /* Port address of Power Mgt 1b acpi_event Reg Blk */ \ -+ uint32_t pm1b_evt_blk; \ -+ uint32_t pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ -+ uint32_t pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ -+ uint32_t pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ -+ uint32_t pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ -+ /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ -+ uint32_t gpe0_blk; \ -+ /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ -+ uint32_t gpe1_blk; \ -+ uint8_t pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \ -+ uint8_t pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \ -+ uint8_t pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ -+ uint8_t pm_tmr_len; /* Byte Length of ports at pm_tm_blk */ \ -+ uint8_t gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ -+ uint8_t gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ -+ uint8_t gpe1_base; /* Offset in gpe model where gpe1 events start */ \ -+ uint8_t reserved3; /* Reserved */ \ -+ uint16_t plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ -+ uint16_t plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ -+ uint16_t flush_size; /* Size of area read to flush caches */ \ -+ uint16_t flush_stride; /* Stride used in flushing caches */ \ -+ uint8_t duty_offset; /* Bit location of duty cycle field in p_cnt reg */ \ -+ uint8_t duty_width; /* Bit width of duty cycle field in p_cnt reg */ \ -+ uint8_t day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ -+ uint8_t mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ -+ uint8_t century; /* Index to century in RTC CMOS RAM */ -+ - struct AcpiFadtDescriptorRev1 - { -- ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -- uint32_t firmware_ctrl; /* Physical address of FACS */ -- uint32_t dsdt; /* Physical address of DSDT */ -- uint8_t model; /* System Interrupt Model */ -- uint8_t reserved1; /* Reserved */ -- uint16_t sci_int; /* System vector of SCI interrupt */ -- uint32_t smi_cmd; /* Port address of SMI command port */ -- uint8_t acpi_enable; /* Value to write to smi_cmd to enable ACPI */ -- uint8_t acpi_disable; /* Value to write to smi_cmd to disable ACPI */ -- uint8_t S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ -- uint8_t reserved2; /* Reserved - must be zero */ -- uint32_t pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ -- uint32_t pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ -- uint32_t pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ -- uint32_t pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ -- uint32_t pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ -- uint32_t pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ -- uint32_t gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ -- uint32_t gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ -- uint8_t pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ -- uint8_t pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ -- uint8_t pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ -- uint8_t pm_tmr_len; /* Byte Length of ports at pm_tm_blk */ -- uint8_t gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ -- uint8_t gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ -- uint8_t gpe1_base; /* Offset in gpe model where gpe1 events start */ -- uint8_t reserved3; /* Reserved */ -- uint16_t plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ -- uint16_t plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ -- uint16_t flush_size; /* Size of area read to flush caches */ -- uint16_t flush_stride; /* Stride used in flushing caches */ -- uint8_t duty_offset; /* Bit location of duty cycle field in p_cnt reg */ -- uint8_t duty_width; /* Bit width of duty cycle field in p_cnt reg */ -- uint8_t day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ -- uint8_t mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ -- uint8_t century; /* Index to century in RTC CMOS RAM */ -+ ACPI_FADT_COMMON_DEF - uint8_t reserved4; /* Reserved */ - uint8_t reserved4a; /* Reserved */ - uint8_t reserved4b; /* Reserved */ -@@ -135,6 +143,59 @@ struct AcpiFadtDescriptorRev1 - } QEMU_PACKED; - typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1; - -+struct AcpiGenericAddress { -+ uint8_t space_id; /* Address space where struct or register exists */ -+ uint8_t bit_width; /* Size in bits of given register */ -+ uint8_t bit_offset; /* Bit offset within the register */ -+ uint8_t access_width; /* Minimum Access size (ACPI 3.0) */ -+ uint64_t address; /* 64-bit address of struct or register */ -+} QEMU_PACKED; -+ -+struct AcpiFadtDescriptorRev5_1 { -+ ACPI_FADT_COMMON_DEF -+ /* IA-PC Boot Architecture Flags (see below for individual flags) */ -+ uint16_t boot_flags; -+ uint8_t reserved; /* Reserved, must be zero */ -+ /* Miscellaneous flag bits (see below for individual flags) */ -+ uint32_t flags; -+ /* 64-bit address of the Reset register */ -+ struct AcpiGenericAddress reset_register; -+ /* Value to write to the reset_register port to reset the system */ -+ uint8_t reset_value; -+ /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ -+ uint16_t arm_boot_flags; -+ uint8_t minor_revision; /* FADT Minor Revision (ACPI 5.1) */ -+ uint64_t Xfacs; /* 64-bit physical address of FACS */ -+ uint64_t Xdsdt; /* 64-bit physical address of DSDT */ -+ /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ -+ struct AcpiGenericAddress xpm1a_event_block; -+ /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ -+ struct AcpiGenericAddress xpm1b_event_block; -+ /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ -+ struct AcpiGenericAddress xpm1a_control_block; -+ /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ -+ struct AcpiGenericAddress xpm1b_control_block; -+ /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ -+ struct AcpiGenericAddress xpm2_control_block; -+ /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ -+ struct AcpiGenericAddress xpm_timer_block; -+ /* 64-bit Extended General Purpose Event 0 Reg Blk address */ -+ struct AcpiGenericAddress xgpe0_block; -+ /* 64-bit Extended General Purpose Event 1 Reg Blk address */ -+ struct AcpiGenericAddress xgpe1_block; -+ /* 64-bit Sleep Control register (ACPI 5.0) */ -+ struct AcpiGenericAddress sleep_control; -+ /* 64-bit Sleep Status register (ACPI 5.0) */ -+ struct AcpiGenericAddress sleep_status; -+} QEMU_PACKED; -+ -+typedef struct AcpiFadtDescriptorRev5_1 AcpiFadtDescriptorRev5_1; -+ -+enum { -+ ACPI_FADT_ARM_USE_PSCI_G_0_2 = 0, -+ ACPI_FADT_ARM_PSCI_USE_HVC = 1, -+}; -+ - /* - * ACPI 1.0 Root System Description Table (RSDT) - */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-GTDT-table.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-GTDT-table.patch deleted file mode 100644 index ddc3196..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-GTDT-table.patch +++ /dev/null @@ -1,171 +0,0 @@ -From eefbc539794dd91394adfa4191307d94be0ef2dc Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:27 +0200 -Subject: [PATCH 065/217] hw/arm/virt-acpi-build: Generate GTDT table -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-16-git-send-email-drjones@redhat.com> -Patchwork-id: 66248 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 15/33] hw/arm/virt-acpi-build: Generate GTDT table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -ACPI v5.1 defines GTDT for ARM devices as a place to describe timer -related information in the system. The Arch Timer interrupts must -be provided for GTDT. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-11-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit ee246400c1ceef2014e120b718388d5f4aea8a2a) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 29 +++++++++++++++++++++++++++++ - hw/arm/virt.c | 8 ++++---- - include/hw/acpi/acpi-defs.h | 37 +++++++++++++++++++++++++++++++++++++ - include/hw/arm/virt.h | 5 +++++ - 4 files changed, 75 insertions(+), 4 deletions(-) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index 29ad535..90587ad 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -151,6 +151,32 @@ static void acpi_dsdt_add_virtio(Aml *scope, - } - } - -+/* GTDT */ -+static void -+build_gtdt(GArray *table_data, GArray *linker) -+{ -+ int gtdt_start = table_data->len; -+ AcpiGenericTimerTable *gtdt; -+ -+ gtdt = acpi_data_push(table_data, sizeof *gtdt); -+ /* The interrupt values are the same with the device tree when adding 16 */ -+ gtdt->secure_el1_interrupt = ARCH_TIMER_S_EL1_IRQ + 16; -+ gtdt->secure_el1_flags = ACPI_EDGE_SENSITIVE; -+ -+ gtdt->non_secure_el1_interrupt = ARCH_TIMER_NS_EL1_IRQ + 16; -+ gtdt->non_secure_el1_flags = ACPI_EDGE_SENSITIVE; -+ -+ gtdt->virtual_timer_interrupt = ARCH_TIMER_VIRT_IRQ + 16; -+ gtdt->virtual_timer_flags = ACPI_EDGE_SENSITIVE; -+ -+ gtdt->non_secure_el2_interrupt = ARCH_TIMER_NS_EL2_IRQ + 16; -+ gtdt->non_secure_el2_flags = ACPI_EDGE_SENSITIVE; -+ -+ build_header(linker, table_data, -+ (void *)(table_data->data + gtdt_start), "GTDT", -+ table_data->len - gtdt_start, 5); -+} -+ - /* MADT */ - static void - build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, -@@ -292,6 +318,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - acpi_add_table(table_offsets, tables_blob); - build_madt(tables_blob, tables->linker, guest_info, &cpuinfo); - -+ acpi_add_table(table_offsets, tables_blob); -+ build_gtdt(tables_blob, tables->linker); -+ - /* Cleanup memory that's no longer used. */ - g_array_free(table_offsets, true); - } -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 59635a1..13c169b 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -270,10 +270,10 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi) - "arm,armv7-timer"); - } - qemu_fdt_setprop_cells(vbi->fdt, "/timer", "interrupts", -- GIC_FDT_IRQ_TYPE_PPI, 13, irqflags, -- GIC_FDT_IRQ_TYPE_PPI, 14, irqflags, -- GIC_FDT_IRQ_TYPE_PPI, 11, irqflags, -- GIC_FDT_IRQ_TYPE_PPI, 10, irqflags); -+ GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_S_EL1_IRQ, irqflags, -+ GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_NS_EL1_IRQ, irqflags, -+ GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_VIRT_IRQ, irqflags, -+ GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_NS_EL2_IRQ, irqflags); - } - - static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) -diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h -index 1e9dbe7..f503ec4 100644 ---- a/include/hw/acpi/acpi-defs.h -+++ b/include/hw/acpi/acpi-defs.h -@@ -341,6 +341,43 @@ struct AcpiMadtGenericDistributor { - typedef struct AcpiMadtGenericDistributor AcpiMadtGenericDistributor; - - /* -+ * Generic Timer Description Table (GTDT) -+ */ -+ -+#define ACPI_GTDT_INTERRUPT_MODE (1 << 0) -+#define ACPI_GTDT_INTERRUPT_POLARITY (1 << 1) -+#define ACPI_GTDT_ALWAYS_ON (1 << 2) -+ -+/* Triggering */ -+ -+#define ACPI_LEVEL_SENSITIVE ((uint8_t) 0x00) -+#define ACPI_EDGE_SENSITIVE ((uint8_t) 0x01) -+ -+/* Polarity */ -+ -+#define ACPI_ACTIVE_HIGH ((uint8_t) 0x00) -+#define ACPI_ACTIVE_LOW ((uint8_t) 0x01) -+#define ACPI_ACTIVE_BOTH ((uint8_t) 0x02) -+ -+struct AcpiGenericTimerTable { -+ ACPI_TABLE_HEADER_DEF -+ uint64_t counter_block_addresss; -+ uint32_t reserved; -+ uint32_t secure_el1_interrupt; -+ uint32_t secure_el1_flags; -+ uint32_t non_secure_el1_interrupt; -+ uint32_t non_secure_el1_flags; -+ uint32_t virtual_timer_interrupt; -+ uint32_t virtual_timer_flags; -+ uint32_t non_secure_el2_interrupt; -+ uint32_t non_secure_el2_flags; -+ uint64_t counter_read_block_address; -+ uint32_t platform_timer_count; -+ uint32_t platform_timer_offset; -+} QEMU_PACKED; -+typedef struct AcpiGenericTimerTable AcpiGenericTimerTable; -+ -+/* - * HPET Description Table - */ - struct Acpi20Hpet { -diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h -index 49a85cc..ceec8b3 100644 ---- a/include/hw/arm/virt.h -+++ b/include/hw/arm/virt.h -@@ -34,6 +34,11 @@ - - #define NUM_VIRTIO_TRANSPORTS 32 - -+#define ARCH_TIMER_VIRT_IRQ 11 -+#define ARCH_TIMER_S_EL1_IRQ 13 -+#define ARCH_TIMER_NS_EL1_IRQ 14 -+#define ARCH_TIMER_NS_EL2_IRQ 10 -+ - enum { - VIRT_FLASH, - VIRT_MEM, --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-MADT-table.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-MADT-table.patch deleted file mode 100644 index 8bfef3d..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-MADT-table.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 8fc3e9f79fd5f95becb75debd83114f74b5a3c93 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:26 +0200 -Subject: [PATCH 064/217] hw/arm/virt-acpi-build: Generate MADT table -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-15-git-send-email-drjones@redhat.com> -Patchwork-id: 66247 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 14/33] hw/arm/virt-acpi-build: Generate MADT table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -MADT describes GIC enabled ARM platforms. The GICC and GICD -subtables are used to define the GIC regions. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-10-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 982d06c561a62cf7d2a8d31e8a8c107fb3477419) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 57 ++++++++++++++++++++++++++++++++++++++++ - include/hw/acpi/acpi-defs.h | 38 ++++++++++++++++++++++++++- - include/hw/arm/virt-acpi-build.h | 3 +++ - 3 files changed, 97 insertions(+), 1 deletion(-) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index 0791501..29ad535 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -42,6 +42,20 @@ - - #define ARM_SPI_BASE 32 - -+typedef struct VirtAcpiCpuInfo { -+ DECLARE_BITMAP(found_cpus, VIRT_ACPI_CPU_ID_LIMIT); -+} VirtAcpiCpuInfo; -+ -+static void virt_acpi_get_cpu_info(VirtAcpiCpuInfo *cpuinfo) -+{ -+ CPUState *cpu; -+ -+ memset(cpuinfo->found_cpus, 0, sizeof cpuinfo->found_cpus); -+ CPU_FOREACH(cpu) { -+ set_bit(cpu->cpu_index, cpuinfo->found_cpus); -+ } -+} -+ - static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) - { - uint16_t i; -@@ -137,6 +151,43 @@ static void acpi_dsdt_add_virtio(Aml *scope, - } - } - -+/* MADT */ -+static void -+build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, -+ VirtAcpiCpuInfo *cpuinfo) -+{ -+ int madt_start = table_data->len; -+ const MemMapEntry *memmap = guest_info->memmap; -+ AcpiMultipleApicTable *madt; -+ AcpiMadtGenericDistributor *gicd; -+ int i; -+ -+ madt = acpi_data_push(table_data, sizeof *madt); -+ -+ for (i = 0; i < guest_info->smp_cpus; i++) { -+ AcpiMadtGenericInterrupt *gicc = acpi_data_push(table_data, -+ sizeof *gicc); -+ gicc->type = ACPI_APIC_GENERIC_INTERRUPT; -+ gicc->length = sizeof(*gicc); -+ gicc->base_address = memmap[VIRT_GIC_CPU].base; -+ gicc->cpu_interface_number = i; -+ gicc->arm_mpidr = i; -+ gicc->uid = i; -+ if (test_bit(i, cpuinfo->found_cpus)) { -+ gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); -+ } -+ } -+ -+ gicd = acpi_data_push(table_data, sizeof *gicd); -+ gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR; -+ gicd->length = sizeof(*gicd); -+ gicd->base_address = memmap[VIRT_GIC_DIST].base; -+ -+ build_header(linker, table_data, -+ (void *)(table_data->data + madt_start), "APIC", -+ table_data->len - madt_start, 5); -+} -+ - /* FADT */ - static void - build_fadt(GArray *table_data, GArray *linker, unsigned dsdt) -@@ -209,8 +260,11 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - { - GArray *table_offsets; - unsigned dsdt; -+ VirtAcpiCpuInfo cpuinfo; - GArray *tables_blob = tables->table_data; - -+ virt_acpi_get_cpu_info(&cpuinfo); -+ - table_offsets = g_array_new(false, true /* clear */, - sizeof(uint32_t)); - -@@ -235,6 +289,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - acpi_add_table(table_offsets, tables_blob); - build_fadt(tables_blob, tables->linker, dsdt); - -+ acpi_add_table(table_offsets, tables_blob); -+ build_madt(tables_blob, tables->linker, guest_info, &cpuinfo); -+ - /* Cleanup memory that's no longer used. */ - g_array_free(table_offsets, true); - } -diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h -index fadcf84..1e9dbe7 100644 ---- a/include/hw/acpi/acpi-defs.h -+++ b/include/hw/acpi/acpi-defs.h -@@ -256,7 +256,13 @@ typedef struct AcpiMultipleApicTable AcpiMultipleApicTable; - #define ACPI_APIC_IO_SAPIC 6 - #define ACPI_APIC_LOCAL_SAPIC 7 - #define ACPI_APIC_XRUPT_SOURCE 8 --#define ACPI_APIC_RESERVED 9 /* 9 and greater are reserved */ -+#define ACPI_APIC_LOCAL_X2APIC 9 -+#define ACPI_APIC_LOCAL_X2APIC_NMI 10 -+#define ACPI_APIC_GENERIC_INTERRUPT 11 -+#define ACPI_APIC_GENERIC_DISTRIBUTOR 12 -+#define ACPI_APIC_GENERIC_MSI_FRAME 13 -+#define ACPI_APIC_GENERIC_REDISTRIBUTOR 14 -+#define ACPI_APIC_RESERVED 15 /* 15 and greater are reserved */ - - /* - * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) -@@ -304,6 +310,36 @@ struct AcpiMadtLocalNmi { - } QEMU_PACKED; - typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi; - -+struct AcpiMadtGenericInterrupt { -+ ACPI_SUB_HEADER_DEF -+ uint16_t reserved; -+ uint32_t cpu_interface_number; -+ uint32_t uid; -+ uint32_t flags; -+ uint32_t parking_version; -+ uint32_t performance_interrupt; -+ uint64_t parked_address; -+ uint64_t base_address; -+ uint64_t gicv_base_address; -+ uint64_t gich_base_address; -+ uint32_t vgic_interrupt; -+ uint64_t gicr_base_address; -+ uint64_t arm_mpidr; -+} QEMU_PACKED; -+ -+typedef struct AcpiMadtGenericInterrupt AcpiMadtGenericInterrupt; -+ -+struct AcpiMadtGenericDistributor { -+ ACPI_SUB_HEADER_DEF -+ uint16_t reserved; -+ uint32_t gic_id; -+ uint64_t base_address; -+ uint32_t global_irq_base; -+ uint32_t reserved2; -+} QEMU_PACKED; -+ -+typedef struct AcpiMadtGenericDistributor AcpiMadtGenericDistributor; -+ - /* - * HPET Description Table - */ -diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h -index ff00121..04f174d 100644 ---- a/include/hw/arm/virt-acpi-build.h -+++ b/include/hw/arm/virt-acpi-build.h -@@ -23,6 +23,9 @@ - #include "qemu-common.h" - #include "hw/arm/virt.h" - -+#define VIRT_ACPI_CPU_ID_LIMIT 8 -+#define ACPI_GICC_ENABLED 1 -+ - typedef struct VirtGuestInfo { - int smp_cpus; - FWCfgState *fw_cfg; --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-MCFG-table.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-MCFG-table.patch deleted file mode 100644 index 26b8e7f..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-MCFG-table.patch +++ /dev/null @@ -1,84 +0,0 @@ -From f8d5324acd943da6bb7662f6e97390b234103495 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:30 +0200 -Subject: [PATCH 068/217] hw/arm/virt-acpi-build: Generate MCFG table -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-19-git-send-email-drjones@redhat.com> -Patchwork-id: 66250 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 18/33] hw/arm/virt-acpi-build: Generate MCFG table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Generate MCFG table for PCIe controller. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-14-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 8434488400971c6793893b8c9547bc6b97e076ce) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index f8c1dd8..95c83ee 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -39,6 +39,7 @@ - #include "hw/loader.h" - #include "hw/hw.h" - #include "hw/acpi/aml-build.h" -+#include "hw/pci/pcie_host.h" - - #define ARM_SPI_BASE 32 - -@@ -180,6 +181,25 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) - return rsdp_table; - } - -+static void -+build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) -+{ -+ AcpiTableMcfg *mcfg; -+ const MemMapEntry *memmap = guest_info->memmap; -+ int len = sizeof(*mcfg) + sizeof(mcfg->allocation[0]); -+ -+ mcfg = acpi_data_push(table_data, len); -+ mcfg->allocation[0].address = cpu_to_le64(memmap[VIRT_PCIE_ECAM].base); -+ -+ /* Only a single allocation so no need to play with segments */ -+ mcfg->allocation[0].pci_segment = cpu_to_le16(0); -+ mcfg->allocation[0].start_bus_number = 0; -+ mcfg->allocation[0].end_bus_number = (memmap[VIRT_PCIE_ECAM].size -+ / PCIE_MMCFG_SIZE_MIN) - 1; -+ -+ build_header(linker, table_data, (void *)mcfg, "MCFG", len, 5); -+} -+ - /* GTDT */ - static void - build_gtdt(GArray *table_data, GArray *linker) -@@ -350,6 +370,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - acpi_add_table(table_offsets, tables_blob); - build_gtdt(tables_blob, tables->linker); - -+ acpi_add_table(table_offsets, tables_blob); -+ build_mcfg(tables_blob, tables->linker, guest_info); -+ - /* RSDT is pointed to by RSDP */ - rsdt = tables_blob->len; - build_rsdt(tables_blob, tables->linker, table_offsets); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-RSDP-table.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-RSDP-table.patch deleted file mode 100644 index 8575c9e..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-RSDP-table.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 957bb78e8e2dcc40be4fe28e09dc75ae1f684f14 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:29 +0200 -Subject: [PATCH 067/217] hw/arm/virt-acpi-build: Generate RSDP table -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-18-git-send-email-drjones@redhat.com> -Patchwork-id: 66249 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 17/33] hw/arm/virt-acpi-build: Generate RSDP table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -RSDP points to RSDT which in turn points to other tables. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-13-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit d4bec5d876b694f7f13ad3fcfe510ff46e9748d0) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 35 ++++++++++++++++++++++++++++++++++- - 1 file changed, 34 insertions(+), 1 deletion(-) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index 95c84d6..f8c1dd8 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -151,6 +151,35 @@ static void acpi_dsdt_add_virtio(Aml *scope, - } - } - -+/* RSDP */ -+static GArray * -+build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) -+{ -+ AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); -+ -+ bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, -+ true /* fseg memory */); -+ -+ memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); -+ memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id)); -+ rsdp->length = cpu_to_le32(sizeof(*rsdp)); -+ rsdp->revision = 0x02; -+ -+ /* Point to RSDT */ -+ rsdp->rsdt_physical_address = cpu_to_le32(rsdt); -+ /* Address to be filled by Guest linker */ -+ bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, -+ ACPI_BUILD_TABLE_FILE, -+ rsdp_table, &rsdp->rsdt_physical_address, -+ sizeof rsdp->rsdt_physical_address); -+ rsdp->checksum = 0; -+ /* Checksum to be filled by Guest linker */ -+ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, -+ rsdp, rsdp, sizeof *rsdp, &rsdp->checksum); -+ -+ return rsdp_table; -+} -+ - /* GTDT */ - static void - build_gtdt(GArray *table_data, GArray *linker) -@@ -285,7 +314,7 @@ static - void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - { - GArray *table_offsets; -- unsigned dsdt; -+ unsigned dsdt, rsdt; - VirtAcpiCpuInfo cpuinfo; - GArray *tables_blob = tables->table_data; - -@@ -322,8 +351,12 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - build_gtdt(tables_blob, tables->linker); - - /* RSDT is pointed to by RSDP */ -+ rsdt = tables_blob->len; - build_rsdt(tables_blob, tables->linker, table_offsets); - -+ /* RSDP is in FSEG memory, so allocate it separately */ -+ build_rsdp(tables->rsdp, tables->linker, rsdt); -+ - /* Cleanup memory that's no longer used. */ - g_array_free(table_offsets, true); - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-RSDT-table.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-RSDT-table.patch deleted file mode 100644 index 3cec245..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generate-RSDT-table.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 0091c5292a51704a5d85b81976ee1869e6969c9e Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:28 +0200 -Subject: [PATCH 066/217] hw/arm/virt-acpi-build: Generate RSDT table -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-17-git-send-email-drjones@redhat.com> -Patchwork-id: 66252 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 16/33] hw/arm/virt-acpi-build: Generate RSDT table -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -RSDT points to other tables FADT, MADT, GTDT. This code is shared with x86. - -Here we still use RSDT as UEFI puts ACPI tables below 4G address space, -and UEFI ignore the RSDT or XSDT. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-12-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit 243bdb79fb0b2eda176cdef37700f29068a71d43) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 24 ++++++++++++++++++++++++ - hw/arm/virt-acpi-build.c | 3 +++ - hw/i386/acpi-build.c | 24 ------------------------ - include/hw/acpi/aml-build.h | 2 ++ - 4 files changed, 29 insertions(+), 24 deletions(-) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index 20eeaf9..2c890c8 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -1007,3 +1007,27 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) - g_array_free(tables->table_data, true); - g_array_free(tables->tcpalog, mfre); - } -+ -+/* Build rsdt table */ -+void -+build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) -+{ -+ AcpiRsdtDescriptorRev1 *rsdt; -+ size_t rsdt_len; -+ int i; -+ const int table_data_len = (sizeof(uint32_t) * table_offsets->len); -+ -+ rsdt_len = sizeof(*rsdt) + table_data_len; -+ rsdt = acpi_data_push(table_data, rsdt_len); -+ memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len); -+ for (i = 0; i < table_offsets->len; ++i) { -+ /* rsdt->table_offset_entry to be filled by Guest linker */ -+ bios_linker_loader_add_pointer(linker, -+ ACPI_BUILD_TABLE_FILE, -+ ACPI_BUILD_TABLE_FILE, -+ table_data, &rsdt->table_offset_entry[i], -+ sizeof(uint32_t)); -+ } -+ build_header(linker, table_data, -+ (void *)rsdt, "RSDT", rsdt_len, 1); -+} -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index 90587ad..95c84d6 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -321,6 +321,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - acpi_add_table(table_offsets, tables_blob); - build_gtdt(tables_blob, tables->linker); - -+ /* RSDT is pointed to by RSDP */ -+ build_rsdt(tables_blob, tables->linker, table_offsets); -+ - /* Cleanup memory that's no longer used. */ - g_array_free(table_offsets, true); - } -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index fa3372b..061a9ba 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -1212,30 +1212,6 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc) - misc->dsdt_size, 1); - } - --/* Build final rsdt table */ --static void --build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) --{ -- AcpiRsdtDescriptorRev1 *rsdt; -- size_t rsdt_len; -- int i; -- -- rsdt_len = sizeof(*rsdt) + sizeof(uint32_t) * table_offsets->len; -- rsdt = acpi_data_push(table_data, rsdt_len); -- memcpy(rsdt->table_offset_entry, table_offsets->data, -- sizeof(uint32_t) * table_offsets->len); -- for (i = 0; i < table_offsets->len; ++i) { -- /* rsdt->table_offset_entry to be filled by Guest linker */ -- bios_linker_loader_add_pointer(linker, -- ACPI_BUILD_TABLE_FILE, -- ACPI_BUILD_TABLE_FILE, -- table_data, &rsdt->table_offset_entry[i], -- sizeof(uint32_t)); -- } -- build_header(linker, table_data, -- (void *)rsdt, "RSDT", rsdt_len, 1); --} -- - static GArray * - build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) - { -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 2142d54..2c07a43 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -266,5 +266,7 @@ unsigned acpi_data_len(GArray *table); - void acpi_add_table(GArray *table_offsets, GArray *table_data); - void acpi_build_tables_init(AcpiBuildTables *tables); - void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); -+void -+build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets); - - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-arm-virt-acpi-build-Generation-of-DSDT-table-for-.patch b/SOURCES/kvm-hw-arm-virt-acpi-build-Generation-of-DSDT-table-for-.patch deleted file mode 100644 index 0e5b0f9..0000000 --- a/SOURCES/kvm-hw-arm-virt-acpi-build-Generation-of-DSDT-table-for-.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 7a00b2df3bb3c63ab578fc1ab7444473a0a15dc5 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:24 +0200 -Subject: [PATCH 062/217] hw/arm/virt-acpi-build: Generation of DSDT table for - virt devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1434455325-23399-13-git-send-email-drjones@redhat.com> -Patchwork-id: 66245 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 12/33] hw/arm/virt-acpi-build: Generation of DSDT table for virt devices -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -DSDT consists of the usual common table header plus a definition -block in AML encoding which describes all devices in the platform. - -After initializing DSDT with header information the namespace is -created which is followed by the device encodings. The devices are -described using the Resource Template for the 32-Bit Fixed Memory -Range and the Extended Interrupt Descriptors. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -Message-id: 1432522520-8068-8-git-send-email-zhaoshenglong@huawei.com -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit dfccd8cfd7c5d1b6740463821d84106bbaced44c) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/arm/virt-acpi-build.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 132 insertions(+) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index b8a5bd8..2cf2cc5 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -40,6 +40,134 @@ - #include "hw/hw.h" - #include "hw/acpi/aml-build.h" - -+#define ARM_SPI_BASE 32 -+ -+static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) -+{ -+ uint16_t i; -+ -+ for (i = 0; i < smp_cpus; i++) { -+ Aml *dev = aml_device("C%03x", i); -+ aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007"))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(i))); -+ aml_append(scope, dev); -+ } -+} -+ -+static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap, -+ int uart_irq) -+{ -+ Aml *dev = aml_device("COM0"); -+ aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011"))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(0))); -+ -+ Aml *crs = aml_resource_template(); -+ aml_append(crs, aml_memory32_fixed(uart_memmap->base, -+ uart_memmap->size, AML_READ_WRITE)); -+ aml_append(crs, -+ aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, -+ AML_EXCLUSIVE, uart_irq)); -+ aml_append(dev, aml_name_decl("_CRS", crs)); -+ aml_append(scope, dev); -+} -+ -+static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap, -+ int rtc_irq) -+{ -+ Aml *dev = aml_device("RTC0"); -+ aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013"))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(0))); -+ -+ Aml *crs = aml_resource_template(); -+ aml_append(crs, aml_memory32_fixed(rtc_memmap->base, -+ rtc_memmap->size, AML_READ_WRITE)); -+ aml_append(crs, -+ aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, -+ AML_EXCLUSIVE, rtc_irq)); -+ aml_append(dev, aml_name_decl("_CRS", crs)); -+ aml_append(scope, dev); -+} -+ -+static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap) -+{ -+ Aml *dev, *crs; -+ hwaddr base = flash_memmap->base; -+ hwaddr size = flash_memmap->size; -+ -+ dev = aml_device("FLS0"); -+ aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0015"))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(0))); -+ -+ crs = aml_resource_template(); -+ aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE)); -+ aml_append(dev, aml_name_decl("_CRS", crs)); -+ aml_append(scope, dev); -+ -+ dev = aml_device("FLS1"); -+ aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0015"))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(1))); -+ crs = aml_resource_template(); -+ aml_append(crs, aml_memory32_fixed(base + size, size, AML_READ_WRITE)); -+ aml_append(dev, aml_name_decl("_CRS", crs)); -+ aml_append(scope, dev); -+} -+ -+static void acpi_dsdt_add_virtio(Aml *scope, -+ const MemMapEntry *virtio_mmio_memmap, -+ int mmio_irq, int num) -+{ -+ hwaddr base = virtio_mmio_memmap->base; -+ hwaddr size = virtio_mmio_memmap->size; -+ int irq = mmio_irq; -+ int i; -+ -+ for (i = 0; i < num; i++) { -+ Aml *dev = aml_device("VR%02u", i); -+ aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005"))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(i))); -+ -+ Aml *crs = aml_resource_template(); -+ aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE)); -+ aml_append(crs, -+ aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, -+ AML_EXCLUSIVE, irq + i)); -+ aml_append(dev, aml_name_decl("_CRS", crs)); -+ aml_append(scope, dev); -+ base += size; -+ } -+} -+ -+/* DSDT */ -+static void -+build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) -+{ -+ Aml *scope, *dsdt; -+ const MemMapEntry *memmap = guest_info->memmap; -+ const int *irqmap = guest_info->irqmap; -+ -+ dsdt = init_aml_allocator(); -+ /* Reserve space for header */ -+ acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader)); -+ -+ scope = aml_scope("\\_SB"); -+ acpi_dsdt_add_cpus(scope, guest_info->smp_cpus); -+ acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], -+ (irqmap[VIRT_UART] + ARM_SPI_BASE)); -+ acpi_dsdt_add_rtc(scope, &memmap[VIRT_RTC], -+ (irqmap[VIRT_RTC] + ARM_SPI_BASE)); -+ acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); -+ acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], -+ (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); -+ aml_append(dsdt, scope); -+ -+ /* copy AML table into ACPI tables blob and patch header there */ -+ g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len); -+ build_header(linker, table_data, -+ (void *)(table_data->data + table_data->len - dsdt->buf->len), -+ "DSDT", dsdt->buf->len, 5); -+ free_aml_allocator(); -+} -+ - typedef - struct AcpiBuildState { - /* Copy of table in RAM (for patching). */ -@@ -55,6 +183,7 @@ static - void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - { - GArray *table_offsets; -+ GArray *tables_blob = tables->table_data; - - table_offsets = g_array_new(false, true /* clear */, - sizeof(uint32_t)); -@@ -72,6 +201,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) - * DSDT - */ - -+ /* DSDT is pointed to by FADT */ -+ build_dsdt(tables_blob, tables->linker, guest_info); -+ - /* Cleanup memory that's no longer used. */ - g_array_free(table_offsets, true); - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-i386-Move-ACPI-header-definitions-in-an-arch-inde.patch b/SOURCES/kvm-hw-i386-Move-ACPI-header-definitions-in-an-arch-inde.patch deleted file mode 100644 index b6c3c16..0000000 --- a/SOURCES/kvm-hw-i386-Move-ACPI-header-definitions-in-an-arch-inde.patch +++ /dev/null @@ -1,816 +0,0 @@ -From ea20bca711793046ce7264edc81ab6cc5fafcf8a Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:15 +0200 -Subject: [PATCH 054/217] hw/i386: Move ACPI header definitions in an - arch-independent location - -Message-id: <1434455325-23399-4-git-send-email-drjones@redhat.com> -Patchwork-id: 66236 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 03/33] hw/i386: Move ACPI header definitions in an arch-independent location -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -The ACPI related header file acpi-defs.h, includes definitions that -apply on other architectures as well. Move it in `include/hw/acpi/` -to sanely include it from other architectures. - -Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com> -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 395e5fb4421a03c9d3a002bbb55d56b74024a568) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 2 +- - hw/i386/acpi-defs.h | 368 -------------------------------------------- - include/hw/acpi/acpi-defs.h | 368 ++++++++++++++++++++++++++++++++++++++++++++ - tests/bios-tables-test.c | 2 +- - 4 files changed, 370 insertions(+), 370 deletions(-) - delete mode 100644 hw/i386/acpi-defs.h - create mode 100644 include/hw/acpi/acpi-defs.h - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 8a356b2..2882460 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -33,7 +33,7 @@ - #include "hw/i386/pc.h" - #include "target-i386/cpu.h" - #include "hw/timer/hpet.h" --#include "hw/i386/acpi-defs.h" -+#include "hw/acpi/acpi-defs.h" - #include "hw/acpi/acpi.h" - #include "hw/nvram/fw_cfg.h" - #include "hw/acpi/bios-linker-loader.h" -diff --git a/hw/i386/acpi-defs.h b/hw/i386/acpi-defs.h -deleted file mode 100644 -index c4468f8..0000000 ---- a/hw/i386/acpi-defs.h -+++ /dev/null -@@ -1,368 +0,0 @@ --/* -- * 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 of the License, or -- * (at your option) any later version. -- -- * 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/>. -- */ --#ifndef QEMU_ACPI_DEFS_H --#define QEMU_ACPI_DEFS_H -- --enum { -- ACPI_FADT_F_WBINVD, -- ACPI_FADT_F_WBINVD_FLUSH, -- ACPI_FADT_F_PROC_C1, -- ACPI_FADT_F_P_LVL2_UP, -- ACPI_FADT_F_PWR_BUTTON, -- ACPI_FADT_F_SLP_BUTTON, -- ACPI_FADT_F_FIX_RTC, -- ACPI_FADT_F_RTC_S4, -- ACPI_FADT_F_TMR_VAL_EXT, -- ACPI_FADT_F_DCK_CAP, -- ACPI_FADT_F_RESET_REG_SUP, -- ACPI_FADT_F_SEALED_CASE, -- ACPI_FADT_F_HEADLESS, -- ACPI_FADT_F_CPU_SW_SLP, -- ACPI_FADT_F_PCI_EXP_WAK, -- ACPI_FADT_F_USE_PLATFORM_CLOCK, -- ACPI_FADT_F_S4_RTC_STS_VALID, -- ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE, -- ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL, -- ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE, -- ACPI_FADT_F_HW_REDUCED_ACPI, -- ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE, --}; -- --/* -- * ACPI 2.0 Generic Address Space definition. -- */ --struct Acpi20GenericAddress { -- uint8_t address_space_id; -- uint8_t register_bit_width; -- uint8_t register_bit_offset; -- uint8_t reserved; -- uint64_t address; --} QEMU_PACKED; --typedef struct Acpi20GenericAddress Acpi20GenericAddress; -- --struct AcpiRsdpDescriptor { /* Root System Descriptor Pointer */ -- uint64_t signature; /* ACPI signature, contains "RSD PTR " */ -- uint8_t checksum; /* To make sum of struct == 0 */ -- uint8_t oem_id [6]; /* OEM identification */ -- uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ -- uint32_t rsdt_physical_address; /* 32-bit physical address of RSDT */ -- uint32_t length; /* XSDT Length in bytes including hdr */ -- uint64_t xsdt_physical_address; /* 64-bit physical address of XSDT */ -- uint8_t extended_checksum; /* Checksum of entire table */ -- uint8_t reserved [3]; /* Reserved field must be 0 */ --} QEMU_PACKED; --typedef struct AcpiRsdpDescriptor AcpiRsdpDescriptor; -- --/* Table structure from Linux kernel (the ACPI tables are under the -- BSD license) */ -- -- --#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ -- uint32_t signature; /* ACPI signature (4 ASCII characters) */ \ -- uint32_t length; /* Length of table, in bytes, including header */ \ -- uint8_t revision; /* ACPI Specification minor version # */ \ -- uint8_t checksum; /* To make sum of entire table == 0 */ \ -- uint8_t oem_id [6]; /* OEM identification */ \ -- uint8_t oem_table_id [8]; /* OEM table identification */ \ -- uint32_t oem_revision; /* OEM revision number */ \ -- uint8_t asl_compiler_id [4]; /* ASL compiler vendor ID */ \ -- uint32_t asl_compiler_revision; /* ASL compiler revision number */ -- -- --struct AcpiTableHeader /* ACPI common table header */ --{ -- ACPI_TABLE_HEADER_DEF --} QEMU_PACKED; --typedef struct AcpiTableHeader AcpiTableHeader; -- --/* -- * ACPI 1.0 Fixed ACPI Description Table (FADT) -- */ --struct AcpiFadtDescriptorRev1 --{ -- ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -- uint32_t firmware_ctrl; /* Physical address of FACS */ -- uint32_t dsdt; /* Physical address of DSDT */ -- uint8_t model; /* System Interrupt Model */ -- uint8_t reserved1; /* Reserved */ -- uint16_t sci_int; /* System vector of SCI interrupt */ -- uint32_t smi_cmd; /* Port address of SMI command port */ -- uint8_t acpi_enable; /* Value to write to smi_cmd to enable ACPI */ -- uint8_t acpi_disable; /* Value to write to smi_cmd to disable ACPI */ -- uint8_t S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ -- uint8_t reserved2; /* Reserved - must be zero */ -- uint32_t pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ -- uint32_t pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ -- uint32_t pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ -- uint32_t pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ -- uint32_t pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ -- uint32_t pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ -- uint32_t gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ -- uint32_t gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ -- uint8_t pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ -- uint8_t pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ -- uint8_t pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ -- uint8_t pm_tmr_len; /* Byte Length of ports at pm_tm_blk */ -- uint8_t gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ -- uint8_t gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ -- uint8_t gpe1_base; /* Offset in gpe model where gpe1 events start */ -- uint8_t reserved3; /* Reserved */ -- uint16_t plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ -- uint16_t plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ -- uint16_t flush_size; /* Size of area read to flush caches */ -- uint16_t flush_stride; /* Stride used in flushing caches */ -- uint8_t duty_offset; /* Bit location of duty cycle field in p_cnt reg */ -- uint8_t duty_width; /* Bit width of duty cycle field in p_cnt reg */ -- uint8_t day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ -- uint8_t mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ -- uint8_t century; /* Index to century in RTC CMOS RAM */ -- uint8_t reserved4; /* Reserved */ -- uint8_t reserved4a; /* Reserved */ -- uint8_t reserved4b; /* Reserved */ -- uint32_t flags; --} QEMU_PACKED; --typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1; -- --/* -- * ACPI 1.0 Root System Description Table (RSDT) -- */ --struct AcpiRsdtDescriptorRev1 --{ -- ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -- uint32_t table_offset_entry[0]; /* Array of pointers to other */ -- /* ACPI tables */ --} QEMU_PACKED; --typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescriptorRev1; -- --/* -- * ACPI 1.0 Firmware ACPI Control Structure (FACS) -- */ --struct AcpiFacsDescriptorRev1 --{ -- uint32_t signature; /* ACPI Signature */ -- uint32_t length; /* Length of structure, in bytes */ -- uint32_t hardware_signature; /* Hardware configuration signature */ -- uint32_t firmware_waking_vector; /* ACPI OS waking vector */ -- uint32_t global_lock; /* Global Lock */ -- uint32_t flags; -- uint8_t resverved3 [40]; /* Reserved - must be zero */ --} QEMU_PACKED; --typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1; -- --/* -- * Differentiated System Description Table (DSDT) -- */ -- --/* -- * MADT values and structures -- */ -- --/* Values for MADT PCATCompat */ -- --#define ACPI_DUAL_PIC 0 --#define ACPI_MULTIPLE_APIC 1 -- --/* Master MADT */ -- --struct AcpiMultipleApicTable --{ -- ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -- uint32_t local_apic_address; /* Physical address of local APIC */ -- uint32_t flags; --} QEMU_PACKED; --typedef struct AcpiMultipleApicTable AcpiMultipleApicTable; -- --/* Values for Type in APIC sub-headers */ -- --#define ACPI_APIC_PROCESSOR 0 --#define ACPI_APIC_IO 1 --#define ACPI_APIC_XRUPT_OVERRIDE 2 --#define ACPI_APIC_NMI 3 --#define ACPI_APIC_LOCAL_NMI 4 --#define ACPI_APIC_ADDRESS_OVERRIDE 5 --#define ACPI_APIC_IO_SAPIC 6 --#define ACPI_APIC_LOCAL_SAPIC 7 --#define ACPI_APIC_XRUPT_SOURCE 8 --#define ACPI_APIC_RESERVED 9 /* 9 and greater are reserved */ -- --/* -- * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) -- */ --#define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\ -- uint8_t type; \ -- uint8_t length; -- --/* Sub-structures for MADT */ -- --struct AcpiMadtProcessorApic --{ -- ACPI_SUB_HEADER_DEF -- uint8_t processor_id; /* ACPI processor id */ -- uint8_t local_apic_id; /* Processor's local APIC id */ -- uint32_t flags; --} QEMU_PACKED; --typedef struct AcpiMadtProcessorApic AcpiMadtProcessorApic; -- --struct AcpiMadtIoApic --{ -- ACPI_SUB_HEADER_DEF -- uint8_t io_apic_id; /* I/O APIC ID */ -- uint8_t reserved; /* Reserved - must be zero */ -- uint32_t address; /* APIC physical address */ -- uint32_t interrupt; /* Global system interrupt where INTI -- * lines start */ --} QEMU_PACKED; --typedef struct AcpiMadtIoApic AcpiMadtIoApic; -- --struct AcpiMadtIntsrcovr { -- ACPI_SUB_HEADER_DEF -- uint8_t bus; -- uint8_t source; -- uint32_t gsi; -- uint16_t flags; --} QEMU_PACKED; --typedef struct AcpiMadtIntsrcovr AcpiMadtIntsrcovr; -- --struct AcpiMadtLocalNmi { -- ACPI_SUB_HEADER_DEF -- uint8_t processor_id; /* ACPI processor id */ -- uint16_t flags; /* MPS INTI flags */ -- uint8_t lint; /* Local APIC LINT# */ --} QEMU_PACKED; --typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi; -- --/* -- * HPET Description Table -- */ --struct Acpi20Hpet { -- ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -- uint32_t timer_block_id; -- Acpi20GenericAddress addr; -- uint8_t hpet_number; -- uint16_t min_tick; -- uint8_t page_protect; --} QEMU_PACKED; --typedef struct Acpi20Hpet Acpi20Hpet; -- --/* -- * SRAT (NUMA topology description) table -- */ -- --struct AcpiSystemResourceAffinityTable --{ -- ACPI_TABLE_HEADER_DEF -- uint32_t reserved1; -- uint32_t reserved2[2]; --} QEMU_PACKED; --typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable; -- --#define ACPI_SRAT_PROCESSOR 0 --#define ACPI_SRAT_MEMORY 1 -- --struct AcpiSratProcessorAffinity --{ -- ACPI_SUB_HEADER_DEF -- uint8_t proximity_lo; -- uint8_t local_apic_id; -- uint32_t flags; -- uint8_t local_sapic_eid; -- uint8_t proximity_hi[3]; -- uint32_t reserved; --} QEMU_PACKED; --typedef struct AcpiSratProcessorAffinity AcpiSratProcessorAffinity; -- --struct AcpiSratMemoryAffinity --{ -- ACPI_SUB_HEADER_DEF -- uint8_t proximity[4]; -- uint16_t reserved1; -- uint64_t base_addr; -- uint64_t range_length; -- uint32_t reserved2; -- uint32_t flags; -- uint32_t reserved3[2]; --} QEMU_PACKED; --typedef struct AcpiSratMemoryAffinity AcpiSratMemoryAffinity; -- --/* PCI fw r3.0 MCFG table. */ --/* Subtable */ --struct AcpiMcfgAllocation { -- uint64_t address; /* Base address, processor-relative */ -- uint16_t pci_segment; /* PCI segment group number */ -- uint8_t start_bus_number; /* Starting PCI Bus number */ -- uint8_t end_bus_number; /* Final PCI Bus number */ -- uint32_t reserved; --} QEMU_PACKED; --typedef struct AcpiMcfgAllocation AcpiMcfgAllocation; -- --struct AcpiTableMcfg { -- ACPI_TABLE_HEADER_DEF; -- uint8_t reserved[8]; -- AcpiMcfgAllocation allocation[0]; --} QEMU_PACKED; --typedef struct AcpiTableMcfg AcpiTableMcfg; -- --/* -- * TCPA Description Table -- */ --struct Acpi20Tcpa { -- ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -- uint16_t platform_class; -- uint32_t log_area_minimum_length; -- uint64_t log_area_start_address; --} QEMU_PACKED; --typedef struct Acpi20Tcpa Acpi20Tcpa; -- --/* DMAR - DMA Remapping table r2.2 */ --struct AcpiTableDmar { -- ACPI_TABLE_HEADER_DEF -- uint8_t host_address_width; /* Maximum DMA physical addressability */ -- uint8_t flags; -- uint8_t reserved[10]; --} QEMU_PACKED; --typedef struct AcpiTableDmar AcpiTableDmar; -- --/* Masks for Flags field above */ --#define ACPI_DMAR_INTR_REMAP 1 --#define ACPI_DMAR_X2APIC_OPT_OUT (1 << 1) -- --/* Values for sub-structure type for DMAR */ --enum { -- ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, /* DRHD */ -- ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, /* RMRR */ -- ACPI_DMAR_TYPE_ATSR = 2, /* ATSR */ -- ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, /* RHSR */ -- ACPI_DMAR_TYPE_ANDD = 4, /* ANDD */ -- ACPI_DMAR_TYPE_RESERVED = 5 /* Reserved for furture use */ --}; -- --/* -- * Sub-structures for DMAR -- */ --/* Type 0: Hardware Unit Definition */ --struct AcpiDmarHardwareUnit { -- uint16_t type; -- uint16_t length; -- uint8_t flags; -- uint8_t reserved; -- uint16_t pci_segment; /* The PCI Segment associated with this unit */ -- uint64_t address; /* Base address of remapping hardware register-set */ --} QEMU_PACKED; --typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit; -- --/* Masks for Flags field above */ --#define ACPI_DMAR_INCLUDE_PCI_ALL 1 -- --#endif -diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h -new file mode 100644 -index 0000000..c4468f8 ---- /dev/null -+++ b/include/hw/acpi/acpi-defs.h -@@ -0,0 +1,368 @@ -+/* -+ * 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 of the License, or -+ * (at your option) any later version. -+ -+ * 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/>. -+ */ -+#ifndef QEMU_ACPI_DEFS_H -+#define QEMU_ACPI_DEFS_H -+ -+enum { -+ ACPI_FADT_F_WBINVD, -+ ACPI_FADT_F_WBINVD_FLUSH, -+ ACPI_FADT_F_PROC_C1, -+ ACPI_FADT_F_P_LVL2_UP, -+ ACPI_FADT_F_PWR_BUTTON, -+ ACPI_FADT_F_SLP_BUTTON, -+ ACPI_FADT_F_FIX_RTC, -+ ACPI_FADT_F_RTC_S4, -+ ACPI_FADT_F_TMR_VAL_EXT, -+ ACPI_FADT_F_DCK_CAP, -+ ACPI_FADT_F_RESET_REG_SUP, -+ ACPI_FADT_F_SEALED_CASE, -+ ACPI_FADT_F_HEADLESS, -+ ACPI_FADT_F_CPU_SW_SLP, -+ ACPI_FADT_F_PCI_EXP_WAK, -+ ACPI_FADT_F_USE_PLATFORM_CLOCK, -+ ACPI_FADT_F_S4_RTC_STS_VALID, -+ ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE, -+ ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL, -+ ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE, -+ ACPI_FADT_F_HW_REDUCED_ACPI, -+ ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE, -+}; -+ -+/* -+ * ACPI 2.0 Generic Address Space definition. -+ */ -+struct Acpi20GenericAddress { -+ uint8_t address_space_id; -+ uint8_t register_bit_width; -+ uint8_t register_bit_offset; -+ uint8_t reserved; -+ uint64_t address; -+} QEMU_PACKED; -+typedef struct Acpi20GenericAddress Acpi20GenericAddress; -+ -+struct AcpiRsdpDescriptor { /* Root System Descriptor Pointer */ -+ uint64_t signature; /* ACPI signature, contains "RSD PTR " */ -+ uint8_t checksum; /* To make sum of struct == 0 */ -+ uint8_t oem_id [6]; /* OEM identification */ -+ uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ -+ uint32_t rsdt_physical_address; /* 32-bit physical address of RSDT */ -+ uint32_t length; /* XSDT Length in bytes including hdr */ -+ uint64_t xsdt_physical_address; /* 64-bit physical address of XSDT */ -+ uint8_t extended_checksum; /* Checksum of entire table */ -+ uint8_t reserved [3]; /* Reserved field must be 0 */ -+} QEMU_PACKED; -+typedef struct AcpiRsdpDescriptor AcpiRsdpDescriptor; -+ -+/* Table structure from Linux kernel (the ACPI tables are under the -+ BSD license) */ -+ -+ -+#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ -+ uint32_t signature; /* ACPI signature (4 ASCII characters) */ \ -+ uint32_t length; /* Length of table, in bytes, including header */ \ -+ uint8_t revision; /* ACPI Specification minor version # */ \ -+ uint8_t checksum; /* To make sum of entire table == 0 */ \ -+ uint8_t oem_id [6]; /* OEM identification */ \ -+ uint8_t oem_table_id [8]; /* OEM table identification */ \ -+ uint32_t oem_revision; /* OEM revision number */ \ -+ uint8_t asl_compiler_id [4]; /* ASL compiler vendor ID */ \ -+ uint32_t asl_compiler_revision; /* ASL compiler revision number */ -+ -+ -+struct AcpiTableHeader /* ACPI common table header */ -+{ -+ ACPI_TABLE_HEADER_DEF -+} QEMU_PACKED; -+typedef struct AcpiTableHeader AcpiTableHeader; -+ -+/* -+ * ACPI 1.0 Fixed ACPI Description Table (FADT) -+ */ -+struct AcpiFadtDescriptorRev1 -+{ -+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -+ uint32_t firmware_ctrl; /* Physical address of FACS */ -+ uint32_t dsdt; /* Physical address of DSDT */ -+ uint8_t model; /* System Interrupt Model */ -+ uint8_t reserved1; /* Reserved */ -+ uint16_t sci_int; /* System vector of SCI interrupt */ -+ uint32_t smi_cmd; /* Port address of SMI command port */ -+ uint8_t acpi_enable; /* Value to write to smi_cmd to enable ACPI */ -+ uint8_t acpi_disable; /* Value to write to smi_cmd to disable ACPI */ -+ uint8_t S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ -+ uint8_t reserved2; /* Reserved - must be zero */ -+ uint32_t pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ -+ uint32_t pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ -+ uint32_t pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ -+ uint32_t pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ -+ uint32_t pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ -+ uint32_t pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ -+ uint32_t gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ -+ uint32_t gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ -+ uint8_t pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ -+ uint8_t pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ -+ uint8_t pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ -+ uint8_t pm_tmr_len; /* Byte Length of ports at pm_tm_blk */ -+ uint8_t gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ -+ uint8_t gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ -+ uint8_t gpe1_base; /* Offset in gpe model where gpe1 events start */ -+ uint8_t reserved3; /* Reserved */ -+ uint16_t plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ -+ uint16_t plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ -+ uint16_t flush_size; /* Size of area read to flush caches */ -+ uint16_t flush_stride; /* Stride used in flushing caches */ -+ uint8_t duty_offset; /* Bit location of duty cycle field in p_cnt reg */ -+ uint8_t duty_width; /* Bit width of duty cycle field in p_cnt reg */ -+ uint8_t day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ -+ uint8_t mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ -+ uint8_t century; /* Index to century in RTC CMOS RAM */ -+ uint8_t reserved4; /* Reserved */ -+ uint8_t reserved4a; /* Reserved */ -+ uint8_t reserved4b; /* Reserved */ -+ uint32_t flags; -+} QEMU_PACKED; -+typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1; -+ -+/* -+ * ACPI 1.0 Root System Description Table (RSDT) -+ */ -+struct AcpiRsdtDescriptorRev1 -+{ -+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -+ uint32_t table_offset_entry[0]; /* Array of pointers to other */ -+ /* ACPI tables */ -+} QEMU_PACKED; -+typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescriptorRev1; -+ -+/* -+ * ACPI 1.0 Firmware ACPI Control Structure (FACS) -+ */ -+struct AcpiFacsDescriptorRev1 -+{ -+ uint32_t signature; /* ACPI Signature */ -+ uint32_t length; /* Length of structure, in bytes */ -+ uint32_t hardware_signature; /* Hardware configuration signature */ -+ uint32_t firmware_waking_vector; /* ACPI OS waking vector */ -+ uint32_t global_lock; /* Global Lock */ -+ uint32_t flags; -+ uint8_t resverved3 [40]; /* Reserved - must be zero */ -+} QEMU_PACKED; -+typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1; -+ -+/* -+ * Differentiated System Description Table (DSDT) -+ */ -+ -+/* -+ * MADT values and structures -+ */ -+ -+/* Values for MADT PCATCompat */ -+ -+#define ACPI_DUAL_PIC 0 -+#define ACPI_MULTIPLE_APIC 1 -+ -+/* Master MADT */ -+ -+struct AcpiMultipleApicTable -+{ -+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -+ uint32_t local_apic_address; /* Physical address of local APIC */ -+ uint32_t flags; -+} QEMU_PACKED; -+typedef struct AcpiMultipleApicTable AcpiMultipleApicTable; -+ -+/* Values for Type in APIC sub-headers */ -+ -+#define ACPI_APIC_PROCESSOR 0 -+#define ACPI_APIC_IO 1 -+#define ACPI_APIC_XRUPT_OVERRIDE 2 -+#define ACPI_APIC_NMI 3 -+#define ACPI_APIC_LOCAL_NMI 4 -+#define ACPI_APIC_ADDRESS_OVERRIDE 5 -+#define ACPI_APIC_IO_SAPIC 6 -+#define ACPI_APIC_LOCAL_SAPIC 7 -+#define ACPI_APIC_XRUPT_SOURCE 8 -+#define ACPI_APIC_RESERVED 9 /* 9 and greater are reserved */ -+ -+/* -+ * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) -+ */ -+#define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\ -+ uint8_t type; \ -+ uint8_t length; -+ -+/* Sub-structures for MADT */ -+ -+struct AcpiMadtProcessorApic -+{ -+ ACPI_SUB_HEADER_DEF -+ uint8_t processor_id; /* ACPI processor id */ -+ uint8_t local_apic_id; /* Processor's local APIC id */ -+ uint32_t flags; -+} QEMU_PACKED; -+typedef struct AcpiMadtProcessorApic AcpiMadtProcessorApic; -+ -+struct AcpiMadtIoApic -+{ -+ ACPI_SUB_HEADER_DEF -+ uint8_t io_apic_id; /* I/O APIC ID */ -+ uint8_t reserved; /* Reserved - must be zero */ -+ uint32_t address; /* APIC physical address */ -+ uint32_t interrupt; /* Global system interrupt where INTI -+ * lines start */ -+} QEMU_PACKED; -+typedef struct AcpiMadtIoApic AcpiMadtIoApic; -+ -+struct AcpiMadtIntsrcovr { -+ ACPI_SUB_HEADER_DEF -+ uint8_t bus; -+ uint8_t source; -+ uint32_t gsi; -+ uint16_t flags; -+} QEMU_PACKED; -+typedef struct AcpiMadtIntsrcovr AcpiMadtIntsrcovr; -+ -+struct AcpiMadtLocalNmi { -+ ACPI_SUB_HEADER_DEF -+ uint8_t processor_id; /* ACPI processor id */ -+ uint16_t flags; /* MPS INTI flags */ -+ uint8_t lint; /* Local APIC LINT# */ -+} QEMU_PACKED; -+typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi; -+ -+/* -+ * HPET Description Table -+ */ -+struct Acpi20Hpet { -+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -+ uint32_t timer_block_id; -+ Acpi20GenericAddress addr; -+ uint8_t hpet_number; -+ uint16_t min_tick; -+ uint8_t page_protect; -+} QEMU_PACKED; -+typedef struct Acpi20Hpet Acpi20Hpet; -+ -+/* -+ * SRAT (NUMA topology description) table -+ */ -+ -+struct AcpiSystemResourceAffinityTable -+{ -+ ACPI_TABLE_HEADER_DEF -+ uint32_t reserved1; -+ uint32_t reserved2[2]; -+} QEMU_PACKED; -+typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable; -+ -+#define ACPI_SRAT_PROCESSOR 0 -+#define ACPI_SRAT_MEMORY 1 -+ -+struct AcpiSratProcessorAffinity -+{ -+ ACPI_SUB_HEADER_DEF -+ uint8_t proximity_lo; -+ uint8_t local_apic_id; -+ uint32_t flags; -+ uint8_t local_sapic_eid; -+ uint8_t proximity_hi[3]; -+ uint32_t reserved; -+} QEMU_PACKED; -+typedef struct AcpiSratProcessorAffinity AcpiSratProcessorAffinity; -+ -+struct AcpiSratMemoryAffinity -+{ -+ ACPI_SUB_HEADER_DEF -+ uint8_t proximity[4]; -+ uint16_t reserved1; -+ uint64_t base_addr; -+ uint64_t range_length; -+ uint32_t reserved2; -+ uint32_t flags; -+ uint32_t reserved3[2]; -+} QEMU_PACKED; -+typedef struct AcpiSratMemoryAffinity AcpiSratMemoryAffinity; -+ -+/* PCI fw r3.0 MCFG table. */ -+/* Subtable */ -+struct AcpiMcfgAllocation { -+ uint64_t address; /* Base address, processor-relative */ -+ uint16_t pci_segment; /* PCI segment group number */ -+ uint8_t start_bus_number; /* Starting PCI Bus number */ -+ uint8_t end_bus_number; /* Final PCI Bus number */ -+ uint32_t reserved; -+} QEMU_PACKED; -+typedef struct AcpiMcfgAllocation AcpiMcfgAllocation; -+ -+struct AcpiTableMcfg { -+ ACPI_TABLE_HEADER_DEF; -+ uint8_t reserved[8]; -+ AcpiMcfgAllocation allocation[0]; -+} QEMU_PACKED; -+typedef struct AcpiTableMcfg AcpiTableMcfg; -+ -+/* -+ * TCPA Description Table -+ */ -+struct Acpi20Tcpa { -+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */ -+ uint16_t platform_class; -+ uint32_t log_area_minimum_length; -+ uint64_t log_area_start_address; -+} QEMU_PACKED; -+typedef struct Acpi20Tcpa Acpi20Tcpa; -+ -+/* DMAR - DMA Remapping table r2.2 */ -+struct AcpiTableDmar { -+ ACPI_TABLE_HEADER_DEF -+ uint8_t host_address_width; /* Maximum DMA physical addressability */ -+ uint8_t flags; -+ uint8_t reserved[10]; -+} QEMU_PACKED; -+typedef struct AcpiTableDmar AcpiTableDmar; -+ -+/* Masks for Flags field above */ -+#define ACPI_DMAR_INTR_REMAP 1 -+#define ACPI_DMAR_X2APIC_OPT_OUT (1 << 1) -+ -+/* Values for sub-structure type for DMAR */ -+enum { -+ ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, /* DRHD */ -+ ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, /* RMRR */ -+ ACPI_DMAR_TYPE_ATSR = 2, /* ATSR */ -+ ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, /* RHSR */ -+ ACPI_DMAR_TYPE_ANDD = 4, /* ANDD */ -+ ACPI_DMAR_TYPE_RESERVED = 5 /* Reserved for furture use */ -+}; -+ -+/* -+ * Sub-structures for DMAR -+ */ -+/* Type 0: Hardware Unit Definition */ -+struct AcpiDmarHardwareUnit { -+ uint16_t type; -+ uint16_t length; -+ uint8_t flags; -+ uint8_t reserved; -+ uint16_t pci_segment; /* The PCI Segment associated with this unit */ -+ uint64_t address; /* Base address of remapping hardware register-set */ -+} QEMU_PACKED; -+typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit; -+ -+/* Masks for Flags field above */ -+#define ACPI_DMAR_INCLUDE_PCI_ALL 1 -+ -+#endif -diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c -index 735ac61..7e85dc4 100644 ---- a/tests/bios-tables-test.c -+++ b/tests/bios-tables-test.c -@@ -17,7 +17,7 @@ - #include "qemu-common.h" - #include "libqtest.h" - #include "qemu/compiler.h" --#include "hw/i386/acpi-defs.h" -+#include "hw/acpi/acpi-defs.h" - #include "hw/i386/smbios.h" - #include "qemu/bitmap.h" - --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-i386-acpi-build-move-generic-acpi-building-helper.patch b/SOURCES/kvm-hw-i386-acpi-build-move-generic-acpi-building-helper.patch deleted file mode 100644 index 18f2bb0..0000000 --- a/SOURCES/kvm-hw-i386-acpi-build-move-generic-acpi-building-helper.patch +++ /dev/null @@ -1,273 +0,0 @@ -From 452b1ada032bc7b0a6291e831decb08d4d4603d3 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:16 +0200 -Subject: [PATCH 055/217] hw/i386/acpi-build: move generic acpi building - helpers into dedictated file - -Message-id: <1434455325-23399-5-git-send-email-drjones@redhat.com> -Patchwork-id: 66237 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 04/33] hw/i386/acpi-build: move generic acpi building helpers into dedictated file -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Shannon Zhao <shannon.zhao@linaro.org> - -Move generic acpi building helpers into dedictated file and this -can be shared with other machines. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 658c27181bf3b08a9cf2fab00ecce7f76065f6af) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/acpi/aml-build.c | 58 ++++++++++++++++++++++++++++++++++ - hw/i386/acpi-build.c | 77 --------------------------------------------- - include/hw/acpi/aml-build.h | 29 +++++++++++++++++ - 3 files changed, 87 insertions(+), 77 deletions(-) - -diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c -index b8591b1..295fde2 100644 ---- a/hw/acpi/aml-build.c -+++ b/hw/acpi/aml-build.c -@@ -26,6 +26,7 @@ - #include <string.h> - #include "hw/acpi/aml-build.h" - #include "qemu/bswap.h" -+#include "hw/acpi/bios-linker-loader.h" - - static GArray *build_alloc_array(void) - { -@@ -894,3 +895,60 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, - dec, addr_gran, addr_min, addr_max, - addr_trans, len, flags); - } -+ -+void -+build_header(GArray *linker, GArray *table_data, -+ AcpiTableHeader *h, const char *sig, int len, uint8_t rev) -+{ -+ memcpy(&h->signature, sig, 4); -+ h->length = cpu_to_le32(len); -+ h->revision = rev; -+ memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); -+ memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); -+ memcpy(h->oem_table_id + 4, sig, 4); -+ h->oem_revision = cpu_to_le32(1); -+ memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); -+ h->asl_compiler_revision = cpu_to_le32(1); -+ h->checksum = 0; -+ /* Checksum to be filled in by Guest linker */ -+ bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, -+ table_data->data, h, len, &h->checksum); -+} -+ -+void *acpi_data_push(GArray *table_data, unsigned size) -+{ -+ unsigned off = table_data->len; -+ g_array_set_size(table_data, off + size); -+ return table_data->data + off; -+} -+ -+unsigned acpi_data_len(GArray *table) -+{ -+#if GLIB_CHECK_VERSION(2, 22, 0) -+ assert(g_array_get_element_size(table) == 1); -+#endif -+ return table->len; -+} -+ -+void acpi_add_table(GArray *table_offsets, GArray *table_data) -+{ -+ uint32_t offset = cpu_to_le32(table_data->len); -+ g_array_append_val(table_offsets, offset); -+} -+ -+void acpi_build_tables_init(AcpiBuildTables *tables) -+{ -+ tables->rsdp = g_array_new(false, true /* clear */, 1); -+ tables->table_data = g_array_new(false, true /* clear */, 1); -+ tables->tcpalog = g_array_new(false, true /* clear */, 1); -+ tables->linker = bios_linker_loader_init(); -+} -+ -+void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) -+{ -+ void *linker_data = bios_linker_loader_cleanup(tables->linker); -+ g_free(linker_data); -+ g_array_free(tables->rsdp, true); -+ g_array_free(tables->table_data, true); -+ g_array_free(tables->tcpalog, mfre); -+} -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 2882460..eb6296c 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -69,9 +69,6 @@ - - #define ACPI_BUILD_TABLE_SIZE 0x20000 - --/* Reserve RAM space for tables: add another order of magnitude. */ --#define ACPI_BUILD_TABLE_MAX_SIZE 0x200000 -- - /* #define DEBUG_ACPI_BUILD */ - #ifdef DEBUG_ACPI_BUILD - #define ACPI_BUILD_DPRINTF(fmt, ...) \ -@@ -266,51 +263,8 @@ static void acpi_get_pci_info(PcPciInfo *info) - NULL); - } - --#define ACPI_BUILD_APPNAME "Bochs" --#define ACPI_BUILD_APPNAME6 "BOCHS " --#define ACPI_BUILD_APPNAME4 "BXPC" -- --#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables" --#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp" --#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log" -- --static void --build_header(GArray *linker, GArray *table_data, -- AcpiTableHeader *h, const char *sig, int len, uint8_t rev) --{ -- memcpy(&h->signature, sig, 4); -- h->length = cpu_to_le32(len); -- h->revision = rev; -- memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); -- memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); -- memcpy(h->oem_table_id + 4, sig, 4); -- h->oem_revision = cpu_to_le32(1); -- memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); -- h->asl_compiler_revision = cpu_to_le32(1); -- h->checksum = 0; -- /* Checksum to be filled in by Guest linker */ -- bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, -- table_data->data, h, len, &h->checksum); --} -- --/* End here */ - #define ACPI_PORT_SMI_CMD 0x00b2 /* TODO: this is APM_CNT_IOPORT */ - --static inline void *acpi_data_push(GArray *table_data, unsigned size) --{ -- unsigned off = table_data->len; -- g_array_set_size(table_data, off + size); -- return table_data->data + off; --} -- --static unsigned acpi_data_len(GArray *table) --{ --#if GLIB_CHECK_VERSION(2, 22, 0) -- assert(g_array_get_element_size(table) == 1); --#endif -- return table->len; --} -- - static void acpi_align_size(GArray *blob, unsigned align) - { - /* Align size to multiple of given size. This reduces the chance -@@ -319,12 +273,6 @@ static void acpi_align_size(GArray *blob, unsigned align) - g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align)); - } - --static inline void acpi_add_table(GArray *table_offsets, GArray *table_data) --{ -- uint32_t offset = cpu_to_le32(table_data->len); -- g_array_append_val(table_offsets, offset); --} -- - /* FACS */ - static void - build_facs(GArray *table_data, GArray *linker, PcGuestInfo *guest_info) -@@ -1313,31 +1261,6 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) - } - - typedef --struct AcpiBuildTables { -- GArray *table_data; -- GArray *rsdp; -- GArray *tcpalog; -- GArray *linker; --} AcpiBuildTables; -- --static inline void acpi_build_tables_init(AcpiBuildTables *tables) --{ -- tables->rsdp = g_array_new(false, true /* clear */, 1); -- tables->table_data = g_array_new(false, true /* clear */, 1); -- tables->tcpalog = g_array_new(false, true /* clear */, 1); -- tables->linker = bios_linker_loader_init(); --} -- --static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) --{ -- void *linker_data = bios_linker_loader_cleanup(tables->linker); -- g_free(linker_data); -- g_array_free(tables->rsdp, true); -- g_array_free(tables->table_data, true); -- g_array_free(tables->tcpalog, mfre); --} -- --typedef - struct AcpiBuildState { - /* Copy of table in RAM (for patching). */ - MemoryRegion *table_mr; -diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h -index 5aa5e7a..15579e6 100644 ---- a/include/hw/acpi/aml-build.h -+++ b/include/hw/acpi/aml-build.h -@@ -4,6 +4,18 @@ - #include <stdint.h> - #include <glib.h> - #include "qemu/compiler.h" -+#include "hw/acpi/acpi-defs.h" -+ -+/* Reserve RAM space for tables: add another order of magnitude. */ -+#define ACPI_BUILD_TABLE_MAX_SIZE 0x200000 -+ -+#define ACPI_BUILD_APPNAME "Bochs" -+#define ACPI_BUILD_APPNAME6 "BOCHS " -+#define ACPI_BUILD_APPNAME4 "BXPC" -+ -+#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables" -+#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp" -+#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log" - - typedef enum { - AML_NO_OPCODE = 0,/* has only data */ -@@ -99,6 +111,14 @@ typedef enum { - aml_ReadWrite = 1, - } AmlReadAndWrite; - -+typedef -+struct AcpiBuildTables { -+ GArray *table_data; -+ GArray *rsdp; -+ GArray *tcpalog; -+ GArray *linker; -+} AcpiBuildTables; -+ - /** - * init_aml_allocator: - * -@@ -194,4 +214,13 @@ Aml *aml_resource_template(void); - Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); - Aml *aml_varpackage(uint32_t num_elements); - -+void -+build_header(GArray *linker, GArray *table_data, -+ AcpiTableHeader *h, const char *sig, int len, uint8_t rev); -+void *acpi_data_push(GArray *table_data, unsigned size); -+unsigned acpi_data_len(GArray *table); -+void acpi_add_table(GArray *table_offsets, GArray *table_data); -+void acpi_build_tables_init(AcpiBuildTables *tables); -+void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); -+ - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-i386-query-only-for-q35-pc-when-looking-for-pci-h.patch b/SOURCES/kvm-hw-i386-query-only-for-q35-pc-when-looking-for-pci-h.patch deleted file mode 100644 index 35d211d..0000000 --- a/SOURCES/kvm-hw-i386-query-only-for-q35-pc-when-looking-for-pci-h.patch +++ /dev/null @@ -1,95 +0,0 @@ -From b7ec6bcbd25ad80d0f31c426a18f68b23a620366 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:23 +0200 -Subject: [PATCH 200/217] hw/i386: query only for q35/pc when looking for pci - host bridge - -Message-id: <1435154016-26233-31-git-send-email-marcel@redhat.com> -Patchwork-id: 66457 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 30/43] hw/i386: query only for q35/pc when looking for pci host bridge -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE anymore. -On i386 arch we only have two pci hosts, so we can look only for them. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit ca6c18556c5e9c4aac12489b960c3e4601e183bf) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 34 +++++++++++++++++++++++++--------- - 1 file changed, 25 insertions(+), 9 deletions(-) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index da9b588..ea77a3f 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -239,13 +239,32 @@ static void acpi_get_misc_info(AcpiMiscInfo *info) - info->applesmc_io_base = applesmc_port(); - } - -+/* -+ * Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE. -+ * On i386 arch we only have two pci hosts, so we can look only for them. -+ */ -+static Object *acpi_get_i386_pci_host(void) -+{ -+ PCIHostState *host; -+ -+ host = OBJECT_CHECK(PCIHostState, -+ object_resolve_path("/machine/i440fx", NULL), -+ TYPE_PCI_HOST_BRIDGE); -+ if (!host) { -+ host = OBJECT_CHECK(PCIHostState, -+ object_resolve_path("/machine/q35", NULL), -+ TYPE_PCI_HOST_BRIDGE); -+ } -+ -+ return OBJECT(host); -+} -+ - static void acpi_get_pci_info(PcPciInfo *info) - { - Object *pci_host; -- bool ambiguous; - -- pci_host = object_resolve_path_type("", TYPE_PCI_HOST_BRIDGE, &ambiguous); -- g_assert(!ambiguous); -+ -+ pci_host = acpi_get_i386_pci_host(); - g_assert(pci_host); - - info->w32.begin = object_property_get_int(pci_host, -@@ -955,10 +974,9 @@ build_ssdt(GArray *table_data, GArray *linker, - { - Object *pci_host; - PCIBus *bus = NULL; -- bool ambiguous; - -- pci_host = object_resolve_path_type("", TYPE_PCI_HOST_BRIDGE, &ambiguous); -- if (!ambiguous && pci_host) { -+ pci_host = acpi_get_i386_pci_host(); -+ if (pci_host) { - bus = PCI_HOST_BRIDGE(pci_host)->bus; - } - -@@ -1251,10 +1269,8 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) - { - Object *pci_host; - QObject *o; -- bool ambiguous; - -- pci_host = object_resolve_path_type("", TYPE_PCI_HOST_BRIDGE, &ambiguous); -- g_assert(!ambiguous); -+ pci_host = acpi_get_i386_pci_host(); - g_assert(pci_host); - - o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL); --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-add-support-for-NUMA-nodes.patch b/SOURCES/kvm-hw-pci-add-support-for-NUMA-nodes.patch deleted file mode 100644 index f1aca51..0000000 --- a/SOURCES/kvm-hw-pci-add-support-for-NUMA-nodes.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 2342630165988673bf9b11707022128b509a42f7 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:33 +0200 -Subject: [PATCH 210/217] hw/pci: add support for NUMA nodes - -Message-id: <1435154016-26233-41-git-send-email-marcel@redhat.com> -Patchwork-id: 66468 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 40/43] hw/pci: add support for NUMA nodes -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -PCI root buses can be attached to a specific NUMA node. -PCI buses are not attached by default to a NUMA node. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 6a3042b23bbb1fa92c00ea9267c830e7f2e99313) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 11 +++++++++++ - include/hw/pci/pci.h | 1 + - include/hw/pci/pci_bus.h | 1 + - include/sysemu/sysemu.h | 1 + - 4 files changed, 14 insertions(+) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index a5598fa..2688be4 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -101,6 +101,11 @@ static int pcibus_num(PCIBus *bus) - return bus->parent_dev->config[PCI_SECONDARY_BUS]; - } - -+static uint16_t pcibus_numa_node(PCIBus *bus) -+{ -+ return NUMA_NODE_UNASSIGNED; -+} -+ - static void pci_bus_class_init(ObjectClass *klass, void *data) - { - BusClass *k = BUS_CLASS(klass); -@@ -115,6 +120,7 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) - - pbc->is_root = pcibus_is_root; - pbc->bus_num = pcibus_num; -+ pbc->numa_node = pcibus_numa_node; - } - - static const TypeInfo pci_bus_info = { -@@ -402,6 +408,11 @@ int pci_bus_num(PCIBus *s) - return PCI_BUS_GET_CLASS(s)->bus_num(s); - } - -+int pci_bus_numa_node(PCIBus *bus) -+{ -+ return PCI_BUS_GET_CLASS(bus)->numa_node(bus); -+} -+ - static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) - { - PCIDevice *s = container_of(pv, PCIDevice, config); -diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h -index 3d1d3ea..f854ea0 100644 ---- a/include/hw/pci/pci.h -+++ b/include/hw/pci/pci.h -@@ -387,6 +387,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, - PCIDevice *pci_vga_init(PCIBus *bus); - - int pci_bus_num(PCIBus *s); -+int pci_bus_numa_node(PCIBus *bus); - void pci_for_each_device(PCIBus *bus, int bus_num, - void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque), - void *opaque); -diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h -index 7b9939e..403fec6 100644 ---- a/include/hw/pci/pci_bus.h -+++ b/include/hw/pci/pci_bus.h -@@ -15,6 +15,7 @@ typedef struct PCIBusClass { - - bool (*is_root)(PCIBus *bus); - int (*bus_num)(PCIBus *bus); -+ uint16_t (*numa_node)(PCIBus *bus); - } PCIBusClass; - - struct PCIBus { -diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h -index f5e9141..fa928dd 100644 ---- a/include/sysemu/sysemu.h -+++ b/include/sysemu/sysemu.h -@@ -138,6 +138,7 @@ extern const char *mem_path; - extern int mem_prealloc; - - #define MAX_NODES 128 -+#define NUMA_NODE_UNASSIGNED MAX_NODES - - /* The following shall be true for all CPUs: - * cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-extend-PCI-config-access-to-support-devices-b.patch b/SOURCES/kvm-hw-pci-extend-PCI-config-access-to-support-devices-b.patch deleted file mode 100644 index 888171c..0000000 --- a/SOURCES/kvm-hw-pci-extend-PCI-config-access-to-support-devices-b.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 33b477ef4d1d4c9bcc157cb51444ce559783787c Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:24 +0200 -Subject: [PATCH 201/217] hw/pci: extend PCI config access to support devices - behind PXB - -Message-id: <1435154016-26233-32-git-send-email-marcel@redhat.com> -Patchwork-id: 66463 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 31/43] hw/pci: extend PCI config access to support devices behind PXB -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -PXB buses are assumed to be children of bus 0. Look for them -while scanning the buses. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 09e5b81922179b6c52b42fd27587e64b474036c7) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 34 +++++++++++++++++++++++++++++----- - 1 file changed, 29 insertions(+), 5 deletions(-) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index ca6a708..38a9cb4 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -1714,10 +1714,28 @@ static bool pci_secondary_bus_in_range(PCIDevice *dev, int bus_num) - { - return !(pci_get_word(dev->config + PCI_BRIDGE_CONTROL) & - PCI_BRIDGE_CTL_BUS_RESET) /* Don't walk the bus if it's reset. */ && -- dev->config[PCI_SECONDARY_BUS] < bus_num && -+ dev->config[PCI_SECONDARY_BUS] <= bus_num && - bus_num <= dev->config[PCI_SUBORDINATE_BUS]; - } - -+/* Whether a given bus number is in a range of a root bus */ -+static bool pci_root_bus_in_range(PCIBus *bus, int bus_num) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { -+ PCIDevice *dev = bus->devices[i]; -+ -+ if (dev && PCI_DEVICE_GET_CLASS(dev)->is_bridge) { -+ if (pci_secondary_bus_in_range(dev, bus_num)) { -+ return true; -+ } -+ } -+ } -+ -+ return false; -+} -+ - static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num) - { - PCIBus *sec; -@@ -1739,12 +1757,18 @@ static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num) - /* try child bus */ - for (; bus; bus = sec) { - QLIST_FOREACH(sec, &bus->child, sibling) { -- assert(!pci_bus_is_root(sec)); -- if (sec->parent_dev->config[PCI_SECONDARY_BUS] == bus_num) { -+ if (pci_bus_num(sec) == bus_num) { - return sec; - } -- if (pci_secondary_bus_in_range(sec->parent_dev, bus_num)) { -- break; -+ /* PXB buses assumed to be children of bus 0 */ -+ if (pci_bus_is_root(sec)) { -+ if (pci_root_bus_in_range(sec, bus_num)) { -+ break; -+ } -+ } else { -+ if (pci_secondary_bus_in_range(sec->parent_dev, bus_num)) { -+ break; -+ } - } - } - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-inform-bios-if-the-system-has-extra-pci-root-.patch b/SOURCES/kvm-hw-pci-inform-bios-if-the-system-has-extra-pci-root-.patch deleted file mode 100644 index 4c5c7c6..0000000 --- a/SOURCES/kvm-hw-pci-inform-bios-if-the-system-has-extra-pci-root-.patch +++ /dev/null @@ -1,70 +0,0 @@ -From a0141bdfa809993b6d773ef79affda091897a9ab Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:31 +0200 -Subject: [PATCH 208/217] hw/pci: inform bios if the system has extra pci root - buses - -Message-id: <1435154016-26233-39-git-send-email-marcel@redhat.com> -Patchwork-id: 66466 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 38/43] hw/pci: inform bios if the system has extra pci root buses -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Marcel Apfelbaum <marcel.a@redhat.com> - -The bios looks for 'etc/extra-pci-roots' to decide if -is going to scan further buses after bus 0 tree. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 2118196bb3795a43bf708c37bdcf4b3c33778ccb) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/pc.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index a946976..eb310ee 100644 ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -30,6 +30,7 @@ - #include "hw/block/fdc.h" - #include "hw/ide.h" - #include "hw/pci/pci.h" -+#include "hw/pci/pci_bus.h" - #include "monitor/monitor.h" - #include "hw/nvram/fw_cfg.h" - #include "hw/timer/hpet.h" -@@ -1120,6 +1121,25 @@ void pc_guest_info_machine_done(Notifier *notifier, void *data) - PcGuestInfoState *guest_info_state = container_of(notifier, - PcGuestInfoState, - machine_done); -+ PCIBus *bus = find_i440fx(); -+ -+ if (bus) { -+ int extra_hosts = 0; -+ -+ QLIST_FOREACH(bus, &bus->child, sibling) { -+ /* look for expander root buses */ -+ if (pci_bus_is_root(bus)) { -+ extra_hosts++; -+ } -+ } -+ if (extra_hosts && guest_info_state->info.fw_cfg) { -+ uint64_t *val = g_malloc(sizeof(*val)); -+ *val = cpu_to_le64(extra_hosts); -+ fw_cfg_add_file(guest_info_state->info.fw_cfg, -+ "etc/extra-pci-roots", val, sizeof(*val)); -+ } -+ } -+ - acpi_setup(&guest_info_state->info); - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-introduce-PCI-Expander-Bridge-PXB.patch b/SOURCES/kvm-hw-pci-introduce-PCI-Expander-Bridge-PXB.patch deleted file mode 100644 index 1250eec..0000000 --- a/SOURCES/kvm-hw-pci-introduce-PCI-Expander-Bridge-PXB.patch +++ /dev/null @@ -1,279 +0,0 @@ -From 95cdd8dd0fa39e7865b9a3549ddb70a06e53d47b Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:30 +0200 -Subject: [PATCH 207/217] hw/pci: introduce PCI Expander Bridge (PXB) - -Message-id: <1435154016-26233-38-git-send-email-marcel@redhat.com> -Patchwork-id: 66464 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 37/43] hw/pci: introduce PCI Expander Bridge (PXB) -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Marcel Apfelbaum <marcel.a@redhat.com> - -PXB is a "light-weight" host bridge whose purpose is to enable -the main host bridge to support multiple PCI root buses -for pc machines. - -As oposed to PCI-2-PCI bridge's secondary bus, PXB's bus -is a primary bus and can be associated with a NUMA node -(different from the main host bridge) allowing the guest OS -to recognize the proximity of a pass-through device to -other resources as RAM and CPUs. - -The PXB is composed from: - - A primary PCI bus (can be associated with a NUMA node) - Acts like a normal pci bus and from the functionality point - of view is an "expansion" of the bus behind the - main host bridge. - - A pci-2-pci bridge behind the primary PCI bus where the actual - devices will be attached. - - A host-bridge PCI device - Situated on the bus behind the main host bridge, allows - the BIOS to configure the bus number and IO/mem resources. - It does not have its own config/data register for configuration - cycles, this being handled by the main host bridge. -- A host-bridge sysbus to comply with QEMU current design. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 40d14bef8012087ade60f254487d31db822a1a44) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci-bridge/Makefile.objs | 1 + - hw/pci-bridge/pci_expander_bridge.c | 196 ++++++++++++++++++++++++++++++++++++ - include/hw/pci/pci.h | 1 + - 3 files changed, 198 insertions(+) - create mode 100644 hw/pci-bridge/pci_expander_bridge.c - -diff --git a/hw/pci-bridge/Makefile.objs b/hw/pci-bridge/Makefile.objs -index 96c596e..f2adfe3 100644 ---- a/hw/pci-bridge/Makefile.objs -+++ b/hw/pci-bridge/Makefile.objs -@@ -1,4 +1,5 @@ - common-obj-y += pci_bridge_dev.o -+common-obj-y += pci_expander_bridge.o - common-obj-$(CONFIG_XIO3130) += xio3130_upstream.o xio3130_downstream.o - common-obj-$(CONFIG_IOH3420) += ioh3420.o - common-obj-$(CONFIG_I82801B11) += i82801b11.o -diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c -new file mode 100644 -index 0000000..88e85c1 ---- /dev/null -+++ b/hw/pci-bridge/pci_expander_bridge.c -@@ -0,0 +1,196 @@ -+/* -+ * PCI Expander Bridge Device Emulation -+ * -+ * Copyright (C) 2015 Red Hat Inc -+ * -+ * Authors: -+ * Marcel Apfelbaum <marcel@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. -+ */ -+ -+#include "hw/pci/pci.h" -+#include "hw/pci/pci_bus.h" -+#include "hw/pci/pci_host.h" -+#include "hw/pci/pci_bus.h" -+#include "hw/i386/pc.h" -+#include "qemu/range.h" -+#include "qemu/error-report.h" -+ -+#define TYPE_PXB_BUS "pxb-bus" -+#define PXB_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_BUS) -+ -+typedef struct PXBBus { -+ /*< private >*/ -+ PCIBus parent_obj; -+ /*< public >*/ -+ -+ char bus_path[8]; -+} PXBBus; -+ -+#define TYPE_PXB_DEVICE "pxb" -+#define PXB_DEV(obj) OBJECT_CHECK(PXBDev, (obj), TYPE_PXB_DEVICE) -+ -+typedef struct PXBDev { -+ /*< private >*/ -+ PCIDevice parent_obj; -+ /*< public >*/ -+ -+ uint8_t bus_nr; -+} PXBDev; -+ -+#define TYPE_PXB_HOST "pxb-host" -+ -+static int pxb_bus_num(PCIBus *bus) -+{ -+ PXBDev *pxb = PXB_DEV(bus->parent_dev); -+ -+ return pxb->bus_nr; -+} -+ -+static bool pxb_is_root(PCIBus *bus) -+{ -+ return true; /* by definition */ -+} -+ -+static void pxb_bus_class_init(ObjectClass *class, void *data) -+{ -+ PCIBusClass *pbc = PCI_BUS_CLASS(class); -+ -+ pbc->bus_num = pxb_bus_num; -+ pbc->is_root = pxb_is_root; -+} -+ -+static const TypeInfo pxb_bus_info = { -+ .name = TYPE_PXB_BUS, -+ .parent = TYPE_PCI_BUS, -+ .instance_size = sizeof(PXBBus), -+ .class_init = pxb_bus_class_init, -+}; -+ -+static const char *pxb_host_root_bus_path(PCIHostState *host_bridge, -+ PCIBus *rootbus) -+{ -+ PXBBus *bus = PXB_BUS(rootbus); -+ -+ snprintf(bus->bus_path, 8, "0000:%02x", pxb_bus_num(rootbus)); -+ return bus->bus_path; -+} -+ -+static void pxb_host_class_init(ObjectClass *class, void *data) -+{ -+ DeviceClass *dc = DEVICE_CLASS(class); -+ PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(class); -+ -+ dc->fw_name = "pci"; -+ hc->root_bus_path = pxb_host_root_bus_path; -+} -+ -+static const TypeInfo pxb_host_info = { -+ .name = TYPE_PXB_HOST, -+ .parent = TYPE_PCI_HOST_BRIDGE, -+ .class_init = pxb_host_class_init, -+}; -+ -+/* -+ * Registers the PXB bus as a child of the i440fx root bus. -+ * -+ * Returns 0 on successs, -1 if i440fx host was not -+ * found or the bus number is already in use. -+ */ -+static int pxb_register_bus(PCIDevice *dev, PCIBus *pxb_bus) -+{ -+ PCIBus *bus = dev->bus; -+ int pxb_bus_num = pci_bus_num(pxb_bus); -+ -+ if (bus->parent_dev) { -+ error_report("PXB devices can be attached only to root bus."); -+ return -1; -+ } -+ -+ QLIST_FOREACH(bus, &bus->child, sibling) { -+ if (pci_bus_num(bus) == pxb_bus_num) { -+ error_report("Bus %d is already in use.", pxb_bus_num); -+ return -1; -+ } -+ } -+ QLIST_INSERT_HEAD(&dev->bus->child, pxb_bus, sibling); -+ -+ return 0; -+} -+ -+static int pxb_dev_initfn(PCIDevice *dev) -+{ -+ PXBDev *pxb = PXB_DEV(dev); -+ DeviceState *ds, *bds; -+ PCIBus *bus; -+ const char *dev_name = NULL; -+ -+ if (dev->qdev.id && *dev->qdev.id) { -+ dev_name = dev->qdev.id; -+ } -+ -+ ds = qdev_create(NULL, TYPE_PXB_HOST); -+ bus = pci_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS); -+ -+ bus->parent_dev = dev; -+ bus->address_space_mem = dev->bus->address_space_mem; -+ bus->address_space_io = dev->bus->address_space_io; -+ bus->map_irq = pci_swizzle_map_irq_fn; -+ -+ bds = qdev_create(BUS(bus), "pci-bridge"); -+ bds->id = dev_name; -+ qdev_prop_set_uint8(bds, "chassis_nr", pxb->bus_nr); -+ -+ PCI_HOST_BRIDGE(ds)->bus = bus; -+ -+ if (pxb_register_bus(dev, bus)) { -+ return -EINVAL; -+ } -+ -+ qdev_init_nofail(ds); -+ qdev_init_nofail(bds); -+ -+ pci_word_test_and_set_mask(dev->config + PCI_STATUS, -+ PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); -+ pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_HOST); -+ -+ return 0; -+} -+ -+static Property pxb_dev_properties[] = { -+ /* Note: 0 is not a legal a PXB bus number. */ -+ DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0), -+ DEFINE_PROP_END_OF_LIST(), -+}; -+ -+static void pxb_dev_class_init(ObjectClass *klass, void *data) -+{ -+ DeviceClass *dc = DEVICE_CLASS(klass); -+ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); -+ -+ k->init = pxb_dev_initfn; -+ k->vendor_id = PCI_VENDOR_ID_REDHAT; -+ k->device_id = PCI_DEVICE_ID_REDHAT_PXB; -+ k->class_id = PCI_CLASS_BRIDGE_HOST; -+ -+ dc->desc = "PCI Expander Bridge"; -+ dc->props = pxb_dev_properties; -+} -+ -+static const TypeInfo pxb_dev_info = { -+ .name = TYPE_PXB_DEVICE, -+ .parent = TYPE_PCI_DEVICE, -+ .instance_size = sizeof(PXBDev), -+ .class_init = pxb_dev_class_init, -+}; -+ -+static void pxb_register_types(void) -+{ -+ type_register_static(&pxb_bus_info); -+ type_register_static(&pxb_host_info); -+ type_register_static(&pxb_dev_info); -+} -+ -+type_init(pxb_register_types) -diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h -index 9586b73..3d1d3ea 100644 ---- a/include/hw/pci/pci.h -+++ b/include/hw/pci/pci.h -@@ -90,6 +90,7 @@ - #define PCI_DEVICE_ID_REDHAT_TEST 0x0005 - #define PCI_DEVICE_ID_REDHAT_SDHCI 0x0007 - #define PCI_DEVICE_ID_REDHAT_PCIE_HOST 0x0008 -+#define PCI_DEVICE_ID_REDHAT_PXB 0x0009 - #define PCI_DEVICE_ID_REDHAT_QXL 0x0100 - - #define FMT_PCIBUS PRIx64 --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-made-pci_bus_is_root-a-PCIBusClass-method.patch b/SOURCES/kvm-hw-pci-made-pci_bus_is_root-a-PCIBusClass-method.patch deleted file mode 100644 index ebf3059..0000000 --- a/SOURCES/kvm-hw-pci-made-pci_bus_is_root-a-PCIBusClass-method.patch +++ /dev/null @@ -1,134 +0,0 @@ -From bd982251e824539e57ad77b0474f9b1f4c8197ed Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:21 +0200 -Subject: [PATCH 198/217] hw/pci: made pci_bus_is_root a PCIBusClass method - -Message-id: <1435154016-26233-29-git-send-email-marcel@redhat.com> -Patchwork-id: 66455 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 28/43] hw/pci: made pci_bus_is_root a PCIBusClass method -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Marcel Apfelbaum <marcel.a@redhat.com> - -Refactoring it as a method of PCIBusClass will allow -different implementations for subclasses. - -Removed the assumption that the root bus does not -have a parent device because is specific only -to the default class implementation. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit ce6a28ee057da3e4a587dada369e33a8486b0066) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 17 ++++++++++++++--- - include/hw/pci/pci.h | 2 ++ - include/hw/pci/pci_bus.h | 8 ++++++++ - 3 files changed, 24 insertions(+), 3 deletions(-) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index b51f229..a77871b 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -88,9 +88,15 @@ static void pci_bus_unrealize(BusState *qbus, Error **errp) - vmstate_unregister(NULL, &vmstate_pcibus, bus); - } - -+static bool pcibus_is_root(PCIBus *bus) -+{ -+ return !bus->parent_dev; -+} -+ - static void pci_bus_class_init(ObjectClass *klass, void *data) - { - BusClass *k = BUS_CLASS(klass); -+ PCIBusClass *pbc = PCI_BUS_CLASS(klass); - - k->print_dev = pcibus_dev_print; - k->get_dev_path = pcibus_get_dev_path; -@@ -98,12 +104,15 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) - k->realize = pci_bus_realize; - k->unrealize = pci_bus_unrealize; - k->reset = pcibus_reset; -+ -+ pbc->is_root = pcibus_is_root; - } - - static const TypeInfo pci_bus_info = { - .name = TYPE_PCI_BUS, - .parent = TYPE_BUS, - .instance_size = sizeof(PCIBus), -+ .class_size = sizeof(PCIBusClass), - .class_init = pci_bus_class_init, - }; - -@@ -278,7 +287,10 @@ PCIBus *pci_device_root_bus(const PCIDevice *d) - { - PCIBus *bus = d->bus; - -- while ((d = bus->parent_dev) != NULL) { -+ while (!pci_bus_is_root(bus)) { -+ d = bus->parent_dev; -+ assert(d != NULL); -+ - bus = d->bus; - } - -@@ -291,7 +303,6 @@ const char *pci_root_bus_path(PCIDevice *dev) - PCIHostState *host_bridge = PCI_HOST_BRIDGE(rootbus->qbus.parent); - PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_GET_CLASS(host_bridge); - -- assert(!rootbus->parent_dev); - assert(host_bridge->bus == rootbus); - - if (hc->root_bus_path) { -@@ -325,7 +336,7 @@ bool pci_bus_is_express(PCIBus *bus) - - bool pci_bus_is_root(PCIBus *bus) - { -- return !bus->parent_dev; -+ return PCI_BUS_GET_CLASS(bus)->is_root(bus); - } - - void pci_bus_new_inplace(PCIBus *bus, size_t bus_size, DeviceState *parent, -diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h -index 8558d6e..9586b73 100644 ---- a/include/hw/pci/pci.h -+++ b/include/hw/pci/pci.h -@@ -345,6 +345,8 @@ typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin); - - #define TYPE_PCI_BUS "PCI" - #define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS) -+#define PCI_BUS_CLASS(klass) OBJECT_CLASS_CHECK(PCIBusClass, (klass), TYPE_PCI_BUS) -+#define PCI_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(PCIBusClass, (obj), TYPE_PCI_BUS) - #define TYPE_PCIE_BUS "PCIE" - - bool pci_bus_is_express(PCIBus *bus); -diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h -index fabaeee..b5ba9c4 100644 ---- a/include/hw/pci/pci_bus.h -+++ b/include/hw/pci/pci_bus.h -@@ -8,6 +8,14 @@ - * use accessor functions in pci.h, pci_bridge.h - */ - -+typedef struct PCIBusClass { -+ /*< private >*/ -+ BusClass parent_class; -+ /*< public >*/ -+ -+ bool (*is_root)(PCIBus *bus); -+} PCIBusClass; -+ - struct PCIBus { - BusState qbus; - PCIIOMMUFunc iommu_fn; --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-made-pci_bus_num-a-PCIBusClass-method.patch b/SOURCES/kvm-hw-pci-made-pci_bus_num-a-PCIBusClass-method.patch deleted file mode 100644 index 35d3262..0000000 --- a/SOURCES/kvm-hw-pci-made-pci_bus_num-a-PCIBusClass-method.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 5b63d9216afcd782328b981c89c8c2cea468a2f8 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:22 +0200 -Subject: [PATCH 199/217] hw/pci: made pci_bus_num a PCIBusClass method - -Message-id: <1435154016-26233-30-git-send-email-marcel@redhat.com> -Patchwork-id: 66459 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 29/43] hw/pci: made pci_bus_num a PCIBusClass method -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Marcel Apfelbaum <marcel.a@redhat.com> - -Refactoring it as a method of PCIBusClass will allow -different implementations for subclasses. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 602141d9974d726063907851528c89d617730156) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 13 ++++++++++--- - include/hw/pci/pci_bus.h | 1 + - 2 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index a77871b..ca6a708 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -93,6 +93,14 @@ static bool pcibus_is_root(PCIBus *bus) - return !bus->parent_dev; - } - -+static int pcibus_num(PCIBus *bus) -+{ -+ if (pcibus_is_root(bus)) { -+ return 0; /* pci host bridge */ -+ } -+ return bus->parent_dev->config[PCI_SECONDARY_BUS]; -+} -+ - static void pci_bus_class_init(ObjectClass *klass, void *data) - { - BusClass *k = BUS_CLASS(klass); -@@ -106,6 +114,7 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) - k->reset = pcibus_reset; - - pbc->is_root = pcibus_is_root; -+ pbc->bus_num = pcibus_num; - } - - static const TypeInfo pci_bus_info = { -@@ -390,9 +399,7 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name, - - int pci_bus_num(PCIBus *s) - { -- if (pci_bus_is_root(s)) -- return 0; /* pci host bridge */ -- return s->parent_dev->config[PCI_SECONDARY_BUS]; -+ return PCI_BUS_GET_CLASS(s)->bus_num(s); - } - - static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) -diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h -index b5ba9c4..7b9939e 100644 ---- a/include/hw/pci/pci_bus.h -+++ b/include/hw/pci/pci_bus.h -@@ -14,6 +14,7 @@ typedef struct PCIBusClass { - /*< public >*/ - - bool (*is_root)(PCIBus *bus); -+ int (*bus_num)(PCIBus *bus); - } PCIBusClass; - - struct PCIBus { --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pci-removed-rootbus-nr-is-0-assumption-from-qmp_p.patch b/SOURCES/kvm-hw-pci-removed-rootbus-nr-is-0-assumption-from-qmp_p.patch deleted file mode 100644 index 87ce95c..0000000 --- a/SOURCES/kvm-hw-pci-removed-rootbus-nr-is-0-assumption-from-qmp_p.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c95a6ddb7307f4ed5cb9cad28086af271cd88033 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:29 +0200 -Subject: [PATCH 206/217] hw/pci: removed 'rootbus nr is 0' assumption from - qmp_pci_query - -Message-id: <1435154016-26233-37-git-send-email-marcel@redhat.com> -Patchwork-id: 66465 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 36/43] hw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Marcel Apfelbaum <marcel.a@redhat.com> - -Use the newer pci_bus_num to correctly get the root bus number. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit cb2ed8b3c66284f226c523231e2c09e60bbb34bb) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index 38a9cb4..a5598fa 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -1594,7 +1594,8 @@ PciInfoList *qmp_query_pci(Error **errp) - - QLIST_FOREACH(host_bridge, &pci_host_bridges, next) { - info = g_malloc0(sizeof(*info)); -- info->value = qmp_query_pci_bus(host_bridge->bus, 0); -+ info->value = qmp_query_pci_bus(host_bridge->bus, -+ pci_bus_num(host_bridge->bus)); - - /* XXX: waiting for the qapi to support GSList */ - if (!cur_item) { --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pxb-add-map_irq-func.patch b/SOURCES/kvm-hw-pxb-add-map_irq-func.patch deleted file mode 100644 index a53268b..0000000 --- a/SOURCES/kvm-hw-pxb-add-map_irq-func.patch +++ /dev/null @@ -1,73 +0,0 @@ -From db0cb5681d34f0d78ae417a786ebdc0c4785fa03 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:32 +0200 -Subject: [PATCH 209/217] hw/pxb: add map_irq func - -Message-id: <1435154016-26233-40-git-send-email-marcel@redhat.com> -Patchwork-id: 66467 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 39/43] hw/pxb: add map_irq func -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -The bios does not index the pxb slot number when -it computes the IRQ because it resides on bus 0 -and not on the current bus. -However Qemu routes the irq through bus 0 and adds -the pxb slot to the IRQ computation of the PXB device. - -Synchronize between bios and Qemu by canceling -pxb's effect. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 0639b00d055b313930c23c4d6c9ebfb4af61c00c) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci-bridge/pci_expander_bridge.c | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) - -diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c -index 88e85c1..8660a00 100644 ---- a/hw/pci-bridge/pci_expander_bridge.c -+++ b/hw/pci-bridge/pci_expander_bridge.c -@@ -120,6 +120,24 @@ static int pxb_register_bus(PCIDevice *dev, PCIBus *pxb_bus) - return 0; - } - -+static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin) -+{ -+ PCIDevice *pxb = pci_dev->bus->parent_dev; -+ -+ /* -+ * The bios does not index the pxb slot number when -+ * it computes the IRQ because it resides on bus 0 -+ * and not on the current bus. -+ * However QEMU routes the irq through bus 0 and adds -+ * the pxb slot to the IRQ computation of the PXB -+ * device. -+ * -+ * Synchronize between bios and QEMU by canceling -+ * pxb's effect. -+ */ -+ return pin - PCI_SLOT(pxb->devfn); -+} -+ - static int pxb_dev_initfn(PCIDevice *dev) - { - PXBDev *pxb = PXB_DEV(dev); -@@ -137,7 +155,7 @@ static int pxb_dev_initfn(PCIDevice *dev) - bus->parent_dev = dev; - bus->address_space_mem = dev->bus->address_space_mem; - bus->address_space_io = dev->bus->address_space_io; -- bus->map_irq = pci_swizzle_map_irq_fn; -+ bus->map_irq = pxb_map_irq_fn; - - bds = qdev_create(BUS(bus), "pci-bridge"); - bds->id = dev_name; --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-pxb-add-numa_node-parameter.patch b/SOURCES/kvm-hw-pxb-add-numa_node-parameter.patch deleted file mode 100644 index 8c94c79..0000000 --- a/SOURCES/kvm-hw-pxb-add-numa_node-parameter.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 5d4345682203150694d4f2d8f8770439fa17b154 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:53:34 +0200 -Subject: [PATCH 211/217] hw/pxb: add numa_node parameter - -Message-id: <1435154016-26233-42-git-send-email-marcel@redhat.com> -Patchwork-id: 66469 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 41/43] hw/pxb: add numa_node parameter -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -The pxb can be attach to and existing numa node by specifying -numa_node option that equals the desired numa nodeid. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Acked-by: Laszlo Ersek <lersek@redhat.com> -(cherry picked from commit 0e79e51a7dcbd4fde5738d713b60f0fb0321f1af) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 6 ++++++ - hw/pci-bridge/pci_expander_bridge.c | 17 +++++++++++++++++ - 2 files changed, 23 insertions(+) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index de2aea0..dbd0d8d 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -900,6 +900,7 @@ build_ssdt(GArray *table_data, GArray *linker, - if (bus) { - QLIST_FOREACH(bus, &bus->child, sibling) { - uint8_t bus_num = pci_bus_num(bus); -+ uint8_t numa_node = pci_bus_numa_node(bus); - - /* look only for expander root buses */ - if (!pci_bus_is_root(bus)) { -@@ -916,6 +917,11 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_name_decl("_UID", aml_string("PC%.02X", bus_num))); - aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A03"))); - aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); -+ -+ if (numa_node != NUMA_NODE_UNASSIGNED) { -+ aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node))); -+ } -+ - aml_append(dev, build_prt()); - crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent), - io_ranges, mem_ranges); -diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c -index 8660a00..ec2bb45 100644 ---- a/hw/pci-bridge/pci_expander_bridge.c -+++ b/hw/pci-bridge/pci_expander_bridge.c -@@ -17,6 +17,7 @@ - #include "hw/i386/pc.h" - #include "qemu/range.h" - #include "qemu/error-report.h" -+#include "sysemu/numa.h" - - #define TYPE_PXB_BUS "pxb-bus" - #define PXB_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_BUS) -@@ -38,6 +39,7 @@ typedef struct PXBDev { - /*< public >*/ - - uint8_t bus_nr; -+ uint16_t numa_node; - } PXBDev; - - #define TYPE_PXB_HOST "pxb-host" -@@ -54,12 +56,20 @@ static bool pxb_is_root(PCIBus *bus) - return true; /* by definition */ - } - -+static uint16_t pxb_bus_numa_node(PCIBus *bus) -+{ -+ PXBDev *pxb = PXB_DEV(bus->parent_dev); -+ -+ return pxb->numa_node; -+} -+ - static void pxb_bus_class_init(ObjectClass *class, void *data) - { - PCIBusClass *pbc = PCI_BUS_CLASS(class); - - pbc->bus_num = pxb_bus_num; - pbc->is_root = pxb_is_root; -+ pbc->numa_node = pxb_bus_numa_node; - } - - static const TypeInfo pxb_bus_info = { -@@ -145,6 +155,12 @@ static int pxb_dev_initfn(PCIDevice *dev) - PCIBus *bus; - const char *dev_name = NULL; - -+ if (pxb->numa_node != NUMA_NODE_UNASSIGNED && -+ pxb->numa_node >= nb_numa_nodes) { -+ error_report("Illegal numa node %d.", pxb->numa_node); -+ return -EINVAL; -+ } -+ - if (dev->qdev.id && *dev->qdev.id) { - dev_name = dev->qdev.id; - } -@@ -180,6 +196,7 @@ static int pxb_dev_initfn(PCIDevice *dev) - static Property pxb_dev_properties[] = { - /* Note: 0 is not a legal a PXB bus number. */ - DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0), -+ DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED), - DEFINE_PROP_END_OF_LIST(), - }; - --- -1.8.3.1 - diff --git a/SOURCES/kvm-hw-q35-fix-floppy-controller-definition-in-ich9.patch b/SOURCES/kvm-hw-q35-fix-floppy-controller-definition-in-ich9.patch deleted file mode 100644 index 24cb561..0000000 --- a/SOURCES/kvm-hw-q35-fix-floppy-controller-definition-in-ich9.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 061fd9ab852225e36bd10e5452e36cbdefc933c0 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Thu, 25 Jun 2015 16:06:42 +0200 -Subject: [PATCH 084/217] hw/q35: fix floppy controller definition in ich9 - -Message-id: <1435248402-13780-1-git-send-email-marcel@redhat.com> -Patchwork-id: 66495 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH] hw/q35: fix floppy controller definition in ich9 -Bugzilla: 894956 -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -BZ: https://bugzilla.redhat.com/show_bug.cgi?id=894956 -Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=9422573 -Upstream: 557772f26b361ade84acecb366fe6fdd2d55a6d9 - -git-backport-diff: -001/1:[----] [--] 'hw/q35: fix floppy controller definition in ich9' - -In DSDT FDC0 declares the IO region as IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04). -Use the same in lpc_ich9 initialization code. -Now the floppy drive is detected correctly on Windows. - -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 557772f26b361ade84acecb366fe6fdd2d55a6d9) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/isa/lpc_ich9.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c -index dba7585..bc9afc6 100644 ---- a/hw/isa/lpc_ich9.c -+++ b/hw/isa/lpc_ich9.c -@@ -494,7 +494,7 @@ static void ich9_lpc_machine_ready(Notifier *n, void *opaque) - /* lpt */ - pci_conf[0x82] |= 0x04; - } -- if (memory_region_present(io_as, 0x3f0)) { -+ if (memory_region_present(io_as, 0x3f2)) { - /* floppy */ - pci_conf[0x82] |= 0x08; - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-i8254-fix-out-of-bounds-memory-access-in-pit_ioport_.patch b/SOURCES/kvm-i8254-fix-out-of-bounds-memory-access-in-pit_ioport_.patch deleted file mode 100644 index 12c80c1..0000000 --- a/SOURCES/kvm-i8254-fix-out-of-bounds-memory-access-in-pit_ioport_.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 5e6ee62a1c466c14723316a0e151c1792ccebf4b Mon Sep 17 00:00:00 2001 -From: Petr Matousek <pmatouse@redhat.com> -Date: Thu, 25 Jun 2015 12:52:25 +0200 -Subject: [PATCH 083/217] i8254: fix out-of-bounds memory access in - pit_ioport_read() - -Message-id: <20150625125225.GK18896@dhcp-25-225.brq.redhat.com> -Patchwork-id: 66479 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH] i8254: fix out-of-bounds memory access in pit_ioport_read() -Bugzilla: 1229647 -RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -RH-Acked-by: Markus Armbruster <armbru@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Upstream: d4862a87e31a51de9eb260f25c9e99a75efe3235 - -Due converting PIO to the new memory read/write api we no longer provide -separate I/O region lenghts for read and write operations. As a result, -reading from PIT Mode/Command register will end with accessing -pit->channels with invalid index. - -Fix this by ignoring read from the Mode/Command register. - -This is CVE-2015-3214. - -Reported-by: Matt Tait <matttait@google.com> -Fixes: 0505bcdec8228d8de39ab1a02644e71999e7c052 -Cc: qemu-stable@nongnu.org -Signed-off-by: Petr Matousek <pmatouse@redhat.com> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> - -Signed-off-by: Petr Matousek <pmatouse@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/timer/i8254.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c -index 3450c98..9b65a33 100644 ---- a/hw/timer/i8254.c -+++ b/hw/timer/i8254.c -@@ -196,6 +196,12 @@ static uint64_t pit_ioport_read(void *opaque, hwaddr addr, - PITChannelState *s; - - addr &= 3; -+ -+ if (addr == 3) { -+ /* Mode/Command register is write only, read is ignored */ -+ return 0; -+ } -+ - s = &pit->channels[addr]; - if (s->status_latched) { - s->status_latched = 0; --- -1.8.3.1 - diff --git a/SOURCES/kvm-iotests-qcow2-COW-with-minimal-L2-cache-size.patch b/SOURCES/kvm-iotests-qcow2-COW-with-minimal-L2-cache-size.patch deleted file mode 100644 index dbfff08..0000000 --- a/SOURCES/kvm-iotests-qcow2-COW-with-minimal-L2-cache-size.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 292fd30c299230aa76a13395a8771ac554c76ffc Mon Sep 17 00:00:00 2001 -From: Max Reitz <mreitz@redhat.com> -Date: Wed, 17 Jun 2015 12:42:55 +0200 -Subject: [PATCH 013/217] iotests: qcow2 COW with minimal L2 cache size - -Message-id: <1434544976-15816-3-git-send-email-mreitz@redhat.com> -Patchwork-id: 66282 -O-Subject: [RHEV-7.2 qemu-kvm-rhev PATCH 2/3] iotests: qcow2 COW with minimal L2 cache size -Bugzilla: 1226996 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Kevin Wolf <kwolf@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -BZ: 1226996 - -This adds a test case to test 103 for performing a COW operation in a -qcow2 image using an L2 cache with minimal size (which should be at -least two clusters so the COW can access both source and destination -simultaneously). - -Signed-off-by: Max Reitz <mreitz@redhat.com> -Reviewed-by: Alberto Garcia <berto@igalia.com> -Signed-off-by: Kevin Wolf <kwolf@redhat.com> -(cherry picked from commit a4291eafc597c0944057930acf3e51d899f79c2e) - -Signed-off-by: Max Reitz <mreitz@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - tests/qemu-iotests/103 | 10 ++++++++++ - tests/qemu-iotests/103.out | 5 +++++ - 2 files changed, 15 insertions(+) - -diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103 -index ccab551..fa9a3c1 100755 ---- a/tests/qemu-iotests/103 -+++ b/tests/qemu-iotests/103 -@@ -93,6 +93,16 @@ $QEMU_IO -c "open -o l2-cache-size=1M,refcount-cache-size=0.25M $TEST_IMG" \ - -c 'read -P 42 0 64k' \ - | _filter_qemu_io - -+echo -+echo '=== Testing minimal L2 cache and COW ===' -+echo -+ -+$QEMU_IMG snapshot -c foo "$TEST_IMG" -+# This requires a COW operation, which accesses two L2 tables simultaneously -+# (COW source and destination), so there must be enough space in the cache to -+# place both tables there (and qemu should not crash) -+$QEMU_IO -c "open -o cache-size=0 $TEST_IMG" -c 'write 0 64k' | _filter_qemu_io -+ - # success, all done - echo '*** done' - rm -f $seq.full -diff --git a/tests/qemu-iotests/103.out b/tests/qemu-iotests/103.out -index ee705b0..d05f49f 100644 ---- a/tests/qemu-iotests/103.out -+++ b/tests/qemu-iotests/103.out -@@ -26,4 +26,9 @@ read 65536/65536 bytes at offset 0 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - read 65536/65536 bytes at offset 0 - 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+=== Testing minimal L2 cache and COW === -+ -+wrote 65536/65536 bytes at offset 0 -+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - *** done --- -1.8.3.1 - diff --git a/SOURCES/kvm-ivshmem-RHEL-only-explicitly-remove-dead-code.patch b/SOURCES/kvm-ivshmem-RHEL-only-explicitly-remove-dead-code.patch deleted file mode 100644 index f2ef1d2..0000000 --- a/SOURCES/kvm-ivshmem-RHEL-only-explicitly-remove-dead-code.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 5f6d95444a4083c3db22aa9528fb4699a180ea11 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Thu, 18 Sep 2014 23:49:30 +0200 -Subject: ivshmem: RHEL-only: explicitly remove dead code - -Message-id: <1411084171-28836-4-git-send-email-drjones@redhat.com> -Patchwork-id: 61304 -O-Subject: [PATCH RHEV-7.1 qemu-kvm-rhev 3/4] ivshmem: RHEL-only: explicitly remove dead code -Bugzilla: 1104063 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -This patch has no functional change, as it simply #if 0's out -code that was already made dead with the last patch. - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c -index 1b574ad..482eca7 100644 ---- a/hw/misc/ivshmem.c -+++ b/hw/misc/ivshmem.c -@@ -123,6 +123,7 @@ static inline bool is_power_of_two(uint64_t x) { - return (x & (x - 1)) == 0; - } - -+#if 0 - /* accessing registers - based on rtl8139 */ - static void ivshmem_update_irq(IVShmemState *s, int val) - { -@@ -177,14 +178,17 @@ static uint32_t ivshmem_IntrStatus_read(IVShmemState *s) - - return ret; - } -+#endif - - static void ivshmem_io_write(void *opaque, hwaddr addr, - uint64_t val, unsigned size) - { -+#if 0 - IVShmemState *s = opaque; - - uint16_t dest = val >> 16; - uint16_t vector = val & 0xff; -+#endif - - #if 1 /* Ignore writes for Red Hat Enterprise Linux */ - static bool complained = false; -@@ -193,7 +197,7 @@ static void ivshmem_io_write(void *opaque, hwaddr addr, - complained = true; - } - return; --#endif -+#else - - addr &= 0xfc; - -@@ -224,14 +228,17 @@ static void ivshmem_io_write(void *opaque, hwaddr addr, - default: - IVSHMEM_DPRINTF("Invalid VM Doorbell VM %d\n", dest); - } -+#endif - } - - static uint64_t ivshmem_io_read(void *opaque, hwaddr addr, - unsigned size) - { - -+#if 0 - IVShmemState *s = opaque; - uint32_t ret; -+#endif - - #if 1 /* Always read zero for Red Hat Enterprise Linux */ - static bool complained = false; -@@ -240,7 +247,7 @@ static uint64_t ivshmem_io_read(void *opaque, hwaddr addr, - complained = true; - } - return 0; --#endif -+#else - - switch (addr) - { -@@ -267,6 +274,7 @@ static uint64_t ivshmem_io_read(void *opaque, hwaddr addr, - } - - return ret; -+#endif - } - - static const MemoryRegionOps ivshmem_mmio_ops = { -@@ -279,6 +287,7 @@ static const MemoryRegionOps ivshmem_mmio_ops = { - }, - }; - -+#if 0 - static void ivshmem_receive(void *opaque, const uint8_t *buf, int size) - { - IVShmemState *s = opaque; -@@ -338,6 +347,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * - return chr; - - } -+#endif - - static int check_shm_size(IVShmemState *s, int fd) { - /* check that the guest isn't going to try and map more memory than the -@@ -380,6 +390,7 @@ static void create_shared_memory_BAR(IVShmemState *s, int fd) { - pci_register_bar(PCI_DEVICE(s), 2, s->ivshmem_attr, &s->bar); - } - -+#if 0 - static void ivshmem_add_eventfd(IVShmemState *s, int posn, int i) - { - memory_region_add_eventfd(&s->ivshmem_mmio, -@@ -594,6 +605,7 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size) - ivshmem_add_eventfd(s, incoming_posn, guest_max_eventfd); - } - } -+#endif - - /* Select the MSI-X vectors used by device. - * ivshmem maps events to vectors statically, so -@@ -647,6 +659,7 @@ static uint64_t ivshmem_get_size(IVShmemState * s) { - return value; - } - -+#if 0 - static void ivshmem_setup_msi(IVShmemState * s) - { - if (msix_init_exclusive_bar(PCI_DEVICE(s), s->vectors, 1)) { -@@ -661,6 +674,7 @@ static void ivshmem_setup_msi(IVShmemState * s) - - ivshmem_use_msix(s); - } -+#endif - - static void ivshmem_save(QEMUFile* f, void *opaque) - { -@@ -684,8 +698,10 @@ static int ivshmem_load(QEMUFile* f, void *opaque, int version_id) - IVSHMEM_DPRINTF("ivshmem_load\n"); - - IVShmemState *proxy = opaque; -+#if 0 - PCIDevice *pci_dev = PCI_DEVICE(proxy); - int ret; -+#endif - - if (version_id > 0) { - return -EINVAL; -@@ -696,6 +712,7 @@ static int ivshmem_load(QEMUFile* f, void *opaque, int version_id) - return -EINVAL; - } - -+#if 0 - ret = pci_device_load(pci_dev, f); - if (ret) { - return ret; -@@ -709,6 +726,7 @@ static int ivshmem_load(QEMUFile* f, void *opaque, int version_id) - proxy->intrmask = qemu_get_be32(f); - } - -+#endif - return 0; - } - -@@ -735,12 +753,14 @@ static int pci_ivshmem_init(PCIDevice *dev) - register_savevm(DEVICE(dev), "ivshmem", 0, 0, ivshmem_save, ivshmem_load, - dev); - -+#if 0 - /* IRQFD requires MSI */ - if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD) && - !ivshmem_has_feature(s, IVSHMEM_MSI)) { - error_report("ioeventfd/irqfd requires MSI"); - exit(1); - } -+#endif - - /* check that role is reasonable */ - if (s->role) { -@@ -790,6 +810,7 @@ static int pci_ivshmem_init(PCIDevice *dev) - s->ivshmem_attr |= PCI_BASE_ADDRESS_MEM_TYPE_64; - } - -+#if 0 - if ((s->server_chr != NULL) && - (strncmp(s->server_chr->filename, "unix:", 5) == 0)) { - /* if we get a UNIX socket as the parameter we will talk -@@ -821,6 +842,8 @@ static int pci_ivshmem_init(PCIDevice *dev) - qemu_chr_add_handlers(s->server_chr, ivshmem_can_receive, ivshmem_read, - ivshmem_event, s); - } else { -+#endif -+ { - /* just map the file immediately, we're not using a server */ - int fd; - diff --git a/SOURCES/kvm-ivshmem-RHEL-only-remove-unsupported-code.patch b/SOURCES/kvm-ivshmem-RHEL-only-remove-unsupported-code.patch deleted file mode 100644 index dd3e26f..0000000 --- a/SOURCES/kvm-ivshmem-RHEL-only-remove-unsupported-code.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 1219d52595e3321acdaf800ae6f0316bb8e95df1 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Thu, 18 Sep 2014 23:49:29 +0200 -Subject: ivshmem: RHEL-only: remove unsupported code - -Message-id: <1411084171-28836-3-git-send-email-drjones@redhat.com> -Patchwork-id: 61305 -O-Subject: [PATCH RHEV-7.1 qemu-kvm-rhev 2/4] ivshmem: RHEL-only: remove unsupported code -Bugzilla: 1104063 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -The objective here is to strip the device down to the bare minimum -needed for supporting memnic. Removing properties goes a long way -in creating deadcode, but a couple additional #if's were needed -as well to kill bar0's interrupt support, and to ensure role -'peer' is always selected (we want ivshmem to always disable -migration). - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c -index 5d272c8..1b574ad 100644 ---- a/hw/misc/ivshmem.c -+++ b/hw/misc/ivshmem.c -@@ -186,6 +186,15 @@ static void ivshmem_io_write(void *opaque, hwaddr addr, - uint16_t dest = val >> 16; - uint16_t vector = val & 0xff; - -+#if 1 /* Ignore writes for Red Hat Enterprise Linux */ -+ static bool complained = false; -+ if (!complained) { -+ error_report("Red Hat: %s: ivshmem interrupts are disabled", __func__); -+ complained = true; -+ } -+ return; -+#endif -+ - addr &= 0xfc; - - IVSHMEM_DPRINTF("writing to addr " TARGET_FMT_plx "\n", addr); -@@ -224,6 +233,15 @@ static uint64_t ivshmem_io_read(void *opaque, hwaddr addr, - IVShmemState *s = opaque; - uint32_t ret; - -+#if 1 /* Always read zero for Red Hat Enterprise Linux */ -+ static bool complained = false; -+ if (!complained) { -+ error_report("Red Hat: %s: ivshmem interrupts are disabled", __func__); -+ complained = true; -+ } -+ return 0; -+#endif -+ - switch (addr) - { - case INTRMASK: -@@ -728,6 +746,7 @@ static int pci_ivshmem_init(PCIDevice *dev) - if (s->role) { - if (strncmp(s->role, "peer", 5) == 0) { - s->role_val = IVSHMEM_PEER; -+#if 0 /* Red Hat Enterprise Linux requires role=peer */ - } else if (strncmp(s->role, "master", 7) == 0) { - s->role_val = IVSHMEM_MASTER; - } else { -@@ -736,6 +755,12 @@ static int pci_ivshmem_init(PCIDevice *dev) - } - } else { - s->role_val = IVSHMEM_MASTER; /* default */ -+#else -+ } else { -+ error_report("Red Hat: 'role' must be specified, and set to 'peer'"); -+ exit(1); -+ } -+#endif - } - - if (s->role_val == IVSHMEM_PEER) { -@@ -800,7 +825,11 @@ static int pci_ivshmem_init(PCIDevice *dev) - int fd; - - if (s->shmobj == NULL) { -+#if 0 /* Red Hat Enterprise Linux doesn't support 'chardev' */ - error_report("Must specify 'chardev' or 'shm' to ivshmem"); -+#else -+ error_report("Red Hat: 'shm' must be specified"); -+#endif - exit(1); - } - -@@ -851,11 +880,15 @@ static void pci_ivshmem_uninit(PCIDevice *dev) - } - - static Property ivshmem_properties[] = { -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - DEFINE_PROP_CHR("chardev", IVShmemState, server_chr), -+#endif - DEFINE_PROP_STRING("size", IVShmemState, sizearg), -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - DEFINE_PROP_UINT32("vectors", IVShmemState, vectors, 1), - DEFINE_PROP_BIT("ioeventfd", IVShmemState, features, IVSHMEM_IOEVENTFD, false), - DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true), -+#endif - DEFINE_PROP_STRING("shm", IVShmemState, shmobj), - DEFINE_PROP_STRING("role", IVShmemState, role), - DEFINE_PROP_UINT32("use64", IVShmemState, ivshmem_64bit, 1), diff --git a/SOURCES/kvm-kvm_stat-Add-RESET-support-for-perf-event-ioctl.patch b/SOURCES/kvm-kvm_stat-Add-RESET-support-for-perf-event-ioctl.patch deleted file mode 100644 index 9b95c89..0000000 --- a/SOURCES/kvm-kvm_stat-Add-RESET-support-for-perf-event-ioctl.patch +++ /dev/null @@ -1,52 +0,0 @@ -From e711121e3fcfeaf0a3a4fe9ef1007b01225f6c77 Mon Sep 17 00:00:00 2001 -From: "wei@redhat.com" <wei@redhat.com> -Date: Tue, 3 Feb 2015 19:51:06 +0100 -Subject: kvm_stat: Add RESET support for perf event ioctl - -Message-id: <1422993066-11422-4-git-send-email-wei@redhat.com> -Patchwork-id: 63715 -O-Subject: [qemu-kvm-rhev RHELSA PATCH V2 3/3] kvm_stat: Add RESET support for perf event ioctl -Bugzilla: 1184603 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> - -While running kvm_stat using tracepoint on ARM64 hardware (e.g. "kvm_stat --1 -t"), the initial values of some kvm_userspace_exit counters were found -to be very suspecious. For instance the tracing tool showed that S390_TSCH -was called many times on ARM64 machine, which apparently was wrong. It -turned out the the perf event counters need to be reset before use. - -This patch adds RESET ioctl support for perf monitoring. Before calling -ioctl to enable a perf event, this patch resets the counter first. With -this patch, the init counter values become correct on ARM64 hardware. - -NOTE: This patch is slightly different from the upstream commit -(fc116efad). I extended the upstream commit with a fix to PPC RESET ioctl -number, which has been submitted to upstream & queued for QEMU by Paolo. - -Example: - -==== before patch ==== -kvm_userspace_exit(S390_SIEIC) 1426 0 -kvm_userspace_exit(S390_TSCH) 339 0 - -==== after patch ==== -kvm_userspace_exit(S390_SIEIC) 0 0 -kvm_userspace_exit(S390_TSCH) 0 0 - -Signed-off-by: Wei Huang <wei@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat -index 7e5d256..68ac19e 100755 ---- a/scripts/kvm/kvm_stat -+++ b/scripts/kvm/kvm_stat -@@ -246,6 +246,7 @@ def ppc_init(): - 'SET_FILTER' : 0x80002406 | (ctypes.sizeof(ctypes.c_char_p) << 16), - 'ENABLE' : 0x20002400, - 'DISABLE' : 0x20002401, -+ 'RESET' : 0x20002403, - } - }) - diff --git a/SOURCES/kvm-linux-headers-add-virtio_pci.patch b/SOURCES/kvm-linux-headers-add-virtio_pci.patch deleted file mode 100644 index b2e1177..0000000 --- a/SOURCES/kvm-linux-headers-add-virtio_pci.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 774bb03d8a9cc8165a62d0f0bbb85995c6bf747d Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:37 +0200 -Subject: [PATCH 149/217] linux-headers: add virtio_pci - -Message-id: <1436260751-25015-35-git-send-email-jasowang@redhat.com> -Patchwork-id: 66809 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 34/68] linux-headers: add virtio_pci -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -Easier than duplicating code. - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit c17bef33601737e24a3d53259ddb6db28ac4d6d2) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 2 + - linux-headers/linux/virtio_pci.h | 192 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 194 insertions(+) - create mode 100644 linux-headers/linux/virtio_pci.h - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 1aa0e01..e32bb89 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -38,6 +38,8 @@ - - #define VIRTIO_PCI_REGION_SIZE(dev) VIRTIO_PCI_CONFIG_OFF(msix_present(dev)) - -+#undef VIRTIO_PCI_CONFIG -+ - /* The remaining space is defined by each driver as the per-driver - * configuration space */ - #define VIRTIO_PCI_CONFIG_SIZE(dev) VIRTIO_PCI_CONFIG_OFF(msix_enabled(dev)) -diff --git a/linux-headers/linux/virtio_pci.h b/linux-headers/linux/virtio_pci.h -new file mode 100644 -index 0000000..92624e5 ---- /dev/null -+++ b/linux-headers/linux/virtio_pci.h -@@ -0,0 +1,192 @@ -+/* -+ * Virtio PCI driver -+ * -+ * This module allows virtio devices to be used over a virtual PCI device. -+ * This can be used with QEMU based VMMs like KVM or Xen. -+ * -+ * Copyright IBM Corp. 2007 -+ * -+ * Authors: -+ * Anthony Liguori <aliguori@us.ibm.com> -+ * -+ * This header is BSD licensed so anyone can use the definitions to implement -+ * compatible drivers/servers. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. Neither the name of IBM nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE -+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+#ifndef _LINUX_VIRTIO_PCI_H -+#define _LINUX_VIRTIO_PCI_H -+ -+#include <linux/types.h> -+ -+#ifndef VIRTIO_PCI_NO_LEGACY -+ -+/* A 32-bit r/o bitmask of the features supported by the host */ -+#define VIRTIO_PCI_HOST_FEATURES 0 -+ -+/* A 32-bit r/w bitmask of features activated by the guest */ -+#define VIRTIO_PCI_GUEST_FEATURES 4 -+ -+/* A 32-bit r/w PFN for the currently selected queue */ -+#define VIRTIO_PCI_QUEUE_PFN 8 -+ -+/* A 16-bit r/o queue size for the currently selected queue */ -+#define VIRTIO_PCI_QUEUE_NUM 12 -+ -+/* A 16-bit r/w queue selector */ -+#define VIRTIO_PCI_QUEUE_SEL 14 -+ -+/* A 16-bit r/w queue notifier */ -+#define VIRTIO_PCI_QUEUE_NOTIFY 16 -+ -+/* An 8-bit device status register. */ -+#define VIRTIO_PCI_STATUS 18 -+ -+/* An 8-bit r/o interrupt status register. Reading the value will return the -+ * current contents of the ISR and will also clear it. This is effectively -+ * a read-and-acknowledge. */ -+#define VIRTIO_PCI_ISR 19 -+ -+/* MSI-X registers: only enabled if MSI-X is enabled. */ -+/* A 16-bit vector for configuration changes. */ -+#define VIRTIO_MSI_CONFIG_VECTOR 20 -+/* A 16-bit vector for selected queue notifications. */ -+#define VIRTIO_MSI_QUEUE_VECTOR 22 -+ -+/* The remaining space is defined by each driver as the per-driver -+ * configuration space */ -+#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20) -+/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */ -+#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled) -+ -+/* Virtio ABI version, this must match exactly */ -+#define VIRTIO_PCI_ABI_VERSION 0 -+ -+/* How many bits to shift physical queue address written to QUEUE_PFN. -+ * 12 is historical, and due to x86 page size. */ -+#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 -+ -+/* The alignment to use between consumer and producer parts of vring. -+ * x86 pagesize again. */ -+#define VIRTIO_PCI_VRING_ALIGN 4096 -+ -+#endif /* VIRTIO_PCI_NO_LEGACY */ -+ -+/* The bit of the ISR which indicates a device configuration change. */ -+#define VIRTIO_PCI_ISR_CONFIG 0x2 -+/* Vector value used to disable MSI for queue */ -+#define VIRTIO_MSI_NO_VECTOR 0xffff -+ -+#ifndef VIRTIO_PCI_NO_MODERN -+ -+/* IDs for different capabilities. Must all exist. */ -+ -+/* Common configuration */ -+#define VIRTIO_PCI_CAP_COMMON_CFG 1 -+/* Notifications */ -+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 -+/* ISR access */ -+#define VIRTIO_PCI_CAP_ISR_CFG 3 -+/* Device specific confiuration */ -+#define VIRTIO_PCI_CAP_DEVICE_CFG 4 -+ -+/* This is the PCI capability header: */ -+struct virtio_pci_cap { -+ __u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */ -+ __u8 cap_next; /* Generic PCI field: next ptr. */ -+ __u8 cap_len; /* Generic PCI field: capability length */ -+ __u8 cfg_type; /* Identifies the structure. */ -+ __u8 bar; /* Where to find it. */ -+ __u8 padding[3]; /* Pad to full dword. */ -+ __le32 offset; /* Offset within bar. */ -+ __le32 length; /* Length of the structure, in bytes. */ -+}; -+ -+struct virtio_pci_notify_cap { -+ struct virtio_pci_cap cap; -+ __le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */ -+}; -+ -+/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */ -+struct virtio_pci_common_cfg { -+ /* About the whole device. */ -+ __le32 device_feature_select; /* read-write */ -+ __le32 device_feature; /* read-only */ -+ __le32 guest_feature_select; /* read-write */ -+ __le32 guest_feature; /* read-write */ -+ __le16 msix_config; /* read-write */ -+ __le16 num_queues; /* read-only */ -+ __u8 device_status; /* read-write */ -+ __u8 config_generation; /* read-only */ -+ -+ /* About a specific virtqueue. */ -+ __le16 queue_select; /* read-write */ -+ __le16 queue_size; /* read-write, power of 2. */ -+ __le16 queue_msix_vector; /* read-write */ -+ __le16 queue_enable; /* read-write */ -+ __le16 queue_notify_off; /* read-only */ -+ __le32 queue_desc_lo; /* read-write */ -+ __le32 queue_desc_hi; /* read-write */ -+ __le32 queue_avail_lo; /* read-write */ -+ __le32 queue_avail_hi; /* read-write */ -+ __le32 queue_used_lo; /* read-write */ -+ __le32 queue_used_hi; /* read-write */ -+}; -+ -+/* Macro versions of offsets for the Old Timers! */ -+#define VIRTIO_PCI_CAP_VNDR 0 -+#define VIRTIO_PCI_CAP_NEXT 1 -+#define VIRTIO_PCI_CAP_LEN 2 -+#define VIRTIO_PCI_CAP_CFG_TYPE 3 -+#define VIRTIO_PCI_CAP_BAR 4 -+#define VIRTIO_PCI_CAP_OFFSET 8 -+#define VIRTIO_PCI_CAP_LENGTH 12 -+ -+#define VIRTIO_PCI_NOTIFY_CAP_MULT 16 -+ -+ -+#define VIRTIO_PCI_COMMON_DFSELECT 0 -+#define VIRTIO_PCI_COMMON_DF 4 -+#define VIRTIO_PCI_COMMON_GFSELECT 8 -+#define VIRTIO_PCI_COMMON_GF 12 -+#define VIRTIO_PCI_COMMON_MSIX 16 -+#define VIRTIO_PCI_COMMON_NUMQ 18 -+#define VIRTIO_PCI_COMMON_STATUS 20 -+#define VIRTIO_PCI_COMMON_CFGGENERATION 21 -+#define VIRTIO_PCI_COMMON_Q_SELECT 22 -+#define VIRTIO_PCI_COMMON_Q_SIZE 24 -+#define VIRTIO_PCI_COMMON_Q_MSIX 26 -+#define VIRTIO_PCI_COMMON_Q_ENABLE 28 -+#define VIRTIO_PCI_COMMON_Q_NOFF 30 -+#define VIRTIO_PCI_COMMON_Q_DESCLO 32 -+#define VIRTIO_PCI_COMMON_Q_DESCHI 36 -+#define VIRTIO_PCI_COMMON_Q_AVAILLO 40 -+#define VIRTIO_PCI_COMMON_Q_AVAILHI 44 -+#define VIRTIO_PCI_COMMON_Q_USEDLO 48 -+#define VIRTIO_PCI_COMMON_Q_USEDHI 52 -+ -+#endif /* VIRTIO_PCI_NO_MODERN */ -+ -+#endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-linux-headers-sync-vhost.h.patch b/SOURCES/kvm-linux-headers-sync-vhost.h.patch deleted file mode 100644 index 746dd3c..0000000 --- a/SOURCES/kvm-linux-headers-sync-vhost.h.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 3b9fbefcf010c79bfc226a8131b60487701f902e Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:33 +0200 -Subject: [PATCH 109/217] linux-headers: sync vhost.h - -Message-id: <1435950819-10991-2-git-send-email-thuth@redhat.com> -Patchwork-id: 66694 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 1/7] linux-headers: sync vhost.h -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Greg Kurz <gkurz@linux.vnet.ibm.com> - -This patch brings the cross-endian vhost API to QEMU. - -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 332f64073bddc9240cd572f64682a44572b67049) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - linux-headers/linux/vhost.h | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h -index c656f61..ead86db 100644 ---- a/linux-headers/linux/vhost.h -+++ b/linux-headers/linux/vhost.h -@@ -103,6 +103,20 @@ struct vhost_memory { - /* Get accessor: reads index, writes value in num */ - #define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state) - -+/* Set the vring byte order in num. Valid values are VHOST_VRING_LITTLE_ENDIAN -+ * or VHOST_VRING_BIG_ENDIAN (other values return -EINVAL). -+ * The byte order cannot be changed while the device is active: trying to do so -+ * returns -EBUSY. -+ * This is a legacy only API that is simply ignored when VIRTIO_F_VERSION_1 is -+ * set. -+ * Not all kernel configurations support this ioctl, but all configurations that -+ * support SET also support GET. -+ */ -+#define VHOST_VRING_LITTLE_ENDIAN 0 -+#define VHOST_VRING_BIG_ENDIAN 1 -+#define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state) -+#define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state) -+ - /* The following ioctls use eventfd file descriptors to signal and poll - * for events. */ - --- -1.8.3.1 - diff --git a/SOURCES/kvm-linux-headers-update.patch b/SOURCES/kvm-linux-headers-update.patch deleted file mode 100644 index 851b277..0000000 --- a/SOURCES/kvm-linux-headers-update.patch +++ /dev/null @@ -1,605 +0,0 @@ -From 0820baa25aa0edbc2f9f66ad44c737d2b952b38e Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:04 +0200 -Subject: [PATCH 116/217] linux-headers: update - -Message-id: <1436260751-25015-2-git-send-email-jasowang@redhat.com> -Patchwork-id: 66776 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 01/68] linux-headers: update -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -This updates linux-headers against master 4.1-rc1 (commit -b787f68c36d49bb1d9236f403813641efa74a031). - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -(cherry picked from commit 7a52ce8a160739c5d37469b0e344d3239eb86462) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/standard-headers/linux/virtio_balloon.h | 28 +++- - include/standard-headers/linux/virtio_ids.h | 1 + - include/standard-headers/linux/virtio_input.h | 76 +++++++++++ - linux-headers/asm-arm/kvm.h | 9 +- - linux-headers/asm-arm64/kvm.h | 9 +- - linux-headers/asm-mips/kvm.h | 164 +++++++++++++++--------- - linux-headers/asm-s390/kvm.h | 4 + - linux-headers/asm-x86/hyperv.h | 2 + - linux-headers/linux/kvm.h | 66 +++++++++- - linux-headers/linux/vfio.h | 2 + - 10 files changed, 293 insertions(+), 68 deletions(-) - create mode 100644 include/standard-headers/linux/virtio_input.h - -diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h -index 799376d..88ada1d 100644 ---- a/include/standard-headers/linux/virtio_balloon.h -+++ b/include/standard-headers/linux/virtio_balloon.h -@@ -25,6 +25,7 @@ - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. */ -+#include "standard-headers/linux/types.h" - #include "standard-headers/linux/virtio_ids.h" - #include "standard-headers/linux/virtio_config.h" - -@@ -51,9 +52,32 @@ struct virtio_balloon_config { - #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ - #define VIRTIO_BALLOON_S_NR 6 - -+/* -+ * Memory statistics structure. -+ * Driver fills an array of these structures and passes to device. -+ * -+ * NOTE: fields are laid out in a way that would make compiler add padding -+ * between and after fields, so we have to use compiler-specific attributes to -+ * pack it, to disable this padding. This also often causes compiler to -+ * generate suboptimal code. -+ * -+ * We maintain this statistics structure format for backwards compatibility, -+ * but don't follow this example. -+ * -+ * If implementing a similar structure, do something like the below instead: -+ * struct virtio_balloon_stat { -+ * __virtio16 tag; -+ * uint8_t reserved[6]; -+ * __virtio64 val; -+ * }; -+ * -+ * In other words, add explicit reserved fields to align field and -+ * structure boundaries at field size, avoiding compiler padding -+ * without the packed attribute. -+ */ - struct virtio_balloon_stat { -- uint16_t tag; -- uint64_t val; -+ __virtio16 tag; -+ __virtio64 val; - } QEMU_PACKED; - - #endif /* _LINUX_VIRTIO_BALLOON_H */ -diff --git a/include/standard-headers/linux/virtio_ids.h b/include/standard-headers/linux/virtio_ids.h -index 284fc3a..5f60aa4 100644 ---- a/include/standard-headers/linux/virtio_ids.h -+++ b/include/standard-headers/linux/virtio_ids.h -@@ -39,5 +39,6 @@ - #define VIRTIO_ID_9P 9 /* 9p virtio console */ - #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ - #define VIRTIO_ID_CAIF 12 /* Virtio caif */ -+#define VIRTIO_ID_INPUT 18 /* virtio input */ - - #endif /* _LINUX_VIRTIO_IDS_H */ -diff --git a/include/standard-headers/linux/virtio_input.h b/include/standard-headers/linux/virtio_input.h -new file mode 100644 -index 0000000..a98a797 ---- /dev/null -+++ b/include/standard-headers/linux/virtio_input.h -@@ -0,0 +1,76 @@ -+#ifndef _LINUX_VIRTIO_INPUT_H -+#define _LINUX_VIRTIO_INPUT_H -+/* This header is BSD licensed so anyone can use the definitions to implement -+ * compatible drivers/servers. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. Neither the name of IBM nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. */ -+ -+#include "standard-headers/linux/types.h" -+ -+enum virtio_input_config_select { -+ VIRTIO_INPUT_CFG_UNSET = 0x00, -+ VIRTIO_INPUT_CFG_ID_NAME = 0x01, -+ VIRTIO_INPUT_CFG_ID_SERIAL = 0x02, -+ VIRTIO_INPUT_CFG_ID_DEVIDS = 0x03, -+ VIRTIO_INPUT_CFG_PROP_BITS = 0x10, -+ VIRTIO_INPUT_CFG_EV_BITS = 0x11, -+ VIRTIO_INPUT_CFG_ABS_INFO = 0x12, -+}; -+ -+struct virtio_input_absinfo { -+ uint32_t min; -+ uint32_t max; -+ uint32_t fuzz; -+ uint32_t flat; -+ uint32_t res; -+}; -+ -+struct virtio_input_devids { -+ uint16_t bustype; -+ uint16_t vendor; -+ uint16_t product; -+ uint16_t version; -+}; -+ -+struct virtio_input_config { -+ uint8_t select; -+ uint8_t subsel; -+ uint8_t size; -+ uint8_t reserved[5]; -+ union { -+ char string[128]; -+ uint8_t bitmap[128]; -+ struct virtio_input_absinfo abs; -+ struct virtio_input_devids ids; -+ } u; -+}; -+ -+struct virtio_input_event { -+ uint16_t type; -+ uint16_t code; -+ uint32_t value; -+}; -+ -+#endif /* _LINUX_VIRTIO_INPUT_H */ -diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h -index 0db25bc..c98e4dc 100644 ---- a/linux-headers/asm-arm/kvm.h -+++ b/linux-headers/asm-arm/kvm.h -@@ -195,9 +195,16 @@ struct kvm_arch_memory_slot { - #define KVM_ARM_IRQ_CPU_IRQ 0 - #define KVM_ARM_IRQ_CPU_FIQ 1 - --/* Highest supported SPI, from VGIC_NR_IRQS */ -+/* -+ * This used to hold the highest supported SPI, but it is now obsolete -+ * and only here to provide source code level compatibility with older -+ * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. -+ */ - #define KVM_ARM_IRQ_GIC_MAX 127 - -+/* One single KVM irqchip, ie. the VGIC */ -+#define KVM_NR_IRQCHIPS 1 -+ - /* PSCI interface */ - #define KVM_PSCI_FN_BASE 0x95c1ba5e - #define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) -diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h -index 3ef77a4..c8abf25 100644 ---- a/linux-headers/asm-arm64/kvm.h -+++ b/linux-headers/asm-arm64/kvm.h -@@ -188,9 +188,16 @@ struct kvm_arch_memory_slot { - #define KVM_ARM_IRQ_CPU_IRQ 0 - #define KVM_ARM_IRQ_CPU_FIQ 1 - --/* Highest supported SPI, from VGIC_NR_IRQS */ -+/* -+ * This used to hold the highest supported SPI, but it is now obsolete -+ * and only here to provide source code level compatibility with older -+ * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. -+ */ - #define KVM_ARM_IRQ_GIC_MAX 127 - -+/* One single KVM irqchip, ie. the VGIC */ -+#define KVM_NR_IRQCHIPS 1 -+ - /* PSCI interface */ - #define KVM_PSCI_FN_BASE 0x95c1ba5e - #define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) -diff --git a/linux-headers/asm-mips/kvm.h b/linux-headers/asm-mips/kvm.h -index 2c04b6d..6985eb5 100644 ---- a/linux-headers/asm-mips/kvm.h -+++ b/linux-headers/asm-mips/kvm.h -@@ -36,77 +36,85 @@ struct kvm_regs { - - /* - * for KVM_GET_FPU and KVM_SET_FPU -- * -- * If Status[FR] is zero (32-bit FPU), the upper 32-bits of the FPRs -- * are zero filled. - */ - struct kvm_fpu { -- __u64 fpr[32]; -- __u32 fir; -- __u32 fccr; -- __u32 fexr; -- __u32 fenr; -- __u32 fcsr; -- __u32 pad; - }; - - - /* -- * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access CP0 -+ * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access various - * registers. The id field is broken down as follows: - * -- * bits[2..0] - Register 'sel' index. -- * bits[7..3] - Register 'rd' index. -- * bits[15..8] - Must be zero. -- * bits[31..16] - 1 -> CP0 registers. -- * bits[51..32] - Must be zero. - * bits[63..52] - As per linux/kvm.h -+ * bits[51..32] - Must be zero. -+ * bits[31..16] - Register set. -+ * -+ * Register set = 0: GP registers from kvm_regs (see definitions below). -+ * -+ * Register set = 1: CP0 registers. -+ * bits[15..8] - Must be zero. -+ * bits[7..3] - Register 'rd' index. -+ * bits[2..0] - Register 'sel' index. -+ * -+ * Register set = 2: KVM specific registers (see definitions below). -+ * -+ * Register set = 3: FPU / MSA registers (see definitions below). - * - * Other sets registers may be added in the future. Each set would - * have its own identifier in bits[31..16]. -- * -- * The registers defined in struct kvm_regs are also accessible, the -- * id values for these are below. - */ - --#define KVM_REG_MIPS_R0 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0) --#define KVM_REG_MIPS_R1 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 1) --#define KVM_REG_MIPS_R2 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 2) --#define KVM_REG_MIPS_R3 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 3) --#define KVM_REG_MIPS_R4 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 4) --#define KVM_REG_MIPS_R5 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 5) --#define KVM_REG_MIPS_R6 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 6) --#define KVM_REG_MIPS_R7 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 7) --#define KVM_REG_MIPS_R8 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 8) --#define KVM_REG_MIPS_R9 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 9) --#define KVM_REG_MIPS_R10 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 10) --#define KVM_REG_MIPS_R11 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 11) --#define KVM_REG_MIPS_R12 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 12) --#define KVM_REG_MIPS_R13 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 13) --#define KVM_REG_MIPS_R14 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 14) --#define KVM_REG_MIPS_R15 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 15) --#define KVM_REG_MIPS_R16 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 16) --#define KVM_REG_MIPS_R17 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 17) --#define KVM_REG_MIPS_R18 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 18) --#define KVM_REG_MIPS_R19 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 19) --#define KVM_REG_MIPS_R20 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 20) --#define KVM_REG_MIPS_R21 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 21) --#define KVM_REG_MIPS_R22 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 22) --#define KVM_REG_MIPS_R23 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 23) --#define KVM_REG_MIPS_R24 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 24) --#define KVM_REG_MIPS_R25 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 25) --#define KVM_REG_MIPS_R26 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 26) --#define KVM_REG_MIPS_R27 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 27) --#define KVM_REG_MIPS_R28 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 28) --#define KVM_REG_MIPS_R29 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 29) --#define KVM_REG_MIPS_R30 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 30) --#define KVM_REG_MIPS_R31 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 31) -- --#define KVM_REG_MIPS_HI (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 32) --#define KVM_REG_MIPS_LO (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 33) --#define KVM_REG_MIPS_PC (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 34) -- --/* KVM specific control registers */ -+#define KVM_REG_MIPS_GP (KVM_REG_MIPS | 0x0000000000000000ULL) -+#define KVM_REG_MIPS_CP0 (KVM_REG_MIPS | 0x0000000000010000ULL) -+#define KVM_REG_MIPS_KVM (KVM_REG_MIPS | 0x0000000000020000ULL) -+#define KVM_REG_MIPS_FPU (KVM_REG_MIPS | 0x0000000000030000ULL) -+ -+ -+/* -+ * KVM_REG_MIPS_GP - General purpose registers from kvm_regs. -+ */ -+ -+#define KVM_REG_MIPS_R0 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 0) -+#define KVM_REG_MIPS_R1 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 1) -+#define KVM_REG_MIPS_R2 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 2) -+#define KVM_REG_MIPS_R3 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 3) -+#define KVM_REG_MIPS_R4 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 4) -+#define KVM_REG_MIPS_R5 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 5) -+#define KVM_REG_MIPS_R6 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 6) -+#define KVM_REG_MIPS_R7 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 7) -+#define KVM_REG_MIPS_R8 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 8) -+#define KVM_REG_MIPS_R9 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 9) -+#define KVM_REG_MIPS_R10 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 10) -+#define KVM_REG_MIPS_R11 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 11) -+#define KVM_REG_MIPS_R12 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 12) -+#define KVM_REG_MIPS_R13 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 13) -+#define KVM_REG_MIPS_R14 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 14) -+#define KVM_REG_MIPS_R15 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 15) -+#define KVM_REG_MIPS_R16 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 16) -+#define KVM_REG_MIPS_R17 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 17) -+#define KVM_REG_MIPS_R18 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 18) -+#define KVM_REG_MIPS_R19 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 19) -+#define KVM_REG_MIPS_R20 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 20) -+#define KVM_REG_MIPS_R21 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 21) -+#define KVM_REG_MIPS_R22 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 22) -+#define KVM_REG_MIPS_R23 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 23) -+#define KVM_REG_MIPS_R24 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 24) -+#define KVM_REG_MIPS_R25 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 25) -+#define KVM_REG_MIPS_R26 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 26) -+#define KVM_REG_MIPS_R27 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 27) -+#define KVM_REG_MIPS_R28 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 28) -+#define KVM_REG_MIPS_R29 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 29) -+#define KVM_REG_MIPS_R30 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 30) -+#define KVM_REG_MIPS_R31 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 31) -+ -+#define KVM_REG_MIPS_HI (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 32) -+#define KVM_REG_MIPS_LO (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 33) -+#define KVM_REG_MIPS_PC (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 34) -+ -+ -+/* -+ * KVM_REG_MIPS_KVM - KVM specific control registers. -+ */ - - /* - * CP0_Count control -@@ -118,8 +126,7 @@ struct kvm_fpu { - * safely without losing time or guest timer interrupts. - * Other: Reserved, do not change. - */ --#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS | KVM_REG_SIZE_U64 | \ -- 0x20000 | 0) -+#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 0) - #define KVM_REG_MIPS_COUNT_CTL_DC 0x00000001 - - /* -@@ -131,15 +138,46 @@ struct kvm_fpu { - * emulated. - * Modifications to times in the future are rejected. - */ --#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS | KVM_REG_SIZE_U64 | \ -- 0x20000 | 1) -+#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 1) - /* - * CP0_Count rate in Hz - * Specifies the rate of the CP0_Count timer in Hz. Modifications occur without - * discontinuities in CP0_Count. - */ --#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS | KVM_REG_SIZE_U64 | \ -- 0x20000 | 2) -+#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 2) -+ -+ -+/* -+ * KVM_REG_MIPS_FPU - Floating Point and MIPS SIMD Architecture (MSA) registers. -+ * -+ * bits[15..8] - Register subset (see definitions below). -+ * bits[7..5] - Must be zero. -+ * bits[4..0] - Register number within register subset. -+ */ -+ -+#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL) -+#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL) -+#define KVM_REG_MIPS_MSACR (KVM_REG_MIPS_FPU | 0x0000000000000200ULL) -+ -+/* -+ * KVM_REG_MIPS_FPR - Floating point / Vector registers. -+ */ -+#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n)) -+#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n)) -+#define KVM_REG_MIPS_VEC_128(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U128 | (n)) -+ -+/* -+ * KVM_REG_MIPS_FCR - Floating point control registers. -+ */ -+#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0) -+#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31) -+ -+/* -+ * KVM_REG_MIPS_MSACR - MIPS SIMD Architecture (MSA) control registers. -+ */ -+#define KVM_REG_MIPS_MSA_IR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 0) -+#define KVM_REG_MIPS_MSA_CSR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 1) -+ - - /* - * KVM MIPS specific structures and definitions -diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h -index c5a93eb..512d8f1 100644 ---- a/linux-headers/asm-s390/kvm.h -+++ b/linux-headers/asm-s390/kvm.h -@@ -150,6 +150,7 @@ struct kvm_guest_debug_arch { - #define KVM_SYNC_CRS (1UL << 3) - #define KVM_SYNC_ARCH0 (1UL << 4) - #define KVM_SYNC_PFAULT (1UL << 5) -+#define KVM_SYNC_VRS (1UL << 6) - /* definition of registers in kvm_run */ - struct kvm_sync_regs { - __u64 prefix; /* prefix register */ -@@ -164,6 +165,9 @@ struct kvm_sync_regs { - __u64 pft; /* pfault token [PFAULT] */ - __u64 pfs; /* pfault select [PFAULT] */ - __u64 pfc; /* pfault compare [PFAULT] */ -+ __u64 vrs[32][2]; /* vector registers */ -+ __u8 reserved[512]; /* for future vector expansion */ -+ __u32 fpc; /* only valid with vector registers */ - }; - - #define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) -diff --git a/linux-headers/asm-x86/hyperv.h b/linux-headers/asm-x86/hyperv.h -index 90c458e..ce6068d 100644 ---- a/linux-headers/asm-x86/hyperv.h -+++ b/linux-headers/asm-x86/hyperv.h -@@ -225,6 +225,8 @@ - #define HV_STATUS_INVALID_HYPERCALL_CODE 2 - #define HV_STATUS_INVALID_HYPERCALL_INPUT 3 - #define HV_STATUS_INVALID_ALIGNMENT 4 -+#define HV_STATUS_INSUFFICIENT_MEMORY 11 -+#define HV_STATUS_INVALID_CONNECTION_ID 18 - #define HV_STATUS_INSUFFICIENT_BUFFERS 19 - - typedef struct _HV_REFERENCE_TSC_PAGE { -diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h -index 60a54c8..b96d978 100644 ---- a/linux-headers/linux/kvm.h -+++ b/linux-headers/linux/kvm.h -@@ -147,6 +147,16 @@ struct kvm_pit_config { - - #define KVM_PIT_SPEAKER_DUMMY 1 - -+struct kvm_s390_skeys { -+ __u64 start_gfn; -+ __u64 count; -+ __u64 skeydata_addr; -+ __u32 flags; -+ __u32 reserved[9]; -+}; -+#define KVM_S390_GET_SKEYS_NONE 1 -+#define KVM_S390_SKEYS_MAX 1048576 -+ - #define KVM_EXIT_UNKNOWN 0 - #define KVM_EXIT_EXCEPTION 1 - #define KVM_EXIT_IO 2 -@@ -172,6 +182,7 @@ struct kvm_pit_config { - #define KVM_EXIT_S390_TSCH 22 - #define KVM_EXIT_EPR 23 - #define KVM_EXIT_SYSTEM_EVENT 24 -+#define KVM_EXIT_S390_STSI 25 - - /* For KVM_EXIT_INTERNAL_ERROR */ - /* Emulate instruction failed. */ -@@ -309,6 +320,15 @@ struct kvm_run { - __u32 type; - __u64 flags; - } system_event; -+ /* KVM_EXIT_S390_STSI */ -+ struct { -+ __u64 addr; -+ __u8 ar; -+ __u8 reserved; -+ __u8 fc; -+ __u8 sel1; -+ __u16 sel2; -+ } s390_stsi; - /* Fix the size of the union. */ - char padding[256]; - }; -@@ -324,7 +344,7 @@ struct kvm_run { - __u64 kvm_dirty_regs; - union { - struct kvm_sync_regs regs; -- char padding[1024]; -+ char padding[2048]; - } s; - }; - -@@ -365,6 +385,24 @@ struct kvm_translation { - __u8 pad[5]; - }; - -+/* for KVM_S390_MEM_OP */ -+struct kvm_s390_mem_op { -+ /* in */ -+ __u64 gaddr; /* the guest address */ -+ __u64 flags; /* flags */ -+ __u32 size; /* amount of bytes */ -+ __u32 op; /* type of operation */ -+ __u64 buf; /* buffer in userspace */ -+ __u8 ar; /* the access register number */ -+ __u8 reserved[31]; /* should be set to 0 */ -+}; -+/* types for kvm_s390_mem_op->op */ -+#define KVM_S390_MEMOP_LOGICAL_READ 0 -+#define KVM_S390_MEMOP_LOGICAL_WRITE 1 -+/* flags for kvm_s390_mem_op->flags */ -+#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0) -+#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1) -+ - /* for KVM_INTERRUPT */ - struct kvm_interrupt { - /* in */ -@@ -520,6 +558,13 @@ struct kvm_s390_irq { - } u; - }; - -+struct kvm_s390_irq_state { -+ __u64 buf; -+ __u32 flags; -+ __u32 len; -+ __u32 reserved[4]; -+}; -+ - /* for KVM_SET_GUEST_DEBUG */ - - #define KVM_GUESTDBG_ENABLE 0x00000001 -@@ -760,6 +805,15 @@ struct kvm_ppc_smmu_info { - #define KVM_CAP_PPC_ENABLE_HCALL 104 - #define KVM_CAP_CHECK_EXTENSION_VM 105 - #define KVM_CAP_S390_USER_SIGP 106 -+#define KVM_CAP_S390_VECTOR_REGISTERS 107 -+#define KVM_CAP_S390_MEM_OP 108 -+#define KVM_CAP_S390_USER_STSI 109 -+#define KVM_CAP_S390_SKEYS 110 -+#define KVM_CAP_MIPS_FPU 111 -+#define KVM_CAP_MIPS_MSA 112 -+#define KVM_CAP_S390_INJECT_IRQ 113 -+#define KVM_CAP_S390_IRQ_STATE 114 -+#define KVM_CAP_PPC_HWRNG 115 - - #ifdef KVM_CAP_IRQ_ROUTING - -@@ -1135,6 +1189,16 @@ struct kvm_s390_ucas_mapping { - #define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) - #define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) - #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) -+/* Available with KVM_CAP_S390_MEM_OP */ -+#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op) -+/* Available with KVM_CAP_S390_SKEYS */ -+#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys) -+#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys) -+/* Available with KVM_CAP_S390_INJECT_IRQ */ -+#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq) -+/* Available with KVM_CAP_S390_IRQ_STATE */ -+#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state) -+#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state) - - #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) - #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) -diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h -index 95ba870..0508d0b 100644 ---- a/linux-headers/linux/vfio.h -+++ b/linux-headers/linux/vfio.h -@@ -160,6 +160,8 @@ struct vfio_device_info { - __u32 flags; - #define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ - #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */ -+#define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */ -+#define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */ - __u32 num_regions; /* Max region index + 1 */ - __u32 num_irqs; /* Max IRQ index + 1 */ - }; --- -1.8.3.1 - diff --git a/SOURCES/kvm-memory-Define-API-for-MemoryRegionOps-to-take-attrs-.patch b/SOURCES/kvm-memory-Define-API-for-MemoryRegionOps-to-take-attrs-.patch deleted file mode 100644 index 379d848..0000000 --- a/SOURCES/kvm-memory-Define-API-for-MemoryRegionOps-to-take-attrs-.patch +++ /dev/null @@ -1,465 +0,0 @@ -From f193533e350724bdb1818eb590608ec1bf7625b2 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:10 +0200 -Subject: [PATCH 122/217] memory: Define API for MemoryRegionOps to take attrs - and return status -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-8-git-send-email-jasowang@redhat.com> -Patchwork-id: 66782 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 07/68] memory: Define API for MemoryRegionOps to take attrs and return status -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Define an API so that devices can register MemoryRegionOps whose read -and write callback functions are passed an arbitrary pointer to some -transaction attributes and can return a success-or-failure status code. -This will allow us to model devices which: - * behave differently for ARM Secure/NonSecure memory accesses - * behave differently for privileged/unprivileged accesses - * may return a transaction failure (causing a guest exception) - for erroneous accesses - -This patch defines the new API and plumbs the attributes parameter through -to the memory.c public level functions io_mem_read() and io_mem_write(), -where it is currently dummied out. - -The success/failure response indication is also propagated out to -io_mem_read() and io_mem_write(), which retain the old-style -boolean true-for-error return. - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Acked-by: Paolo Bonzini <pbonzini@redhat.com> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit cc05c43ad942165ecc6ffd39e41991bee43af044) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/exec/memattrs.h | 41 ++++++++++ - include/exec/memory.h | 22 +++++ - memory.c | 207 ++++++++++++++++++++++++++++++++---------------- - 3 files changed, 203 insertions(+), 67 deletions(-) - create mode 100644 include/exec/memattrs.h - -diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h -new file mode 100644 -index 0000000..1cb3fc0 ---- /dev/null -+++ b/include/exec/memattrs.h -@@ -0,0 +1,41 @@ -+/* -+ * Memory transaction attributes -+ * -+ * Copyright (c) 2015 Linaro Limited. -+ * -+ * Authors: -+ * Peter Maydell <peter.maydell@linaro.org> -+ * -+ * This work is licensed under the terms of the GNU GPL, version 2 or later. -+ * See the COPYING file in the top-level directory. -+ * -+ */ -+ -+#ifndef MEMATTRS_H -+#define MEMATTRS_H -+ -+/* Every memory transaction has associated with it a set of -+ * attributes. Some of these are generic (such as the ID of -+ * the bus master); some are specific to a particular kind of -+ * bus (such as the ARM Secure/NonSecure bit). We define them -+ * all as non-overlapping bitfields in a single struct to avoid -+ * confusion if different parts of QEMU used the same bit for -+ * different semantics. -+ */ -+typedef struct MemTxAttrs { -+ /* Bus masters which don't specify any attributes will get this -+ * (via the MEMTXATTRS_UNSPECIFIED constant), so that we can -+ * distinguish "all attributes deliberately clear" from -+ * "didn't specify" if necessary. -+ */ -+ unsigned int unspecified:1; -+} MemTxAttrs; -+ -+/* Bus masters which don't specify any attributes will get this, -+ * which has all attribute bits clear except the topmost one -+ * (so that we can distinguish "all attributes deliberately clear" -+ * from "didn't specify" if necessary). -+ */ -+#define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = 1 }) -+ -+#endif -diff --git a/include/exec/memory.h b/include/exec/memory.h -index a2ea587..88de117 100644 ---- a/include/exec/memory.h -+++ b/include/exec/memory.h -@@ -28,6 +28,7 @@ - #ifndef CONFIG_USER_ONLY - #include "exec/hwaddr.h" - #endif -+#include "exec/memattrs.h" - #include "qemu/queue.h" - #include "qemu/int128.h" - #include "qemu/notify.h" -@@ -68,6 +69,16 @@ struct IOMMUTLBEntry { - IOMMUAccessFlags perm; - }; - -+/* New-style MMIO accessors can indicate that the transaction failed. -+ * A zero (MEMTX_OK) response means success; anything else is a failure -+ * of some kind. The memory subsystem will bitwise-OR together results -+ * if it is synthesizing an operation from multiple smaller accesses. -+ */ -+#define MEMTX_OK 0 -+#define MEMTX_ERROR (1U << 0) /* device returned an error */ -+#define MEMTX_DECODE_ERROR (1U << 1) /* nothing at that address */ -+typedef uint32_t MemTxResult; -+ - /* - * Memory region callbacks - */ -@@ -84,6 +95,17 @@ struct MemoryRegionOps { - uint64_t data, - unsigned size); - -+ MemTxResult (*read_with_attrs)(void *opaque, -+ hwaddr addr, -+ uint64_t *data, -+ unsigned size, -+ MemTxAttrs attrs); -+ MemTxResult (*write_with_attrs)(void *opaque, -+ hwaddr addr, -+ uint64_t data, -+ unsigned size, -+ MemTxAttrs attrs); -+ - enum device_endian endianness; - /* Guest-visible constraints: */ - struct { -diff --git a/memory.c b/memory.c -index a11e9bf..23d6345 100644 ---- a/memory.c -+++ b/memory.c -@@ -368,57 +368,84 @@ static void adjust_endianness(MemoryRegion *mr, uint64_t *data, unsigned size) - } - } - --static void memory_region_oldmmio_read_accessor(MemoryRegion *mr, -+static MemTxResult memory_region_oldmmio_read_accessor(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *value, -+ unsigned size, -+ unsigned shift, -+ uint64_t mask, -+ MemTxAttrs attrs) -+{ -+ uint64_t tmp; -+ -+ tmp = mr->ops->old_mmio.read[ctz32(size)](mr->opaque, addr); -+ trace_memory_region_ops_read(mr, addr, tmp, size); -+ *value |= (tmp & mask) << shift; -+ return MEMTX_OK; -+} -+ -+static MemTxResult memory_region_read_accessor(MemoryRegion *mr, - hwaddr addr, - uint64_t *value, - unsigned size, - unsigned shift, -- uint64_t mask) -+ uint64_t mask, -+ MemTxAttrs attrs) - { - uint64_t tmp; - -- tmp = mr->ops->old_mmio.read[ctz32(size)](mr->opaque, addr); -+ if (mr->flush_coalesced_mmio) { -+ qemu_flush_coalesced_mmio_buffer(); -+ } -+ tmp = mr->ops->read(mr->opaque, addr, size); - trace_memory_region_ops_read(mr, addr, tmp, size); - *value |= (tmp & mask) << shift; -+ return MEMTX_OK; - } - --static void memory_region_read_accessor(MemoryRegion *mr, -- hwaddr addr, -- uint64_t *value, -- unsigned size, -- unsigned shift, -- uint64_t mask) -+static MemTxResult memory_region_read_with_attrs_accessor(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *value, -+ unsigned size, -+ unsigned shift, -+ uint64_t mask, -+ MemTxAttrs attrs) - { -- uint64_t tmp; -+ uint64_t tmp = 0; -+ MemTxResult r; - - if (mr->flush_coalesced_mmio) { - qemu_flush_coalesced_mmio_buffer(); - } -- tmp = mr->ops->read(mr->opaque, addr, size); -+ r = mr->ops->read_with_attrs(mr->opaque, addr, &tmp, size, attrs); - trace_memory_region_ops_read(mr, addr, tmp, size); - *value |= (tmp & mask) << shift; -+ return r; - } - --static void memory_region_oldmmio_write_accessor(MemoryRegion *mr, -- hwaddr addr, -- uint64_t *value, -- unsigned size, -- unsigned shift, -- uint64_t mask) -+static MemTxResult memory_region_oldmmio_write_accessor(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *value, -+ unsigned size, -+ unsigned shift, -+ uint64_t mask, -+ MemTxAttrs attrs) - { - uint64_t tmp; - - tmp = (*value >> shift) & mask; - trace_memory_region_ops_write(mr, addr, tmp, size); - mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp); -+ return MEMTX_OK; - } - --static void memory_region_write_accessor(MemoryRegion *mr, -- hwaddr addr, -- uint64_t *value, -- unsigned size, -- unsigned shift, -- uint64_t mask) -+static MemTxResult memory_region_write_accessor(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *value, -+ unsigned size, -+ unsigned shift, -+ uint64_t mask, -+ MemTxAttrs attrs) - { - uint64_t tmp; - -@@ -428,24 +455,46 @@ static void memory_region_write_accessor(MemoryRegion *mr, - tmp = (*value >> shift) & mask; - trace_memory_region_ops_write(mr, addr, tmp, size); - mr->ops->write(mr->opaque, addr, tmp, size); -+ return MEMTX_OK; - } - --static void access_with_adjusted_size(hwaddr addr, -+static MemTxResult memory_region_write_with_attrs_accessor(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *value, -+ unsigned size, -+ unsigned shift, -+ uint64_t mask, -+ MemTxAttrs attrs) -+{ -+ uint64_t tmp; -+ -+ if (mr->flush_coalesced_mmio) { -+ qemu_flush_coalesced_mmio_buffer(); -+ } -+ tmp = (*value >> shift) & mask; -+ trace_memory_region_ops_write(mr, addr, tmp, size); -+ return mr->ops->write_with_attrs(mr->opaque, addr, tmp, size, attrs); -+} -+ -+static MemTxResult access_with_adjusted_size(hwaddr addr, - uint64_t *value, - unsigned size, - unsigned access_size_min, - unsigned access_size_max, -- void (*access)(MemoryRegion *mr, -- hwaddr addr, -- uint64_t *value, -- unsigned size, -- unsigned shift, -- uint64_t mask), -- MemoryRegion *mr) -+ MemTxResult (*access)(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *value, -+ unsigned size, -+ unsigned shift, -+ uint64_t mask, -+ MemTxAttrs attrs), -+ MemoryRegion *mr, -+ MemTxAttrs attrs) - { - uint64_t access_mask; - unsigned access_size; - unsigned i; -+ MemTxResult r = MEMTX_OK; - - if (!access_size_min) { - access_size_min = 1; -@@ -459,14 +508,16 @@ static void access_with_adjusted_size(hwaddr addr, - access_mask = -1ULL >> (64 - access_size * 8); - if (memory_region_big_endian(mr)) { - for (i = 0; i < size; i += access_size) { -- access(mr, addr + i, value, access_size, -- (size - access_size - i) * 8, access_mask); -+ r |= access(mr, addr + i, value, access_size, -+ (size - access_size - i) * 8, access_mask, attrs); - } - } else { - for (i = 0; i < size; i += access_size) { -- access(mr, addr + i, value, access_size, i * 8, access_mask); -+ r |= access(mr, addr + i, value, access_size, i * 8, -+ access_mask, attrs); - } - } -+ return r; - } - - static AddressSpace *memory_region_to_address_space(MemoryRegion *mr) -@@ -1053,62 +1104,82 @@ bool memory_region_access_valid(MemoryRegion *mr, - return true; - } - --static uint64_t memory_region_dispatch_read1(MemoryRegion *mr, -- hwaddr addr, -- unsigned size) -+static MemTxResult memory_region_dispatch_read1(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *pval, -+ unsigned size, -+ MemTxAttrs attrs) - { -- uint64_t data = 0; -+ *pval = 0; - - if (mr->ops->read) { -- access_with_adjusted_size(addr, &data, size, -- mr->ops->impl.min_access_size, -- mr->ops->impl.max_access_size, -- memory_region_read_accessor, mr); -+ return access_with_adjusted_size(addr, pval, size, -+ mr->ops->impl.min_access_size, -+ mr->ops->impl.max_access_size, -+ memory_region_read_accessor, -+ mr, attrs); -+ } else if (mr->ops->read_with_attrs) { -+ return access_with_adjusted_size(addr, pval, size, -+ mr->ops->impl.min_access_size, -+ mr->ops->impl.max_access_size, -+ memory_region_read_with_attrs_accessor, -+ mr, attrs); - } else { -- access_with_adjusted_size(addr, &data, size, 1, 4, -- memory_region_oldmmio_read_accessor, mr); -+ return access_with_adjusted_size(addr, pval, size, 1, 4, -+ memory_region_oldmmio_read_accessor, -+ mr, attrs); - } -- -- return data; - } - --static bool memory_region_dispatch_read(MemoryRegion *mr, -- hwaddr addr, -- uint64_t *pval, -- unsigned size) -+static MemTxResult memory_region_dispatch_read(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *pval, -+ unsigned size, -+ MemTxAttrs attrs) - { -+ MemTxResult r; -+ - if (!memory_region_access_valid(mr, addr, size, false)) { - *pval = unassigned_mem_read(mr, addr, size); -- return true; -+ return MEMTX_DECODE_ERROR; - } - -- *pval = memory_region_dispatch_read1(mr, addr, size); -+ r = memory_region_dispatch_read1(mr, addr, pval, size, attrs); - adjust_endianness(mr, pval, size); -- return false; -+ return r; - } - --static bool memory_region_dispatch_write(MemoryRegion *mr, -- hwaddr addr, -- uint64_t data, -- unsigned size) -+static MemTxResult memory_region_dispatch_write(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t data, -+ unsigned size, -+ MemTxAttrs attrs) - { - if (!memory_region_access_valid(mr, addr, size, true)) { - unassigned_mem_write(mr, addr, data, size); -- return true; -+ return MEMTX_DECODE_ERROR; - } - - adjust_endianness(mr, &data, size); - - if (mr->ops->write) { -- access_with_adjusted_size(addr, &data, size, -- mr->ops->impl.min_access_size, -- mr->ops->impl.max_access_size, -- memory_region_write_accessor, mr); -+ return access_with_adjusted_size(addr, &data, size, -+ mr->ops->impl.min_access_size, -+ mr->ops->impl.max_access_size, -+ memory_region_write_accessor, mr, -+ attrs); -+ } else if (mr->ops->write_with_attrs) { -+ return -+ access_with_adjusted_size(addr, &data, size, -+ mr->ops->impl.min_access_size, -+ mr->ops->impl.max_access_size, -+ memory_region_write_with_attrs_accessor, -+ mr, attrs); - } else { -- access_with_adjusted_size(addr, &data, size, 1, 4, -- memory_region_oldmmio_write_accessor, mr); -+ return access_with_adjusted_size(addr, &data, size, 1, 4, -+ memory_region_oldmmio_write_accessor, -+ mr, attrs); - } -- return false; - } - - void memory_region_init_io(MemoryRegion *mr, -@@ -2001,13 +2072,15 @@ void address_space_destroy(AddressSpace *as) - - bool io_mem_read(MemoryRegion *mr, hwaddr addr, uint64_t *pval, unsigned size) - { -- return memory_region_dispatch_read(mr, addr, pval, size); -+ return memory_region_dispatch_read(mr, addr, pval, size, -+ MEMTXATTRS_UNSPECIFIED); - } - - bool io_mem_write(MemoryRegion *mr, hwaddr addr, - uint64_t val, unsigned size) - { -- return memory_region_dispatch_write(mr, addr, val, size); -+ return memory_region_dispatch_write(mr, addr, val, size, -+ MEMTXATTRS_UNSPECIFIED); - } - - typedef struct MemoryRegionList MemoryRegionList; --- -1.8.3.1 - diff --git a/SOURCES/kvm-memory-Replace-io_mem_read-write-with-memory_region_.patch b/SOURCES/kvm-memory-Replace-io_mem_read-write-with-memory_region_.patch deleted file mode 100644 index c0cb719..0000000 --- a/SOURCES/kvm-memory-Replace-io_mem_read-write-with-memory_region_.patch +++ /dev/null @@ -1,401 +0,0 @@ -From ab2adc0fef66967a449a3c1769a67c5ba37f91c8 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:11 +0200 -Subject: [PATCH 123/217] memory: Replace io_mem_read/write with - memory_region_dispatch_read/write -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-9-git-send-email-jasowang@redhat.com> -Patchwork-id: 66783 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 08/68] memory: Replace io_mem_read/write with memory_region_dispatch_read/write -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Peter Maydell <peter.maydell@linaro.org> - -Rather than retaining io_mem_read/write as simple wrappers around -the memory_region_dispatch_read/write functions, make the latter -public and change all the callers to use them, since we need to -touch all the callsites anyway to add MemTxAttrs and MemTxResult -support. Delete io_mem_read and io_mem_write entirely. - -(All the callers currently pass MEMTXATTRS_UNSPECIFIED -and convert the return value back to bool or ignore it.) - -Signed-off-by: Peter Maydell <peter.maydell@linaro.org> -Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -(cherry picked from commit 3b6434953934e6d4a776ed426d8c6d6badee176f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - exec.c | 47 +++++++++++++++++++++++++++++++---------------- - hw/s390x/s390-pci-inst.c | 10 +++++++--- - hw/vfio/pci.c | 18 ++++++++++++------ - include/exec/exec-all.h | 4 ---- - include/exec/memory.h | 31 +++++++++++++++++++++++++++++++ - memory.c | 33 ++++++++++----------------------- - softmmu_template.h | 6 ++++-- - 7 files changed, 95 insertions(+), 54 deletions(-) - -diff --git a/exec.c b/exec.c -index 874ecfc..34dafd2 100644 ---- a/exec.c -+++ b/exec.c -@@ -2312,7 +2312,8 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, - uint64_t val; - hwaddr addr1; - MemoryRegion *mr; -- bool error = false; -+ MemTxResult result = MEMTX_OK; -+ MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; - - while (len > 0) { - l = len; -@@ -2327,22 +2328,26 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, - case 8: - /* 64 bit write access */ - val = ldq_p(buf); -- error |= io_mem_write(mr, addr1, val, 8); -+ result |= memory_region_dispatch_write(mr, addr1, val, 8, -+ attrs); - break; - case 4: - /* 32 bit write access */ - val = ldl_p(buf); -- error |= io_mem_write(mr, addr1, val, 4); -+ result |= memory_region_dispatch_write(mr, addr1, val, 4, -+ attrs); - break; - case 2: - /* 16 bit write access */ - val = lduw_p(buf); -- error |= io_mem_write(mr, addr1, val, 2); -+ result |= memory_region_dispatch_write(mr, addr1, val, 2, -+ attrs); - break; - case 1: - /* 8 bit write access */ - val = ldub_p(buf); -- error |= io_mem_write(mr, addr1, val, 1); -+ result |= memory_region_dispatch_write(mr, addr1, val, 1, -+ attrs); - break; - default: - abort(); -@@ -2361,22 +2366,26 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, - switch (l) { - case 8: - /* 64 bit read access */ -- error |= io_mem_read(mr, addr1, &val, 8); -+ result |= memory_region_dispatch_read(mr, addr1, &val, 8, -+ attrs); - stq_p(buf, val); - break; - case 4: - /* 32 bit read access */ -- error |= io_mem_read(mr, addr1, &val, 4); -+ result |= memory_region_dispatch_read(mr, addr1, &val, 4, -+ attrs); - stl_p(buf, val); - break; - case 2: - /* 16 bit read access */ -- error |= io_mem_read(mr, addr1, &val, 2); -+ result |= memory_region_dispatch_read(mr, addr1, &val, 2, -+ attrs); - stw_p(buf, val); - break; - case 1: - /* 8 bit read access */ -- error |= io_mem_read(mr, addr1, &val, 1); -+ result |= memory_region_dispatch_read(mr, addr1, &val, 1, -+ attrs); - stb_p(buf, val); - break; - default: -@@ -2393,7 +2402,7 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, - addr += l; - } - -- return error; -+ return result; - } - - bool address_space_write(AddressSpace *as, hwaddr addr, -@@ -2669,7 +2678,8 @@ static inline uint32_t ldl_phys_internal(AddressSpace *as, hwaddr addr, - mr = address_space_translate(as, addr, &addr1, &l, false); - if (l < 4 || !memory_access_is_direct(mr, false)) { - /* I/O case */ -- io_mem_read(mr, addr1, &val, 4); -+ memory_region_dispatch_read(mr, addr1, &val, 4, -+ MEMTXATTRS_UNSPECIFIED); - #if defined(TARGET_WORDS_BIGENDIAN) - if (endian == DEVICE_LITTLE_ENDIAN) { - val = bswap32(val); -@@ -2728,7 +2738,8 @@ static inline uint64_t ldq_phys_internal(AddressSpace *as, hwaddr addr, - false); - if (l < 8 || !memory_access_is_direct(mr, false)) { - /* I/O case */ -- io_mem_read(mr, addr1, &val, 8); -+ memory_region_dispatch_read(mr, addr1, &val, 8, -+ MEMTXATTRS_UNSPECIFIED); - #if defined(TARGET_WORDS_BIGENDIAN) - if (endian == DEVICE_LITTLE_ENDIAN) { - val = bswap64(val); -@@ -2795,7 +2806,8 @@ static inline uint32_t lduw_phys_internal(AddressSpace *as, hwaddr addr, - false); - if (l < 2 || !memory_access_is_direct(mr, false)) { - /* I/O case */ -- io_mem_read(mr, addr1, &val, 2); -+ memory_region_dispatch_read(mr, addr1, &val, 2, -+ MEMTXATTRS_UNSPECIFIED); - #if defined(TARGET_WORDS_BIGENDIAN) - if (endian == DEVICE_LITTLE_ENDIAN) { - val = bswap16(val); -@@ -2853,7 +2865,8 @@ void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) - mr = address_space_translate(as, addr, &addr1, &l, - true); - if (l < 4 || !memory_access_is_direct(mr, true)) { -- io_mem_write(mr, addr1, val, 4); -+ memory_region_dispatch_write(mr, addr1, val, 4, -+ MEMTXATTRS_UNSPECIFIED); - } else { - addr1 += memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK; - ptr = qemu_get_ram_ptr(addr1); -@@ -2892,7 +2905,8 @@ static inline void stl_phys_internal(AddressSpace *as, - val = bswap32(val); - } - #endif -- io_mem_write(mr, addr1, val, 4); -+ memory_region_dispatch_write(mr, addr1, val, 4, -+ MEMTXATTRS_UNSPECIFIED); - } else { - /* RAM case */ - addr1 += memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK; -@@ -2955,7 +2969,8 @@ static inline void stw_phys_internal(AddressSpace *as, - val = bswap16(val); - } - #endif -- io_mem_write(mr, addr1, val, 2); -+ memory_region_dispatch_write(mr, addr1, val, 2, -+ MEMTXATTRS_UNSPECIFIED); - } else { - /* RAM case */ - addr1 += memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK; -diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c -index 08d8aa6..8f7288f 100644 ---- a/hw/s390x/s390-pci-inst.c -+++ b/hw/s390x/s390-pci-inst.c -@@ -331,7 +331,8 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) - return 0; - } - MemoryRegion *mr = pbdev->pdev->io_regions[pcias].memory; -- io_mem_read(mr, offset, &data, len); -+ memory_region_dispatch_read(mr, offset, &data, len, -+ MEMTXATTRS_UNSPECIFIED); - } else if (pcias == 15) { - if ((4 - (offset & 0x3)) < len) { - program_interrupt(env, PGM_OPERAND, 4); -@@ -456,7 +457,8 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) - mr = pbdev->pdev->io_regions[pcias].memory; - } - -- io_mem_write(mr, offset, data, len); -+ memory_region_dispatch_write(mr, offset, data, len, -+ MEMTXATTRS_UNSPECIFIED); - } else if (pcias == 15) { - if ((4 - (offset & 0x3)) < len) { - program_interrupt(env, PGM_OPERAND, 4); -@@ -606,7 +608,9 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr) - } - - for (i = 0; i < len / 8; i++) { -- io_mem_write(mr, env->regs[r3] + i * 8, ldq_p(buffer + i * 8), 8); -+ memory_region_dispatch_write(mr, env->regs[r3] + i * 8, -+ ldq_p(buffer + i * 8), 8, -+ MEMTXATTRS_UNSPECIFIED); - } - - setcc(cpu, ZPCI_PCI_LS_OK); -diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c -index 0ec51e2..244a1ce 100644 ---- a/hw/vfio/pci.c -+++ b/hw/vfio/pci.c -@@ -1532,9 +1532,12 @@ static uint64_t vfio_rtl8168_window_quirk_read(void *opaque, - return 0; - } - -- io_mem_read(&vdev->pdev.msix_table_mmio, -- (hwaddr)(quirk->data.address_match & 0xfff), -- &val, size); -+ memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, -+ (hwaddr)(quirk->data.address_match -+ & 0xfff), -+ &val, -+ size, -+ MEMTXATTRS_UNSPECIFIED); - return val; - } - } -@@ -1562,9 +1565,12 @@ static void vfio_rtl8168_window_quirk_write(void *opaque, hwaddr addr, - memory_region_name(&quirk->mem), - vdev->vbasedev.name); - -- io_mem_write(&vdev->pdev.msix_table_mmio, -- (hwaddr)(quirk->data.address_match & 0xfff), -- data, size); -+ memory_region_dispatch_write(&vdev->pdev.msix_table_mmio, -+ (hwaddr)(quirk->data.address_match -+ & 0xfff), -+ data, -+ size, -+ MEMTXATTRS_UNSPECIFIED); - } - - quirk->data.flags = 1; -diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h -index 8eb0db3..ff1bc3e 100644 ---- a/include/exec/exec-all.h -+++ b/include/exec/exec-all.h -@@ -341,10 +341,6 @@ void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align)); - - struct MemoryRegion *iotlb_to_region(CPUState *cpu, - hwaddr index); --bool io_mem_read(struct MemoryRegion *mr, hwaddr addr, -- uint64_t *pvalue, unsigned size); --bool io_mem_write(struct MemoryRegion *mr, hwaddr addr, -- uint64_t value, unsigned size); - - void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx, - uintptr_t retaddr); -diff --git a/include/exec/memory.h b/include/exec/memory.h -index 88de117..a289eec 100644 ---- a/include/exec/memory.h -+++ b/include/exec/memory.h -@@ -1065,6 +1065,37 @@ void memory_global_dirty_log_stop(void); - void mtree_info(fprintf_function mon_printf, void *f); - - /** -+ * memory_region_dispatch_read: perform a read directly to the specified -+ * MemoryRegion. -+ * -+ * @mr: #MemoryRegion to access -+ * @addr: address within that region -+ * @pval: pointer to uint64_t which the data is written to -+ * @size: size of the access in bytes -+ * @attrs: memory transaction attributes to use for the access -+ */ -+MemTxResult memory_region_dispatch_read(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *pval, -+ unsigned size, -+ MemTxAttrs attrs); -+/** -+ * memory_region_dispatch_write: perform a write directly to the specified -+ * MemoryRegion. -+ * -+ * @mr: #MemoryRegion to access -+ * @addr: address within that region -+ * @data: data to write -+ * @size: size of the access in bytes -+ * @attrs: memory transaction attributes to use for the access -+ */ -+MemTxResult memory_region_dispatch_write(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t data, -+ unsigned size, -+ MemTxAttrs attrs); -+ -+/** - * address_space_init: initializes an address space - * - * @as: an uninitialized #AddressSpace -diff --git a/memory.c b/memory.c -index 23d6345..0f6cb81 100644 ---- a/memory.c -+++ b/memory.c -@@ -1131,11 +1131,11 @@ static MemTxResult memory_region_dispatch_read1(MemoryRegion *mr, - } - } - --static MemTxResult memory_region_dispatch_read(MemoryRegion *mr, -- hwaddr addr, -- uint64_t *pval, -- unsigned size, -- MemTxAttrs attrs) -+MemTxResult memory_region_dispatch_read(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t *pval, -+ unsigned size, -+ MemTxAttrs attrs) - { - MemTxResult r; - -@@ -1149,11 +1149,11 @@ static MemTxResult memory_region_dispatch_read(MemoryRegion *mr, - return r; - } - --static MemTxResult memory_region_dispatch_write(MemoryRegion *mr, -- hwaddr addr, -- uint64_t data, -- unsigned size, -- MemTxAttrs attrs) -+MemTxResult memory_region_dispatch_write(MemoryRegion *mr, -+ hwaddr addr, -+ uint64_t data, -+ unsigned size, -+ MemTxAttrs attrs) - { - if (!memory_region_access_valid(mr, addr, size, true)) { - unassigned_mem_write(mr, addr, data, size); -@@ -2070,19 +2070,6 @@ void address_space_destroy(AddressSpace *as) - call_rcu(as, do_address_space_destroy, rcu); - } - --bool io_mem_read(MemoryRegion *mr, hwaddr addr, uint64_t *pval, unsigned size) --{ -- return memory_region_dispatch_read(mr, addr, pval, size, -- MEMTXATTRS_UNSPECIFIED); --} -- --bool io_mem_write(MemoryRegion *mr, hwaddr addr, -- uint64_t val, unsigned size) --{ -- return memory_region_dispatch_write(mr, addr, val, size, -- MEMTXATTRS_UNSPECIFIED); --} -- - typedef struct MemoryRegionList MemoryRegionList; - - struct MemoryRegionList { -diff --git a/softmmu_template.h b/softmmu_template.h -index 0e3dd35..9c1d53e 100644 ---- a/softmmu_template.h -+++ b/softmmu_template.h -@@ -158,7 +158,8 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, - } - - cpu->mem_io_vaddr = addr; -- io_mem_read(mr, physaddr, &val, 1 << SHIFT); -+ memory_region_dispatch_read(mr, physaddr, &val, 1 << SHIFT, -+ MEMTXATTRS_UNSPECIFIED); - return val; - } - #endif -@@ -378,7 +379,8 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env, - - cpu->mem_io_vaddr = addr; - cpu->mem_io_pc = retaddr; -- io_mem_write(mr, physaddr, val, 1 << SHIFT); -+ memory_region_dispatch_write(mr, physaddr, val, 1 << SHIFT, -+ MEMTXATTRS_UNSPECIFIED); - } - - void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val, --- -1.8.3.1 - diff --git a/SOURCES/kvm-memory-add-memory_region_ram_resize.patch b/SOURCES/kvm-memory-add-memory_region_ram_resize.patch deleted file mode 100644 index 8a5eb15..0000000 --- a/SOURCES/kvm-memory-add-memory_region_ram_resize.patch +++ /dev/null @@ -1,71 +0,0 @@ -From c18b0f65a2fa51ed10e9e6b07f1319335efb9779 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 16 Jun 2015 11:48:13 +0200 -Subject: [PATCH 052/217] memory: add memory_region_ram_resize - -Message-id: <1434455325-23399-2-git-send-email-drjones@redhat.com> -Patchwork-id: 66234 -O-Subject: [AArch64 RHEL-7.2 qemu-kvm-rhev PATCH 01/33] memory: add memory_region_ram_resize -Bugzilla: 1231719 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Wei Huang <wei@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Author: Paolo Bonzini <pbonzini@redhat.com> - -This is a simple MemoryRegion wrapper for qemu_ram_resize. - -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -(cherry picked from commit 37d7c08413cd4307f53c83d43b1b06cf2701d7a7) -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/exec/memory.h | 12 ++++++++++++ - memory.c | 7 +++++++ - 2 files changed, 19 insertions(+) - -diff --git a/include/exec/memory.h b/include/exec/memory.h -index 06ffa1d..a2ea587 100644 ---- a/include/exec/memory.h -+++ b/include/exec/memory.h -@@ -605,6 +605,18 @@ int memory_region_get_fd(MemoryRegion *mr); - */ - void *memory_region_get_ram_ptr(MemoryRegion *mr); - -+/* memory_region_ram_resize: Resize a RAM region. -+ * -+ * Only legal before guest might have detected the memory size: e.g. on -+ * incoming migration, or right after reset. -+ * -+ * @mr: a memory region created with @memory_region_init_resizeable_ram. -+ * @newsize: the new size the region -+ * @errp: pointer to Error*, to store an error if it happens. -+ */ -+void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, -+ Error **errp); -+ - /** - * memory_region_set_log: Turn dirty logging on or off for a region. - * -diff --git a/memory.c b/memory.c -index ee3f2a8..a11e9bf 100644 ---- a/memory.c -+++ b/memory.c -@@ -1452,6 +1452,13 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr) - return qemu_get_ram_ptr(mr->ram_addr & TARGET_PAGE_MASK); - } - -+void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp) -+{ -+ assert(mr->terminates); -+ -+ qemu_ram_resize(mr->ram_addr, newsize, errp); -+} -+ - static void memory_region_update_coalesced_range_as(MemoryRegion *mr, AddressSpace *as) - { - FlatView *view; --- -1.8.3.1 - diff --git a/SOURCES/kvm-misc-Add-RHEL-7-machine-types.patch b/SOURCES/kvm-misc-Add-RHEL-7-machine-types.patch deleted file mode 100644 index 52c4e72..0000000 --- a/SOURCES/kvm-misc-Add-RHEL-7-machine-types.patch +++ /dev/null @@ -1,1416 +0,0 @@ ---- a/default-configs/arm-softmmu.mak -+++ b/default-configs/arm-softmmu.mak -@@ -70,7 +70,6 @@ CONFIG_ARM11SCU=y - CONFIG_A9SCU=y - CONFIG_DIGIC=y - CONFIG_MARVELL_88W8618=y --CONFIG_OMAP=y - CONFIG_TSC210X=y - CONFIG_BLIZZARD=y - CONFIG_ONENAND=y ---- a/default-configs/ppc64-softmmu.mak -+++ b/default-configs/ppc64-softmmu.mak -@@ -14,7 +14,6 @@ CONFIG_FDC=y - CONFIG_I8257=y - CONFIG_I82374=y - CONFIG_OPENPIC=y --CONFIG_PREP_PCI=y - CONFIG_I82378=y - CONFIG_PC87312=y - CONFIG_MACIO=y -@@ -36,12 +35,8 @@ CONFIG_PFLASH_CFI01=y - CONFIG_PFLASH_CFI02=y - CONFIG_PTIMER=y - CONFIG_I8259=y --CONFIG_XILINX=y --CONFIG_XILINX_ETHLITE=y -+CONFIG_OPENPIC=y - CONFIG_PSERIES=y --CONFIG_PREP=y --CONFIG_MAC=y --CONFIG_E500=y - CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM)) - CONFIG_PLATFORM_BUS=y - CONFIG_ETSEC=y ---- a/hw/acpi/piix4.c -+++ b/hw/acpi/piix4.c -@@ -275,7 +275,7 @@ static const VMStateDescription vmstate_memhp_state = { - static const VMStateDescription vmstate_acpi = { - .name = "piix4_pm", - .version_id = 3, -- .minimum_version_id = 3, -+ .minimum_version_id = 2, - .minimum_version_id_old = 1, - .load_state_old = acpi_load_old, - .post_load = vmstate_acpi_post_load, -@@ -582,8 +582,8 @@ static void piix4_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) - - static Property piix4_pm_properties[] = { - DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0), -- DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0), -- DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0), -+ DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 1), -+ DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 1), - DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2), - DEFINE_PROP_BOOL("acpi-pci-hotplug-with-bridge-support", PIIX4PMState, - use_acpi_pci_hotplug, true), ---- a/hw/arm/Makefile.objs -+++ b/hw/arm/Makefile.objs -@@ -1,12 +1 @@ --obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o --obj-$(CONFIG_DIGIC) += digic_boards.o --obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o --obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o --obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o --obj-y += netduino2.o -- --obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o --obj-$(CONFIG_DIGIC) += digic.o --obj-y += omap1.o omap2.o strongarm.o --obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o --obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o -+obj-y += boot.o virt.o ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -839,6 +839,7 @@ static void machvirt_init(MachineState *machine) - arm_load_kernel(ARM_CPU(first_cpu), &vbi->bootinfo); - } - -+#if 0 /* Disabled for RHELSA */ - static bool virt_get_secure(Object *obj, Error **errp) - { - VirtMachineState *vms = VIRT_MACHINE(obj); -@@ -866,7 +867,6 @@ static void virt_instance_init(Object *obj) - "Security Extensions (TrustZone)", - NULL); - } -- - static void virt_class_init(ObjectClass *oc, void *data) - { - MachineClass *mc = MACHINE_CLASS(oc); -@@ -892,3 +892,24 @@ static void machvirt_machine_init(void) - } - - machine_init(machvirt_machine_init); -+#endif /* disabled for RHELSA */ -+ -+static QEMUMachine aarch64_machine_rhelsa710 = { -+ .family = "virt-rhelsa-Z", -+ .name = "virt-rhelsa7.1", -+ .alias = "virt", -+ .desc = "RHELSA 7.1 ARM Virtual Machine", -+ .init = machvirt_init, -+ .is_default = 1, -+ .max_cpus = 8, -+ .compat_props = (GlobalProperty[]) { -+ { /* end of list */ } -+ }, -+}; -+ -+static void rhelsa_machine_init(void) -+{ -+ qemu_register_machine(&aarch64_machine_rhelsa710); -+} -+ -+machine_init(rhelsa_machine_init); ---- a/hw/display/cirrus_vga.c -+++ b/hw/display/cirrus_vga.c -@@ -2979,7 +2979,7 @@ static void isa_cirrus_vga_realizefn(DeviceState *dev, Error **errp) - - static Property isa_cirrus_vga_properties[] = { - DEFINE_PROP_UINT32("vgamem_mb", struct ISACirrusVGAState, -- cirrus_vga.vga.vram_size_mb, 8), -+ cirrus_vga.vga.vram_size_mb, 16), - DEFINE_PROP_END_OF_LIST(), - }; - -@@ -3048,7 +3048,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, 8), -+ cirrus_vga.vga.vram_size_mb, 16), - DEFINE_PROP_END_OF_LIST(), - }; - ---- a/hw/display/vga-isa.c -+++ b/hw/display/vga-isa.c -@@ -75,7 +75,7 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp) - } - - static Property vga_isa_properties[] = { -- DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8), -+ DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 16), - DEFINE_PROP_END_OF_LIST(), - }; - ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -174,7 +174,7 @@ static void pc_init1(MachineState *machine, - if (smbios_defaults) { - MachineClass *mc = MACHINE_GET_CLASS(machine); - /* These values are guest ABI, do not change */ -- smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", -+ smbios_set_defaults("Red Hat", "KVM", - mc->name, smbios_legacy_mode, smbios_uuid_encoded); - } - -@@ -310,6 +310,7 @@ static void pc_init_pci(MachineState *machine) - pc_init1(machine, 1, 1); - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void pc_compat_2_2(MachineState *machine) - { - rsdp_in_ram = false; -@@ -995,3 +996,581 @@ static void pc_machine_init(void) - } - - machine_init(pc_machine_init); -+ -+#endif /* Disabled for Red Hat Enterprise Linux */ -+ -+/* Red Hat Enterprise Linux machine types */ -+ -+static void pc_compat_rhel710(MachineState *machine) -+{ -+ /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it -+ * on AMD CPU models. -+ */ -+ x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+} -+ -+static void pc_init_rhel710(MachineState *machine) -+{ -+ pc_compat_rhel710(machine); -+ pc_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel710 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Y", -+ .name = "pc-i440fx-rhel7.1.0", -+ .alias = "pc", -+ .desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)", -+ .init = pc_init_rhel710, -+ .is_default = 1, -+ .default_machine_opts = "firmware=bios-256k.bin", -+ .compat_props = (GlobalProperty[]) { -+ { /* end of list */ } -+ }, -+}; -+ -+static void pc_compat_rhel700(MachineState *machine) -+{ -+ pc_compat_rhel710(machine); -+ -+ /* Upstream enables it for everyone, we're a little more selective */ -+ x86_cpu_compat_kvm_no_autoenable(FEAT_1_ECX, CPUID_EXT_X2APIC); -+ -+ x86_cpu_compat_set_features("Conroe", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Penryn", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Nehalem", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ /* SandyBridge and Haswell already have x2apic enabled */ -+ x86_cpu_compat_set_features("Opteron_G1", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ -+ legacy_acpi_table_size = 6418; /* see pc_compat_2_0() */ -+ smbios_legacy_mode = true; -+ has_reserved_memory = false; -+ migrate_cve_2014_5263_xhci_fields = true; -+} -+ -+static void pc_init_rhel700(MachineState *machine) -+{ -+ pc_compat_rhel700(machine); -+ pc_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel700 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Y", -+ .name = "pc-i440fx-rhel7.0.0", -+ .desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)", -+ .init = pc_init_rhel700, -+ .default_machine_opts = "firmware=bios-256k.bin", -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL7_0_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+#define PC_RHEL6_6_COMPAT \ -+ PC_RHEL7_0_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 = stringify(0),\ -+ },{\ -+ .driver = "qemu32-" TYPE_X86_CPU,\ -+ .property = "xlevel",\ -+ .value = stringify(0),\ -+ },{\ -+ .driver = "486-" TYPE_X86_CPU,\ -+ .property = "level",\ -+ .value = stringify(0),\ -+ },{\ -+ .driver = "qemu32-" TYPE_X86_CPU,\ -+ .property = "model",\ -+ .value = stringify(3),\ -+ },{\ -+ .driver = "usb-ccid",\ -+ .property = "serial",\ -+ .value = "1",\ -+ },{\ -+ .driver = "ne2k_pci",\ -+ .property = "romfile",\ -+ .value = "rhel6-ne2k_pci.rom",\ -+ },{\ -+ .driver = "pcnet",\ -+ .property = "romfile",\ -+ .value = "rhel6-pcnet.rom",\ -+ },{\ -+ .driver = "rtl8139",\ -+ .property = "romfile",\ -+ .value = "rhel6-rtl8139.rom",\ -+ },{\ -+ .driver = "e1000",\ -+ .property = "romfile",\ -+ .value = "rhel6-e1000.rom",\ -+ },{\ -+ .driver = "virtio-net-pci",\ -+ .property = "romfile",\ -+ .value = "rhel6-virtio.rom",\ -+ },{\ -+ .driver = "virtio-net-pci",\ -+ .property = "any_layout",\ -+ .value = "off",\ -+ } -+ -+static void pc_compat_rhel660(MachineState *machine) -+{ -+ pc_compat_rhel700(machine); -+ if (!machine->cpu_model) { -+ machine->cpu_model = "cpu64-rhel6"; -+ } -+ x86_cpu_compat_set_features("pentium", FEAT_1_EDX, 0, CPUID_APIC); -+ x86_cpu_compat_set_features("pentium2", FEAT_1_EDX, 0, CPUID_APIC); -+ x86_cpu_compat_set_features("pentium3", FEAT_1_EDX, 0, CPUID_APIC); -+ -+ x86_cpu_compat_set_features("Conroe", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Penryn", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Nehalem", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ); -+ x86_cpu_compat_set_features("Westmere", FEAT_8000_0001_EDX, -+ CPUID_EXT2_FXSR | CPUID_EXT2_MMX | CPUID_EXT2_PAT | -+ CPUID_EXT2_CMOV | CPUID_EXT2_PGE | CPUID_EXT2_APIC | -+ CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR | -+ CPUID_EXT2_TSC | CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU, -+ 0); -+ x86_cpu_compat_set_features("Broadwell", FEAT_8000_0001_EDX, -+ 0, CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Broadwell", FEAT_7_0_EBX, -+ 0, CPUID_7_0_EBX_SMAP); -+ -+ /* RHEL-6 kernel never supported exposing RDTSCP */ -+ x86_cpu_compat_set_features(NULL, FEAT_8000_0001_EDX, 0, CPUID_EXT2_RDTSCP); -+ -+ x86_cpu_compat_set_features("Opteron_G1", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, 0, CPUID_EXT_X2APIC); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, 0, CPUID_EXT_X2APIC); -+ -+ /* RHEL-6 had 3dnow & 3dnowext unconditionally disabled on all models */ -+ x86_cpu_compat_set_features(NULL, FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT); -+ -+ x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, KVM_FEATURE_PV_UNHALT); -+ -+ rom_file_has_mr = false; -+ has_acpi_build = false; -+ 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_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel660 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.6.0", -+ .desc = "RHEL 6.6.0 PC", -+ .init = pc_init_rhel660, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_6_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+#define PC_RHEL6_5_COMPAT \ -+ PC_RHEL6_6_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_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel650 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.5.0", -+ .desc = "RHEL 6.5.0 PC", -+ .init = pc_init_rhel650, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_5_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+#define PC_RHEL6_4_COMPAT \ -+ PC_RHEL6_5_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",\ -+ } -+ -+static void pc_compat_rhel640(MachineState *machine) -+{ -+ pc_compat_rhel650(machine); -+ x86_cpu_compat_set_features(NULL, FEAT_1_EDX, 0, CPUID_SEP); -+} -+ -+static void pc_init_rhel640(MachineState *machine) -+{ -+ pc_compat_rhel640(machine); -+ pc_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel640 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.4.0", -+ .desc = "RHEL 6.4.0 PC", -+ .init = pc_init_rhel640, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_4_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+#define PC_RHEL6_3_COMPAT \ -+ PC_RHEL6_4_COMPAT,\ -+ {\ -+ .driver = "Conroe-" TYPE_X86_CPU,\ -+ .property = "level",\ -+ .value = stringify(2),\ -+ },{\ -+ .driver = "Penryn-" TYPE_X86_CPU,\ -+ .property = "level",\ -+ .value = stringify(2),\ -+ },{\ -+ .driver = "Nehalem-" TYPE_X86_CPU,\ -+ .property = "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",\ -+ } -+ -+static void pc_compat_rhel630(MachineState *machine) -+{ -+ pc_compat_rhel640(machine); -+ x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, KVM_FEATURE_PV_EOI); -+ enable_compat_apic_id_mode(); -+ x86_cpu_compat_set_features("SandyBridge", FEAT_1_ECX, -+ 0, CPUID_EXT_TSC_DEADLINE_TIMER); -+} -+ -+static void pc_init_rhel630(MachineState *machine) -+{ -+ pc_compat_rhel630(machine); -+ pc_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel630 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.3.0", -+ .desc = "RHEL 6.3.0 PC", -+ .init = pc_init_rhel630, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_3_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+#define PC_RHEL6_2_COMPAT \ -+ PC_RHEL6_3_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_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel620 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.2.0", -+ .desc = "RHEL 6.2.0 PC", -+ .init = pc_init_rhel620, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_2_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+/* -+ * 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 \ -+ PC_RHEL6_2_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_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel610 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.1.0", -+ .desc = "RHEL 6.1.0 PC", -+ .init = pc_init_rhel610, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_1_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+#define PC_RHEL6_0_COMPAT \ -+ PC_RHEL6_1_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_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel600 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Z", -+ .name = "rhel6.0.0", -+ .desc = "RHEL 6.0.0 PC", -+ .init = pc_init_rhel600, -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL6_0_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+static void rhel_machine_init(void) -+{ -+ qemu_register_pc_machine(&pc_machine_rhel710); -+ qemu_register_pc_machine(&pc_machine_rhel700); -+ qemu_register_pc_machine(&pc_machine_rhel660); -+ qemu_register_pc_machine(&pc_machine_rhel650); -+ qemu_register_pc_machine(&pc_machine_rhel640); -+ qemu_register_pc_machine(&pc_machine_rhel630); -+ qemu_register_pc_machine(&pc_machine_rhel620); -+ qemu_register_pc_machine(&pc_machine_rhel610); -+ qemu_register_pc_machine(&pc_machine_rhel600); -+} -+ -+machine_init(rhel_machine_init); ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -165,7 +165,7 @@ static void pc_q35_init(MachineState *machine) - if (smbios_defaults) { - MachineClass *mc = MACHINE_GET_CLASS(machine); - /* These values are guest ABI, do not change */ -- smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", -+ smbios_set_defaults("Red Hat", "KVM", - mc->name, smbios_legacy_mode, smbios_uuid_encoded); - } - -@@ -289,6 +289,7 @@ static void pc_q35_init(MachineState *machine) - } - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void pc_compat_2_2(MachineState *machine) - { - rsdp_in_ram = false; -@@ -517,3 +518,93 @@ static void pc_q35_machine_init(void) - } - - machine_init(pc_q35_machine_init); -+ -+#endif /* Disabled for Red Hat Enterprise Linux */ -+ -+/* Red Hat Enterprise Linux machine types */ -+ -+static void pc_q35_compat_rhel710(MachineState *machine) -+{ -+ /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it -+ * on AMD CPU models. -+ */ -+ x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0, -+ CPUID_EXT2_RDTSCP); -+} -+ -+static void pc_q35_init_rhel710(MachineState *machine) -+{ -+ pc_q35_compat_rhel710(machine); -+ pc_q35_init(machine); -+} -+ -+static QEMUMachine pc_q35_machine_rhel710 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_q35_Z", -+ .name = "pc-q35-rhel7.1.0", -+ .alias = "q35", -+ .desc = "RHEL-7.1.0 PC (Q35 + ICH9, 2009)", -+ .init = pc_q35_init_rhel710, -+ .default_machine_opts = "firmware=bios-256k.bin", -+ .compat_props = (GlobalProperty[]) { -+ { /* end of list */ } -+ }, -+}; -+ -+static void pc_q35_compat_rhel700(MachineState *machine) -+{ -+ pc_q35_compat_rhel710(machine); -+ -+ /* Upstream enables it for everyone, we're a little more selective */ -+ x86_cpu_compat_kvm_no_autoenable(FEAT_1_ECX, CPUID_EXT_X2APIC); -+ -+ x86_cpu_compat_set_features("Conroe", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Penryn", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Nehalem", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ /* SandyBridge and Haswell already have x2apic enabled */ -+ x86_cpu_compat_set_features("Opteron_G1", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); -+ -+ smbios_legacy_mode = true; -+ has_reserved_memory = false; -+ migrate_cve_2014_5263_xhci_fields = true; -+} -+ -+static void pc_q35_init_rhel700(MachineState *machine) -+{ -+ pc_q35_compat_rhel700(machine); -+ pc_q35_init(machine); -+} -+ -+static QEMUMachine pc_q35_machine_rhel700 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_q35_Z", -+ .name = "pc-q35-rhel7.0.0", -+ .desc = "RHEL-7.0.0 PC (Q35 + ICH9, 2009)", -+ .init = pc_q35_init_rhel700, -+ .default_machine_opts = "firmware=bios-256k.bin", -+ .compat_props = (GlobalProperty[]) { -+ PC_RHEL7_0_COMPAT, -+ { /* end of list */ } -+ }, -+}; -+ -+static void rhel_pc_q35_machine_init(void) -+{ -+ qemu_register_pc_machine(&pc_q35_machine_rhel710); -+ qemu_register_pc_machine(&pc_q35_machine_rhel700); -+} -+ -+machine_init(rhel_pc_q35_machine_init); ---- a/hw/i386/smbios.c -+++ b/hw/i386/smbios.c -@@ -795,6 +795,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product, - SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer); - SMBIOS_SET_DEFAULT(type1.product, product); - SMBIOS_SET_DEFAULT(type1.version, version); -+ SMBIOS_SET_DEFAULT(type1.family, "Red Hat Enterprise Linux"); - SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer); - SMBIOS_SET_DEFAULT(type2.product, product); - SMBIOS_SET_DEFAULT(type2.version, version); ---- a/hw/net/e1000.c -+++ b/hw/net/e1000.c -@@ -1551,6 +1551,16 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp) - - pci_conf = pci_dev->config; - -+ if (!(d->compat_flags & E1000_FLAG_AUTONEG)) { -+ /* -+ * We have no capabilities, so capability list bit should normally be 0. -+ * Keep it on for compat machine types to avoid breaking migration. -+ * HACK: abuse E1000_FLAG_AUTONEG, which is off exactly for -+ * the machine types that need this. -+ */ -+ pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST); -+ } -+ - /* TODO: RST# value should be 0, PCI spec 6.2.4 */ - pci_conf[PCI_CACHE_LINE_SIZE] = 0x10; - -@@ -1614,7 +1624,7 @@ static void e1000_class_init(ObjectClass *klass, void *data) - - k->realize = pci_e1000_realize; - k->exit = pci_e1000_uninit; -- k->romfile = "efi-e1000.rom"; -+ k->romfile = "pxe-e1000.rom"; - k->vendor_id = PCI_VENDOR_ID_INTEL; - k->device_id = info->device_id; - k->revision = info->revision; ---- a/hw/net/ne2000.c -+++ b/hw/net/ne2000.c -@@ -763,7 +763,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data) - - k->realize = pci_ne2000_realize; - k->exit = pci_ne2000_exit; -- k->romfile = "efi-ne2k_pci.rom", -+ k->romfile = "pxe-ne2k_pci.rom", - k->vendor_id = PCI_VENDOR_ID_REALTEK; - k->device_id = PCI_DEVICE_ID_REALTEK_8029; - k->class_id = PCI_CLASS_NETWORK_ETHERNET; ---- a/hw/net/pcnet-pci.c -+++ b/hw/net/pcnet-pci.c -@@ -348,7 +348,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data) - - k->realize = pci_pcnet_realize; - k->exit = pci_pcnet_uninit; -- k->romfile = "efi-pcnet.rom", -+ k->romfile = "pxe-pcnet.rom", - k->vendor_id = PCI_VENDOR_ID_AMD; - k->device_id = PCI_DEVICE_ID_AMD_LANCE; - k->revision = 0x10; ---- a/hw/net/rtl8139.c -+++ b/hw/net/rtl8139.c -@@ -3519,7 +3519,7 @@ static void rtl8139_class_init(ObjectClass *klass, void *data) - - k->realize = pci_rtl8139_realize; - k->exit = pci_rtl8139_uninit; -- k->romfile = "efi-rtl8139.rom"; -+ k->romfile = "pxe-rtl8139.rom"; - k->vendor_id = PCI_VENDOR_ID_REALTEK; - k->device_id = PCI_DEVICE_ID_REALTEK_8139; - k->revision = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */ ---- a/hw/ppc/Makefile.objs -+++ b/hw/ppc/Makefile.objs -@@ -8,7 +8,7 @@ ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) - obj-y += spapr_pci_vfio.o - endif - # PowerPC 4xx boards --obj-y += ppc405_boards.o ppc4xx_devs.o ppc405_uc.o ppc440_bamboo.o -+obj-y += ppc4xx_devs.o ppc405_uc.o - obj-y += ppc4xx_pci.o - # PReP - obj-$(CONFIG_PREP) += prep.o ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -1815,6 +1815,7 @@ static const TypeInfo spapr_machine_info = { - }, - }; - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - #define SPAPR_COMPAT_2_2 \ - {\ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,\ -@@ -1879,13 +1880,33 @@ static const TypeInfo spapr_machine_2_3_info = { - .parent = TYPE_SPAPR_MACHINE, - .class_init = spapr_machine_2_3_class_init, - }; -+#endif -+static void spapr_machine_rhel710_class_init(ObjectClass *oc, void *data) -+{ -+ MachineClass *mc = MACHINE_CLASS(oc); -+ -+ mc->name = "pseries-rhel7.1.0"; -+ mc->desc = "RHEL 7.1.0 pSeries Logical Partition (PAPR compliant)"; -+ mc->alias = "pseries"; -+ mc->is_default = 1; -+} -+ -+ -+static const TypeInfo spapr_machine_rhel710_info = { -+ .name = TYPE_SPAPR_MACHINE "RHEL7.1.0", -+ .parent = TYPE_SPAPR_MACHINE, -+ .class_init = spapr_machine_rhel710_class_init, -+}; - - static void spapr_machine_register_types(void) - { - type_register_static(&spapr_machine_info); -+/* - type_register_static(&spapr_machine_2_1_info); - type_register_static(&spapr_machine_2_2_info); - type_register_static(&spapr_machine_2_3_info); -+*/ -+ type_register_static(&spapr_machine_rhel710_info); - } - - type_init(spapr_machine_register_types) ---- a/hw/timer/i8254_common.c -+++ b/hw/timer/i8254_common.c -@@ -266,7 +266,7 @@ static const VMStateDescription vmstate_pit_common = { - .pre_save = pit_dispatch_pre_save, - .post_load = pit_dispatch_post_load, - .fields = (VMStateField[]) { -- VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3), -+ VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */ - VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2, - vmstate_pit_channel, PITChannelState), - VMSTATE_INT64(channels[0].next_transition_time, ---- a/hw/usb/hcd-uhci.c -+++ b/hw/usb/hcd-uhci.c -@@ -150,6 +150,8 @@ 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); -@@ -1199,12 +1201,23 @@ static void usb_uhci_common_realize(PCIDevice *dev, Error **errp) - UHCIState *s = DO_UPCAST(UHCIState, dev, dev); - uint8_t *pci_conf = s->dev.config; - int i; -+ int irq_pin; - - pci_conf[PCI_CLASS_PROG] = 0x00; - /* TODO: reset value should be 0. */ - pci_conf[USB_SBRN] = USB_RELEASE_1; // release number - -- pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1); -+ 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; -+ } -+ pci_config_set_interrupt_pin(pci_conf, irq_pin + 1); - - if (s->masterbus) { - USBPort *ports[NB_PORTS]; ---- a/hw/usb/hcd-xhci.c -+++ b/hw/usb/hcd-xhci.c -@@ -418,6 +418,8 @@ typedef struct XHCIEvent { - uint32_t flags; - uint8_t slotid; - uint8_t epid; -+ uint8_t cve_2014_5263_a; -+ uint8_t cve_2014_5263_b; - } XHCIEvent; - - typedef struct XHCIInterrupter { -@@ -3782,9 +3784,25 @@ static const VMStateDescription vmstate_xhci_slot = { - } - }; - -+static void xhci_event_pre_save(void *opaque) -+{ -+ XHCIEvent *s = opaque; -+ -+ s->cve_2014_5263_a = ((uint8_t *)&s->type)[0]; -+ s->cve_2014_5263_b = ((uint8_t *)&s->type)[1]; -+} -+ -+bool migrate_cve_2014_5263_xhci_fields; -+ -+static bool xhci_event_cve_2014_5263(void *opaque, int version_id) -+{ -+ return migrate_cve_2014_5263_xhci_fields; -+} -+ - static const VMStateDescription vmstate_xhci_event = { - .name = "xhci-event", - .version_id = 1, -+ .pre_save = xhci_event_pre_save, - .fields = (VMStateField[]) { - VMSTATE_UINT32(type, XHCIEvent), - VMSTATE_UINT32(ccode, XHCIEvent), -@@ -3793,6 +3811,8 @@ static const VMStateDescription vmstate_xhci_event = { - VMSTATE_UINT32(flags, XHCIEvent), - VMSTATE_UINT8(slotid, XHCIEvent), - VMSTATE_UINT8(epid, XHCIEvent), -+ VMSTATE_UINT8_TEST(cve_2014_5263_a, XHCIEvent, xhci_event_cve_2014_5263), -+ VMSTATE_UINT8_TEST(cve_2014_5263_b, XHCIEvent, xhci_event_cve_2014_5263), - VMSTATE_END_OF_LIST() - } - }; ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1383,7 +1383,7 @@ static void virtio_net_pci_class_init(ObjectClass *klass, void *data) - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - VirtioPCIClass *vpciklass = VIRTIO_PCI_CLASS(klass); - -- k->romfile = "efi-virtio.rom"; -+ k->romfile = "pxe-virtio.rom"; - k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; - k->device_id = PCI_DEVICE_ID_VIRTIO_NET; - k->revision = VIRTIO_PCI_ABI_VERSION; ---- a/include/hw/i386/pc.h -+++ b/include/hw/i386/pc.h -@@ -512,6 +512,76 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); - #define PC_DEFAULT_MACHINE_OPTIONS \ - PC_COMMON_MACHINE_OPTIONS, \ - .hot_add_cpu = pc_hot_add_cpu, \ -- .max_cpus = 255 -+ .max_cpus = 240 -+ -+/* -+ * 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. -+ */ -+ -+/* -+ * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_* -+ * between our base and 1.5, less stuff backported to RHEL-7.0 -+ * (usb-device.msos-desc), less stuff for devices we changed -+ * (qemu64-x86_64-cpu) or don't support (hpet, pci-serial-2x, -+ * pci-serial-4x) in 7.0. -+ */ -+#define PC_RHEL7_0_COMPAT \ -+ {\ -+ .driver = "virtio-scsi-pci",\ -+ .property = "any_layout",\ -+ .value = "off",\ -+ },{\ -+ .driver = "PIIX4_PM",\ -+ .property = "memory-hotplug-support",\ -+ .value = "off",\ -+ },{\ -+ .driver = "apic",\ -+ .property = "version",\ -+ .value = stringify(0x11),\ -+ },{\ -+ .driver = "nec-usb-xhci",\ -+ .property = "superspeed-ports-first",\ -+ .value = "off",\ -+ },{\ -+ .driver = "nec-usb-xhci",\ -+ .property = "force-pcie-endcap",\ -+ .value = "on",\ -+ },{\ -+ .driver = "pci-serial",\ -+ .property = "prog_if",\ -+ .value = stringify(0),\ -+ },{\ -+ .driver = "virtio-net-pci",\ -+ .property = "guest_announce",\ -+ .value = "off",\ -+ },{\ -+ .driver = "ICH9-LPC",\ -+ .property = "memory-hotplug-support",\ -+ .value = "off",\ -+ },{\ -+ .driver = "xio3130-downstream",\ -+ .property = COMPAT_PROP_PCP,\ -+ .value = "off",\ -+ },{\ -+ .driver = "ioh3420",\ -+ .property = COMPAT_PROP_PCP,\ -+ .value = "off",\ -+ },{\ -+ .driver = "PIIX4_PM",\ -+ .property = "acpi-pci-hotplug-with-bridge-support",\ -+ .value = "off",\ -+ },{\ -+ .driver = "e1000",\ -+ .property = "mitigation",\ -+ .value = "off",\ -+ },{ \ -+ .driver = "virtio-net-pci", \ -+ .property = "ctrl_guest_offloads", \ -+ .value = "off", \ -+ } - - #endif ---- a/include/hw/usb.h -+++ b/include/hw/usb.h -@@ -613,4 +613,11 @@ int usb_get_quirks(uint16_t vendor_id, uint16_t product_id, - uint8_t interface_class, uint8_t interface_subclass, - 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; -+ - #endif ---- a/include/sysemu/sysemu.h -+++ b/include/sysemu/sysemu.h -@@ -89,6 +89,7 @@ void qemu_savevm_state_complete(QEMUFile *f); - void qemu_savevm_state_cancel(void); - uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size); - int qemu_loadvm_state(QEMUFile *f); -+extern bool shadow_bios_after_incoming; - - typedef enum DisplayType - { ---- a/savevm.c -+++ b/savevm.c -@@ -35,6 +35,7 @@ - #include "migration/migration.h" - #include "qemu/sockets.h" - #include "qemu/queue.h" -+#include "qemu/rcu_queue.h" - #include "sysemu/cpus.h" - #include "exec/memory.h" - #include "qmp-commands.h" -@@ -51,6 +52,8 @@ - #define ARP_PTYPE_IP 0x0800 - #define ARP_OP_REQUEST_REV 0x3 - -+bool shadow_bios_after_incoming; -+ - static int announce_self_create(uint8_t *buf, - uint8_t *mac_addr) - { -@@ -929,6 +932,65 @@ typedef struct LoadStateEntry { - int version_id; - } LoadStateEntry; - -+static 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(); -+} -+ - int qemu_loadvm_state(QEMUFile *f) - { - QLIST_HEAD(, LoadStateEntry) loadvm_handlers = -@@ -1061,6 +1123,13 @@ int qemu_loadvm_state(QEMUFile *f) - g_free(buf); - } - -+ /* 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(); - - ret = 0; ---- a/target-i386/cpu.c -+++ b/target-i386/cpu.c -@@ -469,6 +469,7 @@ static uint32_t kvm_default_features[FEATURE_WORDS] = { - (1 << KVM_FEATURE_ASYNC_PF) | - (1 << KVM_FEATURE_STEAL_TIME) | - (1 << KVM_FEATURE_PV_EOI) | -+ (1 << KVM_FEATURE_PV_UNHALT) | - (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT), - [FEAT_1_ECX] = CPUID_EXT_X2APIC, - }; -@@ -675,24 +676,31 @@ struct X86CPUDefinition { - - static X86CPUDefinition builtin_x86_defs[] = { - { -+ /* qemu64 is the default CPU model for all *-rhel7.* machine-types. -+ * The default on RHEL-6 was cpu64-rhel6. -+ * libvirt assumes that qemu64 is the default for _all_ machine-types, -+ * so we should try to keep qemu64 and cpu64-rhel6 as similar as -+ * possible. -+ */ - .name = "qemu64", - .level = 4, - .vendor = CPUID_VENDOR_AMD, - .family = 6, -- .model = 6, -+ .model = 13, - .stepping = 3, -- .features[FEAT_1_EDX] = -- PPRO_FEATURES | -- CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA | -- CPUID_PSE36, -- .features[FEAT_1_ECX] = -- CPUID_EXT_SSE3 | CPUID_EXT_CX16 | CPUID_EXT_POPCNT, -- .features[FEAT_8000_0001_EDX] = -- (PPRO_FEATURES & CPUID_EXT2_AMD_ALIASES) | -- CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX, -- .features[FEAT_8000_0001_ECX] = -- CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | -- CPUID_EXT3_ABM | CPUID_EXT3_SSE4A, -+ .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | -+ CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | -+ CPUID_MCA | CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | -+ CPUID_CX8 | CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | -+ CPUID_PSE | CPUID_DE | CPUID_FP87, -+ .features[FEAT_1_ECX] = CPUID_EXT_CX16 | CPUID_EXT_SSE3, -+ .features[FEAT_8000_0001_EDX] = CPUID_EXT2_LM | CPUID_EXT2_FXSR | -+ CPUID_EXT2_MMX | CPUID_EXT2_NX | CPUID_EXT2_PAT | CPUID_EXT2_CMOV | -+ CPUID_EXT2_PGE | CPUID_EXT2_SYSCALL | CPUID_EXT2_APIC | -+ CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR | CPUID_EXT2_TSC | -+ CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU, -+ .features[FEAT_8000_0001_ECX] = CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | -+ CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, - .xlevel = 0x8000000A, - }, - { -@@ -920,6 +928,29 @@ static X86CPUDefinition builtin_x86_defs[] = { - .model_id = "Intel(R) Atom(TM) CPU N270 @ 1.60GHz", - }, - { -+ .name = "cpu64-rhel6", -+ .level = 4, -+ .vendor = CPUID_VENDOR_AMD, -+ .family = 6, -+ .model = 13, -+ .stepping = 3, -+ .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | -+ CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | -+ CPUID_MCA | CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | -+ CPUID_CX8 | CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | -+ CPUID_PSE | CPUID_DE | CPUID_FP87, -+ .features[FEAT_1_ECX] = CPUID_EXT_CX16 | CPUID_EXT_SSE3, -+ .features[FEAT_8000_0001_EDX] = CPUID_EXT2_LM | CPUID_EXT2_FXSR | -+ CPUID_EXT2_MMX | CPUID_EXT2_NX | CPUID_EXT2_PAT | CPUID_EXT2_CMOV | -+ CPUID_EXT2_PGE | CPUID_EXT2_SYSCALL | CPUID_EXT2_APIC | -+ CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR | CPUID_EXT2_TSC | -+ CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU, -+ .features[FEAT_8000_0001_ECX] = CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | -+ CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, -+ .xlevel = 0x8000000A, -+ .model_id = "QEMU Virtual CPU version (cpu64-rhel6)", -+ }, -+ { - .name = "Conroe", - .level = 4, - .vendor = CPUID_VENDOR_INTEL, ---- a/target-i386/machine.c -+++ b/target-i386/machine.c -@@ -708,6 +708,25 @@ static const VMStateDescription vmstate_xss = { - } - }; - -+static bool vmstate_xsave_needed(void *opaque) -+{ -+ /* The xsave state is already on the main "cpu" section */ -+ return false; -+} -+ -+static const VMStateDescription vmstate_xsave ={ -+ .name = "cpu/xsave", -+ .version_id = 1, -+ .minimum_version_id = 1, -+ .minimum_version_id_old = 1, -+ .fields = (VMStateField []) { -+ VMSTATE_UINT64_V(env.xcr0, X86CPU, 1), -+ VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 1), -+ VMSTATE_YMMH_REGS_VARS(env.xmm_regs, X86CPU, CPU_NB_REGS, 1), -+ VMSTATE_END_OF_LIST() -+ } -+}; -+ - VMStateDescription vmstate_x86_cpu = { - .name = "cpu", - .version_id = 12, -@@ -857,6 +876,9 @@ VMStateDescription vmstate_x86_cpu = { - .vmsd = &vmstate_xss, - .needed = xss_needed, - } , { -+ .vmsd = &vmstate_xsave, -+ .needed = vmstate_xsave_needed, -+ }, { - /* empty */ - } - } diff --git a/SOURCES/kvm-misc-Add-pc-i440fx-rhel7-2-0-machine-type.patch b/SOURCES/kvm-misc-Add-pc-i440fx-rhel7-2-0-machine-type.patch deleted file mode 100644 index e954a0c..0000000 --- a/SOURCES/kvm-misc-Add-pc-i440fx-rhel7-2-0-machine-type.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 9dba3a5128ff087a33db4d83db1647aa22efc91d Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Fri, 10 Apr 2015 16:43:18 +0200 -Subject: Add pc-i440fx-rhel7.2.0 machine type - -Message-id: <1428684199-19029-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 64794 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/2] Add pc-i440fx-rhel7.2.0 machine type -Bugzilla: 1210050 -RH-Acked-by: Bandan Das <bsd@redhat.com> -RH-Acked-by: John Snow <jsnow@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -There are a bunch of changes between 2.1 and 2.3 -that mean we need a new machine type; add it and -add compatibility settings for the older machine -types. - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c -index 899d277..49a8a12 100644 ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -1001,7 +1001,7 @@ machine_init(pc_machine_init); - - /* Red Hat Enterprise Linux machine types */ - --static void pc_compat_rhel710(MachineState *machine) -+static void pc_compat_rhel720(MachineState *machine) - { - /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it - * on AMD CPU models. -@@ -1018,6 +1018,64 @@ static void pc_compat_rhel710(MachineState *machine) - CPUID_EXT2_RDTSCP); - } - -+static void pc_init_rhel720(MachineState *machine) -+{ -+ pc_compat_rhel720(machine); -+ pc_init_pci(machine); -+} -+ -+static QEMUMachine pc_machine_rhel720 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_piix_Y", -+ .name = "pc-i440fx-rhel7.2.0", -+ .alias = "pc", -+ .desc = "RHEL 7.2.0 PC (i440FX + PIIX, 1996)", -+ .init = pc_init_rhel720, -+ .is_default = 1, -+ .default_machine_opts = "firmware=bios-256k.bin", -+ .default_display = "std", -+ .compat_props = (GlobalProperty[]) { -+ { /* end of list */ } -+ }, -+}; -+ -+static void pc_compat_rhel710(MachineState *machine) -+{ -+ PCMachineState *pcms = PC_MACHINE(machine); -+ -+ /* 7.1.0 is based on 2.1.2, 7.2.0 is based on 2.3 */ -+ pc_compat_rhel720(machine); -+ -+ /* From pc_compat_2_2 */ -+ rsdp_in_ram = false; -+ x86_cpu_compat_set_features("kvm64", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("kvm32", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Conroe", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Penryn", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Nehalem", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Westmere", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("SandyBridge", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Haswell", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Broadwell", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G1", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_F16C); -+ x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND); -+ x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C); -+ x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND); -+ machine->suppress_vmdesc = true; -+ -+ /* From pc_compat_2_1 */ -+ smbios_uuid_encoded = false; -+ x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0); -+ x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0); -+ x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM); -+ pcms->enforce_aligned_dimm = false; -+} -+ - static void pc_init_rhel710(MachineState *machine) - { - pc_compat_rhel710(machine); -@@ -1028,12 +1086,11 @@ static QEMUMachine pc_machine_rhel710 = { - PC_DEFAULT_MACHINE_OPTIONS, - .family = "pc_piix_Y", - .name = "pc-i440fx-rhel7.1.0", -- .alias = "pc", - .desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)", - .init = pc_init_rhel710, -- .is_default = 1, - .default_machine_opts = "firmware=bios-256k.bin", - .compat_props = (GlobalProperty[]) { -+ PC_RHEL7_1_COMPAT, - { /* end of list */ } - }, - }; -@@ -1562,6 +1619,7 @@ static QEMUMachine pc_machine_rhel600 = { - - static void rhel_machine_init(void) - { -+ qemu_register_pc_machine(&pc_machine_rhel720); - qemu_register_pc_machine(&pc_machine_rhel710); - qemu_register_pc_machine(&pc_machine_rhel700); - qemu_register_pc_machine(&pc_machine_rhel660); -diff --git a/include/hw/compat.h b/include/hw/compat.h -index 313682a..88076f5 100644 ---- a/include/hw/compat.h -+++ b/include/hw/compat.h -@@ -32,4 +32,34 @@ - .value = "on",\ - } - -+/* Mostly like HW_COMPAT_2_1 but: -+ * we don't need virtio-scsi-pci since 7.0 already had that on -+ */ -+#define HW_COMPAT_RHEL7_1 \ -+ {\ -+ .driver = "intel-hda",\ -+ .property = "old_msi_addr",\ -+ .value = "on",\ -+ },{\ -+ .driver = "VGA",\ -+ .property = "qemu-extended-regs",\ -+ .value = "off",\ -+ },{\ -+ .driver = "secondary-vga",\ -+ .property = "qemu-extended-regs",\ -+ .value = "off",\ -+ },{\ -+ .driver = "usb-mouse",\ -+ .property = "usb_version",\ -+ .value = stringify(1),\ -+ },{\ -+ .driver = "usb-kbd",\ -+ .property = "usb_version",\ -+ .value = stringify(1),\ -+ },{\ -+ .driver = "virtio-pci",\ -+ .property = "virtio-pci-bus-master-bug-migration",\ -+ .value = "on",\ -+ } -+ - #endif /* HW_COMPAT_H */ -diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h -index d3ba376..bcb97ad 100644 ---- a/include/hw/i386/pc.h -+++ b/include/hw/i386/pc.h -@@ -522,6 +522,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); - * in pc_piix.c. - */ - -+/* See include/hw/compat.h for shared compatibility lists */ -+#define PC_RHEL7_1_COMPAT \ -+ HW_COMPAT_RHEL7_1 -+ - /* - * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_* - * between our base and 1.5, less stuff backported to RHEL-7.0 -@@ -530,6 +534,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); - * pci-serial-4x) in 7.0. - */ - #define PC_RHEL7_0_COMPAT \ -+ PC_RHEL7_1_COMPAT,\ - {\ - .driver = "virtio-scsi-pci",\ - .property = "any_layout",\ diff --git a/SOURCES/kvm-misc-Add-pc-q35-rhel7-2-0-machine-type.patch b/SOURCES/kvm-misc-Add-pc-q35-rhel7-2-0-machine-type.patch deleted file mode 100644 index 5237830..0000000 --- a/SOURCES/kvm-misc-Add-pc-q35-rhel7-2-0-machine-type.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 1c88ffac9ddc09b6d81111071e8be722ac43665f Mon Sep 17 00:00:00 2001 -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> -Date: Fri, 10 Apr 2015 16:43:19 +0200 -Subject: Add pc-q35-rhel7.2.0 machine type - -Message-id: <1428684199-19029-3-git-send-email-dgilbert@redhat.com> -Patchwork-id: 64795 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 2/2] Add pc-q35-rhel7.2.0 machine type -Bugzilla: 1210050 -RH-Acked-by: Bandan Das <bsd@redhat.com> -RH-Acked-by: John Snow <jsnow@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> - -Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index f2f99d9..44d5138 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -523,7 +523,7 @@ machine_init(pc_q35_machine_init); - - /* Red Hat Enterprise Linux machine types */ - --static void pc_q35_compat_rhel710(MachineState *machine) -+static void pc_q35_compat_rhel720(MachineState *machine) - { - /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it - * on AMD CPU models. -@@ -540,6 +540,63 @@ static void pc_q35_compat_rhel710(MachineState *machine) - CPUID_EXT2_RDTSCP); - } - -+static void pc_q35_init_rhel720(MachineState *machine) -+{ -+ pc_q35_compat_rhel720(machine); -+ pc_q35_init(machine); -+} -+ -+static QEMUMachine pc_q35_machine_rhel720 = { -+ PC_DEFAULT_MACHINE_OPTIONS, -+ .family = "pc_q35_Z", -+ .name = "pc-q35-rhel7.2.0", -+ .alias = "q35", -+ .desc = "RHEL-7.2.0 PC (Q35 + ICH9, 2009)", -+ .init = pc_q35_init_rhel720, -+ .default_machine_opts = "firmware=bios-256k.bin", -+ .default_display = "std", -+ .compat_props = (GlobalProperty[]) { -+ { /* end of list */ } -+ }, -+}; -+ -+static void pc_q35_compat_rhel710(MachineState *machine) -+{ -+ PCMachineState *pcms = PC_MACHINE(machine); -+ -+ /* 7.1.0 is based on 2.1.2, 7.2.0 is based on 2.3 */ -+ pc_q35_compat_rhel720(machine); -+ -+ /* From pc_compat_2_2 */ -+ rsdp_in_ram = false; -+ x86_cpu_compat_set_features("kvm64", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("kvm32", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Conroe", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Penryn", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Nehalem", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Westmere", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("SandyBridge", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Haswell", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Broadwell", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G1", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G2", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G3", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G4", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Opteron_G5", FEAT_1_EDX, 0, CPUID_VME); -+ x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_F16C); -+ x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND); -+ x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C); -+ x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND); -+ machine->suppress_vmdesc = true; -+ -+ /* From pc_compat_2_1 */ -+ pcms->enforce_aligned_dimm = false; -+ smbios_uuid_encoded = false; -+ x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0); -+ x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0); -+ x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM); -+} -+ - static void pc_q35_init_rhel710(MachineState *machine) - { - pc_q35_compat_rhel710(machine); -@@ -550,11 +607,11 @@ static QEMUMachine pc_q35_machine_rhel710 = { - PC_DEFAULT_MACHINE_OPTIONS, - .family = "pc_q35_Z", - .name = "pc-q35-rhel7.1.0", -- .alias = "q35", - .desc = "RHEL-7.1.0 PC (Q35 + ICH9, 2009)", - .init = pc_q35_init_rhel710, - .default_machine_opts = "firmware=bios-256k.bin", - .compat_props = (GlobalProperty[]) { -+ HW_COMPAT_RHEL7_1, - { /* end of list */ } - }, - }; -@@ -603,6 +660,7 @@ static QEMUMachine pc_q35_machine_rhel700 = { - - static void rhel_pc_q35_machine_init(void) - { -+ qemu_register_pc_machine(&pc_q35_machine_rhel720); - qemu_register_pc_machine(&pc_q35_machine_rhel710); - qemu_register_pc_machine(&pc_q35_machine_rhel700); - } diff --git a/SOURCES/kvm-misc-Add-redhat-directory-and-disable-unsupported-devices.patch b/SOURCES/kvm-misc-Add-redhat-directory-and-disable-unsupported-devices.patch deleted file mode 100644 index 17a635c..0000000 --- a/SOURCES/kvm-misc-Add-redhat-directory-and-disable-unsupported-devices.patch +++ /dev/null @@ -1,196 +0,0 @@ ---- /dev/null -+++ b/.gitpublish -@@ -0,0 +1,17 @@ -+# The default profile, rhev -+[gitpublishprofile "rhev"] -+base = rhev7/master-2.2.0 -+prefix = RHEV-7.2 qemu-kvm-rhev PATCH -+to = rhvirt-patches@redhat.com -+suppresscc = all -+message = True -+ -+# Special project, Acadia, for aarm64 architecture. -+[gitpublishprofile "acadia"] -+base = rhev7/master-2.2.0 -+prefix = RHELSA qemu-kvm-rhev PATCH -+to = rhvirt-patches@redhat.com -+cc = virt-arm@redhat.com -+suppresscc = all -+message = True -+ ---- a/Makefile -+++ b/Makefile -@@ -366,7 +366,7 @@ install-doc: $(DOCS) - $(INSTALL_DATA) qmp-commands.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" - ifneq ($(TOOLS),) - $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1" - $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" ---- a/configure -+++ b/configure -@@ -335,8 +335,10 @@ tpm="yes" - libssh2="" - vhdx="" - quorum="" -+live_block_migration="no" - numa="" - -+ - # parse CC options first - for opt do - optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` -@@ -1134,6 +1136,10 @@ for opt do - ;; - --enable-numa) numa="yes" - ;; -+ --disable-live-block-migration) live_block_migration="no" -+ ;; -+ --enable-live-block-migration) live_block_migration="yes" -+ ;; - *) - echo "ERROR: unknown option $opt" - echo "Try '$0 --help' for more information" -@@ -1405,6 +1411,8 @@ Advanced options (experts only): - --enable-vhdx enable support for the Microsoft VHDX image format - --disable-quorum disable quorum block filter support - --enable-quorum enable quorum block filter support -+ --disable-live-block-migration disable live block migration -+ --enable-live-block-migration enable live block migration - --disable-numa disable libnuma support - --enable-numa enable libnuma support - -@@ -4440,6 +4448,7 @@ echo "Quorum $quorum" - echo "lzo support $lzo" - echo "snappy support $snappy" - echo "bzip2 support $bzip2" -+echo "Live block migration $live_block_migration" - echo "NUMA host support $numa" - - if test "$sdl_too_old" = "yes"; then -@@ -4907,6 +4916,10 @@ if test "$vhdx" = "yes" ; then - echo "CONFIG_VHDX=y" >> $config_host_mak - fi - -+if test "$live_block_migration" = "yes" ; then -+ echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak -+fi -+ - # USB host support - if test "$libusb" = "yes"; then - echo "HOST_USB=libusb legacy" >> $config_host_mak ---- a/migration/migration.c -+++ b/migration/migration.c -@@ -455,6 +455,13 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, - params.blk = has_blk && blk; - params.shared = has_inc && inc; - -+#ifndef CONFIG_LIVE_BLOCK_MIGRATION -+ if (params.blk || params.shared) { -+ error_set(errp, QERR_UNSUPPORTED); -+ return; -+ } -+#endif -+ - if (s->state == MIGRATION_STATUS_ACTIVE || - s->state == MIGRATION_STATUS_SETUP || - s->state == MIGRATION_STATUS_CANCELLING) { ---- a/os-posix.c -+++ b/os-posix.c -@@ -79,7 +79,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) - { ---- a/scripts/qemu-guest-agent/fsfreeze-hook -+++ b/scripts/qemu-guest-agent/fsfreeze-hook -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/bin/bash - - # This script is executed when a guest agent receives fsfreeze-freeze and - # fsfreeze-thaw command, if it is specified in --fsfreeze-hook (-F) -@@ -7,8 +7,7 @@ - # "freeze" argument before the filesystem is frozen. And for fsfreeze-thaw - # request, it is issued with "thaw" argument after filesystem is thawed. - --LOGFILE=/var/log/qga-fsfreeze-hook.log --FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d -+LOGFILE=/var/log/qemu-ga/fsfreeze-hook.log - - # Check whether file $1 is a backup or rpm-generated file and should be ignored - is_ignored_file() { -@@ -19,15 +18,26 @@ is_ignored_file() { - return 1 - } - --# Iterate executables in directory "fsfreeze-hook.d" with the specified args --[ ! -d "$FSFREEZE_D" ] && exit 0 --for file in "$FSFREEZE_D"/* ; do -- is_ignored_file "$file" && continue -- [ -x "$file" ] || continue -- printf "$(date): execute $file $@\n" >>$LOGFILE -- "$file" "$@" >>$LOGFILE 2>&1 -+shopt -s nullglob -+RELPATH=qemu-ga/fsfreeze-hook.d -+ -+for DIR in lib etc run; do -+ for FILE in /"$DIR/$RELPATH"/*; do -+ if is_ignored_file "$FILE" || ! [ -x "$FILE" ]; then -+ continue -+ fi -+ BNAME=$(basename -- "$FILE") -+ if ( [ lib = "$DIR" ] && ( [ -e /etc/"$RELPATH/$BNAME" ] || -+ [ -e /run/"$RELPATH/$BNAME" ] ) ) || -+ ( [ etc = "$DIR" ] && ( [ -e /run/"$RELPATH/$BNAME" ] ) ); then -+ continue -+ fi -+ -+ printf "$(date): execute $FILE $@\n" >>$LOGFILE -+ "$FILE" "$@" >>$LOGFILE 2>&1 - STATUS=$? -- printf "$(date): $file finished with status=$STATUS\n" >>$LOGFILE -+ printf "$(date): $FILE finished with status=$STATUS\n" >>$LOGFILE -+ done - done - - exit 0 ---- a/stubs/Makefile.objs -+++ b/stubs/Makefile.objs -@@ -39,3 +39,4 @@ stub-obj-$(CONFIG_WIN32) += fd-register.o - stub-obj-y += cpus.o - stub-obj-y += kvm.o - stub-obj-y += qmp_pc_dimm_device_list.o -+stub-obj-y += ide-isa.o ---- /dev/null -+++ b/stubs/ide-isa.c -@@ -0,0 +1,12 @@ -+#include <hw/ide.h> -+#include <stdlib.h> -+ -+ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, -+ DriveInfo *hd0, DriveInfo *hd1) -+{ -+ /* -+ * In theory the real isa_ide_init() function can return NULL, but no -+ * caller actually checks for that. Make sure we go out with a clear bang. -+ */ -+ abort(); -+} ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -3630,7 +3630,7 @@ void vnc_display_open(const char *id, Error **errp) - vnc_display_setup_auth(vs, password, sasl, tls, x509, websocket); - - #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; diff --git a/SOURCES/kvm-misc-Add-support-statement-to-help-output.patch b/SOURCES/kvm-misc-Add-support-statement-to-help-output.patch deleted file mode 100644 index bc5b210..0000000 --- a/SOURCES/kvm-misc-Add-support-statement-to-help-output.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 104f48eb1635e6883489d1f9287bf4ad9041615d 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> - -Bugzilla: 972773 -Brew scratch build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6676272 - -Add support statement to -help output, reporting direct qemu-kvm usage -as unsupported by Red Hat, and advising users to use libvirt instead. - -Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> - -diff --git a/vl.c b/vl.c -index 3d72d21..29c9373 100644 ---- a/vl.c -+++ b/vl.c -@@ -1807,9 +1807,17 @@ static void version(void) - printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\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()); -@@ -1824,6 +1832,7 @@ static void help(int exitcode) - "\n" - "When using -nographic, press 'ctrl-a h' to get some help.\n"); - -+ print_rh_warning(); - exit(exitcode); - } - diff --git a/SOURCES/kvm-misc-Enable-disable-devices-for-RHEL-7.patch b/SOURCES/kvm-misc-Enable-disable-devices-for-RHEL-7.patch deleted file mode 100644 index a446b85..0000000 --- a/SOURCES/kvm-misc-Enable-disable-devices-for-RHEL-7.patch +++ /dev/null @@ -1,805 +0,0 @@ ---- a/default-configs/aarch64-softmmu.mak -+++ b/default-configs/aarch64-softmmu.mak -@@ -1,6 +1,11 @@ - # Default configuration for aarch64-softmmu -- --# We support all the 32 bit boards so need all their config --include arm-softmmu.mak -- --# Currently no 64-bit specific config requirements -+CONFIG_PCI=y -+CONFIG_VIRTIO_PCI=y -+CONFIG_VIRTIO=y -+CONFIG_STELLARIS=y -+CONFIG_ARM_GIC=y -+CONFIG_ARM_GIC_KVM=$(CONFIG_KVM) -+CONFIG_PL011=y -+CONFIG_PL031=y -+CONFIG_PFLASH_CFI01=y -+CONFIG_PCI_GENERIC=y ---- a/default-configs/arm-softmmu.mak -+++ b/default-configs/arm-softmmu.mak -@@ -77,7 +77,6 @@ CONFIG_TUSB6010=y - CONFIG_IMX=y - CONFIG_MAINSTONE=y - CONFIG_NSERIES=y --CONFIG_REALVIEW=y - CONFIG_ZAURUS=y - CONFIG_ZYNQ=y - CONFIG_STM32F2XX_TIMER=y -@@ -85,9 +84,6 @@ CONFIG_STM32F2XX_USART=y - CONFIG_STM32F2XX_SYSCFG=y - CONFIG_STM32F205_SOC=y - --CONFIG_VERSATILE_PCI=y --CONFIG_VERSATILE_I2C=y -- - CONFIG_PCI_GENERIC=y - - CONFIG_SDHCI=y ---- a/default-configs/i386-softmmu.mak -+++ b/default-configs/i386-softmmu.mak -@@ -19,7 +19,6 @@ CONFIG_APM=y - CONFIG_I8257=y - CONFIG_IDE_ISA=y - CONFIG_IDE_PIIX=y --CONFIG_NE2000_ISA=y - CONFIG_PIIX_PCI=y - CONFIG_HPET=y - CONFIG_APPLESMC=y -@@ -31,6 +30,7 @@ CONFIG_PAM=y - CONFIG_PCI_PIIX=y - CONFIG_WDT_IB700=y - CONFIG_XEN_I386=$(CONFIG_XEN) -+CONFIG_ISA_BUS=y - CONFIG_ISA_DEBUG=y - CONFIG_ISA_TESTDEV=y - CONFIG_VMPORT=y ---- a/default-configs/mips-softmmu.mak -+++ b/default-configs/mips-softmmu.mak -@@ -20,7 +20,6 @@ CONFIG_I8257=y - CONFIG_PIIX4=y - CONFIG_IDE_ISA=y - CONFIG_IDE_PIIX=y --CONFIG_NE2000_ISA=y - CONFIG_RC4030=y - CONFIG_DP8393X=y - CONFIG_DS1225Y=y ---- a/default-configs/mips64-softmmu.mak -+++ b/default-configs/mips64-softmmu.mak -@@ -20,7 +20,6 @@ CONFIG_I8257=y - CONFIG_PIIX4=y - CONFIG_IDE_ISA=y - CONFIG_IDE_PIIX=y --CONFIG_NE2000_ISA=y - CONFIG_RC4030=y - CONFIG_DP8393X=y - CONFIG_DS1225Y=y ---- a/default-configs/mips64el-softmmu.mak -+++ b/default-configs/mips64el-softmmu.mak -@@ -21,7 +21,6 @@ CONFIG_PIIX4=y - CONFIG_IDE_ISA=y - CONFIG_IDE_PIIX=y - CONFIG_IDE_VIA=y --CONFIG_NE2000_ISA=y - CONFIG_RC4030=y - CONFIG_DP8393X=y - CONFIG_DS1225Y=y ---- a/default-configs/mipsel-softmmu.mak -+++ b/default-configs/mipsel-softmmu.mak -@@ -20,7 +20,6 @@ CONFIG_I8257=y - CONFIG_PIIX4=y - CONFIG_IDE_ISA=y - CONFIG_IDE_PIIX=y --CONFIG_NE2000_ISA=y - CONFIG_RC4030=y - CONFIG_DP8393X=y - CONFIG_DS1225Y=y ---- a/default-configs/pci.mak -+++ b/default-configs/pci.mak -@@ -2,34 +2,20 @@ CONFIG_PCI=y - CONFIG_VIRTIO_PCI=y - CONFIG_VIRTIO=y - CONFIG_USB_UHCI=y --CONFIG_USB_OHCI=y - CONFIG_USB_EHCI=y - CONFIG_USB_XHCI=y --CONFIG_NE2000_PCI=y --CONFIG_EEPRO100_PCI=y --CONFIG_PCNET_PCI=y --CONFIG_PCNET_COMMON=y - CONFIG_AC97=y - CONFIG_HDA=y --CONFIG_ES1370=y --CONFIG_LSI_SCSI_PCI=y --CONFIG_VMW_PVSCSI_SCSI_PCI=y --CONFIG_MEGASAS_SCSI_PCI=y - CONFIG_RTL8139_PCI=y - CONFIG_E1000_PCI=y --CONFIG_VMXNET3_PCI=y - CONFIG_IDE_CORE=y - CONFIG_IDE_QDEV=y - CONFIG_IDE_PCI=y - CONFIG_AHCI=y --CONFIG_ESP=y --CONFIG_ESP_PCI=y - CONFIG_SERIAL=y - CONFIG_SERIAL_PCI=y --CONFIG_IPACK=y - CONFIG_WDT_IB6300ESB=y - CONFIG_PCI_TESTDEV=y --CONFIG_NVME_PCI=y - CONFIG_SD=y - CONFIG_SDHCI=y - CONFIG_EDU=y ---- a/default-configs/ppc-softmmu.mak -+++ b/default-configs/ppc-softmmu.mak -@@ -31,7 +31,6 @@ CONFIG_PPCE500_PCI=y - CONFIG_IDE_ISA=y - CONFIG_IDE_CMD646=y - CONFIG_IDE_MACIO=y --CONFIG_NE2000_ISA=y - CONFIG_PFLASH_CFI01=y - CONFIG_PFLASH_CFI02=y - CONFIG_PTIMER=y ---- a/default-configs/ppc64-softmmu.mak -+++ b/default-configs/ppc64-softmmu.mak -@@ -1,49 +1,28 @@ - # Default configuration for ppc64-softmmu - --include pci.mak -+# PCI configuration - cut down from the defaults in pci.mak -+CONFIG_PCI=y -+CONFIG_VIRTIO_PCI=y -+CONFIG_VIRTIO=y -+CONFIG_USB_EHCI=y -+CONFIG_USB_XHCI=y -+CONFIG_WDT_IB6300ESB=y -+CONFIG_PCI_TESTDEV=y -+ - include sound.mak - include usb.mak -+CONFIG_ISA_BUS=y - CONFIG_ISA_MMIO=y --CONFIG_ESCC=y --CONFIG_M48T59=y -+CONFIG_VGA=y -+CONFIG_VGA_PCI=y - CONFIG_SERIAL=y --CONFIG_PARALLEL=y --CONFIG_I8254=y --CONFIG_PCKBD=y --CONFIG_FDC=y --CONFIG_I8257=y --CONFIG_I82374=y --CONFIG_OPENPIC=y --CONFIG_I82378=y --CONFIG_PC87312=y --CONFIG_MACIO=y --CONFIG_PCSPK=y --CONFIG_CUDA=y --CONFIG_ADB=y --CONFIG_MAC_NVRAM=y --CONFIG_MAC_DBDMA=y --CONFIG_HEATHROW_PIC=y --CONFIG_GRACKLE_PCI=y --CONFIG_UNIN_PCI=y --CONFIG_DEC_PCI=y --CONFIG_PPCE500_PCI=y --CONFIG_IDE_ISA=y --CONFIG_IDE_CMD646=y --CONFIG_IDE_MACIO=y --CONFIG_NE2000_ISA=y --CONFIG_PFLASH_CFI01=y --CONFIG_PFLASH_CFI02=y --CONFIG_PTIMER=y - CONFIG_I8259=y --CONFIG_OPENPIC=y - CONFIG_PSERIES=y --CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM)) - CONFIG_PLATFORM_BUS=y --CONFIG_ETSEC=y - CONFIG_LIBDECNUMBER=y -+CONFIG_USB_OHCI=y - # For pSeries - CONFIG_XICS=$(CONFIG_PSERIES) - CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) --# For PReP --CONFIG_MC146818RTC=y -+CONFIG_I8259=y - CONFIG_ISA_TESTDEV=y ---- a/default-configs/ppcemb-softmmu.mak -+++ b/default-configs/ppcemb-softmmu.mak -@@ -7,6 +7,19 @@ CONFIG_M48T59=y - CONFIG_SERIAL=y - CONFIG_I8257=y - CONFIG_OPENPIC=y -+CONFIG_MACIO=y -+CONFIG_CUDA=y -+CONFIG_ADB=y -+CONFIG_MAC_NVRAM=y -+CONFIG_MAC_DBDMA=y -+CONFIG_HEATHROW_PIC=y -+CONFIG_GRACKLE_PCI=y -+CONFIG_UNIN_PCI=y -+CONFIG_DEC_PCI=y -+CONFIG_PPCE500_PCI=y -+CONFIG_IDE_ISA=y -+CONFIG_IDE_CMD646=y -+CONFIG_IDE_MACIO=y - CONFIG_PFLASH_CFI01=y - CONFIG_PFLASH_CFI02=y - CONFIG_PTIMER=y ---- a/default-configs/sound.mak -+++ b/default-configs/sound.mak -@@ -1,4 +0,0 @@ --CONFIG_SB16=y --CONFIG_ADLIB=y --CONFIG_GUS=y --CONFIG_CS4231A=y ---- a/default-configs/usb.mak -+++ b/default-configs/usb.mak -@@ -1,10 +1,3 @@ - CONFIG_USB=y --CONFIG_USB_TABLET_WACOM=y - CONFIG_USB_STORAGE_BOT=y --CONFIG_USB_STORAGE_UAS=y --CONFIG_USB_STORAGE_MTP=y - CONFIG_USB_SMARTCARD=y --CONFIG_USB_AUDIO=y --CONFIG_USB_SERIAL=y --CONFIG_USB_NETWORK=y --CONFIG_USB_BLUETOOTH=y ---- a/default-configs/x86_64-softmmu.mak -+++ b/default-configs/x86_64-softmmu.mak -@@ -4,12 +4,10 @@ include pci.mak - include sound.mak - include usb.mak - CONFIG_QXL=$(CONFIG_SPICE) --CONFIG_VGA_ISA=y -+CONFIG_VGA_PCI=y - CONFIG_VGA_CIRRUS=y --CONFIG_VMWARE_VGA=y - CONFIG_VMMOUSE=y - CONFIG_SERIAL=y --CONFIG_PARALLEL=y - CONFIG_I8254=y - CONFIG_PCSPK=y - CONFIG_PCKBD=y -@@ -17,12 +15,8 @@ CONFIG_FDC=y - CONFIG_ACPI=y - CONFIG_APM=y - CONFIG_I8257=y --CONFIG_IDE_ISA=y - CONFIG_IDE_PIIX=y --CONFIG_NE2000_ISA=y - CONFIG_PIIX_PCI=y --CONFIG_HPET=y --CONFIG_APPLESMC=y - CONFIG_I8259=y - CONFIG_PFLASH_CFI01=y - CONFIG_TPM_TIS=$(CONFIG_TPM) -@@ -31,6 +25,7 @@ CONFIG_PAM=y - CONFIG_PCI_PIIX=y - CONFIG_WDT_IB700=y - CONFIG_XEN_I386=$(CONFIG_XEN) -+CONFIG_ISA_BUS=y - CONFIG_ISA_DEBUG=y - CONFIG_ISA_TESTDEV=y - CONFIG_VMPORT=y ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -99,7 +99,12 @@ typedef struct { - bool secure; - } VirtMachineState; - -+#if 0 - #define TYPE_VIRT_MACHINE "virt" -+#endif /* disabled for RHELSA */ -+ -+#define TYPE_VIRT_MACHINE "virt-rhelsa7.2" -+ - #define VIRT_MACHINE(obj) \ - OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE) - #define VIRT_MACHINE_GET_CLASS(obj) \ -@@ -894,22 +899,43 @@ static void machvirt_machine_init(void) - machine_init(machvirt_machine_init); - #endif /* disabled for RHELSA */ - --static QEMUMachine aarch64_machine_rhelsa710 = { -- .family = "virt-rhelsa-Z", -- .name = "virt-rhelsa7.1", -- .alias = "virt", -- .desc = "RHELSA 7.1 ARM Virtual Machine", -- .init = machvirt_init, -- .is_default = 1, -- .max_cpus = 8, -- .compat_props = (GlobalProperty[]) { -- { /* end of list */ } -- }, -+static void rhelsa720_virt_instance_init(Object *obj) -+{ -+ VirtMachineState *vms = VIRT_MACHINE(obj); -+ -+ /* EL3 is disabled by default on RHELSA virt */ -+ vms->secure = false; -+} -+ -+static void rhelsa720_virt_class_init(ObjectClass *oc, void *data) -+{ -+ MachineClass *mc = MACHINE_CLASS(oc); -+ static GlobalProperty rhelsa720_compat_props[] = { -+ { /* end of list */ } -+ }; -+ -+ mc->family = "virt-rhelsa-Z"; -+ mc->name = TYPE_VIRT_MACHINE; -+ mc->desc = "RHELSA 7.2 ARM Virtual Machine"; -+ mc->alias = "virt"; -+ mc->init = machvirt_init; -+ mc->max_cpus = 8; -+ mc->is_default = 1; -+ mc->compat_props = rhelsa720_compat_props; -+} -+ -+static const TypeInfo rhelsa720_machvirt_info = { -+ .name = TYPE_VIRT_MACHINE, -+ .parent = TYPE_MACHINE, -+ .instance_size = sizeof(VirtMachineState), -+ .instance_init = rhelsa720_virt_instance_init, -+ .class_size = sizeof(VirtMachineClass), -+ .class_init = rhelsa720_virt_class_init, - }; - --static void rhelsa_machine_init(void) -+static void rhelsa720_machvirt_init(void) - { -- qemu_register_machine(&aarch64_machine_rhelsa710); -+ type_register_static(&rhelsa720_machvirt_info); - } - --machine_init(rhelsa_machine_init); -+machine_init(rhelsa720_machvirt_init); ---- a/hw/char/serial-pci.c -+++ b/hw/char/serial-pci.c -@@ -223,6 +223,8 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) - dc->vmsd = &vmstate_pci_multi_serial; - dc->props = multi_2x_serial_pci_properties; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->cannot_instantiate_with_device_add_yet = true; - } - - static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) -@@ -238,6 +240,8 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) - dc->vmsd = &vmstate_pci_multi_serial; - dc->props = multi_4x_serial_pci_properties; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->cannot_instantiate_with_device_add_yet = true; - } - - static const TypeInfo serial_pci_info = { ---- a/hw/display/cirrus_vga.c -+++ b/hw/display/cirrus_vga.c -@@ -2991,6 +2991,8 @@ static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data) - dc->realize = isa_cirrus_vga_realizefn; - dc->props = isa_cirrus_vga_properties; - set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->cannot_instantiate_with_device_add_yet = true; - } - - static const TypeInfo isa_cirrus_vga_info = { ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -1465,8 +1465,9 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, - } - - serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); -+#if 0 /* Disabled for Red Hat Enterprise Linux 7 */ - parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); -- -+#endif - a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); - i8042 = isa_create_simple(isa_bus, "i8042"); - i8042_setup_a20_line(i8042, &a20_line[0]); ---- a/hw/isa/Makefile.objs -+++ b/hw/isa/Makefile.objs -@@ -1,4 +1,4 @@ --common-obj-y += isa-bus.o -+common-obj-$(CONFIG_ISA_BUS) += isa-bus.o - common-obj-$(CONFIG_APM) += apm.o - common-obj-$(CONFIG_I82378) += i82378.o - common-obj-$(CONFIG_PC87312) += pc87312.o ---- a/hw/misc/Makefile.objs -+++ b/hw/misc/Makefile.objs -@@ -19,7 +19,8 @@ common-obj-$(CONFIG_PUV3) += puv3_pm.o - - common-obj-$(CONFIG_MACIO) += macio/ - --obj-$(CONFIG_IVSHMEM) += ivshmem.o -+# Disabled for Red Hat Enterprise Linux: -+# obj-$(CONFIG_IVSHMEM) += ivshmem.o - - obj-$(CONFIG_REALVIEW) += arm_sysctl.o - obj-$(CONFIG_NSERIES) += cbus.o ---- a/hw/ppc/Makefile.objs -+++ b/hw/ppc/Makefile.objs -@@ -9,7 +9,6 @@ obj-y += spapr_pci_vfio.o - endif - # PowerPC 4xx boards - obj-y += ppc4xx_devs.o ppc405_uc.o --obj-y += ppc4xx_pci.o - # PReP - obj-$(CONFIG_PREP) += prep.o - # OldWorld PowerMac ---- a/hw/usb/ccid-card-emulated.c -+++ b/hw/usb/ccid-card-emulated.c -@@ -586,6 +586,8 @@ static void emulated_class_initfn(ObjectClass *klass, void *data) - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - dc->desc = "emulated smartcard"; - dc->props = emulated_card_properties; -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->cannot_instantiate_with_device_add_yet = true; - } - - static const TypeInfo emulated_card_info = { ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -1363,11 +1363,6 @@ ETEXI - - DEF("no-hpet", 0, QEMU_OPTION_no_hpet, - "-no-hpet disable HPET\n", QEMU_ARCH_I386) --STEXI --@item -no-hpet --@findex -no-hpet --Disable HPET support. --ETEXI - - DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable, - "-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]\n" ---- a/target-arm/cpu.c -+++ b/target-arm/cpu.c -@@ -1264,7 +1264,8 @@ static void arm_cpu_register_types(void) - type_register_static(&arm_cpu_type_info); - - while (info->name) { -- cpu_register(info); -+ if (!strcmp(info->name, "cortex-a15")) -+ cpu_register(info); - info++; - } - } ---- a/tests/Makefile -+++ b/tests/Makefile -@@ -79,8 +79,6 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh - # really in libqtest, not in the testcases themselves. - - gcov-files-ipack-y += hw/ipack/ipack.c --check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF) --gcov-files-ipack-y += hw/char/ipoctal232.c - - check-qtest-virtioserial-y += tests/virtio-console-test$(EXESUF) - gcov-files-virtioserial-y += hw/char/virtio-console.c -@@ -110,23 +108,10 @@ check-qtest-pci-y += tests/e1000-test$(EXESUF) - gcov-files-pci-y += hw/net/e1000.c - check-qtest-pci-y += tests/rtl8139-test$(EXESUF) - gcov-files-pci-y += hw/net/rtl8139.c --check-qtest-pci-y += tests/pcnet-test$(EXESUF) --gcov-files-pci-y += hw/net/pcnet.c --gcov-files-pci-y += hw/net/pcnet-pci.c --check-qtest-pci-y += tests/eepro100-test$(EXESUF) --gcov-files-pci-y += hw/net/eepro100.c --check-qtest-pci-y += tests/ne2000-test$(EXESUF) --gcov-files-pci-y += hw/net/ne2000.c --check-qtest-pci-y += tests/nvme-test$(EXESUF) --gcov-files-pci-y += hw/block/nvme.c - check-qtest-pci-y += tests/ac97-test$(EXESUF) - gcov-files-pci-y += hw/audio/ac97.c --check-qtest-pci-y += tests/es1370-test$(EXESUF) --gcov-files-pci-y += hw/audio/es1370.c - check-qtest-pci-y += $(check-qtest-virtio-y) - gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c --check-qtest-pci-y += tests/tpci200-test$(EXESUF) --gcov-files-pci-y += hw/ipack/tpci200.c - check-qtest-pci-y += $(check-qtest-ipack-y) - gcov-files-pci-y += $(gcov-files-ipack-y) - check-qtest-pci-y += tests/display-vga-test$(EXESUF) -@@ -153,8 +138,6 @@ check-qtest-i386-y += tests/wdt_ib700-test$(EXESUF) - gcov-files-i386-y += hw/watchdog/watchdog.c hw/watchdog/wdt_ib700.c - check-qtest-i386-y += $(check-qtest-pci-y) - gcov-files-i386-y += $(gcov-files-pci-y) --check-qtest-i386-y += tests/vmxnet3-test$(EXESUF) --gcov-files-i386-y += hw/net/vmxnet3.c - gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c - gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c - check-qtest-i386-y += tests/pvpanic-test$(EXESUF) -@@ -163,8 +146,6 @@ check-qtest-i386-y += tests/i82801b11-test$(EXESUF) - gcov-files-i386-y += hw/pci-bridge/i82801b11.c - check-qtest-i386-y += tests/ioh3420-test$(EXESUF) - gcov-files-i386-y += hw/pci-bridge/ioh3420.c --check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF) --gcov-files-i386-y += hw/usb/hcd-ohci.c - check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF) - gcov-files-i386-y += hw/usb/hcd-uhci.c - check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF) -@@ -334,10 +315,7 @@ tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) - tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) - tests/e1000-test$(EXESUF): tests/e1000-test.o - tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) --tests/pcnet-test$(EXESUF): tests/pcnet-test.o - tests/eepro100-test$(EXESUF): tests/eepro100-test.o --tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o --tests/ne2000-test$(EXESUF): tests/ne2000-test.o - tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o - tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o - tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y) -@@ -347,20 +325,16 @@ tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o - tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o - tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o - tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o --tests/tpci200-test$(EXESUF): tests/tpci200-test.o - tests/display-vga-test$(EXESUF): tests/display-vga-test.o - tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o - tests/qom-test$(EXESUF): tests/qom-test.o - tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-pc-obj-y) - tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y) --tests/nvme-test$(EXESUF): tests/nvme-test.o - tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o - tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o - tests/ac97-test$(EXESUF): tests/ac97-test.o --tests/es1370-test$(EXESUF): tests/es1370-test.o - tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o - tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o --tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) - tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y) - tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y) - tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y) ---- a/tests/boot-order-test.c -+++ b/tests/boot-order-test.c -@@ -112,6 +112,7 @@ static void test_pc_boot_order(void) - test_boot_orders(NULL, read_boot_order_pc, test_cases_pc); - } - -+#if 0 /* Disabled for RHEL, since CONFIG_MAC and CONFIG_PREP are not enabled */ - static uint8_t read_m48t59(uint64_t addr, uint16_t reg) - { - writeb(addr, reg & 0xff); -@@ -142,6 +143,7 @@ static uint64_t read_boot_order_pmac(void) - - return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE); - } -+#endif /* Disabled for RHEL, since CONFIG_MAC and CONFIG_PREP are not enabled */ - - static const boot_order_test test_cases_fw_cfg[] = { - { "", 'c', 'c' }, -@@ -151,6 +153,7 @@ static const boot_order_test test_cases_fw_cfg[] = { - {} - }; - -+#if 0 /* Disabled for RHEL, since CONFIG_MAC and CONFIG_PREP are not enabled */ - static void test_pmac_oldworld_boot_order(void) - { - test_boot_orders("g3beige", read_boot_order_pmac, test_cases_fw_cfg); -@@ -159,7 +162,9 @@ static void test_pmac_oldworld_boot_order(void) - static void test_pmac_newworld_boot_order(void) - { - test_boot_orders("mac99", read_boot_order_pmac, test_cases_fw_cfg); -+ - } -+#endif /* Disabled for RHEL, since CONFIG_MAC and CONFIG_PREP are not enabled */ - - static uint64_t read_boot_order_sun4m(void) - { -@@ -194,11 +199,13 @@ int main(int argc, char *argv[]) - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { - qtest_add_func("boot-order/pc", test_pc_boot_order); - } else if (strcmp(arch, "ppc") == 0 || strcmp(arch, "ppc64") == 0) { -+#if 0 /* Disabled for RHEL, since CONFIG_MAC and CONFIG_PREP are not enabled */ - qtest_add_func("boot-order/prep", test_prep_boot_order); - qtest_add_func("boot-order/pmac_oldworld", - test_pmac_oldworld_boot_order); - qtest_add_func("boot-order/pmac_newworld", - test_pmac_newworld_boot_order); -+#endif /* Disabled for RHEL, since CONFIG_MAC and CONFIG_PREP are not enabled */ - } else if (strcmp(arch, "sparc") == 0) { - qtest_add_func("boot-order/sun4m", test_sun4m_boot_order); - } else if (strcmp(arch, "sparc64") == 0) { ---- a/tests/endianness-test.c -+++ b/tests/endianness-test.c -@@ -40,12 +40,14 @@ static const TestCase test_cases[] = { - { "mips64", "mips", 0x14000000, .bswap = true }, - { "mips64", "malta", 0x10000000, .bswap = true }, - { "mips64el", "fulong2e", 0x1fd00000 }, -+#if 0 /* Disabled for RHEL, since ISA is not enabled */ - { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" }, - { "ppc", "prep", 0x80000000, .bswap = true }, - { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" }, - { "ppc64", "mac99", 0xf2000000, .bswap = true, .superio = "i82378" }, - { "ppc64", "pseries", 0x10080000000ULL, - .bswap = true, .superio = "i82378" }, -+#endif /* Disabled for RHEL, since ISA is not enabled */ - { "sh4", "r2d", 0xfe240000, .superio = "i82378" }, - { "sh4eb", "r2d", 0xfe240000, .bswap = true, .superio = "i82378" }, - { "sparc64", "sun4u", 0x1fe02000000LL, .bswap = true }, ---- a/tests/qemu-iotests/051 -+++ b/tests/qemu-iotests/051 -@@ -141,19 +141,19 @@ echo - - run_qemu -drive if=floppy - run_qemu -drive if=ide,media=cdrom --run_qemu -drive if=scsi,media=cdrom -+#run_qemu -drive if=scsi,media=cdrom - - run_qemu -drive if=ide - run_qemu -drive if=virtio --run_qemu -drive if=scsi -+#run_qemu -drive if=scsi - - run_qemu -drive if=none,id=disk -device ide-cd,drive=disk --run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk -+#run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk - - run_qemu -drive if=none,id=disk -device ide-drive,drive=disk - run_qemu -drive if=none,id=disk -device ide-hd,drive=disk --run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk --run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk -+#run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk -+#run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk - - echo - echo === Read-only === -@@ -161,19 +161,19 @@ echo - - run_qemu -drive file="$TEST_IMG",if=floppy,readonly=on - run_qemu -drive file="$TEST_IMG",if=ide,media=cdrom,readonly=on --run_qemu -drive file="$TEST_IMG",if=scsi,media=cdrom,readonly=on -+#run_qemu -drive file="$TEST_IMG",if=scsi,media=cdrom,readonly=on - - run_qemu -drive file="$TEST_IMG",if=ide,readonly=on - run_qemu -drive file="$TEST_IMG",if=virtio,readonly=on --run_qemu -drive file="$TEST_IMG",if=scsi,readonly=on -+#run_qemu -drive file="$TEST_IMG",if=scsi,readonly=on - - run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device ide-cd,drive=disk --run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk -+#run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk - - run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device ide-drive,drive=disk - run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device ide-hd,drive=disk --run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk --run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk -+#run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk -+#run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk - - echo - echo === Cache modes === ---- a/tests/qemu-iotests/051.out -+++ b/tests/qemu-iotests/051.out -@@ -116,10 +116,6 @@ Testing: -drive if=ide,media=cdrom - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K - --Testing: -drive if=scsi,media=cdrom --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- - Testing: -drive if=ide - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) QEMU_PROG: Device needs media, but drive is empty -@@ -138,10 +134,6 @@ Testing: -drive if=none,id=disk -device ide-cd,drive=disk - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K - --Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- - Testing: -drive if=none,id=disk -device ide-drive,drive=disk - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) QEMU_PROG: -device ide-drive,drive=disk: Device needs media, but drive is empty -@@ -154,17 +146,6 @@ QEMU X.Y.Z monitor - type 'help' for more information - QEMU_PROG: -device ide-hd,drive=disk: Device initialization failed. - QEMU_PROG: -device ide-hd,drive=disk: Device 'ide-hd' could not be initialized - --Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) QEMU_PROG: -device scsi-disk,drive=disk: Device needs media, but drive is empty --QEMU_PROG: -device scsi-disk,drive=disk: Device 'scsi-disk' could not be initialized -- --Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) QEMU_PROG: -device scsi-hd,drive=disk: Device needs media, but drive is empty --QEMU_PROG: -device scsi-hd,drive=disk: Device 'scsi-hd' could not be initialized -- -- - === Read-only === - - Testing: -drive file=TEST_DIR/t.qcow2,if=floppy,readonly=on -@@ -175,10 +156,6 @@ Testing: -drive file=TEST_DIR/t.qcow2,if=ide,media=cdrom,readonly=on - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K - --Testing: -drive file=TEST_DIR/t.qcow2,if=scsi,media=cdrom,readonly=on --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- - Testing: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) QEMU_PROG: Can't use a read-only drive -@@ -188,18 +165,10 @@ Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K - --Testing: -drive file=TEST_DIR/t.qcow2,if=scsi,readonly=on --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- - Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-cd,drive=disk - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K - --Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- - Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-drive,drive=disk - QEMU X.Y.Z monitor - type 'help' for more information - (qemu) QEMU_PROG: -device ide-drive,drive=disk: Can't use a read-only drive -@@ -212,15 +181,6 @@ QEMU X.Y.Z monitor - type 'help' for more information - QEMU_PROG: -device ide-hd,drive=disk: Device initialization failed. - QEMU_PROG: -device ide-hd,drive=disk: Device 'ide-hd' could not be initialized - --Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- --Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk --QEMU X.Y.Z monitor - type 'help' for more information --(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K -- -- - === Cache modes === - - Testing: -drive media=cdrom,cache=none ---- a/tests/usb-hcd-xhci-test.c -+++ b/tests/usb-hcd-xhci-test.c -@@ -23,6 +23,7 @@ static void test_xhci_hotplug(void) - usb_test_hotplug("xhci", 1, NULL); - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux 7 */ - static void test_usb_uas_hotplug(void) - { - QDict *response; -@@ -79,6 +80,7 @@ static void test_usb_uas_hotplug(void) - g_assert(!strcmp(qdict_get_str(response, "event"), "DEVICE_DELETED")); - QDECREF(response); - } -+#endif - - int main(int argc, char **argv) - { -@@ -88,8 +90,9 @@ int main(int argc, char **argv) - - qtest_add_func("/xhci/pci/init", test_xhci_init); - qtest_add_func("/xhci/pci/hotplug", test_xhci_hotplug); -+#if 0 /* Disabled for Red Hat Enterprise Linux 7 */ - qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug); -- -+#endif - qtest_start("-device nec-usb-xhci,id=xhci" - " -drive id=drive0,if=none,file=/dev/null,format=raw"); - ret = g_test_run(); ---- a/vl.c -+++ b/vl.c -@@ -161,7 +161,7 @@ int max_cpus = 0; - int smp_cores = 1; - int smp_threads = 1; - int acpi_enabled = 1; --int no_hpet = 0; -+int no_hpet = 1; /* Always disabled for Red Hat Enterprise Linux */ - int fd_bootchk = 1; - static int no_reboot; - int no_shutdown = 0; diff --git a/SOURCES/kvm-misc-Revert-rhel-Drop-ivshmem-device.patch b/SOURCES/kvm-misc-Revert-rhel-Drop-ivshmem-device.patch deleted file mode 100644 index 6f4143d..0000000 --- a/SOURCES/kvm-misc-Revert-rhel-Drop-ivshmem-device.patch +++ /dev/null @@ -1,35 +0,0 @@ -From b88bbf020394cd1706ee50cc4563feee7d072ed7 Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Thu, 18 Sep 2014 23:49:31 +0200 -Subject: Revert "rhel: Drop "ivshmem" device" - -Message-id: <1411084171-28836-5-git-send-email-drjones@redhat.com> -Patchwork-id: 61306 -O-Subject: [PATCH RHEV-7.1 qemu-kvm-rhev 4/4] Revert "rhel: Drop "ivshmem" device" -Bugzilla: 1104063 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -This reverts commit 3350f809f674a56c9467343e478b36ea94c4a14a. - -Signed-off-by: Andrew Jones <drjones@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/misc/Makefile.objs - -diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs -index 1cc0b76..4aa76ff 100644 ---- a/hw/misc/Makefile.objs -+++ b/hw/misc/Makefile.objs -@@ -19,8 +19,7 @@ common-obj-$(CONFIG_PUV3) += puv3_pm.o - - common-obj-$(CONFIG_MACIO) += macio/ - --# Disabled for Red Hat Enterprise Linux: --# obj-$(CONFIG_IVSHMEM) += ivshmem.o -+obj-$(CONFIG_IVSHMEM) += ivshmem.o - - obj-$(CONFIG_REALVIEW) += arm_sysctl.o - obj-$(CONFIG_NSERIES) += cbus.o diff --git a/SOURCES/kvm-misc-Use-kvm-by-default.patch b/SOURCES/kvm-misc-Use-kvm-by-default.patch deleted file mode 100644 index 0b90786..0000000 --- a/SOURCES/kvm-misc-Use-kvm-by-default.patch +++ /dev/null @@ -1,29 +0,0 @@ -From eb882e2304b5ff0e03b9a7908aafa459adff5f4e 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 note: - - 2.2: Move code from vl.c to accel.c - -diff --git a/accel.c b/accel.c -index 74e41da..89ad417 100644 ---- a/accel.c -+++ b/accel.c -@@ -87,8 +87,8 @@ int configure_accelerator(MachineState *ms) - - p = qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (p == NULL) { -- /* Use the default "accelerator", tcg */ -- p = "tcg"; -+ /* Use kvm accelerator by default, fail to tcg*/ -+ p = "kvm:tcg"; - } - - while (!accel_initialised && *p != '\0') { diff --git a/SOURCES/kvm-misc-Use-qemu-kvm-in-documentation-instead-of-qemu-system-i386.patch b/SOURCES/kvm-misc-Use-qemu-kvm-in-documentation-instead-of-qemu-system-i386.patch deleted file mode 100644 index 3dcc7e5..0000000 --- a/SOURCES/kvm-misc-Use-qemu-kvm-in-documentation-instead-of-qemu-system-i386.patch +++ /dev/null @@ -1,847 +0,0 @@ -From b741721bdef6c4154516eb0cd07189739671484a 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-i386 - -Message-id: <1415955110-25204-1-git-send-email-mrezanin@redhat.com> -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> - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1140620 -Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=8244724 - -We change the name and location of qemu-kvm binaries. Update documentation -to reflect this change. - -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/qemu-doc.texi b/qemu-doc.texi -index 0125bc7..cec5fad 100644 ---- a/qemu-doc.texi -+++ b/qemu-doc.texi -@@ -226,12 +226,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. -@@ -247,7 +247,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. -@@ -257,7 +257,7 @@ Linux should boot and give you a prompt. - - @example - @c man begin SYNOPSIS --usage: qemu-system-i386 [options] [@var{disk_image}] -+usage: qemu-kvm [options] [@var{disk_image}] - @c man end - @end example - -@@ -796,7 +796,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} -@@ -806,14 +806,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: -@@ -831,14 +831,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: -@@ -855,23 +855,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 -@@ -896,7 +896,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. -@@ -908,7 +908,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. -@@ -921,14 +921,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 -@@ -970,7 +970,7 @@ Various session related parameters can be set via special options, either - in a configuration file provided via '-readconfig' or directly on the - command line. - --If the initiator-name is not specified qemu will use a default name -+If the initiator-name is not specified qemu-kvm will use a default name - of 'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the - virtual machine. - -@@ -1017,7 +1017,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 - -@@ -1036,7 +1036,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 -@@ -1048,7 +1048,7 @@ GlusterFS is an user space distributed file system. - - You can boot from the GlusterFS disk image with the command: - @example --qemu-system-x86_64 -drive file=gluster[+@var{transport}]://[@var{server}[:@var{port}]]/@var{volname}/@var{image}[?socket=...] -+qemu-kvm -drive file=gluster[+@var{transport}]://[@var{server}[:@var{port}]]/@var{volname}/@var{image}[?socket=...] - @end example - - @var{gluster} is the protocol. -@@ -1081,14 +1081,14 @@ qemu-img create gluster://@var{server}/@var{volname}/@var{image} @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-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 - @end example - - @node disk_images_ssh -@@ -1098,13 +1098,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. -@@ -1248,7 +1248,7 @@ zero-copy communication to the application level of the guests. The basic - syntax is: - - @example --qemu-system-i386 -device ivshmem,size=<size in format accepted by -m>[,shm=<shm name>] -+qemu-kvm -device ivshmem,size=<size in format accepted by -m>[,shm=<shm name>] - @end example - - If desired, interrupts can be sent between guest VMs accessing the same shared -@@ -1258,9 +1258,9 @@ is qemu.git/contrib/ivshmem-server. An example syntax when using the shared - memory server is: - - @example --qemu-system-i386 -device ivshmem,size=<size in format accepted by -m>[,chardev=<id>] -+qemu-kvm -device ivshmem,size=<size in format accepted by -m>[,chardev=<id>] - [,msi=on][,ioeventfd=on][,vectors=n][,role=peer|master] --qemu-system-i386 -chardev socket,path=<path>,id=<id> -+qemu-kvm -chardev socket,path=<path>,id=<id> - @end example - - When using the server, the guest will be assigned a VM ID (>=0) that allows guests -@@ -1290,7 +1290,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 -@@ -1305,7 +1305,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 - -@@ -1369,7 +1369,7 @@ Network adapter that supports CDC ethernet and RNDIS protocols. @var{options} - specifies NIC options as with @code{-net nic,}@var{options} (see description). - For instance, user-mode networking can be used with - @example --qemu-system-i386 [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0 -+qemu-kvm [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0 - @end example - Currently this cannot be used in machines that support PCI NICs. - @item bt[:@var{hci-type}] -@@ -1379,7 +1379,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 --qemu-system-i386 [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3 -+qemu-kvm [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3 - @end example - @end table - -@@ -1457,7 +1457,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 -@@ -1480,7 +1480,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) -@@ -1497,7 +1497,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, -@@ -1515,7 +1515,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 - - -@@ -1526,7 +1526,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) -@@ -1549,7 +1549,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 -@@ -1563,7 +1563,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 - - -@@ -1731,7 +1731,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 -diff --git a/qemu-options.hx b/qemu-options.hx -index 5a10e4a..7a778f6 100644 ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -153,7 +153,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 -@@ -180,7 +180,7 @@ STEXI - Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.: - - @example --qemu-system-i386 -global ide-drive.physical_block_size=4096 -drive file=file,if=ide,index=0,media=disk -+qemu-kvm -global ide-drive.physical_block_size=4096 -drive file=file,if=ide,index=0,media=disk - @end example - - In particular, you can use this to set driver properties for devices which are -@@ -218,7 +218,7 @@ the recommended is 320x240, 640x480, 800x640. - - A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms - when boot failed, then reboot. If @var{rb_timeout} is '-1', guest will not --reboot, qemu passes '-1' to bios by default. Currently Seabios for X86 -+reboot, qemu-kvm passes '-1' to bios by default. Currently Seabios for X86 - system support it. - - Do strict boot via @option{strict=on} as far as firmware/BIOS -@@ -227,11 +227,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 -@@ -330,12 +330,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 -@@ -562,21 +562,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 -@@ -584,33 +584,33 @@ 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 - - You can connect a SCSI disk with unit ID 6 on the bus #0: - @example --qemu-system-i386 -drive file=file,if=scsi,bus=0,unit=6 -+qemu-kvm -drive file=file,if=scsi,bus=0,unit=6 - @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 - -@@ -1617,7 +1617,7 @@ can not be resolved. - - Example: - @example --qemu -net user,dnssearch=mgmt.example.org,dnssearch=example.org [...] -+qemu-kvm -net user,dnssearch=mgmt.example.org,dnssearch=example.org [...] - @end example - - @item tftp=@var{dir} -@@ -1633,7 +1633,7 @@ a guest from a local directory. - - Example (using pxelinux): - @example --qemu-system-i386 -hda linux.img -boot n -net user,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 -+qemu-kvm -hda linux.img -boot n -net user,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 - @end example - - @item smb=@var{dir}[,smbserver=@var{addr}] -@@ -1668,7 +1668,7 @@ screen 0, use the following: - - @example - # on the host --qemu-system-i386 -net user,hostfwd=tcp:127.0.0.1:6001-:6000 [...] -+qemu-kvm -net user,hostfwd=tcp:127.0.0.1:6001-:6000 [...] - # this host xterm should open in the guest X11 server - xterm -display :1 - @end example -@@ -1678,7 +1678,7 @@ the guest, use the following: - - @example - # on the host --qemu-system-i386 -net user,hostfwd=tcp::5555-:23 [...] -+qemu-kvm -net user,hostfwd=tcp::5555-:23 [...] - telnet localhost 5555 - @end example - -@@ -1697,7 +1697,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 -net user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321 [...] -+qemu-kvm -net 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, -@@ -1706,7 +1706,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 -net 'user,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321' -+qemu-kvm -net 'user,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321' - @end example - - @end table -@@ -1738,13 +1738,13 @@ Examples: - - @example - #launch a QEMU instance with the default network script --qemu-system-i386 linux.img -net nic -net tap -+qemu-kvm linux.img -net nic -net 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 \ - -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ - -net nic,vlan=1 -net tap,vlan=1,ifname=tap1 - @end example -@@ -1752,7 +1752,7 @@ qemu-system-i386 linux.img \ - @example - #launch a QEMU instance with the default network helper to - #connect a TAP device to bridge br0 --qemu-system-i386 linux.img \ -+qemu-kvm linux.img \ - -net nic -net tap,"helper=/path/to/qemu-bridge-helper" - @end example - -@@ -1770,13 +1770,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 -net bridge -net nic,model=virtio -+qemu-kvm linux.img -net bridge -net nic,model=virtio - @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 -net bridge,br=qemubr0 -net nic,model=virtio -+qemu-kvm linux.img -net bridge,br=qemubr0 -net nic,model=virtio - @end example - - @item -netdev socket,id=@var{id}[,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] -@@ -1792,12 +1792,12 @@ specifies an already opened TCP socket. - Example: - @example - # launch a first QEMU instance --qemu-system-i386 linux.img \ -+qemu-kvm linux.img \ - -net nic,macaddr=52:54:00:12:34:56 \ - -net socket,listen=:1234 - # connect the VLAN 0 of this instance to the VLAN 0 - # of the first instance --qemu-system-i386 linux.img \ -+qemu-kvm linux.img \ - -net nic,macaddr=52:54:00:12:34:57 \ - -net socket,connect=127.0.0.1:1234 - @end example -@@ -1823,15 +1823,15 @@ Use @option{fd=h} to specify an already opened UDP multicast socket. - Example: - @example - # launch one QEMU instance --qemu-system-i386 linux.img \ -+qemu-kvm linux.img \ - -net nic,macaddr=52:54:00:12:34:56 \ - -net socket,mcast=230.0.0.1:1234 - # launch another QEMU instance on same "bus" --qemu-system-i386 linux.img \ -+qemu-kvm linux.img \ - -net nic,macaddr=52:54:00:12:34:57 \ - -net socket,mcast=230.0.0.1:1234 - # launch yet another QEMU instance on same "bus" --qemu-system-i386 linux.img \ -+qemu-kvm linux.img \ - -net nic,macaddr=52:54:00:12:34:58 \ - -net socket,mcast=230.0.0.1:1234 - @end example -@@ -1840,7 +1840,7 @@ 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 \ - -net nic,macaddr=52:54:00:12:34:56 \ - -net socket,mcast=239.192.168.1:1102 - # launch UML -@@ -1849,7 +1849,7 @@ qemu-system-i386 linux.img \ - - Example (send packets from host's 1.2.3.4): - @example --qemu-system-i386 linux.img \ -+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 -@@ -1908,7 +1908,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 -net nic -net l2tpv3,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter -+qemu-kvm linux.img -net nic -net l2tpv3,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter - - - @end example -@@ -1926,7 +1926,7 @@ Example: - # launch vde switch - vde_switch -F -sock /tmp/myswitch - # launch QEMU instance --qemu-system-i386 linux.img -net nic -net vde,sock=/tmp/myswitch -+qemu-kvm linux.img -net nic -net vde,sock=/tmp/myswitch - @end example - - @item -netdev hubport,id=@var{id},hubid=@var{hubid} -@@ -1947,11 +1947,11 @@ end of the socket. On non-MSIX guests, the feature can be forced with - - Example: - @example --qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ -- -numa node,memdev=mem \ -- -chardev socket,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,path=/path/to/socket \ -+ -netdev type=vhost-user,id=net0,chardev=chr0 \ -+ -device virtio-net-pci,netdev=net0 - @end example - - @item -net dump[,vlan=@var{n}][,file=@var{file}][,len=@var{len}] -@@ -2263,28 +2263,28 @@ images for the guest storage. Both disk and cdrom images are supported. - Syntax for specifying iSCSI LUNs is - ``iscsi://<target-ip>[:<port>]/<target-iqn>/<lun>'' - --By default qemu will use the iSCSI initiator-name -+By default qemu-kvm will use the iSCSI initiator-name - 'iqn.2008-11.org.linux-kvm[:<name>]' but this can also be set from the command - line or a configuration file. - - - Example (without authentication): - @example --qemu-system-i386 -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \ -+qemu-kvm -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \ - -cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \ - -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1 - @end example - - Example (CHAP username/password via URL): - @example --qemu-system-i386 -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1 -+qemu-kvm -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1 - @end example - - Example (CHAP username/password via environment variables): - @example - LIBISCSI_CHAP_USERNAME="user" \ - LIBISCSI_CHAP_PASSWORD="password" \ --qemu-system-i386 -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1 -+qemu-kvm -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1 - @end example - - iSCSI support is an optional feature of QEMU and only available when -@@ -2313,12 +2313,12 @@ Syntax for specifying a NBD device using Unix Domain Sockets - - Example for TCP - @example --qemu-system-i386 --drive file=nbd:192.0.2.1:30000 -+qemu-kvm --drive file=nbd:192.0.2.1:30000 - @end example - - Example for Unix Domain Sockets - @example --qemu-system-i386 --drive file=nbd:unix:/tmp/nbd-socket -+qemu-kvm --drive file=nbd:unix:/tmp/nbd-socket - @end example - - @item SSH -@@ -2326,8 +2326,8 @@ QEMU supports SSH (Secure Shell) access to remote disks. - - Examples: - @example --qemu-system-i386 -drive file=ssh://user@@host/path/to/disk.img --qemu-system-i386 -drive file.driver=ssh,file.user=user,file.host=host,file.port=22,file.path=/path/to/disk.img -+qemu-kvm -drive file=ssh://user@@host/path/to/disk.img -+qemu-kvm -drive file.driver=ssh,file.user=user,file.host=host,file.port=22,file.path=/path/to/disk.img - @end example - - Currently authentication must be done using ssh-agent. Other -@@ -2345,7 +2345,7 @@ sheepdog[+tcp|+unix]://[host:port]/vdiname[?socket=path][#snapid|#tag] - - Example - @example --qemu-system-i386 --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine -+qemu-kvm --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine - @end example - - See also @url{http://http://www.osrg.net/sheepdog/}. -@@ -2363,7 +2363,7 @@ gluster[+transport]://[server[:port]]/volname/image[?socket=...] - - Example - @example --qemu-system-x86_64 --drive file=gluster://192.0.2.1/testvol/a.img -+qemu-kvm --drive file=gluster://192.0.2.1/testvol/a.img - @end example - - See also @url{http://www.gluster.org}. -@@ -2420,14 +2420,14 @@ that CURL waits for a response from the remote server to get the size of the - image to be downloaded. If not set, the default timeout of 5 seconds is used. - @end table - --Note that when passing options to qemu explicitly, @option{driver} is the value -+Note that when passing options to qemu-kvm explicitly, @option{driver} is the value - of <protocol>. - - Example: boot from a remote Fedora 20 live ISO image - @example --qemu-system-x86_64 --drive media=cdrom,file=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly -+qemu-kvm --drive media=cdrom,file=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly - --qemu-system-x86_64 --drive media=cdrom,file.driver=http,file.url=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly -+qemu-kvm --drive media=cdrom,file.driver=http,file.url=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly - @end example - - Example: boot from a remote Fedora 20 cloud image using a local overlay for -@@ -2435,7 +2435,7 @@ writes, copy-on-read, and a readahead of 64k - @example - qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"http",, "file.url":"https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2",, "file.readahead":"64k"@}' /tmp/Fedora-x86_64-20-20131211.1-sda.qcow2 - --qemu-system-x86_64 -drive file=/tmp/Fedora-x86_64-20-20131211.1-sda.qcow2,copy-on-read=on -+qemu-kvm -drive file=/tmp/Fedora-x86_64-20-20131211.1-sda.qcow2,copy-on-read=on - @end example - - Example: boot from an image stored on a VMware vSphere server with a self-signed -@@ -2444,7 +2444,7 @@ of 10 seconds. - @example - qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"https",, "file.url":"https://user:password@@vsphere.example.com/folder/test/test-flat.vmdk?dcPath=Datacenter&dsName=datastore1",, "file.sslverify":"off",, "file.readahead":"64k",, "file.timeout":10@}' /tmp/test.qcow2 - --qemu-system-x86_64 -drive file=/tmp/test.qcow2 -+qemu-kvm -drive file=/tmp/test.qcow2 - @end example - ETEXI - -@@ -2508,7 +2508,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}] -@@ -2554,7 +2554,7 @@ Options to each backend are described below. - - Use 'help' to print all available TPM backend types. - @example --qemu -tpmdev help -+qemu-kvm -tpmdev help - @end example - - @item -tpmdev passthrough, id=@var{id}, path=@var{path}, cancel-path=@var{cancel-path} -@@ -2892,14 +2892,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 - -@@ -2913,7 +2913,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 - diff --git a/SOURCES/kvm-misc-add-qxl_screendump-monitor-command.patch b/SOURCES/kvm-misc-add-qxl_screendump-monitor-command.patch deleted file mode 100644 index 1522a69..0000000 --- a/SOURCES/kvm-misc-add-qxl_screendump-monitor-command.patch +++ /dev/null @@ -1,160 +0,0 @@ -From d871e21c178e41438f47e350fed7b082c2617607 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Fri, 4 Jul 2014 11:55:46 +0200 -Subject: add qxl_screendump monitor command - -RH-Author: Gerd Hoffmann <kraxel@redhat.com> -Message-id: <1375866764-17766-2-git-send-email-kraxel@redhat.com> -Patchwork-id: 53033 -O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] add qxl_screendump monitor command -Bugzilla: 903910 -RH-Acked-by: Hans de Goede <hdegoede@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michal Novotny <minovotn@redhat.com> - -This patch ports the rhel-6 specific qxl_screendump command to rhel-7. -qxl_screendump takes the device id as additional argument and thus can -be used to take screenshots from non-primary displays. - -The plan to get that functionality upstream in time failed, so we go for -plan b and carry forward the rhel-6 specific qxl_screendump command. -Thanks to the major console subsystem cleanups which made it upstream -the implementation is (a) alot less hackier than the rhel-6 one and (b) -not qxl-specific any more. Given that qxl is the only graphic device -which can work as secondary vga card the later is only a theoretical -benefit though ;) - -RHEL-6 commit: 1c6074d107dff93c7c7b0edfb5da871504802946 - -bugzilla: #903910 - RHEL7 does not have equivalent functionality for -__com.redhat_qxl_screendump - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> - -diff --git a/hmp-commands.hx b/hmp-commands.hx -index 3089533..6089b01 100644 ---- a/hmp-commands.hx -+++ b/hmp-commands.hx -@@ -245,6 +245,13 @@ ETEXI - .help = "save screen into PPM image 'filename'", - .mhandler.cmd = hmp_screendump, - }, -+ { -+ .name = "__com.redhat_qxl_screendump", -+ .args_type = "id:s,filename:F", -+ .params = "id filename", -+ .help = "save screen from qxl device 'id' into PPM image 'filename'", -+ .mhandler.cmd = hmp___com_redhat_qxl_screen_dump, -+ }, - - STEXI - @item screendump @var{filename} -diff --git a/hmp.c b/hmp.c -index f142d36..b1423a1 100644 ---- a/hmp.c -+++ b/hmp.c -@@ -1655,6 +1655,16 @@ void hmp_screendump(Monitor *mon, const QDict *qdict) - hmp_handle_error(mon, &err); - } - -+void hmp___com_redhat_qxl_screen_dump(Monitor *mon, const QDict *qdict) -+{ -+ const char *id = qdict_get_str(qdict, "id"); -+ const char *filename = qdict_get_str(qdict, "filename"); -+ Error *err = NULL; -+ -+ qmp___com_redhat_qxl_screendump(id, filename, &err); -+ hmp_handle_error(mon, &err); -+} -+ - void hmp_nbd_server_start(Monitor *mon, const QDict *qdict) - { - const char *uri = qdict_get_str(qdict, "uri"); -diff --git a/hmp.h b/hmp.h -index 2b9308b..6e65699 100644 ---- a/hmp.h -+++ b/hmp.h -@@ -85,6 +85,7 @@ void hmp_getfd(Monitor *mon, const QDict *qdict); - void hmp_closefd(Monitor *mon, const QDict *qdict); - void hmp_sendkey(Monitor *mon, const QDict *qdict); - void hmp_screendump(Monitor *mon, const QDict *qdict); -+void hmp___com_redhat_qxl_screen_dump(Monitor *mon, const QDict *qdict); - void hmp_nbd_server_start(Monitor *mon, const QDict *qdict); - void hmp_nbd_server_add(Monitor *mon, const QDict *qdict); - void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); -diff --git a/qapi-schema.json b/qapi-schema.json -index ac9594d..71b8ab4 100644 ---- a/qapi-schema.json -+++ b/qapi-schema.json -@@ -2736,6 +2736,21 @@ - { 'command': 'screendump', 'data': {'filename': 'str'} } - - ## -+# @__com.redhat_qxl_screendump: -+# -+# Write a PPM of secondary qxl devices to a file. -+# -+# @id: qxl device id -+# @filename: the path of a new PPM file to store the image -+# -+# Returns: Nothing on success -+# -+# Since: never (rhel-only, not upstream) -+## -+{ 'command': '__com.redhat_qxl_screendump', 'data': { 'id' : 'str', -+ 'filename': 'str' } } -+ -+## - # @ChardevFile: - # - # Configuration info for file chardevs. -diff --git a/qmp-commands.hx b/qmp-commands.hx -index 3a42ad0..c091d59 100644 ---- a/qmp-commands.hx -+++ b/qmp-commands.hx -@@ -148,6 +148,11 @@ EQMP - .args_type = "filename:F", - .mhandler.cmd_new = qmp_marshal_input_screendump, - }, -+ { -+ .name = "__com.redhat_qxl_screendump", -+ .args_type = "id:s,filename:F", -+ .mhandler.cmd_new = qmp_marshal_input___com_redhat_qxl_screendump, -+ }, - - SQMP - screendump -diff --git a/ui/console.c b/ui/console.c -index b15ca87..d50bd06 100644 ---- a/ui/console.c -+++ b/ui/console.c -@@ -332,6 +332,29 @@ void qmp_screendump(const char *filename, Error **errp) - ppm_save(filename, surface, errp); - } - -+void qmp___com_redhat_qxl_screendump(const char *id, const char *filename, Error **errp) -+{ -+ DeviceState *dev; -+ QemuConsole *con; -+ DisplaySurface *surface; -+ -+ dev = qdev_find_recursive(sysbus_get_default(), id); -+ if (NULL == dev) { -+ error_set(errp, QERR_DEVICE_NOT_FOUND, id); -+ return; -+ } -+ -+ con = qemu_console_lookup_by_device(dev, 0); -+ if (con == NULL) { -+ error_setg(errp, "Device %s has no QemuConsole attached to it.", id); -+ return; -+ } -+ -+ graphic_hw_update(con); -+ surface = qemu_console_surface(con); -+ ppm_save(filename, surface, errp); -+} -+ - void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata) - { - if (!con) { diff --git a/SOURCES/kvm-misc-fix-guest-physical-bits-to-match-host-to-go-beyond-1TB-guests.patch b/SOURCES/kvm-misc-fix-guest-physical-bits-to-match-host-to-go-beyond-1TB-guests.patch deleted file mode 100644 index 5b76aba..0000000 --- a/SOURCES/kvm-misc-fix-guest-physical-bits-to-match-host-to-go-beyond-1TB-guests.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 9eb06ddea87c33163d1c60612652d280f4eb174a Mon Sep 17 00:00:00 2001 -From: Andrea Arcangeli <aarcange@redhat.com> -Date: Wed, 12 Feb 2014 13:30:18 +0100 -Subject: fix guest physical bits to match host, to go beyond 1TB guests - -RH-Author: Andrea Arcangeli <aarcange@redhat.com> -Message-id: <1392211818-14964-2-git-send-email-aarcange@redhat.com> -Patchwork-id: 57245 -O-Subject: [RHEL-7.0 qemu-kvm PATCH] fix guest physical bits to match host, to go beyond 1TB guests -Bugzilla: 989677 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com> - -Without this patch the guest physical bits are advertised as 40, not -44 or more depending on the hardware capability of the host. - -That leads to guest kernel crashes with injection of page faults 9 -(see oops: 0009) as bits above 40 in the guest pagetables are -considered reserved. - -exregion-0206 [324572448] [17] ex_system_memory_space: System-Memory (width 32) R/W 0 Address=00000000FED00000 -BUG: unable to handle kernel paging request at ffffc9006030e000 -IP: [<ffffffff812fbb6f>] acpi_ex_system_memory_space_handler+0x23e/0x2cb -PGD e01f875067 PUD 1001f075067 PMD e0178d8067 PTE 80000000fed00173 -Oops: 0009 [#1] SMP - -(see PUD with bit >=40 set) - -Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> -Reported-by: Chegu Vinod <chegu_vinod@hp.com> - -diff --git a/target-i386/cpu.c b/target-i386/cpu.c -index af2bf48..8b3476c 100644 ---- a/target-i386/cpu.c -+++ b/target-i386/cpu.c -@@ -2594,8 +2594,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, - /* XXX: This value must match the one used in the MMU code. */ - if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { - /* 64 bit processor */ --/* XXX: The physical address space is limited to 42 bits in exec.c. */ - *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */ -+ if (kvm_enabled()) { -+ uint32_t _eax; -+ host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL); -+ if (_eax >= 0x80000008) -+ host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL); -+ } - } else { - if (env->features[FEAT_1_EDX] & CPUID_PSE36) { - *eax = 0x00000024; /* 36 bits physical */ diff --git a/SOURCES/kvm-misc-ignore-SIGIO-in-tests-that-use-AIO-context-aarch64-host-only.patch b/SOURCES/kvm-misc-ignore-SIGIO-in-tests-that-use-AIO-context-aarch64-host-only.patch deleted file mode 100644 index d448f30..0000000 --- a/SOURCES/kvm-misc-ignore-SIGIO-in-tests-that-use-AIO-context-aarch64-host-only.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 8cde8c7080da3d841d7b285fac41fe2e540e8b3c Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek <lersek@redhat.com> -Date: Thu, 5 Feb 2015 15:35:07 +0100 -Subject: ignore SIGIO in tests that use AIO context (aarch64 host only) - -Message-id: <1423150507-19999-3-git-send-email-lersek@redhat.com> -Patchwork-id: 63730 -O-Subject: [RHELSA qemu-kvm-rhev PATCH 2/2] ignore SIGIO in tests that use AIO context (aarch64 host only) -Bugzilla: 1184405 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Richard Jones <rjones@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> - -There are three tests (grep for aio_context_new()) that call aio_notify(). -According to the previous patch, aio_notify() now generates a SIGIO for -the entire process. The default action for SIGIO is to terminate the -process. - -These tests are single-threaded, and don't expect aio_notify() to raise -SIGIO. Set the disposition to SIG_IGN so that SIGIO not terminate the test -processes. - -Downstream only. - -Signed-off-by: Laszlo Ersek <lersek@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/tests/test-aio.c b/tests/test-aio.c -index a7cb5c9..dd14bc7 100644 ---- a/tests/test-aio.c -+++ b/tests/test-aio.c -@@ -11,6 +11,7 @@ - */ - - #include <glib.h> -+#include "qemu-common.h" - #include "block/aio.h" - #include "qemu/timer.h" - #include "qemu/sockets.h" -@@ -816,6 +817,10 @@ int main(int argc, char **argv) - - init_clocks(); - -+#ifdef HOST_AARCH64 -+ sigaction(SIGIO, &(struct sigaction){ .sa_handler = SIG_IGN }, NULL); -+#endif -+ - ctx = aio_context_new(&local_error); - if (!ctx) { - error_report("Failed to create AIO Context: '%s'", -diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c -index 6a0b981..d9a1444 100644 ---- a/tests/test-thread-pool.c -+++ b/tests/test-thread-pool.c -@@ -227,6 +227,10 @@ int main(int argc, char **argv) - - init_clocks(); - -+#ifdef HOST_AARCH64 -+ sigaction(SIGIO, &(struct sigaction){ .sa_handler = SIG_IGN }, NULL); -+#endif -+ - ctx = aio_context_new(&local_error); - if (!ctx) { - error_report("Failed to create AIO Context: '%s'", -diff --git a/tests/test-throttle.c b/tests/test-throttle.c -index d8ba415..f9f4fca 100644 ---- a/tests/test-throttle.c -+++ b/tests/test-throttle.c -@@ -12,6 +12,7 @@ - - #include <glib.h> - #include <math.h> -+#include "qemu-common.h" - #include "block/aio.h" - #include "qemu/throttle.h" - #include "qemu/error-report.h" -@@ -497,6 +498,10 @@ int main(int argc, char **argv) - - init_clocks(); - -+#ifdef HOST_AARCH64 -+ sigaction(SIGIO, &(struct sigaction){ .sa_handler = SIG_IGN }, NULL); -+#endif -+ - ctx = aio_context_new(&local_error); - if (!ctx) { - error_report("Failed to create AIO Context: '%s'", diff --git a/SOURCES/kvm-misc-introduce-RFQDN_REDHAT-RHEL-6-7-fwd.patch b/SOURCES/kvm-misc-introduce-RFQDN_REDHAT-RHEL-6-7-fwd.patch deleted file mode 100644 index 7a8362b..0000000 --- a/SOURCES/kvm-misc-introduce-RFQDN_REDHAT-RHEL-6-7-fwd.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 3dc14c822f144c2996a0386af74074b1ac1b0a52 Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek <lersek@redhat.com> -Date: Thu, 21 Nov 2013 16:27:17 +0100 -Subject: introduce RFQDN_REDHAT (RHEL 6->7 fwd) - -RH-Author: Laszlo Ersek <lersek@redhat.com> -Message-id: <1385051239-3677-2-git-send-email-lersek@redhat.com> -Patchwork-id: 55836 -O-Subject: [RHEL-7.0 qemu-kvm PATCH 1/3] introduce RFQDN_REDHAT (RHEL 6->7 fwd) -Bugzilla: 971933 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Jiri Denemark <jdenemar@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=971933 - -This forward ports the final effect of RHEL-6 commit - - commit 8d99c4ad4d9fa53768bfbca8606457f8179f4404 - Author: Luiz Capitulino <lcapitulino@redhat.com> - Date: Fri May 14 22:49:19 2010 -0300 - - Monitor: Make RFQDN_REDHAT public - -Signed-off-by: Laszlo Ersek <lersek@redhat.com> - -diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h -index 1c06bed..93fc511 100644 ---- a/include/monitor/monitor.h -+++ b/include/monitor/monitor.h -@@ -19,6 +19,9 @@ extern Monitor *default_mon; - /* flags for monitor commands */ - #define MONITOR_CMD_ASYNC 0x0001 - -+/* Red Hat Monitor's prefix (reversed fully qualified domain) */ -+#define RFQDN_REDHAT "__com.redhat_" -+ - int monitor_cur_is_qmp(void); - - void monitor_init(CharDriverState *chr, int flags); diff --git a/SOURCES/kvm-misc-seabios-paravirt-allow-more-than-1TB-in-x86-guest.patch b/SOURCES/kvm-misc-seabios-paravirt-allow-more-than-1TB-in-x86-guest.patch deleted file mode 100644 index 502f792..0000000 --- a/SOURCES/kvm-misc-seabios-paravirt-allow-more-than-1TB-in-x86-guest.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 1001f53e8eb93f73dc891bc4cea00bdad534b5f1 Mon Sep 17 00:00:00 2001 -From: Andrea Arcangeli <aarcange@redhat.com> -Date: Tue, 8 Oct 2013 17:05:45 +0200 -Subject: seabios paravirt: allow more than 1TB in x86 guest - -RH-Author: Andrea Arcangeli <aarcange@redhat.com> -Message-id: <1381251945-13402-2-git-send-email-aarcange@redhat.com> -Patchwork-id: 54784 -O-Subject: [RHEL-7.0 qemu-kvm PATCH] seabios paravirt: allow more than 1TB in x86 guest -Bugzilla: 989677 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Gleb Natapov <gleb@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -This patch should be applied to the qemu-kvm rpm package at the same -time of the other one for seabios, so qemu will forward the ram_size -bits over 40 to seabios without losing them. - -Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> - -diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index a93f486..32dccd3 100644 ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -404,6 +404,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, - rtc_set_memory(s, 0x5b, val); - rtc_set_memory(s, 0x5c, val >> 8); - rtc_set_memory(s, 0x5d, val >> 16); -+ rtc_set_memory(s, 0x5e, val >> 24); - - /* set the number of CPU */ - rtc_set_memory(s, 0x5f, smp_cpus - 1); diff --git a/SOURCES/kvm-misc-use-recommended-max-vcpu-count.patch b/SOURCES/kvm-misc-use-recommended-max-vcpu-count.patch deleted file mode 100644 index 7d82e50..0000000 --- a/SOURCES/kvm-misc-use-recommended-max-vcpu-count.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c6c39a130786aa379a38b6f05dc51ddaf0829d2f Mon Sep 17 00:00:00 2001 -From: Andrew Jones <drjones@redhat.com> -Date: Tue, 21 Jan 2014 10:46:52 +0100 -Subject: use recommended max vcpu count - -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> - -RHEL-only -Bugzilla: 998708 -Brew: 6905708 - -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 matches the limit tested by QE on RHEL6: 160. - -Signed-off-by: Andrew Jones <drjones@redhat.com> - -diff --git a/kvm-all.c b/kvm-all.c -index dd44f8c..adf442d 100644 ---- a/kvm-all.c -+++ b/kvm-all.c -@@ -1509,6 +1509,9 @@ static int kvm_init(MachineState *ms) - soft_vcpus_limit = kvm_recommended_vcpus(s); - hard_vcpus_limit = kvm_max_vcpus(s); - -+ /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */ -+ hard_vcpus_limit = soft_vcpus_limit; -+ - while (nc->name) { - if (nc->num > soft_vcpus_limit) { - fprintf(stderr, diff --git a/SOURCES/kvm-monitor-Remove-host_net_add-remove-for-Red-Hat-Enterprise-Linux.patch b/SOURCES/kvm-monitor-Remove-host_net_add-remove-for-Red-Hat-Enterprise-Linux.patch deleted file mode 100644 index 79b9be9..0000000 --- a/SOURCES/kvm-monitor-Remove-host_net_add-remove-for-Red-Hat-Enterprise-Linux.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 60a62da5d2d65eae307982ee863bcf0f6f373e29 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina <mrezanin@redhat.com> -Date: Wed, 6 Nov 2013 12:36:04 +0100 -Subject: monitor: Remove host_net_add/remove for Red Hat Enterprise Linux - -RH-Author: Miroslav Rezanina <mrezanin@redhat.com> -Message-id: <b28f4458b4470c9a6fcbf5085c3a1bb4d7a0a5eb.1383741033.git.mrezanin@redhat.com> -Patchwork-id: 55519 -O-Subject: [RHEL7 qemu-kvm PATCH v2 4/4] monitor: Remove host_net_add/remove for Red Hat Enterprise Linux -Bugzilla: 1010858 -RH-Acked-by: Michal Novotny <minovotn@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Orit Wasserman <owasserm@redhat.com> -RH-Acked-by: Eric Blake <eblake@redhat.com> - -From: Miroslav Rezanina <mrezanin@redhat.com> - -This is forwardport of RHEL-6 commit dd94505bd1b826db0c7e155ccee5c24f77987f16: - - monitor: Remove host_net_add/remove for Red Hat Enterprise Linux - - The host_net_add/remove commands are replaced by netdev_add/del. Remove - them. - - Signed-off-by: Amit Shah <amit.shah@redhat.com> - -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/hmp-commands.hx b/hmp-commands.hx -index 008440b..637e133 100644 ---- a/hmp-commands.hx -+++ b/hmp-commands.hx -@@ -1191,6 +1191,7 @@ STEXI - Inject PCIe AER error - ETEXI - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - { - .name = "host_net_add", - .args_type = "device:s,opts:s?", -@@ -1220,6 +1221,7 @@ STEXI - @findex host_net_remove - Remove host VLAN client. - ETEXI -+#endif - - { - .name = "netdev_add", diff --git a/SOURCES/kvm-monitor-Remove-usb_add-del-commands-for-Red-Hat-Enterprise-Linux.patch b/SOURCES/kvm-monitor-Remove-usb_add-del-commands-for-Red-Hat-Enterprise-Linux.patch deleted file mode 100644 index c434691..0000000 --- a/SOURCES/kvm-monitor-Remove-usb_add-del-commands-for-Red-Hat-Enterprise-Linux.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 281e06456233e258735f98561fdeb309f3c3c485 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina <mrezanin@redhat.com> -Date: Wed, 6 Nov 2013 12:36:03 +0100 -Subject: monitor: Remove usb_add/del commands for Red Hat Enterprise Linux - -RH-Author: Miroslav Rezanina <mrezanin@redhat.com> -Message-id: <daf2ca0042519cd01a6a68d30eb76bdd8b88c9f2.1383741033.git.mrezanin@redhat.com> -Patchwork-id: 55520 -O-Subject: [RHEL7 qemu-kvm PATCH v2 3/4] monitor: Remove usb_add/del commands for Red Hat Enterprise Linux -Bugzilla: 1010858 -RH-Acked-by: Michal Novotny <minovotn@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Orit Wasserman <owasserm@redhat.com> -RH-Acked-by: Eric Blake <eblake@redhat.com> - -From: Miroslav Rezanina <mrezanin@redhat.com> - -This is forwardport of RHEL-6 commit 754e6292b4ab41c8848171555af830ab7284f4d3: - - monitor: Remove usb_add/del commands for Red Hat Enterprise Linux - - The usb_add/del commands have been obsoleted by the device_add/del - commands. - - Signed-off-by: Amit Shah <amit.shah@redhat.com> - -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -diff --git a/hmp-commands.hx b/hmp-commands.hx -index 6089b01..008440b 100644 ---- a/hmp-commands.hx -+++ b/hmp-commands.hx -@@ -625,6 +625,7 @@ STEXI - Compute the checksum of a memory region. - ETEXI - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - { - .name = "usb_add", - .args_type = "devname:s", -@@ -655,6 +656,7 @@ Remove the USB device @var{devname} from the QEMU virtual USB - hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor - command @code{info usb} to see the devices you can remove. - ETEXI -+#endif - - { - .name = "device_add", diff --git a/SOURCES/kvm-monitor-check-return-value-of-qemu_find_net_clients_.patch b/SOURCES/kvm-monitor-check-return-value-of-qemu_find_net_clients_.patch deleted file mode 100644 index 62477df..0000000 --- a/SOURCES/kvm-monitor-check-return-value-of-qemu_find_net_clients_.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 3146aa735b74b82fa27090f77c11d3e8d8bfe0f1 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:43 +0200 -Subject: [PATCH 022/217] monitor: check return value of - qemu_find_net_clients_except() - -Message-id: <1434607916-15166-8-git-send-email-jasowang@redhat.com> -Patchwork-id: 66305 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 07/20] monitor: check return value of qemu_find_net_clients_except() -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -qemu_find_net_clients_except() may return a value which is greater -than the size of array we provided. So we should check this value -before using it, otherwise this may cause unexpected memory access. - -This patch fixes the net related command completion when we have a -virtio-net nic with more than 255 queues. - -Cc: Luiz Capitulino <lcapitulino@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit bcfa4d60144fb879f0ffef0a6d174faa37b2df82) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - monitor.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/monitor.c b/monitor.c -index a039edf..2b5643d 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -4477,7 +4477,7 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str) - count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NONE, - MAX_QUEUE_NUM); -- for (i = 0; i < count; i++) { -+ for (i = 0; i < MIN(count, MAX_QUEUE_NUM); i++) { - const char *name = ncs[i]->name; - if (!strncmp(str, name, len)) { - readline_add_completion(rs, name); -@@ -4502,7 +4502,7 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) - readline_set_completion_index(rs, len); - count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, - MAX_QUEUE_NUM); -- for (i = 0; i < count; i++) { -+ for (i = 0; i < MIN(count, MAX_QUEUE_NUM); i++) { - QemuOpts *opts; - const char *name = ncs[i]->name; - if (strncmp(str, name, len)) { -@@ -4576,7 +4576,7 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) - count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NONE, - MAX_QUEUE_NUM); -- for (i = 0; i < count; i++) { -+ for (i = 0; i < MIN(count, MAX_QUEUE_NUM); i++) { - int id; - char name[16]; - -@@ -4593,7 +4593,7 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) - count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NIC, - MAX_QUEUE_NUM); -- for (i = 0; i < count; i++) { -+ for (i = 0; i < MIN(count, MAX_QUEUE_NUM); i++) { - int id; - const char *name; - --- -1.8.3.1 - diff --git a/SOURCES/kvm-monitor-replace-the-magic-number-255-with-MAX_QUEUE_.patch b/SOURCES/kvm-monitor-replace-the-magic-number-255-with-MAX_QUEUE_.patch deleted file mode 100644 index 5bca93f..0000000 --- a/SOURCES/kvm-monitor-replace-the-magic-number-255-with-MAX_QUEUE_.patch +++ /dev/null @@ -1,94 +0,0 @@ -From f1fcc0c935636bb6f94a21de8900113f13b179d2 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:42 +0200 -Subject: [PATCH 021/217] monitor: replace the magic number 255 with - MAX_QUEUE_NUM - -Message-id: <1434607916-15166-7-git-send-email-jasowang@redhat.com> -Patchwork-id: 66308 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 06/20] monitor: replace the magic number 255 with MAX_QUEUE_NUM -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -This patch replace the magic number 255, and increase it to -MAX_QUEUE_NUM which is maximum number of queues supported by a nic. - -Cc: Luiz Capitulino <lcapitulino@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit eaed483c1b3db1ac312116fca5d20c45b4b418b2) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - monitor.c | 17 ++++++++++------- - 1 file changed, 10 insertions(+), 7 deletions(-) - -diff --git a/monitor.c b/monitor.c -index 68873ec..a039edf 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -4472,10 +4472,11 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str) - len = strlen(str); - readline_set_completion_index(rs, len); - if (nb_args == 2) { -- NetClientState *ncs[255]; -+ NetClientState *ncs[MAX_QUEUE_NUM]; - int count, i; - count = qemu_find_net_clients_except(NULL, ncs, -- NET_CLIENT_OPTIONS_KIND_NONE, 255); -+ NET_CLIENT_OPTIONS_KIND_NONE, -+ MAX_QUEUE_NUM); - for (i = 0; i < count; i++) { - const char *name = ncs[i]->name; - if (!strncmp(str, name, len)) { -@@ -4491,7 +4492,7 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str) - void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) - { - int len, count, i; -- NetClientState *ncs[255]; -+ NetClientState *ncs[MAX_QUEUE_NUM]; - - if (nb_args != 2) { - return; -@@ -4500,7 +4501,7 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) - len = strlen(str); - readline_set_completion_index(rs, len); - count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, -- 255); -+ MAX_QUEUE_NUM); - for (i = 0; i < count; i++) { - QemuOpts *opts; - const char *name = ncs[i]->name; -@@ -4566,14 +4567,15 @@ void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str) - - void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) - { -- NetClientState *ncs[255]; -+ NetClientState *ncs[MAX_QUEUE_NUM]; - int count, i, len; - - len = strlen(str); - readline_set_completion_index(rs, len); - if (nb_args == 2) { - count = qemu_find_net_clients_except(NULL, ncs, -- NET_CLIENT_OPTIONS_KIND_NONE, 255); -+ NET_CLIENT_OPTIONS_KIND_NONE, -+ MAX_QUEUE_NUM); - for (i = 0; i < count; i++) { - int id; - char name[16]; -@@ -4589,7 +4591,8 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) - return; - } else if (nb_args == 3) { - count = qemu_find_net_clients_except(NULL, ncs, -- NET_CLIENT_OPTIONS_KIND_NIC, 255); -+ NET_CLIENT_OPTIONS_KIND_NIC, -+ MAX_QUEUE_NUM); - for (i = 0; i < count; i++) { - int id; - const char *name; --- -1.8.3.1 - diff --git a/SOURCES/kvm-numa-Don-t-allow-memdev-on-RHEL-6-machine-types.patch b/SOURCES/kvm-numa-Don-t-allow-memdev-on-RHEL-6-machine-types.patch deleted file mode 100644 index 5c2db4b..0000000 --- a/SOURCES/kvm-numa-Don-t-allow-memdev-on-RHEL-6-machine-types.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8e8107cb36924e14a027173e07d3b94afba64b23 Mon Sep 17 00:00:00 2001 -From: Eduardo Habkost <ehabkost@redhat.com> -Date: Wed, 3 Dec 2014 17:29:13 -0600 -Subject: numa: Don't allow memdev= on RHEL-6 machine-types - -RH-Author: Eduardo Habkost <ehabkost@redhat.com> -Message-id: <1417627753-6012-1-git-send-email-ehabkost@redhat.com> -Patchwork-id: 62655 -O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCH] numa: Don't allow memdev= on RHEL-6 machine-types -Bugzilla: 1170093 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -The hack added to fix bz#1027565 breaks when using the "-numa -...,memdev=..." option, because multiple blocks are registered for RAM -(one for each NUMA node). - -As RHEL-6 didn't support "-numa memdev=", simply disallow the memdev -option when running machine-types that have the BIOS shadowing hack -(rhel6.*). This is safer than changing the hack to work on a case that -was never supported before. - -Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> -Signed-off-by: Jeff E. Nelson <jen@redhat.com> - -diff --git a/numa.c b/numa.c -index c975fb2..bd6119a 100644 ---- a/numa.c -+++ b/numa.c -@@ -355,6 +355,19 @@ 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 < MAX_NODES; i++) { - Error *local_err = NULL; diff --git a/SOURCES/kvm-pc-acpi-fix-pvpanic-for-buggy-guests.patch b/SOURCES/kvm-pc-acpi-fix-pvpanic-for-buggy-guests.patch deleted file mode 100644 index 60ac979..0000000 --- a/SOURCES/kvm-pc-acpi-fix-pvpanic-for-buggy-guests.patch +++ /dev/null @@ -1,73 +0,0 @@ -From a8a013d9f8b70420b56ad211fdbd6c106b870424 Mon Sep 17 00:00:00 2001 -From: Radim Krcmar <rkrcmar@redhat.com> -Date: Tue, 23 Jun 2015 15:00:46 +0200 -Subject: [PATCH 037/217] pc: acpi: fix pvpanic for buggy guests -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1435071646-9165-1-git-send-email-rkrcmar@redhat.com> -Patchwork-id: 66365 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH] pc: acpi: fix pvpanic for buggy guests -Bugzilla: 1221943 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -In the old times, we always had pvpanic in ACPI and a _STA method told -the guest not to use it. Automatic generation dropped the _STA method -as the specification says that missing _STA means enabled and working. -Some guests (Linux) had buggy drivers and this change made them unable -to utilize pvpanic. - -A Linux patch is posted as well, but I think it's worth to make pvpanic -useable on old guests at the price of three lines and few bytes of SSDT. - -The old _STA method was - Method (_STA, 0, NotSerialized) { - Store (PEST, Local0) - If (LEqual (Local0, Zero)) { - Return (Zero) } - Else { - Return (0x0F) }} - -Igor pointed out that we don't need to use a method to return a constant -and that 0xB (don't show in UI) is the common definition now. - -Also, the device used to be PEVT. (PEVT as in "panic event"?) - -Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 2332333c9738b442fbbd5b83a1eaa6be656ab9b5) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/i386/acpi-build.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 8773e8f..d7f0a4e 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -787,7 +787,7 @@ build_ssdt(GArray *table_data, GArray *linker, - if (misc->pvpanic_port) { - scope = aml_scope("\\_SB.PCI0.ISA"); - -- dev = aml_device("PEVR"); -+ dev = aml_device("PEVT"); - aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001"))); - - crs = aml_resource_template(); -@@ -802,6 +802,9 @@ build_ssdt(GArray *table_data, GArray *linker, - aml_append(field, aml_named_field("PEPT", 8)); - aml_append(dev, field); - -+ /* device present, functioning, decoding, not shown in UI */ -+ aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); -+ - method = aml_method("RDPT", 0); - aml_append(method, aml_store(aml_name("PEPT"), aml_local(0))); - aml_append(method, aml_return(aml_local(0))); --- -1.8.3.1 - diff --git a/SOURCES/kvm-pc-dimm-don-t-assert-if-pc-dimm-alignment-hotpluggab.patch b/SOURCES/kvm-pc-dimm-don-t-assert-if-pc-dimm-alignment-hotpluggab.patch deleted file mode 100644 index edacceb..0000000 --- a/SOURCES/kvm-pc-dimm-don-t-assert-if-pc-dimm-alignment-hotpluggab.patch +++ /dev/null @@ -1,51 +0,0 @@ -From da4f684a395e76166c1369653254ed7985f81ffb Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Fri, 12 Jun 2015 14:49:40 +0200 -Subject: [PATCH 010/217] pc-dimm: don't assert if pc-dimm alignment != - hotpluggable mem range size - -Message-id: <1434120580-37949-1-git-send-email-imammedo@redhat.com> -Patchwork-id: 66016 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH] pc-dimm: don't assert if pc-dimm alignment != hotpluggable mem range size -Bugzilla: 1221425 -RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1221425 -Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=9353627 -Upstream commit: b5d3b039 - "pc-dimm: don't assert if pc-dimm alignment != hotpluggable mem range size" - -Drop superfluous pc-dimm alignment on hot-pluggable mem -range size assert, since it causes QEMU crash during hotplug -when hotplugging pc-dimm with alignment bigger than -an alignment of hot-pluggable mem range size. - -Instead allow pc_dimm_get_free_addr() find free address -and bail out gracefully later in that function during -checking if pc-dimm will fit in hot-pluggable mem range. - -Signed-off-by: Igor Mammedov <imammedo@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/mem/pc-dimm.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c -index 39f0c97..e70633d 100644 ---- a/hw/mem/pc-dimm.c -+++ b/hw/mem/pc-dimm.c -@@ -211,7 +211,6 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start, - uint64_t address_space_end = address_space_start + address_space_size; - - g_assert(QEMU_ALIGN_UP(address_space_start, align) == address_space_start); -- g_assert(QEMU_ALIGN_UP(address_space_size, align) == address_space_size); - - if (!address_space_size) { - error_setg(errp, "memory hotplug is not enabled, " --- -1.8.3.1 - diff --git a/SOURCES/kvm-pc_sysfw-prevent-pflash-and-or-mis-sized-firmware-for-rhel6-x-0.patch b/SOURCES/kvm-pc_sysfw-prevent-pflash-and-or-mis-sized-firmware-for-rhel6-x-0.patch deleted file mode 100644 index 452ec98..0000000 --- a/SOURCES/kvm-pc_sysfw-prevent-pflash-and-or-mis-sized-firmware-for-rhel6-x-0.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 8b220c0e9012168a4ce09e429cb8e8920b74d96f Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek <lersek@redhat.com> -Date: Thu, 19 Mar 2015 08:24:51 +0100 -Subject: pc_sysfw: prevent pflash and/or mis-sized firmware for rhel6.x.0 - -Message-id: <1422371804-27044-2-git-send-email-lersek@redhat.com> -Patchwork-id: 63581 -O-Subject: [RHEV-7.2 qemu-kvm-rhev PATCH 1/1] pc_sysfw: prevent pflash and/or mis-sized firmware for rhel6.x.0 machtypes -Bugzilla: 1175099 -RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com> -RH-Acked-by: Markus Armbruster <armbru@redhat.com> -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> - -QE tried to boot OVMF on a rhel6.x.0 machine type. The shadow_bios() -migration hack that is in effect for those machine types is not compatible -with the OVMF image. An assert() in shadow_bios() catches it, but -- given -that OVMF has never been intended for rhel6.x.0 machine types -- QE has -rather requested us to deny such startups cleanly. - -The first hunk prevents "-M rhel6.x.0 -bios ..." style invocations where -the BIOS image is not 128 KB in size. This was suggested by Paolo and it -prevents the case when someone passes an OVMF binary via -bios. - -The second hunk prevents "-M rhel6.x.0 -pflash ...", since that -configuration (for boot firmware purposes or otherwise) was never -supported. - -Downstream only. - -Signed-off-by: Laszlo Ersek <lersek@redhat.com> - -diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c -index 662d997..f342e4d 100644 ---- a/hw/i386/pc_sysfw.c -+++ b/hw/i386/pc_sysfw.c -@@ -192,6 +192,13 @@ 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_abort); - vmstate_register_ram_global(bios); -@@ -240,6 +247,15 @@ 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/SOURCES/kvm-pci-add-PCI_CLASS_INPUT_.patch b/SOURCES/kvm-pci-add-PCI_CLASS_INPUT_.patch deleted file mode 100644 index aab8e44..0000000 --- a/SOURCES/kvm-pci-add-PCI_CLASS_INPUT_.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 868c4a5cc66e9bb08c59d07678f511d80a8c7685 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:56 +0200 -Subject: [PATCH 168/217] pci: add PCI_CLASS_INPUT_* - -Message-id: <1436260751-25015-54-git-send-email-jasowang@redhat.com> -Patchwork-id: 66828 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 53/68] pci: add PCI_CLASS_INPUT_* -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit ffaa05037134d48e3ccd7ebbf2d58db26590b96d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/pci/pci_ids.h | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/include/hw/pci/pci_ids.h b/include/hw/pci/pci_ids.h -index d7be386..dfccefc 100644 ---- a/include/hw/pci/pci_ids.h -+++ b/include/hw/pci/pci_ids.h -@@ -46,6 +46,13 @@ - #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 - #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 - -+#define PCI_CLASS_INPUT_KEYBOARD 0x0900 -+#define PCI_CLASS_INPUT_PEN 0x0901 -+#define PCI_CLASS_INPUT_MOUSE 0x0902 -+#define PCI_CLASS_INPUT_SCANNER 0x0903 -+#define PCI_CLASS_INPUT_GAMEPORT 0x0904 -+#define PCI_CLASS_INPUT_OTHER 0x0980 -+ - #define PCI_CLASS_PROCESSOR_CO 0x0b40 - #define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 - --- -1.8.3.1 - diff --git a/SOURCES/kvm-pci-assign-cap-number-of-devices-that-can-be-assigned.patch b/SOURCES/kvm-pci-assign-cap-number-of-devices-that-can-be-assigned.patch deleted file mode 100644 index 6a048ea..0000000 --- a/SOURCES/kvm-pci-assign-cap-number-of-devices-that-can-be-assigned.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 12f78e5b82f76e18700bfc85d8d4d30345d88690 Mon Sep 17 00:00:00 2001 -From: Bandan Das <bsd@redhat.com> -Date: Tue, 3 Dec 2013 20:05:12 +0100 -Subject: pci-assign: cap number of devices that can be assigned - -RH-Author: Bandan Das <bsd@redhat.com> -Message-id: <1386101113-31560-2-git-send-email-bsd@redhat.com> -Patchwork-id: 55983 -O-Subject: [PATCH RHEL7 qemu-kvm v2 1/2] pci-assign: 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> - -Legacy device assignment is not supported for RHEL7, nevertheless, -it makes sense to enforce the limit here was well in case we need -to support it in the future. Note that 8 is the limit enforced on -RHEL 6, RHEL 5 too has a static limit of 8 assigned devices. - -Signed-off-by: Bandan Das <bsd@redhat.com> - -diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c -index 9db7c77..bdeb0c3 100644 ---- a/hw/i386/kvm/pci-assign.c -+++ b/hw/i386/kvm/pci-assign.c -@@ -139,8 +139,12 @@ typedef struct AssignedDevice { - MemoryRegion mmio; - char *configfd_name; - int32_t bootindex; -+ QLIST_ENTRY(AssignedDevice) next; - } AssignedDevice; - -+#define MAX_DEV_ASSIGN_CMDLINE 8 -+static QLIST_HEAD(, AssignedDevice) devs = QLIST_HEAD_INITIALIZER(devs); -+ - static void assigned_dev_update_irq_routing(PCIDevice *dev); - - static void assigned_dev_load_option_rom(AssignedDevice *dev); -@@ -1741,8 +1745,9 @@ static void reset_assigned_device(DeviceState *dev) - static void assigned_realize(struct PCIDevice *pci_dev, Error **errp) - { - AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); -+ AssignedDevice *adev; - uint8_t e_intx; -- int r; -+ int r, i = 0; - Error *local_err = NULL; - - if (!kvm_enabled()) { -@@ -1750,6 +1755,16 @@ static void assigned_realize(struct PCIDevice *pci_dev, Error **errp) - goto exit_with_error; - } - -+ QLIST_FOREACH(adev, &devs, next) { -+ i++; -+ } -+ -+ if (i >= MAX_DEV_ASSIGN_CMDLINE) { -+ error_setg(&local_err, "pci-assign: Maximum supported assigned devices" -+ " (%d) already attached\n", MAX_DEV_ASSIGN_CMDLINE); -+ goto exit_with_error; -+ } -+ - if (!dev->host.domain && !dev->host.bus && !dev->host.slot && - !dev->host.function) { - error_setg(&local_err, "no host device specified"); -@@ -1819,6 +1834,7 @@ static void assigned_realize(struct PCIDevice *pci_dev, Error **errp) - goto assigned_out; - } - -+ QLIST_INSERT_HEAD(&devs, dev, next); - assigned_dev_load_option_rom(dev); - - return; -@@ -1838,6 +1854,7 @@ static void assigned_exitfn(struct PCIDevice *pci_dev) - { - AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); - -+ QLIST_REMOVE(dev, next); - deassign_device(dev); - free_assigned_device(dev); - } diff --git a/SOURCES/kvm-pci-make-pci_bar-useable-outside-pci.c.patch b/SOURCES/kvm-pci-make-pci_bar-useable-outside-pci.c.patch deleted file mode 100644 index 0f1266e..0000000 --- a/SOURCES/kvm-pci-make-pci_bar-useable-outside-pci.c.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 27f0062aeac82d564e04a9db63dadbe6372d8d2f Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:39 +0200 -Subject: [PATCH 100/217] pci: make pci_bar useable outside pci.c - -Message-id: <1435239881-28541-13-git-send-email-lvivier@redhat.com> -Patchwork-id: 66489 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 12/14] pci: make pci_bar useable outside pci.c -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -We need to work with PCI BARs to generate OF properties -during PCI hotplug for sPAPR guests. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Acked-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit cf8c704d5a06e7b8327c65d19d0c342dc23fff84) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/pci.c | 2 +- - include/hw/pci/pci.h | 6 ++++++ - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index b3d5100..e57255e 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -123,7 +123,7 @@ static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU; - - static QLIST_HEAD(, PCIHostState) pci_host_bridges; - --static int pci_bar(PCIDevice *d, int reg) -+int pci_bar(PCIDevice *d, int reg) - { - uint8_t type; - -diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h -index b97c295..8558d6e 100644 ---- a/include/hw/pci/pci.h -+++ b/include/hw/pci/pci.h -@@ -333,6 +333,12 @@ int pci_device_load(PCIDevice *s, QEMUFile *f); - MemoryRegion *pci_address_space(PCIDevice *dev); - MemoryRegion *pci_address_space_io(PCIDevice *dev); - -+/* -+ * Should not normally be used by devices. For use by sPAPR target -+ * where QEMU emulates firmware. -+ */ -+int pci_bar(PCIDevice *d, int reg); -+ - typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level); - typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num); - typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin); --- -1.8.3.1 - diff --git a/SOURCES/kvm-pci-remove-hard-coded-bar-size-in-msix_init_exclusiv.patch b/SOURCES/kvm-pci-remove-hard-coded-bar-size-in-msix_init_exclusiv.patch deleted file mode 100644 index a7a4cb5..0000000 --- a/SOURCES/kvm-pci-remove-hard-coded-bar-size-in-msix_init_exclusiv.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 7a67550485c32b2516750c4179b7a27a79e8146b Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:46 +0200 -Subject: [PATCH 025/217] pci: remove hard-coded bar size in - msix_init_exclusive_bar() - -Message-id: <1434607916-15166-11-git-send-email-jasowang@redhat.com> -Patchwork-id: 66315 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 10/20] pci: remove hard-coded bar size in msix_init_exclusive_bar() -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -This patch lets msix_init_exclusive_bar() can calculate the bar and -pba size based on the number of MSI-X vectors other than using a -hard-coded limit 4096. This is needed to allow device to have more -than 128 MSI_X vectors. To keep migration compatibility, keep using -4096 as bar size and 2048 for pba offset. - -Notes: We don't care about the case that using vectors > 128 for -legacy machine type. Since we limit the queue max to 64, so vectors >= -65 is meaningless. - -Virtio device will be the first user for this. - -Cc: Keith Busch <keith.busch@intel.com> -Cc: Kevin Wolf <kwolf@redhat.com> -Cc: Stefan Hajnoczi <stefanha@redhat.com> -Cc: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit a0ccd2123ee2f83a1f081e4c39013c3316f9ec7a) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/pci/msix.c | 30 +++++++++++++++++++----------- - 1 file changed, 19 insertions(+), 11 deletions(-) - -diff --git a/hw/pci/msix.c b/hw/pci/msix.c -index 24de260..f8748cf 100644 ---- a/hw/pci/msix.c -+++ b/hw/pci/msix.c -@@ -295,29 +295,37 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, - { - int ret; - char *name; -+ uint32_t bar_size = 4096; -+ uint32_t bar_pba_offset = bar_size / 2; -+ uint32_t bar_pba_size = (nentries / 8 + 1) * 8; - - /* - * Migration compatibility dictates that this remains a 4k - * BAR with the vector table in the lower half and PBA in -- * the upper half. Do not use these elsewhere! -+ * the upper half for nentries which is lower or equal to 128. -+ * No need to care about using more than 65 entries for legacy -+ * machine types who has at most 64 queues. - */ --#define MSIX_EXCLUSIVE_BAR_SIZE 4096 --#define MSIX_EXCLUSIVE_BAR_TABLE_OFFSET 0 --#define MSIX_EXCLUSIVE_BAR_PBA_OFFSET (MSIX_EXCLUSIVE_BAR_SIZE / 2) --#define MSIX_EXCLUSIVE_CAP_OFFSET 0 -+ if (nentries * PCI_MSIX_ENTRY_SIZE > bar_pba_offset) { -+ bar_pba_offset = nentries * PCI_MSIX_ENTRY_SIZE; -+ } - -- if (nentries * PCI_MSIX_ENTRY_SIZE > MSIX_EXCLUSIVE_BAR_PBA_OFFSET) { -- return -EINVAL; -+ if (bar_pba_offset + bar_pba_size > 4096) { -+ bar_size = bar_pba_offset + bar_pba_size; -+ } -+ -+ if (bar_size & (bar_size - 1)) { -+ bar_size = 1 << qemu_fls(bar_size); - } - - name = g_strdup_printf("%s-msix", dev->name); -- memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, MSIX_EXCLUSIVE_BAR_SIZE); -+ memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, bar_size); - g_free(name); - - ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr, -- MSIX_EXCLUSIVE_BAR_TABLE_OFFSET, &dev->msix_exclusive_bar, -- bar_nr, MSIX_EXCLUSIVE_BAR_PBA_OFFSET, -- MSIX_EXCLUSIVE_CAP_OFFSET); -+ 0, &dev->msix_exclusive_bar, -+ bar_nr, bar_pba_offset, -+ 0); - if (ret) { - return ret; - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-pseries-Enable-in-kernel-H_LOGICAL_CI_-LOAD-STORE-im.patch b/SOURCES/kvm-pseries-Enable-in-kernel-H_LOGICAL_CI_-LOAD-STORE-im.patch deleted file mode 100644 index bb0fbc9..0000000 --- a/SOURCES/kvm-pseries-Enable-in-kernel-H_LOGICAL_CI_-LOAD-STORE-im.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 9c94ac69a0301cf41267fded8c2e812c4f975426 Mon Sep 17 00:00:00 2001 -From: David Gibson <dgibson@redhat.com> -Date: Fri, 3 Jul 2015 04:56:16 +0200 -Subject: [PATCH 105/217] pseries: Enable in-kernel H_LOGICAL_CI_{LOAD, STORE} - implementations - -Message-id: <1435899376-15918-1-git-send-email-dgibson@redhat.com> -Patchwork-id: 66618 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH] pseries: Enable in-kernel H_LOGICAL_CI_{LOAD, STORE} implementations -Bugzilla: 1217277 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -qemu currently implements the hypercalls H_LOGICAL_CI_LOAD and -H_LOGICAL_CI_STORE as PAPR extensions. These are used by the SLOF firmware -for IO, because performing cache inhibited MMIO accesses with the MMU off -(real mode) is very awkward on POWER. - -This approach breaks when SLOF needs to access IO devices implemented -within KVM instead of in qemu. The simplest example would be virtio-blk -using an iothread, because the iothread / dataplane mechanism relies on -an in-kernel implementation of the virtio queue notification MMIO. - -To fix this, an in-kernel implementation of these hypercalls has been made, -(kernel commit 99342cf "kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM" -however, the hypercalls still need to be enabled from qemu. This performs -the necessary calls to do so. - -It would be nice to provide some warning if we encounter a problematic -device with a kernel which doesn't support the new calls. Unfortunately, -I can't see a way to detect this case which won't either warn in far too -many cases that will probably work, or which is horribly invasive. - -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Reviewed-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 026bfd89cb896c8a3460cc551cc4836219bd7ff9) - -Signed-off-by: David Gibson <dgibson@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr.c | 5 +++++ - target-ppc/kvm.c | 17 +++++++++++++++++ - target-ppc/kvm_ppc.h | 5 +++++ - 3 files changed, 27 insertions(+) - -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index 41930d8..21bb6da 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -1506,6 +1506,11 @@ static void ppc_spapr_init(MachineState *machine) - qemu_register_reset(spapr_cpu_reset, cpu); - } - -+ if (kvm_enabled()) { -+ /* Enable H_LOGICAL_CI_* so SLOF can talk to in-kernel devices */ -+ kvmppc_enable_logical_ci_hcalls(); -+ } -+ - /* allocate RAM */ - spapr->ram_limit = ram_size; - memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", -diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c -index 12328a4..16f62b5 100644 ---- a/target-ppc/kvm.c -+++ b/target-ppc/kvm.c -@@ -1882,6 +1882,23 @@ int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len) - return 0; - } - -+static inline int kvmppc_enable_hcall(KVMState *s, target_ulong hcall) -+{ -+ return kvm_vm_enable_cap(s, KVM_CAP_PPC_ENABLE_HCALL, 0, hcall, 1); -+} -+ -+void kvmppc_enable_logical_ci_hcalls(void) -+{ -+ /* -+ * FIXME: it would be nice if we could detect the cases where -+ * we're using a device which requires the in kernel -+ * implementation of these hcalls, but the kernel lacks them and -+ * produce a warning. -+ */ -+ kvmppc_enable_hcall(kvm_state, H_LOGICAL_CI_LOAD); -+ kvmppc_enable_hcall(kvm_state, H_LOGICAL_CI_STORE); -+} -+ - void kvmppc_set_papr(PowerPCCPU *cpu) - { - CPUState *cs = CPU(cpu); -diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h -index 2e0224c..4d30e27 100644 ---- a/target-ppc/kvm_ppc.h -+++ b/target-ppc/kvm_ppc.h -@@ -24,6 +24,7 @@ bool kvmppc_get_host_serial(char **buf); - int kvmppc_get_hasidle(CPUPPCState *env); - int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len); - int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level); -+void kvmppc_enable_logical_ci_hcalls(void); - void kvmppc_set_papr(PowerPCCPU *cpu); - int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version); - void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy); -@@ -107,6 +108,10 @@ static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level) - return -1; - } - -+static inline void kvmppc_enable_logical_ci_hcalls(void) -+{ -+} -+ - static inline void kvmppc_set_papr(PowerPCCPU *cpu) - { - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-qcow2-Add-DEFAULT_L2_CACHE_CLUSTERS.patch b/SOURCES/kvm-qcow2-Add-DEFAULT_L2_CACHE_CLUSTERS.patch deleted file mode 100644 index d317207..0000000 --- a/SOURCES/kvm-qcow2-Add-DEFAULT_L2_CACHE_CLUSTERS.patch +++ /dev/null @@ -1,91 +0,0 @@ -From a2cddcefc2f079206c872162c120cee7b695734e Mon Sep 17 00:00:00 2001 -From: Max Reitz <mreitz@redhat.com> -Date: Wed, 17 Jun 2015 12:42:56 +0200 -Subject: [PATCH 014/217] qcow2: Add DEFAULT_L2_CACHE_CLUSTERS - -Message-id: <1434544976-15816-4-git-send-email-mreitz@redhat.com> -Patchwork-id: 66283 -O-Subject: [RHEV-7.2 qemu-kvm-rhev PATCH 3/3] qcow2: Add DEFAULT_L2_CACHE_CLUSTERS -Bugzilla: 1226996 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Kevin Wolf <kwolf@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -BZ: 1226996 - -If a relatively large cluster size is chosen, the default of 1 MB L2 -cache is not really appropriate. In this case, unless overridden by the -user, the default cache size should not be determined by its size in -bytes but by the number of L2 tables (clusters) it is supposed to -contain. - -Note that without this patch, MIN_L2_CACHE_SIZE will effectively take -over the same role. However, providing space for just two L2 tables is -not enough to be the default. - -Signed-off-by: Max Reitz <mreitz@redhat.com> -Reviewed-by: Alberto Garcia <berto@igalia.com> -Signed-off-by: Kevin Wolf <kwolf@redhat.com> -(cherry picked from commit bc85ef265a0118d044ff62ae217c186cb08e0866) - -Signed-off-by: Max Reitz <mreitz@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - block/qcow2.c | 11 ++++++++--- - block/qcow2.h | 2 ++ - 2 files changed, 10 insertions(+), 3 deletions(-) - -diff --git a/block/qcow2.c b/block/qcow2.c -index 316a8db..cab8450 100644 ---- a/block/qcow2.c -+++ b/block/qcow2.c -@@ -483,9 +483,11 @@ static const char *overlap_bool_option_names[QCOW2_OL_MAX_BITNR] = { - [QCOW2_OL_INACTIVE_L2_BITNR] = QCOW2_OPT_OVERLAP_INACTIVE_L2, - }; - --static void read_cache_sizes(QemuOpts *opts, uint64_t *l2_cache_size, -+static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, -+ uint64_t *l2_cache_size, - uint64_t *refcount_cache_size, Error **errp) - { -+ BDRVQcowState *s = bs->opaque; - uint64_t combined_cache_size; - bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_set; - -@@ -525,7 +527,9 @@ static void read_cache_sizes(QemuOpts *opts, uint64_t *l2_cache_size, - } - } else { - if (!l2_cache_size_set && !refcount_cache_size_set) { -- *l2_cache_size = DEFAULT_L2_CACHE_BYTE_SIZE; -+ *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, -+ (uint64_t)DEFAULT_L2_CACHE_CLUSTERS -+ * s->cluster_size); - *refcount_cache_size = *l2_cache_size - / DEFAULT_L2_REFCOUNT_SIZE_RATIO; - } else if (!l2_cache_size_set) { -@@ -803,7 +807,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, - goto fail; - } - -- read_cache_sizes(opts, &l2_cache_size, &refcount_cache_size, &local_err); -+ read_cache_sizes(bs, opts, &l2_cache_size, &refcount_cache_size, -+ &local_err); - if (local_err) { - error_propagate(errp, local_err); - ret = -EINVAL; -diff --git a/block/qcow2.h b/block/qcow2.h -index 2f20949..22f9ac2 100644 ---- a/block/qcow2.h -+++ b/block/qcow2.h -@@ -68,6 +68,8 @@ - /* Must be at least 4 to cover all cases of refcount table growth */ - #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ - -+/* Whichever is more */ -+#define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */ - #define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ - - /* The refblock cache needs only a fourth of the L2 cache size to cover as many --- -1.8.3.1 - diff --git a/SOURCES/kvm-qcow2-Set-MIN_L2_CACHE_SIZE-to-2.patch b/SOURCES/kvm-qcow2-Set-MIN_L2_CACHE_SIZE-to-2.patch deleted file mode 100644 index a4394be..0000000 --- a/SOURCES/kvm-qcow2-Set-MIN_L2_CACHE_SIZE-to-2.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e8894d66a9c560a8fb72ec94fca58e74fcb6c0e5 Mon Sep 17 00:00:00 2001 -From: Max Reitz <mreitz@redhat.com> -Date: Wed, 17 Jun 2015 12:42:54 +0200 -Subject: [PATCH 012/217] qcow2: Set MIN_L2_CACHE_SIZE to 2 - -Message-id: <1434544976-15816-2-git-send-email-mreitz@redhat.com> -Patchwork-id: 66281 -O-Subject: [RHEV-7.2 qemu-kvm-rhev PATCH 1/3] qcow2: Set MIN_L2_CACHE_SIZE to 2 -Bugzilla: 1226996 -RH-Acked-by: Fam Zheng <famz@redhat.com> -RH-Acked-by: Kevin Wolf <kwolf@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -BZ: 1226996 - -The L2 cache must cover at least two L2 tables, because during COW two -L2 tables are accessed simultaneously. - -Reported-by: Alexander Graf <agraf@suse.de> -Cc: qemu-stable <qemu-stable@nongnu.org> -Signed-off-by: Max Reitz <mreitz@redhat.com> -Tested-by: Alexander Graf <agraf@suse.de> -Reviewed-by: Alberto Garcia <berto@igalia.com> -Signed-off-by: Kevin Wolf <kwolf@redhat.com> -(cherry picked from commit 57e216695948a79d9ced82fc217a37cce70fd986) - -Signed-off-by: Max Reitz <mreitz@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - block/qcow2.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/block/qcow2.h b/block/qcow2.h -index 422b825..2f20949 100644 ---- a/block/qcow2.h -+++ b/block/qcow2.h -@@ -62,7 +62,8 @@ - #define MIN_CLUSTER_BITS 9 - #define MAX_CLUSTER_BITS 21 - --#define MIN_L2_CACHE_SIZE 1 /* cluster */ -+/* Must be at least 2 to cover COW */ -+#define MIN_L2_CACHE_SIZE 2 /* clusters */ - - /* Must be at least 4 to cover all cases of refcount table growth */ - #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-qdev-add-64bit-properties.patch b/SOURCES/kvm-qdev-add-64bit-properties.patch deleted file mode 100644 index b3269d8..0000000 --- a/SOURCES/kvm-qdev-add-64bit-properties.patch +++ /dev/null @@ -1,128 +0,0 @@ -From aed0a3d7dfb646b9bf1ae138d3b399220b27ecbf Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:23 +0200 -Subject: [PATCH 135/217] qdev: add 64bit properties - -Message-id: <1436260751-25015-21-git-send-email-jasowang@redhat.com> -Patchwork-id: 66795 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 20/68] qdev: add 64bit properties -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Needed for virtio features which go from 32bit to 64bit with virtio 1.0 - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit fdba6d967e00864edd21275a6ee1d23a383510e8) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/core/qdev-properties.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ - include/hw/qdev-properties.h | 10 ++++++++ - 2 files changed, 68 insertions(+) - -diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c -index 570d5f0..a1606de 100644 ---- a/hw/core/qdev-properties.c -+++ b/hw/core/qdev-properties.c -@@ -125,6 +125,64 @@ PropertyInfo qdev_prop_bit = { - .set = prop_set_bit, - }; - -+/* Bit64 */ -+ -+static uint64_t qdev_get_prop_mask64(Property *prop) -+{ -+ assert(prop->info == &qdev_prop_bit); -+ return 0x1 << prop->bitnr; -+} -+ -+static void bit64_prop_set(DeviceState *dev, Property *props, bool val) -+{ -+ uint64_t *p = qdev_get_prop_ptr(dev, props); -+ uint64_t mask = qdev_get_prop_mask64(props); -+ if (val) { -+ *p |= mask; -+ } else { -+ *p &= ~mask; -+ } -+} -+ -+static void prop_get_bit64(Object *obj, Visitor *v, void *opaque, -+ const char *name, Error **errp) -+{ -+ DeviceState *dev = DEVICE(obj); -+ Property *prop = opaque; -+ uint64_t *p = qdev_get_prop_ptr(dev, prop); -+ bool value = (*p & qdev_get_prop_mask64(prop)) != 0; -+ -+ visit_type_bool(v, &value, name, errp); -+} -+ -+static void prop_set_bit64(Object *obj, Visitor *v, void *opaque, -+ const char *name, Error **errp) -+{ -+ DeviceState *dev = DEVICE(obj); -+ Property *prop = opaque; -+ Error *local_err = NULL; -+ bool value; -+ -+ if (dev->realized) { -+ qdev_prop_set_after_realize(dev, name, errp); -+ return; -+ } -+ -+ visit_type_bool(v, &value, name, &local_err); -+ if (local_err) { -+ error_propagate(errp, local_err); -+ return; -+ } -+ bit64_prop_set(dev, prop, value); -+} -+ -+PropertyInfo qdev_prop_bit64 = { -+ .name = "bool", -+ .description = "on/off", -+ .get = prop_get_bit64, -+ .set = prop_set_bit64, -+}; -+ - /* --- bool --- */ - - static void get_bool(Object *obj, Visitor *v, void *opaque, -diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h -index d67dad5..0cfff1c 100644 ---- a/include/hw/qdev-properties.h -+++ b/include/hw/qdev-properties.h -@@ -6,6 +6,7 @@ - /*** qdev-properties.c ***/ - - extern PropertyInfo qdev_prop_bit; -+extern PropertyInfo qdev_prop_bit64; - extern PropertyInfo qdev_prop_bool; - extern PropertyInfo qdev_prop_uint8; - extern PropertyInfo qdev_prop_uint16; -@@ -50,6 +51,15 @@ extern PropertyInfo qdev_prop_arraylen; - .qtype = QTYPE_QBOOL, \ - .defval = (bool)_defval, \ - } -+#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) { \ -+ .name = (_name), \ -+ .info = &(qdev_prop_bit), \ -+ .bitnr = (_bit), \ -+ .offset = offsetof(_state, _field) \ -+ + type_check(uint64_t, typeof_field(_state, _field)), \ -+ .qtype = QTYPE_QBOOL, \ -+ .defval = (bool)_defval, \ -+ } - - #define DEFINE_PROP_BOOL(_name, _state, _field, _defval) { \ - .name = (_name), \ --- -1.8.3.1 - diff --git a/SOURCES/kvm-qemu-iotests-Fix-broken-test-cases.patch b/SOURCES/kvm-qemu-iotests-Fix-broken-test-cases.patch deleted file mode 100644 index e4b8ac3..0000000 --- a/SOURCES/kvm-qemu-iotests-Fix-broken-test-cases.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2bdd0afd3cf38118b63d1e1c81329004575a7d0c Mon Sep 17 00:00:00 2001 -From: Kevin Wolf <kwolf@redhat.com> -Date: Tue, 2 Dec 2014 13:06:15 +0100 -Subject: qemu-iotests: Fix broken test cases - -Message-id: <1417525575-19744-1-git-send-email-kwolf@redhat.com> -Patchwork-id: 62638 -O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCH] qemu-iotests: Fix broken test cases -Bugzilla: 1169589 -RH-Acked-by: Jeffrey Cody <jcody@redhat.com> -RH-Acked-by: Max Reitz <mreitz@redhat.com> -RH-Acked-by: Markus Armbruster <armbru@redhat.com> - -This fixes a few qemu-iotests cases which currently fail in this tree -because of incomplete or wrong backports. - -051 and 087 have trivial output changes. - -071 would require whitelisting blkverify, but since this doesn't test -other drivers, but merely the QMP interface for blkdebug/blkverify, -which is only compiled in for debugging and not really supported anyway, -we can just skip the test. - -Signed-off-by: Kevin Wolf <kwolf@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Rebase notes: - 2.2.0: Different context in 087.out - -Conflicts: - tests/qemu-iotests/087.out - -diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out -index 042f1e2..ca4830c 100644 ---- a/tests/qemu-iotests/051.out -+++ b/tests/qemu-iotests/051.out -@@ -146,6 +146,7 @@ QEMU X.Y.Z monitor - type 'help' for more information - QEMU_PROG: -device ide-hd,drive=disk: Device initialization failed. - QEMU_PROG: -device ide-hd,drive=disk: Device 'ide-hd' could not be initialized - -+ - === Read-only === - - Testing: -drive file=TEST_DIR/t.qcow2,if=floppy,readonly=on -@@ -181,6 +182,7 @@ QEMU X.Y.Z monitor - type 'help' for more information - QEMU_PROG: -device ide-hd,drive=disk: Device initialization failed. - QEMU_PROG: -device ide-hd,drive=disk: Device 'ide-hd' could not be initialized - -+ - === Cache modes === - - Testing: -drive media=cdrom,cache=none -diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group -index bcf2578..fd03fe0 100644 ---- a/tests/qemu-iotests/group -+++ b/tests/qemu-iotests/group -@@ -77,7 +77,7 @@ - 068 rw auto quick - 069 rw auto quick - 070 rw auto quick --071 rw auto quick -+# 071 rw auto quick -- requires whitelisted blkverify - 072 rw auto quick - 073 rw auto quick - 074 rw auto quick diff --git a/SOURCES/kvm-qemu-iotests-Test-unaligned-sub-block-zero-write.patch b/SOURCES/kvm-qemu-iotests-Test-unaligned-sub-block-zero-write.patch deleted file mode 100644 index c5788fc..0000000 --- a/SOURCES/kvm-qemu-iotests-Test-unaligned-sub-block-zero-write.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 094660cb1db5071c972843f3ffee05f1f7b13cab Mon Sep 17 00:00:00 2001 -From: Fam Zheng <famz@redhat.com> -Date: Wed, 27 May 2015 06:53:52 +0200 -Subject: [PATCH 088/217] qemu-iotests: Test unaligned sub-block zero write - -Message-id: <1432709632-27105-3-git-send-email-famz@redhat.com> -Patchwork-id: 65134 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 2/2] qemu-iotests: Test unaligned sub-block zero write -Bugzilla: 1207034 -RH-Acked-by: Juan Quintela <quintela@redhat.com> -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Max Reitz <mreitz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> - -Test zero write in byte range 512~1024 for 4k alignment. - -Signed-off-by: Fam Zheng <famz@redhat.com> -Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> -Reviewed-by: Kevin Wolf <kwolf@redhat.com> -Message-id: 1431522721-3266-4-git-send-email-famz@redhat.com -Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> -(cherry picked from commit ab53c44718305d3fde3d9d2251889f1cab694be2) -Signed-off-by: Fam Zheng <famz@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - tests/qemu-iotests/033 | 13 +++++++++++++ - tests/qemu-iotests/033.out | 30 ++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+) - -diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 -index 4008f10..a61d8ce 100755 ---- a/tests/qemu-iotests/033 -+++ b/tests/qemu-iotests/033 -@@ -78,6 +78,19 @@ for align in 512 4k; do - echo - echo "== verifying patterns (2) ==" - do_test $align "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io -+ -+ echo -+ echo "== rewriting unaligned zeroes ==" -+ do_test $align "write -P 0xb 0x0 0x1000" "$TEST_IMG" | _filter_qemu_io -+ do_test $align "write -z 0x200 0x200" "$TEST_IMG" | _filter_qemu_io -+ -+ echo -+ echo "== verifying patterns (3) ==" -+ do_test $align "read -P 0xb 0x0 0x200" "$TEST_IMG" | _filter_qemu_io -+ do_test $align "read -P 0x0 0x200 0x200" "$TEST_IMG" | _filter_qemu_io -+ do_test $align "read -P 0xb 0x400 0xc00" "$TEST_IMG" | _filter_qemu_io -+ -+ echo - done - - # success, all done -diff --git a/tests/qemu-iotests/033.out b/tests/qemu-iotests/033.out -index 305949f..c3d18aa 100644 ---- a/tests/qemu-iotests/033.out -+++ b/tests/qemu-iotests/033.out -@@ -27,6 +27,21 @@ wrote 65536/65536 bytes at offset 65536 - read 131072/131072 bytes at offset 1024 - 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - -+== rewriting unaligned zeroes == -+wrote 4096/4096 bytes at offset 0 -+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+wrote 512/512 bytes at offset 512 -+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+== verifying patterns (3) == -+read 512/512 bytes at offset 0 -+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+read 512/512 bytes at offset 512 -+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+read 3072/3072 bytes at offset 1024 -+3 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+ - == preparing image == - wrote 1024/1024 bytes at offset 512 - 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -@@ -52,4 +67,19 @@ wrote 65536/65536 bytes at offset 65536 - == verifying patterns (2) == - read 131072/131072 bytes at offset 1024 - 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+== rewriting unaligned zeroes == -+wrote 4096/4096 bytes at offset 0 -+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+wrote 512/512 bytes at offset 512 -+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ -+== verifying patterns (3) == -+read 512/512 bytes at offset 0 -+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+read 512/512 bytes at offset 512 -+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+read 3072/3072 bytes at offset 1024 -+3 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -+ - *** done --- -1.8.3.1 - diff --git a/SOURCES/kvm-qmp-add-error-reason-to-the-BLOCK_IO_ERROR-event.patch b/SOURCES/kvm-qmp-add-error-reason-to-the-BLOCK_IO_ERROR-event.patch deleted file mode 100644 index b84f590..0000000 --- a/SOURCES/kvm-qmp-add-error-reason-to-the-BLOCK_IO_ERROR-event.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 235591e4c188d89ddcc4b95598414e7eba09635e Mon Sep 17 00:00:00 2001 -From: Luiz Capitulino <lcapitulino@redhat.com> -Date: Fri, 1 May 2015 13:47:09 +0200 -Subject: [PATCH 002/217] qmp: add error reason to the BLOCK_IO_ERROR event - -Message-id: <1430488030-11529-2-git-send-email-lcapitulino@redhat.com> -Patchwork-id: 64969 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 1/2] qmp: add error reason to the BLOCK_IO_ERROR event -Bugzilla: 1199174 -RH-Acked-by: Markus Armbruster <armbru@redhat.com> -RH-Acked-by: Kevin Wolf <kwolf@redhat.com> -RH-Acked-by: Eric Blake <eblake@redhat.com> - -This commit forward ports the following RHEL-7.0 commit to RHEL-7.2: - - commit 771a3a333eb0c9299a69a78ddb9c4181850b827d - Author: Laszlo Ersek <lersek@redhat.com> - Date: Thu Nov 21 16:27:18 2013 +0100 - - error reason in BLOCK_IO_ERROR / BLOCK_JOB_ERROR events (RHEL 6->7 fwd) - -I had to redo the work because now events use the QAPI, but it -was straightforward. - -There's one significant difference though: this commit does not -extend the BLOCK_JOB_ERROR event as did the RHEL-7.0 commit. The -reason is that this extension was supposed to be used only by vdsm -and I don't think there's a requirement to have the extension -in BLOCK_JOB_ERROR too. Let's not spread it. - -Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - block.c | 27 +++++++++++++++++++++++---- - docs/qmp/qmp-events.txt | 9 ++++++++- - qapi/block-core.json | 12 +++++++++++- - 3 files changed, 42 insertions(+), 6 deletions(-) - -diff --git a/block.c b/block.c -index f2f8ae7..2193868 100644 ---- a/block.c -+++ b/block.c -@@ -3666,9 +3666,25 @@ BlockErrorAction bdrv_get_error_action(BlockDriverState *bs, bool is_read, int e - } - } - -+/* https://bugzilla.redhat.com/show_bug.cgi?id=1199174 */ -+static RHEL7BlockErrorReason get_rhel7_error_reason(int error) -+{ -+ switch (error) { -+ case ENOSPC: -+ return RHEL7_BLOCK_ERROR_REASON_ENOSPC; -+ case EPERM: -+ return RHEL7_BLOCK_ERROR_REASON_EPERM; -+ case EIO: -+ return RHEL7_BLOCK_ERROR_REASON_EIO; -+ default: -+ return RHEL7_BLOCK_ERROR_REASON_EOTHER; -+ } -+} -+ - static void send_qmp_error_event(BlockDriverState *bs, - BlockErrorAction action, -- bool is_read, int error) -+ bool is_read, int error, -+ RHEL7BlockErrorReason res) - { - IoOperationType optype; - -@@ -3676,7 +3692,7 @@ static void send_qmp_error_event(BlockDriverState *bs, - qapi_event_send_block_io_error(bdrv_get_device_name(bs), optype, action, - bdrv_iostatus_is_enabled(bs), - error == ENOSPC, strerror(error), -- &error_abort); -+ res, &error_abort); - } - - /* This is done by device models because, while the block layer knows -@@ -3686,7 +3702,10 @@ static void send_qmp_error_event(BlockDriverState *bs, - void bdrv_error_action(BlockDriverState *bs, BlockErrorAction action, - bool is_read, int error) - { -+ RHEL7BlockErrorReason res; -+ - assert(error >= 0); -+ res = get_rhel7_error_reason(error); - - if (action == BLOCK_ERROR_ACTION_STOP) { - /* First set the iostatus, so that "info block" returns an iostatus -@@ -3704,10 +3723,10 @@ void bdrv_error_action(BlockDriverState *bs, BlockErrorAction action, - * also ensures that the STOP/RESUME pair of events is emitted. - */ - qemu_system_vmstop_request_prepare(); -- send_qmp_error_event(bs, action, is_read, error); -+ send_qmp_error_event(bs, action, is_read, error, res); - qemu_system_vmstop_request(RUN_STATE_IO_ERROR); - } else { -- send_qmp_error_event(bs, action, is_read, error); -+ send_qmp_error_event(bs, action, is_read, error, res); - } - } - -diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt -index d759d19..40c2917 100644 ---- a/docs/qmp/qmp-events.txt -+++ b/docs/qmp/qmp-events.txt -@@ -63,13 +63,20 @@ Data: - "ignore": error has been ignored - "report": error has been reported to the device - "stop": the VM is going to stop because of the error -+- "__com.redhat_reason": error reason, this is a RHEL7 extension, it's one of -+ the following (json-string): -+ "eio": errno EIO -+ "eperm": errno EPERM -+ "enospc": errno ENOSPC -+ "eother": any other errno (other than EIO, EPERM, ENOSPC) - - Example: - - { "event": "BLOCK_IO_ERROR", - "data": { "device": "ide0-hd1", - "operation": "write", -- "action": "stop" }, -+ "action": "stop", -+ "__com.redhat_reason": "enospc" }, - "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } - - Note: If action is "stop", a STOP event will eventually follow the -diff --git a/qapi/block-core.json b/qapi/block-core.json -index 7873084..8796eaf 100644 ---- a/qapi/block-core.json -+++ b/qapi/block-core.json -@@ -1780,6 +1780,14 @@ - 'fatal' : 'bool' } } - - ## -+# @RHEL7BlockErrorReason -+# -+# Block I/O error reason -+## -+{ 'enum': 'RHEL7BlockErrorReason', -+ 'data': [ 'enospc', 'eperm', 'eio', 'eother' ] } -+ -+## - # @BLOCK_IO_ERROR - # - # Emitted when a disk I/O error occurs -@@ -1799,6 +1807,8 @@ - # (This field is a debugging aid for humans, it should not - # be parsed by applications) (since: 2.2) - # -+# @__com.redhat_reason: error reason (RHEL7 vendor extension) -+# - # Note: If action is "stop", a STOP event will eventually follow the - # BLOCK_IO_ERROR event - # -@@ -1807,7 +1817,7 @@ - { 'event': 'BLOCK_IO_ERROR', - 'data': { 'device': 'str', 'operation': 'IoOperationType', - 'action': 'BlockErrorAction', '*nospace': 'bool', -- 'reason': 'str' } } -+ 'reason': 'str', '__com.redhat_reason': 'RHEL7BlockErrorReason' } } - - ## - # @BLOCK_JOB_COMPLETED --- -1.8.3.1 - diff --git a/SOURCES/kvm-qmp-event-add-event-notification-for-memory-hot-unpl.patch b/SOURCES/kvm-qmp-event-add-event-notification-for-memory-hot-unpl.patch deleted file mode 100644 index 60a8c5a..0000000 --- a/SOURCES/kvm-qmp-event-add-event-notification-for-memory-hot-unpl.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 79920d2fd718ad7ee450e6d9124ec7618d9f3954 Mon Sep 17 00:00:00 2001 -From: Igor Mammedov <imammedo@redhat.com> -Date: Mon, 8 Jun 2015 00:52:06 +0200 -Subject: [PATCH 050/217] qmp-event: add event notification for memory hot - unplug error - -Message-id: <1433724727-46928-9-git-send-email-imammedo@redhat.com> -Patchwork-id: 65396 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 8/9] qmp-event: add event notification for memory hot unplug error -Bugzilla: 1120706 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> - -When memory hot unplug fails, this patch adds support to send -QMP event to notify mgmt about this failure. - -Reviewed-by: Igor Mammedov <imammedo@redhat.com> -Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit bc09e06113e79e5d70cf2b37015a26f2102cc03e) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - docs/qmp/qmp-events.txt | 17 +++++++++++++++++ - hw/acpi/memory_hotplug.c | 10 +++++++++- - qapi/event.json | 14 ++++++++++++++ - trace-events | 1 + - 4 files changed, 41 insertions(+), 1 deletion(-) - -diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt -index 40c2917..a579253 100644 ---- a/docs/qmp/qmp-events.txt -+++ b/docs/qmp/qmp-events.txt -@@ -233,6 +233,23 @@ Example: - { "event": "GUEST_PANICKED", - "data": { "action": "pause" } } - -+MEM_HOT_UNPLUG_ERROR -+-------------------- -+Emitted when memory hot unplug error occurs. -+ -+Data: -+ -+- "device": device name (json-string) -+- "msg": Informative message (e.g., reason for the error) (json-string) -+ -+Example: -+ -+{ "event": "MEM_HOT_UNPLUG_ERROR" -+ "data": { "device": "dimm1", -+ "msg": "acpi: device unplug for unsupported device" -+ }, -+ "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } -+ - NIC_RX_FILTER_CHANGED - --------------------- - -diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c -index 35bbfeb..34cef1e 100644 ---- a/hw/acpi/memory_hotplug.c -+++ b/hw/acpi/memory_hotplug.c -@@ -94,6 +94,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, - ACPIOSTInfo *info; - DeviceState *dev = NULL; - HotplugHandler *hotplug_ctrl = NULL; -+ Error *local_err = NULL; - - if (!mem_st->dev_count) { - return; -@@ -148,7 +149,14 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, - dev = DEVICE(mdev->dimm); - hotplug_ctrl = qdev_get_hotplug_handler(dev); - /* call pc-dimm unplug cb */ -- hotplug_handler_unplug(hotplug_ctrl, dev, NULL); -+ hotplug_handler_unplug(hotplug_ctrl, dev, &local_err); -+ if (local_err) { -+ trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector); -+ qapi_event_send_mem_unplug_error(dev->id, -+ error_get_pretty(local_err), -+ &error_abort); -+ break; -+ } - trace_mhp_acpi_pc_dimm_deleted(mem_st->selector); - } - break; -diff --git a/qapi/event.json b/qapi/event.json -index c51dc49..378dda5 100644 ---- a/qapi/event.json -+++ b/qapi/event.json -@@ -330,3 +330,17 @@ - ## - { 'event': 'VSERPORT_CHANGE', - 'data': { 'id': 'str', 'open': 'bool' } } -+ -+## -+# @MEM_UNPLUG_ERROR -+# -+# Emitted when memory hot unplug error occurs. -+# -+# @device: device name -+# -+# @msg: Informative message -+# -+# Since: 2.4 -+## -+{ 'event': 'MEM_UNPLUG_ERROR', -+ 'data': { 'device': 'str', 'msg': 'str' } } -diff --git a/trace-events b/trace-events -index 46f6ef0..11387c3 100644 ---- a/trace-events -+++ b/trace-events -@@ -1575,6 +1575,7 @@ mhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "slot[0x%"PRIx32"] OST STA - mhp_acpi_clear_insert_evt(uint32_t slot) "slot[0x%"PRIx32"] clear insert event" - mhp_acpi_clear_remove_evt(uint32_t slot) "slot[0x%"PRIx32"] clear remove event" - mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted" -+mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed" - - # hw/i386/pc.c - mhp_pc_dimm_assigned_slot(int slot) "0x%d" --- -1.8.3.1 - diff --git a/SOURCES/kvm-range-remove-useless-inclusions.patch b/SOURCES/kvm-range-remove-useless-inclusions.patch deleted file mode 100644 index 39828e6..0000000 --- a/SOURCES/kvm-range-remove-useless-inclusions.patch +++ /dev/null @@ -1,91 +0,0 @@ -From c977a566b0163b70df952b1d54ef6d10a10f5299 Mon Sep 17 00:00:00 2001 -From: Marcel Apfelbaum <marcel@redhat.com> -Date: Wed, 24 Jun 2015 13:52:59 +0200 -Subject: [PATCH 188/217] range: remove useless inclusions - -Message-id: <1435154016-26233-7-git-send-email-marcel@redhat.com> -Patchwork-id: 66434 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 06/43] range: remove useless inclusions -Bugzilla: 1103313 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Paolo Bonzini <pbonzini@redhat.com> - -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> -(cherry picked from commit f2fbb40ea32445b281696a1b3f16de670951de2e) -Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - dma-helpers.c | 1 - - hw/acpi/pcihp.c | 1 - - hw/i386/acpi-build.c | 1 - - include/hw/i386/ich9.h | 1 - - include/hw/pci-host/q35.h | 1 - - 5 files changed, 5 deletions(-) - -diff --git a/dma-helpers.c b/dma-helpers.c -index 33b1983..4b51425 100644 ---- a/dma-helpers.c -+++ b/dma-helpers.c -@@ -10,7 +10,6 @@ - #include "sysemu/block-backend.h" - #include "sysemu/dma.h" - #include "trace.h" --#include "qemu/range.h" - #include "qemu/thread.h" - #include "qemu/main-loop.h" - -diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c -index 612fec0..422603d 100644 ---- a/hw/acpi/pcihp.c -+++ b/hw/acpi/pcihp.c -@@ -31,7 +31,6 @@ - #include "hw/pci/pci.h" - #include "hw/acpi/acpi.h" - #include "sysemu/sysemu.h" --#include "qemu/range.h" - #include "exec/ioport.h" - #include "exec/address-spaces.h" - #include "hw/pci/pci_bus.h" -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index c9d4545..da9b588 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -26,7 +26,6 @@ - #include "qemu-common.h" - #include "qemu/bitmap.h" - #include "qemu/osdep.h" --#include "qemu/range.h" - #include "qemu/error-report.h" - #include "hw/pci/pci.h" - #include "qom/cpu.h" -diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h -index 59ea25b..c171578 100644 ---- a/include/hw/i386/ich9.h -+++ b/include/hw/i386/ich9.h -@@ -2,7 +2,6 @@ - #define HW_ICH9_H - - #include "hw/hw.h" --#include "qemu/range.h" - #include "hw/isa/isa.h" - #include "hw/sysbus.h" - #include "hw/i386/pc.h" -diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h -index 025d6e6..96d4cdc 100644 ---- a/include/hw/pci-host/q35.h -+++ b/include/hw/pci-host/q35.h -@@ -23,7 +23,6 @@ - #define HW_Q35_H - - #include "hw/hw.h" --#include "qemu/range.h" - #include "hw/isa/isa.h" - #include "hw/sysbus.h" - #include "hw/i386/pc.h" --- -1.8.3.1 - diff --git a/SOURCES/kvm-rhel-Disable-info-irq-and-info-pic-for-Power.patch b/SOURCES/kvm-rhel-Disable-info-irq-and-info-pic-for-Power.patch deleted file mode 100644 index aef0f96..0000000 --- a/SOURCES/kvm-rhel-Disable-info-irq-and-info-pic-for-Power.patch +++ /dev/null @@ -1,60 +0,0 @@ -From b05756439621ac2ad5651f7e77b812063f1b4eee Mon Sep 17 00:00:00 2001 -From: David Gibson <dgibson@redhat.com> -Date: Fri, 3 Jul 2015 06:45:05 +0200 -Subject: [PATCH 107/217] rhel: Disable "info irq" and "info pic" for Power - -Message-id: <1435905906-24552-3-git-send-email-dgibson@redhat.com> -Patchwork-id: 66687 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 2/3] rhel: Disable "info irq" and "info pic" for Power -Bugzilla: 1191845 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -The "info irq" and "info pic" HMP commands are available on some, but not -all targets, and what they do isn't terribly consistent. For SPARC and -LM32 they do something platform specific, but for x86, powerpc, and MIPS -they print some information from the i8259 (and only the i8259) interrupt -controller. - -It's debatable whether these commands are any use at all, but in particular -they're no use for the RHEV configuration on Power, since the pseries -machine type doesn't use an i8259. It is relevant on the upstream ppc -target, though, because the "prep" machine type does use an i8259 as its -primary interrupt controller. - -The preferred upstream approach to address this is to construct new QOM and -qapi interfaces to query information on any interrupt controller and use -those to either replace the "info irq" and "info pic" HMP commands, or to -make them do something useful on all platforms in a more general way. - -That's going to take a while, though, so this is a downstream only hack to -remove these commands for ppc. This isn't a regression downstream, because -we don't support prep. This will allow us to remove the remaining ISA -devices, so we don't clutter qemu's advertised devices with things we don't -support on Power. - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1191845 - -Signed-off-by: David Gibson <dgibson@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - monitor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/monitor.c b/monitor.c -index 2b5643d..060248a 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -2659,7 +2659,7 @@ static mon_cmd_t info_cmds[] = { - .help = "show the command line history", - .mhandler.cmd = hmp_info_history, - }, --#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_MIPS) || \ -+#if defined(TARGET_I386) || defined(TARGET_MIPS) || \ - defined(TARGET_LM32) || (defined(TARGET_SPARC) && !defined(TARGET_SPARC64)) - { - .name = "irq", --- -1.8.3.1 - diff --git a/SOURCES/kvm-s390-virtio-sort-into-categories.patch b/SOURCES/kvm-s390-virtio-sort-into-categories.patch deleted file mode 100644 index a1b7a74..0000000 --- a/SOURCES/kvm-s390-virtio-sort-into-categories.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 15018403e79340c2831b97653eb166d9c451ab1d Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:18 +0200 -Subject: [PATCH 130/217] s390-virtio: sort into categories - -Message-id: <1436260751-25015-16-git-send-email-jasowang@redhat.com> -Patchwork-id: 66789 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 15/68] s390-virtio: sort into categories -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Sort the various s390-virtio devices into the same categories as their -virtio-pci counterparts. - -Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> -Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -(cherry picked from commit 4d1866de9422c4b359f61819ee01efc9b988187b) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/s390-virtio-bus.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index 5a96ecc..bb25487 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -555,6 +555,7 @@ static void s390_virtio_net_class_init(ObjectClass *klass, void *data) - - k->realize = s390_virtio_net_realize; - dc->props = s390_virtio_net_properties; -+ set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - } - - static const TypeInfo s390_virtio_net = { -@@ -568,8 +569,10 @@ static const TypeInfo s390_virtio_net = { - static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) - { - VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); -+ DeviceClass *dc = DEVICE_CLASS(klass); - - k->realize = s390_virtio_blk_realize; -+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - - static const TypeInfo s390_virtio_blk = { -@@ -591,6 +594,7 @@ static void s390_virtio_serial_class_init(ObjectClass *klass, void *data) - - k->realize = s390_virtio_serial_realize; - dc->props = s390_virtio_serial_properties; -+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - } - - static const TypeInfo s390_virtio_serial = { -@@ -613,6 +617,7 @@ static void s390_virtio_rng_class_init(ObjectClass *klass, void *data) - - k->realize = s390_virtio_rng_realize; - dc->props = s390_virtio_rng_properties; -+ set_bit(DEVICE_CATEGORY_MISC, dc->categories); - } - - static const TypeInfo s390_virtio_rng = { -@@ -670,6 +675,7 @@ static void s390_virtio_scsi_class_init(ObjectClass *klass, void *data) - - k->realize = s390_virtio_scsi_realize; - dc->props = s390_virtio_scsi_properties; -+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - - static const TypeInfo s390_virtio_scsi = { -@@ -693,6 +699,7 @@ static void s390_vhost_scsi_class_init(ObjectClass *klass, void *data) - - k->realize = s390_vhost_scsi_realize; - dc->props = s390_vhost_scsi_properties; -+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - - static const TypeInfo s390_vhost_scsi = { -@@ -716,8 +723,10 @@ static int s390_virtio_bridge_init(SysBusDevice *dev) - static void s390_virtio_bridge_class_init(ObjectClass *klass, void *data) - { - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); -+ DeviceClass *dc = DEVICE_CLASS(klass); - - k->init = s390_virtio_bridge_init; -+ set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - } - - static const TypeInfo s390_virtio_bridge_info = { --- -1.8.3.1 - diff --git a/SOURCES/kvm-s390-virtio-use-common-features.patch b/SOURCES/kvm-s390-virtio-use-common-features.patch deleted file mode 100644 index 768528b..0000000 --- a/SOURCES/kvm-s390-virtio-use-common-features.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 4cf3a794d51284138c2f2daa37f21a2bc0b023f6 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:19 +0200 -Subject: [PATCH 131/217] s390-virtio: use common features - -Message-id: <1436260751-25015-17-git-send-email-jasowang@redhat.com> -Patchwork-id: 66791 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 16/68] s390-virtio: use common features -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Notes: conflicts because there's also an merge conflict upstream: - commit 0403b0f539f40a21da60409b825b4653b273ab39 - ("Merge remote-tracking branch 'remotes/mst/tags/for_upstream' - into staging"). Fixing by squash the changes of upstream - and quote the upstream comments for how to fix the conflict: - - [PMM: fixed conflict in s390_virtio_scsi_properties and - s390_virtio_net_properties arrays; since the result of the - two conflicting patches is to empty the property arrays - completely, the conflict resolution is to remove them entirely.] - -We used to avoid enabling event_idx for virtio-blk devices via -s390-virtio, but we now have a workaround in place for guests trying -to use the device before setting DRIVER_OK. Therefore, let's add -DEFINE_VIRTIO_COMMON_FEATURES to the base device so all devices get -those common features - and make s390-virtio use the same mechanism -as the other transports do. - -Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> -Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -(cherry picked from commit f50616a81b7f88a9adac16f3ea0236311a748eca) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/s390x/s390-virtio-bus.c ---- - hw/s390x/s390-virtio-bus.c | 30 ++++++------------------------ - 1 file changed, 6 insertions(+), 24 deletions(-) - -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index bb25487..c10b002 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -543,18 +543,12 @@ static void virtio_s390_device_plugged(DeviceState *d, Error **errp) - - /**************** S390 Virtio Bus Device Descriptions *******************/ - --static Property s390_virtio_net_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void s390_virtio_net_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); - - k->realize = s390_virtio_net_realize; -- dc->props = s390_virtio_net_properties; - set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - } - -@@ -605,18 +599,12 @@ static const TypeInfo s390_virtio_serial = { - .class_init = s390_virtio_serial_class_init, - }; - --static Property s390_virtio_rng_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void s390_virtio_rng_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); - - k->realize = s390_virtio_rng_realize; -- dc->props = s390_virtio_rng_properties; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - } - -@@ -645,10 +633,16 @@ static void s390_virtio_busdev_reset(DeviceState *dev) - virtio_reset(_dev->vdev); - } - -+static Property virtio_s390_properties[] = { -+ DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -+ DEFINE_PROP_END_OF_LIST(), -+}; -+ - static void virtio_s390_device_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - -+ dc->props = virtio_s390_properties; - dc->realize = s390_virtio_busdev_realize; - dc->bus_type = TYPE_S390_VIRTIO_BUS; - dc->reset = s390_virtio_busdev_reset; -@@ -663,18 +657,12 @@ static const TypeInfo virtio_s390_device_info = { - .abstract = true, - }; - --static Property s390_virtio_scsi_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void s390_virtio_scsi_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); - - k->realize = s390_virtio_scsi_realize; -- dc->props = s390_virtio_scsi_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - -@@ -687,18 +675,12 @@ static const TypeInfo s390_virtio_scsi = { - }; - - #ifdef CONFIG_VHOST_SCSI --static Property s390_vhost_scsi_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void s390_vhost_scsi_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); - - k->realize = s390_vhost_scsi_realize; -- dc->props = s390_vhost_scsi_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-sPAPR-Clear-stale-MSIx-table-during-EEH-reset.patch b/SOURCES/kvm-sPAPR-Clear-stale-MSIx-table-during-EEH-reset.patch deleted file mode 100644 index 3fd3023..0000000 --- a/SOURCES/kvm-sPAPR-Clear-stale-MSIx-table-during-EEH-reset.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 3ed3f42d66618ea1b6e59b781f44318443980a5a Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Mon, 6 Jul 2015 13:05:56 +0200 -Subject: [PATCH 216/217] sPAPR: Clear stale MSIx table during EEH reset - -Message-id: <1436187956-15948-4-git-send-email-lvivier@redhat.com> -Patchwork-id: 66741 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 3/3] sPAPR: Clear stale MSIx table during EEH reset -Bugzilla: 1213681 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Gavin Shan <gwshan@linux.vnet.ibm.com> - -The PCI device MSIx table is cleaned out in hardware after EEH PE -reset. However, we still hold the stale MSIx entries in QEMU, which -should be cleared accordingly. Otherwise, we will run into another -(recursive) EEH error and the PCI devices contained in the PE have -to be offlined exceptionally. - -The patch introduces function spapr_phb_vfio_eeh_pre_reset(), which -is called by sPAPR when asserting hot or fundamental reset, to clear -stale MSIx table for VFIO PCI devices before EEH PE reset so that -MSIx table could be restored properly after EEH PE reset. - -Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -(cherry picked from commit d46e951b62cac411ecba490a4266f4bfe771ed48) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Upstream: 6319b1dad04e66f450fb3ac6c31d2bf3940068b8 -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_pci_vfio.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 46 insertions(+) - -diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c -index 8104074..cca45ed 100644 ---- a/hw/ppc/spapr_pci_vfio.c -+++ b/hw/ppc/spapr_pci_vfio.c -@@ -19,6 +19,7 @@ - - #include "hw/ppc/spapr.h" - #include "hw/pci-host/spapr.h" -+#include "hw/pci/msix.h" - #include "linux/vfio.h" - #include "hw/vfio/vfio.h" - -@@ -159,6 +160,49 @@ static int spapr_phb_vfio_eeh_get_state(sPAPRPHBState *sphb, int *state) - return RTAS_OUT_SUCCESS; - } - -+static void spapr_phb_vfio_eeh_clear_dev_msix(PCIBus *bus, -+ PCIDevice *pdev, -+ void *opaque) -+{ -+ /* Check if the device is VFIO PCI device */ -+ if (!object_dynamic_cast(OBJECT(pdev), "vfio-pci")) { -+ return; -+ } -+ -+ /* -+ * The MSIx table will be cleaned out by reset. We need -+ * disable it so that it can be reenabled properly. Also, -+ * the cached MSIx table should be cleared as it's not -+ * reflecting the contents in hardware. -+ */ -+ if (msix_enabled(pdev)) { -+ uint16_t flags; -+ -+ flags = pci_host_config_read_common(pdev, -+ pdev->msix_cap + PCI_MSIX_FLAGS, -+ pci_config_size(pdev), 2); -+ flags &= ~PCI_MSIX_FLAGS_ENABLE; -+ pci_host_config_write_common(pdev, -+ pdev->msix_cap + PCI_MSIX_FLAGS, -+ pci_config_size(pdev), flags, 2); -+ } -+ -+ msix_reset(pdev); -+} -+ -+static void spapr_phb_vfio_eeh_clear_bus_msix(PCIBus *bus, void *opaque) -+{ -+ pci_for_each_device(bus, pci_bus_num(bus), -+ spapr_phb_vfio_eeh_clear_dev_msix, NULL); -+} -+ -+static void spapr_phb_vfio_eeh_pre_reset(sPAPRPHBState *sphb) -+{ -+ PCIHostState *phb = PCI_HOST_BRIDGE(sphb); -+ -+ pci_for_each_bus(phb->bus, spapr_phb_vfio_eeh_clear_bus_msix, NULL); -+} -+ - static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) - { - sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb); -@@ -170,9 +214,11 @@ static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) - op.op = VFIO_EEH_PE_RESET_DEACTIVATE; - break; - case RTAS_SLOT_RESET_HOT: -+ spapr_phb_vfio_eeh_pre_reset(sphb); - op.op = VFIO_EEH_PE_RESET_HOT; - break; - case RTAS_SLOT_RESET_FUNDAMENTAL: -+ spapr_phb_vfio_eeh_pre_reset(sphb); - op.op = VFIO_EEH_PE_RESET_FUNDAMENTAL; - break; - default: --- -1.8.3.1 - diff --git a/SOURCES/kvm-sPAPR-Don-t-enable-EEH-on-emulated-PCI-devices.patch b/SOURCES/kvm-sPAPR-Don-t-enable-EEH-on-emulated-PCI-devices.patch deleted file mode 100644 index cfa5cee..0000000 --- a/SOURCES/kvm-sPAPR-Don-t-enable-EEH-on-emulated-PCI-devices.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 842bd457bb99209bf5e570d4392fb2d8ca3077dd Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Mon, 6 Jul 2015 13:05:54 +0200 -Subject: [PATCH 214/217] sPAPR: Don't enable EEH on emulated PCI devices - -Message-id: <1436187956-15948-2-git-send-email-lvivier@redhat.com> -Patchwork-id: 66742 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 1/3] sPAPR: Don't enable EEH on emulated PCI devices -Bugzilla: 1213681 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Gavin Shan <gwshan@linux.vnet.ibm.com> - -There might have emulated PCI devices, together with VFIO PCI -devices under one PHB. The EEH capability shouldn't enabled -on emulated PCI devices. - -The patch returns error when enabling EEH capability on emulated -PCI devices by RTAS call "ibm,set-eeh-option". - -Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -(cherry picked from commit 979b81496da90324d4668ea08ada52a59a9ab06f) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Upstream: 7cb180079e245024cf92ca218ca58858b679a7d6 -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_pci.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c -index 00a87bf..1a27963 100644 ---- a/hw/ppc/spapr_pci.c -+++ b/hw/ppc/spapr_pci.c -@@ -425,6 +425,7 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu, - { - sPAPRPHBState *sphb; - sPAPRPHBClass *spc; -+ PCIDevice *pdev; - uint32_t addr, option; - uint64_t buid; - int ret; -@@ -442,6 +443,12 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu, - goto param_error_exit; - } - -+ pdev = pci_find_device(PCI_HOST_BRIDGE(sphb)->bus, -+ (addr >> 16) & 0xFF, (addr >> 8) & 0xFF); -+ if (!pdev || !object_dynamic_cast(OBJECT(pdev), "vfio-pci")) { -+ goto param_error_exit; -+ } -+ - spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); - if (!spc->eeh_set_option) { - goto param_error_exit; --- -1.8.3.1 - diff --git a/SOURCES/kvm-sPAPR-Reenable-EEH-functionality-on-reboot.patch b/SOURCES/kvm-sPAPR-Reenable-EEH-functionality-on-reboot.patch deleted file mode 100644 index 11de333..0000000 --- a/SOURCES/kvm-sPAPR-Reenable-EEH-functionality-on-reboot.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 223e0f7f670353a3429284d04189f53f6fa1c944 Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Mon, 6 Jul 2015 13:05:55 +0200 -Subject: [PATCH 215/217] sPAPR: Reenable EEH functionality on reboot - -Message-id: <1436187956-15948-3-git-send-email-lvivier@redhat.com> -Patchwork-id: 66740 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 2/3] sPAPR: Reenable EEH functionality on reboot -Bugzilla: 1213681 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Gavin Shan <gwshan@linux.vnet.ibm.com> - -When rebooting the guest, some PEs might be in frozen state. The -contained PCI devices won't work properly if their frozen states -aren't cleared in time. One case running into this situation would -be maximal EEH error times encountered in the guest. - -The patch reenables the EEH functinality on PEs on PHB's reset -callback, which will clear their frozen states if needed. - -Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -(cherry picked from commit 57caa35584dba146f53279bfe032c836f086cb5a) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Upstream: aef87d1b879416909a4ac73e6fe2cea4a5630f40 -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_pci_vfio.c | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) - -diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c -index 99a1be5..8104074 100644 ---- a/hw/ppc/spapr_pci_vfio.c -+++ b/hw/ppc/spapr_pci_vfio.c -@@ -71,9 +71,26 @@ static void spapr_phb_vfio_finish_realize(sPAPRPHBState *sphb, Error **errp) - spapr_tce_get_iommu(tcet)); - } - -+static void spapr_phb_vfio_eeh_reenable(sPAPRPHBVFIOState *svphb) -+{ -+ struct vfio_eeh_pe_op op = { -+ .argsz = sizeof(op), -+ .op = VFIO_EEH_PE_ENABLE -+ }; -+ -+ vfio_container_ioctl(&svphb->phb.iommu_as, -+ svphb->iommugroupid, VFIO_EEH_PE_OP, &op); -+} -+ - static void spapr_phb_vfio_reset(DeviceState *qdev) - { -- /* Do nothing */ -+ /* -+ * The PE might be in frozen state. To reenable the EEH -+ * functionality on it will clean the frozen state, which -+ * ensures that the contained PCI devices will work properly -+ * after reboot. -+ */ -+ spapr_phb_vfio_eeh_reenable(SPAPR_PCI_VFIO_HOST_BRIDGE(qdev)); - } - - static int spapr_phb_vfio_eeh_set_option(sPAPRPHBState *sphb, --- -1.8.3.1 - diff --git a/SOURCES/kvm-scripts-qapi-event-py-support-vendor-extension.patch b/SOURCES/kvm-scripts-qapi-event-py-support-vendor-extension.patch deleted file mode 100644 index 50d480d..0000000 --- a/SOURCES/kvm-scripts-qapi-event-py-support-vendor-extension.patch +++ /dev/null @@ -1,74 +0,0 @@ -From f720c153e1393571ade56ba36fcf96176099f18f Mon Sep 17 00:00:00 2001 -From: Luiz Capitulino <lcapitulino@redhat.com> -Date: Wed, 9 Jul 2014 14:31:50 +0200 -Subject: scripts: qapi-event.py: support vendor extension - -Message-id: <1404916312-27953-2-git-send-email-lcapitulino@redhat.com> -Patchwork-id: 59727 -O-Subject: [RHEV7.1 qemu-kvm-rhev PATCH 1/3] scripts: qapi-event.py: support vendor extension -Bugzilla: 1116772 -RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> -RH-Acked-by: Eric Blake <eblake@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -The event code generator barfs when it sees a dot in an event -argument, this makes it impossible to support vendor extensions -in event arguments as they always contain dots. Fix this by -replacing dots by hyphens in the generated code. - -PS: Event names and QMP command arguments may suffer from the -same issue, but I'm not checking/fixing them today. - -Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> - -diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py -index 601e307..485694b 100644 ---- a/scripts/qapi-event.py -+++ b/scripts/qapi-event.py -@@ -23,11 +23,11 @@ def _generate_event_api_name(event_name, params): - if params: - for argname, argentry, optional, structured in parse_args(params): - if optional: -- api_name += "bool has_%s,\n" % c_var(argname) -+ api_name += "bool has_%s,\n" % c_arg(argname) - api_name += "".ljust(l) - - api_name += "%s %s,\n" % (c_type(argentry, is_param=True), -- c_var(argname)) -+ c_arg(argname)) - api_name += "".ljust(l) - - api_name += "Error **errp)" -@@ -98,7 +98,7 @@ def generate_event_implement(api_name, event_name, params): - ret += mcgen(""" - if (has_%(var)s) { - """, -- var = c_var(argname)) -+ var = c_arg(argname)) - push_indent() - - if argentry == "str": -@@ -113,7 +113,7 @@ def generate_event_implement(api_name, event_name, params): - } - """, - var_type = var_type, -- var = c_var(argname), -+ var = c_arg(argname), - type = type_name(argentry), - name = argname) - -diff --git a/scripts/qapi.py b/scripts/qapi.py -index 77d46aa..bfc1aaf 100644 ---- a/scripts/qapi.py -+++ b/scripts/qapi.py -@@ -434,6 +434,10 @@ def c_var(name, protect=True): - def c_fun(name, protect=True): - return c_var(name, protect).replace('.', '_') - -+# Should be used where vendor extensions are supported -+def c_arg(name): -+ return c_var(name).replace('.', '_') -+ - def c_list_type(name): - return '%sList' % name - diff --git a/SOURCES/kvm-spapr-add-rtas_st_buffer_direct-helper.patch b/SOURCES/kvm-spapr-add-rtas_st_buffer_direct-helper.patch deleted file mode 100644 index 8f0ed1e..0000000 --- a/SOURCES/kvm-spapr-add-rtas_st_buffer_direct-helper.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 79142551a4d48f71204a6cb77e520a3ec0c3db93 Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:32 +0200 -Subject: [PATCH 093/217] spapr: add rtas_st_buffer_direct() helper - -Message-id: <1435239881-28541-6-git-send-email-lvivier@redhat.com> -Patchwork-id: 66485 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 05/14] spapr: add rtas_st_buffer_direct() helper -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -This is similar to the existing rtas_st_buffer(), but for cases -where the guest is not expecting a length-encoded byte array. -Namely, for calls where a "work area" buffer is used to pass -around arbitrary fields/data. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit ab316865db8ee97c53cd70c91b1b160c474102f8) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/ppc/spapr.h | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h -index a13e777..919eec6 100644 ---- a/include/hw/ppc/spapr.h -+++ b/include/hw/ppc/spapr.h -@@ -464,6 +464,13 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val) - stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4*n), val); - } - -+static inline void rtas_st_buffer_direct(target_ulong phys, -+ target_ulong phys_len, -+ uint8_t *buffer, uint16_t buffer_len) -+{ -+ cpu_physical_memory_write(ppc64_phys_to_real(phys), buffer, -+ MIN(buffer_len, phys_len)); -+} - - static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len, - uint8_t *buffer, uint16_t buffer_len) -@@ -473,8 +480,7 @@ static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len, - } - stw_be_phys(&address_space_memory, - ppc64_phys_to_real(phys), buffer_len); -- cpu_physical_memory_write(ppc64_phys_to_real(phys + 2), -- buffer, MIN(buffer_len, phys_len - 2)); -+ rtas_st_buffer_direct(phys + 2, phys_len - 2, buffer, buffer_len); - } - - typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr, --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_drc-add-spapr_drc_populate_dt.patch b/SOURCES/kvm-spapr_drc-add-spapr_drc_populate_dt.patch deleted file mode 100644 index a7a786e..0000000 --- a/SOURCES/kvm-spapr_drc-add-spapr_drc_populate_dt.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 9860429da9a75805f13902ca536789b33b87300c Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:36 +0200 -Subject: [PATCH 097/217] spapr_drc: add spapr_drc_populate_dt() - -Message-id: <1435239881-28541-10-git-send-email-lvivier@redhat.com> -Patchwork-id: 66494 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 09/14] spapr_drc: add spapr_drc_populate_dt() -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -This function handles generation of ibm,drc-* array device tree -properties to describe DRC topology to guests. This will by used -by the guest to direct RTAS calls to manage any dynamic resources -we associate with a particular DR Connector as part of -hotplug/unplug. - -Since general management of boot-time device trees are handled -outside of sPAPRDRConnector, we insert these values blindly given -an FDT and offset. A mask of sPAPRDRConnector types is given to -instruct us on what types of connectors entries should be generated -for, since descriptions for different connectors may live in -different parts of the device tree. - -Based on code originally written by Nathan Fontenot. - -Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit e4b798bb53447ba4608fc7e6ed91927bdb1c3d5d) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_drc.c | 156 +++++++++++++++++++++++++++++++++++++++++++++ - include/hw/ppc/spapr_drc.h | 2 + - 2 files changed, 158 insertions(+) - -diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c -index 047c6c7..ef98538 100644 ---- a/hw/ppc/spapr_drc.c -+++ b/hw/ppc/spapr_drc.c -@@ -586,3 +586,159 @@ sPAPRDRConnector *spapr_dr_connector_by_id(sPAPRDRConnectorType type, - (get_type_shift(type) << DRC_INDEX_TYPE_SHIFT) | - (id & DRC_INDEX_ID_MASK)); - } -+ -+/* generate a string the describes the DRC to encode into the -+ * device tree. -+ * -+ * as documented by PAPR+ v2.7, 13.5.2.6 and C.6.1 -+ */ -+static const char *spapr_drc_get_type_str(sPAPRDRConnectorType type) -+{ -+ switch (type) { -+ case SPAPR_DR_CONNECTOR_TYPE_CPU: -+ return "CPU"; -+ case SPAPR_DR_CONNECTOR_TYPE_PHB: -+ return "PHB"; -+ case SPAPR_DR_CONNECTOR_TYPE_VIO: -+ return "SLOT"; -+ case SPAPR_DR_CONNECTOR_TYPE_PCI: -+ return "28"; -+ case SPAPR_DR_CONNECTOR_TYPE_LMB: -+ return "MEM"; -+ default: -+ g_assert(false); -+ } -+ -+ return NULL; -+} -+ -+/** -+ * spapr_drc_populate_dt -+ * -+ * @fdt: libfdt device tree -+ * @path: path in the DT to generate properties -+ * @owner: parent Object/DeviceState for which to generate DRC -+ * descriptions for -+ * @drc_type_mask: mask of sPAPRDRConnectorType values corresponding -+ * to the types of DRCs to generate entries for -+ * -+ * generate OF properties to describe DRC topology/indices to guests -+ * -+ * as documented in PAPR+ v2.1, 13.5.2 -+ */ -+int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, -+ uint32_t drc_type_mask) -+{ -+ Object *root_container; -+ ObjectProperty *prop; -+ uint32_t drc_count = 0; -+ GArray *drc_indexes, *drc_power_domains; -+ GString *drc_names, *drc_types; -+ int ret; -+ -+ /* the first entry of each properties is a 32-bit integer encoding -+ * the number of elements in the array. we won't know this until -+ * we complete the iteration through all the matching DRCs, but -+ * reserve the space now and set the offsets accordingly so we -+ * can fill them in later. -+ */ -+ drc_indexes = g_array_new(false, true, sizeof(uint32_t)); -+ drc_indexes = g_array_set_size(drc_indexes, 1); -+ drc_power_domains = g_array_new(false, true, sizeof(uint32_t)); -+ drc_power_domains = g_array_set_size(drc_power_domains, 1); -+ drc_names = g_string_set_size(g_string_new(NULL), sizeof(uint32_t)); -+ drc_types = g_string_set_size(g_string_new(NULL), sizeof(uint32_t)); -+ -+ /* aliases for all DRConnector objects will be rooted in QOM -+ * composition tree at DRC_CONTAINER_PATH -+ */ -+ root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); -+ -+ QTAILQ_FOREACH(prop, &root_container->properties, node) { -+ Object *obj; -+ sPAPRDRConnector *drc; -+ sPAPRDRConnectorClass *drck; -+ uint32_t drc_index, drc_power_domain; -+ -+ if (!strstart(prop->type, "link<", NULL)) { -+ continue; -+ } -+ -+ obj = object_property_get_link(root_container, prop->name, NULL); -+ drc = SPAPR_DR_CONNECTOR(obj); -+ drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ -+ if (owner && (drc->owner != owner)) { -+ continue; -+ } -+ -+ if ((drc->type & drc_type_mask) == 0) { -+ continue; -+ } -+ -+ drc_count++; -+ -+ /* ibm,drc-indexes */ -+ drc_index = cpu_to_be32(drck->get_index(drc)); -+ g_array_append_val(drc_indexes, drc_index); -+ -+ /* ibm,drc-power-domains */ -+ drc_power_domain = cpu_to_be32(-1); -+ g_array_append_val(drc_power_domains, drc_power_domain); -+ -+ /* ibm,drc-names */ -+ drc_names = g_string_append(drc_names, drck->get_name(drc)); -+ drc_names = g_string_insert_len(drc_names, -1, "\0", 1); -+ -+ /* ibm,drc-types */ -+ drc_types = g_string_append(drc_types, -+ spapr_drc_get_type_str(drc->type)); -+ drc_types = g_string_insert_len(drc_types, -1, "\0", 1); -+ } -+ -+ /* now write the drc count into the space we reserved at the -+ * beginning of the arrays previously -+ */ -+ *(uint32_t *)drc_indexes->data = cpu_to_be32(drc_count); -+ *(uint32_t *)drc_power_domains->data = cpu_to_be32(drc_count); -+ *(uint32_t *)drc_names->str = cpu_to_be32(drc_count); -+ *(uint32_t *)drc_types->str = cpu_to_be32(drc_count); -+ -+ ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-indexes", -+ drc_indexes->data, -+ drc_indexes->len * sizeof(uint32_t)); -+ if (ret) { -+ fprintf(stderr, "Couldn't create ibm,drc-indexes property\n"); -+ goto out; -+ } -+ -+ ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-power-domains", -+ drc_power_domains->data, -+ drc_power_domains->len * sizeof(uint32_t)); -+ if (ret) { -+ fprintf(stderr, "Couldn't finalize ibm,drc-power-domains property\n"); -+ goto out; -+ } -+ -+ ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-names", -+ drc_names->str, drc_names->len); -+ if (ret) { -+ fprintf(stderr, "Couldn't finalize ibm,drc-names property\n"); -+ goto out; -+ } -+ -+ ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-types", -+ drc_types->str, drc_types->len); -+ if (ret) { -+ fprintf(stderr, "Couldn't finalize ibm,drc-types property\n"); -+ goto out; -+ } -+ -+out: -+ g_array_free(drc_indexes, true); -+ g_array_free(drc_power_domains, true); -+ g_string_free(drc_names, true); -+ g_string_free(drc_types, true); -+ -+ return ret; -+} -diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h -index 34fdef9..60cda35 100644 ---- a/include/hw/ppc/spapr_drc.h -+++ b/include/hw/ppc/spapr_drc.h -@@ -195,5 +195,7 @@ sPAPRDRConnector *spapr_dr_connector_new(Object *owner, - sPAPRDRConnector *spapr_dr_connector_by_index(uint32_t index); - sPAPRDRConnector *spapr_dr_connector_by_id(sPAPRDRConnectorType type, - uint32_t id); -+int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, -+ uint32_t drc_type_mask); - - #endif /* __HW_SPAPR_DRC_H__ */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_drc-initial-implementation-of-sPAPRDRConnector.patch b/SOURCES/kvm-spapr_drc-initial-implementation-of-sPAPRDRConnector.patch deleted file mode 100644 index c8c4b29..0000000 --- a/SOURCES/kvm-spapr_drc-initial-implementation-of-sPAPRDRConnector.patch +++ /dev/null @@ -1,868 +0,0 @@ -From 961fd42553e95d28544c63cca4e476849fc45c03 Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:28 +0200 -Subject: [PATCH 089/217] spapr_drc: initial implementation of sPAPRDRConnector - device - -Message-id: <1435239881-28541-2-git-send-email-lvivier@redhat.com> -Patchwork-id: 66481 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 01/14] spapr_drc: initial implementation of sPAPRDRConnector device -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -This device emulates a firmware abstraction used by pSeries guests to -manage hotplug/dynamic-reconfiguration of host-bridges, PCI devices, -memory, and CPUs. It is conceptually similar to an SHPC device, -complete with LED indicators to identify individual slots to physical -physical users and indicate when it is safe to remove a device. In -some cases it is also used to manage virtualized resources, such a -memory, CPUs, and physical-host bridges, which in the case of pSeries -guests are virtualized resources where the physical components are -managed by the host. - -Guests communicate with these DR Connectors using RTAS calls, -generally by addressing the unique DRC index associated with a -particular connector for a particular resource. For introspection -purposes we expose this state initially as QOM properties, and -in subsequent patches will introduce the RTAS calls that make use of -it. This constitutes to the 'guest' interface. - -On the QEMU side we provide an attach/detach interface to associate -or cleanup a DeviceState with a particular sPAPRDRConnector in -response to hotplug/unplug, respectively. This constitutes the -'physical' interface to the DR Connector. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit bbf5c878ab76a74f6277f99082c77bbdb1ad4c5b) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/Makefile.objs | 2 +- - hw/ppc/spapr_drc.c | 588 +++++++++++++++++++++++++++++++++++++++++++++ - include/hw/ppc/spapr_drc.h | 199 +++++++++++++++ - 3 files changed, 788 insertions(+), 1 deletion(-) - create mode 100644 hw/ppc/spapr_drc.c - create mode 100644 include/hw/ppc/spapr_drc.h - -diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs -index fb56945..15c9013 100644 ---- a/hw/ppc/Makefile.objs -+++ b/hw/ppc/Makefile.objs -@@ -3,7 +3,7 @@ obj-y += ppc.o ppc_booke.o - # IBM pSeries (sPAPR) - obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o - obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o --obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o -+obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o - ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) - obj-y += spapr_pci_vfio.o - endif -diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c -new file mode 100644 -index 0000000..047c6c7 ---- /dev/null -+++ b/hw/ppc/spapr_drc.c -@@ -0,0 +1,588 @@ -+/* -+ * QEMU SPAPR Dynamic Reconfiguration Connector Implementation -+ * -+ * Copyright IBM Corp. 2014 -+ * -+ * Authors: -+ * Michael Roth <mdroth@linux.vnet.ibm.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. -+ */ -+ -+#include "hw/ppc/spapr_drc.h" -+#include "qom/object.h" -+#include "hw/qdev.h" -+#include "qapi/visitor.h" -+#include "qemu/error-report.h" -+ -+/* #define DEBUG_SPAPR_DRC */ -+ -+#ifdef DEBUG_SPAPR_DRC -+#define DPRINTF(fmt, ...) \ -+ do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -+#define DPRINTFN(fmt, ...) \ -+ do { DPRINTF(fmt, ## __VA_ARGS__); fprintf(stderr, "\n"); } while (0) -+#else -+#define DPRINTF(fmt, ...) \ -+ do { } while (0) -+#define DPRINTFN(fmt, ...) \ -+ do { } while (0) -+#endif -+ -+#define DRC_CONTAINER_PATH "/dr-connector" -+#define DRC_INDEX_TYPE_SHIFT 28 -+#define DRC_INDEX_ID_MASK (~(~0 << DRC_INDEX_TYPE_SHIFT)) -+ -+static sPAPRDRConnectorTypeShift get_type_shift(sPAPRDRConnectorType type) -+{ -+ uint32_t shift = 0; -+ -+ /* make sure this isn't SPAPR_DR_CONNECTOR_TYPE_ANY, or some -+ * other wonky value. -+ */ -+ g_assert(is_power_of_2(type)); -+ -+ while (type != (1 << shift)) { -+ shift++; -+ } -+ return shift; -+} -+ -+static uint32_t get_index(sPAPRDRConnector *drc) -+{ -+ /* no set format for a drc index: it only needs to be globally -+ * unique. this is how we encode the DRC type on bare-metal -+ * however, so might as well do that here -+ */ -+ return (get_type_shift(drc->type) << DRC_INDEX_TYPE_SHIFT) | -+ (drc->id & DRC_INDEX_ID_MASK); -+} -+ -+static int set_isolation_state(sPAPRDRConnector *drc, -+ sPAPRDRIsolationState state) -+{ -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ -+ DPRINTFN("drc: %x, set_isolation_state: %x", get_index(drc), state); -+ -+ drc->isolation_state = state; -+ -+ if (drc->isolation_state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { -+ /* if we're awaiting release, but still in an unconfigured state, -+ * it's likely the guest is still in the process of configuring -+ * the device and is transitioning the devices to an ISOLATED -+ * state as a part of that process. so we only complete the -+ * removal when this transition happens for a device in a -+ * configured state, as suggested by the state diagram from -+ * PAPR+ 2.7, 13.4 -+ */ -+ if (drc->awaiting_release) { -+ if (drc->configured) { -+ DPRINTFN("finalizing device removal"); -+ drck->detach(drc, DEVICE(drc->dev), drc->detach_cb, -+ drc->detach_cb_opaque, NULL); -+ } else { -+ DPRINTFN("deferring device removal on unconfigured device\n"); -+ } -+ } -+ drc->configured = false; -+ } -+ -+ return 0; -+} -+ -+static int set_indicator_state(sPAPRDRConnector *drc, -+ sPAPRDRIndicatorState state) -+{ -+ DPRINTFN("drc: %x, set_indicator_state: %x", get_index(drc), state); -+ drc->indicator_state = state; -+ return 0; -+} -+ -+static int set_allocation_state(sPAPRDRConnector *drc, -+ sPAPRDRAllocationState state) -+{ -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ -+ DPRINTFN("drc: %x, set_allocation_state: %x", get_index(drc), state); -+ -+ if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI) { -+ drc->allocation_state = state; -+ if (drc->awaiting_release && -+ drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { -+ DPRINTFN("finalizing device removal"); -+ drck->detach(drc, DEVICE(drc->dev), drc->detach_cb, -+ drc->detach_cb_opaque, NULL); -+ } -+ } -+ return 0; -+} -+ -+static uint32_t get_type(sPAPRDRConnector *drc) -+{ -+ return drc->type; -+} -+ -+static const char *get_name(sPAPRDRConnector *drc) -+{ -+ return drc->name; -+} -+ -+static const void *get_fdt(sPAPRDRConnector *drc, int *fdt_start_offset) -+{ -+ if (fdt_start_offset) { -+ *fdt_start_offset = drc->fdt_start_offset; -+ } -+ return drc->fdt; -+} -+ -+static void set_configured(sPAPRDRConnector *drc) -+{ -+ DPRINTFN("drc: %x, set_configured", get_index(drc)); -+ -+ if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_UNISOLATED) { -+ /* guest should be not configuring an isolated device */ -+ DPRINTFN("drc: %x, set_configured: skipping isolated device", -+ get_index(drc)); -+ return; -+ } -+ drc->configured = true; -+} -+ -+/* -+ * dr-entity-sense sensor value -+ * returned via get-sensor-state RTAS calls -+ * as expected by state diagram in PAPR+ 2.7, 13.4 -+ * based on the current allocation/indicator/power states -+ * for the DR connector. -+ */ -+static sPAPRDREntitySense entity_sense(sPAPRDRConnector *drc) -+{ -+ sPAPRDREntitySense state; -+ -+ if (drc->dev) { -+ if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI && -+ drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { -+ /* for logical DR, we return a state of UNUSABLE -+ * iff the allocation state UNUSABLE. -+ * Otherwise, report the state as USABLE/PRESENT, -+ * as we would for PCI. -+ */ -+ state = SPAPR_DR_ENTITY_SENSE_UNUSABLE; -+ } else { -+ /* this assumes all PCI devices are assigned to -+ * a 'live insertion' power domain, where QEMU -+ * manages power state automatically as opposed -+ * to the guest. present, non-PCI resources are -+ * unaffected by power state. -+ */ -+ state = SPAPR_DR_ENTITY_SENSE_PRESENT; -+ } -+ } else { -+ if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { -+ /* PCI devices, and only PCI devices, use EMPTY -+ * in cases where we'd otherwise use UNUSABLE -+ */ -+ state = SPAPR_DR_ENTITY_SENSE_EMPTY; -+ } else { -+ state = SPAPR_DR_ENTITY_SENSE_UNUSABLE; -+ } -+ } -+ -+ DPRINTFN("drc: %x, entity_sense: %x", get_index(drc), state); -+ return state; -+} -+ -+static void prop_get_index(Object *obj, Visitor *v, void *opaque, -+ const char *name, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ uint32_t value = (uint32_t)drck->get_index(drc); -+ visit_type_uint32(v, &value, name, errp); -+} -+ -+static void prop_get_type(Object *obj, Visitor *v, void *opaque, -+ const char *name, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ uint32_t value = (uint32_t)drck->get_type(drc); -+ visit_type_uint32(v, &value, name, errp); -+} -+ -+static char *prop_get_name(Object *obj, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ return g_strdup(drck->get_name(drc)); -+} -+ -+static void prop_get_entity_sense(Object *obj, Visitor *v, void *opaque, -+ const char *name, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ uint32_t value = (uint32_t)drck->entity_sense(drc); -+ visit_type_uint32(v, &value, name, errp); -+} -+ -+static void prop_get_fdt(Object *obj, Visitor *v, void *opaque, -+ const char *name, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); -+ int fdt_offset_next, fdt_offset, fdt_depth; -+ void *fdt; -+ -+ if (!drc->fdt) { -+ return; -+ } -+ -+ fdt = drc->fdt; -+ fdt_offset = drc->fdt_start_offset; -+ fdt_depth = 0; -+ -+ do { -+ const char *name = NULL; -+ const struct fdt_property *prop = NULL; -+ int prop_len = 0, name_len = 0; -+ uint32_t tag; -+ -+ tag = fdt_next_tag(fdt, fdt_offset, &fdt_offset_next); -+ switch (tag) { -+ case FDT_BEGIN_NODE: -+ fdt_depth++; -+ name = fdt_get_name(fdt, fdt_offset, &name_len); -+ visit_start_struct(v, NULL, NULL, name, 0, NULL); -+ break; -+ case FDT_END_NODE: -+ /* shouldn't ever see an FDT_END_NODE before FDT_BEGIN_NODE */ -+ g_assert(fdt_depth > 0); -+ visit_end_struct(v, NULL); -+ fdt_depth--; -+ break; -+ case FDT_PROP: { -+ int i; -+ prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); -+ name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); -+ visit_start_list(v, name, NULL); -+ for (i = 0; i < prop_len; i++) { -+ visit_type_uint8(v, (uint8_t *)&prop->data[i], NULL, NULL); -+ -+ } -+ visit_end_list(v, NULL); -+ break; -+ } -+ default: -+ error_setg(&error_abort, "device FDT in unexpected state: %d", tag); -+ } -+ fdt_offset = fdt_offset_next; -+ } while (fdt_depth != 0); -+} -+ -+static void attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, -+ int fdt_start_offset, bool coldplug, Error **errp) -+{ -+ DPRINTFN("drc: %x, attach", get_index(drc)); -+ -+ if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { -+ error_setg(errp, "an attached device is still awaiting release"); -+ return; -+ } -+ if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { -+ g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); -+ } -+ g_assert(fdt || coldplug); -+ -+ /* NOTE: setting initial isolation state to UNISOLATED means we can't -+ * detach unless guest has a userspace/kernel that moves this state -+ * back to ISOLATED in response to an unplug event, or this is done -+ * manually by the admin prior. if we force things while the guest -+ * may be accessing the device, we can easily crash the guest, so we -+ * we defer completion of removal in such cases to the reset() hook. -+ */ -+ if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { -+ drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; -+ } -+ drc->indicator_state = SPAPR_DR_INDICATOR_STATE_ACTIVE; -+ -+ drc->dev = d; -+ drc->fdt = fdt; -+ drc->fdt_start_offset = fdt_start_offset; -+ drc->configured = false; -+ -+ object_property_add_link(OBJECT(drc), "device", -+ object_get_typename(OBJECT(drc->dev)), -+ (Object **)(&drc->dev), -+ NULL, 0, NULL); -+} -+ -+static void detach(sPAPRDRConnector *drc, DeviceState *d, -+ spapr_drc_detach_cb *detach_cb, -+ void *detach_cb_opaque, Error **errp) -+{ -+ DPRINTFN("drc: %x, detach", get_index(drc)); -+ -+ drc->detach_cb = detach_cb; -+ drc->detach_cb_opaque = detach_cb_opaque; -+ -+ if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { -+ DPRINTFN("awaiting transition to isolated state before removal"); -+ drc->awaiting_release = true; -+ return; -+ } -+ -+ if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI && -+ drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { -+ DPRINTFN("awaiting transition to unusable state before removal"); -+ drc->awaiting_release = true; -+ return; -+ } -+ -+ drc->indicator_state = SPAPR_DR_INDICATOR_STATE_INACTIVE; -+ -+ if (drc->detach_cb) { -+ drc->detach_cb(drc->dev, drc->detach_cb_opaque); -+ } -+ -+ drc->awaiting_release = false; -+ g_free(drc->fdt); -+ drc->fdt = NULL; -+ drc->fdt_start_offset = 0; -+ object_property_del(OBJECT(drc), "device", NULL); -+ drc->dev = NULL; -+ drc->detach_cb = NULL; -+ drc->detach_cb_opaque = NULL; -+} -+ -+static bool release_pending(sPAPRDRConnector *drc) -+{ -+ return drc->awaiting_release; -+} -+ -+static void reset(DeviceState *d) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ -+ DPRINTFN("drc reset: %x", drck->get_index(drc)); -+ /* immediately upon reset we can safely assume DRCs whose devices -+ * are pending removal can be safely removed, and that they will -+ * subsequently be left in an ISOLATED state. move the DRC to this -+ * state in these cases (which will in turn complete any pending -+ * device removals) -+ */ -+ if (drc->awaiting_release) { -+ drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_ISOLATED); -+ /* generally this should also finalize the removal, but if the device -+ * hasn't yet been configured we normally defer removal under the -+ * assumption that this transition is taking place as part of device -+ * configuration. so check if we're still waiting after this, and -+ * force removal if we are -+ */ -+ if (drc->awaiting_release) { -+ drck->detach(drc, DEVICE(drc->dev), drc->detach_cb, -+ drc->detach_cb_opaque, NULL); -+ } -+ -+ /* non-PCI devices may be awaiting a transition to UNUSABLE */ -+ if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI && -+ drc->awaiting_release) { -+ drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_UNUSABLE); -+ } -+ } -+} -+ -+static void realize(DeviceState *d, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ Object *root_container; -+ char link_name[256]; -+ gchar *child_name; -+ Error *err = NULL; -+ -+ DPRINTFN("drc realize: %x", drck->get_index(drc)); -+ /* NOTE: we do this as part of realize/unrealize due to the fact -+ * that the guest will communicate with the DRC via RTAS calls -+ * referencing the global DRC index. By unlinking the DRC -+ * from DRC_CONTAINER_PATH/<drc_index> we effectively make it -+ * inaccessible by the guest, since lookups rely on this path -+ * existing in the composition tree -+ */ -+ root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); -+ snprintf(link_name, sizeof(link_name), "%x", drck->get_index(drc)); -+ child_name = object_get_canonical_path_component(OBJECT(drc)); -+ DPRINTFN("drc child name: %s", child_name); -+ object_property_add_alias(root_container, link_name, -+ drc->owner, child_name, &err); -+ if (err) { -+ error_report("%s", error_get_pretty(err)); -+ error_free(err); -+ object_unref(OBJECT(drc)); -+ } -+ DPRINTFN("drc realize complete"); -+} -+ -+static void unrealize(DeviceState *d, Error **errp) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ Object *root_container; -+ char name[256]; -+ Error *err = NULL; -+ -+ DPRINTFN("drc unrealize: %x", drck->get_index(drc)); -+ root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); -+ snprintf(name, sizeof(name), "%x", drck->get_index(drc)); -+ object_property_del(root_container, name, &err); -+ if (err) { -+ error_report("%s", error_get_pretty(err)); -+ error_free(err); -+ object_unref(OBJECT(drc)); -+ } -+} -+ -+sPAPRDRConnector *spapr_dr_connector_new(Object *owner, -+ sPAPRDRConnectorType type, -+ uint32_t id) -+{ -+ sPAPRDRConnector *drc = -+ SPAPR_DR_CONNECTOR(object_new(TYPE_SPAPR_DR_CONNECTOR)); -+ -+ g_assert(type); -+ -+ drc->type = type; -+ drc->id = id; -+ drc->owner = owner; -+ object_property_add_child(owner, "dr-connector[*]", OBJECT(drc), NULL); -+ object_property_set_bool(OBJECT(drc), true, "realized", NULL); -+ -+ /* human-readable name for a DRC to encode into the DT -+ * description. this is mainly only used within a guest in place -+ * of the unique DRC index. -+ * -+ * in the case of VIO/PCI devices, it corresponds to a -+ * "location code" that maps a logical device/function (DRC index) -+ * to a physical (or virtual in the case of VIO) location in the -+ * system by chaining together the "location label" for each -+ * encapsulating component. -+ * -+ * since this is more to do with diagnosing physical hardware -+ * issues than guest compatibility, we choose location codes/DRC -+ * names that adhere to the documented format, but avoid encoding -+ * the entire topology information into the label/code, instead -+ * just using the location codes based on the labels for the -+ * endpoints (VIO/PCI adaptor connectors), which is basically -+ * just "C" followed by an integer ID. -+ * -+ * DRC names as documented by PAPR+ v2.7, 13.5.2.4 -+ * location codes as documented by PAPR+ v2.7, 12.3.1.5 -+ */ -+ switch (drc->type) { -+ case SPAPR_DR_CONNECTOR_TYPE_CPU: -+ drc->name = g_strdup_printf("CPU %d", id); -+ break; -+ case SPAPR_DR_CONNECTOR_TYPE_PHB: -+ drc->name = g_strdup_printf("PHB %d", id); -+ break; -+ case SPAPR_DR_CONNECTOR_TYPE_VIO: -+ case SPAPR_DR_CONNECTOR_TYPE_PCI: -+ drc->name = g_strdup_printf("C%d", id); -+ break; -+ case SPAPR_DR_CONNECTOR_TYPE_LMB: -+ drc->name = g_strdup_printf("LMB %d", id); -+ break; -+ default: -+ g_assert(false); -+ } -+ -+ /* PCI slot always start in a USABLE state, and stay there */ -+ if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { -+ drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; -+ } -+ -+ return drc; -+} -+ -+static void spapr_dr_connector_instance_init(Object *obj) -+{ -+ sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); -+ -+ object_property_add_uint32_ptr(obj, "isolation-state", -+ &drc->isolation_state, NULL); -+ object_property_add_uint32_ptr(obj, "indicator-state", -+ &drc->indicator_state, NULL); -+ object_property_add_uint32_ptr(obj, "allocation-state", -+ &drc->allocation_state, NULL); -+ object_property_add_uint32_ptr(obj, "id", &drc->id, NULL); -+ object_property_add(obj, "index", "uint32", prop_get_index, -+ NULL, NULL, NULL, NULL); -+ object_property_add(obj, "connector_type", "uint32", prop_get_type, -+ NULL, NULL, NULL, NULL); -+ object_property_add_str(obj, "name", prop_get_name, NULL, NULL); -+ object_property_add(obj, "entity-sense", "uint32", prop_get_entity_sense, -+ NULL, NULL, NULL, NULL); -+ object_property_add(obj, "fdt", "struct", prop_get_fdt, -+ NULL, NULL, NULL, NULL); -+} -+ -+static void spapr_dr_connector_class_init(ObjectClass *k, void *data) -+{ -+ DeviceClass *dk = DEVICE_CLASS(k); -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); -+ -+ dk->reset = reset; -+ dk->realize = realize; -+ dk->unrealize = unrealize; -+ drck->set_isolation_state = set_isolation_state; -+ drck->set_indicator_state = set_indicator_state; -+ drck->set_allocation_state = set_allocation_state; -+ drck->get_index = get_index; -+ drck->get_type = get_type; -+ drck->get_name = get_name; -+ drck->get_fdt = get_fdt; -+ drck->set_configured = set_configured; -+ drck->entity_sense = entity_sense; -+ drck->attach = attach; -+ drck->detach = detach; -+ drck->release_pending = release_pending; -+} -+ -+static const TypeInfo spapr_dr_connector_info = { -+ .name = TYPE_SPAPR_DR_CONNECTOR, -+ .parent = TYPE_DEVICE, -+ .instance_size = sizeof(sPAPRDRConnector), -+ .instance_init = spapr_dr_connector_instance_init, -+ .class_size = sizeof(sPAPRDRConnectorClass), -+ .class_init = spapr_dr_connector_class_init, -+}; -+ -+static void spapr_drc_register_types(void) -+{ -+ type_register_static(&spapr_dr_connector_info); -+} -+ -+type_init(spapr_drc_register_types) -+ -+/* helper functions for external users */ -+ -+sPAPRDRConnector *spapr_dr_connector_by_index(uint32_t index) -+{ -+ Object *obj; -+ char name[256]; -+ -+ snprintf(name, sizeof(name), "%s/%x", DRC_CONTAINER_PATH, index); -+ obj = object_resolve_path(name, NULL); -+ -+ return !obj ? NULL : SPAPR_DR_CONNECTOR(obj); -+} -+ -+sPAPRDRConnector *spapr_dr_connector_by_id(sPAPRDRConnectorType type, -+ uint32_t id) -+{ -+ return spapr_dr_connector_by_index( -+ (get_type_shift(type) << DRC_INDEX_TYPE_SHIFT) | -+ (id & DRC_INDEX_ID_MASK)); -+} -diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h -new file mode 100644 -index 0000000..34fdef9 ---- /dev/null -+++ b/include/hw/ppc/spapr_drc.h -@@ -0,0 +1,199 @@ -+/* -+ * QEMU SPAPR Dynamic Reconfiguration Connector Implementation -+ * -+ * Copyright IBM Corp. 2014 -+ * -+ * Authors: -+ * Michael Roth <mdroth@linux.vnet.ibm.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. -+ */ -+#if !defined(__HW_SPAPR_DRC_H__) -+#define __HW_SPAPR_DRC_H__ -+ -+#include "qom/object.h" -+#include "hw/qdev.h" -+#include "libfdt.h" -+ -+#define TYPE_SPAPR_DR_CONNECTOR "spapr-dr-connector" -+#define SPAPR_DR_CONNECTOR_GET_CLASS(obj) \ -+ OBJECT_GET_CLASS(sPAPRDRConnectorClass, obj, TYPE_SPAPR_DR_CONNECTOR) -+#define SPAPR_DR_CONNECTOR_CLASS(klass) \ -+ OBJECT_CLASS_CHECK(sPAPRDRConnectorClass, klass, \ -+ TYPE_SPAPR_DR_CONNECTOR) -+#define SPAPR_DR_CONNECTOR(obj) OBJECT_CHECK(sPAPRDRConnector, (obj), \ -+ TYPE_SPAPR_DR_CONNECTOR) -+ -+/* -+ * Various hotplug types managed by sPAPRDRConnector -+ * -+ * these are somewhat arbitrary, but to make things easier -+ * when generating DRC indexes later we've aligned the bit -+ * positions with the values used to assign DRC indexes on -+ * pSeries. we use those values as bit shifts to allow for -+ * the OR'ing of these values in various QEMU routines, but -+ * for values exposed to the guest (via DRC indexes for -+ * instance) we will use the shift amounts. -+ */ -+typedef enum { -+ SPAPR_DR_CONNECTOR_TYPE_SHIFT_CPU = 1, -+ SPAPR_DR_CONNECTOR_TYPE_SHIFT_PHB = 2, -+ SPAPR_DR_CONNECTOR_TYPE_SHIFT_VIO = 3, -+ SPAPR_DR_CONNECTOR_TYPE_SHIFT_PCI = 4, -+ SPAPR_DR_CONNECTOR_TYPE_SHIFT_LMB = 8, -+} sPAPRDRConnectorTypeShift; -+ -+typedef enum { -+ SPAPR_DR_CONNECTOR_TYPE_ANY = ~0, -+ SPAPR_DR_CONNECTOR_TYPE_CPU = 1 << SPAPR_DR_CONNECTOR_TYPE_SHIFT_CPU, -+ SPAPR_DR_CONNECTOR_TYPE_PHB = 1 << SPAPR_DR_CONNECTOR_TYPE_SHIFT_PHB, -+ SPAPR_DR_CONNECTOR_TYPE_VIO = 1 << SPAPR_DR_CONNECTOR_TYPE_SHIFT_VIO, -+ SPAPR_DR_CONNECTOR_TYPE_PCI = 1 << SPAPR_DR_CONNECTOR_TYPE_SHIFT_PCI, -+ SPAPR_DR_CONNECTOR_TYPE_LMB = 1 << SPAPR_DR_CONNECTOR_TYPE_SHIFT_LMB, -+} sPAPRDRConnectorType; -+ -+/* -+ * set via set-indicator RTAS calls -+ * as documented by PAPR+ 2.7 13.5.3.4, Table 177 -+ * -+ * isolated: put device under firmware control -+ * unisolated: claim OS control of device (may or may not be in use) -+ */ -+typedef enum { -+ SPAPR_DR_ISOLATION_STATE_ISOLATED = 0, -+ SPAPR_DR_ISOLATION_STATE_UNISOLATED = 1 -+} sPAPRDRIsolationState; -+ -+/* -+ * set via set-indicator RTAS calls -+ * as documented by PAPR+ 2.7 13.5.3.4, Table 177 -+ * -+ * unusable: mark device as unavailable to OS -+ * usable: mark device as available to OS -+ * exchange: (currently unused) -+ * recover: (currently unused) -+ */ -+typedef enum { -+ SPAPR_DR_ALLOCATION_STATE_UNUSABLE = 0, -+ SPAPR_DR_ALLOCATION_STATE_USABLE = 1, -+ SPAPR_DR_ALLOCATION_STATE_EXCHANGE = 2, -+ SPAPR_DR_ALLOCATION_STATE_RECOVER = 3 -+} sPAPRDRAllocationState; -+ -+/* -+ * LED/visual indicator state -+ * -+ * set via set-indicator RTAS calls -+ * as documented by PAPR+ 2.7 13.5.3.4, Table 177, -+ * and PAPR+ 2.7 13.5.4.1, Table 180 -+ * -+ * inactive: hotpluggable entity inactive and safely removable -+ * active: hotpluggable entity in use and not safely removable -+ * identify: (currently unused) -+ * action: (currently unused) -+ */ -+typedef enum { -+ SPAPR_DR_INDICATOR_STATE_INACTIVE = 0, -+ SPAPR_DR_INDICATOR_STATE_ACTIVE = 1, -+ SPAPR_DR_INDICATOR_STATE_IDENTIFY = 2, -+ SPAPR_DR_INDICATOR_STATE_ACTION = 3, -+} sPAPRDRIndicatorState; -+ -+/* -+ * returned via get-sensor-state RTAS calls -+ * as documented by PAPR+ 2.7 13.5.3.3, Table 175: -+ * -+ * empty: connector slot empty (e.g. empty hotpluggable PCI slot) -+ * present: connector slot populated and device available to OS -+ * unusable: device not currently available to OS -+ * exchange: (currently unused) -+ * recover: (currently unused) -+ */ -+typedef enum { -+ SPAPR_DR_ENTITY_SENSE_EMPTY = 0, -+ SPAPR_DR_ENTITY_SENSE_PRESENT = 1, -+ SPAPR_DR_ENTITY_SENSE_UNUSABLE = 2, -+ SPAPR_DR_ENTITY_SENSE_EXCHANGE = 3, -+ SPAPR_DR_ENTITY_SENSE_RECOVER = 4, -+} sPAPRDREntitySense; -+ -+typedef enum { -+ SPAPR_DR_CC_RESPONSE_NEXT_SIB = 1, /* currently unused */ -+ SPAPR_DR_CC_RESPONSE_NEXT_CHILD = 2, -+ SPAPR_DR_CC_RESPONSE_NEXT_PROPERTY = 3, -+ SPAPR_DR_CC_RESPONSE_PREV_PARENT = 4, -+ SPAPR_DR_CC_RESPONSE_SUCCESS = 0, -+ SPAPR_DR_CC_RESPONSE_ERROR = -1, -+ SPAPR_DR_CC_RESPONSE_CONTINUE = -2, -+} sPAPRDRCCResponse; -+ -+typedef void (spapr_drc_detach_cb)(DeviceState *d, void *opaque); -+ -+typedef struct sPAPRDRConnector { -+ /*< private >*/ -+ DeviceState parent; -+ -+ sPAPRDRConnectorType type; -+ uint32_t id; -+ Object *owner; -+ const char *name; -+ -+ /* sensor/indicator states */ -+ uint32_t isolation_state; -+ uint32_t allocation_state; -+ uint32_t indicator_state; -+ -+ /* configure-connector state */ -+ void *fdt; -+ int fdt_start_offset; -+ bool configured; -+ -+ bool awaiting_release; -+ -+ /* device pointer, via link property */ -+ DeviceState *dev; -+ spapr_drc_detach_cb *detach_cb; -+ void *detach_cb_opaque; -+} sPAPRDRConnector; -+ -+typedef struct sPAPRDRConnectorClass { -+ /*< private >*/ -+ DeviceClass parent; -+ -+ /*< public >*/ -+ -+ /* accessors for guest-visible (generally via RTAS) DR state */ -+ int (*set_isolation_state)(sPAPRDRConnector *drc, -+ sPAPRDRIsolationState state); -+ int (*set_indicator_state)(sPAPRDRConnector *drc, -+ sPAPRDRIndicatorState state); -+ int (*set_allocation_state)(sPAPRDRConnector *drc, -+ sPAPRDRAllocationState state); -+ uint32_t (*get_index)(sPAPRDRConnector *drc); -+ uint32_t (*get_type)(sPAPRDRConnector *drc); -+ const char *(*get_name)(sPAPRDRConnector *drc); -+ -+ sPAPRDREntitySense (*entity_sense)(sPAPRDRConnector *drc); -+ -+ /* QEMU interfaces for managing FDT/configure-connector */ -+ const void *(*get_fdt)(sPAPRDRConnector *drc, int *fdt_start_offset); -+ void (*set_configured)(sPAPRDRConnector *drc); -+ -+ /* QEMU interfaces for managing hotplug operations */ -+ void (*attach)(sPAPRDRConnector *drc, DeviceState *d, void *fdt, -+ int fdt_start_offset, bool coldplug, Error **errp); -+ void (*detach)(sPAPRDRConnector *drc, DeviceState *d, -+ spapr_drc_detach_cb *detach_cb, -+ void *detach_cb_opaque, Error **errp); -+ bool (*release_pending)(sPAPRDRConnector *drc); -+} sPAPRDRConnectorClass; -+ -+sPAPRDRConnector *spapr_dr_connector_new(Object *owner, -+ sPAPRDRConnectorType type, -+ uint32_t id); -+sPAPRDRConnector *spapr_dr_connector_by_index(uint32_t index); -+sPAPRDRConnector *spapr_dr_connector_by_id(sPAPRDRConnectorType type, -+ uint32_t id); -+ -+#endif /* __HW_SPAPR_DRC_H__ */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_events-event-scan-RTAS-interface.patch b/SOURCES/kvm-spapr_events-event-scan-RTAS-interface.patch deleted file mode 100644 index 6165406..0000000 --- a/SOURCES/kvm-spapr_events-event-scan-RTAS-interface.patch +++ /dev/null @@ -1,227 +0,0 @@ -From f281cb19214b2fe303c46c68c8548e4f99bfe27c Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:35 +0200 -Subject: [PATCH 096/217] spapr_events: event-scan RTAS interface - -Message-id: <1435239881-28541-9-git-send-email-lvivier@redhat.com> -Patchwork-id: 66490 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 08/14] spapr_events: event-scan RTAS interface -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> - -We don't actually rely on this interface to surface hotplug events, and -instead rely on the similar-but-interrupt-driven check-exception RTAS -interface used for EPOW events. However, the existence of this interface -is needed to ensure guest kernels initialize the event-reporting -interfaces which will in turn be used by userspace tools to handle these -events, so we implement this interface here. - -Since events surfaced by this call are mutually exclusive to those -surfaced via check-exception, we also update the RTAS event queue code -to accept a boolean to mark/filter for events accordingly. - -Events of this sort are not currently generated by QEMU, but the interface -has been tested by surfacing hotplug events via event-scan in place -of check-exception. - -Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 79853e18d904b0a4bcef62701d48559688007c93) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr.c | 2 ++ - hw/ppc/spapr_events.c | 65 ++++++++++++++++++++++++++++++++++++++++++++------ - include/hw/ppc/spapr.h | 3 +++ - 3 files changed, 63 insertions(+), 7 deletions(-) - -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index 793173c..41930d8 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -533,6 +533,8 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, - refpoints, sizeof(refpoints)))); - - _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MAX))); -+ _FDT((fdt_property_cell(fdt, "rtas-event-scan-rate", -+ RTAS_EVENT_SCAN_RATE))); - - /* - * According to PAPR, rtas ibm,os-term does not guarantee a return -diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c -index c634a3b..fda9e35 100644 ---- a/hw/ppc/spapr_events.c -+++ b/hw/ppc/spapr_events.c -@@ -236,17 +236,19 @@ void spapr_events_fdt_skel(void *fdt, uint32_t check_exception_irq) - _FDT((fdt_end_node(fdt))); - } - --static void rtas_event_log_queue(int log_type, void *data) -+static void rtas_event_log_queue(int log_type, void *data, bool exception) - { - sPAPREventLogEntry *entry = g_new(sPAPREventLogEntry, 1); - - g_assert(data); - entry->log_type = log_type; -+ entry->exception = exception; - entry->data = data; - QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next); - } - --static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask) -+static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask, -+ bool exception) - { - sPAPREventLogEntry *entry = NULL; - -@@ -256,6 +258,10 @@ static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask) - } - - QTAILQ_FOREACH(entry, &spapr->pending_events, next) { -+ if (entry->exception != exception) { -+ continue; -+ } -+ - /* EPOW and hotplug events are surfaced in the same manner */ - if (entry->log_type == RTAS_LOG_TYPE_EPOW || - entry->log_type == RTAS_LOG_TYPE_HOTPLUG) { -@@ -270,7 +276,7 @@ static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask) - return entry; - } - --static bool rtas_event_log_contains(uint32_t event_mask) -+static bool rtas_event_log_contains(uint32_t event_mask, bool exception) - { - sPAPREventLogEntry *entry = NULL; - -@@ -280,6 +286,10 @@ static bool rtas_event_log_contains(uint32_t event_mask) - } - - QTAILQ_FOREACH(entry, &spapr->pending_events, next) { -+ if (entry->exception != exception) { -+ continue; -+ } -+ - /* EPOW and hotplug events are surfaced in the same manner */ - if (entry->log_type == RTAS_LOG_TYPE_EPOW || - entry->log_type == RTAS_LOG_TYPE_HOTPLUG) { -@@ -367,7 +377,7 @@ static void spapr_powerdown_req(Notifier *n, void *opaque) - epow->event_modifier = RTAS_LOG_V6_EPOW_MODIFIER_NORMAL; - epow->extended_modifier = RTAS_LOG_V6_EPOW_XMODIFIER_PARTITION_SPECIFIC; - -- rtas_event_log_queue(RTAS_LOG_TYPE_EPOW, new_epow); -+ rtas_event_log_queue(RTAS_LOG_TYPE_EPOW, new_epow, true); - - qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); - } -@@ -428,7 +438,7 @@ static void spapr_hotplug_req_event(sPAPRDRConnector *drc, uint8_t hp_action) - return; - } - -- rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp); -+ rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true); - - qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); - } -@@ -466,7 +476,7 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr, - xinfo |= (uint64_t)rtas_ld(args, 6) << 32; - } - -- event = rtas_event_log_dequeue(mask); -+ event = rtas_event_log_dequeue(mask, true); - if (!event) { - goto out_no_events; - } -@@ -488,7 +498,7 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr, - * do the latter here, since our code relies on edge-triggered - * interrupts. - */ -- if (rtas_event_log_contains(mask)) { -+ if (rtas_event_log_contains(mask, true)) { - qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); - } - -@@ -498,6 +508,46 @@ out_no_events: - rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND); - } - -+static void event_scan(PowerPCCPU *cpu, sPAPREnvironment *spapr, -+ uint32_t token, uint32_t nargs, -+ target_ulong args, -+ uint32_t nret, target_ulong rets) -+{ -+ uint32_t mask, buf, len, event_len; -+ sPAPREventLogEntry *event; -+ struct rtas_error_log *hdr; -+ -+ if (nargs != 4 || nret != 1) { -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ -+ mask = rtas_ld(args, 0); -+ buf = rtas_ld(args, 2); -+ len = rtas_ld(args, 3); -+ -+ event = rtas_event_log_dequeue(mask, false); -+ if (!event) { -+ goto out_no_events; -+ } -+ -+ hdr = event->data; -+ event_len = be32_to_cpu(hdr->extended_length) + sizeof(*hdr); -+ -+ if (event_len < len) { -+ len = event_len; -+ } -+ -+ cpu_physical_memory_write(buf, event->data, len); -+ rtas_st(rets, 0, RTAS_OUT_SUCCESS); -+ g_free(event->data); -+ g_free(event); -+ return; -+ -+out_no_events: -+ rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND); -+} -+ - void spapr_events_init(sPAPREnvironment *spapr) - { - QTAILQ_INIT(&spapr->pending_events); -@@ -506,4 +556,5 @@ void spapr_events_init(sPAPREnvironment *spapr) - qemu_register_powerdown_notifier(&spapr->epow_notifier); - spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception", - check_exception); -+ spapr_rtas_register(RTAS_EVENT_SCAN, "event-scan", event_scan); - } -diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h -index 62fe349..313dcee 100644 ---- a/include/hw/ppc/spapr.h -+++ b/include/hw/ppc/spapr.h -@@ -510,6 +510,8 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, - - #define RTAS_ERROR_LOG_MAX 2048 - -+#define RTAS_EVENT_SCAN_RATE 1 -+ - typedef struct sPAPRTCETable sPAPRTCETable; - - #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table" -@@ -533,6 +535,7 @@ struct sPAPRTCETable { - - struct sPAPREventLogEntry { - int log_type; -+ bool exception; - void *data; - QTAILQ_ENTRY(sPAPREventLogEntry) next; - }; --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_events-re-use-EPOW-event-infrastructure-for-ho.patch b/SOURCES/kvm-spapr_events-re-use-EPOW-event-infrastructure-for-ho.patch deleted file mode 100644 index 642a37f..0000000 --- a/SOURCES/kvm-spapr_events-re-use-EPOW-event-infrastructure-for-ho.patch +++ /dev/null @@ -1,499 +0,0 @@ -From 76f1a332a2f9182774cf6664a350907fcaec29fd Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:34 +0200 -Subject: [PATCH 095/217] spapr_events: re-use EPOW event infrastructure for - hotplug events - -Message-id: <1435239881-28541-8-git-send-email-lvivier@redhat.com> -Patchwork-id: 66487 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 07/14] spapr_events: re-use EPOW event infrastructure for hotplug events -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Nathan Fontenot <nfont@linux.vnet.ibm.com> - -This extends the data structures currently used to report EPOW events to -guests via the check-exception RTAS interfaces to also include event types -for hotplug/unplug events. - -This is currently undocumented and being finalized for inclusion in PAPR -specification, but we implement this here as an extension for guest -userspace tools to implement (existing guest kernels simply log these -events via a sysfs interface that's read by rtas_errd, and current -versions of rtas_errd/powerpc-utils already support the use of this -mechanism for initiating hotplug operations). - -We also add support for queues of pending RTAS events, since in the -case of hotplug there's chance for multiple events being in-flight -at any point in time. - -Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 31fe14d15d08d613ff38abb249911e98c7966b86) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - include/hw/ppc/spapr.h -Conflicts with missing context from commits: - f9ce8e0a hw/ppc/spapr_iommu: Fix the check for invalid upper bits in liob - -Signed-off-by: Laurent Vivier <lvivier@redhat.com> ---- - hw/ppc/spapr.c | 3 +- - hw/ppc/spapr_events.c | 287 ++++++++++++++++++++++++++++++++++++++++--------- - include/hw/ppc/spapr.h | 13 ++- - 3 files changed, 251 insertions(+), 52 deletions(-) - -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index 8b21a71..793173c 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -1660,7 +1660,8 @@ static void ppc_spapr_init(MachineState *machine) - /* Prepare the device tree */ - spapr->fdt_skel = spapr_create_fdt_skel(initrd_base, initrd_size, - kernel_size, kernel_le, -- kernel_cmdline, spapr->epow_irq); -+ kernel_cmdline, -+ spapr->check_exception_irq); - assert(spapr->fdt_skel != NULL); - - /* used by RTAS */ -diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c -index 283e96b..c634a3b 100644 ---- a/hw/ppc/spapr_events.c -+++ b/hw/ppc/spapr_events.c -@@ -32,6 +32,9 @@ - - #include "hw/ppc/spapr.h" - #include "hw/ppc/spapr_vio.h" -+#include "hw/pci/pci.h" -+#include "hw/pci-host/spapr.h" -+#include "hw/ppc/spapr_drc.h" - - #include <libfdt.h> - -@@ -77,6 +80,7 @@ struct rtas_error_log { - #define RTAS_LOG_TYPE_ECC_UNCORR 0x00000009 - #define RTAS_LOG_TYPE_ECC_CORR 0x0000000a - #define RTAS_LOG_TYPE_EPOW 0x00000040 -+#define RTAS_LOG_TYPE_HOTPLUG 0x000000e5 - uint32_t extended_length; - } QEMU_PACKED; - -@@ -166,6 +170,38 @@ struct epow_log_full { - struct rtas_event_log_v6_epow epow; - } QEMU_PACKED; - -+struct rtas_event_log_v6_hp { -+#define RTAS_LOG_V6_SECTION_ID_HOTPLUG 0x4850 /* HP */ -+ struct rtas_event_log_v6_section_header hdr; -+ uint8_t hotplug_type; -+#define RTAS_LOG_V6_HP_TYPE_CPU 1 -+#define RTAS_LOG_V6_HP_TYPE_MEMORY 2 -+#define RTAS_LOG_V6_HP_TYPE_SLOT 3 -+#define RTAS_LOG_V6_HP_TYPE_PHB 4 -+#define RTAS_LOG_V6_HP_TYPE_PCI 5 -+ uint8_t hotplug_action; -+#define RTAS_LOG_V6_HP_ACTION_ADD 1 -+#define RTAS_LOG_V6_HP_ACTION_REMOVE 2 -+ uint8_t hotplug_identifier; -+#define RTAS_LOG_V6_HP_ID_DRC_NAME 1 -+#define RTAS_LOG_V6_HP_ID_DRC_INDEX 2 -+#define RTAS_LOG_V6_HP_ID_DRC_COUNT 3 -+ uint8_t reserved; -+ union { -+ uint32_t index; -+ uint32_t count; -+ char name[1]; -+ } drc; -+} QEMU_PACKED; -+ -+struct hp_log_full { -+ struct rtas_error_log hdr; -+ struct rtas_event_log_v6 v6hdr; -+ struct rtas_event_log_v6_maina maina; -+ struct rtas_event_log_v6_mainb mainb; -+ struct rtas_event_log_v6_hp hp; -+} QEMU_PACKED; -+ - #define EVENT_MASK_INTERNAL_ERRORS 0x80000000 - #define EVENT_MASK_EPOW 0x40000000 - #define EVENT_MASK_HOTPLUG 0x10000000 -@@ -181,67 +217,95 @@ struct epow_log_full { - } \ - } while (0) - --void spapr_events_fdt_skel(void *fdt, uint32_t epow_irq) -+void spapr_events_fdt_skel(void *fdt, uint32_t check_exception_irq) - { -- uint32_t epow_irq_ranges[] = {cpu_to_be32(epow_irq), cpu_to_be32(1)}; -- uint32_t epow_interrupts[] = {cpu_to_be32(epow_irq), 0}; -+ uint32_t irq_ranges[] = {cpu_to_be32(check_exception_irq), cpu_to_be32(1)}; -+ uint32_t interrupts[] = {cpu_to_be32(check_exception_irq), 0}; - - _FDT((fdt_begin_node(fdt, "event-sources"))); - - _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); - _FDT((fdt_property_cell(fdt, "#interrupt-cells", 2))); - _FDT((fdt_property(fdt, "interrupt-ranges", -- epow_irq_ranges, sizeof(epow_irq_ranges)))); -+ irq_ranges, sizeof(irq_ranges)))); - - _FDT((fdt_begin_node(fdt, "epow-events"))); -- _FDT((fdt_property(fdt, "interrupts", -- epow_interrupts, sizeof(epow_interrupts)))); -+ _FDT((fdt_property(fdt, "interrupts", interrupts, sizeof(interrupts)))); - _FDT((fdt_end_node(fdt))); - - _FDT((fdt_end_node(fdt))); - } - --static struct epow_log_full *pending_epow; --static uint32_t next_plid; -+static void rtas_event_log_queue(int log_type, void *data) -+{ -+ sPAPREventLogEntry *entry = g_new(sPAPREventLogEntry, 1); - --static void spapr_powerdown_req(Notifier *n, void *opaque) -+ g_assert(data); -+ entry->log_type = log_type; -+ entry->data = data; -+ QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next); -+} -+ -+static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask) - { -- sPAPREnvironment *spapr = container_of(n, sPAPREnvironment, epow_notifier); -- struct rtas_error_log *hdr; -- struct rtas_event_log_v6 *v6hdr; -- struct rtas_event_log_v6_maina *maina; -- struct rtas_event_log_v6_mainb *mainb; -- struct rtas_event_log_v6_epow *epow; -- struct tm tm; -- int year; -+ sPAPREventLogEntry *entry = NULL; - -- if (pending_epow) { -- /* For now, we just throw away earlier events if two come -- * along before any are consumed. This is sufficient for our -- * powerdown messages, but we'll need more if we do more -- * general error/event logging */ -- g_free(pending_epow); -+ /* we only queue EPOW events atm. */ -+ if ((event_mask & EVENT_MASK_EPOW) == 0) { -+ return NULL; - } -- pending_epow = g_malloc0(sizeof(*pending_epow)); -- hdr = &pending_epow->hdr; -- v6hdr = &pending_epow->v6hdr; -- maina = &pending_epow->maina; -- mainb = &pending_epow->mainb; -- epow = &pending_epow->epow; - -- hdr->summary = cpu_to_be32(RTAS_LOG_VERSION_6 -- | RTAS_LOG_SEVERITY_EVENT -- | RTAS_LOG_DISPOSITION_NOT_RECOVERED -- | RTAS_LOG_OPTIONAL_PART_PRESENT -- | RTAS_LOG_TYPE_EPOW); -- hdr->extended_length = cpu_to_be32(sizeof(*pending_epow) -- - sizeof(pending_epow->hdr)); -+ QTAILQ_FOREACH(entry, &spapr->pending_events, next) { -+ /* EPOW and hotplug events are surfaced in the same manner */ -+ if (entry->log_type == RTAS_LOG_TYPE_EPOW || -+ entry->log_type == RTAS_LOG_TYPE_HOTPLUG) { -+ break; -+ } -+ } -+ -+ if (entry) { -+ QTAILQ_REMOVE(&spapr->pending_events, entry, next); -+ } -+ -+ return entry; -+} -+ -+static bool rtas_event_log_contains(uint32_t event_mask) -+{ -+ sPAPREventLogEntry *entry = NULL; -+ -+ /* we only queue EPOW events atm. */ -+ if ((event_mask & EVENT_MASK_EPOW) == 0) { -+ return false; -+ } -+ -+ QTAILQ_FOREACH(entry, &spapr->pending_events, next) { -+ /* EPOW and hotplug events are surfaced in the same manner */ -+ if (entry->log_type == RTAS_LOG_TYPE_EPOW || -+ entry->log_type == RTAS_LOG_TYPE_HOTPLUG) { -+ return true; -+ } -+ } -+ -+ return false; -+} - -+static uint32_t next_plid; -+ -+static void spapr_init_v6hdr(struct rtas_event_log_v6 *v6hdr) -+{ - v6hdr->b0 = RTAS_LOG_V6_B0_VALID | RTAS_LOG_V6_B0_NEW_LOG - | RTAS_LOG_V6_B0_BIGENDIAN; - v6hdr->b2 = RTAS_LOG_V6_B2_POWERPC_FORMAT - | RTAS_LOG_V6_B2_LOG_FORMAT_PLATFORM_EVENT; - v6hdr->company = cpu_to_be32(RTAS_LOG_V6_COMPANY_IBM); -+} -+ -+static void spapr_init_maina(struct rtas_event_log_v6_maina *maina, -+ int section_count) -+{ -+ struct tm tm; -+ int year; - - maina->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINA); - maina->hdr.section_length = cpu_to_be16(sizeof(*maina)); -@@ -256,8 +320,37 @@ static void spapr_powerdown_req(Notifier *n, void *opaque) - | (to_bcd(tm.tm_min) << 16) - | (to_bcd(tm.tm_sec) << 8)); - maina->creator_id = 'H'; /* Hypervisor */ -- maina->section_count = 3; /* Main-A, Main-B and EPOW */ -+ maina->section_count = section_count; - maina->plid = next_plid++; -+} -+ -+static void spapr_powerdown_req(Notifier *n, void *opaque) -+{ -+ sPAPREnvironment *spapr = container_of(n, sPAPREnvironment, epow_notifier); -+ struct rtas_error_log *hdr; -+ struct rtas_event_log_v6 *v6hdr; -+ struct rtas_event_log_v6_maina *maina; -+ struct rtas_event_log_v6_mainb *mainb; -+ struct rtas_event_log_v6_epow *epow; -+ struct epow_log_full *new_epow; -+ -+ new_epow = g_malloc0(sizeof(*new_epow)); -+ hdr = &new_epow->hdr; -+ v6hdr = &new_epow->v6hdr; -+ maina = &new_epow->maina; -+ mainb = &new_epow->mainb; -+ epow = &new_epow->epow; -+ -+ hdr->summary = cpu_to_be32(RTAS_LOG_VERSION_6 -+ | RTAS_LOG_SEVERITY_EVENT -+ | RTAS_LOG_DISPOSITION_NOT_RECOVERED -+ | RTAS_LOG_OPTIONAL_PART_PRESENT -+ | RTAS_LOG_TYPE_EPOW); -+ hdr->extended_length = cpu_to_be32(sizeof(*new_epow) -+ - sizeof(new_epow->hdr)); -+ -+ spapr_init_v6hdr(v6hdr); -+ spapr_init_maina(maina, 3 /* Main-A, Main-B and EPOW */); - - mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB); - mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb)); -@@ -274,7 +367,80 @@ static void spapr_powerdown_req(Notifier *n, void *opaque) - epow->event_modifier = RTAS_LOG_V6_EPOW_MODIFIER_NORMAL; - epow->extended_modifier = RTAS_LOG_V6_EPOW_XMODIFIER_PARTITION_SPECIFIC; - -- qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->epow_irq)); -+ rtas_event_log_queue(RTAS_LOG_TYPE_EPOW, new_epow); -+ -+ qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); -+} -+ -+static void spapr_hotplug_req_event(sPAPRDRConnector *drc, uint8_t hp_action) -+{ -+ struct hp_log_full *new_hp; -+ struct rtas_error_log *hdr; -+ struct rtas_event_log_v6 *v6hdr; -+ struct rtas_event_log_v6_maina *maina; -+ struct rtas_event_log_v6_mainb *mainb; -+ struct rtas_event_log_v6_hp *hp; -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ sPAPRDRConnectorType drc_type = drck->get_type(drc); -+ -+ new_hp = g_malloc0(sizeof(struct hp_log_full)); -+ hdr = &new_hp->hdr; -+ v6hdr = &new_hp->v6hdr; -+ maina = &new_hp->maina; -+ mainb = &new_hp->mainb; -+ hp = &new_hp->hp; -+ -+ hdr->summary = cpu_to_be32(RTAS_LOG_VERSION_6 -+ | RTAS_LOG_SEVERITY_EVENT -+ | RTAS_LOG_DISPOSITION_NOT_RECOVERED -+ | RTAS_LOG_OPTIONAL_PART_PRESENT -+ | RTAS_LOG_INITIATOR_HOTPLUG -+ | RTAS_LOG_TYPE_HOTPLUG); -+ hdr->extended_length = cpu_to_be32(sizeof(*new_hp) -+ - sizeof(new_hp->hdr)); -+ -+ spapr_init_v6hdr(v6hdr); -+ spapr_init_maina(maina, 3 /* Main-A, Main-B, HP */); -+ -+ mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB); -+ mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb)); -+ mainb->subsystem_id = 0x80; /* External environment */ -+ mainb->event_severity = 0x00; /* Informational / non-error */ -+ mainb->event_subtype = 0x00; /* Normal shutdown */ -+ -+ hp->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG); -+ hp->hdr.section_length = cpu_to_be16(sizeof(*hp)); -+ hp->hdr.section_version = 1; /* includes extended modifier */ -+ hp->hotplug_action = hp_action; -+ -+ -+ switch (drc_type) { -+ case SPAPR_DR_CONNECTOR_TYPE_PCI: -+ hp->drc.index = cpu_to_be32(drck->get_index(drc)); -+ hp->hotplug_identifier = RTAS_LOG_V6_HP_ID_DRC_INDEX; -+ hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI; -+ break; -+ default: -+ /* we shouldn't be signaling hotplug events for resources -+ * that don't support them -+ */ -+ g_assert(false); -+ return; -+ } -+ -+ rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp); -+ -+ qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); -+} -+ -+void spapr_hotplug_req_add_event(sPAPRDRConnector *drc) -+{ -+ spapr_hotplug_req_event(drc, RTAS_LOG_V6_HP_ACTION_ADD); -+} -+ -+void spapr_hotplug_req_remove_event(sPAPRDRConnector *drc) -+{ -+ spapr_hotplug_req_event(drc, RTAS_LOG_V6_HP_ACTION_REMOVE); - } - - static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr, -@@ -282,8 +448,10 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr, - target_ulong args, - uint32_t nret, target_ulong rets) - { -- uint32_t mask, buf, len; -+ uint32_t mask, buf, len, event_len; - uint64_t xinfo; -+ sPAPREventLogEntry *event; -+ struct rtas_error_log *hdr; - - if ((nargs < 6) || (nargs > 7) || nret != 1) { - rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -@@ -298,23 +466,42 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr, - xinfo |= (uint64_t)rtas_ld(args, 6) << 32; - } - -- if ((mask & EVENT_MASK_EPOW) && pending_epow) { -- if (sizeof(*pending_epow) < len) { -- len = sizeof(*pending_epow); -- } -+ event = rtas_event_log_dequeue(mask); -+ if (!event) { -+ goto out_no_events; -+ } - -- cpu_physical_memory_write(buf, pending_epow, len); -- g_free(pending_epow); -- pending_epow = NULL; -- rtas_st(rets, 0, RTAS_OUT_SUCCESS); -- } else { -- rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND); -+ hdr = event->data; -+ event_len = be32_to_cpu(hdr->extended_length) + sizeof(*hdr); -+ -+ if (event_len < len) { -+ len = event_len; -+ } -+ -+ cpu_physical_memory_write(buf, event->data, len); -+ rtas_st(rets, 0, RTAS_OUT_SUCCESS); -+ g_free(event->data); -+ g_free(event); -+ -+ /* according to PAPR+, the IRQ must be left asserted, or re-asserted, if -+ * there are still pending events to be fetched via check-exception. We -+ * do the latter here, since our code relies on edge-triggered -+ * interrupts. -+ */ -+ if (rtas_event_log_contains(mask)) { -+ qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); - } -+ -+ return; -+ -+out_no_events: -+ rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND); - } - - void spapr_events_init(sPAPREnvironment *spapr) - { -- spapr->epow_irq = xics_alloc(spapr->icp, 0, 0, false); -+ QTAILQ_INIT(&spapr->pending_events); -+ spapr->check_exception_irq = xics_alloc(spapr->icp, 0, 0, false); - spapr->epow_notifier.notify = spapr_powerdown_req; - qemu_register_powerdown_notifier(&spapr->epow_notifier); - spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception", -diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h -index 673fd89..62fe349 100644 ---- a/include/hw/ppc/spapr.h -+++ b/include/hw/ppc/spapr.h -@@ -3,11 +3,13 @@ - - #include "sysemu/dma.h" - #include "hw/ppc/xics.h" -+#include "hw/ppc/spapr_drc.h" - - struct VIOsPAPRBus; - struct sPAPRPHBState; - struct sPAPRNVRAM; - typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState; -+typedef struct sPAPREventLogEntry sPAPREventLogEntry; - - #define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL - -@@ -32,8 +34,9 @@ typedef struct sPAPREnvironment { - struct PPCTimebase tb; - bool has_graphics; - -- uint32_t epow_irq; -+ uint32_t check_exception_irq; - Notifier epow_notifier; -+ QTAILQ_HEAD(, sPAPREventLogEntry) pending_events; - - /* Migration state */ - int htab_save_index; -@@ -528,6 +531,12 @@ struct sPAPRTCETable { - QLIST_ENTRY(sPAPRTCETable) list; - }; - -+struct sPAPREventLogEntry { -+ int log_type; -+ void *data; -+ QTAILQ_ENTRY(sPAPREventLogEntry) next; -+}; -+ - void spapr_events_init(sPAPREnvironment *spapr); - void spapr_events_fdt_skel(void *fdt, uint32_t epow_irq); - int spapr_h_cas_compose_response(target_ulong addr, target_ulong size); -@@ -542,6 +551,8 @@ int spapr_dma_dt(void *fdt, int node_off, const char *propname, - int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname, - sPAPRTCETable *tcet); - void spapr_pci_switch_vga(bool big_endian); -+void spapr_hotplug_req_add_event(sPAPRDRConnector *drc); -+void spapr_hotplug_req_remove_event(sPAPRDRConnector *drc); - - /* rtas-configure-connector state */ - struct sPAPRConfigureConnectorState { --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_pci-add-dynamic-reconfiguration-option-for-spa.patch b/SOURCES/kvm-spapr_pci-add-dynamic-reconfiguration-option-for-spa.patch deleted file mode 100644 index 21d0c82..0000000 --- a/SOURCES/kvm-spapr_pci-add-dynamic-reconfiguration-option-for-spa.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 6abe4c42602f8372c7ae99cfd58a44d39d2ec45a Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:37 +0200 -Subject: [PATCH 098/217] spapr_pci: add dynamic-reconfiguration option for - spapr-pci-host-bridge - -Message-id: <1435239881-28541-11-git-send-email-lvivier@redhat.com> -Patchwork-id: 66492 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 10/14] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -This option enables/disables PCI hotplug for a particular PHB. - -Also add machine compatibility code to disable it by default for machine -types prior to pseries-2.4. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -[agraf: move commas for compat fields] -Signed-off-by: Alexander Graf <agraf@suse.de> - -(cherry picked from commit 7619c7b00c90a39243f1229facde8c53a8fba921) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/ppc/spapr.c -conflict with missing SPAPR_COMPAT_2_3 definition, useless as we use -pseries-rhel7.2.0 machine and no other one is defined. - 38ff32c spapr: define SPAPR_COMPAT_2_3 - -Signed-off-by: Laurent Vivier <lvivier@redhat.com> ---- - hw/ppc/spapr_pci.c | 2 ++ - include/hw/pci-host/spapr.h | 1 + - 2 files changed, 3 insertions(+) - -diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c -index 05f4fac..8b76017 100644 ---- a/hw/ppc/spapr_pci.c -+++ b/hw/ppc/spapr_pci.c -@@ -936,6 +936,8 @@ static Property spapr_phb_properties[] = { - DEFINE_PROP_UINT64("io_win_addr", sPAPRPHBState, io_win_addr, -1), - DEFINE_PROP_UINT64("io_win_size", sPAPRPHBState, io_win_size, - SPAPR_PCI_IO_WIN_SIZE), -+ DEFINE_PROP_BOOL("dynamic-reconfiguration", sPAPRPHBState, dr_enabled, -+ true), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h -index 895d273..34ee4e0 100644 ---- a/include/hw/pci-host/spapr.h -+++ b/include/hw/pci-host/spapr.h -@@ -71,6 +71,7 @@ struct sPAPRPHBState { - uint32_t index; - uint64_t buid; - char *dtbusname; -+ bool dr_enabled; - - MemoryRegion memspace, iospace; - hwaddr mem_win_addr, mem_win_size, io_win_addr, io_win_size; --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_pci-create-DRConnectors-for-each-PCI-slot-duri.patch b/SOURCES/kvm-spapr_pci-create-DRConnectors-for-each-PCI-slot-duri.patch deleted file mode 100644 index 6e6056a..0000000 --- a/SOURCES/kvm-spapr_pci-create-DRConnectors-for-each-PCI-slot-duri.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 8e0bb258db05c8a56b3d2aa877270f4113a8ae3c Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:38 +0200 -Subject: [PATCH 099/217] spapr_pci: create DRConnectors for each PCI slot - during PHB realize - -Message-id: <1435239881-28541-12-git-send-email-lvivier@redhat.com> -Patchwork-id: 66488 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 11/14] spapr_pci: create DRConnectors for each PCI slot during PHB realize -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -These will be used to support hotplug/unplug of PCI devices to the PCI -bus associated with a particular PHB. - -We also set up device-tree properties in each PHBs initial FDT to -describe the DRCs associated with them. This advertises to guests that -each PHB is DR-capable device with physical hotpluggable slots, each -managed by the corresponding DRC. This is necessary for allowing -hotplugging of devices to it later via bus rescan or guest rpaphp -hotplug module. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 62083979b0471ac07da6d94944bf12a9b18baa1f) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_pci.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c -index 8b76017..4017279 100644 ---- a/hw/ppc/spapr_pci.c -+++ b/hw/ppc/spapr_pci.c -@@ -35,6 +35,7 @@ - #include "qemu/error-report.h" - - #include "hw/pci/pci_bus.h" -+#include "hw/ppc/spapr_drc.h" - - /* Copied from the kernel arch/powerpc/platforms/pseries/msi.c */ - #define RTAS_QUERY_FN 0 -@@ -880,6 +881,15 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) - sphb->lsi_table[i].irq = irq; - } - -+ /* allocate connectors for child PCI devices */ -+ if (sphb->dr_enabled) { -+ for (i = 0; i < PCI_SLOT_MAX * 8; i++) { -+ spapr_dr_connector_new(OBJECT(phb), -+ SPAPR_DR_CONNECTOR_TYPE_PCI, -+ (sphb->index << 16) | i); -+ } -+ } -+ - if (!info->finish_realize) { - error_setg(errp, "finish_realize not defined"); - return; -@@ -1119,7 +1129,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, - uint32_t xics_phandle, - void *fdt) - { -- int bus_off, i, j; -+ int bus_off, i, j, ret; - char nodename[256]; - uint32_t bus_range[] = { cpu_to_be32(0), cpu_to_be32(0xff) }; - const uint64_t mmiosize = memory_region_size(&phb->memwindow); -@@ -1208,6 +1218,12 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, - object_child_foreach(OBJECT(phb), spapr_phb_children_dt, - &((sPAPRTCEDT){ .fdt = fdt, .node_off = bus_off })); - -+ ret = spapr_drc_populate_dt(fdt, bus_off, OBJECT(phb), -+ SPAPR_DR_CONNECTOR_TYPE_PCI); -+ if (ret) { -+ return ret; -+ } -+ - return 0; - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_pci-emit-hotplug-add-remove-events-during-hotp.patch b/SOURCES/kvm-spapr_pci-emit-hotplug-add-remove-events-during-hotp.patch deleted file mode 100644 index 7ecd35d..0000000 --- a/SOURCES/kvm-spapr_pci-emit-hotplug-add-remove-events-during-hotp.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 5bb08ca2dd7806cd8fbc0f99f14b650f23d30702 Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:41 +0200 -Subject: [PATCH 102/217] spapr_pci: emit hotplug add/remove events during - hotplug - -Message-id: <1435239881-28541-15-git-send-email-lvivier@redhat.com> -Patchwork-id: 66493 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 14/14] spapr_pci: emit hotplug add/remove events during hotplug -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> - -This uses extension of existing EPOW interrupt/event mechanism -to notify userspace tools like librtas/drmgr to handle -in-guest configuration/cleanup operations in response to -device_add/device_del. - -Userspace tools that don't implement this extension will need -to be run manually in response/advance of device_add/device_del, -respectively. - -Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit c5bc152bc399ae7ec8ac5227762e4320d0fd2d1c) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_pci.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c -index c0a34ae..00a87bf 100644 ---- a/hw/ppc/spapr_pci.c -+++ b/hw/ppc/spapr_pci.c -@@ -1075,6 +1075,9 @@ static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler, - error_propagate(errp, local_err); - return; - } -+ if (plugged_dev->hotplugged) { -+ spapr_hotplug_req_add_event(drc); -+ } - } - - static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler, -@@ -1101,6 +1104,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler, - error_propagate(errp, local_err); - return; - } -+ spapr_hotplug_req_remove_event(drc); - } - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_pci-enable-basic-hotplug-operations.patch b/SOURCES/kvm-spapr_pci-enable-basic-hotplug-operations.patch deleted file mode 100644 index 07985f2..0000000 --- a/SOURCES/kvm-spapr_pci-enable-basic-hotplug-operations.patch +++ /dev/null @@ -1,515 +0,0 @@ -From 5ff5f42d0e12141a66f7038902627c6802c4ec11 Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:40 +0200 -Subject: [PATCH 101/217] spapr_pci: enable basic hotplug operations - -Message-id: <1435239881-28541-14-git-send-email-lvivier@redhat.com> -Patchwork-id: 66491 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 13/14] spapr_pci: enable basic hotplug operations -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -This enables hotplug of PCI devices to a PHB. Upon hotplug we -generate the OF-nodes required by PAPR specification and -IEEE 1275-1994 "PCI Bus Binding to Open Firmware" for the -device. - -We associate the corresponding FDT for these nodes with the DRC -corresponding to the slot, which will be fetched via -ibm,configure-connector RTAS calls by the guest as described by PAPR -specification. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 7454c7af91bdd60216e2b6eead827c012bb4d0d0) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/ppc/spapr_pci.c - -Conflicts on context of missing commits: - 46c5874 spapr_pci: Make find_phb()/find_dev() public - ccf9ff8 spapr_pci: Rework device-tree rendering ---- - hw/ppc/spapr_pci.c | 399 ++++++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 380 insertions(+), 19 deletions(-) - -diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c -index 4017279..c0a34ae 100644 ---- a/hw/ppc/spapr_pci.c -+++ b/hw/ppc/spapr_pci.c -@@ -33,9 +33,11 @@ - #include <libfdt.h> - #include "trace.h" - #include "qemu/error-report.h" -+#include "qapi/qmp/qerror.h" - - #include "hw/pci/pci_bus.h" - #include "hw/ppc/spapr_drc.h" -+#include "sysemu/device_tree.h" - - /* Copied from the kernel arch/powerpc/platforms/pseries/msi.c */ - #define RTAS_QUERY_FN 0 -@@ -48,6 +50,14 @@ - #define RTAS_TYPE_MSI 1 - #define RTAS_TYPE_MSIX 2 - -+#define _FDT(exp) \ -+ do { \ -+ int ret = (exp); \ -+ if (ret < 0) { \ -+ return ret; \ -+ } \ -+ } while (0) -+ - static sPAPRPHBState *find_phb(sPAPREnvironment *spapr, uint64_t buid) - { - sPAPRPHBState *sphb; -@@ -732,6 +742,368 @@ static AddressSpace *spapr_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn) - return &phb->iommu_as; - } - -+/* Macros to operate with address in OF binding to PCI */ -+#define b_x(x, p, l) (((x) & ((1<<(l))-1)) << (p)) -+#define b_n(x) b_x((x), 31, 1) /* 0 if relocatable */ -+#define b_p(x) b_x((x), 30, 1) /* 1 if prefetchable */ -+#define b_t(x) b_x((x), 29, 1) /* 1 if the address is aliased */ -+#define b_ss(x) b_x((x), 24, 2) /* the space code */ -+#define b_bbbbbbbb(x) b_x((x), 16, 8) /* bus number */ -+#define b_ddddd(x) b_x((x), 11, 5) /* device number */ -+#define b_fff(x) b_x((x), 8, 3) /* function number */ -+#define b_rrrrrrrr(x) b_x((x), 0, 8) /* register number */ -+ -+/* for 'reg'/'assigned-addresses' OF properties */ -+#define RESOURCE_CELLS_SIZE 2 -+#define RESOURCE_CELLS_ADDRESS 3 -+ -+typedef struct ResourceFields { -+ uint32_t phys_hi; -+ uint32_t phys_mid; -+ uint32_t phys_lo; -+ uint32_t size_hi; -+ uint32_t size_lo; -+} QEMU_PACKED ResourceFields; -+ -+typedef struct ResourceProps { -+ ResourceFields reg[8]; -+ ResourceFields assigned[7]; -+ uint32_t reg_len; -+ uint32_t assigned_len; -+} ResourceProps; -+ -+/* fill in the 'reg'/'assigned-resources' OF properties for -+ * a PCI device. 'reg' describes resource requirements for a -+ * device's IO/MEM regions, 'assigned-addresses' describes the -+ * actual resource assignments. -+ * -+ * the properties are arrays of ('phys-addr', 'size') pairs describing -+ * the addressable regions of the PCI device, where 'phys-addr' is a -+ * RESOURCE_CELLS_ADDRESS-tuple of 32-bit integers corresponding to -+ * (phys.hi, phys.mid, phys.lo), and 'size' is a -+ * RESOURCE_CELLS_SIZE-tuple corresponding to (size.hi, size.lo). -+ * -+ * phys.hi = 0xYYXXXXZZ, where: -+ * 0xYY = npt000ss -+ * ||| | -+ * ||| +-- space code: 1 if IO region, 2 if MEM region -+ * ||+------ for non-relocatable IO: 1 if aliased -+ * || for relocatable IO: 1 if below 64KB -+ * || for MEM: 1 if below 1MB -+ * |+------- 1 if region is prefetchable -+ * +-------- 1 if region is non-relocatable -+ * 0xXXXX = bbbbbbbb dddddfff, encoding bus, slot, and function -+ * bits respectively -+ * 0xZZ = rrrrrrrr, the register number of the BAR corresponding -+ * to the region -+ * -+ * phys.mid and phys.lo correspond respectively to the hi/lo portions -+ * of the actual address of the region. -+ * -+ * how the phys-addr/size values are used differ slightly between -+ * 'reg' and 'assigned-addresses' properties. namely, 'reg' has -+ * an additional description for the config space region of the -+ * device, and in the case of QEMU has n=0 and phys.mid=phys.lo=0 -+ * to describe the region as relocatable, with an address-mapping -+ * that corresponds directly to the PHB's address space for the -+ * resource. 'assigned-addresses' always has n=1 set with an absolute -+ * address assigned for the resource. in general, 'assigned-addresses' -+ * won't be populated, since addresses for PCI devices are generally -+ * unmapped initially and left to the guest to assign. -+ * -+ * note also that addresses defined in these properties are, at least -+ * for PAPR guests, relative to the PHBs IO/MEM windows, and -+ * correspond directly to the addresses in the BARs. -+ * -+ * in accordance with PCI Bus Binding to Open Firmware, -+ * IEEE Std 1275-1994, section 4.1.1, as implemented by PAPR+ v2.7, -+ * Appendix C. -+ */ -+static void populate_resource_props(PCIDevice *d, ResourceProps *rp) -+{ -+ int bus_num = pci_bus_num(PCI_BUS(qdev_get_parent_bus(DEVICE(d)))); -+ uint32_t dev_id = (b_bbbbbbbb(bus_num) | -+ b_ddddd(PCI_SLOT(d->devfn)) | -+ b_fff(PCI_FUNC(d->devfn))); -+ ResourceFields *reg, *assigned; -+ int i, reg_idx = 0, assigned_idx = 0; -+ -+ /* config space region */ -+ reg = &rp->reg[reg_idx++]; -+ reg->phys_hi = cpu_to_be32(dev_id); -+ reg->phys_mid = 0; -+ reg->phys_lo = 0; -+ reg->size_hi = 0; -+ reg->size_lo = 0; -+ -+ for (i = 0; i < PCI_NUM_REGIONS; i++) { -+ if (!d->io_regions[i].size) { -+ continue; -+ } -+ -+ reg = &rp->reg[reg_idx++]; -+ -+ reg->phys_hi = cpu_to_be32(dev_id | b_rrrrrrrr(pci_bar(d, i))); -+ if (d->io_regions[i].type & PCI_BASE_ADDRESS_SPACE_IO) { -+ reg->phys_hi |= cpu_to_be32(b_ss(1)); -+ } else { -+ reg->phys_hi |= cpu_to_be32(b_ss(2)); -+ } -+ reg->phys_mid = 0; -+ reg->phys_lo = 0; -+ reg->size_hi = cpu_to_be32(d->io_regions[i].size >> 32); -+ reg->size_lo = cpu_to_be32(d->io_regions[i].size); -+ -+ if (d->io_regions[i].addr == PCI_BAR_UNMAPPED) { -+ continue; -+ } -+ -+ assigned = &rp->assigned[assigned_idx++]; -+ assigned->phys_hi = cpu_to_be32(reg->phys_hi | b_n(1)); -+ assigned->phys_mid = cpu_to_be32(d->io_regions[i].addr >> 32); -+ assigned->phys_lo = cpu_to_be32(d->io_regions[i].addr); -+ assigned->size_hi = reg->size_hi; -+ assigned->size_lo = reg->size_lo; -+ } -+ -+ rp->reg_len = reg_idx * sizeof(ResourceFields); -+ rp->assigned_len = assigned_idx * sizeof(ResourceFields); -+} -+ -+static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset, -+ int phb_index, int drc_index, -+ const char *drc_name) -+{ -+ ResourceProps rp; -+ bool is_bridge = false; -+ int pci_status; -+ -+ if (pci_default_read_config(dev, PCI_HEADER_TYPE, 1) == -+ PCI_HEADER_TYPE_BRIDGE) { -+ is_bridge = true; -+ } -+ -+ /* in accordance with PAPR+ v2.7 13.6.3, Table 181 */ -+ _FDT(fdt_setprop_cell(fdt, offset, "vendor-id", -+ pci_default_read_config(dev, PCI_VENDOR_ID, 2))); -+ _FDT(fdt_setprop_cell(fdt, offset, "device-id", -+ pci_default_read_config(dev, PCI_DEVICE_ID, 2))); -+ _FDT(fdt_setprop_cell(fdt, offset, "revision-id", -+ pci_default_read_config(dev, PCI_REVISION_ID, 1))); -+ _FDT(fdt_setprop_cell(fdt, offset, "class-code", -+ pci_default_read_config(dev, PCI_CLASS_DEVICE, 2) -+ << 8)); -+ if (pci_default_read_config(dev, PCI_INTERRUPT_PIN, 1)) { -+ _FDT(fdt_setprop_cell(fdt, offset, "interrupts", -+ pci_default_read_config(dev, PCI_INTERRUPT_PIN, 1))); -+ } -+ -+ if (!is_bridge) { -+ _FDT(fdt_setprop_cell(fdt, offset, "min-grant", -+ pci_default_read_config(dev, PCI_MIN_GNT, 1))); -+ _FDT(fdt_setprop_cell(fdt, offset, "max-latency", -+ pci_default_read_config(dev, PCI_MAX_LAT, 1))); -+ } -+ -+ if (pci_default_read_config(dev, PCI_SUBSYSTEM_ID, 2)) { -+ _FDT(fdt_setprop_cell(fdt, offset, "subsystem-id", -+ pci_default_read_config(dev, PCI_SUBSYSTEM_ID, 2))); -+ } -+ -+ if (pci_default_read_config(dev, PCI_SUBSYSTEM_VENDOR_ID, 2)) { -+ _FDT(fdt_setprop_cell(fdt, offset, "subsystem-vendor-id", -+ pci_default_read_config(dev, PCI_SUBSYSTEM_VENDOR_ID, 2))); -+ } -+ -+ _FDT(fdt_setprop_cell(fdt, offset, "cache-line-size", -+ pci_default_read_config(dev, PCI_CACHE_LINE_SIZE, 1))); -+ -+ /* the following fdt cells are masked off the pci status register */ -+ pci_status = pci_default_read_config(dev, PCI_STATUS, 2); -+ _FDT(fdt_setprop_cell(fdt, offset, "devsel-speed", -+ PCI_STATUS_DEVSEL_MASK & pci_status)); -+ -+ if (pci_status & PCI_STATUS_FAST_BACK) { -+ _FDT(fdt_setprop(fdt, offset, "fast-back-to-back", NULL, 0)); -+ } -+ if (pci_status & PCI_STATUS_66MHZ) { -+ _FDT(fdt_setprop(fdt, offset, "66mhz-capable", NULL, 0)); -+ } -+ if (pci_status & PCI_STATUS_UDF) { -+ _FDT(fdt_setprop(fdt, offset, "udf-supported", NULL, 0)); -+ } -+ -+ /* NOTE: this is normally generated by firmware via path/unit name, -+ * but in our case we must set it manually since it does not get -+ * processed by OF beforehand -+ */ -+ _FDT(fdt_setprop_string(fdt, offset, "name", "pci")); -+ _FDT(fdt_setprop(fdt, offset, "ibm,loc-code", drc_name, strlen(drc_name))); -+ _FDT(fdt_setprop_cell(fdt, offset, "ibm,my-drc-index", drc_index)); -+ -+ _FDT(fdt_setprop_cell(fdt, offset, "#address-cells", -+ RESOURCE_CELLS_ADDRESS)); -+ _FDT(fdt_setprop_cell(fdt, offset, "#size-cells", -+ RESOURCE_CELLS_SIZE)); -+ _FDT(fdt_setprop_cell(fdt, offset, "ibm,req#msi-x", -+ RESOURCE_CELLS_SIZE)); -+ -+ populate_resource_props(dev, &rp); -+ _FDT(fdt_setprop(fdt, offset, "reg", (uint8_t *)rp.reg, rp.reg_len)); -+ _FDT(fdt_setprop(fdt, offset, "assigned-addresses", -+ (uint8_t *)rp.assigned, rp.assigned_len)); -+ -+ return 0; -+} -+ -+/* create OF node for pci device and required OF DT properties */ -+static void *spapr_create_pci_child_dt(sPAPRPHBState *phb, PCIDevice *dev, -+ int drc_index, const char *drc_name, -+ int *dt_offset) -+{ -+ void *fdt; -+ int offset, ret, fdt_size; -+ int slot = PCI_SLOT(dev->devfn); -+ int func = PCI_FUNC(dev->devfn); -+ char nodename[512]; -+ -+ fdt = create_device_tree(&fdt_size); -+ if (func != 0) { -+ sprintf(nodename, "pci@%d,%d", slot, func); -+ } else { -+ sprintf(nodename, "pci@%d", slot); -+ } -+ offset = fdt_add_subnode(fdt, 0, nodename); -+ ret = spapr_populate_pci_child_dt(dev, fdt, offset, phb->index, drc_index, -+ drc_name); -+ g_assert(!ret); -+ -+ *dt_offset = offset; -+ return fdt; -+} -+ -+static void spapr_phb_add_pci_device(sPAPRDRConnector *drc, -+ sPAPRPHBState *phb, -+ PCIDevice *pdev, -+ Error **errp) -+{ -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ DeviceState *dev = DEVICE(pdev); -+ int drc_index = drck->get_index(drc); -+ const char *drc_name = drck->get_name(drc); -+ void *fdt = NULL; -+ int fdt_start_offset = 0; -+ -+ /* boot-time devices get their device tree node created by SLOF, but for -+ * hotplugged devices we need QEMU to generate it so the guest can fetch -+ * it via RTAS -+ */ -+ if (dev->hotplugged) { -+ fdt = spapr_create_pci_child_dt(phb, pdev, drc_index, drc_name, -+ &fdt_start_offset); -+ } -+ -+ drck->attach(drc, DEVICE(pdev), -+ fdt, fdt_start_offset, !dev->hotplugged, errp); -+ if (*errp) { -+ g_free(fdt); -+ } -+} -+ -+static void spapr_phb_remove_pci_device_cb(DeviceState *dev, void *opaque) -+{ -+ /* some version guests do not wait for completion of a device -+ * cleanup (generally done asynchronously by the kernel) before -+ * signaling to QEMU that the device is safe, but instead sleep -+ * for some 'safe' period of time. unfortunately on a busy host -+ * this sleep isn't guaranteed to be long enough, resulting in -+ * bad things like IRQ lines being left asserted during final -+ * device removal. to deal with this we call reset just prior -+ * to finalizing the device, which will put the device back into -+ * an 'idle' state, as the device cleanup code expects. -+ */ -+ pci_device_reset(PCI_DEVICE(dev)); -+ object_unparent(OBJECT(dev)); -+} -+ -+static void spapr_phb_remove_pci_device(sPAPRDRConnector *drc, -+ sPAPRPHBState *phb, -+ PCIDevice *pdev, -+ Error **errp) -+{ -+ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ -+ drck->detach(drc, DEVICE(pdev), spapr_phb_remove_pci_device_cb, phb, errp); -+} -+ -+static sPAPRDRConnector *spapr_phb_get_pci_drc(sPAPRPHBState *phb, -+ PCIDevice *pdev) -+{ -+ uint32_t busnr = pci_bus_num(PCI_BUS(qdev_get_parent_bus(DEVICE(pdev)))); -+ return spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_PCI, -+ (phb->index << 16) | -+ (busnr << 8) | -+ pdev->devfn); -+} -+ -+static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler, -+ DeviceState *plugged_dev, Error **errp) -+{ -+ sPAPRPHBState *phb = SPAPR_PCI_HOST_BRIDGE(DEVICE(plug_handler)); -+ PCIDevice *pdev = PCI_DEVICE(plugged_dev); -+ sPAPRDRConnector *drc = spapr_phb_get_pci_drc(phb, pdev); -+ Error *local_err = NULL; -+ -+ /* if DR is disabled we don't need to do anything in the case of -+ * hotplug or coldplug callbacks -+ */ -+ if (!phb->dr_enabled) { -+ /* if this is a hotplug operation initiated by the user -+ * we need to let them know it's not enabled -+ */ -+ if (plugged_dev->hotplugged) { -+ error_set(errp, QERR_BUS_NO_HOTPLUG, -+ object_get_typename(OBJECT(phb))); -+ } -+ return; -+ } -+ -+ g_assert(drc); -+ -+ spapr_phb_add_pci_device(drc, phb, pdev, &local_err); -+ if (local_err) { -+ error_propagate(errp, local_err); -+ return; -+ } -+} -+ -+static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler, -+ DeviceState *plugged_dev, Error **errp) -+{ -+ sPAPRPHBState *phb = SPAPR_PCI_HOST_BRIDGE(DEVICE(plug_handler)); -+ PCIDevice *pdev = PCI_DEVICE(plugged_dev); -+ sPAPRDRConnectorClass *drck; -+ sPAPRDRConnector *drc = spapr_phb_get_pci_drc(phb, pdev); -+ Error *local_err = NULL; -+ -+ if (!phb->dr_enabled) { -+ error_set(errp, QERR_BUS_NO_HOTPLUG, -+ object_get_typename(OBJECT(phb))); -+ return; -+ } -+ -+ g_assert(drc); -+ -+ drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ if (!drck->release_pending(drc)) { -+ spapr_phb_remove_pci_device(drc, phb, pdev, &local_err); -+ if (local_err) { -+ error_propagate(errp, local_err); -+ return; -+ } -+ } -+} -+ - static void spapr_phb_realize(DeviceState *dev, Error **errp) - { - SysBusDevice *s = SYS_BUS_DEVICE(dev); -@@ -825,6 +1197,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) - &sphb->memspace, &sphb->iospace, - PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_PCI_BUS); - phb->bus = bus; -+ qbus_set_hotplug_handler(BUS(phb->bus), DEVICE(sphb), NULL); - - /* - * Initialize PHB address space. -@@ -1061,6 +1434,7 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data) - PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass); - DeviceClass *dc = DEVICE_CLASS(klass); - sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_CLASS(klass); -+ HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(klass); - - hc->root_bus_path = spapr_phb_root_bus_path; - dc->realize = spapr_phb_realize; -@@ -1070,6 +1444,8 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data) - set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->cannot_instantiate_with_device_add_yet = false; - spc->finish_realize = spapr_phb_finish_realize; -+ hp->plug = spapr_phb_hot_plug_child; -+ hp->unplug = spapr_phb_hot_unplug_child; - } - - static const TypeInfo spapr_phb_info = { -@@ -1078,6 +1454,10 @@ static const TypeInfo spapr_phb_info = { - .instance_size = sizeof(sPAPRPHBState), - .class_init = spapr_phb_class_init, - .class_size = sizeof(sPAPRPHBClass), -+ .interfaces = (InterfaceInfo[]) { -+ { TYPE_HOTPLUG_HANDLER }, -+ { } -+ } - }; - - PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int index) -@@ -1091,17 +1471,6 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int index) - return PCI_HOST_BRIDGE(dev); - } - --/* Macros to operate with address in OF binding to PCI */ --#define b_x(x, p, l) (((x) & ((1<<(l))-1)) << (p)) --#define b_n(x) b_x((x), 31, 1) /* 0 if relocatable */ --#define b_p(x) b_x((x), 30, 1) /* 1 if prefetchable */ --#define b_t(x) b_x((x), 29, 1) /* 1 if the address is aliased */ --#define b_ss(x) b_x((x), 24, 2) /* the space code */ --#define b_bbbbbbbb(x) b_x((x), 16, 8) /* bus number */ --#define b_ddddd(x) b_x((x), 11, 5) /* device number */ --#define b_fff(x) b_x((x), 8, 3) /* function number */ --#define b_rrrrrrrr(x) b_x((x), 0, 8) /* register number */ -- - typedef struct sPAPRTCEDT { - void *fdt; - int node_off; -@@ -1171,14 +1540,6 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, - return bus_off; - } - --#define _FDT(exp) \ -- do { \ -- int ret = (exp); \ -- if (ret < 0) { \ -- return ret; \ -- } \ -- } while (0) -- - /* Write PHB properties */ - _FDT(fdt_setprop_string(fdt, bus_off, "device_type", "pci")); - _FDT(fdt_setprop_string(fdt, bus_off, "compatible", "IBM,Logical_PHB")); --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_rtas-add-get-sensor-state-RTAS-interface.patch b/SOURCES/kvm-spapr_rtas-add-get-sensor-state-RTAS-interface.patch deleted file mode 100644 index 0a73e7f..0000000 --- a/SOURCES/kvm-spapr_rtas-add-get-sensor-state-RTAS-interface.patch +++ /dev/null @@ -1,99 +0,0 @@ -From e6ef2a2137ef50c9b4b18f430e33895cba6a8cae Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:31 +0200 -Subject: [PATCH 092/217] spapr_rtas: add get-sensor-state RTAS interface - -Message-id: <1435239881-28541-5-git-send-email-lvivier@redhat.com> -Patchwork-id: 66484 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 04/14] spapr_rtas: add get-sensor-state RTAS interface -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Mike Day <ncmike@ncultra.org> - -This interface allows a guest to read various platform/device sensors. -initially, we only implement support necessary to support hotplug: -reading of the dr-entity-sense sensor, which communicates the state of -a hotplugged resource/device to the guest (EMPTY/PRESENT/UNUSABLE). - -See docs/specs/ppc-spapr-hotplug.txt for a complete description of -this interface. - -Signed-off-by: Mike Day <ncmike@ncultra.org> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 886445a6ee808ee06533f9ecdf0f169c9ea83fbb) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_rtas.c | 43 +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 43 insertions(+) - -diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c -index 6c741fa..f80beb2 100644 ---- a/hw/ppc/spapr_rtas.c -+++ b/hw/ppc/spapr_rtas.c -@@ -377,6 +377,47 @@ out_unimplemented: - rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); - } - -+static void rtas_get_sensor_state(PowerPCCPU *cpu, sPAPREnvironment *spapr, -+ uint32_t token, uint32_t nargs, -+ target_ulong args, uint32_t nret, -+ target_ulong rets) -+{ -+ uint32_t sensor_type; -+ uint32_t sensor_index; -+ sPAPRDRConnector *drc; -+ sPAPRDRConnectorClass *drck; -+ uint32_t entity_sense; -+ -+ if (nargs != 2 || nret != 2) { -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ -+ sensor_type = rtas_ld(args, 0); -+ sensor_index = rtas_ld(args, 1); -+ -+ if (sensor_type != RTAS_SENSOR_TYPE_ENTITY_SENSE) { -+ /* currently only DR-related sensors are implemented */ -+ DPRINTF("rtas_get_sensor_state: sensor/indicator not implemented: %d\n", -+ sensor_type); -+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); -+ return; -+ } -+ -+ drc = spapr_dr_connector_by_index(sensor_index); -+ if (!drc) { -+ DPRINTF("rtas_get_sensor_state: invalid sensor/DRC index: %xh\n", -+ sensor_index); -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ entity_sense = drck->entity_sense(drc); -+ -+ rtas_st(rets, 0, RTAS_OUT_SUCCESS); -+ rtas_st(rets, 1, entity_sense); -+} -+ - static struct rtas_call { - const char *name; - spapr_rtas_fn fn; -@@ -508,6 +549,8 @@ static void core_rtas_register_types(void) - rtas_get_power_level); - spapr_rtas_register(RTAS_SET_INDICATOR, "set-indicator", - rtas_set_indicator); -+ spapr_rtas_register(RTAS_GET_SENSOR_STATE, "get-sensor-state", -+ rtas_get_sensor_state); - } - - type_init(core_rtas_register_types) --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_rtas-add-get-set-power-level-RTAS-interfaces.patch b/SOURCES/kvm-spapr_rtas-add-get-set-power-level-RTAS-interfaces.patch deleted file mode 100644 index 3817565..0000000 --- a/SOURCES/kvm-spapr_rtas-add-get-set-power-level-RTAS-interfaces.patch +++ /dev/null @@ -1,112 +0,0 @@ -From a65a8165db67751090f8e6209b33f0be22fca28b Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:29 +0200 -Subject: [PATCH 090/217] spapr_rtas: add get/set-power-level RTAS interfaces - -Message-id: <1435239881-28541-3-git-send-email-lvivier@redhat.com> -Patchwork-id: 66483 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 02/14] spapr_rtas: add get/set-power-level RTAS interfaces -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Nathan Fontenot <nfont@linux.vnet.ibm.com> - -These interfaces manage the power domains that guest devices are -assigned to and are used to power on/off devices. Currently we -only utilize 1 power domain, the 'live-insertion' domain, which -automates power management of plugged/unplugged devices, essentially -making these calls no-ops, but the RTAS interfaces are still required -by guest hotplug code and PAPR+. - -See docs/specs/ppc-spapr-hotplug.txt for a complete description of -these interfaces. - -Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 094d20585ecdcd31959b1b88a390b4d2c4cfeab7) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_rtas.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c -index 0f1ae55..d7694cd 100644 ---- a/hw/ppc/spapr_rtas.c -+++ b/hw/ppc/spapr_rtas.c -@@ -245,6 +245,56 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu, - rtas_st(rets, 0, ret); - } - -+static void rtas_set_power_level(PowerPCCPU *cpu, sPAPREnvironment *spapr, -+ uint32_t token, uint32_t nargs, -+ target_ulong args, uint32_t nret, -+ target_ulong rets) -+{ -+ int32_t power_domain; -+ -+ if (nargs != 2 || nret != 2) { -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ -+ /* we currently only use a single, "live insert" powerdomain for -+ * hotplugged/dlpar'd resources, so the power is always live/full (100) -+ */ -+ power_domain = rtas_ld(args, 0); -+ if (power_domain != -1) { -+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); -+ return; -+ } -+ -+ rtas_st(rets, 0, RTAS_OUT_SUCCESS); -+ rtas_st(rets, 1, 100); -+} -+ -+static void rtas_get_power_level(PowerPCCPU *cpu, sPAPREnvironment *spapr, -+ uint32_t token, uint32_t nargs, -+ target_ulong args, uint32_t nret, -+ target_ulong rets) -+{ -+ int32_t power_domain; -+ -+ if (nargs != 1 || nret != 2) { -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ -+ /* we currently only use a single, "live insert" powerdomain for -+ * hotplugged/dlpar'd resources, so the power is always live/full (100) -+ */ -+ power_domain = rtas_ld(args, 0); -+ if (power_domain != -1) { -+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); -+ return; -+ } -+ -+ rtas_st(rets, 0, RTAS_OUT_SUCCESS); -+ rtas_st(rets, 1, 100); -+} -+ - static struct rtas_call { - const char *name; - spapr_rtas_fn fn; -@@ -370,6 +420,10 @@ static void core_rtas_register_types(void) - rtas_ibm_set_system_parameter); - spapr_rtas_register(RTAS_IBM_OS_TERM, "ibm,os-term", - rtas_ibm_os_term); -+ spapr_rtas_register(RTAS_SET_POWER_LEVEL, "set-power-level", -+ rtas_set_power_level); -+ spapr_rtas_register(RTAS_GET_POWER_LEVEL, "get-power-level", -+ rtas_get_power_level); - } - - type_init(core_rtas_register_types) --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_rtas-add-ibm-configure-connector-RTAS-interfac.patch b/SOURCES/kvm-spapr_rtas-add-ibm-configure-connector-RTAS-interfac.patch deleted file mode 100644 index 5d2a2d8..0000000 --- a/SOURCES/kvm-spapr_rtas-add-ibm-configure-connector-RTAS-interfac.patch +++ /dev/null @@ -1,311 +0,0 @@ -From fbfb411fd95ec7653edbc9e15a9ce5315c744c1a Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:33 +0200 -Subject: [PATCH 094/217] spapr_rtas: add ibm, configure-connector RTAS - interface - -Message-id: <1435239881-28541-7-git-send-email-lvivier@redhat.com> -Patchwork-id: 66486 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 06/14] spapr_rtas: add ibm, configure-connector RTAS interface -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Michael Roth <mdroth@linux.vnet.ibm.com> - -This interface is used to fetch an OF device-tree nodes that describes a -newly-attached device to guest. It is called multiple times to walk the -device-tree node and fetch individual properties into a 'workarea'/buffer -provided by the guest. - -The device-tree is generated by QEMU and passed to an sPAPRDRConnector during -the initial hotplug operation, and the state of these RTAS calls is tracked by -the sPAPRDRConnector. When the last of these properties is successfully -fetched, we report as special return value to the guest and transition -the device to a 'configured' state on the QEMU/DRC side. - -See docs/specs/ppc-spapr-hotplug.txt for a complete description of -this interface. - -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 46503c2bc047bfe8c26440e17298fcbc59d7bbbe) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr.c | 4 ++ - hw/ppc/spapr_rtas.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++ - include/hw/ppc/spapr.h | 14 ++++ - 3 files changed, 198 insertions(+) - -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index 3fe98ff..8b21a71 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -1663,6 +1663,10 @@ static void ppc_spapr_init(MachineState *machine) - kernel_cmdline, spapr->epow_irq); - assert(spapr->fdt_skel != NULL); - -+ /* used by RTAS */ -+ QTAILQ_INIT(&spapr->ccs_list); -+ qemu_register_reset(spapr_ccs_reset_hook, spapr); -+ - qemu_register_boot_set(spapr_boot_set, spapr); - } - -diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c -index f80beb2..fa28d43 100644 ---- a/hw/ppc/spapr_rtas.c -+++ b/hw/ppc/spapr_rtas.c -@@ -47,6 +47,43 @@ - do { } while (0) - #endif - -+static sPAPRConfigureConnectorState *spapr_ccs_find(sPAPREnvironment *spapr, -+ uint32_t drc_index) -+{ -+ sPAPRConfigureConnectorState *ccs = NULL; -+ -+ QTAILQ_FOREACH(ccs, &spapr->ccs_list, next) { -+ if (ccs->drc_index == drc_index) { -+ break; -+ } -+ } -+ -+ return ccs; -+} -+ -+static void spapr_ccs_add(sPAPREnvironment *spapr, -+ sPAPRConfigureConnectorState *ccs) -+{ -+ g_assert(!spapr_ccs_find(spapr, ccs->drc_index)); -+ QTAILQ_INSERT_HEAD(&spapr->ccs_list, ccs, next); -+} -+ -+static void spapr_ccs_remove(sPAPREnvironment *spapr, -+ sPAPRConfigureConnectorState *ccs) -+{ -+ QTAILQ_REMOVE(&spapr->ccs_list, ccs, next); -+ g_free(ccs); -+} -+ -+void spapr_ccs_reset_hook(void *opaque) -+{ -+ sPAPREnvironment *spapr = opaque; -+ sPAPRConfigureConnectorState *ccs, *ccs_tmp; -+ -+ QTAILQ_FOREACH_SAFE(ccs, &spapr->ccs_list, next, ccs_tmp) { -+ spapr_ccs_remove(spapr, ccs); -+ } -+} - - static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr, - uint32_t token, uint32_t nargs, -@@ -355,6 +392,19 @@ static void rtas_set_indicator(PowerPCCPU *cpu, sPAPREnvironment *spapr, - - switch (sensor_type) { - case RTAS_SENSOR_TYPE_ISOLATION_STATE: -+ /* if the guest is configuring a device attached to this -+ * DRC, we should reset the configuration state at this -+ * point since it may no longer be reliable (guest released -+ * device and needs to start over, or unplug occurred so -+ * the FDT is no longer valid) -+ */ -+ if (sensor_state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { -+ sPAPRConfigureConnectorState *ccs = spapr_ccs_find(spapr, -+ sensor_index); -+ if (ccs) { -+ spapr_ccs_remove(spapr, ccs); -+ } -+ } - drck->set_isolation_state(drc, sensor_state); - break; - case RTAS_SENSOR_TYPE_DR: -@@ -418,6 +468,134 @@ static void rtas_get_sensor_state(PowerPCCPU *cpu, sPAPREnvironment *spapr, - rtas_st(rets, 1, entity_sense); - } - -+/* configure-connector work area offsets, int32_t units for field -+ * indexes, bytes for field offset/len values. -+ * -+ * as documented by PAPR+ v2.7, 13.5.3.5 -+ */ -+#define CC_IDX_NODE_NAME_OFFSET 2 -+#define CC_IDX_PROP_NAME_OFFSET 2 -+#define CC_IDX_PROP_LEN 3 -+#define CC_IDX_PROP_DATA_OFFSET 4 -+#define CC_VAL_DATA_OFFSET ((CC_IDX_PROP_DATA_OFFSET + 1) * 4) -+#define CC_WA_LEN 4096 -+ -+static void rtas_ibm_configure_connector(PowerPCCPU *cpu, -+ sPAPREnvironment *spapr, -+ uint32_t token, uint32_t nargs, -+ target_ulong args, uint32_t nret, -+ target_ulong rets) -+{ -+ uint64_t wa_addr; -+ uint64_t wa_offset; -+ uint32_t drc_index; -+ sPAPRDRConnector *drc; -+ sPAPRDRConnectorClass *drck; -+ sPAPRConfigureConnectorState *ccs; -+ sPAPRDRCCResponse resp = SPAPR_DR_CC_RESPONSE_CONTINUE; -+ int rc; -+ const void *fdt; -+ -+ if (nargs != 2 || nret != 1) { -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ -+ wa_addr = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 0); -+ -+ drc_index = rtas_ld(wa_addr, 0); -+ drc = spapr_dr_connector_by_index(drc_index); -+ if (!drc) { -+ DPRINTF("rtas_ibm_configure_connector: invalid DRC index: %xh\n", -+ drc_index); -+ rc = RTAS_OUT_PARAM_ERROR; -+ goto out; -+ } -+ -+ drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ fdt = drck->get_fdt(drc, NULL); -+ -+ ccs = spapr_ccs_find(spapr, drc_index); -+ if (!ccs) { -+ ccs = g_new0(sPAPRConfigureConnectorState, 1); -+ (void)drck->get_fdt(drc, &ccs->fdt_offset); -+ ccs->drc_index = drc_index; -+ spapr_ccs_add(spapr, ccs); -+ } -+ -+ do { -+ uint32_t tag; -+ const char *name; -+ const struct fdt_property *prop; -+ int fdt_offset_next, prop_len; -+ -+ tag = fdt_next_tag(fdt, ccs->fdt_offset, &fdt_offset_next); -+ -+ switch (tag) { -+ case FDT_BEGIN_NODE: -+ ccs->fdt_depth++; -+ name = fdt_get_name(fdt, ccs->fdt_offset, NULL); -+ -+ /* provide the name of the next OF node */ -+ wa_offset = CC_VAL_DATA_OFFSET; -+ rtas_st(wa_addr, CC_IDX_NODE_NAME_OFFSET, wa_offset); -+ rtas_st_buffer_direct(wa_addr + wa_offset, CC_WA_LEN - wa_offset, -+ (uint8_t *)name, strlen(name) + 1); -+ resp = SPAPR_DR_CC_RESPONSE_NEXT_CHILD; -+ break; -+ case FDT_END_NODE: -+ ccs->fdt_depth--; -+ if (ccs->fdt_depth == 0) { -+ /* done sending the device tree, don't need to track -+ * the state anymore -+ */ -+ drck->set_configured(drc); -+ spapr_ccs_remove(spapr, ccs); -+ ccs = NULL; -+ resp = SPAPR_DR_CC_RESPONSE_SUCCESS; -+ } else { -+ resp = SPAPR_DR_CC_RESPONSE_PREV_PARENT; -+ } -+ break; -+ case FDT_PROP: -+ prop = fdt_get_property_by_offset(fdt, ccs->fdt_offset, -+ &prop_len); -+ name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); -+ -+ /* provide the name of the next OF property */ -+ wa_offset = CC_VAL_DATA_OFFSET; -+ rtas_st(wa_addr, CC_IDX_PROP_NAME_OFFSET, wa_offset); -+ rtas_st_buffer_direct(wa_addr + wa_offset, CC_WA_LEN - wa_offset, -+ (uint8_t *)name, strlen(name) + 1); -+ -+ /* provide the length and value of the OF property. data gets -+ * placed immediately after NULL terminator of the OF property's -+ * name string -+ */ -+ wa_offset += strlen(name) + 1, -+ rtas_st(wa_addr, CC_IDX_PROP_LEN, prop_len); -+ rtas_st(wa_addr, CC_IDX_PROP_DATA_OFFSET, wa_offset); -+ rtas_st_buffer_direct(wa_addr + wa_offset, CC_WA_LEN - wa_offset, -+ (uint8_t *)((struct fdt_property *)prop)->data, -+ prop_len); -+ resp = SPAPR_DR_CC_RESPONSE_NEXT_PROPERTY; -+ break; -+ case FDT_END: -+ resp = SPAPR_DR_CC_RESPONSE_ERROR; -+ default: -+ /* keep seeking for an actionable tag */ -+ break; -+ } -+ if (ccs) { -+ ccs->fdt_offset = fdt_offset_next; -+ } -+ } while (resp == SPAPR_DR_CC_RESPONSE_CONTINUE); -+ -+ rc = resp; -+out: -+ rtas_st(rets, 0, rc); -+} -+ - static struct rtas_call { - const char *name; - spapr_rtas_fn fn; -@@ -551,6 +729,8 @@ static void core_rtas_register_types(void) - rtas_set_indicator); - spapr_rtas_register(RTAS_GET_SENSOR_STATE, "get-sensor-state", - rtas_get_sensor_state); -+ spapr_rtas_register(RTAS_IBM_CONFIGURE_CONNECTOR, "ibm,configure-connector", -+ rtas_ibm_configure_connector); - } - - type_init(core_rtas_register_types) -diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h -index 919eec6..673fd89 100644 ---- a/include/hw/ppc/spapr.h -+++ b/include/hw/ppc/spapr.h -@@ -7,6 +7,7 @@ - struct VIOsPAPRBus; - struct sPAPRPHBState; - struct sPAPRNVRAM; -+typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState; - - #define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL - -@@ -39,6 +40,9 @@ typedef struct sPAPREnvironment { - bool htab_first_pass; - int htab_fd; - bool htab_fd_stale; -+ -+ /* RTAS state */ -+ QTAILQ_HEAD(, sPAPRConfigureConnectorState) ccs_list; - } sPAPREnvironment; - - #define H_SUCCESS 0 -@@ -539,6 +543,16 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname, - sPAPRTCETable *tcet); - void spapr_pci_switch_vga(bool big_endian); - -+/* rtas-configure-connector state */ -+struct sPAPRConfigureConnectorState { -+ uint32_t drc_index; -+ int fdt_offset; -+ int fdt_depth; -+ QTAILQ_ENTRY(sPAPRConfigureConnectorState) next; -+}; -+ -+void spapr_ccs_reset_hook(void *opaque); -+ - #define TYPE_SPAPR_RTC "spapr-rtc" - - void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns); --- -1.8.3.1 - diff --git a/SOURCES/kvm-spapr_rtas-add-set-indicator-RTAS-interface.patch b/SOURCES/kvm-spapr_rtas-add-set-indicator-RTAS-interface.patch deleted file mode 100644 index 026acb6..0000000 --- a/SOURCES/kvm-spapr_rtas-add-set-indicator-RTAS-interface.patch +++ /dev/null @@ -1,170 +0,0 @@ -From b7e8eebea6f5137cf928fdee22e43faa841d2ebb Mon Sep 17 00:00:00 2001 -From: Laurent Vivier <lvivier@redhat.com> -Date: Thu, 25 Jun 2015 13:44:30 +0200 -Subject: [PATCH 091/217] spapr_rtas: add set-indicator RTAS interface - -Message-id: <1435239881-28541-4-git-send-email-lvivier@redhat.com> -Patchwork-id: 66482 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 03/14] spapr_rtas: add set-indicator RTAS interface -Bugzilla: 1172478 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Mike Day <ncmike@ncultra.org> - -This interface allows a guest to control various platform/device -sensors. Initially, we only implement support necessary to control -sensors that are required for hotplug: DR connector indicators/LEDs, -resource allocation state, and resource isolation state. - -See docs/specs/ppc-spapr-hotplug.txt for a complete description of -this interface. - -Signed-off-by: Mike Day <ncmike@ncultra.org> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: David Gibson <david@gibson.dropbear.id.au> -Signed-off-by: Alexander Graf <agraf@suse.de> -(cherry picked from commit 8c8639df32f19d5ca9bf6a823ac83e298a188fd1) -Signed-off-by: Laurent Vivier <lvivier@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/ppc/spapr_rtas.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ - include/hw/ppc/spapr.h | 11 +++++++ - 2 files changed, 95 insertions(+) - -diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c -index d7694cd..6c741fa 100644 ---- a/hw/ppc/spapr_rtas.c -+++ b/hw/ppc/spapr_rtas.c -@@ -35,6 +35,18 @@ - #include "qapi-event.h" - - #include <libfdt.h> -+#include "hw/ppc/spapr_drc.h" -+ -+/* #define DEBUG_SPAPR */ -+ -+#ifdef DEBUG_SPAPR -+#define DPRINTF(fmt, ...) \ -+ do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -+#else -+#define DPRINTF(fmt, ...) \ -+ do { } while (0) -+#endif -+ - - static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr, - uint32_t token, uint32_t nargs, -@@ -295,6 +307,76 @@ static void rtas_get_power_level(PowerPCCPU *cpu, sPAPREnvironment *spapr, - rtas_st(rets, 1, 100); - } - -+static bool sensor_type_is_dr(uint32_t sensor_type) -+{ -+ switch (sensor_type) { -+ case RTAS_SENSOR_TYPE_ISOLATION_STATE: -+ case RTAS_SENSOR_TYPE_DR: -+ case RTAS_SENSOR_TYPE_ALLOCATION_STATE: -+ return true; -+ } -+ -+ return false; -+} -+ -+static void rtas_set_indicator(PowerPCCPU *cpu, sPAPREnvironment *spapr, -+ uint32_t token, uint32_t nargs, -+ target_ulong args, uint32_t nret, -+ target_ulong rets) -+{ -+ uint32_t sensor_type; -+ uint32_t sensor_index; -+ uint32_t sensor_state; -+ sPAPRDRConnector *drc; -+ sPAPRDRConnectorClass *drck; -+ -+ if (nargs != 3 || nret != 1) { -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ -+ sensor_type = rtas_ld(args, 0); -+ sensor_index = rtas_ld(args, 1); -+ sensor_state = rtas_ld(args, 2); -+ -+ if (!sensor_type_is_dr(sensor_type)) { -+ goto out_unimplemented; -+ } -+ -+ /* if this is a DR sensor we can assume sensor_index == drc_index */ -+ drc = spapr_dr_connector_by_index(sensor_index); -+ if (!drc) { -+ DPRINTF("rtas_set_indicator: invalid sensor/DRC index: %xh\n", -+ sensor_index); -+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); -+ return; -+ } -+ drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); -+ -+ switch (sensor_type) { -+ case RTAS_SENSOR_TYPE_ISOLATION_STATE: -+ drck->set_isolation_state(drc, sensor_state); -+ break; -+ case RTAS_SENSOR_TYPE_DR: -+ drck->set_indicator_state(drc, sensor_state); -+ break; -+ case RTAS_SENSOR_TYPE_ALLOCATION_STATE: -+ drck->set_allocation_state(drc, sensor_state); -+ break; -+ default: -+ goto out_unimplemented; -+ } -+ -+ rtas_st(rets, 0, RTAS_OUT_SUCCESS); -+ return; -+ -+out_unimplemented: -+ /* currently only DR-related sensors are implemented */ -+ DPRINTF("rtas_set_indicator: sensor/indicator not implemented: %d\n", -+ sensor_type); -+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); -+} -+ - static struct rtas_call { - const char *name; - spapr_rtas_fn fn; -@@ -424,6 +506,8 @@ static void core_rtas_register_types(void) - rtas_set_power_level); - spapr_rtas_register(RTAS_GET_POWER_LEVEL, "get-power-level", - rtas_get_power_level); -+ spapr_rtas_register(RTAS_SET_INDICATOR, "set-indicator", -+ rtas_set_indicator); - } - - type_init(core_rtas_register_types) -diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h -index af71e8b..a13e777 100644 ---- a/include/hw/ppc/spapr.h -+++ b/include/hw/ppc/spapr.h -@@ -430,6 +430,17 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi); - #define RTAS_SYSPARM_DIAGNOSTICS_RUN_MODE 42 - #define RTAS_SYSPARM_UUID 48 - -+/* RTAS indicator/sensor types -+ * -+ * as defined by PAPR+ 2.7 7.3.5.4, Table 41 -+ * -+ * NOTE: currently only DR-related sensors are implemented here -+ */ -+#define RTAS_SENSOR_TYPE_ISOLATION_STATE 9001 -+#define RTAS_SENSOR_TYPE_DR 9002 -+#define RTAS_SENSOR_TYPE_ALLOCATION_STATE 9003 -+#define RTAS_SENSOR_TYPE_ENTITY_SENSE RTAS_SENSOR_TYPE_ALLOCATION_STATE -+ - /* Possible values for the platform-processor-diagnostics-run-mode parameter - * of the RTAS ibm,get-system-parameter call. - */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-spice-display-fix-segfault-in-qemu_spice_create_upda.patch b/SOURCES/kvm-spice-display-fix-segfault-in-qemu_spice_create_upda.patch deleted file mode 100644 index 3c4856e..0000000 --- a/SOURCES/kvm-spice-display-fix-segfault-in-qemu_spice_create_upda.patch +++ /dev/null @@ -1,61 +0,0 @@ -From db3973feb420415da46859464436245bff4cd584 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Thu, 11 Jun 2015 15:27:44 +0200 -Subject: [PATCH 009/217] spice-display: fix segfault in - qemu_spice_create_update - -Message-id: <1434036464-9660-2-git-send-email-kraxel@redhat.com> -Patchwork-id: 65860 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH v2 1/1] spice-display: fix segfault in qemu_spice_create_update -Bugzilla: 1230550 -RH-Acked-by: Bandan Das <bsd@redhat.com> -RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Although it is pretty unusual the stride for the guest image and the -mirror image maintained by spice-display can be different. So use -separate variables for them. - -Cc: qemu-stable@nongnu.org -Reported-by: perrier vincent <clownix@clownix.net> -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit c6e484707f28b3e115e64122a0570f6b3c585489) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - ui/spice-display.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/ui/spice-display.c b/ui/spice-display.c -index 1644185..5935564 100644 ---- a/ui/spice-display.c -+++ b/ui/spice-display.c -@@ -199,7 +199,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) - static const int blksize = 32; - int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize; - int dirty_top[blocks]; -- int y, yoff, x, xoff, blk, bw; -+ int y, yoff1, yoff2, x, xoff, blk, bw; - int bpp = surface_bytes_per_pixel(ssd->ds); - uint8_t *guest, *mirror; - -@@ -214,13 +214,14 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) - guest = surface_data(ssd->ds); - mirror = (void *)pixman_image_get_data(ssd->mirror); - for (y = ssd->dirty.top; y < ssd->dirty.bottom; y++) { -- yoff = y * surface_stride(ssd->ds); -+ yoff1 = y * surface_stride(ssd->ds); -+ yoff2 = y * pixman_image_get_stride(ssd->mirror); - for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) { - xoff = x * bpp; - blk = x / blksize; - bw = MIN(blksize, ssd->dirty.right - x); -- if (memcmp(guest + yoff + xoff, -- mirror + yoff + xoff, -+ if (memcmp(guest + yoff1 + xoff, -+ mirror + yoff2 + xoff, - bw * bpp) == 0) { - if (dirty_top[blk] != -1) { - QXLRect update = { --- -1.8.3.1 - diff --git a/SOURCES/kvm-tap-add-VNET_LE-VNET_BE-operations.patch b/SOURCES/kvm-tap-add-VNET_LE-VNET_BE-operations.patch deleted file mode 100644 index 8615d4d..0000000 --- a/SOURCES/kvm-tap-add-VNET_LE-VNET_BE-operations.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 397e3c632a926587820d61683541a948b1ee98f1 Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:36 +0200 -Subject: [PATCH 112/217] tap: add VNET_LE/VNET_BE operations - -Message-id: <1435950819-10991-5-git-send-email-thuth@redhat.com> -Patchwork-id: 66697 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 4/7] tap: add VNET_LE/VNET_BE operations -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Greg Kurz <gkurz@linux.vnet.ibm.com> - -The linux tap and macvtap backends can be told to parse vnet headers -according to little or big endian. This is done through the TUNSETVNETLE -and TUNSETVNETBE ioctls. - -This patch brings all the plumbing for QEMU to use these APIs. - -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit c80cd6bb9c20ef518c56319ce44d2971171e677d) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/net/net.h | 6 ++++++ - net/net.c | 18 ++++++++++++++++++ - net/tap-linux.c | 34 ++++++++++++++++++++++++++++++++++ - net/tap-linux.h | 2 ++ - net/tap.c | 16 ++++++++++++++++ - net/tap_int.h | 2 ++ - 6 files changed, 78 insertions(+) - -diff --git a/include/net/net.h b/include/net/net.h -index 50ffcb9..86f57f7 100644 ---- a/include/net/net.h -+++ b/include/net/net.h -@@ -55,6 +55,8 @@ typedef bool (HasVnetHdrLen)(NetClientState *, int); - typedef void (UsingVnetHdr)(NetClientState *, bool); - typedef void (SetOffload)(NetClientState *, int, int, int, int, int); - typedef void (SetVnetHdrLen)(NetClientState *, int); -+typedef int (SetVnetLE)(NetClientState *, bool); -+typedef int (SetVnetBE)(NetClientState *, bool); - - typedef struct NetClientInfo { - NetClientOptionsKind type; -@@ -73,6 +75,8 @@ typedef struct NetClientInfo { - UsingVnetHdr *using_vnet_hdr; - SetOffload *set_offload; - SetVnetHdrLen *set_vnet_hdr_len; -+ SetVnetLE *set_vnet_le; -+ SetVnetBE *set_vnet_be; - } NetClientInfo; - - struct NetClientState { -@@ -138,6 +142,8 @@ void qemu_using_vnet_hdr(NetClientState *nc, bool enable); - void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6, - int ecn, int ufo); - void qemu_set_vnet_hdr_len(NetClientState *nc, int len); -+int qemu_set_vnet_le(NetClientState *nc, bool is_le); -+int qemu_set_vnet_be(NetClientState *nc, bool is_be); - void qemu_macaddr_default_if_unset(MACAddr *macaddr); - int qemu_show_nic_models(const char *arg, const char *const *models); - void qemu_check_nic_model(NICInfo *nd, const char *model); -diff --git a/net/net.c b/net/net.c -index 0be084d..eb8ef3e 100644 ---- a/net/net.c -+++ b/net/net.c -@@ -452,6 +452,24 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) - nc->info->set_vnet_hdr_len(nc, len); - } - -+int qemu_set_vnet_le(NetClientState *nc, bool is_le) -+{ -+ if (!nc || !nc->info->set_vnet_le) { -+ return -ENOSYS; -+ } -+ -+ return nc->info->set_vnet_le(nc, is_le); -+} -+ -+int qemu_set_vnet_be(NetClientState *nc, bool is_be) -+{ -+ if (!nc || !nc->info->set_vnet_be) { -+ return -ENOSYS; -+ } -+ -+ return nc->info->set_vnet_be(nc, is_be); -+} -+ - int qemu_can_send_packet(NetClientState *sender) - { - int vm_running = runstate_is_running(); -diff --git a/net/tap-linux.c b/net/tap-linux.c -index 812bf2d..15b57a7 100644 ---- a/net/tap-linux.c -+++ b/net/tap-linux.c -@@ -198,6 +198,40 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) - } - } - -+int tap_fd_set_vnet_le(int fd, int is_le) -+{ -+ int arg = is_le ? 1 : 0; -+ -+ if (!ioctl(fd, TUNSETVNETLE, &arg)) { -+ return 0; -+ } -+ -+ /* Check if our kernel supports TUNSETVNETLE */ -+ if (errno == EINVAL) { -+ return -errno; -+ } -+ -+ error_report("TUNSETVNETLE ioctl() failed: %s.\n", strerror(errno)); -+ abort(); -+} -+ -+int tap_fd_set_vnet_be(int fd, int is_be) -+{ -+ int arg = is_be ? 1 : 0; -+ -+ if (!ioctl(fd, TUNSETVNETBE, &arg)) { -+ return 0; -+ } -+ -+ /* Check if our kernel supports TUNSETVNETBE */ -+ if (errno == EINVAL) { -+ return -errno; -+ } -+ -+ error_report("TUNSETVNETBE ioctl() failed: %s.\n", strerror(errno)); -+ abort(); -+} -+ - void tap_fd_set_offload(int fd, int csum, int tso4, - int tso6, int ecn, int ufo) - { -diff --git a/net/tap-linux.h b/net/tap-linux.h -index 1cf35d4..01dc6f8 100644 ---- a/net/tap-linux.h -+++ b/net/tap-linux.h -@@ -30,6 +30,8 @@ - #define TUNGETVNETHDRSZ _IOR('T', 215, int) - #define TUNSETVNETHDRSZ _IOW('T', 216, int) - #define TUNSETQUEUE _IOW('T', 217, int) -+#define TUNSETVNETLE _IOW('T', 220, int) -+#define TUNSETVNETBE _IOW('T', 222, int) - - #endif - -diff --git a/net/tap.c b/net/tap.c -index 968df46..c6f9a7d 100644 ---- a/net/tap.c -+++ b/net/tap.c -@@ -274,6 +274,20 @@ static void tap_using_vnet_hdr(NetClientState *nc, bool using_vnet_hdr) - s->using_vnet_hdr = using_vnet_hdr; - } - -+static int tap_set_vnet_le(NetClientState *nc, bool is_le) -+{ -+ TAPState *s = DO_UPCAST(TAPState, nc, nc); -+ -+ return tap_fd_set_vnet_le(s->fd, is_le); -+} -+ -+static int tap_set_vnet_be(NetClientState *nc, bool is_be) -+{ -+ TAPState *s = DO_UPCAST(TAPState, nc, nc); -+ -+ return tap_fd_set_vnet_be(s->fd, is_be); -+} -+ - static void tap_set_offload(NetClientState *nc, int csum, int tso4, - int tso6, int ecn, int ufo) - { -@@ -335,6 +349,8 @@ static NetClientInfo net_tap_info = { - .using_vnet_hdr = tap_using_vnet_hdr, - .set_offload = tap_set_offload, - .set_vnet_hdr_len = tap_set_vnet_hdr_len, -+ .set_vnet_le = tap_set_vnet_le, -+ .set_vnet_be = tap_set_vnet_be, - }; - - static TAPState *net_tap_fd_init(NetClientState *peer, -diff --git a/net/tap_int.h b/net/tap_int.h -index 79afdf2..5cb79fc 100644 ---- a/net/tap_int.h -+++ b/net/tap_int.h -@@ -40,6 +40,8 @@ int tap_probe_vnet_hdr_len(int fd, int len); - int tap_probe_has_ufo(int fd); - void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo); - void tap_fd_set_vnet_hdr_len(int fd, int len); -+int tap_fd_set_vnet_le(int fd, int vnet_is_le); -+int tap_fd_set_vnet_be(int fd, int vnet_is_be); - int tap_fd_enable(int fd); - int tap_fd_disable(int fd); - int tap_fd_get_ifname(int fd, char *ifname); --- -1.8.3.1 - diff --git a/SOURCES/kvm-tap-fix-non-linux-build.patch b/SOURCES/kvm-tap-fix-non-linux-build.patch deleted file mode 100644 index d8d4aeb..0000000 --- a/SOURCES/kvm-tap-fix-non-linux-build.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 278728d37c595d2058b76e09f5e9369123892d0b Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:37 +0200 -Subject: [PATCH 113/217] tap: fix non-linux build - -Message-id: <1435950819-10991-6-git-send-email-thuth@redhat.com> -Patchwork-id: 66699 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 5/7] tap: fix non-linux build -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -tap_fd_set_vnet_le/tap_fd_set_vnet_be was missing, -fix it up. - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Thomas Huth <thuth@redhat.com> -Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -(cherry picked from commit 4ee9b43be9a6e4ae161a1e6322bfef90818589f6) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - net/tap-aix.c | 10 ++++++++++ - net/tap-bsd.c | 10 ++++++++++ - net/tap-haiku.c | 10 ++++++++++ - net/tap-solaris.c | 10 ++++++++++ - net/tap-win32.c | 10 ++++++++++ - 5 files changed, 50 insertions(+) - -diff --git a/net/tap-aix.c b/net/tap-aix.c -index 804d164..3e7f3fb 100644 ---- a/net/tap-aix.c -+++ b/net/tap-aix.c -@@ -56,6 +56,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) - { - } - -+int tap_fd_set_vnet_le(int fd, int is_le) -+{ -+ return -EINVAL; -+} -+ -+int tap_fd_set_vnet_be(int fd, int is_be) -+{ -+ return -EINVAL; -+} -+ - void tap_fd_set_offload(int fd, int csum, int tso4, - int tso6, int ecn, int ufo) - { -diff --git a/net/tap-bsd.c b/net/tap-bsd.c -index bf91bd0..452e01a 100644 ---- a/net/tap-bsd.c -+++ b/net/tap-bsd.c -@@ -200,6 +200,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) - { - } - -+int tap_fd_set_vnet_le(int fd, int is_le) -+{ -+ return -EINVAL; -+} -+ -+int tap_fd_set_vnet_be(int fd, int is_be) -+{ -+ return -EINVAL; -+} -+ - void tap_fd_set_offload(int fd, int csum, int tso4, - int tso6, int ecn, int ufo) - { -diff --git a/net/tap-haiku.c b/net/tap-haiku.c -index e5ce436..57d9e3c 100644 ---- a/net/tap-haiku.c -+++ b/net/tap-haiku.c -@@ -56,6 +56,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) - { - } - -+int tap_fd_set_vnet_le(int fd, int is_le) -+{ -+ return -EINVAL; -+} -+ -+int tap_fd_set_vnet_be(int fd, int is_be) -+{ -+ return -EINVAL; -+} -+ - void tap_fd_set_offload(int fd, int csum, int tso4, - int tso6, int ecn, int ufo) - { -diff --git a/net/tap-solaris.c b/net/tap-solaris.c -index 9c7278f..04ac584 100644 ---- a/net/tap-solaris.c -+++ b/net/tap-solaris.c -@@ -222,6 +222,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) - { - } - -+int tap_fd_set_vnet_le(int fd, int is_le) -+{ -+ return -EINVAL; -+} -+ -+int tap_fd_set_vnet_be(int fd, int is_be) -+{ -+ return -EINVAL; -+} -+ - void tap_fd_set_offload(int fd, int csum, int tso4, - int tso6, int ecn, int ufo) - { -diff --git a/net/tap-win32.c b/net/tap-win32.c -index 8aee611..e7ad386 100644 ---- a/net/tap-win32.c -+++ b/net/tap-win32.c -@@ -688,6 +688,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) - { - } - -+int tap_fd_set_vnet_le(int fd, int is_le) -+{ -+ return -EINVAL; -+} -+ -+int tap_fd_set_vnet_be(int fd, int is_be) -+{ -+ return -EINVAL; -+} -+ - static void tap_using_vnet_hdr(NetClientState *nc, bool using_vnet_hdr) - { - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bridge.patch b/SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bridge.patch deleted file mode 100644 index cabec05..0000000 --- a/SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bridge.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -423,6 +423,10 @@ endif - $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ - done - $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events" -+ $(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 ---- /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 ---- /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 {} diff --git a/SOURCES/kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch b/SOURCES/kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch deleted file mode 100644 index 43a3432..0000000 --- a/SOURCES/kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- /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/SOURCES/kvm-vfio-cap-number-of-devices-that-can-be-assigned.patch b/SOURCES/kvm-vfio-cap-number-of-devices-that-can-be-assigned.patch deleted file mode 100644 index 521ffbb..0000000 --- a/SOURCES/kvm-vfio-cap-number-of-devices-that-can-be-assigned.patch +++ /dev/null @@ -1,59 +0,0 @@ -From f5252bbf663079c7500bb6c16fa1a85db854a8d3 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> - -diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c -index 6b80539..62fcb3d 100644 ---- a/hw/vfio/pci.c -+++ b/hw/vfio/pci.c -@@ -193,6 +193,7 @@ static const VFIORomBlacklistEntry romblacklist[] = { - }; - - #define MSIX_CAP_LENGTH 12 -+#define MAX_DEV_ASSIGN_CMDLINE 32 - - static void vfio_disable_interrupts(VFIOPCIDevice *vdev); - static uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len); -@@ -3328,7 +3329,19 @@ static int vfio_initfn(PCIDevice *pdev) - ssize_t len; - struct stat st; - int groupid; -- int 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_report("vfio: Maximum supported vfio devices (%d) " -+ "already attached\n", MAX_DEV_ASSIGN_CMDLINE); -+ return -1; -+ } - - /* Check that the host device exists */ - snprintf(path, sizeof(path), diff --git a/SOURCES/kvm-vfio-pci-Fix-error-path-sign.patch b/SOURCES/kvm-vfio-pci-Fix-error-path-sign.patch deleted file mode 100644 index 7d6f39c..0000000 --- a/SOURCES/kvm-vfio-pci-Fix-error-path-sign.patch +++ /dev/null @@ -1,47 +0,0 @@ -From ff607db7a3a72923a48a7fdcb1f2d1f80561c49e Mon Sep 17 00:00:00 2001 -From: Alex Williamson <alex.williamson@redhat.com> -Date: Mon, 22 Jun 2015 16:42:46 +0200 -Subject: [PATCH 038/217] vfio-pci: Fix error path sign - -Message-id: <20150622164246.23137.52840.stgit@gimli.home> -Patchwork-id: 66349 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 1/2] vfio-pci: Fix error path sign -Bugzilla: 1219090 -RH-Acked-by: Bandan Das <bsd@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -This is an impossible error path due to the fact that we're reading a -kernel provided, rather than user provided link, which will certainly -always fit in PATH_MAX. Currently it returns a fixed 26 char path -plus %d group number, which typically maxes out at double digits. -However, the caller of the initfn certainly expects a less-than zero -return value on error, not just a non-zero value. Therefore we -should correct the sign here. - -Upstream: c6d231e2fd3773ef9a566ca24962f2314cb78f73 - -Reported-by: Laszlo Ersek <lersek@redhat.com> -Reviewed-by: Laszlo Ersek <lersek@redhat.com> -Signed-off-by: Alex Williamson <alex.williamson@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/vfio/pci.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c -index 62fcb3d..3df2bbe 100644 ---- a/hw/vfio/pci.c -+++ b/hw/vfio/pci.c -@@ -3365,7 +3365,7 @@ static int vfio_initfn(PCIDevice *pdev) - len = readlink(path, iommu_group_path, sizeof(path)); - if (len <= 0 || len >= sizeof(path)) { - error_report("vfio: error no iommu_group for device"); -- return len < 0 ? -errno : ENAMETOOLONG; -+ return len < 0 ? -errno : -ENAMETOOLONG; - } - - iommu_group_path[len] = 0; --- -1.8.3.1 - diff --git a/SOURCES/kvm-vfio-pci-Further-fix-BAR-size-overflow.patch b/SOURCES/kvm-vfio-pci-Further-fix-BAR-size-overflow.patch deleted file mode 100644 index d45192f..0000000 --- a/SOURCES/kvm-vfio-pci-Further-fix-BAR-size-overflow.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 414af41ecbcf3120f5d993ded3d111d08f42906e Mon Sep 17 00:00:00 2001 -From: Alex Williamson <alex.williamson@redhat.com> -Date: Mon, 22 Jun 2015 16:42:52 +0200 -Subject: [PATCH 039/217] vfio-pci: Further fix BAR size overflow - -Message-id: <20150622164251.23137.74252.stgit@gimli.home> -Patchwork-id: 66348 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 2/2] vfio-pci: Further fix BAR size overflow -Bugzilla: 1219090 -RH-Acked-by: Bandan Das <bsd@redhat.com> -RH-Acked-by: Andrew Jones <drjones@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -In an analysis by Laszlo, the resulting type of our calculation for -the end of the MSI-X table, and thus the start of memory after the -table, is uint32_t. We're therefore not correctly preventing the -corner case overflow that we intended to fix here where a BAR >=4G -could place the MSI-X table to end exactly at the 4G boundary. The -MSI-X table offset is defined by the hardware spec to 32bits, so we -simply use a cast rather than changing data structure types. This -scenario is purely theoretically, typically the MSI-X table is located -at the front of the BAR. - -Upstream: 07ceaf98800519ef9c5dc893af00f1fe1f9144e4 - -Reported-by: Laszlo Ersek <lersek@redhat.com> -Reviewed-by: Laszlo Ersek <lersek@redhat.com> -Signed-off-by: Alex Williamson <alex.williamson@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/vfio/pci.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c -index 3df2bbe..0ec51e2 100644 ---- a/hw/vfio/pci.c -+++ b/hw/vfio/pci.c -@@ -2395,7 +2395,7 @@ static void vfio_map_bar(VFIOPCIDevice *vdev, int nr) - if (vdev->msix && vdev->msix->table_bar == nr) { - uint64_t start; - -- start = HOST_PAGE_ALIGN(vdev->msix->table_offset + -+ start = HOST_PAGE_ALIGN((uint64_t)vdev->msix->table_offset + - (vdev->msix->entries * PCI_MSIX_ENTRY_SIZE)); - - size = start < bar->region.size ? bar->region.size - start : 0; --- -1.8.3.1 - diff --git a/SOURCES/kvm-vhost-64-bit-features.patch b/SOURCES/kvm-vhost-64-bit-features.patch deleted file mode 100644 index fefda10..0000000 --- a/SOURCES/kvm-vhost-64-bit-features.patch +++ /dev/null @@ -1,172 +0,0 @@ -From cc8f130bf91e395aeed11298bedfa704382a51b3 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:36 +0200 -Subject: [PATCH 148/217] vhost: 64 bit features - -Message-id: <1436260751-25015-34-git-send-email-jasowang@redhat.com> -Patchwork-id: 66808 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 33/68] vhost: 64 bit features -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Make sure that all vhost interfaces use 64 bit features, as the virtio -core does, and make sure to use ULL everywhere possible to be on the -safe side. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 9a2ba82302bea7faf3b9579f9168b89c73ae34ad) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/vhost_net.c | 12 ++++++------ - hw/virtio/vhost.c | 14 +++++++------- - include/hw/virtio/vhost.h | 6 +++--- - include/net/vhost_net.h | 4 ++-- - 4 files changed, 18 insertions(+), 18 deletions(-) - -diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c -index 760f4fc..f98653a 100644 ---- a/hw/net/vhost_net.c -+++ b/hw/net/vhost_net.c -@@ -110,13 +110,13 @@ static const int *vhost_net_get_feature_bits(struct vhost_net *net) - return feature_bits; - } - --unsigned vhost_net_get_features(struct vhost_net *net, unsigned features) -+uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features) - { - return vhost_get_features(&net->dev, vhost_net_get_feature_bits(net), - features); - } - --void vhost_net_ack_features(struct vhost_net *net, unsigned features) -+void vhost_net_ack_features(struct vhost_net *net, uint64_t features) - { - net->dev.acked_features = net->dev.backend_features; - vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features); -@@ -150,7 +150,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) - goto fail; - } - net->dev.backend_features = qemu_has_vnet_hdr(options->net_backend) -- ? 0 : (1 << VHOST_NET_F_VIRTIO_NET_HDR); -+ ? 0 : (1ULL << VHOST_NET_F_VIRTIO_NET_HDR); - net->backend = r; - } else { - net->dev.backend_features = 0; -@@ -169,7 +169,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) - if (backend_kernel) { - if (!qemu_has_vnet_hdr_len(options->net_backend, - sizeof(struct virtio_net_hdr_mrg_rxbuf))) { -- net->dev.features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF); -+ net->dev.features &= ~(1ULL << VIRTIO_NET_F_MRG_RXBUF); - } - if (~net->dev.features & net->dev.backend_features) { - fprintf(stderr, "vhost lacks feature mask %" PRIu64 -@@ -437,11 +437,11 @@ void vhost_net_cleanup(struct vhost_net *net) - { - } - --unsigned vhost_net_get_features(struct vhost_net *net, unsigned features) -+uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features) - { - return features; - } --void vhost_net_ack_features(struct vhost_net *net, unsigned features) -+void vhost_net_ack_features(struct vhost_net *net, uint64_t features) - { - } - -diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c -index 1d7b939..9b492d4 100644 ---- a/hw/virtio/vhost.c -+++ b/hw/virtio/vhost.c -@@ -553,7 +553,7 @@ static int vhost_dev_set_features(struct vhost_dev *dev, bool enable_log) - uint64_t features = dev->acked_features; - int r; - if (enable_log) { -- features |= 0x1 << VHOST_F_LOG_ALL; -+ features |= 0x1ULL << VHOST_F_LOG_ALL; - } - r = dev->vhost_ops->vhost_call(dev, VHOST_SET_FEATURES, &features); - return r < 0 ? -errno : 0; -@@ -908,7 +908,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, - .priority = 10 - }; - hdev->migration_blocker = NULL; -- if (!(hdev->features & (0x1 << VHOST_F_LOG_ALL))) { -+ if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { - error_setg(&hdev->migration_blocker, - "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."); - migrate_add_blocker(hdev->migration_blocker); -@@ -1051,12 +1051,12 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n, - assert(r >= 0); - } - --unsigned vhost_get_features(struct vhost_dev *hdev, const int *feature_bits, -- unsigned features) -+uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits, -+ uint64_t features) - { - const int *bit = feature_bits; - while (*bit != VHOST_INVALID_FEATURE_BIT) { -- unsigned bit_mask = (1 << *bit); -+ uint64_t bit_mask = (1ULL << *bit); - if (!(hdev->features & bit_mask)) { - features &= ~bit_mask; - } -@@ -1066,11 +1066,11 @@ unsigned vhost_get_features(struct vhost_dev *hdev, const int *feature_bits, - } - - void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits, -- unsigned features) -+ uint64_t features) - { - const int *bit = feature_bits; - while (*bit != VHOST_INVALID_FEATURE_BIT) { -- unsigned bit_mask = (1 << *bit); -+ uint64_t bit_mask = (1ULL << *bit); - if (features & bit_mask) { - hdev->acked_features |= bit_mask; - } -diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h -index 8f04888..88e1e56 100644 ---- a/include/hw/virtio/vhost.h -+++ b/include/hw/virtio/vhost.h -@@ -72,8 +72,8 @@ bool vhost_virtqueue_pending(struct vhost_dev *hdev, int n); - */ - void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n, - bool mask); --unsigned vhost_get_features(struct vhost_dev *hdev, const int *feature_bits, -- unsigned features); -+uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits, -+ uint64_t features); - void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits, -- unsigned features); -+ uint64_t features); - #endif -diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h -index b1c18a3..9eb493e 100644 ---- a/include/net/vhost_net.h -+++ b/include/net/vhost_net.h -@@ -22,8 +22,8 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, int total_queues); - - void vhost_net_cleanup(VHostNetState *net); - --unsigned vhost_net_get_features(VHostNetState *net, unsigned features); --void vhost_net_ack_features(VHostNetState *net, unsigned features); -+uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features); -+void vhost_net_ack_features(VHostNetState *net, uint64_t features); - - bool vhost_net_virtqueue_pending(VHostNetState *net, int n); - void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, --- -1.8.3.1 - diff --git a/SOURCES/kvm-vhost-net-tell-tap-backend-about-the-vnet-endianness.patch b/SOURCES/kvm-vhost-net-tell-tap-backend-about-the-vnet-endianness.patch deleted file mode 100644 index 327922d..0000000 --- a/SOURCES/kvm-vhost-net-tell-tap-backend-about-the-vnet-endianness.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 25f89bc40797c73021edc288c0777e9e90d099e5 Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:38 +0200 -Subject: [PATCH 114/217] vhost-net: tell tap backend about the vnet endianness - -Message-id: <1435950819-10991-7-git-send-email-thuth@redhat.com> -Patchwork-id: 66698 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 6/7] vhost-net: tell tap backend about the vnet endianness -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Greg Kurz <gkurz@linux.vnet.ibm.com> - -The default behaviour for TAP/MACVTAP is to consider vnet as native endian. - -This patch handles the cases when this is not true: -- virtio 1.0: always little-endian -- legacy cross-endian - -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/vhost_net.c | 33 ++++++++++++++++++++++++++++++++- - 1 file changed, 32 insertions(+), 1 deletion(-) - -diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c -index cf23335..1884e59 100644 ---- a/hw/net/vhost_net.c -+++ b/hw/net/vhost_net.c -@@ -38,6 +38,7 @@ - #include "standard-headers/linux/virtio_ring.h" - #include "hw/virtio/vhost.h" - #include "hw/virtio/virtio-bus.h" -+#include "hw/virtio/virtio-access.h" - - struct vhost_net { - struct vhost_dev dev; -@@ -194,6 +195,27 @@ static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index) - net->dev.vq_index = vq_index; - } - -+static int vhost_net_set_vnet_endian(VirtIODevice *dev, NetClientState *peer, -+ bool set) -+{ -+ int r = 0; -+ -+ if (virtio_has_feature(dev, VIRTIO_F_VERSION_1) || -+ (virtio_legacy_is_cross_endian(dev) && !virtio_is_big_endian(dev))) { -+ r = qemu_set_vnet_le(peer, set); -+ if (r) { -+ error_report("backend does not support LE vnet headers"); -+ } -+ } else if (virtio_legacy_is_cross_endian(dev)) { -+ r = qemu_set_vnet_be(peer, set); -+ if (r) { -+ error_report("backend does not support BE vnet headers"); -+ } -+ } -+ -+ return r; -+} -+ - static int vhost_net_start_one(struct vhost_net *net, - VirtIODevice *dev) - { -@@ -304,6 +326,11 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, - goto err; - } - -+ r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true); -+ if (r < 0) { -+ goto err; -+ } -+ - for (i = 0; i < total_queues; i++) { - vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2); - } -@@ -311,7 +338,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, - r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true); - if (r < 0) { - error_report("Error binding guest notifier: %d", -r); -- goto err; -+ goto err_endian; - } - - for (i = 0; i < total_queues; i++) { -@@ -333,6 +360,8 @@ err_start: - fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e); - fflush(stderr); - } -+err_endian: -+ vhost_net_set_vnet_endian(dev, ncs[0].peer, false); - err: - return r; - } -@@ -355,6 +384,8 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, - fflush(stderr); - } - assert(r >= 0); -+ -+ assert(vhost_net_set_vnet_endian(dev, ncs[0].peer, false) >= 0); - } - - void vhost_net_cleanup(struct vhost_net *net) --- -1.8.3.1 - diff --git a/SOURCES/kvm-vhost-scsi-move-qdev-properties-into-vhost-scsi.c.patch b/SOURCES/kvm-vhost-scsi-move-qdev-properties-into-vhost-scsi.c.patch deleted file mode 100644 index cb3842e..0000000 --- a/SOURCES/kvm-vhost-scsi-move-qdev-properties-into-vhost-scsi.c.patch +++ /dev/null @@ -1,74 +0,0 @@ -From c8bb6059810cc5f64ca13bbe16e9054ce1ae66e3 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:05 +0200 -Subject: [PATCH 177/217] vhost-scsi: move qdev properties into vhost-scsi.c - -Message-id: <1436260751-25015-63-git-send-email-jasowang@redhat.com> -Patchwork-id: 66837 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 62/68] vhost-scsi: move qdev properties into vhost-scsi.c -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -As only one place in vhost-scsi.c uses DEFINE_VHOST_SCSI_PROPERTIES, -there is no need to expose it. Inline it into vhost-scsi.c to avoid -wrongly use. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 21549a4642e1f1b438ffc31dd9dc35f134b10e5b) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/scsi/vhost-scsi.c | 9 ++++++++- - include/hw/virtio/vhost-scsi.h | 9 --------- - 2 files changed, 8 insertions(+), 10 deletions(-) - -diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c -index 9c76486..1941aa1 100644 ---- a/hw/scsi/vhost-scsi.c -+++ b/hw/scsi/vhost-scsi.c -@@ -294,7 +294,14 @@ static char *vhost_scsi_get_fw_dev_path(FWPathProvider *p, BusState *bus, - } - - static Property vhost_scsi_properties[] = { -- DEFINE_VHOST_SCSI_PROPERTIES(VHostSCSI, parent_obj.conf), -+ DEFINE_PROP_STRING("vhostfd", VHostSCSI, parent_obj.conf.vhostfd), -+ DEFINE_PROP_STRING("wwpn", VHostSCSI, parent_obj.conf.wwpn), -+ DEFINE_PROP_UINT32("boot_tpgt", VHostSCSI, parent_obj.conf.boot_tpgt, 0), -+ DEFINE_PROP_UINT32("num_queues", VHostSCSI, parent_obj.conf.num_queues, 1), -+ DEFINE_PROP_UINT32("max_sectors", VHostSCSI, parent_obj.conf.max_sectors, -+ 0xFFFF), -+ DEFINE_PROP_UINT32("cmd_per_lun", VHostSCSI, parent_obj.conf.cmd_per_lun, -+ 128), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/virtio/vhost-scsi.h b/include/hw/virtio/vhost-scsi.h -index dea0075..701bfee 100644 ---- a/include/hw/virtio/vhost-scsi.h -+++ b/include/hw/virtio/vhost-scsi.h -@@ -66,13 +66,4 @@ typedef struct VHostSCSI { - int lun; - } VHostSCSI; - --#define DEFINE_VHOST_SCSI_PROPERTIES(_state, _conf_field) \ -- DEFINE_PROP_STRING("vhostfd", _state, _conf_field.vhostfd), \ -- DEFINE_PROP_STRING("wwpn", _state, _conf_field.wwpn), \ -- DEFINE_PROP_UINT32("boot_tpgt", _state, _conf_field.boot_tpgt, 0), \ -- DEFINE_PROP_UINT32("num_queues", _state, _conf_field.num_queues, 1), \ -- DEFINE_PROP_UINT32("max_sectors", _state, _conf_field.max_sectors, 0xFFFF), \ -- DEFINE_PROP_UINT32("cmd_per_lun", _state, _conf_field.cmd_per_lun, 128) -- -- - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-vhost-set-vring-endianness-for-legacy-virtio.patch b/SOURCES/kvm-vhost-set-vring-endianness-for-legacy-virtio.patch deleted file mode 100644 index eb5aac3..0000000 --- a/SOURCES/kvm-vhost-set-vring-endianness-for-legacy-virtio.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 89b170d39328a86a293d13a6351d3ce0959bd4c4 Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:35 +0200 -Subject: [PATCH 111/217] vhost: set vring endianness for legacy virtio - -Message-id: <1435950819-10991-4-git-send-email-thuth@redhat.com> -Patchwork-id: 66696 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 3/7] vhost: set vring endianness for legacy virtio -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Greg Kurz <gkurz@linux.vnet.ibm.com> - -Legacy virtio is native endian: if the guest and host endianness differ, -we have to tell vhost so it can swap bytes where appropriate. This is -done through a vhost ring ioctl. - -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 04b7a1523d65bb5c78832098cf3108a1aadcaf8a) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/vhost.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 49 insertions(+), 1 deletion(-) - -diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c -index 54851b7..1d7b939 100644 ---- a/hw/virtio/vhost.c -+++ b/hw/virtio/vhost.c -@@ -17,9 +17,11 @@ - #include "hw/hw.h" - #include "qemu/atomic.h" - #include "qemu/range.h" -+#include "qemu/error-report.h" - #include <linux/vhost.h> - #include "exec/address-spaces.h" - #include "hw/virtio/virtio-bus.h" -+#include "hw/virtio/virtio-access.h" - #include "migration/migration.h" - - static void vhost_dev_sync_region(struct vhost_dev *dev, -@@ -647,6 +649,27 @@ static void vhost_log_stop(MemoryListener *listener, - /* FIXME: implement */ - } - -+static int vhost_virtqueue_set_vring_endian_legacy(struct vhost_dev *dev, -+ bool is_big_endian, -+ int vhost_vq_index) -+{ -+ struct vhost_vring_state s = { -+ .index = vhost_vq_index, -+ .num = is_big_endian -+ }; -+ -+ if (!dev->vhost_ops->vhost_call(dev, VHOST_SET_VRING_ENDIAN, &s)) { -+ return 0; -+ } -+ -+ if (errno == ENOTTY) { -+ error_report("vhost does not support cross-endian"); -+ return -ENOSYS; -+ } -+ -+ return -errno; -+} -+ - static int vhost_virtqueue_start(struct vhost_dev *dev, - struct VirtIODevice *vdev, - struct vhost_virtqueue *vq, -@@ -677,6 +700,16 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, - return -errno; - } - -+ if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1) && -+ virtio_legacy_is_cross_endian(vdev)) { -+ r = vhost_virtqueue_set_vring_endian_legacy(dev, -+ virtio_is_big_endian(vdev), -+ vhost_vq_index); -+ if (r) { -+ return -errno; -+ } -+ } -+ - s = l = virtio_queue_get_desc_size(vdev, idx); - a = virtio_queue_get_desc_addr(vdev, idx); - vq->desc = cpu_physical_memory_map(a, &l, 0); -@@ -747,8 +780,9 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev, - struct vhost_virtqueue *vq, - unsigned idx) - { -+ int vhost_vq_index = idx - dev->vq_index; - struct vhost_vring_state state = { -- .index = idx - dev->vq_index -+ .index = vhost_vq_index, - }; - int r; - assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs); -@@ -759,6 +793,20 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev, - } - virtio_queue_set_last_avail_idx(vdev, idx, state.num); - virtio_queue_invalidate_signalled_used(vdev, idx); -+ -+ /* In the cross-endian case, we need to reset the vring endianness to -+ * native as legacy devices expect so by default. -+ */ -+ if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1) && -+ virtio_legacy_is_cross_endian(vdev)) { -+ r = vhost_virtqueue_set_vring_endian_legacy(dev, -+ !virtio_is_big_endian(vdev), -+ vhost_vq_index); -+ if (r < 0) { -+ error_report("failed to reset vring endianness"); -+ } -+ } -+ - assert (r >= 0); - cpu_physical_memory_unmap(vq->ring, virtio_queue_get_ring_size(vdev, idx), - 0, virtio_queue_get_ring_size(vdev, idx)); --- -1.8.3.1 - diff --git a/SOURCES/kvm-vhost_net-add-version_1-feature.patch b/SOURCES/kvm-vhost_net-add-version_1-feature.patch deleted file mode 100644 index c3116bf..0000000 --- a/SOURCES/kvm-vhost_net-add-version_1-feature.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7293dc708fec897b74722d6f1d449de7a29f4f56 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:35 +0200 -Subject: [PATCH 147/217] vhost_net: add version_1 feature - -Message-id: <1436260751-25015-33-git-send-email-jasowang@redhat.com> -Patchwork-id: 66807 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 32/68] vhost_net: add version_1 feature -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -Add VERSION_1 to list of features that we should -test at the backend. - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit b1506132001eee6b11cf23b5968cd66ec141a9ed) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/vhost_net.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c -index 3e4b0f2..760f4fc 100644 ---- a/hw/net/vhost_net.c -+++ b/hw/net/vhost_net.c -@@ -53,6 +53,7 @@ static const int kernel_feature_bits[] = { - VIRTIO_RING_F_INDIRECT_DESC, - VIRTIO_RING_F_EVENT_IDX, - VIRTIO_NET_F_MRG_RXBUF, -+ VIRTIO_F_VERSION_1, - VHOST_INVALID_FEATURE_BIT - }; - -@@ -63,6 +64,7 @@ static const int user_feature_bits[] = { - VIRTIO_RING_F_EVENT_IDX, - - VIRTIO_F_ANY_LAYOUT, -+ VIRTIO_F_VERSION_1, - VIRTIO_NET_F_CSUM, - VIRTIO_NET_F_GUEST_CSUM, - VIRTIO_NET_F_GSO, --- -1.8.3.1 - diff --git a/SOURCES/kvm-vhost_net-re-enable-when-cross-endian.patch b/SOURCES/kvm-vhost_net-re-enable-when-cross-endian.patch deleted file mode 100644 index fadde05..0000000 --- a/SOURCES/kvm-vhost_net-re-enable-when-cross-endian.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 89db7a99ad2a13c705c0a377c0176c555aad8d4a Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:39 +0200 -Subject: [PATCH 115/217] vhost_net: re-enable when cross endian -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1435950819-10991-8-git-send-email-thuth@redhat.com> -Patchwork-id: 66700 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 7/7] vhost_net: re-enable when cross endian -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Cédric Le Goater <clg@fr.ibm.com> - -Cross-endianness is now checked by the core vhost code. - -revert 371df9f5e0f1 "vhost-net: disable when cross-endian" - -Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> -[ added commit message, Greg Kurz <gkurz@linux.vnet.ibm.com> ] -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 1717388645670336c48aa05d19b0acd07687a821) -Signed-off-by: Thomas Huth <thuth@redhat.com> - -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/vhost_net.c | 19 ------------------- - 1 file changed, 19 deletions(-) - -diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c -index 1884e59..3e4b0f2 100644 ---- a/hw/net/vhost_net.c -+++ b/hw/net/vhost_net.c -@@ -293,19 +293,6 @@ static void vhost_net_stop_one(struct vhost_net *net, - vhost_dev_disable_notifiers(&net->dev, dev); - } - --static bool vhost_net_device_endian_ok(VirtIODevice *vdev) --{ --#ifdef TARGET_IS_BIENDIAN --#ifdef HOST_WORDS_BIGENDIAN -- return virtio_is_big_endian(vdev); --#else -- return !virtio_is_big_endian(vdev); --#endif --#else -- return true; --#endif --} -- - int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, - int total_queues) - { -@@ -314,12 +301,6 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, - VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); - int r, e, i; - -- if (!vhost_net_device_endian_ok(dev)) { -- error_report("vhost-net does not support cross-endian"); -- r = -ENOSYS; -- goto err; -- } -- - if (!k->set_guest_notifiers) { - error_report("binding does not support guest notifiers"); - r = -ENOSYS; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virito-pci-fix-OVERRUN-problem.patch b/SOURCES/kvm-virito-pci-fix-OVERRUN-problem.patch deleted file mode 100644 index 1919165..0000000 --- a/SOURCES/kvm-virito-pci-fix-OVERRUN-problem.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0677491b99e29e3bdbf313121077187439cca727 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:06 +0200 -Subject: [PATCH 178/217] virito-pci: fix OVERRUN problem - -Message-id: <1436260751-25015-64-git-send-email-jasowang@redhat.com> -Patchwork-id: 66838 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 63/68] virito-pci: fix OVERRUN problem -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gonglei <arei.gonglei@huawei.com> - -Overrunning array "proxy->guest_features" of 2 4-byte -elements at element index 2 (byte offset 8) using index -"proxy->gfselect" (which evaluates to 2). Normally, the -Linux kernel driver just read/write '0' or '1' as the -"proxy->gfselect" values, so using '<' instead of '=<' to -make coverity happy and avoid potential harm. - -Cc: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Gonglei <arei.gonglei@huawei.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 3750dabc69d76f0938cc726a64a70e4ae2fe21df) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 1aba4e2..9b5f009 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -977,7 +977,7 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, - val = proxy->gfselect; - break; - case VIRTIO_PCI_COMMON_GF: -- if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) { -+ if (proxy->gfselect < ARRAY_SIZE(proxy->guest_features)) { - val = proxy->guest_features[proxy->gfselect]; - } - break; -@@ -1052,7 +1052,7 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr, - proxy->gfselect = val; - break; - case VIRTIO_PCI_COMMON_GF: -- if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) { -+ if (proxy->gfselect < ARRAY_SIZE(proxy->guest_features)) { - proxy->guest_features[proxy->gfselect] = val; - virtio_set_features(vdev, - (((uint64_t)proxy->guest_features[1]) << 32) | --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-64bit-features-fixups.patch b/SOURCES/kvm-virtio-64bit-features-fixups.patch deleted file mode 100644 index 017a754..0000000 --- a/SOURCES/kvm-virtio-64bit-features-fixups.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 8708588f2fb4de402e82b86032538aa8d5c4e144 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:27 +0200 -Subject: [PATCH 139/217] virtio: 64bit features fixups. - -Message-id: <1436260751-25015-25-git-send-email-jasowang@redhat.com> -Patchwork-id: 66799 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 24/68] virtio: 64bit features fixups. -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Commit "019a3ed virtio: make features 64bit wide" missed a few changes, -as I've noticed while trying to rebase the virtio-1 branch to latest -master. This patch adds them. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit d5aaa1b0456033fc9ff723ac881ebe1b61360cca) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 2 +- - hw/virtio/virtio.c | 2 +- - include/hw/virtio/virtio.h | 10 +++++----- - 3 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index 1d7ce09..a4397b4 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -517,7 +517,7 @@ static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n) - return virtio_net_guest_offloads_by_features(vdev->guest_features); - } - --static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) -+static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features) - { - VirtIONet *n = VIRTIO_NET(vdev); - int i; -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 596e3d8..8ac6156 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -1003,7 +1003,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - vmstate_save_state(f, &vmstate_virtio, vdev, NULL); - } - --int virtio_set_features(VirtIODevice *vdev, uint32_t val) -+int virtio_set_features(VirtIODevice *vdev, uint64_t val) - { - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - bool bad = (val & ~(vdev->host_features)) != 0; -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 180b077..8e8b72d 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -98,7 +98,7 @@ typedef struct VirtioDeviceClass { - DeviceUnrealize unrealize; - uint64_t (*get_features)(VirtIODevice *vdev, uint64_t requested_features); - uint64_t (*bad_features)(VirtIODevice *vdev); -- void (*set_features)(VirtIODevice *vdev, uint32_t val); -+ void (*set_features)(VirtIODevice *vdev, uint64_t val); - void (*get_config)(VirtIODevice *vdev, uint8_t *config); - void (*set_config)(VirtIODevice *vdev, const uint8_t *config); - void (*reset)(VirtIODevice *vdev); -@@ -184,7 +184,7 @@ void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector); - void virtio_set_status(VirtIODevice *vdev, uint8_t val); - void virtio_reset(void *opaque); - void virtio_update_irq(VirtIODevice *vdev); --int virtio_set_features(VirtIODevice *vdev, uint32_t val); -+int virtio_set_features(VirtIODevice *vdev, uint64_t val); - - /* Base devices. */ - typedef struct VirtIOBlkConf VirtIOBlkConf; -@@ -230,19 +230,19 @@ VirtQueue *virtio_vector_next_queue(VirtQueue *vq); - static inline void virtio_add_feature(uint64_t *features, unsigned int fbit) - { - assert(fbit < 64); -- *features |= (1 << fbit); -+ *features |= (1ULL << fbit); - } - - static inline void virtio_clear_feature(uint64_t *features, unsigned int fbit) - { - assert(fbit < 64); -- *features &= ~(1 << fbit); -+ *features &= ~(1ULL << fbit); - } - - static inline bool __virtio_has_feature(uint64_t features, unsigned int fbit) - { - assert(fbit < 64); -- return !!(features & (1 << fbit)); -+ return !!(features & (1ULL << fbit)); - } - - static inline bool virtio_has_feature(VirtIODevice *vdev, unsigned int fbit) --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-9p-device-move-qdev-properties-into-virtio-9p.patch b/SOURCES/kvm-virtio-9p-device-move-qdev-properties-into-virtio-9p.patch deleted file mode 100644 index 4467b3c..0000000 --- a/SOURCES/kvm-virtio-9p-device-move-qdev-properties-into-virtio-9p.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 6c0b0a6c240c1e19502e6d59ef740813409bfee1 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:04 +0200 -Subject: [PATCH 176/217] virtio-9p-device: move qdev properties into - virtio-9p-device.c - -Message-id: <1436260751-25015-62-git-send-email-jasowang@redhat.com> -Patchwork-id: 66836 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 61/68] virtio-9p-device: move qdev properties into virtio-9p-device.c -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -As only one place in virtio-9p-device.c uses -DEFINE_VIRTIO_9P_PROPERTIES, there is no need to expose it. Inline it -into virtio-9p-device.c to avoid wrongly use. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 83a84878da2e00b4d350bd90d6775c1f6320e7b4) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/9pfs/virtio-9p-device.c | 3 ++- - hw/9pfs/virtio-9p.h | 4 ---- - 2 files changed, 2 insertions(+), 5 deletions(-) - -diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c -index 60f9ff9..3f4c9e7 100644 ---- a/hw/9pfs/virtio-9p-device.c -+++ b/hw/9pfs/virtio-9p-device.c -@@ -140,7 +140,8 @@ out: - /* virtio-9p device */ - - static Property virtio_9p_properties[] = { -- DEFINE_VIRTIO_9P_PROPERTIES(V9fsState, fsconf), -+ DEFINE_PROP_STRING("mount_tag", V9fsState, fsconf.tag), -+ DEFINE_PROP_STRING("fsdev", V9fsState, fsconf.fsdev_id), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h -index 58dafa9..2e7d488 100644 ---- a/hw/9pfs/virtio-9p.h -+++ b/hw/9pfs/virtio-9p.h -@@ -391,8 +391,4 @@ extern int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath, - #define VIRTIO_9P(obj) \ - OBJECT_CHECK(V9fsState, (obj), TYPE_VIRTIO_9P) - --#define DEFINE_VIRTIO_9P_PROPERTIES(_state, _field) \ -- DEFINE_PROP_STRING("mount_tag", _state, _field.tag), \ -- DEFINE_PROP_STRING("fsdev", _state, _field.fsdev_id) -- - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-add-modern-config-accessors.patch b/SOURCES/kvm-virtio-add-modern-config-accessors.patch deleted file mode 100644 index 24abd78..0000000 --- a/SOURCES/kvm-virtio-add-modern-config-accessors.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 2f152d27eecc91b27383652a88400cfb6b48977a Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:40 +0200 -Subject: [PATCH 152/217] virtio: add modern config accessors - -Message-id: <1436260751-25015-38-git-send-email-jasowang@redhat.com> -Patchwork-id: 66812 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 37/68] virtio: add modern config accessors -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -virtio 1.0 defines config space as LE, -as opposed to pre-1.0 which was native endian. - -Add API for transports to execute word/dword accesses in -little endian format - will be useful for mmio -and pci (byte access is also wrapped, for completeness). - -For simplicity, we still keep config in host native -endian format, byteswap to LE on guest access. - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit adfb743c90c7aa5e92907ce875e4f35747ee1963) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++ - include/hw/virtio/virtio.h | 9 +++++ - 2 files changed, 105 insertions(+) - -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index cae5eca..fb49ffc 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -729,6 +729,102 @@ void virtio_config_writel(VirtIODevice *vdev, uint32_t addr, uint32_t data) - } - } - -+uint32_t virtio_config_modern_readb(VirtIODevice *vdev, uint32_t addr) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint8_t val; -+ -+ if (addr + sizeof(val) > vdev->config_len) { -+ return (uint32_t)-1; -+ } -+ -+ k->get_config(vdev, vdev->config); -+ -+ val = ldub_p(vdev->config + addr); -+ return val; -+} -+ -+uint32_t virtio_config_modern_readw(VirtIODevice *vdev, uint32_t addr) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint16_t val; -+ -+ if (addr + sizeof(val) > vdev->config_len) { -+ return (uint32_t)-1; -+ } -+ -+ k->get_config(vdev, vdev->config); -+ -+ val = lduw_le_p(vdev->config + addr); -+ return val; -+} -+ -+uint32_t virtio_config_modern_readl(VirtIODevice *vdev, uint32_t addr) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint32_t val; -+ -+ if (addr + sizeof(val) > vdev->config_len) { -+ return (uint32_t)-1; -+ } -+ -+ k->get_config(vdev, vdev->config); -+ -+ val = ldl_le_p(vdev->config + addr); -+ return val; -+} -+ -+void virtio_config_modern_writeb(VirtIODevice *vdev, -+ uint32_t addr, uint32_t data) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint8_t val = data; -+ -+ if (addr + sizeof(val) > vdev->config_len) { -+ return; -+ } -+ -+ stb_p(vdev->config + addr, val); -+ -+ if (k->set_config) { -+ k->set_config(vdev, vdev->config); -+ } -+} -+ -+void virtio_config_modern_writew(VirtIODevice *vdev, -+ uint32_t addr, uint32_t data) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint16_t val = data; -+ -+ if (addr + sizeof(val) > vdev->config_len) { -+ return; -+ } -+ -+ stw_le_p(vdev->config + addr, val); -+ -+ if (k->set_config) { -+ k->set_config(vdev, vdev->config); -+ } -+} -+ -+void virtio_config_modern_writel(VirtIODevice *vdev, -+ uint32_t addr, uint32_t data) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint32_t val = data; -+ -+ if (addr + sizeof(val) > vdev->config_len) { -+ return; -+ } -+ -+ stl_le_p(vdev->config + addr, val); -+ -+ if (k->set_config) { -+ k->set_config(vdev, vdev->config); -+ } -+} -+ - void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr) - { - vdev->vq[n].vring.desc = addr; -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 96a32a1..2bf9cc1 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -174,6 +174,15 @@ uint32_t virtio_config_readl(VirtIODevice *vdev, uint32_t addr); - void virtio_config_writeb(VirtIODevice *vdev, uint32_t addr, uint32_t data); - void virtio_config_writew(VirtIODevice *vdev, uint32_t addr, uint32_t data); - void virtio_config_writel(VirtIODevice *vdev, uint32_t addr, uint32_t data); -+uint32_t virtio_config_modern_readb(VirtIODevice *vdev, uint32_t addr); -+uint32_t virtio_config_modern_readw(VirtIODevice *vdev, uint32_t addr); -+uint32_t virtio_config_modern_readl(VirtIODevice *vdev, uint32_t addr); -+void virtio_config_modern_writeb(VirtIODevice *vdev, -+ uint32_t addr, uint32_t data); -+void virtio_config_modern_writew(VirtIODevice *vdev, -+ uint32_t addr, uint32_t data); -+void virtio_config_modern_writel(VirtIODevice *vdev, -+ uint32_t addr, uint32_t data); - void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr); - hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n); - void virtio_queue_set_num(VirtIODevice *vdev, int n, int num); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-allow-to-fail-setting-status.patch b/SOURCES/kvm-virtio-allow-to-fail-setting-status.patch deleted file mode 100644 index 99013a3..0000000 --- a/SOURCES/kvm-virtio-allow-to-fail-setting-status.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 415f6fa6818194f0b5ba53c1d0130091581d5f7f Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:31 +0200 -Subject: [PATCH 143/217] virtio: allow to fail setting status - -Message-id: <1436260751-25015-29-git-send-email-jasowang@redhat.com> -Patchwork-id: 66803 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 28/68] virtio: allow to fail setting status -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -virtio-1 allow setting of the FEATURES_OK status bit to fail if -the negotiated feature bits are inconsistent: let's fail -virtio_set_status() in that case and update virtio-ccw to post an -error to the guest. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 0b352fd680e1ca7827ddea47b5e9b603320913b6) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 20 ++++++++++++-------- - hw/virtio/virtio.c | 24 +++++++++++++++++++++++- - include/hw/virtio/virtio.h | 3 ++- - 3 files changed, 37 insertions(+), 10 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index fdac013..8708a2b 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -497,15 +497,19 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { - virtio_ccw_stop_ioeventfd(dev); - } -- virtio_set_status(vdev, status); -- if (vdev->status == 0) { -- virtio_reset(vdev); -- } -- if (status & VIRTIO_CONFIG_S_DRIVER_OK) { -- virtio_ccw_start_ioeventfd(dev); -+ if (virtio_set_status(vdev, status) == 0) { -+ if (vdev->status == 0) { -+ virtio_reset(vdev); -+ } -+ if (status & VIRTIO_CONFIG_S_DRIVER_OK) { -+ virtio_ccw_start_ioeventfd(dev); -+ } -+ sch->curr_status.scsw.count = ccw.count - sizeof(status); -+ ret = 0; -+ } else { -+ /* Trigger a command reject. */ -+ ret = -ENOSYS; - } -- sch->curr_status.scsw.count = ccw.count - sizeof(status); -- ret = 0; - } - break; - case CCW_CMD_SET_IND: -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 3367100..8a6ebae 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -544,15 +544,37 @@ void virtio_update_irq(VirtIODevice *vdev) - virtio_notify_vector(vdev, VIRTIO_NO_VECTOR); - } - --void virtio_set_status(VirtIODevice *vdev, uint8_t val) -+static int virtio_validate_features(VirtIODevice *vdev) -+{ -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ -+ if (k->validate_features) { -+ return k->validate_features(vdev); -+ } else { -+ return 0; -+ } -+} -+ -+int virtio_set_status(VirtIODevice *vdev, uint8_t val) - { - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - trace_virtio_set_status(vdev, val); - -+ if (virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { -+ if (!(vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) && -+ val & VIRTIO_CONFIG_S_FEATURES_OK) { -+ int ret = virtio_validate_features(vdev); -+ -+ if (ret) { -+ return ret; -+ } -+ } -+ } - if (k->set_status) { - k->set_status(vdev, val); - } - vdev->status = val; -+ return 0; - } - - bool target_words_bigendian(void); -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 7583eac..effb8f8 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -99,6 +99,7 @@ typedef struct VirtioDeviceClass { - uint64_t (*get_features)(VirtIODevice *vdev, uint64_t requested_features); - uint64_t (*bad_features)(VirtIODevice *vdev); - void (*set_features)(VirtIODevice *vdev, uint64_t val); -+ int (*validate_features)(VirtIODevice *vdev); - void (*get_config)(VirtIODevice *vdev, uint8_t *config); - void (*set_config)(VirtIODevice *vdev, const uint8_t *config); - void (*reset)(VirtIODevice *vdev); -@@ -184,7 +185,7 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align); - void virtio_queue_notify(VirtIODevice *vdev, int n); - uint16_t virtio_queue_vector(VirtIODevice *vdev, int n); - void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector); --void virtio_set_status(VirtIODevice *vdev, uint8_t val); -+int virtio_set_status(VirtIODevice *vdev, uint8_t val); - void virtio_reset(void *opaque); - void virtio_update_irq(VirtIODevice *vdev); - int virtio_set_features(VirtIODevice *vdev, uint64_t val); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-allow-virtio-1-queue-layout.patch b/SOURCES/kvm-virtio-allow-virtio-1-queue-layout.patch deleted file mode 100644 index dde6ce4..0000000 --- a/SOURCES/kvm-virtio-allow-virtio-1-queue-layout.patch +++ /dev/null @@ -1,203 +0,0 @@ -From f77e2d22c91d2e2e7b2179e0e57b0fc9cd7b1557 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:29 +0200 -Subject: [PATCH 141/217] virtio: allow virtio-1 queue layout - -Message-id: <1436260751-25015-27-git-send-email-jasowang@redhat.com> -Patchwork-id: 66801 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 26/68] virtio: allow virtio-1 queue layout -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -For virtio-1 devices, we allow a more complex queue layout that doesn't -require descriptor table and rings on a physically-contigous memory area: -add virtio_queue_set_rings() to allow transports to set this up. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit ab223c9518e8c7eb542ef3133de1a34475b69790) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-mmio.c | 3 +++ - hw/virtio/virtio.c | 53 +++++++++++++++++++++++++++++----------------- - include/hw/virtio/virtio.h | 3 +++ - 3 files changed, 40 insertions(+), 19 deletions(-) - -diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c -index a3cfd30..a368a39 100644 ---- a/hw/virtio/virtio-mmio.c -+++ b/hw/virtio/virtio-mmio.c -@@ -243,8 +243,11 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, - case VIRTIO_MMIO_QUEUENUM: - DPRINTF("mmio_queue write %d max %d\n", (int)value, VIRTQUEUE_MAX_SIZE); - virtio_queue_set_num(vdev, vdev->queue_sel, value); -+ /* Note: only call this function for legacy devices */ -+ virtio_queue_update_rings(vdev, vdev->queue_sel); - break; - case VIRTIO_MMIO_QUEUEALIGN: -+ /* Note: this is only valid for legacy devices */ - virtio_queue_set_align(vdev, vdev->queue_sel, value); - break; - case VIRTIO_MMIO_QUEUEPFN: -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index d37d27b..c27e975 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -69,7 +69,6 @@ typedef struct VRing - struct VirtQueue - { - VRing vring; -- hwaddr pa; - uint16_t last_avail_idx; - /* Last used index value we have signalled on */ - uint16_t signalled_used; -@@ -93,15 +92,18 @@ struct VirtQueue - }; - - /* virt queue functions */ --static void virtqueue_init(VirtQueue *vq) -+void virtio_queue_update_rings(VirtIODevice *vdev, int n) - { -- hwaddr pa = vq->pa; -+ VRing *vring = &vdev->vq[n].vring; - -- vq->vring.desc = pa; -- vq->vring.avail = pa + vq->vring.num * sizeof(VRingDesc); -- vq->vring.used = vring_align(vq->vring.avail + -- offsetof(VRingAvail, ring[vq->vring.num]), -- vq->vring.align); -+ if (!vring->desc) { -+ /* not yet setup -> nothing to do */ -+ return; -+ } -+ vring->avail = vring->desc + vring->num * sizeof(VRingDesc); -+ vring->used = vring_align(vring->avail + -+ offsetof(VRingAvail, ring[vring->num]), -+ vring->align); - } - - static inline uint64_t vring_desc_addr(VirtIODevice *vdev, hwaddr desc_pa, -@@ -605,7 +607,6 @@ void virtio_reset(void *opaque) - vdev->vq[i].vring.avail = 0; - vdev->vq[i].vring.used = 0; - vdev->vq[i].last_avail_idx = 0; -- vdev->vq[i].pa = 0; - virtio_queue_set_vector(vdev, i, VIRTIO_NO_VECTOR); - vdev->vq[i].signalled_used = 0; - vdev->vq[i].signalled_used_valid = false; -@@ -708,13 +709,21 @@ void virtio_config_writel(VirtIODevice *vdev, uint32_t addr, uint32_t data) - - void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr) - { -- vdev->vq[n].pa = addr; -- virtqueue_init(&vdev->vq[n]); -+ vdev->vq[n].vring.desc = addr; -+ virtio_queue_update_rings(vdev, n); - } - - hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n) - { -- return vdev->vq[n].pa; -+ return vdev->vq[n].vring.desc; -+} -+ -+void virtio_queue_set_rings(VirtIODevice *vdev, int n, hwaddr desc, -+ hwaddr avail, hwaddr used) -+{ -+ vdev->vq[n].vring.desc = desc; -+ vdev->vq[n].vring.avail = avail; -+ vdev->vq[n].vring.used = used; - } - - void virtio_queue_set_num(VirtIODevice *vdev, int n, int num) -@@ -728,7 +737,6 @@ void virtio_queue_set_num(VirtIODevice *vdev, int n, int num) - return; - } - vdev->vq[n].vring.num = num; -- virtqueue_init(&vdev->vq[n]); - } - - VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector) -@@ -771,6 +779,11 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align) - BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); - VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); - -+ /* virtio-1 compliant devices cannot change the alignment */ -+ if (virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { -+ error_report("tried to modify queue alignment for virtio-1 device"); -+ return; -+ } - /* Check that the transport told us it was going to do this - * (so a buggy transport will immediately assert rather than - * silently failing to migrate this state) -@@ -778,7 +791,7 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align) - assert(k->has_variable_vring_alignment); - - vdev->vq[n].vring.align = align; -- virtqueue_init(&vdev->vq[n]); -+ virtio_queue_update_rings(vdev, n); - } - - void virtio_queue_notify_vq(VirtQueue *vq) -@@ -992,7 +1005,8 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - if (k->has_variable_vring_alignment) { - qemu_put_be32(f, vdev->vq[i].vring.align); - } -- qemu_put_be64(f, vdev->vq[i].pa); -+ /* XXX virtio-1 devices */ -+ qemu_put_be64(f, vdev->vq[i].vring.desc); - qemu_put_be16s(f, &vdev->vq[i].last_avail_idx); - if (k->save_queue) { - k->save_queue(qbus->parent, i, f); -@@ -1076,13 +1090,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - if (k->has_variable_vring_alignment) { - vdev->vq[i].vring.align = qemu_get_be32(f); - } -- vdev->vq[i].pa = qemu_get_be64(f); -+ vdev->vq[i].vring.desc = qemu_get_be64(f); - qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); - vdev->vq[i].signalled_used_valid = false; - vdev->vq[i].notification = true; - -- if (vdev->vq[i].pa) { -- virtqueue_init(&vdev->vq[i]); -+ if (vdev->vq[i].vring.desc) { -+ /* XXX virtio-1 devices */ -+ virtio_queue_update_rings(vdev, i); - } else if (vdev->vq[i].last_avail_idx) { - error_report("VQ %d address 0x0 " - "inconsistent with Host index 0x%x", -@@ -1138,7 +1153,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - } - - for (i = 0; i < num; i++) { -- if (vdev->vq[i].pa) { -+ if (vdev->vq[i].vring.desc) { - uint16_t nheads; - nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; - /* Check it isn't doing strange things with descriptor numbers. */ -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index eed7f4f..7583eac 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -177,6 +177,9 @@ hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n); - void virtio_queue_set_num(VirtIODevice *vdev, int n, int num); - int virtio_queue_get_num(VirtIODevice *vdev, int n); - int virtio_get_num_queues(VirtIODevice *vdev); -+void virtio_queue_set_rings(VirtIODevice *vdev, int n, hwaddr desc, -+ hwaddr avail, hwaddr used); -+void virtio_queue_update_rings(VirtIODevice *vdev, int n); - void virtio_queue_set_align(VirtIODevice *vdev, int n, int align); - void virtio_queue_notify(VirtIODevice *vdev, int n); - uint16_t virtio_queue_vector(VirtIODevice *vdev, int n); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-balloon-switch-to-virtio_add_feature.patch b/SOURCES/kvm-virtio-balloon-switch-to-virtio_add_feature.patch deleted file mode 100644 index 55ad60a..0000000 --- a/SOURCES/kvm-virtio-balloon-switch-to-virtio_add_feature.patch +++ /dev/null @@ -1,45 +0,0 @@ -From bdaa633e9a54843983c3c64f31b66d35777ab097 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:48 +0200 -Subject: [PATCH 160/217] virtio-balloon: switch to virtio_add_feature - -Message-id: <1436260751-25015-46-git-send-email-jasowang@redhat.com> -Patchwork-id: 66820 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 45/68] virtio-balloon: switch to virtio_add_feature -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -This was missed during the conversion of feature bit manipulation. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 40de55affda76392627e68d3b1ba5a6a11c492bc) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-balloon.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index 734f35b..72745db 100644 ---- a/hw/virtio/virtio-balloon.c -+++ b/hw/virtio/virtio-balloon.c -@@ -312,7 +312,7 @@ static void virtio_balloon_set_config(VirtIODevice *vdev, - - static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f) - { -- f |= (1 << VIRTIO_BALLOON_F_STATS_VQ); -+ virtio_add_feature(&f, VIRTIO_BALLOON_F_STATS_VQ); - return f; - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-Don-t-advertise-VIRTIO_F_BAD_FEATURE.patch b/SOURCES/kvm-virtio-ccw-Don-t-advertise-VIRTIO_F_BAD_FEATURE.patch deleted file mode 100644 index 528a40e..0000000 --- a/SOURCES/kvm-virtio-ccw-Don-t-advertise-VIRTIO_F_BAD_FEATURE.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0adabe625aa6a5265bcb6476c0e9663d698ad427 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:21 +0200 -Subject: [PATCH 133/217] virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE - -Message-id: <1436260751-25015-19-git-send-email-jasowang@redhat.com> -Patchwork-id: 66793 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 18/68] virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -This was copied from virtio-pci, but it doesn't make much sense for -ccw, as it doesn't have to handle the broken implementations this bit -is supposed to deal with. Remove it. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 13644819c5bf322ae4c2a415aca77d5dbde95fe8) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 2b98ae9..c1d24d4 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -1422,7 +1422,6 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) - sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); - - virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); -- virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); - - css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, - d->hotplugged, 1); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-change-realization-sequence.patch b/SOURCES/kvm-virtio-ccw-change-realization-sequence.patch deleted file mode 100644 index becff22..0000000 --- a/SOURCES/kvm-virtio-ccw-change-realization-sequence.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 022bafb518274ee659b6307ee6042c4cac14bf94 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:39 +0200 -Subject: [PATCH 018/217] virtio-ccw: change realization sequence - -Message-id: <1434607916-15166-4-git-send-email-jasowang@redhat.com> -Patchwork-id: 66302 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 03/20] virtio-ccw: change realization sequence -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -virtio-ccw has an odd sequence of realizing devices: first the -device-specific relization (net, block, ...), then the generic -realization. It feels less odd to have the generic realization -callback trigger the device-specific realization instead (and this -also matches what virtio-pci does). - -One thing to note: We need to defer initializing the cu model in the -sense id data until after the device-specific realization has been -performed, as we need to refer to the virtio device's device_id. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Message-Id: <1429627016-30656-2-git-send-email-cornelia.huck@de.ibm.com> -(cherry picked from commit 1fa755234e24697cc76f326782edbb09bd0a3a53) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 41 +++++++++++++++++------------------------ - 1 file changed, 17 insertions(+), 24 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index f102974..e06ebea 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -615,8 +615,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - return ret; - } - --static void virtio_ccw_device_realize(VirtioCcwDevice *dev, -- VirtIODevice *vdev, Error **errp) -+static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) - { - unsigned int cssid = 0; - unsigned int ssid = 0; -@@ -627,6 +626,9 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, - SubchDev *sch; - int num; - DeviceState *parent = DEVICE(dev); -+ Error *err = NULL; -+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_GET_CLASS(dev); -+ VirtIODevice *vdev; - - sch = g_malloc0(sizeof(SubchDev)); - -@@ -739,6 +741,18 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, - memset(&sch->id, 0, sizeof(SenseId)); - sch->id.reserved = 0xff; - sch->id.cu_type = VIRTIO_CCW_CU_TYPE; -+ -+ if (k->realize) { -+ k->realize(dev, &err); -+ } -+ if (err) { -+ error_propagate(errp, err); -+ css_subch_assign(cssid, ssid, schid, devno, NULL); -+ goto out_err; -+ } -+ -+ /* device_id is only set after vdev has been realized */ -+ vdev = virtio_ccw_get_vdev(sch); - sch->id.cu_model = vdev->device_id; - - /* Only the first 32 feature bits are used. */ -@@ -786,10 +800,7 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); -- return; - } -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - static void virtio_ccw_net_instance_init(Object *obj) -@@ -812,10 +823,7 @@ static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); -- return; - } -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - static void virtio_ccw_blk_instance_init(Object *obj) -@@ -852,10 +860,7 @@ static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); -- return; - } -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - -@@ -877,10 +882,7 @@ static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); -- return; - } -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - static void balloon_ccw_stats_get_all(Object *obj, struct Visitor *v, -@@ -945,10 +947,7 @@ static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); -- return; - } -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - static void virtio_ccw_scsi_instance_init(Object *obj) -@@ -972,10 +971,7 @@ static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); -- return; - } -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - static void vhost_ccw_scsi_instance_init(Object *obj) -@@ -1003,8 +999,6 @@ static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp) - object_property_set_link(OBJECT(dev), - OBJECT(dev->vdev.conf.rng), "rng", - NULL); -- -- virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); - } - - /* DeviceState to VirtioCcwDevice. Note: used on datapath, -@@ -1605,10 +1599,9 @@ static const TypeInfo virtio_ccw_rng = { - static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp) - { - VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev; -- VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev); - - virtio_ccw_bus_new(&_dev->bus, sizeof(_dev->bus), _dev); -- _info->realize(_dev, errp); -+ virtio_ccw_device_realize(_dev, errp); - } - - static int virtio_ccw_busdev_exit(DeviceState *dev) --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-implement-device_plugged.patch b/SOURCES/kvm-virtio-ccw-implement-device_plugged.patch deleted file mode 100644 index bbef834..0000000 --- a/SOURCES/kvm-virtio-ccw-implement-device_plugged.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 4bcad0a82632e4641d1c5f99c2b26d9e53dd6714 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:40 +0200 -Subject: [PATCH 019/217] virtio-ccw: implement ->device_plugged - -Message-id: <1434607916-15166-5-git-send-email-jasowang@redhat.com> -Patchwork-id: 66304 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 04/20] virtio-ccw: implement ->device_plugged -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Let's move operations that are only valid after the backend has been -realized to a ->device_plugged callback, just as virtio-pci does. -Also reorder setting up the host feature bits to the sequence used -by virtio-pci. - -While we're at it, also add a ->device_unplugged callback to stop -ioeventfd, just to be on the safe side. - -Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Message-Id: <1429627016-30656-3-git-send-email-cornelia.huck@de.ibm.com> -(cherry picked from commit fb846a094fdee7bb6a88b48aeed0d97a8080a20d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 41 ++++++++++++++++++++++++++--------------- - 1 file changed, 26 insertions(+), 15 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index e06ebea..e68dcc7 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -625,10 +625,8 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) - bool found = false; - SubchDev *sch; - int num; -- DeviceState *parent = DEVICE(dev); - Error *err = NULL; - VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_GET_CLASS(dev); -- VirtIODevice *vdev; - - sch = g_malloc0(sizeof(SubchDev)); - -@@ -751,19 +749,6 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) - goto out_err; - } - -- /* device_id is only set after vdev has been realized */ -- vdev = virtio_ccw_get_vdev(sch); -- sch->id.cu_model = vdev->device_id; -- -- /* Only the first 32 feature bits are used. */ -- dev->host_features[0] = virtio_bus_get_vdev_features(&dev->bus, -- dev->host_features[0]); -- -- virtio_add_feature(&dev->host_features[0], VIRTIO_F_NOTIFY_ON_EMPTY); -- virtio_add_feature(&dev->host_features[0], VIRTIO_F_BAD_FEATURE); -- -- css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, -- parent->hotplugged, 1); - return; - - out_err: -@@ -1393,6 +1378,30 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) - return 0; - } - -+/* This is called by virtio-bus just after the device is plugged. */ -+static void virtio_ccw_device_plugged(DeviceState *d) -+{ -+ VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -+ SubchDev *sch = dev->sch; -+ -+ sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); -+ -+ /* Only the first 32 feature bits are used. */ -+ virtio_add_feature(&dev->host_features[0], VIRTIO_F_NOTIFY_ON_EMPTY); -+ virtio_add_feature(&dev->host_features[0], VIRTIO_F_BAD_FEATURE); -+ dev->host_features[0] = virtio_bus_get_vdev_features(&dev->bus, -+ dev->host_features[0]); -+ -+ css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, -+ d->hotplugged, 1); -+} -+ -+static void virtio_ccw_device_unplugged(DeviceState *d) -+{ -+ VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -+ -+ virtio_ccw_stop_ioeventfd(dev); -+} - /**************** Virtio-ccw Bus Device Descriptions *******************/ - - static Property virtio_ccw_net_properties[] = { -@@ -1717,6 +1726,8 @@ static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data) - k->load_queue = virtio_ccw_load_queue; - k->save_config = virtio_ccw_save_config; - k->load_config = virtio_ccw_load_config; -+ k->device_plugged = virtio_ccw_device_plugged; -+ k->device_unplugged = virtio_ccw_device_unplugged; - } - - static const TypeInfo virtio_ccw_bus_info = { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-introduce-ccw-specific-queue-limit.patch b/SOURCES/kvm-virtio-ccw-introduce-ccw-specific-queue-limit.patch deleted file mode 100644 index 93a8d84..0000000 --- a/SOURCES/kvm-virtio-ccw-introduce-ccw-specific-queue-limit.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 6f97a162f6f6e2918f656471401268730fe8d49d Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:50 +0200 -Subject: [PATCH 029/217] virtio-ccw: introduce ccw specific queue limit - -Message-id: <1434607916-15166-15-git-send-email-jasowang@redhat.com> -Patchwork-id: 66312 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 14/20] virtio-ccw: introduce ccw specific queue limit -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Notes: conflicts since 42874d3a8c6267ff7789a0396843c884b1d0933a - ("Switch non-CPU callers from ld/st*_phys to - address_space_ld/st*") was not backported. - -Cc: Alexander Graf <agraf@suse.de> -Cc: Cornelia Huck <cornelia.huck@de.ibm.com> -Cc: Christian Borntraeger <borntraeger@de.ibm.com> -Cc: Richard Henderson <rth@twiddle.net> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 8dfbaa6ac450c4ec2646b1ca08a4017052a90c1d) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/s390x/virtio-ccw.c ---- - hw/s390x/s390-virtio-ccw.c | 2 +- - hw/s390x/virtio-ccw.c | 12 ++++++------ - include/hw/s390x/s390_flic.h | 5 ++++- - 3 files changed, 11 insertions(+), 8 deletions(-) - -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index afb539a..8a565f6 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -67,7 +67,7 @@ static int virtio_ccw_hcall_notify(const uint64_t *args) - if (!sch || !css_subch_visible(sch)) { - return -EINVAL; - } -- if (queue >= VIRTIO_PCI_QUEUE_MAX) { -+ if (queue >= VIRTIO_CCW_QUEUE_MAX) { - return -EINVAL; - } - virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 28d2879..4ee38a3 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -170,7 +170,7 @@ static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) - return; - } - vdev = virtio_bus_get_device(&dev->bus); -- for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -+ for (n = 0; n < VIRTIO_CCW_QUEUE_MAX; n++) { - if (!virtio_queue_get_num(vdev, n)) { - continue; - } -@@ -205,7 +205,7 @@ static void virtio_ccw_stop_ioeventfd(VirtioCcwDevice *dev) - return; - } - vdev = virtio_bus_get_device(&dev->bus); -- for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -+ for (n = 0; n < VIRTIO_CCW_QUEUE_MAX; n++) { - if (!virtio_queue_get_num(vdev, n)) { - continue; - } -@@ -266,7 +266,7 @@ static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, - { - VirtIODevice *vdev = virtio_ccw_get_vdev(sch); - -- if (index >= VIRTIO_PCI_QUEUE_MAX) { -+ if (index >= VIRTIO_CCW_QUEUE_MAX) { - return -EINVAL; - } - -@@ -291,7 +291,7 @@ static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, - virtio_queue_set_vector(vdev, index, index); - } - /* tell notify handler in case of config change */ -- vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; -+ vdev->config_vector = VIRTIO_CCW_QUEUE_MAX; - return 0; - } - -@@ -549,7 +549,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - ret = -EFAULT; - } else { - vq_config.index = lduw_be_phys(&address_space_memory, ccw.cda); -- if (vq_config.index >= VIRTIO_PCI_QUEUE_MAX) { -+ if (vq_config.index >= VIRTIO_CCW_QUEUE_MAX) { - ret = -EINVAL; - break; - } -@@ -1026,7 +1026,7 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) - return; - } - -- if (vector < VIRTIO_PCI_QUEUE_MAX) { -+ if (vector < VIRTIO_CCW_QUEUE_MAX) { - if (!dev->indicators) { - return; - } -diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h -index 489d73b..200e7e9 100644 ---- a/include/hw/s390x/s390_flic.h -+++ b/include/hw/s390x/s390_flic.h -@@ -17,10 +17,13 @@ - #include "hw/s390x/adapter.h" - #include "hw/virtio/virtio.h" - -+#define ADAPTER_ROUTES_MAX_GSI 64 -+#define VIRTIO_CCW_QUEUE_MAX ADAPTER_ROUTES_MAX_GSI -+ - typedef struct AdapterRoutes { - AdapterInfo adapter; - int num_routes; -- int gsi[VIRTIO_PCI_QUEUE_MAX]; -+ int gsi[ADAPTER_ROUTES_MAX_GSI]; - } AdapterRoutes; - - #define TYPE_S390_FLIC_COMMON "s390-flic" --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-sort-into-categories.patch b/SOURCES/kvm-virtio-ccw-sort-into-categories.patch deleted file mode 100644 index 1e614bb..0000000 --- a/SOURCES/kvm-virtio-ccw-sort-into-categories.patch +++ /dev/null @@ -1,102 +0,0 @@ -From c32a53cacfa808b4636e66d2d84e213e3f0c9eda Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:38 +0200 -Subject: [PATCH 017/217] virtio-ccw: sort into categories - -Message-id: <1434607916-15166-3-git-send-email-jasowang@redhat.com> -Patchwork-id: 66301 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 02/20] virtio-ccw: sort into categories -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Sort the various virtio-ccw devices into the same categories as their -virtio-pci counterparts. - -Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> -Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -(cherry picked from commit cd20d61634092a9fa19c8c6f0a749526e9958374) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 0434f56..f102974 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -1418,6 +1418,7 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = virtio_ccw_net_properties; -+ set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - } - - static const TypeInfo virtio_ccw_net = { -@@ -1444,6 +1445,7 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = virtio_ccw_blk_properties; -+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - - static const TypeInfo virtio_ccw_blk = { -@@ -1470,6 +1472,7 @@ static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = virtio_ccw_serial_properties; -+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - } - - static const TypeInfo virtio_ccw_serial = { -@@ -1496,6 +1499,7 @@ static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = virtio_ccw_balloon_properties; -+ set_bit(DEVICE_CATEGORY_MISC, dc->categories); - } - - static const TypeInfo virtio_ccw_balloon = { -@@ -1523,6 +1527,7 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = virtio_ccw_scsi_properties; -+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - - static const TypeInfo virtio_ccw_scsi = { -@@ -1548,6 +1553,7 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = vhost_ccw_scsi_properties; -+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - } - - static const TypeInfo vhost_ccw_scsi = { -@@ -1585,6 +1591,7 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data) - k->exit = virtio_ccw_exit; - dc->reset = virtio_ccw_reset; - dc->props = virtio_ccw_rng_properties; -+ set_bit(DEVICE_CATEGORY_MISC, dc->categories); - } - - static const TypeInfo virtio_ccw_rng = { -@@ -1671,9 +1678,11 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) - { - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); -+ DeviceClass *dc = DEVICE_CLASS(klass); - - k->init = virtual_css_bridge_init; - hc->unplug = virtio_ccw_busdev_unplug; -+ set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - } - - static const TypeInfo virtual_css_bridge_info = { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-using-VIRTIO_NO_VECTOR-instead-of-0-for-i.patch b/SOURCES/kvm-virtio-ccw-using-VIRTIO_NO_VECTOR-instead-of-0-for-i.patch deleted file mode 100644 index fa0ffa1..0000000 --- a/SOURCES/kvm-virtio-ccw-using-VIRTIO_NO_VECTOR-instead-of-0-for-i.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 85a61ffc66d0d5b98585cc2e3e1b354f740ee214 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:37 +0200 -Subject: [PATCH 016/217] virtio-ccw: using VIRTIO_NO_VECTOR instead of 0 for - invalid virtqueue - -Message-id: <1434607916-15166-2-git-send-email-jasowang@redhat.com> -Patchwork-id: 66300 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 01/20] virtio-ccw: using VIRTIO_NO_VECTOR instead of 0 for invalid virtqueue -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -It's a bad idea to need to use vector 0 for invalid virtqueue. So this patch -changes to using VIRTIO_NO_VECTOR instead. - -Cc: Michael S. Tsirkin <mst@redhat.com> -Cc: Cornelia Huck <cornelia.huck@de.ibm.com> -CC: Christian Borntraeger <borntraeger@de.ibm.com> -Cc: Richard Henderson <rth@twiddle.net> -Cc: Alexander Graf <agraf@suse.de> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 955cc8c9541779e09895a9c5ccbf8ace15d884f5) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index d32ecaf..0434f56 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -281,7 +281,7 @@ static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, - - virtio_queue_set_addr(vdev, index, addr); - if (!addr) { -- virtio_queue_set_vector(vdev, index, 0); -+ virtio_queue_set_vector(vdev, index, VIRTIO_NO_VECTOR); - } else { - /* Fail if we don't have a big enough queue. */ - /* TODO: Add interface to handle vring.num changing */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-ccw-validate-the-number-of-queues-against-bus.patch b/SOURCES/kvm-virtio-ccw-validate-the-number-of-queues-against-bus.patch deleted file mode 100644 index 44932b5..0000000 --- a/SOURCES/kvm-virtio-ccw-validate-the-number-of-queues-against-bus.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7a56a3126851d7794672c92c3b8dfd9dac2936c9 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:51 +0200 -Subject: [PATCH 030/217] virtio-ccw: validate the number of queues against bus - limitation - -Message-id: <1434607916-15166-16-git-send-email-jasowang@redhat.com> -Patchwork-id: 66313 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 15/20] virtio-ccw: validate the number of queues against bus limitation -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Cc: Cornelia Huck <cornelia.huck@de.ibm.com> -Cc: Christian Borntraeger <borntraeger@de.ibm.com> -Cc: Richard Henderson <rth@twiddle.net> -Cc: Alexander Graf <agraf@suse.de> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 10ceaa1e8f9f74c917df1fe5db856817a8b26fe7) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/virtio-ccw.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 4ee38a3..534d6b6 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -1382,7 +1382,16 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) - static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) - { - VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); - SubchDev *sch = dev->sch; -+ int n = virtio_get_num_queues(vdev); -+ -+ if (virtio_get_num_queues(vdev) > VIRTIO_CCW_QUEUE_MAX) { -+ error_setg(errp, "The nubmer of virtqueues %d " -+ "exceeds ccw limit %d", n, -+ VIRTIO_CCW_QUEUE_MAX); -+ return; -+ } - - sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-device_plugged-can-fail.patch b/SOURCES/kvm-virtio-device_plugged-can-fail.patch deleted file mode 100644 index 920b2c6..0000000 --- a/SOURCES/kvm-virtio-device_plugged-can-fail.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 9c8e22f530543a2e79e0e80f7d5c696ca50e90a6 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:48 +0200 -Subject: [PATCH 027/217] virtio: device_plugged() can fail - -Message-id: <1434607916-15166-13-git-send-email-jasowang@redhat.com> -Patchwork-id: 66310 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 12/20] virtio: device_plugged() can fail -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Notes: conflicts since commit 6b8f1020540c27246277377aa2c3331ad2bfb160 - ("virtio: move host_features") was not backported. So still - need to add Error *parameter to mmio version of device_plugged - in RHEL7. - -This patch passes error pointer to transport specific device_plugged() -callback. Through this way, device_plugged() can do some transport -specific check and fail. This will be uesd by following patches that -check the number of virtqueues against the transport limitation. - -Cc: Cornelia Huck <cornelia.huck@de.ibm.com> -Cc: Christian Borntraeger <borntraeger@de.ibm.com> -Cc: Richard Henderson <rth@twiddle.net> -Cc: Alexander Graf <agraf@suse.de> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit e83980455c8c7eb066405de512be7c4bace3ac4d) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/virtio/virtio-bus.c ---- - hw/s390x/virtio-ccw.c | 2 +- - hw/virtio/virtio-bus.c | 5 ++--- - hw/virtio/virtio-mmio.c | 2 +- - hw/virtio/virtio-pci.c | 2 +- - hw/virtio/virtio.c | 7 ++++++- - include/hw/virtio/virtio-bus.h | 4 ++-- - 6 files changed, 13 insertions(+), 9 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index e68dcc7..28d2879 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -1379,7 +1379,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) - } - - /* This is called by virtio-bus just after the device is plugged. */ --static void virtio_ccw_device_plugged(DeviceState *d) -+static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) - { - VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); - SubchDev *sch = dev->sch; -diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c -index be886e7..24cde3d 100644 ---- a/hw/virtio/virtio-bus.c -+++ b/hw/virtio/virtio-bus.c -@@ -38,7 +38,7 @@ do { printf("virtio_bus: " fmt , ## __VA_ARGS__); } while (0) - #endif - - /* A VirtIODevice is being plugged */ --int virtio_bus_device_plugged(VirtIODevice *vdev) -+void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp) - { - DeviceState *qdev = DEVICE(vdev); - BusState *qbus = BUS(qdev_get_parent_bus(qdev)); -@@ -47,10 +47,9 @@ int virtio_bus_device_plugged(VirtIODevice *vdev) - DPRINTF("%s: plug device.\n", qbus->name); - - if (klass->device_plugged != NULL) { -- klass->device_plugged(qbus->parent); -+ klass->device_plugged(qbus->parent, errp); - } - -- return 0; - } - - /* Reset the virtio_bus */ -diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c -index 10123f3..dd3f80b 100644 ---- a/hw/virtio/virtio-mmio.c -+++ b/hw/virtio/virtio-mmio.c -@@ -345,7 +345,7 @@ static void virtio_mmio_reset(DeviceState *d) - /* virtio-mmio device */ - - /* This is called by virtio-bus just after the device is plugged. */ --static void virtio_mmio_device_plugged(DeviceState *opaque) -+static void virtio_mmio_device_plugged(DeviceState *opaque, Error **errp) - { - VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index b91e799..96d54f1 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -918,7 +918,7 @@ static int virtio_pci_query_nvectors(DeviceState *d) - } - - /* This is called by virtio-bus just after the device is plugged. */ --static void virtio_pci_device_plugged(DeviceState *d) -+static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - { - VirtIOPCIProxy *proxy = VIRTIO_PCI(d); - VirtioBusState *bus = &proxy->bus; -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 6985e76..0b50f9d 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -1328,7 +1328,12 @@ static void virtio_device_realize(DeviceState *dev, Error **errp) - return; - } - } -- virtio_bus_device_plugged(vdev); -+ -+ virtio_bus_device_plugged(vdev, &err); -+ if (err != NULL) { -+ error_propagate(errp, err); -+ return; -+ } - } - - static void virtio_device_unrealize(DeviceState *dev, Error **errp) -diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h -index a4588ca..e5bbfbf 100644 ---- a/include/hw/virtio/virtio-bus.h -+++ b/include/hw/virtio/virtio-bus.h -@@ -56,7 +56,7 @@ typedef struct VirtioBusClass { - * transport independent init function. - * This is called by virtio-bus just after the device is plugged. - */ -- void (*device_plugged)(DeviceState *d); -+ void (*device_plugged)(DeviceState *d, Error **errp); - /* - * transport independent exit function. - * This is called by virtio-bus just before the device is unplugged. -@@ -75,7 +75,7 @@ struct VirtioBusState { - BusState parent_obj; - }; - --int virtio_bus_device_plugged(VirtIODevice *vdev); -+void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp); - void virtio_bus_reset(VirtioBusState *bus); - void virtio_bus_device_unplugged(VirtIODevice *bus); - /* Get the device id of the plugged device. */ --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-disallow-late-feature-changes-for-virtio-1.patch b/SOURCES/kvm-virtio-disallow-late-feature-changes-for-virtio-1.patch deleted file mode 100644 index 603095c..0000000 --- a/SOURCES/kvm-virtio-disallow-late-feature-changes-for-virtio-1.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 48c92e245e1c034d1f7f2680740548d1edfd9947 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:30 +0200 -Subject: [PATCH 142/217] virtio: disallow late feature changes for virtio-1 - -Message-id: <1436260751-25015-28-git-send-email-jasowang@redhat.com> -Patchwork-id: 66802 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 27/68] virtio: disallow late feature changes for virtio-1 -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -For virtio-1 devices, the driver must not attempt to set feature bits -after it set FEATURES_OK in the device status. Simply reject it in -that case. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 6c0196d702e8482a17638ee79f45ce27cdd1ef5d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio.c | 18 +++++++++++++++--- - 1 file changed, 15 insertions(+), 3 deletions(-) - -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index c27e975..3367100 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -1021,7 +1021,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - vmstate_save_state(f, &vmstate_virtio, vdev, NULL); - } - --int virtio_set_features(VirtIODevice *vdev, uint64_t val) -+static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val) - { - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - bool bad = (val & ~(vdev->host_features)) != 0; -@@ -1034,6 +1034,18 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val) - return bad ? -1 : 0; - } - -+int virtio_set_features(VirtIODevice *vdev, uint64_t val) -+{ -+ /* -+ * The driver must not attempt to set features after feature negotiation -+ * has finished. -+ */ -+ if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) { -+ return -EINVAL; -+ } -+ return virtio_set_features_nocheck(vdev, val); -+} -+ - int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - { - int i, ret; -@@ -1137,14 +1149,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - * host_features. - */ - uint64_t features64 = vdev->guest_features; -- if (virtio_set_features(vdev, features64) < 0) { -+ if (virtio_set_features_nocheck(vdev, features64) < 0) { - error_report("Features 0x%" PRIx64 " unsupported. " - "Allowed features: 0x%" PRIx64, - features64, vdev->host_features); - return -1; - } - } else { -- if (virtio_set_features(vdev, features) < 0) { -+ if (virtio_set_features_nocheck(vdev, features) < 0) { - error_report("Features 0x%x unsupported. " - "Allowed features: 0x%" PRIx64, - features, vdev->host_features); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-endianness-checks-for-virtio-1.0-devices.patch b/SOURCES/kvm-virtio-endianness-checks-for-virtio-1.0-devices.patch deleted file mode 100644 index dfc65aa..0000000 --- a/SOURCES/kvm-virtio-endianness-checks-for-virtio-1.0-devices.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 21da65ec799379c149c06caafe9a604c18893a20 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:28 +0200 -Subject: [PATCH 140/217] virtio: endianness checks for virtio 1.0 devices - -Message-id: <1436260751-25015-26-git-send-email-jasowang@redhat.com> -Patchwork-id: 66800 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 25/68] virtio: endianness checks for virtio 1.0 devices -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Add code that checks for the VERSION_1 feature bit in order to make -decisions about the device's endianness. This allows us to support -transitional devices. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 3c185597c86b8cd0a07c46e7a5bd5aac28bb7200) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio.c | 6 +++++- - include/hw/virtio/virtio-access.h | 4 ++++ - include/hw/virtio/virtio.h | 8 ++++++-- - 3 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 8ac6156..d37d27b 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -903,7 +903,11 @@ static bool virtio_device_endian_needed(void *opaque) - VirtIODevice *vdev = opaque; - - assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); -- return vdev->device_endian != virtio_default_endian(); -+ if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { -+ return vdev->device_endian != virtio_default_endian(); -+ } -+ /* Devices conforming to VIRTIO 1.0 or later are always LE. */ -+ return vdev->device_endian != VIRTIO_DEVICE_ENDIAN_LITTLE; - } - - static bool virtio_64bit_features_needed(void *opaque) -diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h -index caf0940..cee5dd7 100644 ---- a/include/hw/virtio/virtio-access.h -+++ b/include/hw/virtio/virtio-access.h -@@ -19,6 +19,10 @@ - - static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) - { -+ if (virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { -+ /* Devices conforming to VIRTIO 1.0 or later are always LE. */ -+ return false; -+ } - #if defined(TARGET_IS_BIENDIAN) - return virtio_is_big_endian(vdev); - #elif defined(TARGET_WORDS_BIGENDIAN) -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 8e8b72d..eed7f4f 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -252,7 +252,11 @@ static inline bool virtio_has_feature(VirtIODevice *vdev, unsigned int fbit) - - static inline bool virtio_is_big_endian(VirtIODevice *vdev) - { -- assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); -- return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG; -+ if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { -+ assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); -+ return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG; -+ } -+ /* Devices conforming to VIRTIO 1.0 or later are always LE. */ -+ return false; - } - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-generation-counter-support.patch b/SOURCES/kvm-virtio-generation-counter-support.patch deleted file mode 100644 index 0011f08..0000000 --- a/SOURCES/kvm-virtio-generation-counter-support.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 2fe0f208950c3a4f0ea4c7b0ce68ff0ad7af122e Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:39 +0200 -Subject: [PATCH 151/217] virtio: generation counter support - -Message-id: <1436260751-25015-37-git-send-email-jasowang@redhat.com> -Patchwork-id: 66811 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 36/68] virtio: generation counter support -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit b8f059081d93f1802480059d1d49fe5c1d32f60c) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 2 +- - hw/virtio/virtio.c | 1 + - include/hw/virtio/virtio.h | 1 + - 3 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 5c69614..a41ceee 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -977,7 +977,7 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, - val = vdev->status; - break; - case VIRTIO_PCI_COMMON_CFGGENERATION: -- val = 0; /* TODO */ -+ val = vdev->generation; - break; - case VIRTIO_PCI_COMMON_Q_SELECT: - val = vdev->queue_sel; -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 8a6ebae..cae5eca 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -930,6 +930,7 @@ void virtio_notify_config(VirtIODevice *vdev) - return; - - vdev->isr |= 0x03; -+ vdev->generation++; - virtio_notify_vector(vdev, vdev->config_vector); - } - -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index effb8f8..96a32a1 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -78,6 +78,7 @@ struct VirtIODevice - size_t config_len; - void *config; - uint16_t config_vector; -+ uint32_t generation; - int nvectors; - VirtQueue *vq; - uint16_t device_id; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-increase-the-queue-limit-to-1024.patch b/SOURCES/kvm-virtio-increase-the-queue-limit-to-1024.patch deleted file mode 100644 index 5ee53e1..0000000 --- a/SOURCES/kvm-virtio-increase-the-queue-limit-to-1024.patch +++ /dev/null @@ -1,42 +0,0 @@ -From e4d6749aeae28f7e17d6877186c359ffd565a6e6 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:55 +0200 -Subject: [PATCH 034/217] virtio: increase the queue limit to 1024 - -Message-id: <1434607916-15166-20-git-send-email-jasowang@redhat.com> -Patchwork-id: 66318 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 19/20] virtio: increase the queue limit to 1024 -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Increase the queue limit to 1024. But virtio-ccw and s390-virtio won't -support this, this is done through failing device_plugged() for those -two transports if the number of virtqueues is greater than 64. - -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit b829c2a98f1f67308eb02fcddb52d8fa67775f18) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/virtio/virtio.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index a9e22af..fc0aeaa 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -48,7 +48,7 @@ typedef struct VirtQueueElement - struct iovec out_sg[VIRTQUEUE_MAX_SIZE]; - } VirtQueueElement; - --#define VIRTIO_QUEUE_MAX 64 -+#define VIRTIO_QUEUE_MAX 1024 - - #define VIRTIO_NO_VECTOR 0xffff - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-add-input-routing-support.patch b/SOURCES/kvm-virtio-input-add-input-routing-support.patch deleted file mode 100644 index 96ef79e..0000000 --- a/SOURCES/kvm-virtio-input-add-input-routing-support.patch +++ /dev/null @@ -1,113 +0,0 @@ -From d199670e5e24494e2f4a5f6bbc5ac59166de7bc7 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:10 +0200 -Subject: [PATCH 182/217] virtio-input: add input routing support - -Message-id: <1436260751-25015-68-git-send-email-jasowang@redhat.com> -Patchwork-id: 66842 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 67/68] virtio-input: add input routing support -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Add display and head properties for input routing to -virtio-input devices, update multiseat documentation. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 5cce173323cfe1bb22f7a10f9b73ac7796909cef) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - docs/multiseat.txt | 17 +++++++++++++++-- - hw/input/virtio-input-hid.c | 11 +++++++++++ - include/hw/virtio/virtio-input.h | 2 ++ - 3 files changed, 28 insertions(+), 2 deletions(-) - -diff --git a/docs/multiseat.txt b/docs/multiseat.txt -index b963665..e93d223 100644 ---- a/docs/multiseat.txt -+++ b/docs/multiseat.txt -@@ -2,8 +2,8 @@ - multiseat howto (with some multihead coverage) - ============================================== - --host side ----------- -+host devices -+------------ - - First you must compile qemu with a user interface supporting - multihead/multiseat and input event routing. Right now this -@@ -41,6 +41,19 @@ The "display=video2" sets up the input routing. Any input coming from - the window which belongs to the video.2 display adapter will be routed - to these input devices. - -+Starting with qemu 2.4 and linux kernel 4.1 you can also use virtio -+for the input devices, using this ... -+ -+ -device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \ -+ -device secondary-vga,bus=head.2,addr=02.0,id=video.2 \ -+ -device virtio-keyboard-pci,bus=head.2,addr=03.0,display=video.2 \ -+ -device virtio-tablet-pci,bus=head.2,addr=03.0,display=video.2 -+ -+... instead of xhci and usb hid devices. -+ -+host ui -+------- -+ - The sdl2 ui will start up with two windows, one for each display - device. The gtk ui will start with a single window and each display - in a separate tab. You can either simply switch tabs to switch heads, -diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c -index 32cc94a..616a815 100644 ---- a/hw/input/virtio-input-hid.c -+++ b/hw/input/virtio-input-hid.c -@@ -252,7 +252,11 @@ static void virtio_input_handle_sync(DeviceState *dev) - static void virtio_input_hid_realize(DeviceState *dev, Error **errp) - { - VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev); -+ - vhid->hs = qemu_input_handler_register(dev, vhid->handler); -+ if (vhid->display && vhid->hs) { -+ qemu_input_handler_bind(vhid->hs, vhid->display, vhid->head, NULL); -+ } - } - - static void virtio_input_hid_unrealize(DeviceState *dev, Error **errp) -@@ -301,10 +305,17 @@ static void virtio_input_hid_handle_status(VirtIOInput *vinput, - } - } - -+static Property virtio_input_hid_properties[] = { -+ DEFINE_PROP_STRING("display", VirtIOInputHID, display), -+ DEFINE_PROP_UINT32("head", VirtIOInputHID, head, 0), -+}; -+ - static void virtio_input_hid_class_init(ObjectClass *klass, void *data) - { -+ DeviceClass *dc = DEVICE_CLASS(klass); - VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass); - -+ dc->props = virtio_input_hid_properties; - vic->realize = virtio_input_hid_realize; - vic->unrealize = virtio_input_hid_unrealize; - vic->change_active = virtio_input_hid_change_active; -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -index fd5417d..af1c207 100644 ---- a/include/hw/virtio/virtio-input.h -+++ b/include/hw/virtio/virtio-input.h -@@ -95,6 +95,8 @@ struct VirtIOInputClass { - - struct VirtIOInputHID { - VirtIOInput parent_obj; -+ char *display; -+ uint32_t head; - QemuInputHandler *handler; - QemuInputHandlerState *hs; - int ledstate; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-add-linux-input.h.patch b/SOURCES/kvm-virtio-input-add-linux-input.h.patch deleted file mode 100644 index 6e04ff3..0000000 --- a/SOURCES/kvm-virtio-input-add-linux-input.h.patch +++ /dev/null @@ -1,1263 +0,0 @@ -From 8432fbb7c73dcddd5fc23bc472d0da2df707d9bf Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:05 +0200 -Subject: [PATCH 117/217] virtio-input: add linux/input.h - -Message-id: <1436260751-25015-3-git-send-email-jasowang@redhat.com> -Patchwork-id: 66777 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 02/68] virtio-input: add linux/input.h -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Linux input layer (evdev) header file. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 2fe7c31832a345cdc34314cdcd5478d06b884842) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/standard-headers/linux/input.h | 1198 ++++++++++++++++++++++++++++++++ - scripts/update-linux-headers.sh | 4 +- - 2 files changed, 1201 insertions(+), 1 deletion(-) - create mode 100644 include/standard-headers/linux/input.h - -diff --git a/include/standard-headers/linux/input.h b/include/standard-headers/linux/input.h -new file mode 100644 -index 0000000..b94d365 ---- /dev/null -+++ b/include/standard-headers/linux/input.h -@@ -0,0 +1,1198 @@ -+/* -+ * Copyright (c) 1999-2002 Vojtech Pavlik -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+#ifndef _INPUT_H -+#define _INPUT_H -+ -+ -+#include <sys/time.h> -+#include <sys/ioctl.h> -+#include <sys/types.h> -+#include "standard-headers/linux/types.h" -+ -+ -+/* -+ * The event structure itself -+ */ -+ -+struct input_event { -+ struct timeval time; -+ uint16_t type; -+ uint16_t code; -+ int32_t value; -+}; -+ -+/* -+ * Protocol version. -+ */ -+ -+#define EV_VERSION 0x010001 -+ -+/* -+ * IOCTLs (0x00 - 0x7f) -+ */ -+ -+struct input_id { -+ uint16_t bustype; -+ uint16_t vendor; -+ uint16_t product; -+ uint16_t version; -+}; -+ -+/** -+ * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls -+ * @value: latest reported value for the axis. -+ * @minimum: specifies minimum value for the axis. -+ * @maximum: specifies maximum value for the axis. -+ * @fuzz: specifies fuzz value that is used to filter noise from -+ * the event stream. -+ * @flat: values that are within this value will be discarded by -+ * joydev interface and reported as 0 instead. -+ * @resolution: specifies resolution for the values reported for -+ * the axis. -+ * -+ * Note that input core does not clamp reported values to the -+ * [minimum, maximum] limits, such task is left to userspace. -+ * -+ * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in -+ * units per millimeter (units/mm), resolution for rotational axes -+ * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. -+ */ -+struct input_absinfo { -+ int32_t value; -+ int32_t minimum; -+ int32_t maximum; -+ int32_t fuzz; -+ int32_t flat; -+ int32_t resolution; -+}; -+ -+/** -+ * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls -+ * @scancode: scancode represented in machine-endian form. -+ * @len: length of the scancode that resides in @scancode buffer. -+ * @index: index in the keymap, may be used instead of scancode -+ * @flags: allows to specify how kernel should handle the request. For -+ * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel -+ * should perform lookup in keymap by @index instead of @scancode -+ * @keycode: key code assigned to this scancode -+ * -+ * The structure is used to retrieve and modify keymap data. Users have -+ * option of performing lookup either by @scancode itself or by @index -+ * in keymap entry. EVIOCGKEYCODE will also return scancode or index -+ * (depending on which element was used to perform lookup). -+ */ -+struct input_keymap_entry { -+#define INPUT_KEYMAP_BY_INDEX (1 << 0) -+ uint8_t flags; -+ uint8_t len; -+ uint16_t index; -+ uint32_t keycode; -+ uint8_t scancode[32]; -+}; -+ -+#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ -+#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ -+#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ -+#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ -+ -+#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ -+#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) -+#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ -+#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) -+ -+#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ -+#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ -+#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ -+#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ -+ -+/** -+ * EVIOCGMTSLOTS(len) - get MT slot values -+ * @len: size of the data buffer in bytes -+ * -+ * The ioctl buffer argument should be binary equivalent to -+ * -+ * struct input_mt_request_layout { -+ * uint32_t code; -+ * int32_t values[num_slots]; -+ * }; -+ * -+ * where num_slots is the (arbitrary) number of MT slots to extract. -+ * -+ * The ioctl size argument (len) is the size of the buffer, which -+ * should satisfy len = (num_slots + 1) * sizeof(int32_t). If len is -+ * too small to fit all available slots, the first num_slots are -+ * returned. -+ * -+ * Before the call, code is set to the wanted ABS_MT event type. On -+ * return, values[] is filled with the slot values for the specified -+ * ABS_MT code. -+ * -+ * If the request code is not an ABS_MT value, -EINVAL is returned. -+ */ -+#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len) -+ -+#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ -+#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ -+#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ -+#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ -+ -+#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */ -+#define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */ -+#define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */ -+ -+#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ -+#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ -+#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ -+ -+#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ -+#define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */ -+ -+#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ -+ -+/* -+ * Device properties and quirks -+ */ -+ -+#define INPUT_PROP_POINTER 0x00 /* needs a pointer */ -+#define INPUT_PROP_DIRECT 0x01 /* direct input devices */ -+#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ -+#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ -+#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ -+#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ -+#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ -+ -+#define INPUT_PROP_MAX 0x1f -+#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) -+ -+/* -+ * Event types -+ */ -+ -+#define EV_SYN 0x00 -+#define EV_KEY 0x01 -+#define EV_REL 0x02 -+#define EV_ABS 0x03 -+#define EV_MSC 0x04 -+#define EV_SW 0x05 -+#define EV_LED 0x11 -+#define EV_SND 0x12 -+#define EV_REP 0x14 -+#define EV_FF 0x15 -+#define EV_PWR 0x16 -+#define EV_FF_STATUS 0x17 -+#define EV_MAX 0x1f -+#define EV_CNT (EV_MAX+1) -+ -+/* -+ * Synchronization events. -+ */ -+ -+#define SYN_REPORT 0 -+#define SYN_CONFIG 1 -+#define SYN_MT_REPORT 2 -+#define SYN_DROPPED 3 -+#define SYN_MAX 0xf -+#define SYN_CNT (SYN_MAX+1) -+ -+/* -+ * Keys and buttons -+ * -+ * Most of the keys/buttons are modeled after USB HUT 1.12 -+ * (see http://www.usb.org/developers/hidpage). -+ * Abbreviations in the comments: -+ * AC - Application Control -+ * AL - Application Launch Button -+ * SC - System Control -+ */ -+ -+#define KEY_RESERVED 0 -+#define KEY_ESC 1 -+#define KEY_1 2 -+#define KEY_2 3 -+#define KEY_3 4 -+#define KEY_4 5 -+#define KEY_5 6 -+#define KEY_6 7 -+#define KEY_7 8 -+#define KEY_8 9 -+#define KEY_9 10 -+#define KEY_0 11 -+#define KEY_MINUS 12 -+#define KEY_EQUAL 13 -+#define KEY_BACKSPACE 14 -+#define KEY_TAB 15 -+#define KEY_Q 16 -+#define KEY_W 17 -+#define KEY_E 18 -+#define KEY_R 19 -+#define KEY_T 20 -+#define KEY_Y 21 -+#define KEY_U 22 -+#define KEY_I 23 -+#define KEY_O 24 -+#define KEY_P 25 -+#define KEY_LEFTBRACE 26 -+#define KEY_RIGHTBRACE 27 -+#define KEY_ENTER 28 -+#define KEY_LEFTCTRL 29 -+#define KEY_A 30 -+#define KEY_S 31 -+#define KEY_D 32 -+#define KEY_F 33 -+#define KEY_G 34 -+#define KEY_H 35 -+#define KEY_J 36 -+#define KEY_K 37 -+#define KEY_L 38 -+#define KEY_SEMICOLON 39 -+#define KEY_APOSTROPHE 40 -+#define KEY_GRAVE 41 -+#define KEY_LEFTSHIFT 42 -+#define KEY_BACKSLASH 43 -+#define KEY_Z 44 -+#define KEY_X 45 -+#define KEY_C 46 -+#define KEY_V 47 -+#define KEY_B 48 -+#define KEY_N 49 -+#define KEY_M 50 -+#define KEY_COMMA 51 -+#define KEY_DOT 52 -+#define KEY_SLASH 53 -+#define KEY_RIGHTSHIFT 54 -+#define KEY_KPASTERISK 55 -+#define KEY_LEFTALT 56 -+#define KEY_SPACE 57 -+#define KEY_CAPSLOCK 58 -+#define KEY_F1 59 -+#define KEY_F2 60 -+#define KEY_F3 61 -+#define KEY_F4 62 -+#define KEY_F5 63 -+#define KEY_F6 64 -+#define KEY_F7 65 -+#define KEY_F8 66 -+#define KEY_F9 67 -+#define KEY_F10 68 -+#define KEY_NUMLOCK 69 -+#define KEY_SCROLLLOCK 70 -+#define KEY_KP7 71 -+#define KEY_KP8 72 -+#define KEY_KP9 73 -+#define KEY_KPMINUS 74 -+#define KEY_KP4 75 -+#define KEY_KP5 76 -+#define KEY_KP6 77 -+#define KEY_KPPLUS 78 -+#define KEY_KP1 79 -+#define KEY_KP2 80 -+#define KEY_KP3 81 -+#define KEY_KP0 82 -+#define KEY_KPDOT 83 -+ -+#define KEY_ZENKAKUHANKAKU 85 -+#define KEY_102ND 86 -+#define KEY_F11 87 -+#define KEY_F12 88 -+#define KEY_RO 89 -+#define KEY_KATAKANA 90 -+#define KEY_HIRAGANA 91 -+#define KEY_HENKAN 92 -+#define KEY_KATAKANAHIRAGANA 93 -+#define KEY_MUHENKAN 94 -+#define KEY_KPJPCOMMA 95 -+#define KEY_KPENTER 96 -+#define KEY_RIGHTCTRL 97 -+#define KEY_KPSLASH 98 -+#define KEY_SYSRQ 99 -+#define KEY_RIGHTALT 100 -+#define KEY_LINEFEED 101 -+#define KEY_HOME 102 -+#define KEY_UP 103 -+#define KEY_PAGEUP 104 -+#define KEY_LEFT 105 -+#define KEY_RIGHT 106 -+#define KEY_END 107 -+#define KEY_DOWN 108 -+#define KEY_PAGEDOWN 109 -+#define KEY_INSERT 110 -+#define KEY_DELETE 111 -+#define KEY_MACRO 112 -+#define KEY_MUTE 113 -+#define KEY_VOLUMEDOWN 114 -+#define KEY_VOLUMEUP 115 -+#define KEY_POWER 116 /* SC System Power Down */ -+#define KEY_KPEQUAL 117 -+#define KEY_KPPLUSMINUS 118 -+#define KEY_PAUSE 119 -+#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ -+ -+#define KEY_KPCOMMA 121 -+#define KEY_HANGEUL 122 -+#define KEY_HANGUEL KEY_HANGEUL -+#define KEY_HANJA 123 -+#define KEY_YEN 124 -+#define KEY_LEFTMETA 125 -+#define KEY_RIGHTMETA 126 -+#define KEY_COMPOSE 127 -+ -+#define KEY_STOP 128 /* AC Stop */ -+#define KEY_AGAIN 129 -+#define KEY_PROPS 130 /* AC Properties */ -+#define KEY_UNDO 131 /* AC Undo */ -+#define KEY_FRONT 132 -+#define KEY_COPY 133 /* AC Copy */ -+#define KEY_OPEN 134 /* AC Open */ -+#define KEY_PASTE 135 /* AC Paste */ -+#define KEY_FIND 136 /* AC Search */ -+#define KEY_CUT 137 /* AC Cut */ -+#define KEY_HELP 138 /* AL Integrated Help Center */ -+#define KEY_MENU 139 /* Menu (show menu) */ -+#define KEY_CALC 140 /* AL Calculator */ -+#define KEY_SETUP 141 -+#define KEY_SLEEP 142 /* SC System Sleep */ -+#define KEY_WAKEUP 143 /* System Wake Up */ -+#define KEY_FILE 144 /* AL Local Machine Browser */ -+#define KEY_SENDFILE 145 -+#define KEY_DELETEFILE 146 -+#define KEY_XFER 147 -+#define KEY_PROG1 148 -+#define KEY_PROG2 149 -+#define KEY_WWW 150 /* AL Internet Browser */ -+#define KEY_MSDOS 151 -+#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ -+#define KEY_SCREENLOCK KEY_COFFEE -+#define KEY_DIRECTION 153 -+#define KEY_CYCLEWINDOWS 154 -+#define KEY_MAIL 155 -+#define KEY_BOOKMARKS 156 /* AC Bookmarks */ -+#define KEY_COMPUTER 157 -+#define KEY_BACK 158 /* AC Back */ -+#define KEY_FORWARD 159 /* AC Forward */ -+#define KEY_CLOSECD 160 -+#define KEY_EJECTCD 161 -+#define KEY_EJECTCLOSECD 162 -+#define KEY_NEXTSONG 163 -+#define KEY_PLAYPAUSE 164 -+#define KEY_PREVIOUSSONG 165 -+#define KEY_STOPCD 166 -+#define KEY_RECORD 167 -+#define KEY_REWIND 168 -+#define KEY_PHONE 169 /* Media Select Telephone */ -+#define KEY_ISO 170 -+#define KEY_CONFIG 171 /* AL Consumer Control Configuration */ -+#define KEY_HOMEPAGE 172 /* AC Home */ -+#define KEY_REFRESH 173 /* AC Refresh */ -+#define KEY_EXIT 174 /* AC Exit */ -+#define KEY_MOVE 175 -+#define KEY_EDIT 176 -+#define KEY_SCROLLUP 177 -+#define KEY_SCROLLDOWN 178 -+#define KEY_KPLEFTPAREN 179 -+#define KEY_KPRIGHTPAREN 180 -+#define KEY_NEW 181 /* AC New */ -+#define KEY_REDO 182 /* AC Redo/Repeat */ -+ -+#define KEY_F13 183 -+#define KEY_F14 184 -+#define KEY_F15 185 -+#define KEY_F16 186 -+#define KEY_F17 187 -+#define KEY_F18 188 -+#define KEY_F19 189 -+#define KEY_F20 190 -+#define KEY_F21 191 -+#define KEY_F22 192 -+#define KEY_F23 193 -+#define KEY_F24 194 -+ -+#define KEY_PLAYCD 200 -+#define KEY_PAUSECD 201 -+#define KEY_PROG3 202 -+#define KEY_PROG4 203 -+#define KEY_DASHBOARD 204 /* AL Dashboard */ -+#define KEY_SUSPEND 205 -+#define KEY_CLOSE 206 /* AC Close */ -+#define KEY_PLAY 207 -+#define KEY_FASTFORWARD 208 -+#define KEY_BASSBOOST 209 -+#define KEY_PRINT 210 /* AC Print */ -+#define KEY_HP 211 -+#define KEY_CAMERA 212 -+#define KEY_SOUND 213 -+#define KEY_QUESTION 214 -+#define KEY_EMAIL 215 -+#define KEY_CHAT 216 -+#define KEY_SEARCH 217 -+#define KEY_CONNECT 218 -+#define KEY_FINANCE 219 /* AL Checkbook/Finance */ -+#define KEY_SPORT 220 -+#define KEY_SHOP 221 -+#define KEY_ALTERASE 222 -+#define KEY_CANCEL 223 /* AC Cancel */ -+#define KEY_BRIGHTNESSDOWN 224 -+#define KEY_BRIGHTNESSUP 225 -+#define KEY_MEDIA 226 -+ -+#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video -+ outputs (Monitor/LCD/TV-out/etc) */ -+#define KEY_KBDILLUMTOGGLE 228 -+#define KEY_KBDILLUMDOWN 229 -+#define KEY_KBDILLUMUP 230 -+ -+#define KEY_SEND 231 /* AC Send */ -+#define KEY_REPLY 232 /* AC Reply */ -+#define KEY_FORWARDMAIL 233 /* AC Forward Msg */ -+#define KEY_SAVE 234 /* AC Save */ -+#define KEY_DOCUMENTS 235 -+ -+#define KEY_BATTERY 236 -+ -+#define KEY_BLUETOOTH 237 -+#define KEY_WLAN 238 -+#define KEY_UWB 239 -+ -+#define KEY_UNKNOWN 240 -+ -+#define KEY_VIDEO_NEXT 241 /* drive next video source */ -+#define KEY_VIDEO_PREV 242 /* drive previous video source */ -+#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ -+#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual -+ brightness control is off, -+ rely on ambient */ -+#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO -+#define KEY_DISPLAY_OFF 245 /* display device to off state */ -+ -+#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */ -+#define KEY_WIMAX KEY_WWAN -+#define KEY_RFKILL 247 /* Key that controls all radios */ -+ -+#define KEY_MICMUTE 248 /* Mute / unmute the microphone */ -+ -+/* Code 255 is reserved for special needs of AT keyboard driver */ -+ -+#define BTN_MISC 0x100 -+#define BTN_0 0x100 -+#define BTN_1 0x101 -+#define BTN_2 0x102 -+#define BTN_3 0x103 -+#define BTN_4 0x104 -+#define BTN_5 0x105 -+#define BTN_6 0x106 -+#define BTN_7 0x107 -+#define BTN_8 0x108 -+#define BTN_9 0x109 -+ -+#define BTN_MOUSE 0x110 -+#define BTN_LEFT 0x110 -+#define BTN_RIGHT 0x111 -+#define BTN_MIDDLE 0x112 -+#define BTN_SIDE 0x113 -+#define BTN_EXTRA 0x114 -+#define BTN_FORWARD 0x115 -+#define BTN_BACK 0x116 -+#define BTN_TASK 0x117 -+ -+#define BTN_JOYSTICK 0x120 -+#define BTN_TRIGGER 0x120 -+#define BTN_THUMB 0x121 -+#define BTN_THUMB2 0x122 -+#define BTN_TOP 0x123 -+#define BTN_TOP2 0x124 -+#define BTN_PINKIE 0x125 -+#define BTN_BASE 0x126 -+#define BTN_BASE2 0x127 -+#define BTN_BASE3 0x128 -+#define BTN_BASE4 0x129 -+#define BTN_BASE5 0x12a -+#define BTN_BASE6 0x12b -+#define BTN_DEAD 0x12f -+ -+#define BTN_GAMEPAD 0x130 -+#define BTN_SOUTH 0x130 -+#define BTN_A BTN_SOUTH -+#define BTN_EAST 0x131 -+#define BTN_B BTN_EAST -+#define BTN_C 0x132 -+#define BTN_NORTH 0x133 -+#define BTN_X BTN_NORTH -+#define BTN_WEST 0x134 -+#define BTN_Y BTN_WEST -+#define BTN_Z 0x135 -+#define BTN_TL 0x136 -+#define BTN_TR 0x137 -+#define BTN_TL2 0x138 -+#define BTN_TR2 0x139 -+#define BTN_SELECT 0x13a -+#define BTN_START 0x13b -+#define BTN_MODE 0x13c -+#define BTN_THUMBL 0x13d -+#define BTN_THUMBR 0x13e -+ -+#define BTN_DIGI 0x140 -+#define BTN_TOOL_PEN 0x140 -+#define BTN_TOOL_RUBBER 0x141 -+#define BTN_TOOL_BRUSH 0x142 -+#define BTN_TOOL_PENCIL 0x143 -+#define BTN_TOOL_AIRBRUSH 0x144 -+#define BTN_TOOL_FINGER 0x145 -+#define BTN_TOOL_MOUSE 0x146 -+#define BTN_TOOL_LENS 0x147 -+#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ -+#define BTN_TOUCH 0x14a -+#define BTN_STYLUS 0x14b -+#define BTN_STYLUS2 0x14c -+#define BTN_TOOL_DOUBLETAP 0x14d -+#define BTN_TOOL_TRIPLETAP 0x14e -+#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ -+ -+#define BTN_WHEEL 0x150 -+#define BTN_GEAR_DOWN 0x150 -+#define BTN_GEAR_UP 0x151 -+ -+#define KEY_OK 0x160 -+#define KEY_SELECT 0x161 -+#define KEY_GOTO 0x162 -+#define KEY_CLEAR 0x163 -+#define KEY_POWER2 0x164 -+#define KEY_OPTION 0x165 -+#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ -+#define KEY_TIME 0x167 -+#define KEY_VENDOR 0x168 -+#define KEY_ARCHIVE 0x169 -+#define KEY_PROGRAM 0x16a /* Media Select Program Guide */ -+#define KEY_CHANNEL 0x16b -+#define KEY_FAVORITES 0x16c -+#define KEY_EPG 0x16d -+#define KEY_PVR 0x16e /* Media Select Home */ -+#define KEY_MHP 0x16f -+#define KEY_LANGUAGE 0x170 -+#define KEY_TITLE 0x171 -+#define KEY_SUBTITLE 0x172 -+#define KEY_ANGLE 0x173 -+#define KEY_ZOOM 0x174 -+#define KEY_MODE 0x175 -+#define KEY_KEYBOARD 0x176 -+#define KEY_SCREEN 0x177 -+#define KEY_PC 0x178 /* Media Select Computer */ -+#define KEY_TV 0x179 /* Media Select TV */ -+#define KEY_TV2 0x17a /* Media Select Cable */ -+#define KEY_VCR 0x17b /* Media Select VCR */ -+#define KEY_VCR2 0x17c /* VCR Plus */ -+#define KEY_SAT 0x17d /* Media Select Satellite */ -+#define KEY_SAT2 0x17e -+#define KEY_CD 0x17f /* Media Select CD */ -+#define KEY_TAPE 0x180 /* Media Select Tape */ -+#define KEY_RADIO 0x181 -+#define KEY_TUNER 0x182 /* Media Select Tuner */ -+#define KEY_PLAYER 0x183 -+#define KEY_TEXT 0x184 -+#define KEY_DVD 0x185 /* Media Select DVD */ -+#define KEY_AUX 0x186 -+#define KEY_MP3 0x187 -+#define KEY_AUDIO 0x188 /* AL Audio Browser */ -+#define KEY_VIDEO 0x189 /* AL Movie Browser */ -+#define KEY_DIRECTORY 0x18a -+#define KEY_LIST 0x18b -+#define KEY_MEMO 0x18c /* Media Select Messages */ -+#define KEY_CALENDAR 0x18d -+#define KEY_RED 0x18e -+#define KEY_GREEN 0x18f -+#define KEY_YELLOW 0x190 -+#define KEY_BLUE 0x191 -+#define KEY_CHANNELUP 0x192 /* Channel Increment */ -+#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ -+#define KEY_FIRST 0x194 -+#define KEY_LAST 0x195 /* Recall Last */ -+#define KEY_AB 0x196 -+#define KEY_NEXT 0x197 -+#define KEY_RESTART 0x198 -+#define KEY_SLOW 0x199 -+#define KEY_SHUFFLE 0x19a -+#define KEY_BREAK 0x19b -+#define KEY_PREVIOUS 0x19c -+#define KEY_DIGITS 0x19d -+#define KEY_TEEN 0x19e -+#define KEY_TWEN 0x19f -+#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ -+#define KEY_GAMES 0x1a1 /* Media Select Games */ -+#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ -+#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ -+#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ -+#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ -+#define KEY_EDITOR 0x1a6 /* AL Text Editor */ -+#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ -+#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ -+#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ -+#define KEY_DATABASE 0x1aa /* AL Database App */ -+#define KEY_NEWS 0x1ab /* AL Newsreader */ -+#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ -+#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ -+#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ -+#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ -+#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE -+#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ -+#define KEY_LOGOFF 0x1b1 /* AL Logoff */ -+ -+#define KEY_DOLLAR 0x1b2 -+#define KEY_EURO 0x1b3 -+ -+#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ -+#define KEY_FRAMEFORWARD 0x1b5 -+#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ -+#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ -+#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ -+#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ -+#define KEY_IMAGES 0x1ba /* AL Image Browser */ -+ -+#define KEY_DEL_EOL 0x1c0 -+#define KEY_DEL_EOS 0x1c1 -+#define KEY_INS_LINE 0x1c2 -+#define KEY_DEL_LINE 0x1c3 -+ -+#define KEY_FN 0x1d0 -+#define KEY_FN_ESC 0x1d1 -+#define KEY_FN_F1 0x1d2 -+#define KEY_FN_F2 0x1d3 -+#define KEY_FN_F3 0x1d4 -+#define KEY_FN_F4 0x1d5 -+#define KEY_FN_F5 0x1d6 -+#define KEY_FN_F6 0x1d7 -+#define KEY_FN_F7 0x1d8 -+#define KEY_FN_F8 0x1d9 -+#define KEY_FN_F9 0x1da -+#define KEY_FN_F10 0x1db -+#define KEY_FN_F11 0x1dc -+#define KEY_FN_F12 0x1dd -+#define KEY_FN_1 0x1de -+#define KEY_FN_2 0x1df -+#define KEY_FN_D 0x1e0 -+#define KEY_FN_E 0x1e1 -+#define KEY_FN_F 0x1e2 -+#define KEY_FN_S 0x1e3 -+#define KEY_FN_B 0x1e4 -+ -+#define KEY_BRL_DOT1 0x1f1 -+#define KEY_BRL_DOT2 0x1f2 -+#define KEY_BRL_DOT3 0x1f3 -+#define KEY_BRL_DOT4 0x1f4 -+#define KEY_BRL_DOT5 0x1f5 -+#define KEY_BRL_DOT6 0x1f6 -+#define KEY_BRL_DOT7 0x1f7 -+#define KEY_BRL_DOT8 0x1f8 -+#define KEY_BRL_DOT9 0x1f9 -+#define KEY_BRL_DOT10 0x1fa -+ -+#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ -+#define KEY_NUMERIC_1 0x201 /* and other keypads */ -+#define KEY_NUMERIC_2 0x202 -+#define KEY_NUMERIC_3 0x203 -+#define KEY_NUMERIC_4 0x204 -+#define KEY_NUMERIC_5 0x205 -+#define KEY_NUMERIC_6 0x206 -+#define KEY_NUMERIC_7 0x207 -+#define KEY_NUMERIC_8 0x208 -+#define KEY_NUMERIC_9 0x209 -+#define KEY_NUMERIC_STAR 0x20a -+#define KEY_NUMERIC_POUND 0x20b -+ -+#define KEY_CAMERA_FOCUS 0x210 -+#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ -+ -+#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ -+#define KEY_TOUCHPAD_ON 0x213 -+#define KEY_TOUCHPAD_OFF 0x214 -+ -+#define KEY_CAMERA_ZOOMIN 0x215 -+#define KEY_CAMERA_ZOOMOUT 0x216 -+#define KEY_CAMERA_UP 0x217 -+#define KEY_CAMERA_DOWN 0x218 -+#define KEY_CAMERA_LEFT 0x219 -+#define KEY_CAMERA_RIGHT 0x21a -+ -+#define KEY_ATTENDANT_ON 0x21b -+#define KEY_ATTENDANT_OFF 0x21c -+#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */ -+#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */ -+ -+#define BTN_DPAD_UP 0x220 -+#define BTN_DPAD_DOWN 0x221 -+#define BTN_DPAD_LEFT 0x222 -+#define BTN_DPAD_RIGHT 0x223 -+ -+#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ -+ -+#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ -+#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ -+#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */ -+#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */ -+#define KEY_APPSELECT 0x244 /* AL Select Task/Application */ -+#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ -+#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ -+ -+#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ -+#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ -+ -+#define KEY_KBDINPUTASSIST_PREV 0x260 -+#define KEY_KBDINPUTASSIST_NEXT 0x261 -+#define KEY_KBDINPUTASSIST_PREVGROUP 0x262 -+#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 -+#define KEY_KBDINPUTASSIST_ACCEPT 0x264 -+#define KEY_KBDINPUTASSIST_CANCEL 0x265 -+ -+#define BTN_TRIGGER_HAPPY 0x2c0 -+#define BTN_TRIGGER_HAPPY1 0x2c0 -+#define BTN_TRIGGER_HAPPY2 0x2c1 -+#define BTN_TRIGGER_HAPPY3 0x2c2 -+#define BTN_TRIGGER_HAPPY4 0x2c3 -+#define BTN_TRIGGER_HAPPY5 0x2c4 -+#define BTN_TRIGGER_HAPPY6 0x2c5 -+#define BTN_TRIGGER_HAPPY7 0x2c6 -+#define BTN_TRIGGER_HAPPY8 0x2c7 -+#define BTN_TRIGGER_HAPPY9 0x2c8 -+#define BTN_TRIGGER_HAPPY10 0x2c9 -+#define BTN_TRIGGER_HAPPY11 0x2ca -+#define BTN_TRIGGER_HAPPY12 0x2cb -+#define BTN_TRIGGER_HAPPY13 0x2cc -+#define BTN_TRIGGER_HAPPY14 0x2cd -+#define BTN_TRIGGER_HAPPY15 0x2ce -+#define BTN_TRIGGER_HAPPY16 0x2cf -+#define BTN_TRIGGER_HAPPY17 0x2d0 -+#define BTN_TRIGGER_HAPPY18 0x2d1 -+#define BTN_TRIGGER_HAPPY19 0x2d2 -+#define BTN_TRIGGER_HAPPY20 0x2d3 -+#define BTN_TRIGGER_HAPPY21 0x2d4 -+#define BTN_TRIGGER_HAPPY22 0x2d5 -+#define BTN_TRIGGER_HAPPY23 0x2d6 -+#define BTN_TRIGGER_HAPPY24 0x2d7 -+#define BTN_TRIGGER_HAPPY25 0x2d8 -+#define BTN_TRIGGER_HAPPY26 0x2d9 -+#define BTN_TRIGGER_HAPPY27 0x2da -+#define BTN_TRIGGER_HAPPY28 0x2db -+#define BTN_TRIGGER_HAPPY29 0x2dc -+#define BTN_TRIGGER_HAPPY30 0x2dd -+#define BTN_TRIGGER_HAPPY31 0x2de -+#define BTN_TRIGGER_HAPPY32 0x2df -+#define BTN_TRIGGER_HAPPY33 0x2e0 -+#define BTN_TRIGGER_HAPPY34 0x2e1 -+#define BTN_TRIGGER_HAPPY35 0x2e2 -+#define BTN_TRIGGER_HAPPY36 0x2e3 -+#define BTN_TRIGGER_HAPPY37 0x2e4 -+#define BTN_TRIGGER_HAPPY38 0x2e5 -+#define BTN_TRIGGER_HAPPY39 0x2e6 -+#define BTN_TRIGGER_HAPPY40 0x2e7 -+ -+/* We avoid low common keys in module aliases so they don't get huge. */ -+#define KEY_MIN_INTERESTING KEY_MUTE -+#define KEY_MAX 0x2ff -+#define KEY_CNT (KEY_MAX+1) -+ -+/* -+ * Relative axes -+ */ -+ -+#define REL_X 0x00 -+#define REL_Y 0x01 -+#define REL_Z 0x02 -+#define REL_RX 0x03 -+#define REL_RY 0x04 -+#define REL_RZ 0x05 -+#define REL_HWHEEL 0x06 -+#define REL_DIAL 0x07 -+#define REL_WHEEL 0x08 -+#define REL_MISC 0x09 -+#define REL_MAX 0x0f -+#define REL_CNT (REL_MAX+1) -+ -+/* -+ * Absolute axes -+ */ -+ -+#define ABS_X 0x00 -+#define ABS_Y 0x01 -+#define ABS_Z 0x02 -+#define ABS_RX 0x03 -+#define ABS_RY 0x04 -+#define ABS_RZ 0x05 -+#define ABS_THROTTLE 0x06 -+#define ABS_RUDDER 0x07 -+#define ABS_WHEEL 0x08 -+#define ABS_GAS 0x09 -+#define ABS_BRAKE 0x0a -+#define ABS_HAT0X 0x10 -+#define ABS_HAT0Y 0x11 -+#define ABS_HAT1X 0x12 -+#define ABS_HAT1Y 0x13 -+#define ABS_HAT2X 0x14 -+#define ABS_HAT2Y 0x15 -+#define ABS_HAT3X 0x16 -+#define ABS_HAT3Y 0x17 -+#define ABS_PRESSURE 0x18 -+#define ABS_DISTANCE 0x19 -+#define ABS_TILT_X 0x1a -+#define ABS_TILT_Y 0x1b -+#define ABS_TOOL_WIDTH 0x1c -+ -+#define ABS_VOLUME 0x20 -+ -+#define ABS_MISC 0x28 -+ -+#define ABS_MT_SLOT 0x2f /* MT slot being modified */ -+#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ -+#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ -+#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ -+#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ -+#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ -+#define ABS_MT_POSITION_X 0x35 /* Center X touch position */ -+#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */ -+#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ -+#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ -+#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ -+#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ -+#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ -+#define ABS_MT_TOOL_X 0x3c /* Center X tool position */ -+#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ -+ -+ -+#define ABS_MAX 0x3f -+#define ABS_CNT (ABS_MAX+1) -+ -+/* -+ * Switch events -+ */ -+ -+#define SW_LID 0x00 /* set = lid shut */ -+#define SW_TABLET_MODE 0x01 /* set = tablet mode */ -+#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ -+#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" -+ set = radio enabled */ -+#define SW_RADIO SW_RFKILL_ALL /* deprecated */ -+#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ -+#define SW_DOCK 0x05 /* set = plugged into dock */ -+#define SW_LINEOUT_INSERT 0x06 /* set = inserted */ -+#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ -+#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ -+#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ -+#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ -+#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ -+#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ -+#define SW_LINEIN_INSERT 0x0d /* set = inserted */ -+#define SW_MUTE_DEVICE 0x0e /* set = device disabled */ -+#define SW_MAX 0x0f -+#define SW_CNT (SW_MAX+1) -+ -+/* -+ * Misc events -+ */ -+ -+#define MSC_SERIAL 0x00 -+#define MSC_PULSELED 0x01 -+#define MSC_GESTURE 0x02 -+#define MSC_RAW 0x03 -+#define MSC_SCAN 0x04 -+#define MSC_TIMESTAMP 0x05 -+#define MSC_MAX 0x07 -+#define MSC_CNT (MSC_MAX+1) -+ -+/* -+ * LEDs -+ */ -+ -+#define LED_NUML 0x00 -+#define LED_CAPSL 0x01 -+#define LED_SCROLLL 0x02 -+#define LED_COMPOSE 0x03 -+#define LED_KANA 0x04 -+#define LED_SLEEP 0x05 -+#define LED_SUSPEND 0x06 -+#define LED_MUTE 0x07 -+#define LED_MISC 0x08 -+#define LED_MAIL 0x09 -+#define LED_CHARGING 0x0a -+#define LED_MAX 0x0f -+#define LED_CNT (LED_MAX+1) -+ -+/* -+ * Autorepeat values -+ */ -+ -+#define REP_DELAY 0x00 -+#define REP_PERIOD 0x01 -+#define REP_MAX 0x01 -+#define REP_CNT (REP_MAX+1) -+ -+/* -+ * Sounds -+ */ -+ -+#define SND_CLICK 0x00 -+#define SND_BELL 0x01 -+#define SND_TONE 0x02 -+#define SND_MAX 0x07 -+#define SND_CNT (SND_MAX+1) -+ -+/* -+ * IDs. -+ */ -+ -+#define ID_BUS 0 -+#define ID_VENDOR 1 -+#define ID_PRODUCT 2 -+#define ID_VERSION 3 -+ -+#define BUS_PCI 0x01 -+#define BUS_ISAPNP 0x02 -+#define BUS_USB 0x03 -+#define BUS_HIL 0x04 -+#define BUS_BLUETOOTH 0x05 -+#define BUS_VIRTUAL 0x06 -+ -+#define BUS_ISA 0x10 -+#define BUS_I8042 0x11 -+#define BUS_XTKBD 0x12 -+#define BUS_RS232 0x13 -+#define BUS_GAMEPORT 0x14 -+#define BUS_PARPORT 0x15 -+#define BUS_AMIGA 0x16 -+#define BUS_ADB 0x17 -+#define BUS_I2C 0x18 -+#define BUS_HOST 0x19 -+#define BUS_GSC 0x1A -+#define BUS_ATARI 0x1B -+#define BUS_SPI 0x1C -+ -+/* -+ * MT_TOOL types -+ */ -+#define MT_TOOL_FINGER 0 -+#define MT_TOOL_PEN 1 -+#define MT_TOOL_MAX 1 -+ -+/* -+ * Values describing the status of a force-feedback effect -+ */ -+#define FF_STATUS_STOPPED 0x00 -+#define FF_STATUS_PLAYING 0x01 -+#define FF_STATUS_MAX 0x01 -+ -+/* -+ * Structures used in ioctls to upload effects to a device -+ * They are pieces of a bigger structure (called ff_effect) -+ */ -+ -+/* -+ * All duration values are expressed in ms. Values above 32767 ms (0x7fff) -+ * should not be used and have unspecified results. -+ */ -+ -+/** -+ * struct ff_replay - defines scheduling of the force-feedback effect -+ * @length: duration of the effect -+ * @delay: delay before effect should start playing -+ */ -+struct ff_replay { -+ uint16_t length; -+ uint16_t delay; -+}; -+ -+/** -+ * struct ff_trigger - defines what triggers the force-feedback effect -+ * @button: number of the button triggering the effect -+ * @interval: controls how soon the effect can be re-triggered -+ */ -+struct ff_trigger { -+ uint16_t button; -+ uint16_t interval; -+}; -+ -+/** -+ * struct ff_envelope - generic force-feedback effect envelope -+ * @attack_length: duration of the attack (ms) -+ * @attack_level: level at the beginning of the attack -+ * @fade_length: duration of fade (ms) -+ * @fade_level: level at the end of fade -+ * -+ * The @attack_level and @fade_level are absolute values; when applying -+ * envelope force-feedback core will convert to positive/negative -+ * value based on polarity of the default level of the effect. -+ * Valid range for the attack and fade levels is 0x0000 - 0x7fff -+ */ -+struct ff_envelope { -+ uint16_t attack_length; -+ uint16_t attack_level; -+ uint16_t fade_length; -+ uint16_t fade_level; -+}; -+ -+/** -+ * struct ff_constant_effect - defines parameters of a constant force-feedback effect -+ * @level: strength of the effect; may be negative -+ * @envelope: envelope data -+ */ -+struct ff_constant_effect { -+ int16_t level; -+ struct ff_envelope envelope; -+}; -+ -+/** -+ * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect -+ * @start_level: beginning strength of the effect; may be negative -+ * @end_level: final strength of the effect; may be negative -+ * @envelope: envelope data -+ */ -+struct ff_ramp_effect { -+ int16_t start_level; -+ int16_t end_level; -+ struct ff_envelope envelope; -+}; -+ -+/** -+ * struct ff_condition_effect - defines a spring or friction force-feedback effect -+ * @right_saturation: maximum level when joystick moved all way to the right -+ * @left_saturation: same for the left side -+ * @right_coeff: controls how fast the force grows when the joystick moves -+ * to the right -+ * @left_coeff: same for the left side -+ * @deadband: size of the dead zone, where no force is produced -+ * @center: position of the dead zone -+ */ -+struct ff_condition_effect { -+ uint16_t right_saturation; -+ uint16_t left_saturation; -+ -+ int16_t right_coeff; -+ int16_t left_coeff; -+ -+ uint16_t deadband; -+ int16_t center; -+}; -+ -+/** -+ * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect -+ * @waveform: kind of the effect (wave) -+ * @period: period of the wave (ms) -+ * @magnitude: peak value -+ * @offset: mean value of the wave (roughly) -+ * @phase: 'horizontal' shift -+ * @envelope: envelope data -+ * @custom_len: number of samples (FF_CUSTOM only) -+ * @custom_data: buffer of samples (FF_CUSTOM only) -+ * -+ * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP, -+ * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined -+ * for the time being as no driver supports it yet. -+ * -+ * Note: the data pointed by custom_data is copied by the driver. -+ * You can therefore dispose of the memory after the upload/update. -+ */ -+struct ff_periodic_effect { -+ uint16_t waveform; -+ uint16_t period; -+ int16_t magnitude; -+ int16_t offset; -+ uint16_t phase; -+ -+ struct ff_envelope envelope; -+ -+ uint32_t custom_len; -+ int16_t *custom_data; -+}; -+ -+/** -+ * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect -+ * @strong_magnitude: magnitude of the heavy motor -+ * @weak_magnitude: magnitude of the light one -+ * -+ * Some rumble pads have two motors of different weight. Strong_magnitude -+ * represents the magnitude of the vibration generated by the heavy one. -+ */ -+struct ff_rumble_effect { -+ uint16_t strong_magnitude; -+ uint16_t weak_magnitude; -+}; -+ -+/** -+ * struct ff_effect - defines force feedback effect -+ * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, -+ * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) -+ * @id: an unique id assigned to an effect -+ * @direction: direction of the effect -+ * @trigger: trigger conditions (struct ff_trigger) -+ * @replay: scheduling of the effect (struct ff_replay) -+ * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, -+ * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further -+ * defining effect parameters -+ * -+ * This structure is sent through ioctl from the application to the driver. -+ * To create a new effect application should set its @id to -1; the kernel -+ * will return assigned @id which can later be used to update or delete -+ * this effect. -+ * -+ * Direction of the effect is encoded as follows: -+ * 0 deg -> 0x0000 (down) -+ * 90 deg -> 0x4000 (left) -+ * 180 deg -> 0x8000 (up) -+ * 270 deg -> 0xC000 (right) -+ */ -+struct ff_effect { -+ uint16_t type; -+ int16_t id; -+ uint16_t direction; -+ struct ff_trigger trigger; -+ struct ff_replay replay; -+ -+ union { -+ struct ff_constant_effect constant; -+ struct ff_ramp_effect ramp; -+ struct ff_periodic_effect periodic; -+ struct ff_condition_effect condition[2]; /* One for each axis */ -+ struct ff_rumble_effect rumble; -+ } u; -+}; -+ -+/* -+ * Force feedback effect types -+ */ -+ -+#define FF_RUMBLE 0x50 -+#define FF_PERIODIC 0x51 -+#define FF_CONSTANT 0x52 -+#define FF_SPRING 0x53 -+#define FF_FRICTION 0x54 -+#define FF_DAMPER 0x55 -+#define FF_INERTIA 0x56 -+#define FF_RAMP 0x57 -+ -+#define FF_EFFECT_MIN FF_RUMBLE -+#define FF_EFFECT_MAX FF_RAMP -+ -+/* -+ * Force feedback periodic effect types -+ */ -+ -+#define FF_SQUARE 0x58 -+#define FF_TRIANGLE 0x59 -+#define FF_SINE 0x5a -+#define FF_SAW_UP 0x5b -+#define FF_SAW_DOWN 0x5c -+#define FF_CUSTOM 0x5d -+ -+#define FF_WAVEFORM_MIN FF_SQUARE -+#define FF_WAVEFORM_MAX FF_CUSTOM -+ -+/* -+ * Set ff device properties -+ */ -+ -+#define FF_GAIN 0x60 -+#define FF_AUTOCENTER 0x61 -+ -+#define FF_MAX 0x7f -+#define FF_CNT (FF_MAX+1) -+ -+#endif /* _INPUT_H */ -diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh -index f208ec9..baf4220 100755 ---- a/scripts/update-linux-headers.sh -+++ b/scripts/update-linux-headers.sh -@@ -31,7 +31,7 @@ fi - cp_virtio() { - from=$1 - to=$2 -- virtio=$(find "$from" -name '*virtio*h') -+ virtio=$(find "$from" -name '*virtio*h' -o -name "input.h") - if [ "$virtio" ]; then - rm -rf "$to" - mkdir -p "$to" -@@ -40,6 +40,7 @@ cp_virtio() { - grep '#include' "$f" | grep -v -e 'linux/virtio' \ - -e 'linux/types' \ - -e 'linux/if_ether' \ -+ -e 'sys/' \ - > /dev/null - then - echo "Unexpected #include in input file $f". -@@ -48,6 +49,7 @@ cp_virtio() { - - header=$(basename "$f"); - sed -e 's/__u\([0-9][0-9]*\)/uint\1_t/g' \ -+ -e 's/__s\([0-9][0-9]*\)/int\1_t/g' \ - -e 's/__le\([0-9][0-9]*\)/uint\1_t/g' \ - -e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \ - -e 's/<linux\/\([^>]*\)>/"standard-headers\/linux\/\1"/' \ --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-const_le16-and-const_le32-not-build-tim.patch b/SOURCES/kvm-virtio-input-const_le16-and-const_le32-not-build-tim.patch deleted file mode 100644 index c8c0a59..0000000 --- a/SOURCES/kvm-virtio-input-const_le16-and-const_le32-not-build-tim.patch +++ /dev/null @@ -1,60 +0,0 @@ -From e23a5016bbcbf155f18ba534d9f6f55159e47fe9 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:25 +0200 -Subject: [PATCH 137/217] virtio-input: const_le16 and const_le32 not build - time constant -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1436260751-25015-23-git-send-email-jasowang@redhat.com> -Patchwork-id: 66797 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 22/68] virtio-input: const_le16 and const_le32 not build time constant -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Michael Mueller <mimu@linux.vnet.ibm.com> - -As the implementation of const_le16 and const_le32 is not build time constant -on big endian systems this need to be fixed. - - CC hw/input/virtio-input-hid.o -hw/input/virtio-input-hid.c:340:13: error: initializer element is not constant -hw/input/virtio-input-hid.c:340:13: error: (near initialization for ‘virtio_keyboard_config[1].u.ids.bustype’) -... - -Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com> -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 16c9d46d32b39b147774ddd948dd2f9ad9049d02) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/virtio/virtio-input.h | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -index a265519..bcee355 100644 ---- a/include/hw/virtio/virtio-input.h -+++ b/include/hw/virtio/virtio-input.h -@@ -14,8 +14,14 @@ typedef struct virtio_input_config virtio_input_config; - typedef struct virtio_input_event virtio_input_event; - - #if defined(HOST_WORDS_BIGENDIAN) --# define const_le32(_x) bswap32(_x) --# define const_le16(_x) bswap32(_x) -+# define const_le32(_x) \ -+ (((_x & 0x000000ffU) << 24) | \ -+ ((_x & 0x0000ff00U) << 8) | \ -+ ((_x & 0x00ff0000U) >> 8) | \ -+ ((_x & 0xff000000U) >> 24)) -+# define const_le16(_x) \ -+ (((_x & 0x00ff) << 8) | \ -+ ((_x & 0xff00) >> 8)) - #else - # define const_le32(_x) (_x) - # define const_le16(_x) (_x) --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-core-code-base-class-device.patch b/SOURCES/kvm-virtio-input-core-code-base-class-device.patch deleted file mode 100644 index f502e50..0000000 --- a/SOURCES/kvm-virtio-input-core-code-base-class-device.patch +++ /dev/null @@ -1,443 +0,0 @@ -From e249510e9540bf33b48b36d9a1cc2ba7d5e69ba4 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:06 +0200 -Subject: [PATCH 118/217] virtio-input: core code & base class [device] - -Message-id: <1436260751-25015-4-git-send-email-jasowang@redhat.com> -Patchwork-id: 66778 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 03/68] virtio-input: core code & base class [device] -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -This patch adds virtio-input support to qemu. It brings a abstract -base class providing core support, other classes can build on it to -actually implement input devices. - -virtio-input basically sends linux input layer events (evdev) over -virtio. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit f73ddbad397f98c1d476ffbf93d65af1cfa796e6) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/input/Makefile.objs | 4 + - hw/input/virtio-input.c | 282 +++++++++++++++++++++++++++++++++++++++ - include/hw/virtio/virtio-input.h | 84 ++++++++++++ - include/hw/virtio/virtio.h | 1 + - 4 files changed, 371 insertions(+) - create mode 100644 hw/input/virtio-input.c - create mode 100644 include/hw/virtio/virtio-input.h - -diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs -index e8c80b9..ee8bba9 100644 ---- a/hw/input/Makefile.objs -+++ b/hw/input/Makefile.objs -@@ -8,6 +8,10 @@ common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o - common-obj-$(CONFIG_TSC2005) += tsc2005.o - common-obj-$(CONFIG_VMMOUSE) += vmmouse.o - -+ifeq ($(CONFIG_LINUX),y) -+common-obj-$(CONFIG_VIRTIO) += virtio-input.o -+endif -+ - obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o - obj-$(CONFIG_PXA2XX) += pxa2xx_keypad.o - obj-$(CONFIG_TSC210X) += tsc210x.o -diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c -new file mode 100644 -index 0000000..e615c5c ---- /dev/null -+++ b/hw/input/virtio-input.c -@@ -0,0 +1,282 @@ -+/* -+ * This work is licensed under the terms of the GNU GPL, version 2 or -+ * (at your option) any later version. See the COPYING file in the -+ * top-level directory. -+ */ -+ -+#include "qemu/iov.h" -+ -+#include "hw/qdev.h" -+#include "hw/virtio/virtio.h" -+#include "hw/virtio/virtio-input.h" -+ -+#include "standard-headers/linux/input.h" -+ -+/* ----------------------------------------------------------------- */ -+ -+void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event) -+{ -+ VirtQueueElement elem; -+ unsigned have, need; -+ int i, len; -+ -+ /* queue up events ... */ -+ if (vinput->qindex == vinput->qsize) { -+ vinput->qsize++; -+ vinput->queue = realloc(vinput->queue, vinput->qsize * -+ sizeof(virtio_input_event)); -+ } -+ vinput->queue[vinput->qindex++] = *event; -+ -+ /* ... until we see a report sync ... */ -+ if (event->type != cpu_to_le16(EV_SYN) || -+ event->code != cpu_to_le16(SYN_REPORT)) { -+ return; -+ } -+ -+ /* ... then check available space ... */ -+ need = sizeof(virtio_input_event) * vinput->qindex; -+ virtqueue_get_avail_bytes(vinput->evt, &have, NULL, need, 0); -+ if (have < need) { -+ vinput->qindex = 0; -+ fprintf(stderr, "%s: ENOSPC in vq, dropping events\n", __func__); -+ return; -+ } -+ -+ /* ... and finally pass them to the guest */ -+ for (i = 0; i < vinput->qindex; i++) { -+ if (!virtqueue_pop(vinput->evt, &elem)) { -+ /* should not happen, we've checked for space beforehand */ -+ fprintf(stderr, "%s: Huh? No vq elem available ...\n", __func__); -+ return; -+ } -+ len = iov_from_buf(elem.in_sg, elem.in_num, -+ 0, vinput->queue+i, sizeof(virtio_input_event)); -+ virtqueue_push(vinput->evt, &elem, len); -+ } -+ virtio_notify(VIRTIO_DEVICE(vinput), vinput->evt); -+ vinput->qindex = 0; -+} -+ -+static void virtio_input_handle_evt(VirtIODevice *vdev, VirtQueue *vq) -+{ -+ /* nothing */ -+} -+ -+static void virtio_input_handle_sts(VirtIODevice *vdev, VirtQueue *vq) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev); -+ VirtIOInput *vinput = VIRTIO_INPUT(vdev); -+ virtio_input_event event; -+ VirtQueueElement elem; -+ int len; -+ -+ while (virtqueue_pop(vinput->sts, &elem)) { -+ memset(&event, 0, sizeof(event)); -+ len = iov_to_buf(elem.out_sg, elem.out_num, -+ 0, &event, sizeof(event)); -+ if (vic->handle_status) { -+ vic->handle_status(vinput, &event); -+ } -+ virtqueue_push(vinput->sts, &elem, len); -+ } -+ virtio_notify(vdev, vinput->sts); -+} -+ -+static virtio_input_config *virtio_input_find_config(VirtIOInput *vinput, -+ uint8_t select, -+ uint8_t subsel) -+{ -+ VirtIOInputConfig *cfg; -+ -+ QTAILQ_FOREACH(cfg, &vinput->cfg_list, node) { -+ if (select == cfg->config.select && -+ subsel == cfg->config.subsel) { -+ return &cfg->config; -+ } -+ } -+ return NULL; -+} -+ -+void virtio_input_add_config(VirtIOInput *vinput, -+ virtio_input_config *config) -+{ -+ VirtIOInputConfig *cfg; -+ -+ if (virtio_input_find_config(vinput, config->select, config->subsel)) { -+ /* should not happen */ -+ fprintf(stderr, "%s: duplicate config: %d/%d\n", -+ __func__, config->select, config->subsel); -+ abort(); -+ } -+ -+ cfg = g_new0(VirtIOInputConfig, 1); -+ cfg->config = *config; -+ QTAILQ_INSERT_TAIL(&vinput->cfg_list, cfg, node); -+} -+ -+void virtio_input_init_config(VirtIOInput *vinput, -+ virtio_input_config *config) -+{ -+ int i = 0; -+ -+ QTAILQ_INIT(&vinput->cfg_list); -+ while (config[i].select) { -+ virtio_input_add_config(vinput, config + i); -+ i++; -+ } -+} -+ -+void virtio_input_idstr_config(VirtIOInput *vinput, -+ uint8_t select, const char *string) -+{ -+ virtio_input_config id; -+ -+ if (!string) { -+ return; -+ } -+ memset(&id, 0, sizeof(id)); -+ id.select = select; -+ id.size = snprintf(id.u.string, sizeof(id.u.string), "%s", string); -+ virtio_input_add_config(vinput, &id); -+} -+ -+static void virtio_input_get_config(VirtIODevice *vdev, uint8_t *config_data) -+{ -+ VirtIOInput *vinput = VIRTIO_INPUT(vdev); -+ virtio_input_config *config; -+ -+ config = virtio_input_find_config(vinput, vinput->cfg_select, -+ vinput->cfg_subsel); -+ if (config) { -+ memcpy(config_data, config, vinput->cfg_size); -+ } else { -+ memset(config_data, 0, vinput->cfg_size); -+ } -+} -+ -+static void virtio_input_set_config(VirtIODevice *vdev, -+ const uint8_t *config_data) -+{ -+ VirtIOInput *vinput = VIRTIO_INPUT(vdev); -+ virtio_input_config *config = (virtio_input_config *)config_data; -+ -+ vinput->cfg_select = config->select; -+ vinput->cfg_subsel = config->subsel; -+ virtio_notify_config(vdev); -+} -+ -+static uint32_t virtio_input_get_features(VirtIODevice *vdev, uint32_t f) -+{ -+ return f; -+} -+ -+static void virtio_input_set_status(VirtIODevice *vdev, uint8_t val) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev); -+ VirtIOInput *vinput = VIRTIO_INPUT(vdev); -+ -+ if (val & VIRTIO_CONFIG_S_DRIVER_OK) { -+ if (!vinput->active) { -+ vinput->active = true; -+ if (vic->change_active) { -+ vic->change_active(vinput); -+ } -+ } -+ } -+} -+ -+static void virtio_input_reset(VirtIODevice *vdev) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev); -+ VirtIOInput *vinput = VIRTIO_INPUT(vdev); -+ -+ if (vinput->active) { -+ vinput->active = false; -+ if (vic->change_active) { -+ vic->change_active(vinput); -+ } -+ } -+} -+ -+static void virtio_input_device_realize(DeviceState *dev, Error **errp) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev); -+ VirtIODevice *vdev = VIRTIO_DEVICE(dev); -+ VirtIOInput *vinput = VIRTIO_INPUT(dev); -+ VirtIOInputConfig *cfg; -+ Error *local_err = NULL; -+ -+ if (vic->realize) { -+ vic->realize(dev, &local_err); -+ if (local_err) { -+ error_propagate(errp, local_err); -+ return; -+ } -+ } -+ -+ virtio_input_idstr_config(vinput, VIRTIO_INPUT_CFG_ID_SERIAL, -+ vinput->input.serial); -+ -+ QTAILQ_FOREACH(cfg, &vinput->cfg_list, node) { -+ if (vinput->cfg_size < cfg->config.size) { -+ vinput->cfg_size = cfg->config.size; -+ } -+ } -+ vinput->cfg_size += 8; -+ assert(vinput->cfg_size <= sizeof(virtio_input_config)); -+ -+ virtio_init(vdev, "virtio-input", VIRTIO_ID_INPUT, -+ vinput->cfg_size); -+ vinput->evt = virtio_add_queue(vdev, 64, virtio_input_handle_evt); -+ vinput->sts = virtio_add_queue(vdev, 64, virtio_input_handle_sts); -+} -+ -+static void virtio_input_device_unrealize(DeviceState *dev, Error **errp) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev); -+ VirtIODevice *vdev = VIRTIO_DEVICE(dev); -+ Error *local_err = NULL; -+ -+ if (vic->unrealize) { -+ vic->unrealize(dev, &local_err); -+ if (local_err) { -+ error_propagate(errp, local_err); -+ return; -+ } -+ } -+ virtio_cleanup(vdev); -+} -+ -+static void virtio_input_class_init(ObjectClass *klass, void *data) -+{ -+ DeviceClass *dc = DEVICE_CLASS(klass); -+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -+ -+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -+ vdc->realize = virtio_input_device_realize; -+ vdc->unrealize = virtio_input_device_unrealize; -+ vdc->get_config = virtio_input_get_config; -+ vdc->set_config = virtio_input_set_config; -+ vdc->get_features = virtio_input_get_features; -+ vdc->set_status = virtio_input_set_status; -+ vdc->reset = virtio_input_reset; -+} -+ -+static const TypeInfo virtio_input_info = { -+ .name = TYPE_VIRTIO_INPUT, -+ .parent = TYPE_VIRTIO_DEVICE, -+ .instance_size = sizeof(VirtIOInput), -+ .class_size = sizeof(VirtIOInputClass), -+ .class_init = virtio_input_class_init, -+ .abstract = true, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static void virtio_register_types(void) -+{ -+ type_register_static(&virtio_input_info); -+} -+ -+type_init(virtio_register_types) -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -new file mode 100644 -index 0000000..ad915cc ---- /dev/null -+++ b/include/hw/virtio/virtio-input.h -@@ -0,0 +1,84 @@ -+#ifndef _QEMU_VIRTIO_INPUT_H -+#define _QEMU_VIRTIO_INPUT_H -+ -+#include "ui/input.h" -+ -+/* ----------------------------------------------------------------- */ -+/* virtio input protocol */ -+ -+#include "standard-headers/linux/virtio_ids.h" -+#include "standard-headers/linux/virtio_input.h" -+ -+typedef struct virtio_input_absinfo virtio_input_absinfo; -+typedef struct virtio_input_config virtio_input_config; -+typedef struct virtio_input_event virtio_input_event; -+ -+#if defined(HOST_WORDS_BIGENDIAN) -+# define const_le32(_x) bswap32(_x) -+# define const_le16(_x) bswap32(_x) -+#else -+# define const_le32(_x) (_x) -+# define const_le16(_x) (_x) -+#endif -+ -+/* ----------------------------------------------------------------- */ -+/* qemu internals */ -+ -+#define TYPE_VIRTIO_INPUT "virtio-input-device" -+#define VIRTIO_INPUT(obj) \ -+ OBJECT_CHECK(VirtIOInput, (obj), TYPE_VIRTIO_INPUT) -+#define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \ -+ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT) -+#define VIRTIO_INPUT_GET_CLASS(obj) \ -+ OBJECT_GET_CLASS(VirtIOInputClass, obj, TYPE_VIRTIO_INPUT) -+#define VIRTIO_INPUT_CLASS(klass) \ -+ OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT) -+ -+typedef struct VirtIOInput VirtIOInput; -+typedef struct VirtIOInputClass VirtIOInputClass; -+typedef struct VirtIOInputConfig VirtIOInputConfig; -+ -+struct virtio_input_conf { -+ char *serial; -+}; -+ -+struct VirtIOInputConfig { -+ virtio_input_config config; -+ QTAILQ_ENTRY(VirtIOInputConfig) node; -+}; -+ -+struct VirtIOInput { -+ VirtIODevice parent_obj; -+ uint8_t cfg_select; -+ uint8_t cfg_subsel; -+ uint32_t cfg_size; -+ QTAILQ_HEAD(, VirtIOInputConfig) cfg_list; -+ VirtQueue *evt, *sts; -+ virtio_input_conf input; -+ -+ virtio_input_event *queue; -+ uint32_t qindex, qsize; -+ -+ bool active; -+}; -+ -+struct VirtIOInputClass { -+ /*< private >*/ -+ VirtioDeviceClass parent; -+ /*< public >*/ -+ -+ DeviceRealize realize; -+ DeviceUnrealize unrealize; -+ void (*change_active)(VirtIOInput *vinput); -+ void (*handle_status)(VirtIOInput *vinput, virtio_input_event *event); -+}; -+ -+void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event); -+void virtio_input_init_config(VirtIOInput *vinput, -+ virtio_input_config *config); -+void virtio_input_add_config(VirtIOInput *vinput, -+ virtio_input_config *config); -+void virtio_input_idstr_config(VirtIOInput *vinput, -+ uint8_t select, const char *string); -+ -+#endif /* _QEMU_VIRTIO_INPUT_H */ -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index fc0aeaa..77b6559 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -189,6 +189,7 @@ int virtio_set_features(VirtIODevice *vdev, uint32_t val); - typedef struct VirtIOBlkConf VirtIOBlkConf; - struct virtio_net_conf; - typedef struct virtio_serial_conf virtio_serial_conf; -+typedef struct virtio_input_conf virtio_input_conf; - typedef struct VirtIOSCSIConf VirtIOSCSIConf; - typedef struct VirtIORNGConf VirtIORNGConf; - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-core-code-base-class-pci.patch b/SOURCES/kvm-virtio-input-core-code-base-class-pci.patch deleted file mode 100644 index 72bf3c4..0000000 --- a/SOURCES/kvm-virtio-input-core-code-base-class-pci.patch +++ /dev/null @@ -1,131 +0,0 @@ -From fd4dd0eb8bff7078cc36d7fe829f720111308796 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:57 +0200 -Subject: [PATCH 169/217] virtio-input: core code & base class [pci] - -Message-id: <1436260751-25015-55-git-send-email-jasowang@redhat.com> -Patchwork-id: 66829 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 54/68] virtio-input: core code & base class [pci] -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -This patch adds the virtio-pci support bits for virtio-input-device. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit f958c8aa138718b8126a300d6faece522f7674b8) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 36 ++++++++++++++++++++++++++++++++++++ - hw/virtio/virtio-pci.h | 14 ++++++++++++++ - 2 files changed, 50 insertions(+) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 0313712..24ba519 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -24,6 +24,7 @@ - #include "hw/virtio/virtio-serial.h" - #include "hw/virtio/virtio-scsi.h" - #include "hw/virtio/virtio-balloon.h" -+#include "hw/virtio/virtio-input.h" - #include "hw/pci/pci.h" - #include "qemu/error-report.h" - #include "hw/pci/msi.h" -@@ -1925,6 +1926,40 @@ static const TypeInfo virtio_rng_pci_info = { - .class_init = virtio_rng_pci_class_init, - }; - -+/* virtio-input-pci */ -+ -+static void virtio_input_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -+{ -+ VirtIOInputPCI *vinput = VIRTIO_INPUT_PCI(vpci_dev); -+ DeviceState *vdev = DEVICE(&vinput->vdev); -+ -+ qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); -+ /* force virtio-1.0 */ -+ vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN; -+ vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY; -+ object_property_set_bool(OBJECT(vdev), true, "realized", errp); -+} -+ -+static void virtio_input_pci_class_init(ObjectClass *klass, void *data) -+{ -+ DeviceClass *dc = DEVICE_CLASS(klass); -+ VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); -+ PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); -+ -+ k->realize = virtio_input_pci_realize; -+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -+ -+ pcidev_k->class_id = PCI_CLASS_INPUT_OTHER; -+} -+ -+static const TypeInfo virtio_input_pci_info = { -+ .name = TYPE_VIRTIO_INPUT_PCI, -+ .parent = TYPE_VIRTIO_PCI, -+ .instance_size = sizeof(VirtIOInputPCI), -+ .class_init = virtio_input_pci_class_init, -+ .abstract = true, -+}; -+ - /* virtio-pci-bus */ - - static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, -@@ -1966,6 +2001,7 @@ static const TypeInfo virtio_pci_bus_info = { - static void virtio_pci_register_types(void) - { - type_register_static(&virtio_rng_pci_info); -+ type_register_static(&virtio_input_pci_info); - type_register_static(&virtio_pci_bus_info); - type_register_static(&virtio_pci_info); - #ifdef CONFIG_VIRTFS -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index ff5ab71..754971f 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -24,6 +24,7 @@ - #include "hw/virtio/virtio-balloon.h" - #include "hw/virtio/virtio-bus.h" - #include "hw/virtio/virtio-9p.h" -+#include "hw/virtio/virtio-input.h" - #ifdef CONFIG_VIRTFS - #include "hw/9pfs/virtio-9p.h" - #endif -@@ -39,6 +40,7 @@ typedef struct VirtIOSerialPCI VirtIOSerialPCI; - typedef struct VirtIONetPCI VirtIONetPCI; - typedef struct VHostSCSIPCI VHostSCSIPCI; - typedef struct VirtIORngPCI VirtIORngPCI; -+typedef struct VirtIOInputPCI VirtIOInputPCI; - - /* virtio-pci-bus */ - -@@ -234,6 +236,18 @@ struct VirtIORngPCI { - VirtIORNG vdev; - }; - -+/* -+ * virtio-input-pci: This extends VirtioPCIProxy. -+ */ -+#define TYPE_VIRTIO_INPUT_PCI "virtio-input-pci" -+#define VIRTIO_INPUT_PCI(obj) \ -+ OBJECT_CHECK(VirtIOInputPCI, (obj), TYPE_VIRTIO_INPUT_PCI) -+ -+struct VirtIOInputPCI { -+ VirtIOPCIProxy parent_obj; -+ VirtIOInput vdev; -+}; -+ - /* Virtio ABI version, if we increment this, we break the guest driver. */ - #define VIRTIO_PCI_ABI_VERSION 0 - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-emulated-devices-device.patch b/SOURCES/kvm-virtio-input-emulated-devices-device.patch deleted file mode 100644 index 6b3b1b2..0000000 --- a/SOURCES/kvm-virtio-input-emulated-devices-device.patch +++ /dev/null @@ -1,601 +0,0 @@ -From ad287849539b64649a83c1f717937f68199339fc Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:07 +0200 -Subject: [PATCH 119/217] virtio-input: emulated devices [device] - -Message-id: <1436260751-25015-5-git-send-email-jasowang@redhat.com> -Patchwork-id: 66779 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 04/68] virtio-input: emulated devices [device] -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -This patch adds the virtio-input-hid base class and -virtio-{keyboard,mouse,tablet} subclasses building on the base class. -They are hooked up to the qemu input core and deliver input events -to the guest like all other hid devices (ps/2 kbd, usb tablet, ...). - -Using them is as simple as adding "-device virtio-tablet-device" to -your command line, for use all transports except pci. virtio-pci -support comes as separate patch, once virtio-pci got virtio 1.0 -support. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 55a1d80a41032d6133adec041c0096820beaa1b7) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/input/Makefile.objs | 1 + - hw/input/virtio-input-hid.c | 502 +++++++++++++++++++++++++++++++++++++++ - include/hw/virtio/virtio-input.h | 21 ++ - 3 files changed, 524 insertions(+) - create mode 100644 hw/input/virtio-input-hid.c - -diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs -index ee8bba9..0dae710 100644 ---- a/hw/input/Makefile.objs -+++ b/hw/input/Makefile.objs -@@ -10,6 +10,7 @@ common-obj-$(CONFIG_VMMOUSE) += vmmouse.o - - ifeq ($(CONFIG_LINUX),y) - common-obj-$(CONFIG_VIRTIO) += virtio-input.o -+common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o - endif - - obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o -diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c -new file mode 100644 -index 0000000..32cc94a ---- /dev/null -+++ b/hw/input/virtio-input-hid.c -@@ -0,0 +1,502 @@ -+/* -+ * This work is licensed under the terms of the GNU GPL, version 2 or -+ * (at your option) any later version. See the COPYING file in the -+ * top-level directory. -+ */ -+ -+#include "qemu/iov.h" -+ -+#include "hw/qdev.h" -+#include "hw/virtio/virtio.h" -+#include "hw/virtio/virtio-input.h" -+ -+#undef CONFIG_CURSES -+#include "ui/console.h" -+ -+#include "standard-headers/linux/input.h" -+ -+#define VIRTIO_ID_NAME_KEYBOARD "QEMU Virtio Keyboard" -+#define VIRTIO_ID_NAME_MOUSE "QEMU Virtio Mouse" -+#define VIRTIO_ID_NAME_TABLET "QEMU Virtio Tablet" -+ -+/* ----------------------------------------------------------------- */ -+ -+static const unsigned int keymap_qcode[Q_KEY_CODE_MAX] = { -+ [Q_KEY_CODE_ESC] = KEY_ESC, -+ [Q_KEY_CODE_1] = KEY_1, -+ [Q_KEY_CODE_2] = KEY_2, -+ [Q_KEY_CODE_3] = KEY_3, -+ [Q_KEY_CODE_4] = KEY_4, -+ [Q_KEY_CODE_5] = KEY_5, -+ [Q_KEY_CODE_6] = KEY_6, -+ [Q_KEY_CODE_7] = KEY_7, -+ [Q_KEY_CODE_8] = KEY_8, -+ [Q_KEY_CODE_9] = KEY_9, -+ [Q_KEY_CODE_0] = KEY_0, -+ [Q_KEY_CODE_MINUS] = KEY_MINUS, -+ [Q_KEY_CODE_EQUAL] = KEY_EQUAL, -+ [Q_KEY_CODE_BACKSPACE] = KEY_BACKSPACE, -+ -+ [Q_KEY_CODE_TAB] = KEY_TAB, -+ [Q_KEY_CODE_Q] = KEY_Q, -+ [Q_KEY_CODE_W] = KEY_W, -+ [Q_KEY_CODE_E] = KEY_E, -+ [Q_KEY_CODE_R] = KEY_R, -+ [Q_KEY_CODE_T] = KEY_T, -+ [Q_KEY_CODE_Y] = KEY_Y, -+ [Q_KEY_CODE_U] = KEY_U, -+ [Q_KEY_CODE_I] = KEY_I, -+ [Q_KEY_CODE_O] = KEY_O, -+ [Q_KEY_CODE_P] = KEY_P, -+ [Q_KEY_CODE_BRACKET_LEFT] = KEY_LEFTBRACE, -+ [Q_KEY_CODE_BRACKET_RIGHT] = KEY_RIGHTBRACE, -+ [Q_KEY_CODE_RET] = KEY_ENTER, -+ -+ [Q_KEY_CODE_CTRL] = KEY_LEFTCTRL, -+ [Q_KEY_CODE_A] = KEY_A, -+ [Q_KEY_CODE_S] = KEY_S, -+ [Q_KEY_CODE_D] = KEY_D, -+ [Q_KEY_CODE_F] = KEY_F, -+ [Q_KEY_CODE_G] = KEY_G, -+ [Q_KEY_CODE_H] = KEY_H, -+ [Q_KEY_CODE_J] = KEY_J, -+ [Q_KEY_CODE_K] = KEY_K, -+ [Q_KEY_CODE_L] = KEY_L, -+ [Q_KEY_CODE_SEMICOLON] = KEY_SEMICOLON, -+ [Q_KEY_CODE_APOSTROPHE] = KEY_APOSTROPHE, -+ [Q_KEY_CODE_GRAVE_ACCENT] = KEY_GRAVE, -+ -+ [Q_KEY_CODE_SHIFT] = KEY_LEFTSHIFT, -+ [Q_KEY_CODE_BACKSLASH] = KEY_BACKSLASH, -+ [Q_KEY_CODE_LESS] = KEY_102ND, -+ [Q_KEY_CODE_Z] = KEY_Z, -+ [Q_KEY_CODE_X] = KEY_X, -+ [Q_KEY_CODE_C] = KEY_C, -+ [Q_KEY_CODE_V] = KEY_V, -+ [Q_KEY_CODE_B] = KEY_B, -+ [Q_KEY_CODE_N] = KEY_N, -+ [Q_KEY_CODE_M] = KEY_M, -+ [Q_KEY_CODE_COMMA] = KEY_COMMA, -+ [Q_KEY_CODE_DOT] = KEY_DOT, -+ [Q_KEY_CODE_SLASH] = KEY_SLASH, -+ [Q_KEY_CODE_SHIFT_R] = KEY_RIGHTSHIFT, -+ -+ [Q_KEY_CODE_ALT] = KEY_LEFTALT, -+ [Q_KEY_CODE_SPC] = KEY_SPACE, -+ [Q_KEY_CODE_CAPS_LOCK] = KEY_CAPSLOCK, -+ -+ [Q_KEY_CODE_F1] = KEY_F1, -+ [Q_KEY_CODE_F2] = KEY_F2, -+ [Q_KEY_CODE_F3] = KEY_F3, -+ [Q_KEY_CODE_F4] = KEY_F4, -+ [Q_KEY_CODE_F5] = KEY_F5, -+ [Q_KEY_CODE_F6] = KEY_F6, -+ [Q_KEY_CODE_F7] = KEY_F7, -+ [Q_KEY_CODE_F8] = KEY_F8, -+ [Q_KEY_CODE_F9] = KEY_F9, -+ [Q_KEY_CODE_F10] = KEY_F10, -+ [Q_KEY_CODE_NUM_LOCK] = KEY_NUMLOCK, -+ [Q_KEY_CODE_SCROLL_LOCK] = KEY_SCROLLLOCK, -+ -+ [Q_KEY_CODE_KP_0] = KEY_KP0, -+ [Q_KEY_CODE_KP_1] = KEY_KP1, -+ [Q_KEY_CODE_KP_2] = KEY_KP2, -+ [Q_KEY_CODE_KP_3] = KEY_KP3, -+ [Q_KEY_CODE_KP_4] = KEY_KP4, -+ [Q_KEY_CODE_KP_5] = KEY_KP5, -+ [Q_KEY_CODE_KP_6] = KEY_KP6, -+ [Q_KEY_CODE_KP_7] = KEY_KP7, -+ [Q_KEY_CODE_KP_8] = KEY_KP8, -+ [Q_KEY_CODE_KP_9] = KEY_KP9, -+ [Q_KEY_CODE_KP_SUBTRACT] = KEY_KPMINUS, -+ [Q_KEY_CODE_KP_ADD] = KEY_KPPLUS, -+ [Q_KEY_CODE_KP_DECIMAL] = KEY_KPDOT, -+ [Q_KEY_CODE_KP_ENTER] = KEY_KPENTER, -+ [Q_KEY_CODE_KP_DIVIDE] = KEY_KPSLASH, -+ [Q_KEY_CODE_KP_MULTIPLY] = KEY_KPASTERISK, -+ -+ [Q_KEY_CODE_F11] = KEY_F11, -+ [Q_KEY_CODE_F12] = KEY_F12, -+ -+ [Q_KEY_CODE_CTRL_R] = KEY_RIGHTCTRL, -+ [Q_KEY_CODE_SYSRQ] = KEY_SYSRQ, -+ [Q_KEY_CODE_ALT_R] = KEY_RIGHTALT, -+ -+ [Q_KEY_CODE_HOME] = KEY_HOME, -+ [Q_KEY_CODE_UP] = KEY_UP, -+ [Q_KEY_CODE_PGUP] = KEY_PAGEUP, -+ [Q_KEY_CODE_LEFT] = KEY_LEFT, -+ [Q_KEY_CODE_RIGHT] = KEY_RIGHT, -+ [Q_KEY_CODE_END] = KEY_END, -+ [Q_KEY_CODE_DOWN] = KEY_DOWN, -+ [Q_KEY_CODE_PGDN] = KEY_PAGEDOWN, -+ [Q_KEY_CODE_INSERT] = KEY_INSERT, -+ [Q_KEY_CODE_DELETE] = KEY_DELETE, -+ -+ [Q_KEY_CODE_META_L] = KEY_LEFTMETA, -+ [Q_KEY_CODE_META_R] = KEY_RIGHTMETA, -+ [Q_KEY_CODE_MENU] = KEY_MENU, -+}; -+ -+static const unsigned int keymap_button[INPUT_BUTTON_MAX] = { -+ [INPUT_BUTTON_LEFT] = BTN_LEFT, -+ [INPUT_BUTTON_RIGHT] = BTN_RIGHT, -+ [INPUT_BUTTON_MIDDLE] = BTN_MIDDLE, -+ [INPUT_BUTTON_WHEEL_UP] = BTN_GEAR_UP, -+ [INPUT_BUTTON_WHEEL_DOWN] = BTN_GEAR_DOWN, -+}; -+ -+static const unsigned int axismap_rel[INPUT_AXIS_MAX] = { -+ [INPUT_AXIS_X] = REL_X, -+ [INPUT_AXIS_Y] = REL_Y, -+}; -+ -+static const unsigned int axismap_abs[INPUT_AXIS_MAX] = { -+ [INPUT_AXIS_X] = ABS_X, -+ [INPUT_AXIS_Y] = ABS_Y, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static void virtio_input_key_config(VirtIOInput *vinput, -+ const unsigned int *keymap, -+ size_t mapsize) -+{ -+ virtio_input_config keys; -+ int i, bit, byte, bmax = 0; -+ -+ memset(&keys, 0, sizeof(keys)); -+ for (i = 0; i < mapsize; i++) { -+ bit = keymap[i]; -+ if (!bit) { -+ continue; -+ } -+ byte = bit / 8; -+ bit = bit % 8; -+ keys.u.bitmap[byte] |= (1 << bit); -+ if (bmax < byte+1) { -+ bmax = byte+1; -+ } -+ } -+ keys.select = VIRTIO_INPUT_CFG_EV_BITS; -+ keys.subsel = EV_KEY; -+ keys.size = bmax; -+ virtio_input_add_config(vinput, &keys); -+} -+ -+static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, -+ InputEvent *evt) -+{ -+ VirtIOInput *vinput = VIRTIO_INPUT(dev); -+ virtio_input_event event; -+ int qcode; -+ -+ switch (evt->kind) { -+ case INPUT_EVENT_KIND_KEY: -+ qcode = qemu_input_key_value_to_qcode(evt->key->key); -+ if (qcode && keymap_qcode[qcode]) { -+ event.type = cpu_to_le16(EV_KEY); -+ event.code = cpu_to_le16(keymap_qcode[qcode]); -+ event.value = cpu_to_le32(evt->key->down ? 1 : 0); -+ virtio_input_send(vinput, &event); -+ } else { -+ if (evt->key->down) { -+ fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__, -+ qcode, QKeyCode_lookup[qcode]); -+ } -+ } -+ break; -+ case INPUT_EVENT_KIND_BTN: -+ if (keymap_button[evt->btn->button]) { -+ event.type = cpu_to_le16(EV_KEY); -+ event.code = cpu_to_le16(keymap_button[evt->btn->button]); -+ event.value = cpu_to_le32(evt->btn->down ? 1 : 0); -+ virtio_input_send(vinput, &event); -+ } else { -+ if (evt->btn->down) { -+ fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__, -+ evt->btn->button, InputButton_lookup[evt->btn->button]); -+ } -+ } -+ break; -+ case INPUT_EVENT_KIND_REL: -+ event.type = cpu_to_le16(EV_REL); -+ event.code = cpu_to_le16(axismap_rel[evt->rel->axis]); -+ event.value = cpu_to_le32(evt->rel->value); -+ virtio_input_send(vinput, &event); -+ break; -+ case INPUT_EVENT_KIND_ABS: -+ event.type = cpu_to_le16(EV_ABS); -+ event.code = cpu_to_le16(axismap_abs[evt->abs->axis]); -+ event.value = cpu_to_le32(evt->abs->value); -+ virtio_input_send(vinput, &event); -+ break; -+ default: -+ /* keep gcc happy */ -+ break; -+ } -+} -+ -+static void virtio_input_handle_sync(DeviceState *dev) -+{ -+ VirtIOInput *vinput = VIRTIO_INPUT(dev); -+ virtio_input_event event = { -+ .type = cpu_to_le16(EV_SYN), -+ .code = cpu_to_le16(SYN_REPORT), -+ .value = 0, -+ }; -+ -+ virtio_input_send(vinput, &event); -+} -+ -+static void virtio_input_hid_realize(DeviceState *dev, Error **errp) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev); -+ vhid->hs = qemu_input_handler_register(dev, vhid->handler); -+} -+ -+static void virtio_input_hid_unrealize(DeviceState *dev, Error **errp) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev); -+ qemu_input_handler_unregister(vhid->hs); -+} -+ -+static void virtio_input_hid_change_active(VirtIOInput *vinput) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(vinput); -+ -+ if (vinput->active) { -+ qemu_input_handler_activate(vhid->hs); -+ } else { -+ qemu_input_handler_deactivate(vhid->hs); -+ } -+} -+ -+static void virtio_input_hid_handle_status(VirtIOInput *vinput, -+ virtio_input_event *event) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(vinput); -+ int ledbit = 0; -+ -+ switch (le16_to_cpu(event->type)) { -+ case EV_LED: -+ if (event->code == LED_NUML) { -+ ledbit = QEMU_NUM_LOCK_LED; -+ } else if (event->code == LED_CAPSL) { -+ ledbit = QEMU_CAPS_LOCK_LED; -+ } else if (event->code == LED_SCROLLL) { -+ ledbit = QEMU_SCROLL_LOCK_LED; -+ } -+ if (event->value) { -+ vhid->ledstate |= ledbit; -+ } else { -+ vhid->ledstate &= ~ledbit; -+ } -+ kbd_put_ledstate(vhid->ledstate); -+ break; -+ default: -+ fprintf(stderr, "%s: unknown type %d\n", __func__, -+ le16_to_cpu(event->type)); -+ break; -+ } -+} -+ -+static void virtio_input_hid_class_init(ObjectClass *klass, void *data) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass); -+ -+ vic->realize = virtio_input_hid_realize; -+ vic->unrealize = virtio_input_hid_unrealize; -+ vic->change_active = virtio_input_hid_change_active; -+ vic->handle_status = virtio_input_hid_handle_status; -+} -+ -+static const TypeInfo virtio_input_hid_info = { -+ .name = TYPE_VIRTIO_INPUT_HID, -+ .parent = TYPE_VIRTIO_INPUT, -+ .instance_size = sizeof(VirtIOInputHID), -+ .class_init = virtio_input_hid_class_init, -+ .abstract = true, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static QemuInputHandler virtio_keyboard_handler = { -+ .name = VIRTIO_ID_NAME_KEYBOARD, -+ .mask = INPUT_EVENT_MASK_KEY, -+ .event = virtio_input_handle_event, -+ .sync = virtio_input_handle_sync, -+}; -+ -+static struct virtio_input_config virtio_keyboard_config[] = { -+ { -+ .select = VIRTIO_INPUT_CFG_ID_NAME, -+ .size = sizeof(VIRTIO_ID_NAME_KEYBOARD), -+ .u.string = VIRTIO_ID_NAME_KEYBOARD, -+ },{ -+ .select = VIRTIO_INPUT_CFG_ID_DEVIDS, -+ .size = sizeof(struct virtio_input_devids), -+ .u.ids = { -+ .bustype = const_le16(BUS_VIRTUAL), -+ .vendor = const_le16(0x0627), /* same we use for usb hid devices */ -+ .product = const_le16(0x0001), -+ .version = const_le16(0x0001), -+ }, -+ },{ -+ .select = VIRTIO_INPUT_CFG_EV_BITS, -+ .subsel = EV_REP, -+ .size = 1, -+ },{ -+ .select = VIRTIO_INPUT_CFG_EV_BITS, -+ .subsel = EV_LED, -+ .size = 1, -+ .u.bitmap = { -+ (1 << LED_NUML) | (1 << LED_CAPSL) | (1 << LED_SCROLLL), -+ }, -+ }, -+ { /* end of list */ }, -+}; -+ -+static void virtio_keyboard_init(Object *obj) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj); -+ VirtIOInput *vinput = VIRTIO_INPUT(obj); -+ -+ vhid->handler = &virtio_keyboard_handler; -+ virtio_input_init_config(vinput, virtio_keyboard_config); -+ virtio_input_key_config(vinput, keymap_qcode, -+ ARRAY_SIZE(keymap_qcode)); -+} -+ -+static const TypeInfo virtio_keyboard_info = { -+ .name = TYPE_VIRTIO_KEYBOARD, -+ .parent = TYPE_VIRTIO_INPUT_HID, -+ .instance_size = sizeof(VirtIOInputHID), -+ .instance_init = virtio_keyboard_init, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static QemuInputHandler virtio_mouse_handler = { -+ .name = VIRTIO_ID_NAME_MOUSE, -+ .mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL, -+ .event = virtio_input_handle_event, -+ .sync = virtio_input_handle_sync, -+}; -+ -+static struct virtio_input_config virtio_mouse_config[] = { -+ { -+ .select = VIRTIO_INPUT_CFG_ID_NAME, -+ .size = sizeof(VIRTIO_ID_NAME_MOUSE), -+ .u.string = VIRTIO_ID_NAME_MOUSE, -+ },{ -+ .select = VIRTIO_INPUT_CFG_ID_DEVIDS, -+ .size = sizeof(struct virtio_input_devids), -+ .u.ids = { -+ .bustype = const_le16(BUS_VIRTUAL), -+ .vendor = const_le16(0x0627), /* same we use for usb hid devices */ -+ .product = const_le16(0x0002), -+ .version = const_le16(0x0001), -+ }, -+ },{ -+ .select = VIRTIO_INPUT_CFG_EV_BITS, -+ .subsel = EV_REL, -+ .size = 1, -+ .u.bitmap = { -+ (1 << REL_X) | (1 << REL_Y), -+ }, -+ }, -+ { /* end of list */ }, -+}; -+ -+static void virtio_mouse_init(Object *obj) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj); -+ VirtIOInput *vinput = VIRTIO_INPUT(obj); -+ -+ vhid->handler = &virtio_mouse_handler; -+ virtio_input_init_config(vinput, virtio_mouse_config); -+ virtio_input_key_config(vinput, keymap_button, -+ ARRAY_SIZE(keymap_button)); -+} -+ -+static const TypeInfo virtio_mouse_info = { -+ .name = TYPE_VIRTIO_MOUSE, -+ .parent = TYPE_VIRTIO_INPUT_HID, -+ .instance_size = sizeof(VirtIOInputHID), -+ .instance_init = virtio_mouse_init, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static QemuInputHandler virtio_tablet_handler = { -+ .name = VIRTIO_ID_NAME_TABLET, -+ .mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS, -+ .event = virtio_input_handle_event, -+ .sync = virtio_input_handle_sync, -+}; -+ -+static struct virtio_input_config virtio_tablet_config[] = { -+ { -+ .select = VIRTIO_INPUT_CFG_ID_NAME, -+ .size = sizeof(VIRTIO_ID_NAME_TABLET), -+ .u.string = VIRTIO_ID_NAME_TABLET, -+ },{ -+ .select = VIRTIO_INPUT_CFG_ID_DEVIDS, -+ .size = sizeof(struct virtio_input_devids), -+ .u.ids = { -+ .bustype = const_le16(BUS_VIRTUAL), -+ .vendor = const_le16(0x0627), /* same we use for usb hid devices */ -+ .product = const_le16(0x0003), -+ .version = const_le16(0x0001), -+ }, -+ },{ -+ .select = VIRTIO_INPUT_CFG_EV_BITS, -+ .subsel = EV_ABS, -+ .size = 1, -+ .u.bitmap = { -+ (1 << ABS_X) | (1 << ABS_Y), -+ }, -+ },{ -+ .select = VIRTIO_INPUT_CFG_ABS_INFO, -+ .subsel = ABS_X, -+ .size = sizeof(virtio_input_absinfo), -+ .u.abs.max = const_le32(INPUT_EVENT_ABS_SIZE), -+ },{ -+ .select = VIRTIO_INPUT_CFG_ABS_INFO, -+ .subsel = ABS_Y, -+ .size = sizeof(virtio_input_absinfo), -+ .u.abs.max = const_le32(INPUT_EVENT_ABS_SIZE), -+ }, -+ { /* end of list */ }, -+}; -+ -+static void virtio_tablet_init(Object *obj) -+{ -+ VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj); -+ VirtIOInput *vinput = VIRTIO_INPUT(obj); -+ -+ vhid->handler = &virtio_tablet_handler; -+ virtio_input_init_config(vinput, virtio_tablet_config); -+ virtio_input_key_config(vinput, keymap_button, -+ ARRAY_SIZE(keymap_button)); -+} -+ -+static const TypeInfo virtio_tablet_info = { -+ .name = TYPE_VIRTIO_TABLET, -+ .parent = TYPE_VIRTIO_INPUT_HID, -+ .instance_size = sizeof(VirtIOInputHID), -+ .instance_init = virtio_tablet_init, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static void virtio_register_types(void) -+{ -+ type_register_static(&virtio_input_hid_info); -+ type_register_static(&virtio_keyboard_info); -+ type_register_static(&virtio_mouse_info); -+ type_register_static(&virtio_tablet_info); -+} -+ -+type_init(virtio_register_types) -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -index ad915cc..a265519 100644 ---- a/include/hw/virtio/virtio-input.h -+++ b/include/hw/virtio/virtio-input.h -@@ -34,9 +34,23 @@ typedef struct virtio_input_event virtio_input_event; - #define VIRTIO_INPUT_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT) - -+#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid" -+#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard" -+#define TYPE_VIRTIO_MOUSE "virtio-mouse" -+#define TYPE_VIRTIO_TABLET "virtio-tablet" -+ -+#define VIRTIO_INPUT_HID(obj) \ -+ OBJECT_CHECK(VirtIOInputHID, (obj), TYPE_VIRTIO_INPUT_HID) -+#define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \ -+ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID) -+ -+#define DEFINE_VIRTIO_INPUT_PROPERTIES(_state, _field) \ -+ DEFINE_PROP_STRING("serial", _state, _field.serial) -+ - typedef struct VirtIOInput VirtIOInput; - typedef struct VirtIOInputClass VirtIOInputClass; - typedef struct VirtIOInputConfig VirtIOInputConfig; -+typedef struct VirtIOInputHID VirtIOInputHID; - - struct virtio_input_conf { - char *serial; -@@ -73,6 +87,13 @@ struct VirtIOInputClass { - void (*handle_status)(VirtIOInput *vinput, virtio_input_event *event); - }; - -+struct VirtIOInputHID { -+ VirtIOInput parent_obj; -+ QemuInputHandler *handler; -+ QemuInputHandlerState *hs; -+ int ledstate; -+}; -+ - void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event); - void virtio_input_init_config(VirtIOInput *vinput, - virtio_input_config *config); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-emulated-devices-pci.patch b/SOURCES/kvm-virtio-input-emulated-devices-pci.patch deleted file mode 100644 index 0a44cc4..0000000 --- a/SOURCES/kvm-virtio-input-emulated-devices-pci.patch +++ /dev/null @@ -1,184 +0,0 @@ -From ee1882452a6bbc1188d630a7cb997b21e3814254 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:58 +0200 -Subject: [PATCH 170/217] virtio-input: emulated devices [pci] - -Message-id: <1436260751-25015-56-git-send-email-jasowang@redhat.com> -Patchwork-id: 66830 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 55/68] virtio-input: emulated devices [pci] -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -This patch adds virtio-pci support for the emulated virtio-input -devices. Using them is as simple as adding "-device virtio-tablet-pci" -to your command line. If you want add multiple devices but don't want -waste a pci slot for each you can compose a multifunction device this way: - -qemu -device virtio-keyboard-pci,addr=0d.0,multifunction=on \ - -device virtio-tablet-pci,addr=0d.1,multifunction=on - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 710e2d90da1a16807f7885d37b203ce739fdc53a) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ - hw/virtio/virtio-pci.h | 13 ++++++++ - 2 files changed, 97 insertions(+) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 24ba519..1aba4e2 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1928,6 +1928,12 @@ static const TypeInfo virtio_rng_pci_info = { - - /* virtio-input-pci */ - -+static Property virtio_input_hid_pci_properties[] = { -+ DEFINE_VIRTIO_INPUT_PROPERTIES(VirtIOInputPCI, vdev.input), -+ DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), -+ DEFINE_PROP_END_OF_LIST(), -+}; -+ - static void virtio_input_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) - { - VirtIOInputPCI *vinput = VIRTIO_INPUT_PCI(vpci_dev); -@@ -1952,6 +1958,49 @@ static void virtio_input_pci_class_init(ObjectClass *klass, void *data) - pcidev_k->class_id = PCI_CLASS_INPUT_OTHER; - } - -+static void virtio_input_hid_pci_class_init(ObjectClass *klass, void *data) -+{ -+ DeviceClass *dc = DEVICE_CLASS(klass); -+ -+ dc->props = virtio_input_hid_pci_properties; -+} -+ -+static void virtio_input_hid_kbd_pci_class_init(ObjectClass *klass, void *data) -+{ -+ PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); -+ -+ pcidev_k->class_id = PCI_CLASS_INPUT_KEYBOARD; -+} -+ -+static void virtio_input_hid_mouse_pci_class_init(ObjectClass *klass, -+ void *data) -+{ -+ PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); -+ -+ pcidev_k->class_id = PCI_CLASS_INPUT_MOUSE; -+} -+ -+static void virtio_keyboard_initfn(Object *obj) -+{ -+ VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); -+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_KEYBOARD); -+ object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); -+} -+ -+static void virtio_mouse_initfn(Object *obj) -+{ -+ VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); -+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_MOUSE); -+ object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); -+} -+ -+static void virtio_tablet_initfn(Object *obj) -+{ -+ VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); -+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_TABLET); -+ object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); -+} -+ - static const TypeInfo virtio_input_pci_info = { - .name = TYPE_VIRTIO_INPUT_PCI, - .parent = TYPE_VIRTIO_PCI, -@@ -1960,6 +2009,37 @@ static const TypeInfo virtio_input_pci_info = { - .abstract = true, - }; - -+static const TypeInfo virtio_input_hid_pci_info = { -+ .name = TYPE_VIRTIO_INPUT_HID_PCI, -+ .parent = TYPE_VIRTIO_INPUT_PCI, -+ .instance_size = sizeof(VirtIOInputHIDPCI), -+ .class_init = virtio_input_hid_pci_class_init, -+ .abstract = true, -+}; -+ -+static const TypeInfo virtio_keyboard_pci_info = { -+ .name = TYPE_VIRTIO_KEYBOARD_PCI, -+ .parent = TYPE_VIRTIO_INPUT_HID_PCI, -+ .class_init = virtio_input_hid_kbd_pci_class_init, -+ .instance_size = sizeof(VirtIOInputHIDPCI), -+ .instance_init = virtio_keyboard_initfn, -+}; -+ -+static const TypeInfo virtio_mouse_pci_info = { -+ .name = TYPE_VIRTIO_MOUSE_PCI, -+ .parent = TYPE_VIRTIO_INPUT_HID_PCI, -+ .class_init = virtio_input_hid_mouse_pci_class_init, -+ .instance_size = sizeof(VirtIOInputHIDPCI), -+ .instance_init = virtio_mouse_initfn, -+}; -+ -+static const TypeInfo virtio_tablet_pci_info = { -+ .name = TYPE_VIRTIO_TABLET_PCI, -+ .parent = TYPE_VIRTIO_INPUT_HID_PCI, -+ .instance_size = sizeof(VirtIOInputHIDPCI), -+ .instance_init = virtio_tablet_initfn, -+}; -+ - /* virtio-pci-bus */ - - static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, -@@ -2002,6 +2082,10 @@ static void virtio_pci_register_types(void) - { - type_register_static(&virtio_rng_pci_info); - type_register_static(&virtio_input_pci_info); -+ type_register_static(&virtio_input_hid_pci_info); -+ type_register_static(&virtio_keyboard_pci_info); -+ type_register_static(&virtio_mouse_pci_info); -+ type_register_static(&virtio_tablet_pci_info); - type_register_static(&virtio_pci_bus_info); - type_register_static(&virtio_pci_info); - #ifdef CONFIG_VIRTFS -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index 754971f..d962125 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -41,6 +41,7 @@ typedef struct VirtIONetPCI VirtIONetPCI; - typedef struct VHostSCSIPCI VHostSCSIPCI; - typedef struct VirtIORngPCI VirtIORngPCI; - typedef struct VirtIOInputPCI VirtIOInputPCI; -+typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; - - /* virtio-pci-bus */ - -@@ -248,6 +249,18 @@ struct VirtIOInputPCI { - VirtIOInput vdev; - }; - -+#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" -+#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" -+#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" -+#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" -+#define VIRTIO_INPUT_HID_PCI(obj) \ -+ OBJECT_CHECK(VirtIOInputHIDPCI, (obj), TYPE_VIRTIO_INPUT_HID_PCI) -+ -+struct VirtIOInputHIDPCI { -+ VirtIOPCIProxy parent_obj; -+ VirtIOInputHID vdev; -+}; -+ - /* Virtio ABI version, if we increment this, we break the guest driver. */ - #define VIRTIO_PCI_ABI_VERSION 0 - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-evdev-passthrough.patch b/SOURCES/kvm-virtio-input-evdev-passthrough.patch deleted file mode 100644 index 195b641..0000000 --- a/SOURCES/kvm-virtio-input-evdev-passthrough.patch +++ /dev/null @@ -1,355 +0,0 @@ -From ea0f75600c2b5e67f750f5b003189a9eeec1b812 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:08 +0200 -Subject: [PATCH 180/217] virtio-input: evdev passthrough - -Message-id: <1436260751-25015-66-git-send-email-jasowang@redhat.com> -Patchwork-id: 66840 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 65/68] virtio-input: evdev passthrough -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Notes: conflicts since virtio-gpu was not backported - -This allows to assign host input devices to the guest: - -qemu -device virtio-input-host-pci,evdev=/dev/input/event<nr> - -The guest gets exclusive access to the input device, so be careful -with assigning the keyboard if you have only one connected to your -machine. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 006a5edebe656114e0e0a6fb24b8aae6401c1cf4) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/virtio/virtio-pci.h ---- - hw/input/Makefile.objs | 1 + - hw/input/virtio-input-host.c | 188 +++++++++++++++++++++++++++++++++++++++ - hw/virtio/virtio-pci.c | 16 ++++ - hw/virtio/virtio-pci.h | 10 +++ - include/hw/virtio/virtio-input.h | 13 +++ - 5 files changed, 228 insertions(+) - create mode 100644 hw/input/virtio-input-host.c - -diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs -index 0dae710..624ba7e 100644 ---- a/hw/input/Makefile.objs -+++ b/hw/input/Makefile.objs -@@ -11,6 +11,7 @@ common-obj-$(CONFIG_VMMOUSE) += vmmouse.o - ifeq ($(CONFIG_LINUX),y) - common-obj-$(CONFIG_VIRTIO) += virtio-input.o - common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o -+common-obj-$(CONFIG_VIRTIO) += virtio-input-host.o - endif - - obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o -diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c -new file mode 100644 -index 0000000..f7e3d84 ---- /dev/null -+++ b/hw/input/virtio-input-host.c -@@ -0,0 +1,188 @@ -+/* -+ * This work is licensed under the terms of the GNU GPL, version 2 or -+ * (at your option) any later version. See the COPYING file in the -+ * top-level directory. -+ */ -+ -+#include "qemu-common.h" -+#include "qemu/sockets.h" -+ -+#include "hw/qdev.h" -+#include "hw/virtio/virtio.h" -+#include "hw/virtio/virtio-input.h" -+ -+#include "standard-headers/linux/input.h" -+ -+/* ----------------------------------------------------------------- */ -+ -+static struct virtio_input_config virtio_input_host_config[] = { -+ { /* empty list */ }, -+}; -+ -+static void virtio_input_host_event(void *opaque) -+{ -+ VirtIOInputHost *vih = opaque; -+ VirtIOInput *vinput = VIRTIO_INPUT(vih); -+ struct virtio_input_event virtio; -+ struct input_event evdev; -+ int rc; -+ -+ for (;;) { -+ rc = read(vih->fd, &evdev, sizeof(evdev)); -+ if (rc != sizeof(evdev)) { -+ break; -+ } -+ -+ virtio.type = cpu_to_le16(evdev.type); -+ virtio.code = cpu_to_le16(evdev.code); -+ virtio.value = cpu_to_le32(evdev.value); -+ virtio_input_send(vinput, &virtio); -+ } -+} -+ -+static void virtio_input_bits_config(VirtIOInputHost *vih, -+ int type, int count) -+{ -+ virtio_input_config bits; -+ int rc, i, size = 0; -+ -+ memset(&bits, 0, sizeof(bits)); -+ rc = ioctl(vih->fd, EVIOCGBIT(type, count/8), bits.u.bitmap); -+ if (rc < 0) { -+ return; -+ } -+ -+ for (i = 0; i < count/8; i++) { -+ if (bits.u.bitmap[i]) { -+ size = i+1; -+ } -+ } -+ if (size == 0) { -+ return; -+ } -+ -+ bits.select = VIRTIO_INPUT_CFG_EV_BITS; -+ bits.subsel = type; -+ bits.size = size; -+ virtio_input_add_config(VIRTIO_INPUT(vih), &bits); -+} -+ -+static void virtio_input_host_realize(DeviceState *dev, Error **errp) -+{ -+ VirtIOInputHost *vih = VIRTIO_INPUT_HOST(dev); -+ VirtIOInput *vinput = VIRTIO_INPUT(dev); -+ virtio_input_config id; -+ struct input_id ids; -+ int rc, ver; -+ -+ if (!vih->evdev) { -+ error_setg(errp, "evdev property is required"); -+ return; -+ } -+ -+ vih->fd = open(vih->evdev, O_RDWR); -+ if (vih->fd < 0) { -+ error_setg_file_open(errp, errno, vih->evdev); -+ return; -+ } -+ qemu_set_nonblock(vih->fd); -+ -+ rc = ioctl(vih->fd, EVIOCGVERSION, &ver); -+ if (rc < 0) { -+ error_setg(errp, "%s: is not an evdev device", vih->evdev); -+ goto err_close; -+ } -+ -+ rc = ioctl(vih->fd, EVIOCGRAB, 1); -+ if (rc < 0) { -+ error_setg_errno(errp, errno, "%s: failed to get exclusive access", -+ vih->evdev); -+ goto err_close; -+ } -+ -+ memset(&id, 0, sizeof(id)); -+ ioctl(vih->fd, EVIOCGNAME(sizeof(id.u.string)-1), id.u.string); -+ id.select = VIRTIO_INPUT_CFG_ID_NAME; -+ id.size = strlen(id.u.string); -+ virtio_input_add_config(vinput, &id); -+ -+ if (ioctl(vih->fd, EVIOCGID, &ids) == 0) { -+ memset(&id, 0, sizeof(id)); -+ id.select = VIRTIO_INPUT_CFG_ID_DEVIDS; -+ id.size = sizeof(struct virtio_input_devids); -+ id.u.ids.bustype = cpu_to_le16(ids.bustype); -+ id.u.ids.vendor = cpu_to_le16(ids.vendor); -+ id.u.ids.product = cpu_to_le16(ids.product); -+ id.u.ids.version = cpu_to_le16(ids.version); -+ virtio_input_add_config(vinput, &id); -+ } -+ -+ virtio_input_bits_config(vih, EV_KEY, KEY_CNT); -+ virtio_input_bits_config(vih, EV_REL, REL_CNT); -+ virtio_input_bits_config(vih, EV_ABS, ABS_CNT); -+ virtio_input_bits_config(vih, EV_MSC, MSC_CNT); -+ virtio_input_bits_config(vih, EV_SW, SW_CNT); -+ -+ qemu_set_fd_handler(vih->fd, virtio_input_host_event, NULL, vih); -+ return; -+ -+err_close: -+ close(vih->fd); -+ vih->fd = -1; -+ return; -+} -+ -+static void virtio_input_host_unrealize(DeviceState *dev, Error **errp) -+{ -+ VirtIOInputHost *vih = VIRTIO_INPUT_HOST(dev); -+ -+ if (vih->fd > 0) { -+ qemu_set_fd_handler(vih->fd, NULL, NULL, NULL); -+ close(vih->fd); -+ } -+} -+ -+static const VMStateDescription vmstate_virtio_input_host = { -+ .name = "virtio-input-host", -+ .unmigratable = 1, -+}; -+ -+static Property virtio_input_host_properties[] = { -+ DEFINE_PROP_STRING("evdev", VirtIOInputHost, evdev), -+ DEFINE_PROP_END_OF_LIST(), -+}; -+ -+static void virtio_input_host_class_init(ObjectClass *klass, void *data) -+{ -+ VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass); -+ DeviceClass *dc = DEVICE_CLASS(klass); -+ -+ dc->vmsd = &vmstate_virtio_input_host; -+ dc->props = virtio_input_host_properties; -+ vic->realize = virtio_input_host_realize; -+ vic->unrealize = virtio_input_host_unrealize; -+} -+ -+static void virtio_input_host_init(Object *obj) -+{ -+ VirtIOInput *vinput = VIRTIO_INPUT(obj); -+ -+ virtio_input_init_config(vinput, virtio_input_host_config); -+} -+ -+static const TypeInfo virtio_input_host_info = { -+ .name = TYPE_VIRTIO_INPUT_HOST, -+ .parent = TYPE_VIRTIO_INPUT, -+ .instance_size = sizeof(VirtIOInputHost), -+ .instance_init = virtio_input_host_init, -+ .class_init = virtio_input_host_class_init, -+}; -+ -+/* ----------------------------------------------------------------- */ -+ -+static void virtio_register_types(void) -+{ -+ type_register_static(&virtio_input_host_info); -+} -+ -+type_init(virtio_register_types) -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index c69f066..e2e1eb5 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1997,6 +1997,14 @@ static void virtio_tablet_initfn(Object *obj) - TYPE_VIRTIO_TABLET); - } - -+static void virtio_host_initfn(Object *obj) -+{ -+ VirtIOInputHostPCI *dev = VIRTIO_INPUT_HOST_PCI(obj); -+ -+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), -+ TYPE_VIRTIO_INPUT_HOST); -+} -+ - static const TypeInfo virtio_input_pci_info = { - .name = TYPE_VIRTIO_INPUT_PCI, - .parent = TYPE_VIRTIO_PCI, -@@ -2035,6 +2043,13 @@ static const TypeInfo virtio_tablet_pci_info = { - .instance_init = virtio_tablet_initfn, - }; - -+static const TypeInfo virtio_host_pci_info = { -+ .name = TYPE_VIRTIO_INPUT_HOST_PCI, -+ .parent = TYPE_VIRTIO_INPUT_PCI, -+ .instance_size = sizeof(VirtIOInputHostPCI), -+ .instance_init = virtio_host_initfn, -+}; -+ - /* virtio-pci-bus */ - - static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, -@@ -2081,6 +2096,7 @@ static void virtio_pci_register_types(void) - type_register_static(&virtio_keyboard_pci_info); - type_register_static(&virtio_mouse_pci_info); - type_register_static(&virtio_tablet_pci_info); -+ type_register_static(&virtio_host_pci_info); - type_register_static(&virtio_pci_bus_info); - type_register_static(&virtio_pci_info); - #ifdef CONFIG_VIRTFS -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index d962125..e7c8f22 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -42,6 +42,7 @@ typedef struct VHostSCSIPCI VHostSCSIPCI; - typedef struct VirtIORngPCI VirtIORngPCI; - typedef struct VirtIOInputPCI VirtIOInputPCI; - typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; -+typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; - - /* virtio-pci-bus */ - -@@ -261,6 +262,15 @@ struct VirtIOInputHIDPCI { - VirtIOInputHID vdev; - }; - -+#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci" -+#define VIRTIO_INPUT_HOST_PCI(obj) \ -+ OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI) -+ -+struct VirtIOInputHostPCI { -+ VirtIOPCIProxy parent_obj; -+ VirtIOInputHost vdev; -+}; -+ - /* Virtio ABI version, if we increment this, we break the guest driver. */ - #define VIRTIO_PCI_ABI_VERSION 0 - -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -index 8160dd6..fd5417d 100644 ---- a/include/hw/virtio/virtio-input.h -+++ b/include/hw/virtio/virtio-input.h -@@ -50,10 +50,17 @@ typedef struct virtio_input_event virtio_input_event; - #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \ - OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID) - -+#define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device" -+#define VIRTIO_INPUT_HOST(obj) \ -+ OBJECT_CHECK(VirtIOInputHost, (obj), TYPE_VIRTIO_INPUT_HOST) -+#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \ -+ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST) -+ - typedef struct VirtIOInput VirtIOInput; - typedef struct VirtIOInputClass VirtIOInputClass; - typedef struct VirtIOInputConfig VirtIOInputConfig; - typedef struct VirtIOInputHID VirtIOInputHID; -+typedef struct VirtIOInputHost VirtIOInputHost; - - struct VirtIOInputConfig { - virtio_input_config config; -@@ -93,6 +100,12 @@ struct VirtIOInputHID { - int ledstate; - }; - -+struct VirtIOInputHost { -+ VirtIOInput parent_obj; -+ char *evdev; -+ int fd; -+}; -+ - void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event); - void virtio_input_init_config(VirtIOInput *vinput, - virtio_input_config *config); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-make-virtio-devices-follow-usual-naming.patch b/SOURCES/kvm-virtio-input-make-virtio-devices-follow-usual-naming.patch deleted file mode 100644 index ccd6ac2..0000000 --- a/SOURCES/kvm-virtio-input-make-virtio-devices-follow-usual-naming.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 3ada75990b91f65d086078feb7fd1c7324222d73 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:26 +0200 -Subject: [PATCH 138/217] virtio-input: make virtio devices follow usual naming - convention - -Message-id: <1436260751-25015-24-git-send-email-jasowang@redhat.com> -Patchwork-id: 66798 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 23/68] virtio-input: make virtio devices follow usual naming convention -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit e63d114b8a81e22ff9295674ba64b21255d589ee) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/virtio/virtio-input.h | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -index bcee355..8134178 100644 ---- a/include/hw/virtio/virtio-input.h -+++ b/include/hw/virtio/virtio-input.h -@@ -40,10 +40,10 @@ typedef struct virtio_input_event virtio_input_event; - #define VIRTIO_INPUT_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT) - --#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid" --#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard" --#define TYPE_VIRTIO_MOUSE "virtio-mouse" --#define TYPE_VIRTIO_TABLET "virtio-tablet" -+#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device" -+#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device" -+#define TYPE_VIRTIO_MOUSE "virtio-mouse-device" -+#define TYPE_VIRTIO_TABLET "virtio-tablet-device" - - #define VIRTIO_INPUT_HID(obj) \ - OBJECT_CHECK(VirtIOInputHID, (obj), TYPE_VIRTIO_INPUT_HID) --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-input-move-properties-use-virtio_instance_ini.patch b/SOURCES/kvm-virtio-input-move-properties-use-virtio_instance_ini.patch deleted file mode 100644 index 49d7546..0000000 --- a/SOURCES/kvm-virtio-input-move-properties-use-virtio_instance_ini.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 34954b98cd81e0ef430de834dead739a0b650d02 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:07 +0200 -Subject: [PATCH 179/217] virtio-input: move properties, use - virtio_instance_init_common - -Message-id: <1436260751-25015-65-git-send-email-jasowang@redhat.com> -Patchwork-id: 66839 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 64/68] virtio-input: move properties, use virtio_instance_init_common -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Move properties from virtio-*-pci to virtio-*-device. -Also make better use of QOM and attach common properties -to the abstract parent classes (virtio-input-device and -virtio-input-pci-device). - -Switch the hid device instance init functions over to use -virtio_instance_init_common, so we get the properties of the -virtio device aliased properly to the virtio pci proxy. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -(cherry picked from commit 6f2b9a5b24c488d38ace01910c684749ff922e26) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/input/virtio-input.c | 8 +++++++- - hw/virtio/virtio-pci.c | 27 +++++++++++---------------- - include/hw/virtio/virtio-input.h | 9 +-------- - 3 files changed, 19 insertions(+), 25 deletions(-) - -diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c -index c4f4b3c..7f5b8d6 100644 ---- a/hw/input/virtio-input.c -+++ b/hw/input/virtio-input.c -@@ -216,7 +216,7 @@ static void virtio_input_device_realize(DeviceState *dev, Error **errp) - } - - virtio_input_idstr_config(vinput, VIRTIO_INPUT_CFG_ID_SERIAL, -- vinput->input.serial); -+ vinput->serial); - - QTAILQ_FOREACH(cfg, &vinput->cfg_list, node) { - if (vinput->cfg_size < cfg->config.size) { -@@ -248,11 +248,17 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp) - virtio_cleanup(vdev); - } - -+static Property virtio_input_properties[] = { -+ DEFINE_PROP_STRING("serial", VirtIOInput, serial), -+ DEFINE_PROP_END_OF_LIST(), -+}; -+ - static void virtio_input_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); - -+ dc->props = virtio_input_properties; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - vdc->realize = virtio_input_device_realize; - vdc->unrealize = virtio_input_device_unrealize; -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 9b5f009..c69f066 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1928,8 +1928,7 @@ static const TypeInfo virtio_rng_pci_info = { - - /* virtio-input-pci */ - --static Property virtio_input_hid_pci_properties[] = { -- DEFINE_VIRTIO_INPUT_PROPERTIES(VirtIOInputPCI, vdev.input), -+static Property virtio_input_pci_properties[] = { - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), - DEFINE_PROP_END_OF_LIST(), - }; -@@ -1952,19 +1951,13 @@ static void virtio_input_pci_class_init(ObjectClass *klass, void *data) - VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); - PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); - -+ dc->props = virtio_input_pci_properties; - k->realize = virtio_input_pci_realize; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - - pcidev_k->class_id = PCI_CLASS_INPUT_OTHER; - } - --static void virtio_input_hid_pci_class_init(ObjectClass *klass, void *data) --{ -- DeviceClass *dc = DEVICE_CLASS(klass); -- -- dc->props = virtio_input_hid_pci_properties; --} -- - static void virtio_input_hid_kbd_pci_class_init(ObjectClass *klass, void *data) - { - PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); -@@ -1983,22 +1976,25 @@ static void virtio_input_hid_mouse_pci_class_init(ObjectClass *klass, - static void virtio_keyboard_initfn(Object *obj) - { - VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); -- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_KEYBOARD); -- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); -+ -+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), -+ TYPE_VIRTIO_KEYBOARD); - } - - static void virtio_mouse_initfn(Object *obj) - { - VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); -- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_MOUSE); -- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); -+ -+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), -+ TYPE_VIRTIO_MOUSE); - } - - static void virtio_tablet_initfn(Object *obj) - { - VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); -- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_TABLET); -- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); -+ -+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), -+ TYPE_VIRTIO_TABLET); - } - - static const TypeInfo virtio_input_pci_info = { -@@ -2013,7 +2009,6 @@ static const TypeInfo virtio_input_hid_pci_info = { - .name = TYPE_VIRTIO_INPUT_HID_PCI, - .parent = TYPE_VIRTIO_INPUT_PCI, - .instance_size = sizeof(VirtIOInputHIDPCI), -- .class_init = virtio_input_hid_pci_class_init, - .abstract = true, - }; - -diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h -index 8134178..8160dd6 100644 ---- a/include/hw/virtio/virtio-input.h -+++ b/include/hw/virtio/virtio-input.h -@@ -50,18 +50,11 @@ typedef struct virtio_input_event virtio_input_event; - #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \ - OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID) - --#define DEFINE_VIRTIO_INPUT_PROPERTIES(_state, _field) \ -- DEFINE_PROP_STRING("serial", _state, _field.serial) -- - typedef struct VirtIOInput VirtIOInput; - typedef struct VirtIOInputClass VirtIOInputClass; - typedef struct VirtIOInputConfig VirtIOInputConfig; - typedef struct VirtIOInputHID VirtIOInputHID; - --struct virtio_input_conf { -- char *serial; --}; -- - struct VirtIOInputConfig { - virtio_input_config config; - QTAILQ_ENTRY(VirtIOInputConfig) node; -@@ -74,7 +67,7 @@ struct VirtIOInput { - uint32_t cfg_size; - QTAILQ_HEAD(, VirtIOInputConfig) cfg_list; - VirtQueue *evt, *sts; -- virtio_input_conf input; -+ char *serial; - - virtio_input_event *queue; - uint32_t qindex, qsize; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-introduce-vector-to-virtqueues-mapping.patch b/SOURCES/kvm-virtio-introduce-vector-to-virtqueues-mapping.patch deleted file mode 100644 index 193b018..0000000 --- a/SOURCES/kvm-virtio-introduce-vector-to-virtqueues-mapping.patch +++ /dev/null @@ -1,184 +0,0 @@ -From d0fef479dd943234d2179e9f9d878094816c4079 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:44 +0200 -Subject: [PATCH 023/217] virtio: introduce vector to virtqueues mapping - -Message-id: <1434607916-15166-9-git-send-email-jasowang@redhat.com> -Patchwork-id: 66306 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 08/20] virtio: introduce vector to virtqueues mapping -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Currently we will try to traverse all virtqueues to find a subset that -using a specific vector. This is sub optimal when we will support -hundreds or even thousands of virtqueues. So this patch introduces a -method which could be used by transport to get all virtqueues that -using a same vector. This is done through QLISTs and the number of -QLISTs was queried through a transport specific method. When guest -setting vectors, the virtqueue will be linked and helpers for traverse -the list was also introduced. - -The first user will be virtio pci which will use this to speed up -MSI-X masking and unmasking handling. - -Cc: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit e0d686bf4b9d018ba5449f057b486bb5e1fa1a0d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 8 ++++++++ - hw/virtio/virtio.c | 36 ++++++++++++++++++++++++++++++++++-- - include/hw/virtio/virtio-bus.h | 1 + - include/hw/virtio/virtio.h | 3 +++ - 4 files changed, 46 insertions(+), 2 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index aa34aa5..6b064b9 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -908,6 +908,13 @@ static const TypeInfo virtio_9p_pci_info = { - * virtio-pci: This is the PCIDevice which has a virtio-pci-bus. - */ - -+static int virtio_pci_query_nvectors(DeviceState *d) -+{ -+ VirtIOPCIProxy *proxy = VIRTIO_PCI(d); -+ -+ return proxy->nvectors; -+} -+ - /* This is called by virtio-bus just after the device is plugged. */ - static void virtio_pci_device_plugged(DeviceState *d) - { -@@ -1498,6 +1505,7 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) - k->vmstate_change = virtio_pci_vmstate_change; - k->device_plugged = virtio_pci_device_plugged; - k->device_unplugged = virtio_pci_device_unplugged; -+ k->query_nvectors = virtio_pci_query_nvectors; - } - - static const TypeInfo virtio_pci_bus_info = { -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 17c1260..6985e76 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -89,6 +89,7 @@ struct VirtQueue - VirtIODevice *vdev; - EventNotifier guest_notifier; - EventNotifier host_notifier; -+ QLIST_ENTRY(VirtQueue) node; - }; - - /* virt queue functions */ -@@ -605,7 +606,7 @@ void virtio_reset(void *opaque) - vdev->vq[i].vring.used = 0; - vdev->vq[i].last_avail_idx = 0; - vdev->vq[i].pa = 0; -- vdev->vq[i].vector = VIRTIO_NO_VECTOR; -+ virtio_queue_set_vector(vdev, i, VIRTIO_NO_VECTOR); - vdev->vq[i].signalled_used = 0; - vdev->vq[i].signalled_used_valid = false; - vdev->vq[i].notification = true; -@@ -730,6 +731,16 @@ void virtio_queue_set_num(VirtIODevice *vdev, int n, int num) - virtqueue_init(&vdev->vq[n]); - } - -+VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector) -+{ -+ return QLIST_FIRST(&vdev->vector_queues[vector]); -+} -+ -+VirtQueue *virtio_vector_next_queue(VirtQueue *vq) -+{ -+ return QLIST_NEXT(vq, node); -+} -+ - int virtio_queue_get_num(VirtIODevice *vdev, int n) - { - return vdev->vq[n].vring.num; -@@ -780,8 +791,19 @@ uint16_t virtio_queue_vector(VirtIODevice *vdev, int n) - - void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector) - { -- if (n < VIRTIO_PCI_QUEUE_MAX) -+ VirtQueue *vq = &vdev->vq[n]; -+ -+ if (n < VIRTIO_PCI_QUEUE_MAX) { -+ if (vdev->vector_queues && -+ vdev->vq[n].vector != VIRTIO_NO_VECTOR) { -+ QLIST_REMOVE(vq, node); -+ } - vdev->vq[n].vector = vector; -+ if (vdev->vector_queues && -+ vector != VIRTIO_NO_VECTOR) { -+ QLIST_INSERT_HEAD(&vdev->vector_queues[vector], vq, node); -+ } -+ } - } - - VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, -@@ -1088,6 +1110,7 @@ void virtio_cleanup(VirtIODevice *vdev) - qemu_del_vm_change_state_handler(vdev->vmstate); - g_free(vdev->config); - g_free(vdev->vq); -+ g_free(vdev->vector_queues); - } - - static void virtio_vmstate_change(void *opaque, int running, RunState state) -@@ -1125,7 +1148,16 @@ void virtio_instance_init_common(Object *proxy_obj, void *data, - void virtio_init(VirtIODevice *vdev, const char *name, - uint16_t device_id, size_t config_size) - { -+ BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); -+ VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); - int i; -+ int nvectors = k->query_nvectors ? k->query_nvectors(qbus->parent) : 0; -+ -+ if (nvectors) { -+ vdev->vector_queues = -+ g_malloc0(sizeof(*vdev->vector_queues) * nvectors); -+ } -+ - vdev->device_id = device_id; - vdev->status = 0; - vdev->isr = 0; -diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h -index 0d2e7b4..a4588ca 100644 ---- a/include/hw/virtio/virtio-bus.h -+++ b/include/hw/virtio/virtio-bus.h -@@ -62,6 +62,7 @@ typedef struct VirtioBusClass { - * This is called by virtio-bus just before the device is unplugged. - */ - void (*device_unplugged)(DeviceState *d); -+ int (*query_nvectors)(DeviceState *d); - /* - * Does the transport have variable vring alignment? - * (ie can it ever call virtio_queue_set_align()?) -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index d95f8b6..9706c29 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -84,6 +84,7 @@ struct VirtIODevice - VMChangeStateEntry *vmstate; - char *bus_name; - uint8_t device_endian; -+ QLIST_HEAD(, VirtQueue) * vector_queues; - }; - - typedef struct VirtioDeviceClass { -@@ -218,6 +219,8 @@ void virtio_queue_set_host_notifier_fd_handler(VirtQueue *vq, bool assign, - bool set_handler); - void virtio_queue_notify_vq(VirtQueue *vq); - void virtio_irq(VirtQueue *vq); -+VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector); -+VirtQueue *virtio_vector_next_queue(VirtQueue *vq); - - static inline void virtio_add_feature(uint32_t *features, unsigned int fbit) - { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-introduce-virtio_get_num_queues.patch b/SOURCES/kvm-virtio-introduce-virtio_get_num_queues.patch deleted file mode 100644 index 1a57b28..0000000 --- a/SOURCES/kvm-virtio-introduce-virtio_get_num_queues.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 1e9702f54d58dbdbd8f28b7cadab280f13a6172d Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:49 +0200 -Subject: [PATCH 028/217] virtio: introduce virtio_get_num_queues() - -Message-id: <1434607916-15166-14-git-send-email-jasowang@redhat.com> -Patchwork-id: 66311 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 13/20] virtio: introduce virtio_get_num_queues() -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -This patch introduces virtio_get_num_queues() which iterates the vqs -array and return the number of virtqueues used by device. - -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 8ad176aaed24535f535e0fdb03c538c23017535d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio.c | 13 +++++++++++++ - include/hw/virtio/virtio.h | 1 + - 2 files changed, 14 insertions(+) - -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 0b50f9d..81d8905 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -746,6 +746,19 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n) - return vdev->vq[n].vring.num; - } - -+int virtio_get_num_queues(VirtIODevice *vdev) -+{ -+ int i; -+ -+ for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ if (!virtio_queue_get_num(vdev, i)) { -+ break; -+ } -+ } -+ -+ return i; -+} -+ - int virtio_queue_get_id(VirtQueue *vq) - { - VirtIODevice *vdev = vq->vdev; -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 9706c29..6f49108 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -175,6 +175,7 @@ void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr); - hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n); - void virtio_queue_set_num(VirtIODevice *vdev, int n, int num); - int virtio_queue_get_num(VirtIODevice *vdev, int n); -+int virtio_get_num_queues(VirtIODevice *vdev); - void virtio_queue_set_align(VirtIODevice *vdev, int n, int align); - void virtio_queue_notify(VirtIODevice *vdev, int n); - uint16_t virtio_queue_vector(VirtIODevice *vdev, int n); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-introduce-virtio_legacy_is_cross_endian.patch b/SOURCES/kvm-virtio-introduce-virtio_legacy_is_cross_endian.patch deleted file mode 100644 index 4f64b8b..0000000 --- a/SOURCES/kvm-virtio-introduce-virtio_legacy_is_cross_endian.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 2c0d1ccb47a3e2cb061cc892802f89e528d2c139 Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Fri, 3 Jul 2015 19:13:34 +0200 -Subject: [PATCH 110/217] virtio: introduce virtio_legacy_is_cross_endian() - -Message-id: <1435950819-10991-3-git-send-email-thuth@redhat.com> -Patchwork-id: 66695 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 2/7] virtio: introduce virtio_legacy_is_cross_endian() -Bugzilla: 1225715 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> - -From: Greg Kurz <gkurz@linux.vnet.ibm.com> - -This helper will be used by vhost and tap to detect cross-endianness in -the legacy virtio case. - -Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 41d283bdab08868a244b9c19dce507fdf15a8990) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/virtio/virtio-access.h | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h -index 46456fd..caf0940 100644 ---- a/include/hw/virtio/virtio-access.h -+++ b/include/hw/virtio/virtio-access.h -@@ -28,6 +28,19 @@ static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) - #endif - } - -+static inline bool virtio_legacy_is_cross_endian(VirtIODevice *vdev) -+{ -+#ifdef TARGET_IS_BIENDIAN -+#ifdef HOST_WORDS_BIGENDIAN -+ return !virtio_is_big_endian(vdev); -+#else -+ return virtio_is_big_endian(vdev); -+#endif -+#else -+ return false; -+#endif -+} -+ - static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa) - { - if (virtio_access_is_big_endian(vdev)) { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-make-features-64bit-wide.patch b/SOURCES/kvm-virtio-make-features-64bit-wide.patch deleted file mode 100644 index 3701179..0000000 --- a/SOURCES/kvm-virtio-make-features-64bit-wide.patch +++ /dev/null @@ -1,382 +0,0 @@ -From 58f11e037f20478b149af9fc47b64382f37f4f45 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:24 +0200 -Subject: [PATCH 136/217] virtio: make features 64bit wide - -Message-id: <1436260751-25015-22-git-send-email-jasowang@redhat.com> -Patchwork-id: 66796 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 21/68] virtio: make features 64bit wide -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Make features 64bit wide everywhere. - -On migration a full 64bit guest_features field is sent if one of the -high bits is set, in addition to the lower 32bit guest_features field -which must stay for compatibility reasons. That way we send the lower -32 feature bits twice, but the code is simpler because we don't have -to split and compose the 64bit features into two 32bit fields. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 019a3edbb25f1571e876f8af1ce4c55412939e5d) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/9pfs/virtio-9p-device.c | 2 +- - hw/block/virtio-blk.c | 2 +- - hw/char/virtio-serial-bus.c | 2 +- - hw/input/virtio-input.c | 2 +- - hw/net/virtio-net.c | 18 +++++++++------- - hw/scsi/vhost-scsi.c | 4 ++-- - hw/scsi/virtio-scsi.c | 4 ++-- - hw/virtio/virtio-balloon.c | 2 +- - hw/virtio/virtio-rng.c | 2 +- - hw/virtio/virtio.c | 51 +++++++++++++++++++++++++++++++++++++++------ - include/hw/virtio/virtio.h | 32 ++++++++++++++-------------- - 11 files changed, 81 insertions(+), 40 deletions(-) - -diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c -index 30492ec..60f9ff9 100644 ---- a/hw/9pfs/virtio-9p-device.c -+++ b/hw/9pfs/virtio-9p-device.c -@@ -21,7 +21,7 @@ - #include "virtio-9p-coth.h" - #include "hw/virtio/virtio-access.h" - --static uint32_t virtio_9p_get_features(VirtIODevice *vdev, uint32_t features) -+static uint64_t virtio_9p_get_features(VirtIODevice *vdev, uint64_t features) - { - virtio_add_feature(&features, VIRTIO_9P_MOUNT_TAG); - return features; -diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c -index 9546fd2..cf54710 100644 ---- a/hw/block/virtio-blk.c -+++ b/hw/block/virtio-blk.c -@@ -718,7 +718,7 @@ static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config) - aio_context_release(blk_get_aio_context(s->blk)); - } - --static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features) -+static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features) - { - VirtIOBlock *s = VIRTIO_BLK(vdev); - -diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c -index 4e6154b..fbe9d24 100644 ---- a/hw/char/virtio-serial-bus.c -+++ b/hw/char/virtio-serial-bus.c -@@ -498,7 +498,7 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq) - } - } - --static uint32_t get_features(VirtIODevice *vdev, uint32_t features) -+static uint64_t get_features(VirtIODevice *vdev, uint64_t features) - { - VirtIOSerial *vser; - -diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c -index e615c5c..c4f4b3c 100644 ---- a/hw/input/virtio-input.c -+++ b/hw/input/virtio-input.c -@@ -166,7 +166,7 @@ static void virtio_input_set_config(VirtIODevice *vdev, - virtio_notify_config(vdev); - } - --static uint32_t virtio_input_get_features(VirtIODevice *vdev, uint32_t f) -+static uint64_t virtio_input_get_features(VirtIODevice *vdev, uint64_t f) - { - return f; - } -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index 84a71ae..1d7ce09 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -441,7 +441,7 @@ static void virtio_net_set_queues(VirtIONet *n) - - static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue); - --static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) -+static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features) - { - VirtIONet *n = VIRTIO_NET(vdev); - NetClientState *nc = qemu_get_queue(n->nic); -@@ -474,9 +474,9 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) - return vhost_net_get_features(get_vhost_net(nc->peer), features); - } - --static uint32_t virtio_net_bad_features(VirtIODevice *vdev) -+static uint64_t virtio_net_bad_features(VirtIODevice *vdev) - { -- uint32_t features = 0; -+ uint64_t features = 0; - - /* Linux kernel 2.6.25. It understood MAC (as everyone must), - * but also these: */ -@@ -1038,10 +1038,12 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t - if (i == 0) - return -1; - error_report("virtio-net unexpected empty queue: " -- "i %zd mergeable %d offset %zd, size %zd, " -- "guest hdr len %zd, host hdr len %zd guest features 0x%x", -- i, n->mergeable_rx_bufs, offset, size, -- n->guest_hdr_len, n->host_hdr_len, vdev->guest_features); -+ "i %zd mergeable %d offset %zd, size %zd, " -+ "guest hdr len %zd, host hdr len %zd " -+ "guest features 0x%" PRIx64, -+ i, n->mergeable_rx_bufs, offset, size, -+ n->guest_hdr_len, n->host_hdr_len, -+ vdev->guest_features); - exit(1); - } - -@@ -1524,7 +1526,7 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx, - vdev, idx, mask); - } - --static void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features) -+static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features) - { - int i, config_size = 0; - virtio_add_feature(&host_features, VIRTIO_NET_F_MAC); -diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c -index 335f442..9c76486 100644 ---- a/hw/scsi/vhost-scsi.c -+++ b/hw/scsi/vhost-scsi.c -@@ -151,8 +151,8 @@ static void vhost_scsi_stop(VHostSCSI *s) - vhost_dev_disable_notifiers(&s->dev, vdev); - } - --static uint32_t vhost_scsi_get_features(VirtIODevice *vdev, -- uint32_t features) -+static uint64_t vhost_scsi_get_features(VirtIODevice *vdev, -+ uint64_t features) - { - VHostSCSI *s = VHOST_SCSI(vdev); - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index 5818159..b0dee29 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -628,8 +628,8 @@ static void virtio_scsi_set_config(VirtIODevice *vdev, - vs->cdb_size = virtio_ldl_p(vdev, &scsiconf->cdb_size); - } - --static uint32_t virtio_scsi_get_features(VirtIODevice *vdev, -- uint32_t requested_features) -+static uint64_t virtio_scsi_get_features(VirtIODevice *vdev, -+ uint64_t requested_features) - { - VirtIOSCSI *s = VIRTIO_SCSI(vdev); - -diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index 484c3c3..734f35b 100644 ---- a/hw/virtio/virtio-balloon.c -+++ b/hw/virtio/virtio-balloon.c -@@ -310,7 +310,7 @@ static void virtio_balloon_set_config(VirtIODevice *vdev, - trace_virtio_balloon_set_config(dev->actual, oldactual); - } - --static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f) -+static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f) - { - f |= (1 << VIRTIO_BALLOON_F_STATS_VQ); - return f; -diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c -index 06e7178..420c39f 100644 ---- a/hw/virtio/virtio-rng.c -+++ b/hw/virtio/virtio-rng.c -@@ -99,7 +99,7 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq) - virtio_rng_process(vrng); - } - --static uint32_t get_features(VirtIODevice *vdev, uint32_t f) -+static uint64_t get_features(VirtIODevice *vdev, uint64_t f) - { - return f; - } -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index a0637d9..596e3d8 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -906,6 +906,13 @@ static bool virtio_device_endian_needed(void *opaque) - return vdev->device_endian != virtio_default_endian(); - } - -+static bool virtio_64bit_features_needed(void *opaque) -+{ -+ VirtIODevice *vdev = opaque; -+ -+ return (vdev->host_features >> 32) != 0; -+} -+ - static const VMStateDescription vmstate_virtio_device_endian = { - .name = "virtio/device_endian", - .version_id = 1, -@@ -916,6 +923,16 @@ static const VMStateDescription vmstate_virtio_device_endian = { - } - }; - -+static const VMStateDescription vmstate_virtio_64bit_features = { -+ .name = "virtio/64bit_features", -+ .version_id = 1, -+ .minimum_version_id = 1, -+ .fields = (VMStateField[]) { -+ VMSTATE_UINT64(guest_features, VirtIODevice), -+ VMSTATE_END_OF_LIST() -+ } -+}; -+ - static const VMStateDescription vmstate_virtio = { - .name = "virtio", - .version_id = 1, -@@ -929,6 +946,10 @@ static const VMStateDescription vmstate_virtio = { - .vmsd = &vmstate_virtio_device_endian, - .needed = &virtio_device_endian_needed - }, -+ { -+ .vmsd = &vmstate_virtio_64bit_features, -+ .needed = &virtio_64bit_features_needed -+ }, - { 0 } - } - }; -@@ -938,6 +959,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); - VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); -+ uint32_t guest_features_lo = (vdev->guest_features & 0xffffffff); - int i; - - if (k->save_config) { -@@ -947,7 +969,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - qemu_put_8s(f, &vdev->status); - qemu_put_8s(f, &vdev->isr); - qemu_put_be16s(f, &vdev->queue_sel); -- qemu_put_be32s(f, &vdev->guest_features); -+ qemu_put_be32s(f, &guest_features_lo); - qemu_put_be32(f, vdev->config_len); - qemu_put_buffer(f, vdev->config, vdev->config_len); - -@@ -1024,11 +1046,6 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - } - qemu_get_be32s(f, &features); - -- if (virtio_set_features(vdev, features) < 0) { -- error_report("Features 0x%x unsupported. Allowed features: 0x%x", -- features, vdev->host_features); -- return -1; -- } - config_len = qemu_get_be32(f); - - /* -@@ -1094,6 +1111,28 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - vdev->device_endian = virtio_default_endian(); - } - -+ if (virtio_64bit_features_needed(vdev)) { -+ /* -+ * Subsection load filled vdev->guest_features. Run them -+ * through virtio_set_features to sanity-check them against -+ * host_features. -+ */ -+ uint64_t features64 = vdev->guest_features; -+ if (virtio_set_features(vdev, features64) < 0) { -+ error_report("Features 0x%" PRIx64 " unsupported. " -+ "Allowed features: 0x%" PRIx64, -+ features64, vdev->host_features); -+ return -1; -+ } -+ } else { -+ if (virtio_set_features(vdev, features) < 0) { -+ error_report("Features 0x%x unsupported. " -+ "Allowed features: 0x%" PRIx64, -+ features, vdev->host_features); -+ return -1; -+ } -+ } -+ - for (i = 0; i < num; i++) { - if (vdev->vq[i].pa) { - uint16_t nheads; -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index fb052c1..180b077 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -73,8 +73,8 @@ struct VirtIODevice - uint8_t status; - uint8_t isr; - uint16_t queue_sel; -- uint32_t guest_features; -- uint32_t host_features; -+ uint64_t guest_features; -+ uint64_t host_features; - size_t config_len; - void *config; - uint16_t config_vector; -@@ -96,8 +96,8 @@ typedef struct VirtioDeviceClass { - /* This is what a VirtioDevice must implement */ - DeviceRealize realize; - DeviceUnrealize unrealize; -- uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features); -- uint32_t (*bad_features)(VirtIODevice *vdev); -+ uint64_t (*get_features)(VirtIODevice *vdev, uint64_t requested_features); -+ uint64_t (*bad_features)(VirtIODevice *vdev); - void (*set_features)(VirtIODevice *vdev, uint32_t val); - void (*get_config)(VirtIODevice *vdev, uint8_t *config); - void (*set_config)(VirtIODevice *vdev, const uint8_t *config); -@@ -195,12 +195,12 @@ typedef struct VirtIOSCSIConf VirtIOSCSIConf; - typedef struct VirtIORNGConf VirtIORNGConf; - - #define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \ -- DEFINE_PROP_BIT("indirect_desc", _state, _field, \ -- VIRTIO_RING_F_INDIRECT_DESC, true), \ -- DEFINE_PROP_BIT("event_idx", _state, _field, \ -- VIRTIO_RING_F_EVENT_IDX, true), \ -- DEFINE_PROP_BIT("notify_on_empty", _state, _field, \ -- VIRTIO_F_NOTIFY_ON_EMPTY, true) -+ DEFINE_PROP_BIT64("indirect_desc", _state, _field, \ -+ VIRTIO_RING_F_INDIRECT_DESC, true), \ -+ DEFINE_PROP_BIT64("event_idx", _state, _field, \ -+ VIRTIO_RING_F_EVENT_IDX, true), \ -+ DEFINE_PROP_BIT64("notify_on_empty", _state, _field, \ -+ VIRTIO_F_NOTIFY_ON_EMPTY, true) - - hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); - hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n); -@@ -227,21 +227,21 @@ void virtio_irq(VirtQueue *vq); - VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector); - VirtQueue *virtio_vector_next_queue(VirtQueue *vq); - --static inline void virtio_add_feature(uint32_t *features, unsigned int fbit) -+static inline void virtio_add_feature(uint64_t *features, unsigned int fbit) - { -- assert(fbit < 32); -+ assert(fbit < 64); - *features |= (1 << fbit); - } - --static inline void virtio_clear_feature(uint32_t *features, unsigned int fbit) -+static inline void virtio_clear_feature(uint64_t *features, unsigned int fbit) - { -- assert(fbit < 32); -+ assert(fbit < 64); - *features &= ~(1 << fbit); - } - --static inline bool __virtio_has_feature(uint32_t features, unsigned int fbit) -+static inline bool __virtio_has_feature(uint64_t features, unsigned int fbit) - { -- assert(fbit < 32); -+ assert(fbit < 64); - return !!(features & (1 << fbit)); - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-move-VIRTIO_F_NOTIFY_ON_EMPTY-into-core.patch b/SOURCES/kvm-virtio-move-VIRTIO_F_NOTIFY_ON_EMPTY-into-core.patch deleted file mode 100644 index 7a137eb..0000000 --- a/SOURCES/kvm-virtio-move-VIRTIO_F_NOTIFY_ON_EMPTY-into-core.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0136e94ba2207653f0db033a26098868d55d456f Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:22 +0200 -Subject: [PATCH 134/217] virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core - -Message-id: <1436260751-25015-20-git-send-email-jasowang@redhat.com> -Patchwork-id: 66794 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 19/68] virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Notes: conflicts since commits - 10ceaa1e8f9f74c917df1fe5db856817a8b26fe7 ("virtio-ccw: validate - the number of queues against bus limitation") - e83980455c8c7eb066405de512be7c4bace3ac4d ("virtio: - device_plugged() can fail") - were backported before this commit - -Nearly all transports have been offering VIRTIO_F_NOTIFY_ON_EMPTY, -s390-virtio being the exception. There's no reason why it shouldn't -offer it as well, though (handling is done in core anyway), so let's -move it to the common virtio features. - -While we're changing it anyway, fix the indentation for the -DEFINE_VIRTIO_COMMON_FEATURES macro. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit cf34f533a161f8ced7322321d70ca00414d47473) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/s390x/virtio-ccw.c - hw/virtio/virtio-mmio.c ---- - hw/s390x/virtio-ccw.c | 2 -- - hw/virtio/virtio-mmio.c | 10 ---------- - hw/virtio/virtio-pci.c | 1 - - include/hw/virtio/virtio.h | 10 ++++++---- - 4 files changed, 6 insertions(+), 17 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index c1d24d4..fdac013 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -1421,8 +1421,6 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) - - sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); - -- virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); -- - css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, - d->hotplugged, 1); - } -diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c -index 9ebfa0c..a3cfd30 100644 ---- a/hw/virtio/virtio-mmio.c -+++ b/hw/virtio/virtio-mmio.c -@@ -336,15 +336,6 @@ static void virtio_mmio_reset(DeviceState *d) - - /* virtio-mmio device */ - --/* This is called by virtio-bus just after the device is plugged. */ --static void virtio_mmio_device_plugged(DeviceState *opaque, Error **errp) --{ -- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); -- VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -- -- virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); --} -- - static void virtio_mmio_realizefn(DeviceState *d, Error **errp) - { - VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d); -@@ -384,7 +375,6 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data) - k->notify = virtio_mmio_update_irq; - k->save_config = virtio_mmio_save_config; - k->load_config = virtio_mmio_load_config; -- k->device_plugged = virtio_mmio_device_plugged; - k->has_variable_vring_alignment = true; - bus_class->max_dev = 1; - } -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index e40191e..1aa0e01 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -960,7 +960,6 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; - } - -- virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); - virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); - } - -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 3058711..fb052c1 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -195,10 +195,12 @@ typedef struct VirtIOSCSIConf VirtIOSCSIConf; - typedef struct VirtIORNGConf VirtIORNGConf; - - #define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \ -- DEFINE_PROP_BIT("indirect_desc", _state, _field, \ -- VIRTIO_RING_F_INDIRECT_DESC, true), \ -- DEFINE_PROP_BIT("event_idx", _state, _field, \ -- VIRTIO_RING_F_EVENT_IDX, true) -+ DEFINE_PROP_BIT("indirect_desc", _state, _field, \ -+ VIRTIO_RING_F_INDIRECT_DESC, true), \ -+ DEFINE_PROP_BIT("event_idx", _state, _field, \ -+ VIRTIO_RING_F_EVENT_IDX, true), \ -+ DEFINE_PROP_BIT("notify_on_empty", _state, _field, \ -+ VIRTIO_F_NOTIFY_ON_EMPTY, true) - - hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); - hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-move-host_features.patch b/SOURCES/kvm-virtio-move-host_features.patch deleted file mode 100644 index 1cca09c..0000000 --- a/SOURCES/kvm-virtio-move-host_features.patch +++ /dev/null @@ -1,507 +0,0 @@ -From ad6f9886771e6f9062d49259ee07f20c5a4cc15a Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:20 +0200 -Subject: [PATCH 132/217] virtio: move host_features - -Message-id: <1436260751-25015-18-git-send-email-jasowang@redhat.com> -Patchwork-id: 66792 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 17/68] virtio: move host_features -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Notes: conflicts since commits - e83980455c8c7eb066405de512be7c4bace3ac4d ("virtio: - device_plugged() can fail") - 10ceaa1e8f9f74c917df1fe5db856817a8b26fe7 ("virtio-ccw: - validate the number of queues against bus limitation") - d820331a0b47cbbdc409b435545aea25e19b57ad ("virtio-s390: - introduce virtio_s390_device_plugged()") - was backported before this commit. - -Move host_features from the individual transport proxies into -the virtio device. Transports may continue to add feature bits -during device plugging. - -This should it make easier to offer different sets of host features -for virtio-1/transitional support. - -Tested-by: Shannon Zhao <shannon.zhao@linaro.org> -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 6b8f1020540c27246277377aa2c3331ad2bfb160) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/s390x/s390-virtio-bus.c - hw/s390x/virtio-ccw.c - hw/virtio/virtio-bus.c ---- - hw/s390x/s390-virtio-bus.c | 18 ++---------------- - hw/s390x/s390-virtio-bus.h | 1 - - hw/s390x/virtio-ccw.c | 28 +++++----------------------- - hw/s390x/virtio-ccw.h | 4 ---- - hw/virtio/virtio-bus.c | 18 +++++------------- - hw/virtio/virtio-mmio.c | 22 +++------------------- - hw/virtio/virtio-pci.c | 17 ++++------------- - hw/virtio/virtio-pci.h | 1 - - hw/virtio/virtio.c | 17 +++++++++-------- - include/hw/virtio/virtio-bus.h | 1 - - include/hw/virtio/virtio.h | 1 + - 11 files changed, 29 insertions(+), 99 deletions(-) - -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index c10b002..18dd354 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -133,8 +133,6 @@ static void s390_virtio_device_init(VirtIOS390Device *dev, - - bus->dev_offs += dev_len; - -- dev->host_features = virtio_bus_get_vdev_features(&dev->bus, -- dev->host_features); - s390_virtio_device_sync(dev); - s390_virtio_reset_idx(dev); - if (dev->qdev.hotplugged) { -@@ -427,7 +425,8 @@ void s390_virtio_device_sync(VirtIOS390Device *dev) - cur_offs += num_vq * VIRTIO_VQCONFIG_LEN; - - /* Sync feature bitmap */ -- address_space_stl_le(&address_space_memory, cur_offs, dev->host_features, -+ address_space_stl_le(&address_space_memory, cur_offs, -+ dev->vdev->host_features, - MEMTXATTRS_UNSPECIFIED, NULL); - - dev->feat_offs = cur_offs + dev->feat_len; -@@ -522,12 +521,6 @@ static void virtio_s390_notify(DeviceState *d, uint16_t vector) - s390_virtio_irq(0, token); - } - --static unsigned virtio_s390_get_features(DeviceState *d) --{ -- VirtIOS390Device *dev = to_virtio_s390_device(d); -- return dev->host_features; --} -- - static void virtio_s390_device_plugged(DeviceState *d, Error **errp) - { - VirtIOS390Device *dev = to_virtio_s390_device(d); -@@ -633,16 +626,10 @@ static void s390_virtio_busdev_reset(DeviceState *dev) - virtio_reset(_dev->vdev); - } - --static Property virtio_s390_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void virtio_s390_device_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - -- dc->props = virtio_s390_properties; - dc->realize = s390_virtio_busdev_realize; - dc->bus_type = TYPE_S390_VIRTIO_BUS; - dc->reset = s390_virtio_busdev_reset; -@@ -740,7 +727,6 @@ static void virtio_s390_bus_class_init(ObjectClass *klass, void *data) - BusClass *bus_class = BUS_CLASS(klass); - bus_class->max_dev = 1; - k->notify = virtio_s390_notify; -- k->get_features = virtio_s390_get_features; - k->device_plugged = virtio_s390_device_plugged; - } - -diff --git a/hw/s390x/s390-virtio-bus.h b/hw/s390x/s390-virtio-bus.h -index 96b1890..7ad295e 100644 ---- a/hw/s390x/s390-virtio-bus.h -+++ b/hw/s390x/s390-virtio-bus.h -@@ -92,7 +92,6 @@ struct VirtIOS390Device { - ram_addr_t feat_offs; - uint8_t feat_len; - VirtIODevice *vdev; -- uint32_t host_features; - VirtioBusState bus; - }; - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 18fc697..2b98ae9 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -381,8 +381,8 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - + sizeof(features.features), - MEMTXATTRS_UNSPECIFIED, - NULL); -- if (features.index < ARRAY_SIZE(dev->host_features)) { -- features.features = dev->host_features[features.index]; -+ if (features.index == 0) { -+ features.features = vdev->host_features; - } else { - /* Return zeroes if the guest supports more feature bits. */ - features.features = 0; -@@ -417,7 +417,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - ccw.cda, - MEMTXATTRS_UNSPECIFIED, - NULL); -- if (features.index < ARRAY_SIZE(dev->host_features)) { -+ if (features.index == 0) { - virtio_set_features(vdev, features.features); - } else { - /* -@@ -1098,14 +1098,6 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) - } - } - --static unsigned virtio_ccw_get_features(DeviceState *d) --{ -- VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -- -- /* Only the first 32 feature bits are used. */ -- return dev->host_features[0]; --} -- - static void virtio_ccw_reset(DeviceState *d) - { - VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -@@ -1429,11 +1421,8 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) - - sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); - -- /* Only the first 32 feature bits are used. */ -- virtio_add_feature(&dev->host_features[0], VIRTIO_F_NOTIFY_ON_EMPTY); -- virtio_add_feature(&dev->host_features[0], VIRTIO_F_BAD_FEATURE); -- dev->host_features[0] = virtio_bus_get_vdev_features(&dev->bus, -- dev->host_features[0]); -+ virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); -+ virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); - - css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, - d->hotplugged, 1); -@@ -1684,16 +1673,10 @@ static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev, - object_unparent(OBJECT(dev)); - } - --static Property virtio_ccw_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtioCcwDevice, host_features[0]), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void virtio_ccw_device_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - -- dc->props = virtio_ccw_properties; - dc->realize = virtio_ccw_busdev_realize; - dc->exit = virtio_ccw_busdev_exit; - dc->bus_type = TYPE_VIRTUAL_CSS_BUS; -@@ -1758,7 +1741,6 @@ static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data) - - bus_class->max_dev = 1; - k->notify = virtio_ccw_notify; -- k->get_features = virtio_ccw_get_features; - k->vmstate_change = virtio_ccw_vmstate_change; - k->query_guest_notifiers = virtio_ccw_query_guest_notifiers; - k->set_host_notifier = virtio_ccw_set_host_notifier; -diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h -index 4fceda7..ad3af76 100644 ---- a/hw/s390x/virtio-ccw.h -+++ b/hw/s390x/virtio-ccw.h -@@ -68,9 +68,6 @@ typedef struct VirtIOCCWDeviceClass { - int (*exit)(VirtioCcwDevice *dev); - } VirtIOCCWDeviceClass; - --/* Change here if we want to support more feature bits. */ --#define VIRTIO_CCW_FEATURE_SIZE 1 -- - /* Performance improves when virtqueue kick processing is decoupled from the - * vcpu thread using ioeventfd for some devices. */ - #define VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT 1 -@@ -88,7 +85,6 @@ struct VirtioCcwDevice { - DeviceState parent_obj; - SubchDev *sch; - char *bus_id; -- uint32_t host_features[VIRTIO_CCW_FEATURE_SIZE]; - VirtioBusState bus; - bool ioeventfd_started; - bool ioeventfd_disabled; -diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c -index 24cde3d..3926f7e 100644 ---- a/hw/virtio/virtio-bus.c -+++ b/hw/virtio/virtio-bus.c -@@ -44,12 +44,17 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp) - BusState *qbus = BUS(qdev_get_parent_bus(qdev)); - VirtioBusState *bus = VIRTIO_BUS(qbus); - VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); -+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); -+ - DPRINTF("%s: plug device.\n", qbus->name); - - if (klass->device_plugged != NULL) { - klass->device_plugged(qbus->parent, errp); - } - -+ /* Get the features of the plugged device. */ -+ assert(vdc->get_features != NULL); -+ vdev->host_features = vdc->get_features(vdev, vdev->host_features); - } - - /* Reset the virtio_bus */ -@@ -95,19 +100,6 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus) - return vdev->config_len; - } - --/* Get the features of the plugged device. */ --uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus, -- uint32_t requested_features) --{ -- VirtIODevice *vdev = virtio_bus_get_device(bus); -- VirtioDeviceClass *k; -- -- assert(vdev != NULL); -- k = VIRTIO_DEVICE_GET_CLASS(vdev); -- assert(k->get_features != NULL); -- return k->get_features(vdev, requested_features); --} -- - /* Get bad features of the plugged device. */ - uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus) - { -diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c -index bd2ee26..9ebfa0c 100644 ---- a/hw/virtio/virtio-mmio.c -+++ b/hw/virtio/virtio-mmio.c -@@ -80,7 +80,6 @@ typedef struct { - SysBusDevice parent_obj; - MemoryRegion iomem; - qemu_irq irq; -- uint32_t host_features; - /* Guest accessible state needing migration and reset */ - uint32_t host_features_sel; - uint32_t guest_features_sel; -@@ -147,7 +146,7 @@ static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size) - if (proxy->host_features_sel) { - return 0; - } -- return proxy->host_features; -+ return vdev->host_features; - case VIRTIO_MMIO_QUEUENUMMAX: - if (!virtio_queue_get_num(vdev, vdev->queue_sel)) { - return 0; -@@ -306,13 +305,6 @@ static void virtio_mmio_update_irq(DeviceState *opaque, uint16_t vector) - qemu_set_irq(proxy->irq, level); - } - --static unsigned int virtio_mmio_get_features(DeviceState *opaque) --{ -- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); -- -- return proxy->host_features; --} -- - static int virtio_mmio_load_config(DeviceState *opaque, QEMUFile *f) - { - VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); -@@ -348,10 +340,9 @@ static void virtio_mmio_reset(DeviceState *d) - static void virtio_mmio_device_plugged(DeviceState *opaque, Error **errp) - { - VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - -- virtio_add_feature(&proxy->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); -- proxy->host_features = virtio_bus_get_vdev_features(&proxy->bus, -- proxy->host_features); -+ virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); - } - - static void virtio_mmio_realizefn(DeviceState *d, Error **errp) -@@ -367,16 +358,10 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp) - sysbus_init_mmio(sbd, &proxy->iomem); - } - --static Property virtio_mmio_properties[] = { -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOMMIOProxy, host_features), -- DEFINE_PROP_END_OF_LIST(), --}; -- - static void virtio_mmio_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - -- dc->props = virtio_mmio_properties; - dc->realize = virtio_mmio_realizefn; - dc->reset = virtio_mmio_reset; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); -@@ -399,7 +384,6 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data) - k->notify = virtio_mmio_update_irq; - k->save_config = virtio_mmio_save_config; - k->load_config = virtio_mmio_load_config; -- k->get_features = virtio_mmio_get_features; - k->device_plugged = virtio_mmio_device_plugged; - k->has_variable_vring_alignment = true; - bus_class->max_dev = 1; -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 2f1e03f..e40191e 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -306,7 +306,7 @@ static uint32_t virtio_ioport_read(VirtIOPCIProxy *proxy, uint32_t addr) - - switch (addr) { - case VIRTIO_PCI_HOST_FEATURES: -- ret = proxy->host_features; -+ ret = vdev->host_features; - break; - case VIRTIO_PCI_GUEST_FEATURES: - ret = vdev->guest_features; -@@ -434,12 +434,6 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, - } - } - --static unsigned virtio_pci_get_features(DeviceState *d) --{ -- VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -- return proxy->host_features; --} -- - static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy, - unsigned int queue_no, - unsigned int vector, -@@ -931,6 +925,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - VirtioBusState *bus = &proxy->bus; - uint8_t *config; - uint32_t size; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - - config = proxy->pci_dev.config; - if (proxy->class_code) { -@@ -965,10 +960,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; - } - -- virtio_add_feature(&proxy->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); -- virtio_add_feature(&proxy->host_features, VIRTIO_F_BAD_FEATURE); -- proxy->host_features = virtio_bus_get_vdev_features(bus, -- proxy->host_features); -+ virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); -+ virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); - } - - static void virtio_pci_device_unplugged(DeviceState *d) -@@ -1006,7 +999,6 @@ static void virtio_pci_reset(DeviceState *qdev) - static Property virtio_pci_properties[] = { - DEFINE_PROP_BIT("virtio-pci-bus-master-bug-migration", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, false), -- DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), - DEFINE_PROP_END_OF_LIST(), - }; - -@@ -1504,7 +1496,6 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) - k->load_config = virtio_pci_load_config; - k->save_queue = virtio_pci_save_queue; - k->load_queue = virtio_pci_load_queue; -- k->get_features = virtio_pci_get_features; - k->query_guest_notifiers = virtio_pci_query_guest_notifiers; - k->set_host_notifier = virtio_pci_set_host_notifier; - k->set_guest_notifiers = virtio_pci_set_guest_notifiers; -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index 3bac016..de39468 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -91,7 +91,6 @@ struct VirtIOPCIProxy { - uint32_t flags; - uint32_t class_code; - uint32_t nvectors; -- uint32_t host_features; - bool ioeventfd_disabled; - bool ioeventfd_started; - VirtIOIRQFD *vector_irqfd; -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 7092aa5..a0637d9 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -983,13 +983,10 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - - int virtio_set_features(VirtIODevice *vdev, uint32_t val) - { -- BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); -- VirtioBusClass *vbusk = VIRTIO_BUS_GET_CLASS(qbus); - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -- uint32_t supported_features = vbusk->get_features(qbus->parent); -- bool bad = (val & ~supported_features) != 0; -+ bool bad = (val & ~(vdev->host_features)) != 0; - -- val &= supported_features; -+ val &= vdev->host_features; - if (k->set_features) { - k->set_features(vdev, val); - } -@@ -1003,7 +1000,6 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - int32_t config_len; - uint32_t num; - uint32_t features; -- uint32_t supported_features; - BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); - VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); -@@ -1029,9 +1025,8 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - qemu_get_be32s(f, &features); - - if (virtio_set_features(vdev, features) < 0) { -- supported_features = k->get_features(qbus->parent); - error_report("Features 0x%x unsupported. Allowed features: 0x%x", -- features, supported_features); -+ features, vdev->host_features); - return -1; - } - config_len = qemu_get_be32(f); -@@ -1369,6 +1364,11 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp) - vdev->bus_name = NULL; - } - -+static Property virtio_properties[] = { -+ DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features), -+ DEFINE_PROP_END_OF_LIST(), -+}; -+ - static void virtio_device_class_init(ObjectClass *klass, void *data) - { - /* Set the default value here. */ -@@ -1377,6 +1377,7 @@ static void virtio_device_class_init(ObjectClass *klass, void *data) - dc->realize = virtio_device_realize; - dc->unrealize = virtio_device_unrealize; - dc->bus_type = TYPE_VIRTIO_BUS; -+ dc->props = virtio_properties; - } - - static const TypeInfo virtio_device_info = { -diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h -index e5bbfbf..8811415 100644 ---- a/include/hw/virtio/virtio-bus.h -+++ b/include/hw/virtio/virtio-bus.h -@@ -47,7 +47,6 @@ typedef struct VirtioBusClass { - int (*load_config)(DeviceState *d, QEMUFile *f); - int (*load_queue)(DeviceState *d, int n, QEMUFile *f); - int (*load_done)(DeviceState *d, QEMUFile *f); -- unsigned (*get_features)(DeviceState *d); - bool (*query_guest_notifiers)(DeviceState *d); - int (*set_guest_notifiers)(DeviceState *d, int nvqs, bool assign); - int (*set_host_notifier)(DeviceState *d, int n, bool assigned); -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 77b6559..3058711 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -74,6 +74,7 @@ struct VirtIODevice - uint8_t isr; - uint16_t queue_sel; - uint32_t guest_features; -+ uint32_t host_features; - size_t config_len; - void *config; - uint16_t config_vector; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-Move-DEFINE_VIRTIO_NET_FEATURES-to-virtio.patch b/SOURCES/kvm-virtio-net-Move-DEFINE_VIRTIO_NET_FEATURES-to-virtio.patch deleted file mode 100644 index 2f7f324..0000000 --- a/SOURCES/kvm-virtio-net-Move-DEFINE_VIRTIO_NET_FEATURES-to-virtio.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 853b36266568d6fe5265d13ee37db1698f40275e Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:08 +0200 -Subject: [PATCH 120/217] virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to - virtio-net - -Message-id: <1436260751-25015-6-git-send-email-jasowang@redhat.com> -Patchwork-id: 66780 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 05/68] virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -So far virtio-net-device can't expose host features to guest while -using virtio-mmio because it doesn't set DEFINE_VIRTIO_NET_FEATURES on -backend or transport. So the performance is low. - -The host features belong to the backend while virtio-net-pci, -virtio-net-s390 and virtio-net-ccw set the DEFINE_VIRTIO_NET_FEATURES -on transports. But they already have the ability to forward property -accesses to the backend child. So if we move the host features to -backends, it doesn't break the backwards compatibility for them and -make host features work while using virtio-mmio. - -Here we move DEFINE_VIRTIO_NET_FEATURES to the backend virtio-net. The -transports just sync the host features from backend. Meanwhile move -virtio_net_set_config_size to virtio-net to make sure the config size -is correct and don't expose it. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit da3e8a23492dbc13c4b70d90b6ae42970624e63a) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 7 ++++++- - hw/s390x/s390-virtio-bus.c | 2 -- - hw/s390x/virtio-ccw.c | 2 -- - hw/virtio/virtio-pci.c | 2 -- - include/hw/virtio/virtio-net.h | 2 +- - 5 files changed, 7 insertions(+), 8 deletions(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index 4859b1c..84a71ae 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -446,6 +446,9 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) - VirtIONet *n = VIRTIO_NET(vdev); - NetClientState *nc = qemu_get_queue(n->nic); - -+ /* Firstly sync all virtio-net possible supported features */ -+ features |= n->host_features; -+ - virtio_add_feature(&features, VIRTIO_NET_F_MAC); - - if (!peer_has_vnet_hdr(n)) { -@@ -1521,7 +1524,7 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx, - vdev, idx, mask); - } - --void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features) -+static void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features) - { - int i, config_size = 0; - virtio_add_feature(&host_features, VIRTIO_NET_F_MAC); -@@ -1554,6 +1557,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) - NetClientState *nc; - int i; - -+ virtio_net_set_config_size(n, n->host_features); - virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); - - n->max_queues = MAX(n->nic_conf.peers.queues, 1); -@@ -1696,6 +1700,7 @@ static void virtio_net_instance_init(Object *obj) - } - - static Property virtio_net_properties[] = { -+ DEFINE_VIRTIO_NET_FEATURES(VirtIONet, host_features), - DEFINE_NIC_PROPERTIES(VirtIONet, nic_conf), - DEFINE_PROP_UINT32("x-txtimer", VirtIONet, net_conf.txtimer, - TX_TIMER_INTERVAL), -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index 8017ecc..118ad21 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -147,7 +147,6 @@ static void s390_virtio_net_realize(VirtIOS390Device *s390_dev, Error **errp) - DeviceState *vdev = DEVICE(&dev->vdev); - Error *err = NULL; - -- virtio_net_set_config_size(&dev->vdev, s390_dev->host_features); - virtio_net_set_netclient_name(&dev->vdev, qdev->id, - object_get_typename(OBJECT(qdev))); - qdev_set_parent_bus(vdev, BUS(&s390_dev->bus)); -@@ -523,7 +522,6 @@ static void virtio_s390_device_plugged(DeviceState *d, Error **errp) - - static Property s390_virtio_net_properties[] = { - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_VIRTIO_NET_FEATURES(VirtIOS390Device, host_features), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 534d6b6..083da1a 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -778,7 +778,6 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) - DeviceState *vdev = DEVICE(&dev->vdev); - Error *err = NULL; - -- virtio_net_set_config_size(&dev->vdev, ccw_dev->host_features[0]); - virtio_net_set_netclient_name(&dev->vdev, qdev->id, - object_get_typename(OBJECT(qdev))); - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); -@@ -1415,7 +1414,6 @@ static void virtio_ccw_device_unplugged(DeviceState *d) - - static Property virtio_ccw_net_properties[] = { - DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id), -- DEFINE_VIRTIO_NET_FEATURES(VirtioCcwDevice, host_features[0]), - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_END_OF_LIST(), -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 48ff555..05e9afd 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1376,7 +1376,6 @@ static Property virtio_net_properties[] = { - DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), -- DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features), - DEFINE_PROP_END_OF_LIST(), - }; - -@@ -1386,7 +1385,6 @@ static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) - VirtIONetPCI *dev = VIRTIO_NET_PCI(vpci_dev); - DeviceState *vdev = DEVICE(&dev->vdev); - -- virtio_net_set_config_size(&dev->vdev, vpci_dev->host_features); - virtio_net_set_netclient_name(&dev->vdev, qdev->id, - object_get_typename(OBJECT(qdev))); - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); -diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h -index 4c2fe83..e0dbb41 100644 ---- a/include/hw/virtio/virtio-net.h -+++ b/include/hw/virtio/virtio-net.h -@@ -68,6 +68,7 @@ typedef struct VirtIONet { - uint32_t has_vnet_hdr; - size_t host_hdr_len; - size_t guest_hdr_len; -+ uint32_t host_features; - uint8_t has_ufo; - int mergeable_rx_bufs; - uint8_t promisc; -@@ -137,7 +138,6 @@ typedef struct VirtIONet { - DEFINE_PROP_INT32("x-txburst", _state, _field.txburst, TX_BURST), \ - DEFINE_PROP_STRING("tx", _state, _field.tx) - --void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features); - void virtio_net_set_netclient_name(VirtIONet *n, const char *name, - const char *type); - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-adding-all-queues-in-.realize.patch b/SOURCES/kvm-virtio-net-adding-all-queues-in-.realize.patch deleted file mode 100644 index 89455e5..0000000 --- a/SOURCES/kvm-virtio-net-adding-all-queues-in-.realize.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 36fba7167a3d54ac5e162199b746012855d030bb Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:47 +0200 -Subject: [PATCH 026/217] virtio-net: adding all queues in .realize() - -Message-id: <1434607916-15166-12-git-send-email-jasowang@redhat.com> -Patchwork-id: 66309 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 11/20] virtio-net: adding all queues in .realize() -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Instead of adding queues for multiqueue during feature set. This patch -did this in .realize(), this will help the following patches that -count the number of virtqueues used in .device_plugged() callback. - -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit da51a335aa61ec0e45879d80f3c5e2ee4f87cd2f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 59 +++++++++++++++-------------------------------------- - 1 file changed, 17 insertions(+), 42 deletions(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index b6fac9c..ccf5a78 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -1304,39 +1304,8 @@ static void virtio_net_tx_bh(void *opaque) - - static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) - { -- VirtIODevice *vdev = VIRTIO_DEVICE(n); -- int i, max = multiqueue ? n->max_queues : 1; -- - n->multiqueue = multiqueue; - -- for (i = 2; i < n->max_queues * 2 + 1; i++) { -- virtio_del_queue(vdev, i); -- } -- -- for (i = 1; i < max; i++) { -- n->vqs[i].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); -- if (n->vqs[i].tx_timer) { -- n->vqs[i].tx_vq = -- virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); -- n->vqs[i].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, -- virtio_net_tx_timer, -- &n->vqs[i]); -- } else { -- n->vqs[i].tx_vq = -- virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); -- n->vqs[i].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[i]); -- } -- -- n->vqs[i].tx_waiting = 0; -- n->vqs[i].n = n; -- } -- -- /* Note: Minux Guests (version 3.2.1) use ctrl vq but don't ack -- * VIRTIO_NET_F_CTRL_VQ. Create ctrl vq unconditionally to avoid -- * breaking them. -- */ -- n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); -- - virtio_net_set_queues(n); - } - -@@ -1596,9 +1565,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) - return; - } - n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); -- n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); - n->curr_queues = 1; -- n->vqs[0].n = n; - n->tx_timeout = n->net_conf.txtimer; - - if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") -@@ -1609,16 +1576,24 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) - error_report("Defaulting to \"bh\""); - } - -- if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { -- n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, -- virtio_net_handle_tx_timer); -- n->vqs[0].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_tx_timer, -- &n->vqs[0]); -- } else { -- n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, -- virtio_net_handle_tx_bh); -- n->vqs[0].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[0]); -+ for (i = 0; i < n->max_queues; i++) { -+ n->vqs[i].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); -+ if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { -+ n->vqs[i].tx_vq = -+ virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); -+ n->vqs[i].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, -+ virtio_net_tx_timer, -+ &n->vqs[i]); -+ } else { -+ n->vqs[i].tx_vq = -+ virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); -+ n->vqs[i].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[i]); -+ } -+ -+ n->vqs[i].tx_waiting = 0; -+ n->vqs[i].n = n; - } -+ - n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); - qemu_macaddr_default_if_unset(&n->nic_conf.macaddr); - memcpy(&n->mac[0], &n->nic_conf.macaddr, sizeof(n->mac)); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-enable-virtio-1.0.patch b/SOURCES/kvm-virtio-net-enable-virtio-1.0.patch deleted file mode 100644 index eb0e193..0000000 --- a/SOURCES/kvm-virtio-net-enable-virtio-1.0.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 692fca15761470e9ba250bd5f33a6b2c6015c7c0 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:34 +0200 -Subject: [PATCH 146/217] virtio-net: enable virtio 1.0 - -Message-id: <1436260751-25015-32-git-send-email-jasowang@redhat.com> -Patchwork-id: 66806 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 31/68] virtio-net: enable virtio 1.0 -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -virtio-net (non-vhost) now should have everything in place to support -virtio 1.0: let's enable the feature bit for it. - -Note that VIRTIO_F_VERSION_1 is technically a transport feature; once -every device is ready for virtio 1.0, we can move setting this -feature bit out of the individual devices. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit df91055db5c9cee93d70ca8c08d72119a240b987) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index ea9e22e..ed47f39 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -476,6 +476,7 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features) - } - - if (!get_vhost_net(nc->peer)) { -+ virtio_add_feature(&features, VIRTIO_F_VERSION_1); - return features; - } - return vhost_net_get_features(get_vhost_net(nc->peer), features); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-fix-the-upper-bound-when-trying-to-delete.patch b/SOURCES/kvm-virtio-net-fix-the-upper-bound-when-trying-to-delete.patch deleted file mode 100644 index 1e2f241..0000000 --- a/SOURCES/kvm-virtio-net-fix-the-upper-bound-when-trying-to-delete.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 2a6b636b6ed64cb2e7ddf4c2a2baee0ad036c48c Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:41 +0200 -Subject: [PATCH 020/217] virtio-net: fix the upper bound when trying to delete - queues - -Message-id: <1434607916-15166-6-git-send-email-jasowang@redhat.com> -Patchwork-id: 66303 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 05/20] virtio-net: fix the upper bound when trying to delete queues -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Virtqueue were indexed from zero, so don't delete virtqueue whose -index is n->max_queues * 2 + 1. - -Cc: Michael S. Tsirkin <mst@redhat.com> -Cc: qemu-stable <qemu-stable@nongnu.org> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 27a46dcf5038e20451101ed2d5414aebf3846e27) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index 59f76bc..b6fac9c 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -1309,7 +1309,7 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) - - n->multiqueue = multiqueue; - -- for (i = 2; i <= n->max_queues * 2 + 1; i++) { -+ for (i = 2; i < n->max_queues * 2 + 1; i++) { - virtio_del_queue(vdev, i); - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-move-qdev-properties-into-virtio-net.c.patch b/SOURCES/kvm-virtio-net-move-qdev-properties-into-virtio-net.c.patch deleted file mode 100644 index d2227c2..0000000 --- a/SOURCES/kvm-virtio-net-move-qdev-properties-into-virtio-net.c.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 726ea533e540abeedbe00d007a7d90f76c02ee3e Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:59 +0200 -Subject: [PATCH 171/217] virtio-net: move qdev properties into virtio-net.c - -Message-id: <1436260751-25015-57-git-send-email-jasowang@redhat.com> -Patchwork-id: 66831 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 56/68] virtio-net: move qdev properties into virtio-net.c -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -As only one place in virtio-net.c uses DEFINE_VIRTIO_NET_FEATURES, -there is no need to expose it. Inline it into virtio-net.c to avoid -wrongly use. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 87108bb26ce04637980c0897caeabee8901e72c9) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 44 ++++++++++++++++++++++++++++++++++++++++-- - include/hw/virtio/virtio-net.h | 24 ----------------------- - 2 files changed, 42 insertions(+), 26 deletions(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index ed47f39..53d2169 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -1713,10 +1713,50 @@ static void virtio_net_instance_init(Object *obj) - } - - static Property virtio_net_properties[] = { -- DEFINE_VIRTIO_NET_FEATURES(VirtIONet, host_features), -+ DEFINE_PROP_BIT("any_layout", VirtIONet, host_features, -+ VIRTIO_F_ANY_LAYOUT, true), -+ DEFINE_PROP_BIT("csum", VirtIONet, host_features, VIRTIO_NET_F_CSUM, true), -+ DEFINE_PROP_BIT("guest_csum", VirtIONet, host_features, -+ VIRTIO_NET_F_GUEST_CSUM, true), -+ DEFINE_PROP_BIT("gso", VirtIONet, host_features, VIRTIO_NET_F_GSO, true), -+ DEFINE_PROP_BIT("guest_tso4", VirtIONet, host_features, -+ VIRTIO_NET_F_GUEST_TSO4, true), -+ DEFINE_PROP_BIT("guest_tso6", VirtIONet, host_features, -+ VIRTIO_NET_F_GUEST_TSO6, true), -+ DEFINE_PROP_BIT("guest_ecn", VirtIONet, host_features, -+ VIRTIO_NET_F_GUEST_ECN, true), -+ DEFINE_PROP_BIT("guest_ufo", VirtIONet, host_features, -+ VIRTIO_NET_F_GUEST_UFO, true), -+ DEFINE_PROP_BIT("guest_announce", VirtIONet, host_features, -+ VIRTIO_NET_F_GUEST_ANNOUNCE, true), -+ DEFINE_PROP_BIT("host_tso4", VirtIONet, host_features, -+ VIRTIO_NET_F_HOST_TSO4, true), -+ DEFINE_PROP_BIT("host_tso6", VirtIONet, host_features, -+ VIRTIO_NET_F_HOST_TSO6, true), -+ DEFINE_PROP_BIT("host_ecn", VirtIONet, host_features, -+ VIRTIO_NET_F_HOST_ECN, true), -+ DEFINE_PROP_BIT("host_ufo", VirtIONet, host_features, -+ VIRTIO_NET_F_HOST_UFO, true), -+ DEFINE_PROP_BIT("mrg_rxbuf", VirtIONet, host_features, -+ VIRTIO_NET_F_MRG_RXBUF, true), -+ DEFINE_PROP_BIT("status", VirtIONet, host_features, -+ VIRTIO_NET_F_STATUS, true), -+ DEFINE_PROP_BIT("ctrl_vq", VirtIONet, host_features, -+ VIRTIO_NET_F_CTRL_VQ, true), -+ DEFINE_PROP_BIT("ctrl_rx", VirtIONet, host_features, -+ VIRTIO_NET_F_CTRL_RX, true), -+ DEFINE_PROP_BIT("ctrl_vlan", VirtIONet, host_features, -+ VIRTIO_NET_F_CTRL_VLAN, true), -+ DEFINE_PROP_BIT("ctrl_rx_extra", VirtIONet, host_features, -+ VIRTIO_NET_F_CTRL_RX_EXTRA, true), -+ DEFINE_PROP_BIT("ctrl_mac_addr", VirtIONet, host_features, -+ VIRTIO_NET_F_CTRL_MAC_ADDR, true), -+ DEFINE_PROP_BIT("ctrl_guest_offloads", VirtIONet, host_features, -+ VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, true), -+ DEFINE_PROP_BIT("mq", VirtIONet, host_features, VIRTIO_NET_F_MQ, false), - DEFINE_NIC_PROPERTIES(VirtIONet, nic_conf), - DEFINE_PROP_UINT32("x-txtimer", VirtIONet, net_conf.txtimer, -- TX_TIMER_INTERVAL), -+ TX_TIMER_INTERVAL), - DEFINE_PROP_INT32("x-txburst", VirtIONet, net_conf.txburst, TX_BURST), - DEFINE_PROP_STRING("tx", VirtIONet, net_conf.tx), - DEFINE_PROP_END_OF_LIST(), -diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h -index e0dbb41..c142b42 100644 ---- a/include/hw/virtio/virtio-net.h -+++ b/include/hw/virtio/virtio-net.h -@@ -109,30 +109,6 @@ typedef struct VirtIONet { - #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 - #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 - --#define DEFINE_VIRTIO_NET_FEATURES(_state, _field) \ -- DEFINE_PROP_BIT("any_layout", _state, _field, VIRTIO_F_ANY_LAYOUT, true), \ -- DEFINE_PROP_BIT("csum", _state, _field, VIRTIO_NET_F_CSUM, true), \ -- DEFINE_PROP_BIT("guest_csum", _state, _field, VIRTIO_NET_F_GUEST_CSUM, true), \ -- DEFINE_PROP_BIT("gso", _state, _field, VIRTIO_NET_F_GSO, true), \ -- DEFINE_PROP_BIT("guest_tso4", _state, _field, VIRTIO_NET_F_GUEST_TSO4, true), \ -- DEFINE_PROP_BIT("guest_tso6", _state, _field, VIRTIO_NET_F_GUEST_TSO6, true), \ -- DEFINE_PROP_BIT("guest_ecn", _state, _field, VIRTIO_NET_F_GUEST_ECN, true), \ -- DEFINE_PROP_BIT("guest_ufo", _state, _field, VIRTIO_NET_F_GUEST_UFO, true), \ -- DEFINE_PROP_BIT("guest_announce", _state, _field, VIRTIO_NET_F_GUEST_ANNOUNCE, true), \ -- DEFINE_PROP_BIT("host_tso4", _state, _field, VIRTIO_NET_F_HOST_TSO4, true), \ -- DEFINE_PROP_BIT("host_tso6", _state, _field, VIRTIO_NET_F_HOST_TSO6, true), \ -- DEFINE_PROP_BIT("host_ecn", _state, _field, VIRTIO_NET_F_HOST_ECN, true), \ -- DEFINE_PROP_BIT("host_ufo", _state, _field, VIRTIO_NET_F_HOST_UFO, true), \ -- DEFINE_PROP_BIT("mrg_rxbuf", _state, _field, VIRTIO_NET_F_MRG_RXBUF, true), \ -- DEFINE_PROP_BIT("status", _state, _field, VIRTIO_NET_F_STATUS, true), \ -- DEFINE_PROP_BIT("ctrl_vq", _state, _field, VIRTIO_NET_F_CTRL_VQ, true), \ -- DEFINE_PROP_BIT("ctrl_rx", _state, _field, VIRTIO_NET_F_CTRL_RX, true), \ -- DEFINE_PROP_BIT("ctrl_vlan", _state, _field, VIRTIO_NET_F_CTRL_VLAN, true), \ -- DEFINE_PROP_BIT("ctrl_rx_extra", _state, _field, VIRTIO_NET_F_CTRL_RX_EXTRA, true), \ -- DEFINE_PROP_BIT("ctrl_mac_addr", _state, _field, VIRTIO_NET_F_CTRL_MAC_ADDR, true), \ -- DEFINE_PROP_BIT("ctrl_guest_offloads", _state, _field, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, true), \ -- DEFINE_PROP_BIT("mq", _state, _field, VIRTIO_NET_F_MQ, false) -- - #define DEFINE_VIRTIO_NET_PROPERTIES(_state, _field) \ - DEFINE_PROP_UINT32("x-txtimer", _state, _field.txtimer, TX_TIMER_INTERVAL),\ - DEFINE_PROP_INT32("x-txburst", _state, _field.txburst, TX_BURST), \ --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-no-writeable-mac-for-virtio-1.patch b/SOURCES/kvm-virtio-net-no-writeable-mac-for-virtio-1.patch deleted file mode 100644 index 71632b3..0000000 --- a/SOURCES/kvm-virtio-net-no-writeable-mac-for-virtio-1.patch +++ /dev/null @@ -1,45 +0,0 @@ -From d4c858cc95f0cf9728f7858a82bff723f04392fc Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:32 +0200 -Subject: [PATCH 144/217] virtio-net: no writeable mac for virtio-1 - -Message-id: <1436260751-25015-30-git-send-email-jasowang@redhat.com> -Patchwork-id: 66804 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 29/68] virtio-net: no writeable mac for virtio-1 -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -Devices operating as virtio 1.0 may not allow writes to the mac -address in config space. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit b6a3cddb22d3f0f729e267d45f350ae31bdebbcf) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index a4397b4..2b8d019 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -87,6 +87,7 @@ static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config) - memcpy(&netcfg, config, n->config_size); - - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR) && -+ !virtio_has_feature(vdev, VIRTIO_F_VERSION_1) && - memcmp(netcfg.mac, n->mac, ETH_ALEN)) { - memcpy(n->mac, netcfg.mac, ETH_ALEN); - qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net-support-longer-header.patch b/SOURCES/kvm-virtio-net-support-longer-header.patch deleted file mode 100644 index 7b3bb53..0000000 --- a/SOURCES/kvm-virtio-net-support-longer-header.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 5d395188ae9bca7772e9ece81835a0f9769b620b Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:33 +0200 -Subject: [PATCH 145/217] virtio-net: support longer header - -Message-id: <1436260751-25015-31-git-send-email-jasowang@redhat.com> -Patchwork-id: 66805 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 30/68] virtio-net: support longer header -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Cornelia Huck <cornelia.huck@de.ibm.com> - -virtio-1 devices always use num_buffers in the header, even if -mergeable rx buffers have not been negotiated. - -Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit bb9d17f831fa8e70494eab8421d83a542e3d8508) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/net/virtio-net.c | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index 2b8d019..ea9e22e 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -373,15 +373,21 @@ static int peer_has_ufo(VirtIONet *n) - return n->has_ufo; - } - --static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs) -+static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs, -+ int version_1) - { - int i; - NetClientState *nc; - - n->mergeable_rx_bufs = mergeable_rx_bufs; - -- n->guest_hdr_len = n->mergeable_rx_bufs ? -- sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); -+ if (version_1) { -+ n->guest_hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf); -+ } else { -+ n->guest_hdr_len = n->mergeable_rx_bufs ? -+ sizeof(struct virtio_net_hdr_mrg_rxbuf) : -+ sizeof(struct virtio_net_hdr); -+ } - - for (i = 0; i < n->max_queues; i++) { - nc = qemu_get_subqueue(n->nic, i); -@@ -528,7 +534,9 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features) - - virtio_net_set_mrg_rx_bufs(n, - __virtio_has_feature(features, -- VIRTIO_NET_F_MRG_RXBUF)); -+ VIRTIO_NET_F_MRG_RXBUF), -+ __virtio_has_feature(features, -+ VIRTIO_F_VERSION_1)); - - if (n->has_vnet_hdr) { - n->curr_guest_offloads = -@@ -1381,7 +1389,8 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, - qemu_get_buffer(f, n->mac, ETH_ALEN); - n->vqs[0].tx_waiting = qemu_get_be32(f); - -- virtio_net_set_mrg_rx_bufs(n, qemu_get_be32(f)); -+ virtio_net_set_mrg_rx_bufs(n, qemu_get_be32(f), -+ virtio_has_feature(vdev, VIRTIO_F_VERSION_1)); - - if (version_id >= 3) - n->status = qemu_get_be16(f); -@@ -1633,7 +1642,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) - - n->vqs[0].tx_waiting = 0; - n->tx_burst = n->net_conf.txburst; -- virtio_net_set_mrg_rx_bufs(n, 0); -+ virtio_net_set_mrg_rx_bufs(n, 0, 0); - n->promisc = 1; /* for compatibility */ - - n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-net.h-Remove-unsed-DEFINE_VIRTIO_NET_PROPERTI.patch b/SOURCES/kvm-virtio-net.h-Remove-unsed-DEFINE_VIRTIO_NET_PROPERTI.patch deleted file mode 100644 index 4f0c704..0000000 --- a/SOURCES/kvm-virtio-net.h-Remove-unsed-DEFINE_VIRTIO_NET_PROPERTI.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 2d586751586bee1ea8b8968a8adbe6afe0ec6e1d Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:00 +0200 -Subject: [PATCH 172/217] virtio-net.h: Remove unsed - DEFINE_VIRTIO_NET_PROPERTIES - -Message-id: <1436260751-25015-58-git-send-email-jasowang@redhat.com> -Patchwork-id: 66832 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 57/68] virtio-net.h: Remove unsed DEFINE_VIRTIO_NET_PROPERTIES -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -Remove unsed DEFINE_VIRTIO_NET_PROPERTIES in virtio-net.h and delete a -space typo. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit db58c063e159f02f0232d1557f0930fd32a6580f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/virtio/virtio-net.h | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h -index c142b42..280dacf 100644 ---- a/include/hw/virtio/virtio-net.h -+++ b/include/hw/virtio/virtio-net.h -@@ -107,12 +107,7 @@ typedef struct VirtIONet { - * VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit. - */ - #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 -- #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 -- --#define DEFINE_VIRTIO_NET_PROPERTIES(_state, _field) \ -- DEFINE_PROP_UINT32("x-txtimer", _state, _field.txtimer, TX_TIMER_INTERVAL),\ -- DEFINE_PROP_INT32("x-txburst", _state, _field.txburst, TX_BURST), \ -- DEFINE_PROP_STRING("tx", _state, _field.tx) -+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 - - void virtio_net_set_netclient_name(VirtIONet *n, const char *name, - const char *type); --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-add-flags-to-enable-disable-legacy-modern.patch b/SOURCES/kvm-virtio-pci-add-flags-to-enable-disable-legacy-modern.patch deleted file mode 100644 index 1c182f1..0000000 --- a/SOURCES/kvm-virtio-pci-add-flags-to-enable-disable-legacy-modern.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 31c5f82a937c12677b745f5e86885ebeb573df61 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:42 +0200 -Subject: [PATCH 154/217] virtio-pci: add flags to enable/disable legacy/modern - -Message-id: <1436260751-25015-40-git-send-email-jasowang@redhat.com> -Patchwork-id: 66814 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 39/68] virtio-pci: add flags to enable/disable legacy/modern -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Add VIRTIO_PCI_FLAG_DISABLE_LEGACY and VIRTIO_PCI_FLAG_DISABLE_MODERN -for VirtIOPCIProxy->flags. Also add properties for them. They can be -used to disable modern (virtio 1.0) or legacy (virtio 0.9) modes. - -By default only legacy is advertized, modern will be turned on by -default once all remaining spec compilance issues are addressed. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Acked-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit e266d421490e0ae83044bbebb209b2d3650c0ba6) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 46 +++++++++++++++++++++++++++++++++------------- - hw/virtio/virtio-pci.h | 6 ++++++ - 2 files changed, 39 insertions(+), 13 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 455b90f..b296b8c 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1197,6 +1197,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - { - VirtIOPCIProxy *proxy = VIRTIO_PCI(d); - VirtioBusState *bus = &proxy->bus; -+ bool legacy = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_LEGACY); -+ bool modern = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN); - uint8_t *config; - uint32_t size; - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -@@ -1205,13 +1207,24 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - if (proxy->class_code) { - pci_config_set_class(config, proxy->class_code); - } -- pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID, -- pci_get_word(config + PCI_VENDOR_ID)); -- pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus)); -+ -+ if (legacy) { -+ /* legacy and transitional */ -+ pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID, -+ pci_get_word(config + PCI_VENDOR_ID)); -+ pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus)); -+ } else { -+ /* pure virtio-1.0 */ -+ pci_set_word(config + PCI_VENDOR_ID, -+ PCI_VENDOR_ID_REDHAT_QUMRANET); -+ pci_set_word(config + PCI_DEVICE_ID, -+ 0x1040 + virtio_bus_get_vdev_id(bus)); -+ pci_config_set_revision(config, 1); -+ } - config[PCI_INTERRUPT_PIN] = 1; - - -- if (1) { /* TODO: Make this optional, dependent on virtio 1.0 */ -+ if (modern) { - struct virtio_pci_cap common = { - .cfg_type = VIRTIO_PCI_CAP_COMMON_CFG, - .cap_len = sizeof common, -@@ -1325,17 +1338,20 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - - proxy->pci_dev.config_write = virtio_write_config; - -- size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) -- + virtio_bus_get_vdev_config_len(bus); -- if (size & (size - 1)) { -- size = 1 << qemu_fls(size); -- } -+ if (legacy) { -+ size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) -+ + virtio_bus_get_vdev_config_len(bus); -+ if (size & (size - 1)) { -+ size = 1 << qemu_fls(size); -+ } - -- memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops, -- proxy, "virtio-pci", size); -+ memory_region_init_io(&proxy->bar, OBJECT(proxy), -+ &virtio_pci_config_ops, -+ proxy, "virtio-pci", size); - -- pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, -- &proxy->bar); -+ pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, -+ &proxy->bar); -+ } - - if (!kvm_has_many_ioeventfds()) { - proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; -@@ -1379,6 +1395,10 @@ static void virtio_pci_reset(DeviceState *qdev) - static Property virtio_pci_properties[] = { - DEFINE_PROP_BIT("virtio-pci-bus-master-bug-migration", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, false), -+ DEFINE_PROP_BIT("disable-legacy", VirtIOPCIProxy, flags, -+ VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT, false), -+ DEFINE_PROP_BIT("disable-modern", VirtIOPCIProxy, flags, -+ VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT, true), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index 7a6481f..4e9b2db 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -63,6 +63,12 @@ typedef struct VirtioBusClass VirtioPCIBusClass; - #define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1 - #define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT) - -+/* virtio version flags */ -+#define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2 -+#define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3 -+#define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT) -+#define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT) -+ - typedef struct { - MSIMessage msg; - int virq; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-add-struct-VirtIOPCIRegion-for-virtio-1-r.patch b/SOURCES/kvm-virtio-pci-add-struct-VirtIOPCIRegion-for-virtio-1-r.patch deleted file mode 100644 index 00bfc50..0000000 --- a/SOURCES/kvm-virtio-pci-add-struct-VirtIOPCIRegion-for-virtio-1-r.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 2e460b990de6c094b798e73a8b151d5c874db82d Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:49 +0200 -Subject: [PATCH 161/217] virtio-pci: add struct VirtIOPCIRegion for virtio-1 - regions - -Message-id: <1436260751-25015-47-git-send-email-jasowang@redhat.com> -Patchwork-id: 66821 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 46/68] virtio-pci: add struct VirtIOPCIRegion for virtio-1 regions -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -For now just place the MemoryRegion there, -following patches will add more. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 588255ad5021f06789f438f7b045015c54e30841) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 20 +++++++++++--------- - hw/virtio/virtio-pci.h | 12 ++++++++---- - 2 files changed, 19 insertions(+), 13 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 9677ec2..ed47a6d 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -145,7 +145,7 @@ static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy, - EventNotifier *notifier = virtio_queue_get_host_notifier(vq); - bool legacy = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_LEGACY); - bool modern = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN); -- MemoryRegion *modern_mr = &proxy->notify; -+ MemoryRegion *modern_mr = &proxy->notify.mr; - MemoryRegion *legacy_mr = &proxy->bar; - hwaddr modern_addr = QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - virtio_get_queue_index(vq); -@@ -1340,28 +1340,30 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", - 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); -- memory_region_init_io(&proxy->common, OBJECT(proxy), -+ memory_region_init_io(&proxy->common.mr, OBJECT(proxy), - &common_ops, - proxy, - "virtio-pci-common", 0x1000); -- memory_region_add_subregion(&proxy->modern_bar, 0, &proxy->common); -- memory_region_init_io(&proxy->isr, OBJECT(proxy), -+ memory_region_add_subregion(&proxy->modern_bar, 0, &proxy->common.mr); -+ memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), - &isr_ops, - proxy, - "virtio-pci-isr", 0x1000); -- memory_region_add_subregion(&proxy->modern_bar, 0x1000, &proxy->isr); -- memory_region_init_io(&proxy->device, OBJECT(proxy), -+ memory_region_add_subregion(&proxy->modern_bar, 0x1000, &proxy->isr.mr); -+ memory_region_init_io(&proxy->device.mr, OBJECT(proxy), - &device_ops, - virtio_bus_get_device(&proxy->bus), - "virtio-pci-device", 0x1000); -- memory_region_add_subregion(&proxy->modern_bar, 0x2000, &proxy->device); -- memory_region_init_io(&proxy->notify, OBJECT(proxy), -+ memory_region_add_subregion(&proxy->modern_bar, 0x2000, -+ &proxy->device.mr); -+ memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), - ¬ify_ops, - virtio_bus_get_device(&proxy->bus), - "virtio-pci-notify", - QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); -- memory_region_add_subregion(&proxy->modern_bar, 0x3000, &proxy->notify); -+ memory_region_add_subregion(&proxy->modern_bar, 0x3000, -+ &proxy->notify.mr); - pci_register_bar(&proxy->pci_dev, modern_mem_bar, - PCI_BASE_ADDRESS_SPACE_MEMORY | - PCI_BASE_ADDRESS_MEM_PREFETCH | -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index 4e9b2db..8f1fc02 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -91,13 +91,17 @@ typedef struct VirtioPCIClass { - void (*realize)(VirtIOPCIProxy *vpci_dev, Error **errp); - } VirtioPCIClass; - -+typedef struct VirtIOPCIRegion { -+ MemoryRegion mr; -+} VirtIOPCIRegion; -+ - struct VirtIOPCIProxy { - PCIDevice pci_dev; - MemoryRegion bar; -- MemoryRegion common; -- MemoryRegion isr; -- MemoryRegion device; -- MemoryRegion notify; -+ VirtIOPCIRegion common; -+ VirtIOPCIRegion isr; -+ VirtIOPCIRegion device; -+ VirtIOPCIRegion notify; - MemoryRegion modern_bar; - uint32_t flags; - uint32_t class_code; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-add-virtio_pci_modern_region_map.patch b/SOURCES/kvm-virtio-pci-add-virtio_pci_modern_region_map.patch deleted file mode 100644 index 52f23c6..0000000 --- a/SOURCES/kvm-virtio-pci-add-virtio_pci_modern_region_map.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 6f99b7d23517176b39b660bd691f893ed9107591 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:51 +0200 -Subject: [PATCH 163/217] virtio-pci: add virtio_pci_modern_region_map() - -Message-id: <1436260751-25015-49-git-send-email-jasowang@redhat.com> -Patchwork-id: 66822 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 48/68] virtio-pci: add virtio_pci_modern_region_map() -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Add function to map modern virtio regions. -Add offset to VirtIOPCIRegion. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit a3cc2e81592aba6d818005c078b94b16ba47a02c) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 25 +++++++++++++++++++------ - hw/virtio/virtio-pci.h | 1 + - 2 files changed, 20 insertions(+), 6 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 2d1059d..415660a 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1251,20 +1251,35 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) - &common_ops, - proxy, - "virtio-pci-common", 0x1000); -+ proxy->common.offset = 0x0; -+ - memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), - &isr_ops, - proxy, - "virtio-pci-isr", 0x1000); -+ proxy->isr.offset = 0x1000; -+ - memory_region_init_io(&proxy->device.mr, OBJECT(proxy), - &device_ops, - virtio_bus_get_device(&proxy->bus), - "virtio-pci-device", 0x1000); -+ proxy->device.offset = 0x2000; -+ - memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), - ¬ify_ops, - virtio_bus_get_device(&proxy->bus), - "virtio-pci-notify", - QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); -+ proxy->notify.offset = 0x3000; -+} -+ -+static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, -+ VirtIOPCIRegion *region) -+{ -+ memory_region_add_subregion(&proxy->modern_bar, -+ region->offset, -+ ®ion->mr); - } - - /* This is called by virtio-bus just after the device is plugged. */ -@@ -1359,12 +1374,10 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); - virtio_pci_modern_regions_init(proxy); -- memory_region_add_subregion(&proxy->modern_bar, 0, &proxy->common.mr); -- memory_region_add_subregion(&proxy->modern_bar, 0x1000, &proxy->isr.mr); -- memory_region_add_subregion(&proxy->modern_bar, 0x2000, -- &proxy->device.mr); -- memory_region_add_subregion(&proxy->modern_bar, 0x3000, -- &proxy->notify.mr); -+ virtio_pci_modern_region_map(proxy, &proxy->common); -+ virtio_pci_modern_region_map(proxy, &proxy->isr); -+ virtio_pci_modern_region_map(proxy, &proxy->device); -+ virtio_pci_modern_region_map(proxy, &proxy->notify); - pci_register_bar(&proxy->pci_dev, modern_mem_bar, - PCI_BASE_ADDRESS_SPACE_MEMORY | - PCI_BASE_ADDRESS_MEM_PREFETCH | -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index 8f1fc02..f5829b0 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -93,6 +93,7 @@ typedef struct VirtioPCIClass { - - typedef struct VirtIOPCIRegion { - MemoryRegion mr; -+ uint32_t offset; - } VirtIOPCIRegion; - - struct VirtIOPCIProxy { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-add-virtio_pci_modern_regions_init.patch b/SOURCES/kvm-virtio-pci-add-virtio_pci_modern_regions_init.patch deleted file mode 100644 index 2a46c4d..0000000 --- a/SOURCES/kvm-virtio-pci-add-virtio_pci_modern_regions_init.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 2197cce6812ce06be0a25c16e9215193e4e6a294 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:50 +0200 -Subject: [PATCH 162/217] virtio-pci: add virtio_pci_modern_regions_init() - -Message-id: <1436260751-25015-48-git-send-email-jasowang@redhat.com> -Patchwork-id: 66826 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 47/68] virtio-pci: add virtio_pci_modern_regions_init() -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Add init function for the modern pci regions, -move over the init code. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 1141ce2190c85daacfa9b874476651ed0f7dc6df) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 117 +++++++++++++++++++++++++------------------------ - 1 file changed, 59 insertions(+), 58 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index ed47a6d..2d1059d 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1208,6 +1208,64 @@ static void virtio_pci_device_write(void *opaque, hwaddr addr, - } - } - -+static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) -+{ -+ static const MemoryRegionOps common_ops = { -+ .read = virtio_pci_common_read, -+ .write = virtio_pci_common_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ static const MemoryRegionOps isr_ops = { -+ .read = virtio_pci_isr_read, -+ .write = virtio_pci_isr_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ static const MemoryRegionOps device_ops = { -+ .read = virtio_pci_device_read, -+ .write = virtio_pci_device_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ static const MemoryRegionOps notify_ops = { -+ .read = virtio_pci_notify_read, -+ .write = virtio_pci_notify_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ -+ memory_region_init_io(&proxy->common.mr, OBJECT(proxy), -+ &common_ops, -+ proxy, -+ "virtio-pci-common", 0x1000); -+ memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), -+ &isr_ops, -+ proxy, -+ "virtio-pci-isr", 0x1000); -+ memory_region_init_io(&proxy->device.mr, OBJECT(proxy), -+ &device_ops, -+ virtio_bus_get_device(&proxy->bus), -+ "virtio-pci-device", 0x1000); -+ memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), -+ ¬ify_ops, -+ virtio_bus_get_device(&proxy->bus), -+ "virtio-pci-notify", -+ QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -+ VIRTIO_QUEUE_MAX); -+} - - /* This is called by virtio-bus just after the device is plugged. */ - static void virtio_pci_device_plugged(DeviceState *d, Error **errp) -@@ -1290,46 +1348,6 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT), - }; - -- static const MemoryRegionOps common_ops = { -- .read = virtio_pci_common_read, -- .write = virtio_pci_common_write, -- .impl = { -- .min_access_size = 1, -- .max_access_size = 4, -- }, -- .endianness = DEVICE_LITTLE_ENDIAN, -- }; -- -- static const MemoryRegionOps isr_ops = { -- .read = virtio_pci_isr_read, -- .write = virtio_pci_isr_write, -- .impl = { -- .min_access_size = 1, -- .max_access_size = 4, -- }, -- .endianness = DEVICE_LITTLE_ENDIAN, -- }; -- -- static const MemoryRegionOps device_ops = { -- .read = virtio_pci_device_read, -- .write = virtio_pci_device_write, -- .impl = { -- .min_access_size = 1, -- .max_access_size = 4, -- }, -- .endianness = DEVICE_LITTLE_ENDIAN, -- }; -- -- static const MemoryRegionOps notify_ops = { -- .read = virtio_pci_notify_read, -- .write = virtio_pci_notify_write, -- .impl = { -- .min_access_size = 1, -- .max_access_size = 4, -- }, -- .endianness = DEVICE_LITTLE_ENDIAN, -- }; -- - /* TODO: add io access for speed */ - virtio_pci_add_mem_cap(proxy, &common); - virtio_pci_add_mem_cap(proxy, &isr); -@@ -1340,28 +1358,11 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", - 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); -- memory_region_init_io(&proxy->common.mr, OBJECT(proxy), -- &common_ops, -- proxy, -- "virtio-pci-common", 0x1000); -+ virtio_pci_modern_regions_init(proxy); - memory_region_add_subregion(&proxy->modern_bar, 0, &proxy->common.mr); -- memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), -- &isr_ops, -- proxy, -- "virtio-pci-isr", 0x1000); - memory_region_add_subregion(&proxy->modern_bar, 0x1000, &proxy->isr.mr); -- memory_region_init_io(&proxy->device.mr, OBJECT(proxy), -- &device_ops, -- virtio_bus_get_device(&proxy->bus), -- "virtio-pci-device", 0x1000); - memory_region_add_subregion(&proxy->modern_bar, 0x2000, - &proxy->device.mr); -- memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), -- ¬ify_ops, -- virtio_bus_get_device(&proxy->bus), -- "virtio-pci-notify", -- QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -- VIRTIO_QUEUE_MAX); - memory_region_add_subregion(&proxy->modern_bar, 0x3000, - &proxy->notify.mr); - pci_register_bar(&proxy->pci_dev, modern_mem_bar, --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-change-document-virtio-pci-bar-layout.patch b/SOURCES/kvm-virtio-pci-change-document-virtio-pci-bar-layout.patch deleted file mode 100644 index b627ecb..0000000 --- a/SOURCES/kvm-virtio-pci-change-document-virtio-pci-bar-layout.patch +++ /dev/null @@ -1,126 +0,0 @@ -From e5754f8928cdfe0253689f5c883d21e419f6faea Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:44 +0200 -Subject: [PATCH 156/217] virtio-pci: change & document virtio pci bar layout. - -Message-id: <1436260751-25015-42-git-send-email-jasowang@redhat.com> -Patchwork-id: 66816 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 41/68] virtio-pci: change & document virtio pci bar layout. -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -This patch adds variables for the pci bars (to get rid of the magic -numbers in the code) and moves the modern virtio bar to region 4 so -regions 2+3 are kept free. virtio-vga wants use them. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 23c5e3977502a1b57fa2d8cf8cf4b5c9e45f0d1f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 31 +++++++++++++++++++++++++------ - 1 file changed, 25 insertions(+), 6 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 5986838..1d6c10b 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -926,8 +926,6 @@ static void virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, - PCIDevice *dev = &proxy->pci_dev; - int offset; - -- cap->bar = 2; -- - offset = pci_add_capability(dev, PCI_CAP_ID_VNDR, 0, cap->cap_len); - assert(offset > 0); - -@@ -1203,6 +1201,22 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - uint32_t size; - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - -+ /* -+ * virtio pci bar layout -+ * -+ * region 0 -- virtio legacy io bar -+ * region 1 -- msi-x bar -+ * region 2+3 -- not used by virtio-pci -+ * region 4+5 -- virtio modern memory (64bit) bar -+ * -+ * Regions 2+3 can be used by VirtIOPCIProxy subclasses. -+ * virtio-vga places the vga framebuffer there. -+ * -+ */ -+ uint32_t legacy_io_bar = 0; -+ uint32_t msix_bar = 1; -+ uint32_t modern_mem_bar = 4; -+ - config = proxy->pci_dev.config; - if (proxy->class_code) { - pci_config_set_class(config, proxy->class_code); -@@ -1228,24 +1242,28 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - struct virtio_pci_cap common = { - .cfg_type = VIRTIO_PCI_CAP_COMMON_CFG, - .cap_len = sizeof common, -+ .bar = modern_mem_bar, - .offset = cpu_to_le32(0x0), - .length = cpu_to_le32(0x1000), - }; - struct virtio_pci_cap isr = { - .cfg_type = VIRTIO_PCI_CAP_ISR_CFG, - .cap_len = sizeof isr, -+ .bar = modern_mem_bar, - .offset = cpu_to_le32(0x1000), - .length = cpu_to_le32(0x1000), - }; - struct virtio_pci_cap device = { - .cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG, - .cap_len = sizeof device, -+ .bar = modern_mem_bar, - .offset = cpu_to_le32(0x2000), - .length = cpu_to_le32(0x1000), - }; - struct virtio_pci_notify_cap notify = { - .cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG, - .cap.cap_len = sizeof notify, -+ .cap.bar = modern_mem_bar, - .cap.offset = cpu_to_le32(0x3000), - .cap.length = cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX), -@@ -1325,12 +1343,13 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); - memory_region_add_subregion(&proxy->modern_bar, 0x3000, &proxy->notify); -- pci_register_bar(&proxy->pci_dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, -+ pci_register_bar(&proxy->pci_dev, modern_mem_bar, -+ PCI_BASE_ADDRESS_SPACE_MEMORY, - &proxy->modern_bar); - } - - if (proxy->nvectors && -- msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) { -+ msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, msix_bar)) { - error_report("unable to init msix vectors to %" PRIu32, - proxy->nvectors); - proxy->nvectors = 0; -@@ -1349,8 +1368,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - &virtio_pci_config_ops, - proxy, "virtio-pci", size); - -- pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, -- &proxy->bar); -+ pci_register_bar(&proxy->pci_dev, legacy_io_bar, -+ PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); - } - - if (!kvm_has_many_ioeventfds()) { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-correctly-set-host-notifiers-for-modern-b.patch b/SOURCES/kvm-virtio-pci-correctly-set-host-notifiers-for-modern-b.patch deleted file mode 100644 index 4ebe082..0000000 --- a/SOURCES/kvm-virtio-pci-correctly-set-host-notifiers-for-modern-b.patch +++ /dev/null @@ -1,103 +0,0 @@ -From d8e5a36995271120c98604e386e927e2c56cc2d0 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:46 +0200 -Subject: [PATCH 158/217] virtio-pci: correctly set host notifiers for modern - bar - -Message-id: <1436260751-25015-44-git-send-email-jasowang@redhat.com> -Patchwork-id: 66818 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 43/68] virtio-pci: correctly set host notifiers for modern bar -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -Currently, during host notifier set. We only add eventfd for legacy -bar, this is not correct since: - -- Non-transitional device does not have legacy bar, so qemu will crash - since proxy->bar was not initialized. -- Modern device uses modern bar and notify cap to notify the device, - we should add eventfd for proxy->notify. - -So this patch fixes the above two issues by adding eventfd based on -whether legacy or modern device were supported. - -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 975acc0ae6d60260859884a9235ae3c62e2969a2) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 31 +++++++++++++++++++++++++------ - 1 file changed, 25 insertions(+), 6 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 4d80716..9677ec2 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -135,12 +135,21 @@ static int virtio_pci_load_queue(DeviceState *d, int n, QEMUFile *f) - return 0; - } - -+#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000 -+ - static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy, - int n, bool assign, bool set_handler) - { - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - VirtQueue *vq = virtio_get_queue(vdev, n); - EventNotifier *notifier = virtio_queue_get_host_notifier(vq); -+ bool legacy = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_LEGACY); -+ bool modern = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN); -+ MemoryRegion *modern_mr = &proxy->notify; -+ MemoryRegion *legacy_mr = &proxy->bar; -+ hwaddr modern_addr = QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -+ virtio_get_queue_index(vq); -+ hwaddr legacy_addr = VIRTIO_PCI_QUEUE_NOTIFY; - int r = 0; - - if (assign) { -@@ -151,11 +160,23 @@ static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy, - return r; - } - virtio_queue_set_host_notifier_fd_handler(vq, true, set_handler); -- memory_region_add_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY, 2, -- true, n, notifier); -+ if (modern) { -+ memory_region_add_eventfd(modern_mr, modern_addr, 2, -+ true, n, notifier); -+ } -+ if (legacy) { -+ memory_region_add_eventfd(legacy_mr, legacy_addr, 2, -+ true, n, notifier); -+ } - } else { -- memory_region_del_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY, 2, -- true, n, notifier); -+ if (modern) { -+ memory_region_del_eventfd(modern_mr, modern_addr, 2, -+ true, n, notifier); -+ } -+ if (legacy) { -+ memory_region_del_eventfd(legacy_mr, legacy_addr, 2, -+ true, n, notifier); -+ } - virtio_queue_set_host_notifier_fd_handler(vq, false, false); - event_notifier_cleanup(notifier); - } -@@ -934,8 +955,6 @@ static void virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, - cap->cap_len - PCI_CAP_FLAGS); - } - --#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000 -- - static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, - unsigned size) - { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-don-t-try-to-mask-or-unmask-vqs-without-n.patch b/SOURCES/kvm-virtio-pci-don-t-try-to-mask-or-unmask-vqs-without-n.patch deleted file mode 100644 index 4d968a9..0000000 --- a/SOURCES/kvm-virtio-pci-don-t-try-to-mask-or-unmask-vqs-without-n.patch +++ /dev/null @@ -1,83 +0,0 @@ -From a98529c8a86399ff4ad4efc95b89c079252ecef3 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:56 +0200 -Subject: [PATCH 035/217] virtio-pci: don't try to mask or unmask vqs without - notifiers - -Message-id: <1434607916-15166-21-git-send-email-jasowang@redhat.com> -Patchwork-id: 66319 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 20/20] virtio-pci: don't try to mask or unmask vqs without notifiers -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -We should validate the vq index against nvqs_with_notifiers. Otherwise we may -try to mask or unmask vector for vqs without notifiers (e.g control vq). This -will lead qemu abort on kvm_irqchip_commit_routes() when trying to boot win8.1 -guest. - -Fixes 851c2a75a6e80c8aa5e713864d98cfb512e7229b ("virtio-pci: speedup MSI-X -masking and unmasking") - -Reported-by: Alex Williamson <alex.williamson@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 6652d0811c9463fbfb2d2d1cb2ec03f388145c5f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 21 ++++++++++++++------- - 1 file changed, 14 insertions(+), 7 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 625bf25..48ff555 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -638,21 +638,26 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector, - if (!virtio_queue_get_num(vdev, index)) { - break; - } -- ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg); -- if (ret < 0) { -- goto undo; -+ if (index < proxy->nvqs_with_notifiers) { -+ ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg); -+ if (ret < 0) { -+ goto undo; -+ } -+ ++unmasked; - } - vq = virtio_vector_next_queue(vq); -- ++unmasked; - } - - return 0; - - undo: - vq = virtio_vector_first_queue(vdev, vector); -- while (vq && --unmasked >= 0) { -+ while (vq && unmasked >= 0) { - index = virtio_get_queue_index(vq); -- virtio_pci_vq_vector_mask(proxy, index, vector); -+ if (index < proxy->nvqs_with_notifiers) { -+ virtio_pci_vq_vector_mask(proxy, index, vector); -+ --unmasked; -+ } - vq = virtio_vector_next_queue(vq); - } - return ret; -@@ -670,7 +675,9 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector) - if (!virtio_queue_get_num(vdev, index)) { - break; - } -- virtio_pci_vq_vector_mask(proxy, index, vector); -+ if (index < proxy->nvqs_with_notifiers) { -+ virtio_pci_vq_vector_mask(proxy, index, vector); -+ } - vq = virtio_vector_next_queue(vq); - } - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-drop-identical-virtio_pci_cap.patch b/SOURCES/kvm-virtio-pci-drop-identical-virtio_pci_cap.patch deleted file mode 100644 index 2e9b6d8..0000000 --- a/SOURCES/kvm-virtio-pci-drop-identical-virtio_pci_cap.patch +++ /dev/null @@ -1,67 +0,0 @@ -From f2f74f60cefff45bd9b6efc42672e643f640b7bd Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:54 +0200 -Subject: [PATCH 166/217] virtio-pci: drop identical virtio_pci_cap - -Message-id: <1436260751-25015-52-git-send-email-jasowang@redhat.com> -Patchwork-id: 66825 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 51/68] virtio-pci: drop identical virtio_pci_cap -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Now the three struct virtio_pci_caps are identical, -lets drop two of them ;) - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit cc52ea90f835aa66d431db712b22f8b15bec2e46) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 18 +++++------------- - 1 file changed, 5 insertions(+), 13 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 9c509e0..374b878 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1341,16 +1341,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - - - if (modern) { -- struct virtio_pci_cap common = { -- .cap_len = sizeof common, -- .bar = modern_mem_bar, -- }; -- struct virtio_pci_cap isr = { -- .cap_len = sizeof isr, -- .bar = modern_mem_bar, -- }; -- struct virtio_pci_cap device = { -- .cap_len = sizeof device, -+ struct virtio_pci_cap cap = { -+ .cap_len = sizeof cap, - .bar = modern_mem_bar, - }; - struct virtio_pci_notify_cap notify = { -@@ -1367,9 +1359,9 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); - virtio_pci_modern_regions_init(proxy); -- virtio_pci_modern_region_map(proxy, &proxy->common, &common); -- virtio_pci_modern_region_map(proxy, &proxy->isr, &isr); -- virtio_pci_modern_region_map(proxy, &proxy->device, &device); -+ virtio_pci_modern_region_map(proxy, &proxy->common, &cap); -+ virtio_pci_modern_region_map(proxy, &proxy->isr, &cap); -+ virtio_pci_modern_region_map(proxy, &proxy->device, &cap); - virtio_pci_modern_region_map(proxy, &proxy->notify, ¬ify.cap); - pci_register_bar(&proxy->pci_dev, modern_mem_bar, - PCI_BASE_ADDRESS_SPACE_MEMORY | --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-fill-VirtIOPCIRegions-early.patch b/SOURCES/kvm-virtio-pci-fill-VirtIOPCIRegions-early.patch deleted file mode 100644 index 63312c8..0000000 --- a/SOURCES/kvm-virtio-pci-fill-VirtIOPCIRegions-early.patch +++ /dev/null @@ -1,237 +0,0 @@ -From d7228bcd52c3150a536ef6d43831ba6c813c018c Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:55 +0200 -Subject: [PATCH 167/217] virtio-pci: fill VirtIOPCIRegions early. - -Message-id: <1436260751-25015-53-git-send-email-jasowang@redhat.com> -Patchwork-id: 66827 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 52/68] virtio-pci: fill VirtIOPCIRegions early. -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Initialize the modern bar and the VirtIOPCIRegion fields early, in -realize. Also add a size field to VirtIOPCIRegion and variables for -pci bars to VirtIOPCIProxy. - -This allows virtio-pci subclasses to change things before the -device_plugged callback applies them. virtio-vga will use that to -arrange regions in a way that virtio-vga is compatible to both stdvga -(in vga mode) and virtio-gpu-pci (in pci mode). - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit b6ce27a593ab39ac28baebc3045901925046bebd) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 92 ++++++++++++++++++++++++++++---------------------- - hw/virtio/virtio-pci.h | 4 +++ - 2 files changed, 55 insertions(+), 41 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 374b878..0313712 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1250,32 +1250,26 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) - memory_region_init_io(&proxy->common.mr, OBJECT(proxy), - &common_ops, - proxy, -- "virtio-pci-common", 0x1000); -- proxy->common.offset = 0x0; -- proxy->common.type = VIRTIO_PCI_CAP_COMMON_CFG; -+ "virtio-pci-common", -+ proxy->common.size); - - memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), - &isr_ops, - proxy, -- "virtio-pci-isr", 0x1000); -- proxy->isr.offset = 0x1000; -- proxy->isr.type = VIRTIO_PCI_CAP_ISR_CFG; -+ "virtio-pci-isr", -+ proxy->isr.size); - - memory_region_init_io(&proxy->device.mr, OBJECT(proxy), - &device_ops, - virtio_bus_get_device(&proxy->bus), -- "virtio-pci-device", 0x1000); -- proxy->device.offset = 0x2000; -- proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG; -+ "virtio-pci-device", -+ proxy->device.size); - - memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), - ¬ify_ops, - virtio_bus_get_device(&proxy->bus), - "virtio-pci-notify", -- QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -- VIRTIO_QUEUE_MAX); -- proxy->notify.offset = 0x3000; -- proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG; -+ proxy->notify.size); - } - - static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, -@@ -1287,8 +1281,9 @@ static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, - ®ion->mr); - - cap->cfg_type = region->type; -+ cap->bar = proxy->modern_mem_bar; - cap->offset = cpu_to_le32(region->offset); -- cap->length = cpu_to_le32(memory_region_size(®ion->mr)); -+ cap->length = cpu_to_le32(region->size); - virtio_pci_add_mem_cap(proxy, cap); - } - -@@ -1303,22 +1298,6 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - uint32_t size; - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - -- /* -- * virtio pci bar layout -- * -- * region 0 -- virtio legacy io bar -- * region 1 -- msi-x bar -- * region 2+3 -- not used by virtio-pci -- * region 4+5 -- virtio modern memory (64bit) bar -- * -- * Regions 2+3 can be used by VirtIOPCIProxy subclasses. -- * virtio-vga places the vga framebuffer there. -- * -- */ -- uint32_t legacy_io_bar = 0; -- uint32_t msix_bar = 1; -- uint32_t modern_mem_bar = 4; -- - config = proxy->pci_dev.config; - if (proxy->class_code) { - pci_config_set_class(config, proxy->class_code); -@@ -1343,11 +1322,9 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - if (modern) { - struct virtio_pci_cap cap = { - .cap_len = sizeof cap, -- .bar = modern_mem_bar, - }; - struct virtio_pci_notify_cap notify = { - .cap.cap_len = sizeof notify, -- .cap.bar = modern_mem_bar, - .notify_off_multiplier = - cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT), - }; -@@ -1355,15 +1332,12 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - /* TODO: add io access for speed */ - - virtio_add_feature(&vdev->host_features, VIRTIO_F_VERSION_1); -- memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", -- 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -- VIRTIO_QUEUE_MAX); - virtio_pci_modern_regions_init(proxy); - virtio_pci_modern_region_map(proxy, &proxy->common, &cap); - virtio_pci_modern_region_map(proxy, &proxy->isr, &cap); - virtio_pci_modern_region_map(proxy, &proxy->device, &cap); - virtio_pci_modern_region_map(proxy, &proxy->notify, ¬ify.cap); -- pci_register_bar(&proxy->pci_dev, modern_mem_bar, -+ pci_register_bar(&proxy->pci_dev, proxy->modern_mem_bar, - PCI_BASE_ADDRESS_SPACE_MEMORY | - PCI_BASE_ADDRESS_MEM_PREFETCH | - PCI_BASE_ADDRESS_MEM_TYPE_64, -@@ -1371,7 +1345,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - } - - if (proxy->nvectors && -- msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, msix_bar)) { -+ msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, -+ proxy->msix_bar)) { - error_report("unable to init msix vectors to %" PRIu32, - proxy->nvectors); - proxy->nvectors = 0; -@@ -1390,7 +1365,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - &virtio_pci_config_ops, - proxy, "virtio-pci", size); - -- pci_register_bar(&proxy->pci_dev, legacy_io_bar, -+ pci_register_bar(&proxy->pci_dev, proxy->legacy_io_bar, - PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); - } - -@@ -1410,12 +1385,47 @@ static void virtio_pci_device_unplugged(DeviceState *d) - - static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) - { -- VirtIOPCIProxy *dev = VIRTIO_PCI(pci_dev); -+ VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev); - VirtioPCIClass *k = VIRTIO_PCI_GET_CLASS(pci_dev); - -- virtio_pci_bus_new(&dev->bus, sizeof(dev->bus), dev); -+ /* -+ * virtio pci bar layout used by default. -+ * subclasses can re-arrange things if needed. -+ * -+ * region 0 -- virtio legacy io bar -+ * region 1 -- msi-x bar -+ * region 4+5 -- virtio modern memory (64bit) bar -+ * -+ */ -+ proxy->legacy_io_bar = 0; -+ proxy->msix_bar = 1; -+ proxy->modern_mem_bar = 4; -+ -+ proxy->common.offset = 0x0; -+ proxy->common.size = 0x1000; -+ proxy->common.type = VIRTIO_PCI_CAP_COMMON_CFG; -+ -+ proxy->isr.offset = 0x1000; -+ proxy->isr.size = 0x1000; -+ proxy->isr.type = VIRTIO_PCI_CAP_ISR_CFG; -+ -+ proxy->device.offset = 0x2000; -+ proxy->device.size = 0x1000; -+ proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG; -+ -+ proxy->notify.offset = 0x3000; -+ proxy->notify.size = -+ QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * VIRTIO_QUEUE_MAX; -+ proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG; -+ -+ /* subclasses can enforce modern, so do this unconditionally */ -+ memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", -+ 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -+ VIRTIO_QUEUE_MAX); -+ -+ virtio_pci_bus_new(&proxy->bus, sizeof(proxy->bus), proxy); - if (k->realize) { -- k->realize(dev, errp); -+ k->realize(proxy, errp); - } - } - -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index ea1343d..ff5ab71 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -94,6 +94,7 @@ typedef struct VirtioPCIClass { - typedef struct VirtIOPCIRegion { - MemoryRegion mr; - uint32_t offset; -+ uint32_t size; - uint32_t type; - } VirtIOPCIRegion; - -@@ -105,6 +106,9 @@ struct VirtIOPCIProxy { - VirtIOPCIRegion device; - VirtIOPCIRegion notify; - MemoryRegion modern_bar; -+ uint32_t legacy_io_bar; -+ uint32_t msix_bar; -+ uint32_t modern_mem_bar; - uint32_t flags; - uint32_t class_code; - uint32_t nvectors; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-initial-virtio-1.0-support.patch b/SOURCES/kvm-virtio-pci-initial-virtio-1.0-support.patch deleted file mode 100644 index 807c1d8..0000000 --- a/SOURCES/kvm-virtio-pci-initial-virtio-1.0-support.patch +++ /dev/null @@ -1,480 +0,0 @@ -From b95c028d3257ab6c58c4115734655617cfa7de6c Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:38 +0200 -Subject: [PATCH 150/217] virtio-pci: initial virtio 1.0 support - -Message-id: <1436260751-25015-36-git-send-email-jasowang@redhat.com> -Patchwork-id: 66810 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 35/68] virtio-pci: initial virtio 1.0 support -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -This is somewhat functional. With this, and linux driver from my tree, -I was able to use virtio net as virtio 1.0 device for light browsing. - -At the moment, dataplane and vhost code is -still missing. - -Based on Cornelia's virtio 1.0 patchset: - Date: Thu, 11 Dec 2014 14:25:02 +0100 - From: Cornelia Huck <cornelia.huck@de.ibm.com> - To: virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org - Cc: rusty@rustcorp.com.au, thuth@linux.vnet.ibm.com, mst@redhat.com, - Cornelia Huck <cornelia.huck@de.ibm.com> - Subject: [PATCH RFC v6 00/20] qemu: towards virtio-1 host support - Message-Id: <1418304322-7546-1-git-send-email-cornelia.huck@de.ibm.com> - -which is itself still missing some core bits. - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit dfb8e184db758bff275f94f7aa634300886cfe21) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 379 +++++++++++++++++++++++++++++++++++++++++++++++++ - hw/virtio/virtio-pci.h | 16 +++ - 2 files changed, 395 insertions(+) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index e32bb89..5c69614 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -920,6 +920,278 @@ static int virtio_pci_query_nvectors(DeviceState *d) - return proxy->nvectors; - } - -+static void virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, -+ struct virtio_pci_cap *cap) -+{ -+ PCIDevice *dev = &proxy->pci_dev; -+ int offset; -+ -+ cap->bar = 2; -+ -+ offset = pci_add_capability(dev, PCI_CAP_ID_VNDR, 0, cap->cap_len); -+ assert(offset > 0); -+ -+ assert(cap->cap_len >= sizeof *cap); -+ memcpy(dev->config + offset + PCI_CAP_FLAGS, &cap->cap_len, -+ cap->cap_len - PCI_CAP_FLAGS); -+} -+ -+#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x10000 -+ -+static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, -+ unsigned size) -+{ -+ VirtIOPCIProxy *proxy = opaque; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ uint32_t val = 0; -+ int i; -+ -+ switch (addr) { -+ case VIRTIO_PCI_COMMON_DFSELECT: -+ val = proxy->dfselect; -+ break; -+ case VIRTIO_PCI_COMMON_DF: -+ if (proxy->dfselect <= 1) { -+ val = vdev->host_features >> (32 * proxy->dfselect); -+ } -+ break; -+ case VIRTIO_PCI_COMMON_GFSELECT: -+ val = proxy->gfselect; -+ break; -+ case VIRTIO_PCI_COMMON_GF: -+ if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) { -+ val = proxy->guest_features[proxy->gfselect]; -+ } -+ break; -+ case VIRTIO_PCI_COMMON_MSIX: -+ val = vdev->config_vector; -+ break; -+ case VIRTIO_PCI_COMMON_NUMQ: -+ for (i = 0; i < VIRTIO_QUEUE_MAX; ++i) { -+ if (virtio_queue_get_num(vdev, i)) { -+ val = i + 1; -+ } -+ } -+ break; -+ case VIRTIO_PCI_COMMON_STATUS: -+ val = vdev->status; -+ break; -+ case VIRTIO_PCI_COMMON_CFGGENERATION: -+ val = 0; /* TODO */ -+ break; -+ case VIRTIO_PCI_COMMON_Q_SELECT: -+ val = vdev->queue_sel; -+ break; -+ case VIRTIO_PCI_COMMON_Q_SIZE: -+ val = virtio_queue_get_num(vdev, vdev->queue_sel); -+ break; -+ case VIRTIO_PCI_COMMON_Q_MSIX: -+ val = virtio_queue_vector(vdev, vdev->queue_sel); -+ break; -+ case VIRTIO_PCI_COMMON_Q_ENABLE: -+ val = proxy->vqs[vdev->queue_sel].enabled; -+ break; -+ case VIRTIO_PCI_COMMON_Q_NOFF: -+ /* Simply map queues in order */ -+ val = vdev->queue_sel; -+ break; -+ case VIRTIO_PCI_COMMON_Q_DESCLO: -+ val = proxy->vqs[vdev->queue_sel].desc[0]; -+ break; -+ case VIRTIO_PCI_COMMON_Q_DESCHI: -+ val = proxy->vqs[vdev->queue_sel].desc[1]; -+ break; -+ case VIRTIO_PCI_COMMON_Q_AVAILLO: -+ val = proxy->vqs[vdev->queue_sel].avail[0]; -+ break; -+ case VIRTIO_PCI_COMMON_Q_AVAILHI: -+ val = proxy->vqs[vdev->queue_sel].avail[1]; -+ break; -+ case VIRTIO_PCI_COMMON_Q_USEDLO: -+ val = proxy->vqs[vdev->queue_sel].used[0]; -+ break; -+ case VIRTIO_PCI_COMMON_Q_USEDHI: -+ val = proxy->vqs[vdev->queue_sel].used[1]; -+ break; -+ default: -+ val = 0; -+ } -+ -+ return val; -+} -+ -+static void virtio_pci_common_write(void *opaque, hwaddr addr, -+ uint64_t val, unsigned size) -+{ -+ VirtIOPCIProxy *proxy = opaque; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ -+ switch (addr) { -+ case VIRTIO_PCI_COMMON_DFSELECT: -+ proxy->dfselect = val; -+ break; -+ case VIRTIO_PCI_COMMON_GFSELECT: -+ proxy->gfselect = val; -+ break; -+ case VIRTIO_PCI_COMMON_GF: -+ if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) { -+ proxy->guest_features[proxy->gfselect] = val; -+ virtio_set_features(vdev, -+ (((uint64_t)proxy->guest_features[1]) << 32) | -+ proxy->guest_features[0]); -+ } -+ break; -+ case VIRTIO_PCI_COMMON_MSIX: -+ msix_vector_unuse(&proxy->pci_dev, vdev->config_vector); -+ /* Make it possible for guest to discover an error took place. */ -+ if (msix_vector_use(&proxy->pci_dev, val) < 0) { -+ val = VIRTIO_NO_VECTOR; -+ } -+ vdev->config_vector = val; -+ break; -+ case VIRTIO_PCI_COMMON_STATUS: -+ if (!(val & VIRTIO_CONFIG_S_DRIVER_OK)) { -+ virtio_pci_stop_ioeventfd(proxy); -+ } -+ -+ virtio_set_status(vdev, val & 0xFF); -+ -+ if (val & VIRTIO_CONFIG_S_DRIVER_OK) { -+ virtio_pci_start_ioeventfd(proxy); -+ } -+ -+ if (vdev->status == 0) { -+ virtio_reset(vdev); -+ msix_unuse_all_vectors(&proxy->pci_dev); -+ } -+ -+ break; -+ case VIRTIO_PCI_COMMON_Q_SELECT: -+ if (val < VIRTIO_QUEUE_MAX) { -+ vdev->queue_sel = val; -+ } -+ break; -+ case VIRTIO_PCI_COMMON_Q_SIZE: -+ proxy->vqs[vdev->queue_sel].num = val; -+ break; -+ case VIRTIO_PCI_COMMON_Q_MSIX: -+ msix_vector_unuse(&proxy->pci_dev, -+ virtio_queue_vector(vdev, vdev->queue_sel)); -+ /* Make it possible for guest to discover an error took place. */ -+ if (msix_vector_use(&proxy->pci_dev, val) < 0) { -+ val = VIRTIO_NO_VECTOR; -+ } -+ virtio_queue_set_vector(vdev, vdev->queue_sel, val); -+ break; -+ case VIRTIO_PCI_COMMON_Q_ENABLE: -+ /* TODO: need a way to put num back on reset. */ -+ virtio_queue_set_num(vdev, vdev->queue_sel, -+ proxy->vqs[vdev->queue_sel].num); -+ virtio_queue_set_rings(vdev, vdev->queue_sel, -+ ((uint64_t)proxy->vqs[vdev->queue_sel].desc[1]) << 32 | -+ proxy->vqs[vdev->queue_sel].desc[0], -+ ((uint64_t)proxy->vqs[vdev->queue_sel].avail[1]) << 32 | -+ proxy->vqs[vdev->queue_sel].avail[0], -+ ((uint64_t)proxy->vqs[vdev->queue_sel].used[1]) << 32 | -+ proxy->vqs[vdev->queue_sel].used[0]); -+ break; -+ case VIRTIO_PCI_COMMON_Q_DESCLO: -+ proxy->vqs[vdev->queue_sel].desc[0] = val; -+ break; -+ case VIRTIO_PCI_COMMON_Q_DESCHI: -+ proxy->vqs[vdev->queue_sel].desc[1] = val; -+ break; -+ case VIRTIO_PCI_COMMON_Q_AVAILLO: -+ proxy->vqs[vdev->queue_sel].avail[0] = val; -+ break; -+ case VIRTIO_PCI_COMMON_Q_AVAILHI: -+ proxy->vqs[vdev->queue_sel].avail[1] = val; -+ break; -+ case VIRTIO_PCI_COMMON_Q_USEDLO: -+ proxy->vqs[vdev->queue_sel].used[0] = val; -+ break; -+ case VIRTIO_PCI_COMMON_Q_USEDHI: -+ proxy->vqs[vdev->queue_sel].used[1] = val; -+ break; -+ default: -+ break; -+ } -+} -+ -+ -+static uint64_t virtio_pci_notify_read(void *opaque, hwaddr addr, -+ unsigned size) -+{ -+ return 0; -+} -+ -+static void virtio_pci_notify_write(void *opaque, hwaddr addr, -+ uint64_t val, unsigned size) -+{ -+ VirtIODevice *vdev = opaque; -+ unsigned queue = addr / QEMU_VIRTIO_PCI_QUEUE_MEM_MULT; -+ -+ if (queue < VIRTIO_QUEUE_MAX) { -+ virtio_queue_notify(vdev, queue); -+ } -+} -+ -+static uint64_t virtio_pci_isr_read(void *opaque, hwaddr addr, -+ unsigned size) -+{ -+ VirtIOPCIProxy *proxy = opaque; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ uint64_t val = vdev->isr; -+ -+ vdev->isr = 0; -+ pci_irq_deassert(&proxy->pci_dev); -+ -+ return val; -+} -+ -+static void virtio_pci_isr_write(void *opaque, hwaddr addr, -+ uint64_t val, unsigned size) -+{ -+} -+ -+static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr, -+ unsigned size) -+{ -+ VirtIODevice *vdev = opaque; -+ uint64_t val = 0; -+ -+ switch (size) { -+ case 1: -+ val = virtio_config_readb(vdev, addr); -+ break; -+ case 2: -+ val = virtio_config_readw(vdev, addr); -+ break; -+ case 4: -+ val = virtio_config_readl(vdev, addr); -+ break; -+ } -+ return val; -+} -+ -+static void virtio_pci_device_write(void *opaque, hwaddr addr, -+ uint64_t val, unsigned size) -+{ -+ VirtIODevice *vdev = opaque; -+ switch (size) { -+ case 1: -+ virtio_config_writeb(vdev, addr, val); -+ break; -+ case 2: -+ virtio_config_writew(vdev, addr, val); -+ break; -+ case 4: -+ virtio_config_writel(vdev, addr, val); -+ break; -+ } -+} -+ -+ - /* This is called by virtio-bus just after the device is plugged. */ - static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - { -@@ -938,6 +1210,112 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus)); - config[PCI_INTERRUPT_PIN] = 1; - -+ -+ if (1) { /* TODO: Make this optional, dependent on virtio 1.0 */ -+ struct virtio_pci_cap common = { -+ .cfg_type = VIRTIO_PCI_CAP_COMMON_CFG, -+ .cap_len = sizeof common, -+ .offset = cpu_to_le32(0x0), -+ .length = cpu_to_le32(0x1000), -+ }; -+ struct virtio_pci_cap isr = { -+ .cfg_type = VIRTIO_PCI_CAP_ISR_CFG, -+ .cap_len = sizeof isr, -+ .offset = cpu_to_le32(0x1000), -+ .length = cpu_to_le32(0x1000), -+ }; -+ struct virtio_pci_cap device = { -+ .cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG, -+ .cap_len = sizeof device, -+ .offset = cpu_to_le32(0x2000), -+ .length = cpu_to_le32(0x1000), -+ }; -+ struct virtio_pci_notify_cap notify = { -+ .cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG, -+ .cap.cap_len = sizeof notify, -+ .cap.offset = cpu_to_le32(0x3000), -+ .cap.length = cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -+ VIRTIO_QUEUE_MAX), -+ .notify_off_multiplier = -+ cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT), -+ }; -+ -+ static const MemoryRegionOps common_ops = { -+ .read = virtio_pci_common_read, -+ .write = virtio_pci_common_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ -+ static const MemoryRegionOps isr_ops = { -+ .read = virtio_pci_isr_read, -+ .write = virtio_pci_isr_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ -+ static const MemoryRegionOps device_ops = { -+ .read = virtio_pci_device_read, -+ .write = virtio_pci_device_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ -+ static const MemoryRegionOps notify_ops = { -+ .read = virtio_pci_notify_read, -+ .write = virtio_pci_notify_write, -+ .impl = { -+ .min_access_size = 1, -+ .max_access_size = 4, -+ }, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+ }; -+ -+ /* TODO: add io access for speed */ -+ virtio_pci_add_mem_cap(proxy, &common); -+ virtio_pci_add_mem_cap(proxy, &isr); -+ virtio_pci_add_mem_cap(proxy, &device); -+ virtio_pci_add_mem_cap(proxy, ¬ify.cap); -+ -+ virtio_add_feature(&vdev->host_features, VIRTIO_F_VERSION_1); -+ memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", -+ 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -+ VIRTIO_QUEUE_MAX); -+ memory_region_init_io(&proxy->common, OBJECT(proxy), -+ &common_ops, -+ proxy, -+ "virtio-pci-common", 0x1000); -+ memory_region_add_subregion(&proxy->modern_bar, 0, &proxy->common); -+ memory_region_init_io(&proxy->isr, OBJECT(proxy), -+ &isr_ops, -+ proxy, -+ "virtio-pci-isr", 0x1000); -+ memory_region_add_subregion(&proxy->modern_bar, 0x1000, &proxy->isr); -+ memory_region_init_io(&proxy->device, OBJECT(proxy), -+ &device_ops, -+ virtio_bus_get_device(&proxy->bus), -+ "virtio-pci-device", 0x1000); -+ memory_region_add_subregion(&proxy->modern_bar, 0x2000, &proxy->device); -+ memory_region_init_io(&proxy->notify, OBJECT(proxy), -+ ¬ify_ops, -+ virtio_bus_get_device(&proxy->bus), -+ "virtio-pci-notify", -+ QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -+ VIRTIO_QUEUE_MAX); -+ memory_region_add_subregion(&proxy->modern_bar, 0x3000, &proxy->notify); -+ pci_register_bar(&proxy->pci_dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, -+ &proxy->modern_bar); -+ } -+ - if (proxy->nvectors && - msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) { - error_report("unable to init msix vectors to %" PRIu32, -@@ -955,6 +1333,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - - memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops, - proxy, "virtio-pci", size); -+ - pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, - &proxy->bar); - -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index de39468..7a6481f 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -88,9 +88,25 @@ typedef struct VirtioPCIClass { - struct VirtIOPCIProxy { - PCIDevice pci_dev; - MemoryRegion bar; -+ MemoryRegion common; -+ MemoryRegion isr; -+ MemoryRegion device; -+ MemoryRegion notify; -+ MemoryRegion modern_bar; - uint32_t flags; - uint32_t class_code; - uint32_t nvectors; -+ uint32_t dfselect; -+ uint32_t gfselect; -+ uint32_t guest_features[2]; -+ struct { -+ uint16_t num; -+ bool enabled; -+ uint32_t desc[2]; -+ uint32_t avail[2]; -+ uint32_t used[2]; -+ } vqs[VIRTIO_QUEUE_MAX]; -+ - bool ioeventfd_disabled; - bool ioeventfd_started; - VirtIOIRQFD *vector_irqfd; --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-make-QEMU_VIRTIO_PCI_QUEUE_MEM_MULT-small.patch b/SOURCES/kvm-virtio-pci-make-QEMU_VIRTIO_PCI_QUEUE_MEM_MULT-small.patch deleted file mode 100644 index e2ebcd8..0000000 --- a/SOURCES/kvm-virtio-pci-make-QEMU_VIRTIO_PCI_QUEUE_MEM_MULT-small.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 644a67dba8127b49201d8117caaa5b44d29303f0 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:43 +0200 -Subject: [PATCH 155/217] virtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT - smaller - -Message-id: <1436260751-25015-41-git-send-email-jasowang@redhat.com> -Patchwork-id: 66815 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 40/68] virtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT smaller -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Acked-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 8aca0d75869f8ad0aa0032c50d8c85dcad65302f) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index b296b8c..5986838 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -936,7 +936,7 @@ static void virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, - cap->cap_len - PCI_CAP_FLAGS); - } - --#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x10000 -+#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000 - - static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, - unsigned size) --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-make-modern-bar-64bit-prefetchable.patch b/SOURCES/kvm-virtio-pci-make-modern-bar-64bit-prefetchable.patch deleted file mode 100644 index 65f4cd0..0000000 --- a/SOURCES/kvm-virtio-pci-make-modern-bar-64bit-prefetchable.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c4e18f9fe7f7b05a2e48d8bb78a3579df4e9feeb Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:45 +0200 -Subject: [PATCH 157/217] virtio-pci: make modern bar 64bit + prefetchable - -Message-id: <1436260751-25015-43-git-send-email-jasowang@redhat.com> -Patchwork-id: 66817 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 42/68] virtio-pci: make modern bar 64bit + prefetchable -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 4e93a68eb369b2f7adbef7a4f6afd7a30a0ed927) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 1d6c10b..4d80716 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1344,7 +1344,9 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - VIRTIO_QUEUE_MAX); - memory_region_add_subregion(&proxy->modern_bar, 0x3000, &proxy->notify); - pci_register_bar(&proxy->pci_dev, modern_mem_bar, -- PCI_BASE_ADDRESS_SPACE_MEMORY, -+ PCI_BASE_ADDRESS_SPACE_MEMORY | -+ PCI_BASE_ADDRESS_MEM_PREFETCH | -+ PCI_BASE_ADDRESS_MEM_TYPE_64, - &proxy->modern_bar); - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-move-cap-type-to-VirtIOPCIRegion.patch b/SOURCES/kvm-virtio-pci-move-cap-type-to-VirtIOPCIRegion.patch deleted file mode 100644 index b1423a4..0000000 --- a/SOURCES/kvm-virtio-pci-move-cap-type-to-VirtIOPCIRegion.patch +++ /dev/null @@ -1,106 +0,0 @@ -From c1d5cc4e999d3e5e4e399445401b516042e0264c Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:53 +0200 -Subject: [PATCH 165/217] virtio-pci: move cap type to VirtIOPCIRegion - -Message-id: <1436260751-25015-51-git-send-email-jasowang@redhat.com> -Patchwork-id: 66824 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 50/68] virtio-pci: move cap type to VirtIOPCIRegion -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit fc004905c5b4b7568aad50087c156a5f4dfae1a7) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 9 +++++---- - hw/virtio/virtio-pci.h | 1 + - 2 files changed, 6 insertions(+), 4 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 3b61b21..9c509e0 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1252,18 +1252,21 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) - proxy, - "virtio-pci-common", 0x1000); - proxy->common.offset = 0x0; -+ proxy->common.type = VIRTIO_PCI_CAP_COMMON_CFG; - - memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), - &isr_ops, - proxy, - "virtio-pci-isr", 0x1000); - proxy->isr.offset = 0x1000; -+ proxy->isr.type = VIRTIO_PCI_CAP_ISR_CFG; - - memory_region_init_io(&proxy->device.mr, OBJECT(proxy), - &device_ops, - virtio_bus_get_device(&proxy->bus), - "virtio-pci-device", 0x1000); - proxy->device.offset = 0x2000; -+ proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG; - - memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), - ¬ify_ops, -@@ -1272,6 +1275,7 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) - QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); - proxy->notify.offset = 0x3000; -+ proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG; - } - - static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, -@@ -1282,6 +1286,7 @@ static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, - region->offset, - ®ion->mr); - -+ cap->cfg_type = region->type; - cap->offset = cpu_to_le32(region->offset); - cap->length = cpu_to_le32(memory_region_size(®ion->mr)); - virtio_pci_add_mem_cap(proxy, cap); -@@ -1337,22 +1342,18 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - - if (modern) { - struct virtio_pci_cap common = { -- .cfg_type = VIRTIO_PCI_CAP_COMMON_CFG, - .cap_len = sizeof common, - .bar = modern_mem_bar, - }; - struct virtio_pci_cap isr = { -- .cfg_type = VIRTIO_PCI_CAP_ISR_CFG, - .cap_len = sizeof isr, - .bar = modern_mem_bar, - }; - struct virtio_pci_cap device = { -- .cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG, - .cap_len = sizeof device, - .bar = modern_mem_bar, - }; - struct virtio_pci_notify_cap notify = { -- .cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG, - .cap.cap_len = sizeof notify, - .cap.bar = modern_mem_bar, - .notify_off_multiplier = -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index f5829b0..ea1343d 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -94,6 +94,7 @@ typedef struct VirtioPCIClass { - typedef struct VirtIOPCIRegion { - MemoryRegion mr; - uint32_t offset; -+ uint32_t type; - } VirtIOPCIRegion; - - struct VirtIOPCIProxy { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-move-virtio_pci_add_mem_cap-call-to-virti.patch b/SOURCES/kvm-virtio-pci-move-virtio_pci_add_mem_cap-call-to-virti.patch deleted file mode 100644 index 4895cc5..0000000 --- a/SOURCES/kvm-virtio-pci-move-virtio_pci_add_mem_cap-call-to-virti.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0d6061a30d985750952fd159bfdea03386601ee5 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:52 +0200 -Subject: [PATCH 164/217] virtio-pci: move virtio_pci_add_mem_cap call to - virtio_pci_modern_region_map - -Message-id: <1436260751-25015-50-git-send-email-jasowang@redhat.com> -Patchwork-id: 66823 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 49/68] virtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Gerd Hoffmann <kraxel@redhat.com> - -Also fill offset and length automatically, -from VirtIOPCIRegion->offset and region size. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 54790d71e4adcfaae95dac3c7019b10721e609de) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 28 ++++++++++------------------ - 1 file changed, 10 insertions(+), 18 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 415660a..3b61b21 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1275,11 +1275,16 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) - } - - static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, -- VirtIOPCIRegion *region) -+ VirtIOPCIRegion *region, -+ struct virtio_pci_cap *cap) - { - memory_region_add_subregion(&proxy->modern_bar, - region->offset, - ®ion->mr); -+ -+ cap->offset = cpu_to_le32(region->offset); -+ cap->length = cpu_to_le32(memory_region_size(®ion->mr)); -+ virtio_pci_add_mem_cap(proxy, cap); - } - - /* This is called by virtio-bus just after the device is plugged. */ -@@ -1335,49 +1340,36 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) - .cfg_type = VIRTIO_PCI_CAP_COMMON_CFG, - .cap_len = sizeof common, - .bar = modern_mem_bar, -- .offset = cpu_to_le32(0x0), -- .length = cpu_to_le32(0x1000), - }; - struct virtio_pci_cap isr = { - .cfg_type = VIRTIO_PCI_CAP_ISR_CFG, - .cap_len = sizeof isr, - .bar = modern_mem_bar, -- .offset = cpu_to_le32(0x1000), -- .length = cpu_to_le32(0x1000), - }; - struct virtio_pci_cap device = { - .cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG, - .cap_len = sizeof device, - .bar = modern_mem_bar, -- .offset = cpu_to_le32(0x2000), -- .length = cpu_to_le32(0x1000), - }; - struct virtio_pci_notify_cap notify = { - .cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG, - .cap.cap_len = sizeof notify, - .cap.bar = modern_mem_bar, -- .cap.offset = cpu_to_le32(0x3000), -- .cap.length = cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * -- VIRTIO_QUEUE_MAX), - .notify_off_multiplier = - cpu_to_le32(QEMU_VIRTIO_PCI_QUEUE_MEM_MULT), - }; - - /* TODO: add io access for speed */ -- virtio_pci_add_mem_cap(proxy, &common); -- virtio_pci_add_mem_cap(proxy, &isr); -- virtio_pci_add_mem_cap(proxy, &device); -- virtio_pci_add_mem_cap(proxy, ¬ify.cap); - - virtio_add_feature(&vdev->host_features, VIRTIO_F_VERSION_1); - memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", - 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * - VIRTIO_QUEUE_MAX); - virtio_pci_modern_regions_init(proxy); -- virtio_pci_modern_region_map(proxy, &proxy->common); -- virtio_pci_modern_region_map(proxy, &proxy->isr); -- virtio_pci_modern_region_map(proxy, &proxy->device); -- virtio_pci_modern_region_map(proxy, &proxy->notify); -+ virtio_pci_modern_region_map(proxy, &proxy->common, &common); -+ virtio_pci_modern_region_map(proxy, &proxy->isr, &isr); -+ virtio_pci_modern_region_map(proxy, &proxy->device, &device); -+ virtio_pci_modern_region_map(proxy, &proxy->notify, ¬ify.cap); - pci_register_bar(&proxy->pci_dev, modern_mem_bar, - PCI_BASE_ADDRESS_SPACE_MEMORY | - PCI_BASE_ADDRESS_MEM_PREFETCH | --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-speedup-MSI-X-masking-and-unmasking.patch b/SOURCES/kvm-virtio-pci-speedup-MSI-X-masking-and-unmasking.patch deleted file mode 100644 index ac7d40b..0000000 --- a/SOURCES/kvm-virtio-pci-speedup-MSI-X-masking-and-unmasking.patch +++ /dev/null @@ -1,114 +0,0 @@ -From faa5a68c3133624759bc7e36714fd6629bcd00d8 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:45 +0200 -Subject: [PATCH 024/217] virtio-pci: speedup MSI-X masking and unmasking - -Message-id: <1434607916-15166-10-git-send-email-jasowang@redhat.com> -Patchwork-id: 66307 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 09/20] virtio-pci: speedup MSI-X masking and unmasking -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -This patch tries to speed up the MSI-X masking and unmasking through -the mapping between vector and queues. With this patch it will there's -no need to go through all possible virtqueues, which may help to -reduce the time spent when doing MSI-X masking/unmasking a single -vector when more than hundreds or even thousands of virtqueues were -supported. - -Tested with 80 queue pairs virito-net-pci by changing the smp affinity -in the background and doing netperf in the same time: - -Before the patch: -5711.70 Gbits/sec -After the patch: -6830.98 Gbits/sec - -About 19.6% improvements in throughput. - -Cc: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 851c2a75a6e80c8aa5e713864d98cfb512e7229b) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 40 +++++++++++++++++++++------------------- - 1 file changed, 21 insertions(+), 19 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 6b064b9..b91e799 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -630,28 +630,30 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector, - { - VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -- int ret, queue_no; -+ VirtQueue *vq = virtio_vector_first_queue(vdev, vector); -+ int ret, index, unmasked = 0; - -- for (queue_no = 0; queue_no < proxy->nvqs_with_notifiers; queue_no++) { -- if (!virtio_queue_get_num(vdev, queue_no)) { -+ while (vq) { -+ index = virtio_get_queue_index(vq); -+ if (!virtio_queue_get_num(vdev, index)) { - break; - } -- if (virtio_queue_vector(vdev, queue_no) != vector) { -- continue; -- } -- ret = virtio_pci_vq_vector_unmask(proxy, queue_no, vector, msg); -+ ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg); - if (ret < 0) { - goto undo; - } -+ vq = virtio_vector_next_queue(vq); -+ ++unmasked; - } -+ - return 0; - - undo: -- while (--queue_no >= 0) { -- if (virtio_queue_vector(vdev, queue_no) != vector) { -- continue; -- } -- virtio_pci_vq_vector_mask(proxy, queue_no, vector); -+ vq = virtio_vector_first_queue(vdev, vector); -+ while (vq && --unmasked >= 0) { -+ index = virtio_get_queue_index(vq); -+ virtio_pci_vq_vector_mask(proxy, index, vector); -+ vq = virtio_vector_next_queue(vq); - } - return ret; - } -@@ -660,16 +662,16 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector) - { - VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -- int queue_no; -+ VirtQueue *vq = virtio_vector_first_queue(vdev, vector); -+ int index; - -- for (queue_no = 0; queue_no < proxy->nvqs_with_notifiers; queue_no++) { -- if (!virtio_queue_get_num(vdev, queue_no)) { -+ while (vq) { -+ index = virtio_get_queue_index(vq); -+ if (!virtio_queue_get_num(vdev, index)) { - break; - } -- if (virtio_queue_vector(vdev, queue_no) != vector) { -- continue; -- } -- virtio_pci_vq_vector_mask(proxy, queue_no, vector); -+ virtio_pci_vq_vector_mask(proxy, index, vector); -+ vq = virtio_vector_next_queue(vq); - } - } - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-pci-switch-to-modern-accessors-for-1.0.patch b/SOURCES/kvm-virtio-pci-switch-to-modern-accessors-for-1.0.patch deleted file mode 100644 index 5e26b5d..0000000 --- a/SOURCES/kvm-virtio-pci-switch-to-modern-accessors-for-1.0.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 55c12f2f8fc87cb1ab7c867310c8ff520793d06b Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:41 +0200 -Subject: [PATCH 153/217] virtio-pci: switch to modern accessors for 1.0 - -Message-id: <1436260751-25015-39-git-send-email-jasowang@redhat.com> -Patchwork-id: 66813 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 38/68] virtio-pci: switch to modern accessors for 1.0 -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -virtio 1.0 config space is in LE format for all -devices, use modern wrappers when accessed through -the 1.0 BAR. - -Reported-by: Rusty Russell <rusty@rustcorp.com.au> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit 54c720d49d3f9741b52ac95c65a5cc990254a5d8) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-pci.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index a41ceee..455b90f 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1162,13 +1162,13 @@ static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr, - - switch (size) { - case 1: -- val = virtio_config_readb(vdev, addr); -+ val = virtio_config_modern_readb(vdev, addr); - break; - case 2: -- val = virtio_config_readw(vdev, addr); -+ val = virtio_config_modern_readw(vdev, addr); - break; - case 4: -- val = virtio_config_readl(vdev, addr); -+ val = virtio_config_modern_readl(vdev, addr); - break; - } - return val; -@@ -1180,13 +1180,13 @@ static void virtio_pci_device_write(void *opaque, hwaddr addr, - VirtIODevice *vdev = opaque; - switch (size) { - case 1: -- virtio_config_writeb(vdev, addr, val); -+ virtio_config_modern_writeb(vdev, addr, val); - break; - case 2: -- virtio_config_writew(vdev, addr, val); -+ virtio_config_modern_writew(vdev, addr, val); - break; - case 4: -- virtio_config_writel(vdev, addr, val); -+ virtio_config_modern_writel(vdev, addr, val); - break; - } - } --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-rename-VIRTIO_PCI_QUEUE_MAX-to-VIRTIO_QUEUE_M.patch b/SOURCES/kvm-virtio-rename-VIRTIO_PCI_QUEUE_MAX-to-VIRTIO_QUEUE_M.patch deleted file mode 100644 index c85afbe..0000000 --- a/SOURCES/kvm-virtio-rename-VIRTIO_PCI_QUEUE_MAX-to-VIRTIO_QUEUE_M.patch +++ /dev/null @@ -1,292 +0,0 @@ -From 42b4baecfc41f45a5ce2ecb211e5351ead45264c Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:54 +0200 -Subject: [PATCH 033/217] virtio: rename VIRTIO_PCI_QUEUE_MAX to - VIRTIO_QUEUE_MAX - -Message-id: <1434607916-15166-19-git-send-email-jasowang@redhat.com> -Patchwork-id: 66317 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 18/20] virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Notes: conflicts since commit 631b22ea206300f09b9d1bb9249169e0f0092639 - ("misc: Fix new collection of typos"). Fix by squashing the - typo fixes for virtio-net in this patch. - -VIRTIO_PCI_QUEUE_MAX is not only used for pci, so rename it be generic. - -Cc: Amit Shah <amit.shah@redhat.com> -Cc: Paolo Bonzini <pbonzini@redhat.com> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 87b3bd1c858e6cacac4d403da9109ec3a04fe9d0) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/net/virtio-net.c ---- - hw/char/virtio-serial-bus.c | 2 +- - hw/net/virtio-net.c | 6 +++--- - hw/scsi/virtio-scsi.c | 4 ++-- - hw/virtio/virtio-mmio.c | 4 ++-- - hw/virtio/virtio-pci.c | 10 +++++----- - hw/virtio/virtio.c | 28 ++++++++++++++-------------- - include/hw/virtio/virtio.h | 2 +- - 7 files changed, 28 insertions(+), 28 deletions(-) - -diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c -index e336bdb..4e6154b 100644 ---- a/hw/char/virtio-serial-bus.c -+++ b/hw/char/virtio-serial-bus.c -@@ -973,7 +973,7 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp) - } - - /* Each port takes 2 queues, and one pair is for the control queue */ -- max_supported_ports = VIRTIO_PCI_QUEUE_MAX / 2 - 1; -+ max_supported_ports = VIRTIO_QUEUE_MAX / 2 - 1; - - if (vser->serial.max_virtserial_ports > max_supported_ports) { - error_setg(errp, "maximum ports supported: %u", max_supported_ports); -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index ccf5a78..4859b1c 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -1557,10 +1557,10 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) - virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); - - n->max_queues = MAX(n->nic_conf.peers.queues, 1); -- if (n->max_queues * 2 + 1 > VIRTIO_PCI_QUEUE_MAX) { -+ if (n->max_queues * 2 + 1 > VIRTIO_QUEUE_MAX) { - error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " -- "must be a postive integer less than %d.", -- n->max_queues, (VIRTIO_PCI_QUEUE_MAX - 1) / 2); -+ "must be a positive integer less than %d.", -+ n->max_queues, (VIRTIO_QUEUE_MAX - 1) / 2); - virtio_cleanup(vdev); - return; - } -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index c9bea06..13a272a 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -826,10 +826,10 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp, - sizeof(VirtIOSCSIConfig)); - - if (s->conf.num_queues == 0 || -- s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX - 2) { -+ s->conf.num_queues > VIRTIO_QUEUE_MAX - 2) { - error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " - "must be a positive integer less than %d.", -- s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX - 2); -+ s->conf.num_queues, VIRTIO_QUEUE_MAX - 2); - virtio_cleanup(vdev); - return; - } -diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c -index dd3f80b..bd2ee26 100644 ---- a/hw/virtio/virtio-mmio.c -+++ b/hw/virtio/virtio-mmio.c -@@ -237,7 +237,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, - proxy->guest_page_shift); - break; - case VIRTIO_MMIO_QUEUESEL: -- if (value < VIRTIO_PCI_QUEUE_MAX) { -+ if (value < VIRTIO_QUEUE_MAX) { - vdev->queue_sel = value; - } - break; -@@ -257,7 +257,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, - } - break; - case VIRTIO_MMIO_QUEUENOTIFY: -- if (value < VIRTIO_PCI_QUEUE_MAX) { -+ if (value < VIRTIO_QUEUE_MAX) { - virtio_queue_notify(vdev, value); - } - break; -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 96d54f1..625bf25 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -171,7 +171,7 @@ static void virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) - return; - } - -- for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -+ for (n = 0; n < VIRTIO_QUEUE_MAX; n++) { - if (!virtio_queue_get_num(vdev, n)) { - continue; - } -@@ -207,7 +207,7 @@ static void virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy) - return; - } - -- for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -+ for (n = 0; n < VIRTIO_QUEUE_MAX; n++) { - if (!virtio_queue_get_num(vdev, n)) { - continue; - } -@@ -243,11 +243,11 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) - virtio_queue_set_addr(vdev, vdev->queue_sel, pa); - break; - case VIRTIO_PCI_QUEUE_SEL: -- if (val < VIRTIO_PCI_QUEUE_MAX) -+ if (val < VIRTIO_QUEUE_MAX) - vdev->queue_sel = val; - break; - case VIRTIO_PCI_QUEUE_NOTIFY: -- if (val < VIRTIO_PCI_QUEUE_MAX) { -+ if (val < VIRTIO_QUEUE_MAX) { - virtio_queue_notify(vdev, val); - } - break; -@@ -750,7 +750,7 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign) - bool with_irqfd = msix_enabled(&proxy->pci_dev) && - kvm_msi_via_irqfd_enabled(); - -- nvqs = MIN(nvqs, VIRTIO_PCI_QUEUE_MAX); -+ nvqs = MIN(nvqs, VIRTIO_QUEUE_MAX); - - /* When deassigning, pass a consistent nvqs value - * to avoid leaking notifiers. -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 81d8905..7092aa5 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -600,7 +600,7 @@ void virtio_reset(void *opaque) - vdev->config_vector = VIRTIO_NO_VECTOR; - virtio_notify_vector(vdev, vdev->config_vector); - -- for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for(i = 0; i < VIRTIO_QUEUE_MAX; i++) { - vdev->vq[i].vring.desc = 0; - vdev->vq[i].vring.avail = 0; - vdev->vq[i].vring.used = 0; -@@ -750,7 +750,7 @@ int virtio_get_num_queues(VirtIODevice *vdev) - { - int i; - -- for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - if (!virtio_queue_get_num(vdev, i)) { - break; - } -@@ -762,7 +762,7 @@ int virtio_get_num_queues(VirtIODevice *vdev) - int virtio_queue_get_id(VirtQueue *vq) - { - VirtIODevice *vdev = vq->vdev; -- assert(vq >= &vdev->vq[0] && vq < &vdev->vq[VIRTIO_PCI_QUEUE_MAX]); -+ assert(vq >= &vdev->vq[0] && vq < &vdev->vq[VIRTIO_QUEUE_MAX]); - return vq - &vdev->vq[0]; - } - -@@ -798,7 +798,7 @@ void virtio_queue_notify(VirtIODevice *vdev, int n) - - uint16_t virtio_queue_vector(VirtIODevice *vdev, int n) - { -- return n < VIRTIO_PCI_QUEUE_MAX ? vdev->vq[n].vector : -+ return n < VIRTIO_QUEUE_MAX ? vdev->vq[n].vector : - VIRTIO_NO_VECTOR; - } - -@@ -806,7 +806,7 @@ void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector) - { - VirtQueue *vq = &vdev->vq[n]; - -- if (n < VIRTIO_PCI_QUEUE_MAX) { -+ if (n < VIRTIO_QUEUE_MAX) { - if (vdev->vector_queues && - vdev->vq[n].vector != VIRTIO_NO_VECTOR) { - QLIST_REMOVE(vq, node); -@@ -824,12 +824,12 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, - { - int i; - -- for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - if (vdev->vq[i].vring.num == 0) - break; - } - -- if (i == VIRTIO_PCI_QUEUE_MAX || queue_size > VIRTQUEUE_MAX_SIZE) -+ if (i == VIRTIO_QUEUE_MAX || queue_size > VIRTQUEUE_MAX_SIZE) - abort(); - - vdev->vq[i].vring.num = queue_size; -@@ -841,7 +841,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, - - void virtio_del_queue(VirtIODevice *vdev, int n) - { -- if (n < 0 || n >= VIRTIO_PCI_QUEUE_MAX) { -+ if (n < 0 || n >= VIRTIO_QUEUE_MAX) { - abort(); - } - -@@ -951,14 +951,14 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) - qemu_put_be32(f, vdev->config_len); - qemu_put_buffer(f, vdev->config, vdev->config_len); - -- for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - if (vdev->vq[i].vring.num == 0) - break; - } - - qemu_put_be32(f, i); - -- for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - if (vdev->vq[i].vring.num == 0) - break; - -@@ -1023,7 +1023,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - qemu_get_8s(f, &vdev->status); - qemu_get_8s(f, &vdev->isr); - qemu_get_be16s(f, &vdev->queue_sel); -- if (vdev->queue_sel >= VIRTIO_PCI_QUEUE_MAX) { -+ if (vdev->queue_sel >= VIRTIO_QUEUE_MAX) { - return -1; - } - qemu_get_be32s(f, &features); -@@ -1050,7 +1050,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - - num = qemu_get_be32(f); - -- if (num > VIRTIO_PCI_QUEUE_MAX) { -+ if (num > VIRTIO_QUEUE_MAX) { - error_report("Invalid number of PCI queues: 0x%x", num); - return -1; - } -@@ -1176,9 +1176,9 @@ void virtio_init(VirtIODevice *vdev, const char *name, - vdev->isr = 0; - vdev->queue_sel = 0; - vdev->config_vector = VIRTIO_NO_VECTOR; -- vdev->vq = g_malloc0(sizeof(VirtQueue) * VIRTIO_PCI_QUEUE_MAX); -+ vdev->vq = g_malloc0(sizeof(VirtQueue) * VIRTIO_QUEUE_MAX); - vdev->vm_running = runstate_is_running(); -- for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - vdev->vq[i].vector = VIRTIO_NO_VECTOR; - vdev->vq[i].vdev = vdev; - vdev->vq[i].queue_index = i; -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 6f49108..a9e22af 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -48,7 +48,7 @@ typedef struct VirtQueueElement - struct iovec out_sg[VIRTQUEUE_MAX_SIZE]; - } VirtQueueElement; - --#define VIRTIO_PCI_QUEUE_MAX 64 -+#define VIRTIO_QUEUE_MAX 64 - - #define VIRTIO_NO_VECTOR 0xffff - --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-rng-move-qdev-properties-into-virtio-rng.c.patch b/SOURCES/kvm-virtio-rng-move-qdev-properties-into-virtio-rng.c.patch deleted file mode 100644 index 19d535f..0000000 --- a/SOURCES/kvm-virtio-rng-move-qdev-properties-into-virtio-rng.c.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 3950a8610d84ecebc2443ff67cbf7023233eaaed Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:02 +0200 -Subject: [PATCH 174/217] virtio-rng: move qdev properties into virtio-rng.c - -Message-id: <1436260751-25015-60-git-send-email-jasowang@redhat.com> -Patchwork-id: 66833 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 59/68] virtio-rng: move qdev properties into virtio-rng.c -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -As only one place in virtio-rng.c uses DEFINE_VIRTIO_RNG_PROPERTIES, -there is no need to expose it. Inline it into virtio-rng.c to avoid -wrongly use. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit fe704809b974d8dd8e020b4d3f48ede338a886fe) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/virtio/virtio-rng.c | 8 +++++++- - include/hw/virtio/virtio-rng.h | 10 ---------- - 2 files changed, 7 insertions(+), 11 deletions(-) - -diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c -index 420c39f..22b1d87 100644 ---- a/hw/virtio/virtio-rng.c -+++ b/hw/virtio/virtio-rng.c -@@ -219,7 +219,13 @@ static void virtio_rng_device_unrealize(DeviceState *dev, Error **errp) - } - - static Property virtio_rng_properties[] = { -- DEFINE_VIRTIO_RNG_PROPERTIES(VirtIORNG, conf), -+ /* Set a default rate limit of 2^47 bytes per minute or roughly 2TB/s. If -+ * you have an entropy source capable of generating more entropy than this -+ * and you can pass it through via virtio-rng, then hats off to you. Until -+ * then, this is unlimited for all practical purposes. -+ */ -+ DEFINE_PROP_UINT64("max-bytes", VirtIORNG, conf.max_bytes, INT64_MAX), -+ DEFINE_PROP_UINT32("period", VirtIORNG, conf.period_ms, 1 << 16), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h -index 7702ff4..0316488 100644 ---- a/include/hw/virtio/virtio-rng.h -+++ b/include/hw/virtio/virtio-rng.h -@@ -46,14 +46,4 @@ typedef struct VirtIORNG { - int64_t quota_remaining; - } VirtIORNG; - --/* Set a default rate limit of 2^47 bytes per minute or roughly 2TB/s. If -- you have an entropy source capable of generating more entropy than this -- and you can pass it through via virtio-rng, then hats off to you. Until -- then, this is unlimited for all practical purposes. --*/ --#define DEFINE_VIRTIO_RNG_PROPERTIES(_state, _conf_field) \ -- DEFINE_PROP_UINT64("max-bytes", _state, _conf_field.max_bytes, \ -- INT64_MAX), \ -- DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 1 << 16) -- - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-s390-introduce-virito-s390-queue-limit.patch b/SOURCES/kvm-virtio-s390-introduce-virito-s390-queue-limit.patch deleted file mode 100644 index 0b3bfe2..0000000 --- a/SOURCES/kvm-virtio-s390-introduce-virito-s390-queue-limit.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 99841221bdfe8d32bd05edfb338ce1286c0c92eb Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:52 +0200 -Subject: [PATCH 031/217] virtio-s390: introduce virito s390 queue limit - -Message-id: <1434607916-15166-17-git-send-email-jasowang@redhat.com> -Patchwork-id: 66314 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 16/20] virtio-s390: introduce virito s390 queue limit -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Cc: Alexander Graf <agraf@suse.de> -Cc: Richard Henderson <rth@twiddle.net> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 74c85296dc880568005b8e7572e08a39d66bcdca) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/s390-virtio-bus.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index 047c963..34d0708 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -45,6 +45,8 @@ - do { } while (0) - #endif - -+#define VIRTIO_S390_QUEUE_MAX 64 -+ - static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size, - VirtIOS390Device *dev); - -@@ -344,7 +346,7 @@ static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev) - VirtIODevice *vdev = dev->vdev; - int num_vq; - -- for (num_vq = 0; num_vq < VIRTIO_PCI_QUEUE_MAX; num_vq++) { -+ for (num_vq = 0; num_vq < VIRTIO_S390_QUEUE_MAX; num_vq++) { - if (!virtio_queue_get_num(vdev, num_vq)) { - break; - } -@@ -446,7 +448,7 @@ VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus, - QTAILQ_FOREACH(kid, &bus->bus.children, sibling) { - VirtIOS390Device *dev = (VirtIOS390Device *)kid->child; - -- for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { -+ for (i = 0; i < VIRTIO_S390_QUEUE_MAX; i++) { - if (!virtio_queue_get_addr(dev->vdev, i)) - break; - if (virtio_queue_get_addr(dev->vdev, i) == mem) { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-s390-introduce-virtio_s390_device_plugged.patch b/SOURCES/kvm-virtio-s390-introduce-virtio_s390_device_plugged.patch deleted file mode 100644 index f883660..0000000 --- a/SOURCES/kvm-virtio-s390-introduce-virtio_s390_device_plugged.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0e1e2d27a636cde1b68d1fced31ecec49b5e5863 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Thu, 18 Jun 2015 06:11:53 +0200 -Subject: [PATCH 032/217] virtio-s390: introduce virtio_s390_device_plugged() - -Message-id: <1434607916-15166-18-git-send-email-jasowang@redhat.com> -Patchwork-id: 66316 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 17/20] virtio-s390: introduce virtio_s390_device_plugged() -Bugzilla: 1231610 -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com> -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> - -Notes: conflicts since commit 6b8f1020540c27246277377aa2c3331ad2bfb160 - ("virtio: move host_features") was not backpoted, so - get_features still exists in virito-s390. - -This patch introduce a virtio-s390 specific device_plugged() function -and doing the number of virtqueue validation inside. - -Cc: Alexander Graf <agraf@suse.de> -Cc: Richard Henderson <rth@twiddle.net> -Signed-off-by: Jason Wang <jasowang@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit d820331a0b47cbbdc409b435545aea25e19b57ad) -Signed-off-by: Jason Wang <jasowang@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> - -Conflicts: - hw/s390x/s390-virtio-bus.c ---- - hw/s390x/s390-virtio-bus.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index 34d0708..8017ecc 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -506,6 +506,19 @@ static unsigned virtio_s390_get_features(DeviceState *d) - return dev->host_features; - } - -+static void virtio_s390_device_plugged(DeviceState *d, Error **errp) -+{ -+ VirtIOS390Device *dev = to_virtio_s390_device(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); -+ int n = virtio_get_num_queues(vdev); -+ -+ if (n > VIRTIO_S390_QUEUE_MAX) { -+ error_setg(errp, "The nubmer of virtqueues %d " -+ "exceeds s390 limit %d", n, -+ VIRTIO_S390_QUEUE_MAX); -+ } -+} -+ - /**************** S390 Virtio Bus Device Descriptions *******************/ - - static Property s390_virtio_net_properties[] = { -@@ -717,6 +730,7 @@ static void virtio_s390_bus_class_init(ObjectClass *klass, void *data) - bus_class->max_dev = 1; - k->notify = virtio_s390_notify; - k->get_features = virtio_s390_get_features; -+ k->device_plugged = virtio_s390_device_plugged; - } - - static const TypeInfo virtio_s390_bus_info = { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-scsi-Move-DEFINE_VIRTIO_SCSI_FEATURES-to-virt.patch b/SOURCES/kvm-virtio-scsi-Move-DEFINE_VIRTIO_SCSI_FEATURES-to-virt.patch deleted file mode 100644 index 16110a0..0000000 --- a/SOURCES/kvm-virtio-scsi-Move-DEFINE_VIRTIO_SCSI_FEATURES-to-virt.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 6bed4d049afeb569fe7f4d387aa9d67ce00c6380 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:09 +0200 -Subject: [PATCH 121/217] virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to - virtio-scsi - -Message-id: <1436260751-25015-7-git-send-email-jasowang@redhat.com> -Patchwork-id: 66781 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 06/68] virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to virtio-scsi -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -So far virtio-scsi-device can't expose host features to guest while -using virtio-mmio because it doesn't set DEFINE_VIRTIO_SCSI_FEATURES on -backend or transport. - -The host features belong to the backends while virtio-scsi-pci, -virtio-scsi-s390 and virtio-scsi-ccw set the DEFINE_VIRTIO_SCSI_FEATURES -on transports. But they already have the ability to forward property -accesses to the backend child. So if we move the host features to -backends, it doesn't break the backwards compatibility for them and -make host features work while using virtio-mmio. - -Move DEFINE_VIRTIO_SCSI_FEATURES to the backend virtio-scsi. The -transports just sync the host features from backends. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Peter Maydell <peter.maydell@linaro.org> -(cherry picked from commit da2f84d1270d203027d82f778d5bcc1f7a49bab0) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/s390x/s390-virtio-bus.c | 1 - - hw/s390x/virtio-ccw.c | 1 - - hw/scsi/virtio-scsi.c | 5 +++++ - hw/virtio/virtio-pci.c | 1 - - include/hw/virtio/virtio-scsi.h | 1 + - 5 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c -index 118ad21..04ed89f 100644 ---- a/hw/s390x/s390-virtio-bus.c -+++ b/hw/s390x/s390-virtio-bus.c -@@ -637,7 +637,6 @@ static const TypeInfo virtio_s390_device_info = { - - static Property s390_virtio_scsi_properties[] = { - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), -- DEFINE_VIRTIO_SCSI_FEATURES(VirtIOS390Device, host_features), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index 083da1a..e15e2b3 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -1522,7 +1522,6 @@ static const TypeInfo virtio_ccw_balloon = { - - static Property virtio_ccw_scsi_properties[] = { - DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id), -- DEFINE_VIRTIO_SCSI_FEATURES(VirtioCcwDevice, host_features[0]), - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_END_OF_LIST(), -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index 13a272a..5818159 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -631,6 +631,10 @@ static void virtio_scsi_set_config(VirtIODevice *vdev, - static uint32_t virtio_scsi_get_features(VirtIODevice *vdev, - uint32_t requested_features) - { -+ VirtIOSCSI *s = VIRTIO_SCSI(vdev); -+ -+ /* Firstly sync all virtio-scsi possible supported features */ -+ requested_features |= s->host_features; - return requested_features; - } - -@@ -945,6 +949,7 @@ static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp) - - static Property virtio_scsi_properties[] = { - DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOSCSI, parent_obj.conf), -+ DEFINE_VIRTIO_SCSI_FEATURES(VirtIOSCSI, host_features), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 05e9afd..2f1e03f 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1094,7 +1094,6 @@ static Property virtio_scsi_pci_properties[] = { - VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, - DEV_NVECTORS_UNSPECIFIED), -- DEFINE_VIRTIO_SCSI_FEATURES(VirtIOPCIProxy, host_features), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index f93b57d..b42e7f1 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -98,6 +98,7 @@ typedef struct VirtIOSCSI { - bool dataplane_fenced; - Error *blocker; - Notifier migration_state_notifier; -+ uint32_t host_features; - } VirtIOSCSI; - - typedef struct VirtIOSCSIReq { --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-scsi-move-qdev-properties-into-virtio-scsi.c.patch b/SOURCES/kvm-virtio-scsi-move-qdev-properties-into-virtio-scsi.c.patch deleted file mode 100644 index ab7d73a..0000000 --- a/SOURCES/kvm-virtio-scsi-move-qdev-properties-into-virtio-scsi.c.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 458e690ea8ea6657f8cd56758ce7140731dea5f6 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:01 +0200 -Subject: [PATCH 173/217] virtio-scsi: move qdev properties into virtio-scsi.c - -Message-id: <1436260751-25015-59-git-send-email-jasowang@redhat.com> -Patchwork-id: 66834 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 58/68] virtio-scsi: move qdev properties into virtio-scsi.c -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -As only one place in virtio-scsi.c uses DEFINE_VIRTIO_SCSI_PROPERTIES -and DEFINE_VIRTIO_SCSI_FEATURES, there is no need to expose them. Inline -them into virtio-scsi.c to avoid wrongly use. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 0c63237a90f37fffe8a8016f24f61bb228653e86) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/scsi/virtio-scsi.c | 13 +++++++++++-- - include/hw/virtio/virtio-scsi.h | 13 ------------- - 2 files changed, 11 insertions(+), 15 deletions(-) - -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index b0dee29..f7d3c7c 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -948,8 +948,17 @@ static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp) - } - - static Property virtio_scsi_properties[] = { -- DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOSCSI, parent_obj.conf), -- DEFINE_VIRTIO_SCSI_FEATURES(VirtIOSCSI, host_features), -+ DEFINE_PROP_UINT32("num_queues", VirtIOSCSI, parent_obj.conf.num_queues, 1), -+ DEFINE_PROP_UINT32("max_sectors", VirtIOSCSI, parent_obj.conf.max_sectors, -+ 0xFFFF), -+ DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSI, parent_obj.conf.cmd_per_lun, -+ 128), -+ DEFINE_PROP_BIT("any_layout", VirtIOSCSI, host_features, -+ VIRTIO_F_ANY_LAYOUT, true), -+ DEFINE_PROP_BIT("hotplug", VirtIOSCSI, host_features, -+ VIRTIO_SCSI_F_HOTPLUG, true), -+ DEFINE_PROP_BIT("param_change", VirtIOSCSI, host_features, -+ VIRTIO_SCSI_F_CHANGE, true), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index b42e7f1..088fe9f 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -141,19 +141,6 @@ typedef struct VirtIOSCSIReq { - } req; - } VirtIOSCSIReq; - --#define DEFINE_VIRTIO_SCSI_PROPERTIES(_state, _conf_field) \ -- DEFINE_PROP_UINT32("num_queues", _state, _conf_field.num_queues, 1), \ -- DEFINE_PROP_UINT32("max_sectors", _state, _conf_field.max_sectors, 0xFFFF),\ -- DEFINE_PROP_UINT32("cmd_per_lun", _state, _conf_field.cmd_per_lun, 128) -- --#define DEFINE_VIRTIO_SCSI_FEATURES(_state, _feature_field) \ -- DEFINE_PROP_BIT("any_layout", _state, _feature_field, \ -- VIRTIO_F_ANY_LAYOUT, true), \ -- DEFINE_PROP_BIT("hotplug", _state, _feature_field, VIRTIO_SCSI_F_HOTPLUG, \ -- true), \ -- DEFINE_PROP_BIT("param_change", _state, _feature_field, \ -- VIRTIO_SCSI_F_CHANGE, true) -- - typedef void (*HandleOutput)(VirtIODevice *, VirtQueue *); - - void virtio_scsi_common_realize(DeviceState *dev, Error **errp, --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio-serial-bus-move-qdev-properties-into-virtio-s.patch b/SOURCES/kvm-virtio-serial-bus-move-qdev-properties-into-virtio-s.patch deleted file mode 100644 index cfadf9b..0000000 --- a/SOURCES/kvm-virtio-serial-bus-move-qdev-properties-into-virtio-s.patch +++ /dev/null @@ -1,63 +0,0 @@ -From d6e1453c28c2f13327ba8a2a9d411b2862db6f61 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:19:03 +0200 -Subject: [PATCH 175/217] virtio-serial-bus: move qdev properties into - virtio-serial-bus.c - -Message-id: <1436260751-25015-61-git-send-email-jasowang@redhat.com> -Patchwork-id: 66835 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 60/68] virtio-serial-bus: move qdev properties into virtio-serial-bus.c -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: Shannon Zhao <shannon.zhao@linaro.org> - -As only one place in virtio-serial-bus.c uses -DEFINE_VIRTIO_SERIAL_PROPERTIES, there is no need to expose it. Inline -it into virtio-serial-bus.c to avoid wrongly use. - -Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> -Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> -Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -(cherry picked from commit 448777c411b80df0263eb00b9df2f829cdc7cc9b) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - hw/char/virtio-serial-bus.c | 3 ++- - include/hw/virtio/virtio-serial.h | 3 --- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c -index fbe9d24..dc5c5ac 100644 ---- a/hw/char/virtio-serial-bus.c -+++ b/hw/char/virtio-serial-bus.c -@@ -1083,7 +1083,8 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp) - } - - static Property virtio_serial_properties[] = { -- DEFINE_VIRTIO_SERIAL_PROPERTIES(VirtIOSerial, serial), -+ DEFINE_PROP_UINT32("max_ports", VirtIOSerial, serial.max_virtserial_ports, -+ 31), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h -index 18d1bcc..527d0bf 100644 ---- a/include/hw/virtio/virtio-serial.h -+++ b/include/hw/virtio/virtio-serial.h -@@ -221,7 +221,4 @@ void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle); - #define VIRTIO_SERIAL(obj) \ - OBJECT_CHECK(VirtIOSerial, (obj), TYPE_VIRTIO_SERIAL) - --#define DEFINE_VIRTIO_SERIAL_PROPERTIES(_state, _field) \ -- DEFINE_PROP_UINT32("max_ports", _state, _field.max_virtserial_ports, 31) -- - #endif --- -1.8.3.1 - diff --git a/SOURCES/kvm-virtio_balloon-header-update.patch b/SOURCES/kvm-virtio_balloon-header-update.patch deleted file mode 100644 index 30bc163..0000000 --- a/SOURCES/kvm-virtio_balloon-header-update.patch +++ /dev/null @@ -1,47 +0,0 @@ -From ec309d1e67a724e92063fd83cf13ec31ec4ffda1 Mon Sep 17 00:00:00 2001 -From: Xiao Wang <jasowang@redhat.com> -Date: Tue, 7 Jul 2015 09:18:47 +0200 -Subject: [PATCH 159/217] virtio_balloon: header update - -Message-id: <1436260751-25015-45-git-send-email-jasowang@redhat.com> -Patchwork-id: 66819 -O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 44/68] virtio_balloon: header update -Bugzilla: 1227343 -RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> -RH-Acked-by: David Gibson <dgibson@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> -RH-Acked-by: Thomas Huth <thuth@redhat.com> - -From: "Michael S. Tsirkin" <mst@redhat.com> - -add modern header - -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Michael S. Tsirkin <mst@redhat.com> - -(cherry picked from commit fbdc6892dd8a842a3d86b8315ff56399e0387b74) -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - include/hw/virtio/virtio-balloon.h | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-balloon.h -index 4ab8f54..346a9fd 100644 ---- a/include/hw/virtio/virtio-balloon.h -+++ b/include/hw/virtio/virtio-balloon.h -@@ -25,6 +25,12 @@ - - typedef struct virtio_balloon_stat VirtIOBalloonStat; - -+typedef struct virtio_balloon_stat_modern { -+ uint16_t tag; -+ uint8_t reserved[6]; -+ uint64_t val; -+} VirtIOBalloonStatModern; -+ - typedef struct VirtIOBalloon { - VirtIODevice parent_obj; - VirtQueue *ivq, *dvq, *svq; --- -1.8.3.1 - diff --git a/SOURCES/kvm-vl-Round-memory-sizes-below-2MiB-up-to-2MiB.patch b/SOURCES/kvm-vl-Round-memory-sizes-below-2MiB-up-to-2MiB.patch deleted file mode 100644 index 71502ab..0000000 --- a/SOURCES/kvm-vl-Round-memory-sizes-below-2MiB-up-to-2MiB.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0fd67818527881ce8ec6ee9c3952386c166f91ad Mon Sep 17 00:00:00 2001 -From: Markus Armbruster <armbru@redhat.com> -Date: Mon, 7 Jul 2014 10:28:38 +0200 -Subject: vl: Round memory sizes below 2MiB up to 2MiB - -RH-Author: Markus Armbruster <armbru@redhat.com> -Message-id: <1387459965-19517-2-git-send-email-armbru@redhat.com> -Patchwork-id: 56389 -O-Subject: [PATCH 7.0 qemu-kvm 1/1] vl: Round memory sizes below 2MiB up to 2MiB -Bugzilla: 999836 -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> -RH-Acked-by: Igor Mammedov <imammedo@redhat.com> - -From: Markus Armbruster <armbru@redhat.com> - -SeaBIOS requires at least 1MiB of RAM, but doesn't doesn't check for -it. It simply assumes it's there, and crashes when it isn't, often -without any indication what's wrong. No upstream SeaBIOS fix -expected. - -In RHEL-6, we round memory sizes below 2MiB up to 2MiB to protect -SeaBIOS (commit 551c098 and commit b9d6c40). Do the same for RHEL-7. -Not wanted upstream. - -Signed-off-by: Markus Armbruster <armbru@redhat.com> - -diff --git a/vl.c b/vl.c -index 29c9373..30631ac 100644 ---- a/vl.c -+++ b/vl.c -@@ -2689,6 +2689,7 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size) - } - - sz = QEMU_ALIGN_UP(sz, 8192); -+ sz = MAX(sz, 2 * 1024 * 1024); - ram_size = sz; - if (ram_size != sz) { - error_report("ram size too large"); diff --git a/SOURCES/kvm-vmdk-Fix-overflow-if-l1_size-is-0x20000000.patch b/SOURCES/kvm-vmdk-Fix-overflow-if-l1_size-is-0x20000000.patch deleted file mode 100644 index 4c3ad46..0000000 --- a/SOURCES/kvm-vmdk-Fix-overflow-if-l1_size-is-0x20000000.patch +++ /dev/null @@ -1,62 +0,0 @@ -From fc2dd801b0a471b15fe8220d132186fa8a6a5588 Mon Sep 17 00:00:00 2001 -From: Fam Zheng <famz@redhat.com> -Date: Mon, 1 Jun 2015 08:26:45 +0200 -Subject: [PATCH 007/217] vmdk: Fix overflow if l1_size is 0x20000000 - -Message-id: <1433147205-15238-1-git-send-email-famz@redhat.com> -Patchwork-id: 65161 -O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH] vmdk: Fix overflow if l1_size is 0x20000000 -Bugzilla: 1226809 -RH-Acked-by: Max Reitz <mreitz@redhat.com> -RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Richard Jones caught this bug with afl fuzzer. - -In fact, that's the only possible value to overflow (extent->l1_size = -0x20000000) l1_size: - -l1_size = extent->l1_size * sizeof(long) => 0x80000000; - -g_try_malloc returns NULL because l1_size is interpreted as negative -during type casting from 'int' to 'gsize', which yields a enormous -value. Hence, by coincidence, we get a "not too bad" behavior: - -qemu-img: Could not open '/tmp/afl6.img': Could not open -'/tmp/afl6.img': Cannot allocate memory - -Values larger than 0x20000000 will be refused by the validation in -vmdk_add_extent. - -Values smaller than 0x20000000 will not overflow l1_size. - -Cc: qemu-stable@nongnu.org -Reported-by: Richard W.M. Jones <rjones@redhat.com> -Signed-off-by: Fam Zheng <famz@redhat.com> -Reviewed-by: Max Reitz <mreitz@redhat.com> -Tested-by: Richard W.M. Jones <rjones@redhat.com> -Signed-off-by: Kevin Wolf <kwolf@redhat.com> -(cherry picked from commit 13c4941cdd8685d28c7e3a09e393a5579b58db46) -Signed-off-by: Fam Zheng <famz@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - block/vmdk.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/block/vmdk.c b/block/vmdk.c -index 8410a15..214653c 100644 ---- a/block/vmdk.c -+++ b/block/vmdk.c -@@ -451,7 +451,8 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent, - Error **errp) - { - int ret; -- int l1_size, i; -+ size_t l1_size; -+ int i; - - /* read the L1 table */ - l1_size = extent->l1_size * sizeof(uint32_t); --- -1.8.3.1 - diff --git a/SOURCES/qemu-ga.sysconfig b/SOURCES/qemu-ga.sysconfig index f54018e..67bad0c 100644 --- a/SOURCES/qemu-ga.sysconfig +++ b/SOURCES/qemu-ga.sysconfig @@ -5,7 +5,7 @@ # # You can get the list of RPC commands using "qemu-ga --blacklist='?'". # There should be no spaces between commas and commands in the blacklist. -BLACKLIST_RPC=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush +BLACKLIST_RPC=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush,guest-exec,guest-exec-status # Fsfreeze hook script specification. # diff --git a/SOURCES/qemuga-qga-commands-posix-Fix-bug-in-guest-fstrim.patch b/SOURCES/qemuga-qga-commands-posix-Fix-bug-in-guest-fstrim.patch deleted file mode 100644 index 97e1de8..0000000 --- a/SOURCES/qemuga-qga-commands-posix-Fix-bug-in-guest-fstrim.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0a3e71ac6373184a31a5d99b6eebc1c698a6e12f Mon Sep 17 00:00:00 2001 -From: Thomas Huth <thuth@redhat.com> -Date: Thu, 9 Jul 2015 10:15:50 +0200 -Subject: [PATCH 2/2] qga/commands-posix: Fix bug in guest-fstrim - -Message-id: <1436436950-3481-2-git-send-email-thuth@redhat.com> -Patchwork-id: 66881 -O-Subject: [RHEV-7.2 qemu-guest-agent PATCH 1/1] qga/commands-posix: Fix bug in guest-fstrim -Bugzilla: 1211973 -RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> -RH-Acked-by: Laurent Vivier <lvivier@redhat.com> - -From: Justin Ossevoort <justin@quarantainenet.nl> - -The FITRIM ioctl updates the fstrim_range structure it receives. This -way the caller can determine how many bytes were trimmed. The -guest-fstrim logic reuses the same fstrim_range for each filesystem, -effectively limiting each filesystem to trim at most as much as the -previous was able to trim. - -If a previous filesystem would have trimmed 0 bytes, than the next -filesystem would report an error 'Invalid argument' because a FITRIM -request with length 0 is not valid. - -This change resets the fstrim_range structure for each filesystem. - -Signed-off-by: Justin Ossevoort <justin@quarantainenet.nl> -Reviewed-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -(cherry picked from commit 73a652a1b08445e8d91e50cdbb2da50e571c61b3) -Signed-off-by: Thomas Huth <thuth@redhat.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - qga/commands-posix.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/qga/commands-posix.c b/qga/commands-posix.c -index ba8de62..4449628 100644 ---- a/qga/commands-posix.c -+++ b/qga/commands-posix.c -@@ -1332,11 +1332,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) - struct FsMount *mount; - int fd; - Error *local_err = NULL; -- struct fstrim_range r = { -- .start = 0, -- .len = -1, -- .minlen = has_minimum ? minimum : 0, -- }; -+ struct fstrim_range r; - - slog("guest-fstrim called"); - -@@ -1360,6 +1356,9 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) - * error means an unexpected error, so return it in those cases. In - * some other cases ENOTTY will be reported (e.g. CD-ROMs). - */ -+ r.start = 0; -+ r.len = -1; -+ r.minlen = has_minimum ? minimum : 0; - ret = ioctl(fd, FITRIM, &r); - if (ret == -1) { - if (errno != ENOTTY && errno != EOPNOTSUPP) { --- -1.8.3.1 - diff --git a/SOURCES/qemuga-qga-fail-early-for-invalid-time.patch b/SOURCES/qemuga-qga-fail-early-for-invalid-time.patch deleted file mode 100644 index 6e3e595..0000000 --- a/SOURCES/qemuga-qga-fail-early-for-invalid-time.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 9e6b7a584d01e555f5757269b940eeea09386379 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com> -Date: Tue, 8 Sep 2015 10:24:38 +0200 -Subject: [PATCH] qga: fail early for invalid time -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Message-id: <1441707878-9654-1-git-send-email-marcandre.lureau@redhat.com> -Patchwork-id: 67702 -O-Subject: [RHEL-7.2 qemu-guest-agent PATCH] qga: fail early for invalid time -Bugzilla: 1224023 -RH-Acked-by: Thomas Huth <thuth@redhat.com> -RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> -RH-Acked-by: Laszlo Ersek <lersek@redhat.com> - -Upstream-status: 00d2f3707a63881a0cec8d00cbd467f9b2d8af41 - -It's possible to set system time with dates after 2070, however, it's -not possible to set the RTC. It has limitation to up to year -2070 (1970+100). In order to keep both clock in sync and before the -kernel complains on invalid values, bail out early. - -Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> -Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> -Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> ---- - qga/commands-posix.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/qga/commands-posix.c b/qga/commands-posix.c -index 4449628..2096a25 100644 ---- a/qga/commands-posix.c -+++ b/qga/commands-posix.c -@@ -154,6 +154,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) - - /* If user has passed a time, validate and set it. */ - if (has_time) { -+ GDate date = { 0, }; -+ - /* year-2038 will overflow in case time_t is 32bit */ - if (time_ns / 1000000000 != (time_t)(time_ns / 1000000000)) { - error_setg(errp, "Time %" PRId64 " is too large", time_ns); -@@ -162,6 +164,11 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) - - tv.tv_sec = time_ns / 1000000000; - tv.tv_usec = (time_ns % 1000000000) / 1000; -+ g_date_set_time_t(&date, tv.tv_sec); -+ if (date.year < 1970 || date.year >= 2070) { -+ error_setg_errno(errp, errno, "Invalid time"); -+ return; -+ } - - ret = settimeofday(&tv, NULL); - if (ret < 0) { --- -1.8.3.1 - diff --git a/SPECS/qemu-guest-agent.spec b/SPECS/qemu-guest-agent.spec index 0c6f2e9..13c9409 100644 --- a/SPECS/qemu-guest-agent.spec +++ b/SPECS/qemu-guest-agent.spec @@ -58,8 +58,8 @@ Summary: QEMU guest agent Name: qemu-guest-agent -Version: 2.3.0 -Release: 4%{?dist} +Version: 2.5.0 +Release: 3%{?dist} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 10 License: GPLv2+ and LGPLv2+ and BSD @@ -74,478 +74,14 @@ Requires(postun): systemd-units %define _smp_mflags %{nil} %endif -Source0: http://wiki.qemu.org/download/qemu-%{version}.tar.bz2 +Source0: http://wiki.qemu.org/download/qemu-2.5.0.tar.bz2 Source1: qemu-guest-agent.service Source2: 99-qemu-guest-agent.rules Source3: qemu-ga.sysconfig Source4: build_configure.sh - -Patch1000: kvm-misc-Add-redhat-directory-and-disable-unsupported-devices.patch -Patch1001: kvm-misc-Add-RHEL-7-machine-types.patch -Patch1002: kvm-misc-Enable-disable-devices-for-RHEL-7.patch -Patch1003: kvm-misc-Use-kvm-by-default.patch -Patch1004: kvm-misc-add-qxl_screendump-monitor-command.patch -Patch1005: kvm-misc-seabios-paravirt-allow-more-than-1TB-in-x86-guest.patch -Patch1006: kvm-monitor-Remove-usb_add-del-commands-for-Red-Hat-Enterprise-Linux.patch -Patch1007: kvm-monitor-Remove-host_net_add-remove-for-Red-Hat-Enterprise-Linux.patch -Patch1008: kvm-misc-introduce-RFQDN_REDHAT-RHEL-6-7-fwd.patch -Patch1009: kvm-pci-assign-cap-number-of-devices-that-can-be-assigned.patch -Patch1010: kvm-vfio-cap-number-of-devices-that-can-be-assigned.patch -Patch1011: kvm-QMP-Forward-port-__com-redhat_drive_del-from-RHEL-6.patch -Patch1012: kvm-QMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch -Patch1013: kvm-HMP-Forward-port-__com-redhat_drive_add-from-RHEL-6.patch -Patch1014: kvm-QMP-Document-throttling-parameters-of-__com-redhat_drive_add.patch -Patch1015: kvm-misc-Add-support-statement-to-help-output.patch -Patch1016: kvm-__com-redhat_qxl_screendump-add-docs.patch -Patch1017: kvm-vl-Round-memory-sizes-below-2MiB-up-to-2MiB.patch -Patch1018: kvm-misc-use-recommended-max-vcpu-count.patch -Patch1019: kvm-configure-add-option-to-disable-fstack-protect.patch -Patch1020: kvm-misc-fix-guest-physical-bits-to-match-host-to-go-beyond-1TB-guests.patch -Patch1021: kvm-QMP-Relax-__com-redhat_drive_add-parameter-checking.patch -Patch1022: kvm-scripts-qapi-event-py-support-vendor-extension.patch -Patch1024: kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bridge.patch -Patch1026: kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch -Patch1027: kvm-ivshmem-RHEL-only-remove-unsupported-code.patch -Patch1028: kvm-ivshmem-RHEL-only-explicitly-remove-dead-code.patch -Patch1029: kvm-misc-Revert-rhel-Drop-ivshmem-device.patch -Patch1030: kvm-misc-Use-qemu-kvm-in-documentation-instead-of-qemu-system-i386.patch -Patch1031: kvm-qemu-iotests-Fix-broken-test-cases.patch -Patch1032: kvm-numa-Don-t-allow-memdev-on-RHEL-6-machine-types.patch -Patch1033: kvm-acpi-Use-apic_id_limit-when-calculating-legacy-ACPI-table-size.patch -Patch1034: kvm-kvm_stat-Add-RESET-support-for-perf-event-ioctl.patch -Patch1035: kvm-misc-ignore-SIGIO-in-tests-that-use-AIO-context-aarch64-host-only.patch -Patch1036: kvm-aio_notify-force-main-loop-wakeup-with-SIGIO-aarch64-host-only.patch -Patch1037: kvm-pc_sysfw-prevent-pflash-and-or-mis-sized-firmware-for-rhel6-x-0.patch -Patch1038: kvm-misc-Add-pc-i440fx-rhel7-2-0-machine-type.patch -Patch1039: kvm-misc-Add-pc-q35-rhel7-2-0-machine-type.patch -# For bz#1165534 - balloon: improve error message when adding second device -Patch1040: kvm-balloon-improve-error-msg-when-adding-second-device.patch -# For bz#1199174 - QMP: forward port rhel-only error reason to BLOCK_IO_ERROR event -Patch1041: kvm-qmp-add-error-reason-to-the-BLOCK_IO_ERROR-event.patch -# For bz#1122778 - miss "vhdx" and "iscsi" in qemu-img supported format list -Patch1042: kvm-fdc-force-the-fifo-access-to-be-in-bounds-of-the-all.patch -# For bz#1226809 - Overflow in malloc size calculation in VMDK driver -Patch1043: kvm-vmdk-Fix-overflow-if-l1_size-is-0x20000000.patch -# For bz#1228574 - Add RHEL7.2 machine type in QEMU for PPC64LE -Patch1044: kvm-Downstream-only-Add-rhel7.2.0-machine-type.patch -# For bz#1230550 - [abrt] qemu-system-x86: __memcmp_sse4_1(): qemu-system-x86_64 killed by SIGSEGV -Patch1045: kvm-spice-display-fix-segfault-in-qemu_spice_create_upda.patch -# For bz#1221425 - qemu crash when hot-plug a memory device -Patch1046: kvm-pc-dimm-don-t-assert-if-pc-dimm-alignment-hotpluggab.patch -# For bz#1229073 - [graphical framebuffer]Start guest failed when VNC listen on IPV6 address -Patch1047: kvm-Strip-brackets-from-vnc-host.patch -# For bz#1226996 - qcow2: Fix minimum L2 cache size -Patch1048: kvm-qcow2-Set-MIN_L2_CACHE_SIZE-to-2.patch -# For bz#1226996 - qcow2: Fix minimum L2 cache size -Patch1049: kvm-iotests-qcow2-COW-with-minimal-L2-cache-size.patch -# For bz#1226996 - qcow2: Fix minimum L2 cache size -Patch1050: kvm-qcow2-Add-DEFAULT_L2_CACHE_CLUSTERS.patch -# For bz#1231610 - Support more virtio queues -Patch1051: kvm-virtio-ccw-using-VIRTIO_NO_VECTOR-instead-of-0-for-i.patch -# For bz#1231610 - Support more virtio queues -Patch1052: kvm-virtio-ccw-sort-into-categories.patch -# For bz#1231610 - Support more virtio queues -Patch1053: kvm-virtio-ccw-change-realization-sequence.patch -# For bz#1231610 - Support more virtio queues -Patch1054: kvm-virtio-ccw-implement-device_plugged.patch -# For bz#1231610 - Support more virtio queues -Patch1055: kvm-virtio-net-fix-the-upper-bound-when-trying-to-delete.patch -# For bz#1231610 - Support more virtio queues -Patch1056: kvm-monitor-replace-the-magic-number-255-with-MAX_QUEUE_.patch -# For bz#1231610 - Support more virtio queues -Patch1057: kvm-monitor-check-return-value-of-qemu_find_net_clients_.patch -# For bz#1231610 - Support more virtio queues -Patch1058: kvm-virtio-introduce-vector-to-virtqueues-mapping.patch -# For bz#1231610 - Support more virtio queues -Patch1059: kvm-virtio-pci-speedup-MSI-X-masking-and-unmasking.patch -# For bz#1231610 - Support more virtio queues -Patch1060: kvm-pci-remove-hard-coded-bar-size-in-msix_init_exclusiv.patch -# For bz#1231610 - Support more virtio queues -Patch1061: kvm-virtio-net-adding-all-queues-in-.realize.patch -# For bz#1231610 - Support more virtio queues -Patch1062: kvm-virtio-device_plugged-can-fail.patch -# For bz#1231610 - Support more virtio queues -Patch1063: kvm-virtio-introduce-virtio_get_num_queues.patch -# For bz#1231610 - Support more virtio queues -Patch1064: kvm-virtio-ccw-introduce-ccw-specific-queue-limit.patch -# For bz#1231610 - Support more virtio queues -Patch1065: kvm-virtio-ccw-validate-the-number-of-queues-against-bus.patch -# For bz#1231610 - Support more virtio queues -Patch1066: kvm-virtio-s390-introduce-virito-s390-queue-limit.patch -# For bz#1231610 - Support more virtio queues -Patch1067: kvm-virtio-s390-introduce-virtio_s390_device_plugged.patch -# For bz#1231610 - Support more virtio queues -Patch1068: kvm-virtio-rename-VIRTIO_PCI_QUEUE_MAX-to-VIRTIO_QUEUE_M.patch -# For bz#1231610 - Support more virtio queues -Patch1069: kvm-virtio-increase-the-queue-limit-to-1024.patch -# For bz#1231610 - Support more virtio queues -Patch1070: kvm-virtio-pci-don-t-try-to-mask-or-unmask-vqs-without-n.patch -# For bz#1231335 - [abrt] qemu-kvm: bdrv_error_action(): qemu-kvm killed by SIGABRT -Patch1071: kvm-atomics-add-explicit-compiler-fence-in-__atomic-memo.patch -# For bz#1221943 - On_crash events didn't work when using guest's pvpanic device -Patch1072: kvm-pc-acpi-fix-pvpanic-for-buggy-guests.patch -# For bz#1219090 - vfio-pci - post QEMU2.3 fixes, error sign + BAR overflow -Patch1073: kvm-vfio-pci-Fix-error-path-sign.patch -# For bz#1219090 - vfio-pci - post QEMU2.3 fixes, error sign + BAR overflow -Patch1074: kvm-vfio-pci-Further-fix-BAR-size-overflow.patch -# For bz#1215087 - migration: 7.2->earlier; serial compatibility -Patch1075: kvm-Add-flag-for-pre-2.2-migration-compatibility.patch -# For bz#1215087 - migration: 7.2->earlier; serial compatibility -Patch1076: kvm-Serial-Migration-compatibility-pre-2.2-7.2.patch -# For bz#1215088 - migration: 7.2->earlier; mc146818rtc compatibility -Patch1077: kvm-Migration-compat-for-mc146818rtc-irq_reinject_on_ack.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1078: kvm-docs-update-documentation-for-memory-hot-unplug.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1079: kvm-acpi-mem-hotplug-add-acpi_memory_slot_status-to-get-.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1080: kvm-acpi-mem-hotplug-add-unplug-request-cb-for-memory-de.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1081: kvm-acpi-mem-hotplug-add-unplug-cb-for-memory-device.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1082: kvm-acpi-extend-aml_field-to-support-UpdateRule.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1083: kvm-acpi-fix-Memory-device-control-fields-register.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1084: kvm-acpi-add-hardware-implementation-for-memory-hot-unpl.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1085: kvm-qmp-event-add-event-notification-for-memory-hot-unpl.patch -# For bz#1120706 - Support dynamic virtual Memory deallocation - qemu-kvm -Patch1086: kvm-hw-acpi-aml-build-Fix-memory-leak.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1087: kvm-memory-add-memory_region_ram_resize.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1088: kvm-acpi-build-remove-dependency-from-ram_addr.h.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1089: kvm-hw-i386-Move-ACPI-header-definitions-in-an-arch-inde.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1090: kvm-hw-i386-acpi-build-move-generic-acpi-building-helper.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1091: kvm-hw-acpi-aml-build-Make-enum-values-to-be-upper-case-.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1092: kvm-hw-arm-virt-Move-common-definitions-to-virt.h.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1093: kvm-hw-arm-virt-Record-PCIe-ranges-in-MemMapEntry-array.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1094: kvm-hw-arm-virt-acpi-build-Basic-framework-for-building-.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1095: kvm-hw-acpi-aml-build-Add-aml_memory32_fixed-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1096: kvm-hw-acpi-aml-build-Add-aml_interrupt-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1097: kvm-hw-arm-virt-acpi-build-Generation-of-DSDT-table-for-.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1098: kvm-hw-arm-virt-acpi-build-Generate-FADT-table-and-updat.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1099: kvm-hw-arm-virt-acpi-build-Generate-MADT-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1100: kvm-hw-arm-virt-acpi-build-Generate-GTDT-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1101: kvm-hw-arm-virt-acpi-build-Generate-RSDT-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1102: kvm-hw-arm-virt-acpi-build-Generate-RSDP-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1103: kvm-hw-arm-virt-acpi-build-Generate-MCFG-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1104: kvm-hw-acpi-aml-build-Make-aml_buffer-definition-consist.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1105: kvm-hw-acpi-aml-build-Add-ToUUID-macro.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1106: kvm-hw-acpi-aml-build-Add-aml_or-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1107: kvm-hw-acpi-aml-build-Add-aml_lnot-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1108: kvm-hw-acpi-aml-build-Add-aml_else-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1109: kvm-hw-acpi-aml-build-Add-aml_create_dword_field-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1110: kvm-hw-acpi-aml-build-Add-aml_dword_io-term.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1111: kvm-hw-acpi-aml-build-Add-Unicode-macro.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1112: kvm-hw-arm-virt-acpi-build-Add-PCIe-controller-in-ACPI-D.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1113: kvm-ACPI-split-CONFIG_ACPI-into-4-pieces.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1114: kvm-hw-arm-virt-Enable-dynamic-generation-of-ACPI-v5.1-t.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1115: kvm-ACPI-Add-definitions-for-the-SPCR-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1116: kvm-hw-arm-virt-acpi-build-Add-SPCR-table.patch -# For bz#1231719 - AArch64: backport ACPI support -Patch1117: kvm-AArch64-Enable-ACPI.patch -# For bz#1229647 - CVE-2015-3214 qemu-kvm-rhev: qemu: i8254: out-of-bounds memory access in pit_ioport_read function [rhel-7.2] -Patch1118: kvm-i8254-fix-out-of-bounds-memory-access-in-pit_ioport_.patch -# For bz#894956 - floppy can not be recognized by Windows guest (q35) -Patch1119: kvm-hw-q35-fix-floppy-controller-definition-in-ich9.patch -# For bz#1215092 - migration: 7.2->earlier: pckbd compatibility -Patch1120: kvm-Migration-compat-for-pckbd.patch -# For bz#1215091 - migration: 7.2->earlier; floppy compatibility -Patch1121: kvm-Migration-compat-for-fdc.patch -# For bz#1207034 - QEMU segfault when doing unaligned zero write to non-512 disk -Patch1122: kvm-block-Fix-NULL-deference-for-unaligned-write-if-qiov.patch -# For bz#1207034 - QEMU segfault when doing unaligned zero write to non-512 disk -Patch1123: kvm-qemu-iotests-Test-unaligned-sub-block-zero-write.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1124: kvm-spapr_drc-initial-implementation-of-sPAPRDRConnector.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1125: kvm-spapr_rtas-add-get-set-power-level-RTAS-interfaces.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1126: kvm-spapr_rtas-add-set-indicator-RTAS-interface.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1127: kvm-spapr_rtas-add-get-sensor-state-RTAS-interface.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1128: kvm-spapr-add-rtas_st_buffer_direct-helper.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1129: kvm-spapr_rtas-add-ibm-configure-connector-RTAS-interfac.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1130: kvm-spapr_events-re-use-EPOW-event-infrastructure-for-ho.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1131: kvm-spapr_events-event-scan-RTAS-interface.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1132: kvm-spapr_drc-add-spapr_drc_populate_dt.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1133: kvm-spapr_pci-add-dynamic-reconfiguration-option-for-spa.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1134: kvm-spapr_pci-create-DRConnectors-for-each-PCI-slot-duri.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1135: kvm-pci-make-pci_bar-useable-outside-pci.c.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1136: kvm-spapr_pci-enable-basic-hotplug-operations.patch -# For bz#1172478 - add support for PCI hotplugging -Patch1137: kvm-spapr_pci-emit-hotplug-add-remove-events-during-hotp.patch -# For bz#1209793 - migration: 7.1->7.2 error while loading state for instance 0x0 of device '0000:00:04.0/intel-hda' -Patch1138: kvm-Print-error-when-failing-to-load-PCI-config-data.patch -# For bz#1209793 - migration: 7.1->7.2 error while loading state for instance 0x0 of device '0000:00:04.0/intel-hda' -Patch1139: kvm-Fix-ich9-intel-hda-compatibility.patch -# For bz#1217277 - Enable KVM implementation of H_LOGICAL_CI_{LOAD,STORE} -Patch1140: kvm-pseries-Enable-in-kernel-H_LOGICAL_CI_-LOAD-STORE-im.patch -# For bz#1191845 - [PowerKVM] There are some unsupported x86 devices under the output of cmds 'man qemu-kvm' and '/usr/libexec/qemu-kvm -device help' -Patch1141: kvm-Split-serial-isa-into-its-own-config-option.patch -# For bz#1191845 - [PowerKVM] There are some unsupported x86 devices under the output of cmds 'man qemu-kvm' and '/usr/libexec/qemu-kvm -device help' -Patch1142: kvm-rhel-Disable-info-irq-and-info-pic-for-Power.patch -# For bz#1191845 - [PowerKVM] There are some unsupported x86 devices under the output of cmds 'man qemu-kvm' and '/usr/libexec/qemu-kvm -device help' -Patch1143: kvm-RHEL-Disable-remaining-unsupported-devices-for-ppc.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1144: kvm-linux-headers-sync-vhost.h.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1145: kvm-virtio-introduce-virtio_legacy_is_cross_endian.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1146: kvm-vhost-set-vring-endianness-for-legacy-virtio.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1147: kvm-tap-add-VNET_LE-VNET_BE-operations.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1148: kvm-tap-fix-non-linux-build.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1149: kvm-vhost-net-tell-tap-backend-about-the-vnet-endianness.patch -# For bz#1225715 - Enable cross-endian vhost devices -Patch1150: kvm-vhost_net-re-enable-when-cross-endian.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1151: kvm-linux-headers-update.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1152: kvm-virtio-input-add-linux-input.h.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1153: kvm-virtio-input-core-code-base-class-device.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1154: kvm-virtio-input-emulated-devices-device.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1155: kvm-virtio-net-Move-DEFINE_VIRTIO_NET_FEATURES-to-virtio.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1156: kvm-virtio-scsi-Move-DEFINE_VIRTIO_SCSI_FEATURES-to-virt.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1157: kvm-memory-Define-API-for-MemoryRegionOps-to-take-attrs-.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1158: kvm-memory-Replace-io_mem_read-write-with-memory_region_.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1159: kvm-Make-CPU-iotlb-a-structure-rather-than-a-plain-hwadd.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1160: kvm-Add-MemTxAttrs-to-the-IOTLB.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1161: kvm-exec.c-Convert-subpage-memory-ops-to-_with_attrs.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1162: kvm-exec.c-Make-address_space_rw-take-transaction-attrib.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1163: kvm-exec.c-Add-new-address_space_ld-st-functions.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1164: kvm-Switch-non-CPU-callers-from-ld-st-_phys-to-address_s.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1165: kvm-s390-virtio-sort-into-categories.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1166: kvm-s390-virtio-use-common-features.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1167: kvm-virtio-move-host_features.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1168: kvm-virtio-ccw-Don-t-advertise-VIRTIO_F_BAD_FEATURE.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1169: kvm-virtio-move-VIRTIO_F_NOTIFY_ON_EMPTY-into-core.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1170: kvm-qdev-add-64bit-properties.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1171: kvm-virtio-make-features-64bit-wide.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1172: kvm-virtio-input-const_le16-and-const_le32-not-build-tim.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1173: kvm-virtio-input-make-virtio-devices-follow-usual-naming.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1174: kvm-virtio-64bit-features-fixups.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1175: kvm-virtio-endianness-checks-for-virtio-1.0-devices.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1176: kvm-virtio-allow-virtio-1-queue-layout.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1177: kvm-virtio-disallow-late-feature-changes-for-virtio-1.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1178: kvm-virtio-allow-to-fail-setting-status.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1179: kvm-virtio-net-no-writeable-mac-for-virtio-1.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1180: kvm-virtio-net-support-longer-header.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1181: kvm-virtio-net-enable-virtio-1.0.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1182: kvm-vhost_net-add-version_1-feature.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1183: kvm-vhost-64-bit-features.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1184: kvm-linux-headers-add-virtio_pci.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1185: kvm-virtio-pci-initial-virtio-1.0-support.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1186: kvm-virtio-generation-counter-support.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1187: kvm-virtio-add-modern-config-accessors.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1188: kvm-virtio-pci-switch-to-modern-accessors-for-1.0.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1189: kvm-virtio-pci-add-flags-to-enable-disable-legacy-modern.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1190: kvm-virtio-pci-make-QEMU_VIRTIO_PCI_QUEUE_MEM_MULT-small.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1191: kvm-virtio-pci-change-document-virtio-pci-bar-layout.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1192: kvm-virtio-pci-make-modern-bar-64bit-prefetchable.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1193: kvm-virtio-pci-correctly-set-host-notifiers-for-modern-b.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1194: kvm-virtio_balloon-header-update.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1195: kvm-virtio-balloon-switch-to-virtio_add_feature.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1196: kvm-virtio-pci-add-struct-VirtIOPCIRegion-for-virtio-1-r.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1197: kvm-virtio-pci-add-virtio_pci_modern_regions_init.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1198: kvm-virtio-pci-add-virtio_pci_modern_region_map.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1199: kvm-virtio-pci-move-virtio_pci_add_mem_cap-call-to-virti.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1200: kvm-virtio-pci-move-cap-type-to-VirtIOPCIRegion.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1201: kvm-virtio-pci-drop-identical-virtio_pci_cap.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1202: kvm-virtio-pci-fill-VirtIOPCIRegions-early.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1203: kvm-pci-add-PCI_CLASS_INPUT_.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1204: kvm-virtio-input-core-code-base-class-pci.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1205: kvm-virtio-input-emulated-devices-pci.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1206: kvm-virtio-net-move-qdev-properties-into-virtio-net.c.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1207: kvm-virtio-net.h-Remove-unsed-DEFINE_VIRTIO_NET_PROPERTI.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1208: kvm-virtio-scsi-move-qdev-properties-into-virtio-scsi.c.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1209: kvm-virtio-rng-move-qdev-properties-into-virtio-rng.c.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1210: kvm-virtio-serial-bus-move-qdev-properties-into-virtio-s.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1211: kvm-virtio-9p-device-move-qdev-properties-into-virtio-9p.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1212: kvm-vhost-scsi-move-qdev-properties-into-vhost-scsi.c.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1213: kvm-virito-pci-fix-OVERRUN-problem.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1214: kvm-virtio-input-move-properties-use-virtio_instance_ini.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1215: kvm-virtio-input-evdev-passthrough.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1216: kvm-Add-MAINTAINERS-entry-for-virtio-input.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1217: kvm-virtio-input-add-input-routing-support.patch -# For bz#1227343 - [virtio-1] QEMU Virtio-1 Support -Patch1218: kvm-dataplane-fix-cross-endian-issues.patch -# For bz#1174861 - use seccomp -Patch1219: kvm-aarch64-allow-enable-seccomp.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1220: kvm-acpi-add-a-missing-backslash-to-the-_SB-scope.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1221: kvm-range-remove-useless-inclusions.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1222: kvm-acpi-Simplify-printing-to-dynamic-string.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1223: kvm-acpi-add-aml_add-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1224: kvm-acpi-add-aml_lless-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1225: kvm-acpi-add-aml_index-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1226: kvm-acpi-add-aml_shiftleft-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1227: kvm-acpi-add-aml_shiftright-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1228: kvm-acpi-add-aml_increment-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1229: kvm-acpi-add-aml_while-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1230: kvm-acpi-add-implementation-of-aml_while-term.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1231: kvm-hw-pci-made-pci_bus_is_root-a-PCIBusClass-method.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1232: kvm-hw-pci-made-pci_bus_num-a-PCIBusClass-method.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1233: kvm-hw-i386-query-only-for-q35-pc-when-looking-for-pci-h.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1234: kvm-hw-pci-extend-PCI-config-access-to-support-devices-b.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1235: kvm-hw-acpi-add-support-for-i440fx-snooping-root-busses.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1236: kvm-hw-apci-add-_PRT-method-for-extra-PCI-root-busses.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1237: kvm-hw-acpi-add-_CRS-method-for-extra-root-busses.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1238: kvm-hw-acpi-remove-from-root-bus-0-the-crs-resources-use.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1239: kvm-hw-pci-removed-rootbus-nr-is-0-assumption-from-qmp_p.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1240: kvm-hw-pci-introduce-PCI-Expander-Bridge-PXB.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1241: kvm-hw-pci-inform-bios-if-the-system-has-extra-pci-root-.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1242: kvm-hw-pxb-add-map_irq-func.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1243: kvm-hw-pci-add-support-for-NUMA-nodes.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1244: kvm-hw-pxb-add-numa_node-parameter.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1245: kvm-apci-fix-PXB-behaviour-if-used-with-unsupported-BIOS.patch -# For bz#1103313 - RFE: configure guest NUMA node locality for guest PCI devices -Patch1246: kvm-docs-Add-PXB-documentation.patch -# For bz#1213681 - PAPR PCI-e EEH (Enhanced Error Handling) for KVM/Power guests with VFIO devices (qemu) -Patch1247: kvm-sPAPR-Don-t-enable-EEH-on-emulated-PCI-devices.patch -# For bz#1213681 - PAPR PCI-e EEH (Enhanced Error Handling) for KVM/Power guests with VFIO devices (qemu) -Patch1248: kvm-sPAPR-Reenable-EEH-functionality-on-reboot.patch -# For bz#1213681 - PAPR PCI-e EEH (Enhanced Error Handling) for KVM/Power guests with VFIO devices (qemu) -Patch1249: kvm-sPAPR-Clear-stale-MSIx-table-during-EEH-reset.patch -# For bz#1213882 - enable using tcmalloc for memory allocation in qemu-kvm-rhev -Patch1250: kvm-configure-Add-support-for-tcmalloc.patch -# For bz#1211973 - 'guest-fstrim' failed for guest with os on spapr-vscsi disk -Patch1251: qemuga-qga-commands-posix-Fix-bug-in-guest-fstrim.patch -# For bz#1224023 - The hwclock and systemclock of guest should be ccoincident while set a invalid domtime with guest agent -Patch1252: qemuga-qga-fail-early-for-invalid-time.patch +Patch0001: 0001-Initial-redhat-build.patch BuildRequires: zlib-devel BuildRequires: SDL-devel @@ -630,6 +166,7 @@ BuildRequires: lzo-devel snappy-devel %if 0%{have_numa} BuildRequires: numactl-devel %endif +BuildRequires: libcacard-devel %define qemudocdir %{_docdir}/%{pkgname} @@ -691,257 +228,7 @@ ApplyOptionalPatch() } -%patch1000 -p1 -%patch1001 -p1 -%patch1002 -p1 -%patch1003 -p1 -%patch1004 -p1 -%patch1005 -p1 -%patch1006 -p1 -%patch1007 -p1 -%patch1008 -p1 -%patch1009 -p1 -%patch1010 -p1 -%patch1011 -p1 -%patch1012 -p1 -%patch1013 -p1 -%patch1014 -p1 -%patch1015 -p1 -%patch1016 -p1 -%patch1017 -p1 -%patch1018 -p1 -%patch1019 -p1 -%patch1020 -p1 -%patch1021 -p1 -%patch1022 -p1 -%patch1024 -p1 -%patch1026 -p1 -%patch1027 -p1 -%patch1028 -p1 -%patch1029 -p1 -%patch1030 -p1 -%patch1031 -p1 -%patch1032 -p1 -%patch1033 -p1 -%patch1034 -p1 -%patch1035 -p1 -%patch1036 -p1 -%patch1037 -p1 -%patch1038 -p1 -%patch1039 -p1 -%patch1040 -p1 -%patch1041 -p1 -%patch1042 -p1 -%patch1043 -p1 -%patch1044 -p1 -%patch1045 -p1 -%patch1046 -p1 -%patch1047 -p1 -%patch1048 -p1 -%patch1049 -p1 -%patch1050 -p1 -%patch1051 -p1 -%patch1052 -p1 -%patch1053 -p1 -%patch1054 -p1 -%patch1055 -p1 -%patch1056 -p1 -%patch1057 -p1 -%patch1058 -p1 -%patch1059 -p1 -%patch1060 -p1 -%patch1061 -p1 -%patch1062 -p1 -%patch1063 -p1 -%patch1064 -p1 -%patch1065 -p1 -%patch1066 -p1 -%patch1067 -p1 -%patch1068 -p1 -%patch1069 -p1 -%patch1070 -p1 -%patch1071 -p1 -%patch1072 -p1 -%patch1073 -p1 -%patch1074 -p1 -%patch1075 -p1 -%patch1076 -p1 -%patch1077 -p1 -%patch1078 -p1 -%patch1079 -p1 -%patch1080 -p1 -%patch1081 -p1 -%patch1082 -p1 -%patch1083 -p1 -%patch1084 -p1 -%patch1085 -p1 -%patch1086 -p1 -%patch1087 -p1 -%patch1088 -p1 -%patch1089 -p1 -%patch1090 -p1 -%patch1091 -p1 -%patch1092 -p1 -%patch1093 -p1 -%patch1094 -p1 -%patch1095 -p1 -%patch1096 -p1 -%patch1097 -p1 -%patch1098 -p1 -%patch1099 -p1 -%patch1100 -p1 -%patch1101 -p1 -%patch1102 -p1 -%patch1103 -p1 -%patch1104 -p1 -%patch1105 -p1 -%patch1106 -p1 -%patch1107 -p1 -%patch1108 -p1 -%patch1109 -p1 -%patch1110 -p1 -%patch1111 -p1 -%patch1112 -p1 -%patch1113 -p1 -%patch1114 -p1 -%patch1115 -p1 -%patch1116 -p1 -%patch1117 -p1 -%patch1118 -p1 -%patch1119 -p1 -%patch1120 -p1 -%patch1121 -p1 -%patch1122 -p1 -%patch1123 -p1 -%patch1124 -p1 -%patch1125 -p1 -%patch1126 -p1 -%patch1127 -p1 -%patch1128 -p1 -%patch1129 -p1 -%patch1130 -p1 -%patch1131 -p1 -%patch1132 -p1 -%patch1133 -p1 -%patch1134 -p1 -%patch1135 -p1 -%patch1136 -p1 -%patch1137 -p1 -%patch1138 -p1 -%patch1139 -p1 -%patch1140 -p1 -%patch1141 -p1 -%patch1142 -p1 -%patch1143 -p1 -%patch1144 -p1 -%patch1145 -p1 -%patch1146 -p1 -%patch1147 -p1 -%patch1148 -p1 -%patch1149 -p1 -%patch1150 -p1 -%patch1151 -p1 -%patch1152 -p1 -%patch1153 -p1 -%patch1154 -p1 -%patch1155 -p1 -%patch1156 -p1 -%patch1157 -p1 -%patch1158 -p1 -%patch1159 -p1 -%patch1160 -p1 -%patch1161 -p1 -%patch1162 -p1 -%patch1163 -p1 -%patch1164 -p1 -%patch1165 -p1 -%patch1166 -p1 -%patch1167 -p1 -%patch1168 -p1 -%patch1169 -p1 -%patch1170 -p1 -%patch1171 -p1 -%patch1172 -p1 -%patch1173 -p1 -%patch1174 -p1 -%patch1175 -p1 -%patch1176 -p1 -%patch1177 -p1 -%patch1178 -p1 -%patch1179 -p1 -%patch1180 -p1 -%patch1181 -p1 -%patch1182 -p1 -%patch1183 -p1 -%patch1184 -p1 -%patch1185 -p1 -%patch1186 -p1 -%patch1187 -p1 -%patch1188 -p1 -%patch1189 -p1 -%patch1190 -p1 -%patch1191 -p1 -%patch1192 -p1 -%patch1193 -p1 -%patch1194 -p1 -%patch1195 -p1 -%patch1196 -p1 -%patch1197 -p1 -%patch1198 -p1 -%patch1199 -p1 -%patch1200 -p1 -%patch1201 -p1 -%patch1202 -p1 -%patch1203 -p1 -%patch1204 -p1 -%patch1205 -p1 -%patch1206 -p1 -%patch1207 -p1 -%patch1208 -p1 -%patch1209 -p1 -%patch1210 -p1 -%patch1211 -p1 -%patch1212 -p1 -%patch1213 -p1 -%patch1214 -p1 -%patch1215 -p1 -%patch1216 -p1 -%patch1217 -p1 -%patch1218 -p1 -%patch1219 -p1 -%patch1220 -p1 -%patch1221 -p1 -%patch1222 -p1 -%patch1223 -p1 -%patch1224 -p1 -%patch1225 -p1 -%patch1226 -p1 -%patch1227 -p1 -%patch1228 -p1 -%patch1229 -p1 -%patch1230 -p1 -%patch1231 -p1 -%patch1232 -p1 -%patch1233 -p1 -%patch1234 -p1 -%patch1235 -p1 -%patch1236 -p1 -%patch1237 -p1 -%patch1238 -p1 -%patch1239 -p1 -%patch1240 -p1 -%patch1241 -p1 -%patch1242 -p1 -%patch1243 -p1 -%patch1244 -p1 -%patch1245 -p1 -%patch1246 -p1 -%patch1247 -p1 -%patch1248 -p1 -%patch1249 -p1 -%patch1250 -p1 -%patch1251 -p1 -%patch1252 -p1 +%patch0001 -p1 ApplyOptionalPatch qemu-kvm-test.patch @@ -1027,6 +314,7 @@ cat config-host.mak echo "===" make qemu-ga %{?_smp_mflags} $buildldflags +make qemu-ga.8 %install %define _udevdir %(pkg-config --variable=udevdir udev)/rules.d @@ -1063,6 +351,9 @@ mkdir -p -v $RPM_BUILD_ROOT%{_localstatedir}/log/qemu-ga/ mkdir -p $RPM_BUILD_ROOT%{_bindir} install -c -m 0755 qemu-ga ${RPM_BUILD_ROOT}%{_bindir}/qemu-ga +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8 +install -m 0644 qemu-ga.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/ + %files %defattr(-,root,root,-) %doc COPYING README @@ -1072,14 +363,25 @@ install -c -m 0755 qemu-ga ${RPM_BUILD_ROOT}%{_bindir}/qemu-ga %config(noreplace) %{_sysconfdir}/sysconfig/qemu-ga %{_sysconfdir}/qemu-ga %{_datadir}/%{pkgname}/qemu-ga + %{_mandir}/man8/qemu-ga.8* %dir %{_localstatedir}/log/qemu-ga %changelog -* Fri Sep 11 2015 Miroslav Rezanina <mrezanin@redhat.com> - 2.3.0-4.el7 -- qemuga-qga-fail-early-for-invalid-time.patch [bz#1224023] -- Resolves: bz#1224023 - (The hwclock and systemclock of guest should be ccoincident while set a invalid domtime with guest agent) +* Thu Sep 01 2016 Miroslav Rezanina <mrezanin@redhat.com> - 2.5.0-3.el7 +- qemuga-spec-add-qemu-ga-man-page.patch [bz#1101556] +- Resolves: bz#1101556 + ([RFE] qemu-ga should have a config file) + +* Wed Jun 15 2016 Miroslav Rezanina <mrezanin@redhat.com> - 2.5.0-2.el7 +- qemuga-redhat-blacklist-guest-exec-commands.patch [bz#1340346] +- Resolves: bz#1340346 + (blacklist guest-exec in newer version of qemu-guest-agent) + +* Tue Jan 12 2016 Miroslav Rezanina <mrezanin@redhat.com> - 2.5.0-1.el7 +- Rebase to QEMU 2.5.0 [bz#1297673] +- Resolves: bz#1297673 + (Rebase to QEMU 2.5) * Tue Aug 25 2015 Miroslav Rezanina <mrezanin@redhat.com> - 2.3.0-3.el7 - qemuga-Do-not-stop-qemu-guest-agent-service-on-target-switc.patch [bz#1160930]