From: "Jan Beulich" Subject: Re: [PATCH] xen PV passthru: assign SR-IOV virtual functions to separate virtual slots Date: Wed, 17 Oct 2012 08:13:32 +0100 Message-ID: <507E76BC02000078000A1DCD@nat28.tlf.novell.com> References: <507D7240.2010305@citrix.com> <1350408986-10891-1-git-send-email-lersek@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1350408986-10891-1-git-send-email-lersek@redhat.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Laszlo Ersek Cc: andrew.cooper3@citrix.com, jeremy@goop.org, konrad.wilk@oracle.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 16.10.12 at 19:36, Laszlo Ersek wrote: > VFs are reported as single-function devices in PCI_HEADER_TYPE, which > causes pci_scan_slot() in the PV domU to skip all VFs beyond #0 in the > pciback-provided slot. Avoid this by assigning each VF to a separate > virtual slot. > > Signed-off-by: Laszlo Ersek > --- > drivers/xen/xen-pciback/vpci.c | 35 ++++++++++++++++++++--------------- > 1 files changed, 20 insertions(+), 15 deletions(-) > > diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c > index 46d140b..489404a 100644 > --- a/drivers/xen/xen-pciback/vpci.c > +++ b/drivers/xen/xen-pciback/vpci.c > @@ -89,21 +89,26 @@ static int __xen_pcibk_add_pci_dev(struct > xen_pcibk_device *pdev, > > mutex_lock(&vpci_dev->lock); > > - /* Keep multi-function devices together on the virtual PCI bus */ > - for (slot = 0; slot < PCI_SLOT_MAX; slot++) { > - if (!list_empty(&vpci_dev->dev_list[slot])) { > - t = list_entry(list_first(&vpci_dev->dev_list[slot]), > - struct pci_dev_entry, list); > - > - if (match_slot(dev, t->dev)) { > - pr_info(DRV_NAME ": vpci: %s: " > - "assign to virtual slot %d func %d\n", > - pci_name(dev), slot, > - PCI_FUNC(dev->devfn)); > - list_add_tail(&dev_entry->list, > - &vpci_dev->dev_list[slot]); > - func = PCI_FUNC(dev->devfn); > - goto unlock; > + /* > + * Keep multi-function devices together on the virtual PCI bus, except > + * virtual functions. > + */ > + if (!dev->is_virtfn) { > + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { > + if (!list_empty(&vpci_dev->dev_list[slot])) { To keep indentation reasonable (and shrink the patch size at once), could you use if (list_empty(&vpci_dev->dev_list[slot])) continue; here instead? Or alternatively tweak the for() above to embed the if()'s condition there? Jan > + t = list_entry(list_first(&vpci_dev->dev_list[slot]), > + struct pci_dev_entry, list); > + > + if (match_slot(dev, t->dev)) { > + pr_info(DRV_NAME ": vpci: %s: " > + "assign to virtual slot %d func %d\n", > + pci_name(dev), slot, > + PCI_FUNC(dev->devfn)); > + list_add_tail(&dev_entry->list, > + &vpci_dev->dev_list[slot]); > + func = PCI_FUNC(dev->devfn); > + goto unlock; > + } > } > } > } > -- > 1.7.1 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel