[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] xen PV passthru: assign SR-IOV virtual functions to separate virtual slots



>>> On 17.10.12 at 11:55, Laszlo Ersek <lersek@xxxxxxxxxx> 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 <lersek@xxxxxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

> ---
> v1->v2:
> * avoid extra indentation
> * make sure virtual functions are assigned with func=0
> 
>  drivers/xen/xen-pciback/vpci.c |   14 ++++++++++----
>  1 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c
> index 46d140b..0f478ac 100644
> --- a/drivers/xen/xen-pciback/vpci.c
> +++ b/drivers/xen/xen-pciback/vpci.c
> @@ -89,9 +89,15 @@ 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])) {
> +     /*
> +      * 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]))
> +                             continue;
> +
>                       t = list_entry(list_first(&vpci_dev->dev_list[slot]),
>                                      struct pci_dev_entry, list);
>  
> @@ -116,7 +122,7 @@ static int __xen_pcibk_add_pci_dev(struct 
> xen_pcibk_device *pdev,
>                              pci_name(dev), slot);
>                       list_add_tail(&dev_entry->list,
>                                     &vpci_dev->dev_list[slot]);
> -                     func = PCI_FUNC(dev->devfn);
> +                     func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn);
>                       goto unlock;
>               }
>       }
> -- 
> 1.7.1




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.