Skip to contentSkip to conversation

Fix pci bus-master & ehci migration

PATCH New Hans de Goede 1 participant 3 messages Nov 8, 2012

lore
Share & tools
lore
#0 lore raw

cover Fix pci bus-master & ehci migration

Not sure if this should go in through your USB tree, as this also touched PCI in general, but my ehci migration troubles were the reason I wrote this...

Regards,

Hans

#1 lore raw

PATCH 1/2 ehci-pci: Fix crash on migration / migration not working

---
 hw/usb/hcd-ehci-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/hcd-ehci-pci.c +2 -1
index d5c7d46..fe45a1f 100644
@@ -91,6 +91,7 @@ static const VMStateDescription vmstate_ehci_pci = {
     .fields      = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(pcidev, EHCIPCIState),
         VMSTATE_STRUCT(ehci, EHCIPCIState, 2, vmstate_ehci, EHCIState),
+        VMSTATE_END_OF_LIST()
     }
 };
 
@@ -105,7 +106,7 @@ static void ehci_class_init(ObjectClass *klass, void *data)
     k->device_id = i->device_id;
     k->revision = i->revision;
     k->class_id = PCI_CLASS_SERIAL_USB;
-    dc->vmsd = &vmstate_ehci;
+    dc->vmsd = &vmstate_ehci_pci;
     dc->props = ehci_pci_properties;
 }
 
Signature · 1 line
1.7.12.1
#2 lore raw

PATCH 2/2 pci: Restore bus-master memory mapping state after migration

This fixes dma reads / writes from pci-devices no longer working after migration.

---
 hw/pci.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/pci.c +4 -0
index dceda0b..6666651 100644
@@ -367,6 +367,10 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
 
     pci_update_mappings(s);
 
+    memory_region_set_enabled(&s->bus_master_enable_region,
+                              pci_get_word(s->config + PCI_COMMAND)
+                                & PCI_COMMAND_MASTER);
+
     g_free(config);
     return 0;
 }
Signature · 1 line
1.7.12.1