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

Re: [Xen-devel] [PATCH] libxl: passthrough: avoid passing through devices not owned by pciback



On Fri, Mar 23, 2012 at 2:47 AM, Hao, Xudong <xudong.hao@xxxxxxxxx> wrote:
>> On a different (but related) note, it appears that libxl doesn't have the
>> pci-quirks functionality that xend has.  Do you know if this is still 
>> needed, if it's
>> in the pvops tree and needs to be upstreamed?
>> Is anyone at Intel working on libxl pci-quirks support for the 4.2 release?
>>
> We did not see any Intel pci device need quirk in libxl till now, so maybe no 
> plan for libxl pci-quirks support for the 4.2 release.

FWIW, I did see a quirk on the following Intel NIC (don't have the
details of the warning message handy):

07:00.0 Ethernet controller [0200]: Intel Corporation 82575GB Gigabit
Network Connection [8086:10d6] (rev 02)

But given the proximity to the 4.2 release, it would make perfect
sense to wait for 4.3.  I'm going to try to implement a per-device
"permissive" feature in libxl which should tide us over.

 -George

>
>>  -George
>>
>> >
>> > Signed-off-by: Allen Kay <allen.m.kay@xxxxxxxxx>
>> > Signed-off-by: Xudong Hao <xudong.hao@xxxxxxxxx>
>> >
>> > diff -r 4e1d091d10d8 tools/libxl/libxl_pci.c
>> > --- a/tools/libxl/libxl_pci.c   Fri Mar 16 15:24:25 2012 +0000
>> > +++ b/tools/libxl/libxl_pci.c   Thu Mar 22 00:43:14 2012 +0800
>> > @@ -779,6 +779,24 @@ int libxl_device_pci_add(libxl_ctx *ctx,
>> >     return rc;
>> >  }
>> >
>> > +static int libxl_pcidev_assignable(libxl_ctx *ctx, libxl_device_pci
>> > +*pcidev) {
>> > +    libxl_device_pci *pcidevs;
>> > +    int num, i;
>> > +
>> > +    pcidevs = libxl_device_pci_list_assignable(ctx, &num);
>> > +    for (i = 0; i < num; i++) {
>> > +        if (pcidevs[i].domain == pcidev->domain &&
>> > +            pcidevs[i].bus == pcidev->bus &&
>> > +            pcidevs[i].dev == pcidev->dev &&
>> > +            pcidevs[i].func == pcidev->func)
>> > +        {
>> > +            return 1;
>> > +        }
>> > +    }
>> > +    return 0;
>> > +}
>> > +
>> >  int libxl__device_pci_add(libxl__gc *gc, uint32_t domid,
>> > libxl_device_pci *pcidev, int starting)  {
>> >     libxl_ctx *ctx = libxl__gc_owner(gc); @@ -789,6 +807,13 @@ int
>> > libxl__device_pci_add(libxl__gc *gc,
>> >
>> >     rc = libxl__device_pci_setdefault(gc, pcidev);
>> >     if (rc) goto out;
>> > +
>> > +    if (!libxl_pcidev_assignable(ctx, pcidev)) {
>> > +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device %x:%x:%x.%x
>> is
>> > + not assignable",
>> > +                   pcidev->domain, pcidev->bus, pcidev->dev,
>> > + pcidev->func);
>> > +        rc = ERROR_FAIL;
>> > +        goto out;
>> > +    }
>> >
>> >     rc = get_all_assigned_devices(gc, &assigned, &num_assigned);
>> >     if ( rc ) {
>> >
>> > _______________________________________________
>> > Xen-devel mailing list
>> > Xen-devel@xxxxxxxxxxxxx
>> > http://lists.xen.org/xen-devel
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
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®.