pci_bridge: use parent bus's address space
authorWen Congyang <wency@cn.fujitsu.com>
Fri, 26 Aug 2011 10:00:33 +0000 (13:00 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 19 Sep 2011 18:22:30 +0000 (21:22 +0300)
The switch to the new memory API caused the following problem:

The pci device may call pci_register_bar() to use PCI bus's address
space.  But we don't init PCI bus's address space if it is not bus
0.  A crash was reported:
http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02243.html

More work will be needed to make bridge filtering work correctly
with the memory API.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci_bridge.c

index 464d89708f95a4a67ba9891aef17ad4add014c49..e0b339edb0fb6af9b5eb690d9b376ecedcdd83ba 100644 (file)
@@ -246,6 +246,9 @@ int pci_bridge_initfn(PCIDevice *dev)
                         br->bus_name);
     sec_bus->parent_dev = dev;
     sec_bus->map_irq = br->map_irq;
+    /* TODO: use memory API to perform memory filtering. */
+    sec_bus->address_space_mem = parent->address_space_mem;
+    sec_bus->address_space_io = parent->address_space_io;
 
     QLIST_INIT(&sec_bus->child);
     QLIST_INSERT_HEAD(&parent->child, sec_bus, sibling);