|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] libxl: Simplify cleanup in do_pci_remove()
Calls to xc_physdev_unmap_pirq() will fail for HVM guests since QEMU
makes the same call earlier, during device removal.
In addition, guest's call to xc_domain_irq_permission() will also fail
since clearing permissions is part of hypervisor's unmap_domain_pirq().
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
tools/libxl/libxl_pci.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 4c6a733..d5d7cc0 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1310,24 +1310,26 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid,
}
fclose(f);
skip1:
- sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq",
pcidev->domain,
- pcidev->bus, pcidev->dev, pcidev->func);
- f = fopen(sysfs_path, "r");
- if (f == NULL) {
- LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s",
sysfs_path);
- goto out;
- }
- if ((fscanf(f, "%u", &irq) == 1) && irq) {
- rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
- if (rc < 0) {
- LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_physdev_unmap_pirq
irq=%d", irq);
+ if (!hvm) {
+ sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq",
+ pcidev->domain,
+ pcidev->bus, pcidev->dev,
+ pcidev->func);
+ f = fopen(sysfs_path, "r");
+ if (f == NULL) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+ "Couldn't open %s", sysfs_path);
+ goto out;
}
- rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
- if (rc < 0) {
- LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
"xc_domain_irq_permission irq=%d", irq);
+ if ((fscanf(f, "%u", &irq) == 1) && irq) {
+ rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
+ if (rc < 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+ "xc_physdev_unmap_pirq irq=%d", irq);
+ }
}
+ fclose(f);
}
- fclose(f);
}
out:
/* don't do multiple resets while some functions are still passed through
*/
--
1.7.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |