Skip to contentSkip to conversation

xhci PCIe endpoint migration compatibility fix

GIT PULL Applied Gerd Hoffmann 2 participants 3 messages Sep 10, 2014 – Sep 11, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

Qemu 2.1.1 release is delayed a bit, so I have the chance to squeeze in a last-minute fix for a migration compatibility bug in xhci.

please pull,
Gerd

The following changes since commit f102f224556f292f55b6e25147741bb8c48c9451:

Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-peter' into staging (2014-09-05 16:03:56 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-usb-20140910-1

for you to fetch changes up to e6043e92c2812a56b8f6cf35d5512067c746ce21:

xhci PCIe endpoint migration compatibility fix (2014-09-10 07:20:53 +0200)

----------------------------------------------------------------
xhci PCIe endpoint migration compatibility fix

----------------------------------------------------------------
Dr. David Alan Gilbert (1):
xhci PCIe endpoint migration compatibility fix

 hw/usb/hcd-xhci.c    | 6 +++++-
 include/hw/i386/pc.h | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
#1 lore raw

From: "Dr. David Alan Gilbert" <[email protected]>

Add back the PCIe config capabilities on XHCI cards in non-PCIe slots, but only for machine types before 2.1.

This fixes a migration incompatibility in the XHCI PCI devices caused by:
058fdcf52cdbf57b67e7 - xhci: add endpoint cap on express bus only

Note that in fixing it for compatibility with older QEMUs, it breaks compatibility with existing QEMU 2.1's on older machine types.

The status before this patch was (if it used an XHCI adapter):
machine type | source qemu

     any           pre-2.1     - FAIL
     any           2.1...      - PASS

With this patch:
machine type | source qemu

     any           pre-2.1    - PASS
     pre-2.1       2.1...     - FAIL
     2.1           2.1...     - PASS

A test to trigger it is to add '-device nec-usb-xhci,id=xhci,addr=0x12' to the command line.

---
 hw/usb/hcd-xhci.c    | 6 +++++-
 include/hw/i386/pc.h | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
hw/usb/hcd-xhci.c +5 -1
index bbe4c5f..73ced1f 100644
@@ -499,6 +499,7 @@ enum xhci_flags {
     XHCI_FLAG_USE_MSI = 1,
     XHCI_FLAG_USE_MSI_X,
     XHCI_FLAG_SS_FIRST,
+    XHCI_FLAG_FORCE_PCIE_ENDCAP,
 };
 
 static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
@@ -3626,7 +3627,8 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
                      PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64,
                      &xhci->mem);
 
-    if (pci_bus_is_express(dev->bus)) {
+    if (pci_bus_is_express(dev->bus) ||
+        xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
         ret = pcie_endpoint_cap_init(dev, 0xa0);
         assert(ret >= 0);
     }
@@ -3855,6 +3857,8 @@ static Property xhci_properties[] = {
     DEFINE_PROP_BIT("msix",     XHCIState, flags, XHCI_FLAG_USE_MSI_X, true),
     DEFINE_PROP_BIT("superspeed-ports-first",
                     XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
+    DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
+                    XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
     DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
     DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
     DEFINE_PROP_UINT32("p2",    XHCIState, numports_2, 4),
include/hw/i386/pc.h +5 -0
index a39cb42..77316d5 100644
@@ -330,6 +330,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .value    = "off",\
         },\
         {\
+            .driver   = "nec-usb-xhci",\
+            .property = "force-pcie-endcap",\
+            .value    = "on",\
+        },\
+        {\
             .driver   = "pci-serial",\
             .property = "prog_if",\
             .value    = stringify(0),\
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Gerd Hoffmann
Quoted 24 lines · Gerd Hoffmann

Hi,

Qemu 2.1.1 release is delayed a bit, so I have the chance to squeeze in a last-minute fix for a migration compatibility bug in xhci.

please pull,
Gerd

The following changes since commit f102f224556f292f55b6e25147741bb8c48c9451:

Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-peter' into staging (2014-09-05 16:03:56 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-usb-20140910-1

for you to fetch changes up to e6043e92c2812a56b8f6cf35d5512067c746ce21:

xhci PCIe endpoint migration compatibility fix (2014-09-10 07:20:53 +0200)

----------------------------------------------------------------
xhci PCIe endpoint migration compatibility fix

Quoted 7 lines

----------------------------------------------------------------
Dr. David Alan Gilbert (1):
xhci PCIe endpoint migration compatibility fix

 hw/usb/hcd-xhci.c    | 6 +++++-
 include/hw/i386/pc.h | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

Applied, thanks.

-- PMM