Allow PCI passthrough to PV guest without IOMMU
authorMihir Nanavati <mihirn@cs.ubc.ca>
Tue, 3 Aug 2010 16:14:06 +0000 (17:14 +0100)
committerMihir Nanavati <mihirn@cs.ubc.ca>
Tue, 3 Aug 2010 16:14:06 +0000 (17:14 +0100)
Added a check which allows adding and removal of PCI devices for PV
guests in the absence of an IOMMU.

Signed-off-by: Mihir Nanavati <mihirn@cs.ubc.ca>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
tools/libxl/libxl_pci.c

index a4ae74bae0595d9c26917160ee5170fe2f9d5b1b..98b49a2f307f4a4043a43afab1225f496b311996 100644 (file)
@@ -416,7 +416,7 @@ static int do_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev)
 out:
     if (!libxl_is_stubdom(ctx, domid, NULL)) {
         rc = xc_assign_device(ctx->xch, domid, pcidev->value);
-        if (rc < 0) {
+        if (rc < 0 && (hvm || errno != ENOSYS)) {
             XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_assign_device failed");
             return ERROR_FAIL;
         }
@@ -541,7 +541,7 @@ out:
 
     if (!libxl_is_stubdom(ctx, domid, NULL)) {
         rc = xc_deassign_device(ctx->xch, domid, pcidev->value);
-        if (rc < 0)
+        if (rc < 0 && (hvm || errno != ENOSYS))
             XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_deassign_device failed");
     }