]> xenbits.xensource.com Git - people/jgross/xen.git/commitdiff
xen/domctl: Introduce and use XEN_DOMCTL_CDF_nested_virt
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 28 Aug 2018 14:30:14 +0000 (14:30 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 6 Oct 2020 11:28:37 +0000 (12:28 +0100)
Like other major areas of functionality, nested virt (or not) needs to be
known at domain creation time for sensible CPUID handling, and wants to be
known this early for sensible infrastructure handling in Xen.

Introduce XEN_DOMCTL_CDF_nested_virt and modify libxl to set it appropriately
when creating domains.  There is no need to adjust the ARM logic to reject the
use of this new flag.

No functional change yet.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wl@xen.org>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/libs/light/libxl_create.c
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
xen/arch/x86/domain.c
xen/common/domain.c
xen/include/public/domctl.h

index df31a421244feea0d872fb25a99a40367cfc6707..321a13e519b5b71fb684bd6d196d5cd684c72c67 100644 (file)
@@ -617,6 +617,9 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
 
             if ( !libxl_defbool_val(info->oos) )
                 create.flags |= XEN_DOMCTL_CDF_oos_off;
+
+            if ( libxl_defbool_val(b_info->nested_hvm) )
+                create.flags |= XEN_DOMCTL_CDF_nested_virt;
         }
 
         assert(info->passthrough != LIBXL_PASSTHROUGH_DEFAULT);
index 497ded7ce26b7434b3db5cbe54aac352f3ec089e..e878699b0a1aa9338c02b0e8d550106790326d64 100644 (file)
@@ -64,6 +64,7 @@ type domain_create_flag =
        | CDF_OOS_OFF
        | CDF_XS_DOMAIN
        | CDF_IOMMU
+       | CDF_NESTED_VIRT
 
 type domain_create_iommu_opts =
        | IOMMU_NO_SHAREPT
index f7f6ec570dfeaaa963cf67d29104d35cdb79d7d5..e64907df8e7e4e56b4d11233cb43bce30c91f64c 100644 (file)
@@ -57,6 +57,7 @@ type domain_create_flag =
   | CDF_OOS_OFF
   | CDF_XS_DOMAIN
   | CDF_IOMMU
+  | CDF_NESTED_VIRT
 
 type domain_create_iommu_opts =
   | IOMMU_NO_SHAREPT
index d8f9be132cdbab39e3bacda01aba44655af42f65..5454f94d18a0f7d72bbcec8b0449cd783f864617 100644 (file)
@@ -630,6 +630,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
 {
     bool hvm = config->flags & XEN_DOMCTL_CDF_hvm;
     bool hap = config->flags & XEN_DOMCTL_CDF_hap;
+    bool nested_virt = config->flags & XEN_DOMCTL_CDF_nested_virt;
     unsigned int max_vcpus;
 
     if ( hvm ? !hvm_enabled : !IS_ENABLED(CONFIG_PV) )
@@ -667,6 +668,12 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
          */
         config->flags |= XEN_DOMCTL_CDF_oos_off;
 
+    if ( nested_virt && !hap )
+    {
+        dprintk(XENLOG_INFO, "Nested virt not supported without HAP\n");
+        return -EINVAL;
+    }
+
     return 0;
 }
 
index a877eacc09a2157f9cfb4393d53ccdac0f47ccf4..f748806a450ba8fceb426f317f1e1822f58e04c7 100644 (file)
@@ -303,12 +303,11 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
     bool hap = config->flags & XEN_DOMCTL_CDF_hap;
     bool iommu = config->flags & XEN_DOMCTL_CDF_iommu;
 
-    if ( config->flags & ~(XEN_DOMCTL_CDF_hvm |
-                           XEN_DOMCTL_CDF_hap |
-                           XEN_DOMCTL_CDF_s3_integrity |
-                           XEN_DOMCTL_CDF_oos_off |
-                           XEN_DOMCTL_CDF_xs_domain |
-                           XEN_DOMCTL_CDF_iommu) )
+    if ( config->flags &
+         ~(XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap |
+           XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off |
+           XEN_DOMCTL_CDF_xs_domain | XEN_DOMCTL_CDF_iommu |
+           XEN_DOMCTL_CDF_nested_virt) )
     {
         dprintk(XENLOG_INFO, "Unknown CDF flags %#x\n", config->flags);
         return -EINVAL;
index 791f0a2592a008a8d23d3196d70c1bf492b1af3e..666aeb71bf1b3708530eed255ff33e2e5b89d8b2 100644 (file)
@@ -68,9 +68,11 @@ struct xen_domctl_createdomain {
  /* Should this domain be permitted to use the IOMMU? */
 #define _XEN_DOMCTL_CDF_iommu         5
 #define XEN_DOMCTL_CDF_iommu          (1U<<_XEN_DOMCTL_CDF_iommu)
+#define _XEN_DOMCTL_CDF_nested_virt   6
+#define XEN_DOMCTL_CDF_nested_virt    (1U << _XEN_DOMCTL_CDF_nested_virt)
 
 /* Max XEN_DOMCTL_CDF_* constant.  Used for ABI checking. */
-#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_iommu
+#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_nested_virt
 
     uint32_t flags;