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
|