From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [PATCH 1/2] pci-assign: Re-order initfn for memory API Date: Wed, 21 Sep 2011 21:12:36 -0600 Message-ID: <20110922031236.4121.62055.stgit@s20.home> References: <20110922030909.4121.66872.stgit@s20.home> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: jan.kiszka@siemens.com, avi@redhat.com, yongjie.ren@intel.com, alex.williamson@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58119 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751872Ab1IVDMk (ORCPT ); Wed, 21 Sep 2011 23:12:40 -0400 In-Reply-To: <20110922030909.4121.66872.stgit@s20.home> Sender: kvm-owner@vger.kernel.org List-ID: We now need to scan PCI capabilities and setup an MSI-X page before we walk the device resources since the overlay is now setup during init instead of at the first mapping by the guest. Signed-off-by: Alex Williamson --- hw/device-assignment.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 288f80c..93913b3 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1603,6 +1603,14 @@ static int assigned_initfn(struct PCIDevice *pci_dev) goto out; } + if (assigned_device_pci_cap_init(pci_dev) < 0) + goto out; + + /* intercept MSI-X entry page in the MMIO */ + if (dev->cap.available & ASSIGNED_DEVICE_CAP_MSIX) + if (assigned_dev_register_msix_mmio(dev)) + goto out; + /* handle real device's MMIO/PIO BARs */ if (assigned_dev_register_regions(dev->real_device.regions, dev->real_device.region_number, @@ -1618,9 +1626,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev) dev->h_busnr = dev->host.bus; dev->h_devfn = PCI_DEVFN(dev->host.dev, dev->host.func); - if (assigned_device_pci_cap_init(pci_dev) < 0) - goto out; - /* assign device to guest */ r = assign_device(dev); if (r < 0) @@ -1631,11 +1636,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev) if (r < 0) goto assigned_out; - /* intercept MSI-X entry page in the MMIO */ - if (dev->cap.available & ASSIGNED_DEVICE_CAP_MSIX) - if (assigned_dev_register_msix_mmio(dev)) - goto assigned_out; - assigned_dev_load_option_rom(dev); QLIST_INSERT_HEAD(&devs, dev, next);