From: Paul Durrant <pdurr...@amazon.com>

Commit babde47a "introduce a 'passthrough' configuration option to xl.cfg..."
added a check to xl_parse.c:parse_config_data() to make sure that an IOMMU
was present and enabled in the system before allowing devices to be passed
through to a guest. This check was then subsequently moved into
libxl_create.c:libxl__domain_config_setdefault() by commit ad011ad0 "libxl/xl:
Overhaul passthrough setting logic".

Prior to this check being added, it was possible (although not in any way safe
or supported) to pass devices through to a PV guest without an IOMMU being
enabled in the system. This patch relaxes the check for PV guests to restore
that possibility, emitting a warning instead.

Signed-off-by: Paul Durrant <pdurr...@amazon.com>
---
Cc: Ian Jackson <ian.jack...@eu.citrix.com>
Cc: Wei Liu <w...@xen.org>A
Cc: Anthony PERARD <anthony.per...@citrix.com>

This patch ought to be in 4.14 as it as very obvious change, restoring lost
functionality that has affected a user.
---
 tools/libxl/libxl_create.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 2814818e34..f1d17cfb87 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1104,10 +1104,14 @@ int libxl__domain_config_setdefault(libxl__gc *gc,
 
     bool iommu_enabled = physinfo.cap_hvm_directio;
     if (c_info->passthrough != LIBXL_PASSTHROUGH_DISABLED && !iommu_enabled) {
-        LOGD(ERROR, domid,
-             "passthrough not supported on this platform\n");
-        ret = ERROR_INVAL;
-        goto error_out;
+        if (c_info->type != LIBXL_DOMAIN_TYPE_PV) {
+            LOGD(ERROR, domid,
+                 "passthrough not supported on this platform\n");
+            ret = ERROR_INVAL;
+            goto error_out;
+        }
+        LOGD(WARN, domid,
+             "passthrough is enabled but IOMMU is not present/enabled\n");
     }
 
     if (c_info->passthrough == LIBXL_PASSTHROUGH_DISABLED && need_pt) {
-- 
2.20.1


Reply via email to