Message ID | 20201124080159.11912-10-paul@xen.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xl / libxl: named PCI pass-through devices | expand |
Hi, Paul! On 11/24/20 10:01 AM, Paul Durrant wrote: > From: Paul Durrant <pdurrant@amazon.com> > > The code currently checks explicitly whether the device is already assigned, > but this is actually unnecessary as assigned devices do not form part of > the list returned by libxl_device_pci_assignable_list() and hence the > libxl_pci_assignable() test would have already failed. > > Signed-off-by: Paul Durrant <pdurrant@amazon.com> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Thank you, Oleksandr > --- > Cc: Ian Jackson <iwj@xenproject.org> > Cc: Wei Liu <wl@xen.org> > --- > tools/libs/light/libxl_pci.c | 16 +--------------- > 1 file changed, 1 insertion(+), 15 deletions(-) > > diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c > index a5d5d2e78b..ec101f255f 100644 > --- a/tools/libs/light/libxl_pci.c > +++ b/tools/libs/light/libxl_pci.c > @@ -1555,8 +1555,7 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid, > { > STATE_AO_GC(aodev->ao); > libxl_ctx *ctx = libxl__gc_owner(gc); > - libxl_device_pci *assigned; > - int num_assigned, rc; > + int rc; > int stubdomid = 0; > pci_add_state *pas; > > @@ -1595,19 +1594,6 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid, > goto out; > } > > - rc = get_all_assigned_devices(gc, &assigned, &num_assigned); > - if ( rc ) { > - LOGD(ERROR, domid, > - "cannot determine if device is assigned, refusing to continue"); > - goto out; > - } > - if ( is_pci_in_array(assigned, num_assigned, pci->domain, > - pci->bus, pci->dev, pci->func) ) { > - LOGD(ERROR, domid, "PCI device already attached to a domain"); > - rc = ERROR_FAIL; > - goto out; > - } > - > libxl__device_pci_reset(gc, pci->domain, pci->bus, pci->dev, pci->func); > > stubdomid = libxl_get_stubdom_id(ctx, domid);
diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c index a5d5d2e78b..ec101f255f 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -1555,8 +1555,7 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid, { STATE_AO_GC(aodev->ao); libxl_ctx *ctx = libxl__gc_owner(gc); - libxl_device_pci *assigned; - int num_assigned, rc; + int rc; int stubdomid = 0; pci_add_state *pas; @@ -1595,19 +1594,6 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid, goto out; } - rc = get_all_assigned_devices(gc, &assigned, &num_assigned); - if ( rc ) { - LOGD(ERROR, domid, - "cannot determine if device is assigned, refusing to continue"); - goto out; - } - if ( is_pci_in_array(assigned, num_assigned, pci->domain, - pci->bus, pci->dev, pci->func) ) { - LOGD(ERROR, domid, "PCI device already attached to a domain"); - rc = ERROR_FAIL; - goto out; - } - libxl__device_pci_reset(gc, pci->domain, pci->bus, pci->dev, pci->func); stubdomid = libxl_get_stubdom_id(ctx, domid);