Blame SOURCES/0030-usb-xhci-Fix-PCI-capability-order.patch

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