WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 3 of 3] xl, check a PCI device is assignable befo

To: "Gianni Tedesco (3P)" <gianni.tedesco@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 3 of 3] xl, check a PCI device is assignable before adding it to a domU
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 28 Jul 2010 18:41:07 +0100
Cc: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 28 Jul 2010 10:41:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <dbfc4f30efe216dbc1ec.1280247873@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1280247870@xxxxxxxxxxxxxxxxxxxxxx> <dbfc4f30efe216dbc1ec.1280247873@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Tue, 27 Jul 2010, Gianni Tedesco (3P) wrote:
>  tools/libxl/libxl_pci.c |  11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> 
> This prevents PCI devices from being added multiply to the same domain
> or multiple different domains simultaneously.

Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

> 
> diff -r 214733749470 -r dbfc4f30efe2 tools/libxl/libxl_pci.c
> --- a/tools/libxl/libxl_pci.c Tue Jul 27 17:17:31 2010 +0100
> +++ b/tools/libxl/libxl_pci.c Tue Jul 27 17:18:44 2010 +0100
> @@ -334,8 +334,17 @@ int libxl_device_pci_add(struct libxl_ct
>      char *state, *vdevfn;
>      int rc, hvm;
>      int stubdomid = 0;
> +    libxl_device_pci *assigned;
> +    int num_assigned;
>  
> -    /* TODO: check if the device can be assigned */
> +    assigned = get_all_assigned_devices(ctx, &num_assigned);
> +    if ( is_assigned(assigned, num_assigned, pcidev->domain,
> +                     pcidev->bus, pcidev->dev, pcidev->func) ) {
> +        XL_LOG(ctx, XL_LOG_ERROR, "PCI device already attached to a domain");
> +        free(assigned);
> +        return ERROR_FAIL;
> +    }
> +    free(assigned);
>  
>      libxl_device_pci_reset(ctx, pcidev->domain, pcidev->bus, pcidev->dev, 
> pcidev->func);
>  
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel