diff mbox series

[for,4.14] libxl: allow passthrough to PV guests regardless of whether IOMMU is enabled

Message ID 20200619073315.8414-1-paul@xen.org (mailing list archive)
State New, archived
Headers show
Series [for,4.14] libxl: allow passthrough to PV guests regardless of whether IOMMU is enabled | expand

Commit Message

Paul Durrant June 19, 2020, 7:33 a.m. UTC
From: Paul Durrant <pdurrant@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 <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>A
Cc: Anthony PERARD <anthony.perard@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(-)

Comments

Ian Jackson June 19, 2020, 3:25 p.m. UTC | #1
Paul Durrant writes ("[PATCH for 4.14] libxl: allow passthrough to PV guests regardless of whether IOMMU is enabled"):
> From: Paul Durrant <pdurrant@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.

Thanks.

Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

I think this patch could have
  Reported-by: Patrik HornĂ­k <patrik@hornik.sk>
Patrik, if we put your credit in like this it will be permanently
recorded in our git history, as part of our code traceability etc.
Please let us know what you would prefer.

> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wl@xen.org>A
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> 
> This patch ought to be in 4.14 as it as very obvious change, restoring lost
> functionality that has affected a user.

Thanks.  I'll take that as a release-ack :-).

Also, I will add this tag too when I commit this:

Backport: 4.13+

Ian.
diff mbox series

Patch

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) {