[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 3/4] xen: Add usage of device listener interface for PCI to PCI bridges
Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> CC: Don Slutz <don.slutz@xxxxxxxxx> --- include/hw/xen/xen_common.h | 10 ++++++---- xen-hvm.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 38f29fb..6579b78 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -229,7 +229,8 @@ static inline void xen_map_pcidev(XenXC xc, domid_t dom, static inline void xen_unmap_pcidev(XenXC xc, domid_t dom, ioservid_t ioservid, - PCIDevice *pci_dev) + PCIDevice *pci_dev, + uint8_t oldbus) { } @@ -357,12 +358,13 @@ static inline void xen_map_pcidev(XenXC xc, domid_t dom, static inline void xen_unmap_pcidev(XenXC xc, domid_t dom, ioservid_t ioservid, - PCIDevice *pci_dev) + PCIDevice *pci_dev, + uint8_t oldbus) { - trace_xen_unmap_pcidev(ioservid, pci_bus_num(pci_dev->bus), + trace_xen_unmap_pcidev(ioservid, oldbus, PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid, - 0, pci_bus_num(pci_dev->bus), + 0, oldbus, PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); } diff --git a/xen-hvm.c b/xen-hvm.c index 42356b8..7b6d8f1 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -590,10 +590,20 @@ static void xen_device_unrealize(DeviceListener *listener, if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { PCIDevice *pci_dev = PCI_DEVICE(dev); - xen_unmap_pcidev(xen_xc, xen_domid, state->ioservid, pci_dev); + xen_unmap_pcidev(xen_xc, xen_domid, state->ioservid, pci_dev, + pci_bus_num(pci_dev->bus)); } } +static void xen_device_change_pci_bus_num(DeviceListener *listener, + PCIDevice *pci_dev, uint8_t oldbus) +{ + XenIOState *state = container_of(listener, XenIOState, device_listener); + + xen_unmap_pcidev(xen_xc, xen_domid, state->ioservid, pci_dev, oldbus); + xen_map_pcidev(xen_xc, xen_domid, state->ioservid, pci_dev); +} + static void xen_sync_dirty_bitmap(XenIOState *state, hwaddr start_addr, ram_addr_t size) @@ -709,6 +719,7 @@ static MemoryListener xen_io_listener = { static DeviceListener xen_device_listener = { .realize = xen_device_realize, .unrealize = xen_device_unrealize, + .change_pci_bus_num = xen_device_change_pci_bus_num, }; /* get the ioreq packets from share mem */ -- 1.8.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |