xen/domctl: Introduce XEN_DOMCTL_CDF_vpci flag
authorRahul Singh <rahul.singh@arm.com>
Wed, 6 Oct 2021 17:40:33 +0000 (18:40 +0100)
committerStefano Stabellini <stefano.stabellini@xilinx.com>
Thu, 7 Oct 2021 19:47:25 +0000 (12:47 -0700)
Introduce XEN_DOMCTL_CDF_vpci flag to enable VPCI support in XEN.
Reject the use of this new flag for x86 as VPCI is not supported for
DOMU guests for x86.

Signed-off-by: Rahul Singh <rahul.singh@arm.com>
[stefano: drop _XEN_DOMCTL_CDF_vpci]
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
xen/arch/arm/domain.c
xen/arch/x86/domain.c
xen/common/domain.c
xen/include/public/domctl.h

index a5588c643f230814f8c5955d9151484ca28eb9ca..7ed1c00e473786b1dbfb5f3e5e0492987b7a6db2 100644 (file)
@@ -69,6 +69,7 @@ type domain_create_flag =
        | CDF_XS_DOMAIN
        | CDF_IOMMU
        | CDF_NESTED_VIRT
+       | CDF_VPCI
 
 type domain_create_iommu_opts =
        | IOMMU_NO_SHAREPT
index 6e94940a8a95402745acbb11937559a5b0a2b4c8..391d4abdf8fe0562c8ebc31f53ee05b5a9cf65d7 100644 (file)
@@ -62,6 +62,7 @@ type domain_create_flag =
   | CDF_XS_DOMAIN
   | CDF_IOMMU
   | CDF_NESTED_VIRT
+  | CDF_VPCI
 
 type domain_create_iommu_opts =
   | IOMMU_NO_SHAREPT
index 19c756ac3d4600af5de499dd78b0a4a95389ba15..36138c1b2ef374a4525ddeefe2511c9bee64e764 100644 (file)
@@ -622,8 +622,8 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
 {
     unsigned int max_vcpus;
 
-    /* HVM and HAP must be set. IOMMU may or may not be */
-    if ( (config->flags & ~XEN_DOMCTL_CDF_iommu) !=
+    /* HVM and HAP must be set. IOMMU and VPCI may or may not be */
+    if ( (config->flags & ~XEN_DOMCTL_CDF_iommu & ~XEN_DOMCTL_CDF_vpci) !=
          (XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap) )
     {
         dprintk(XENLOG_INFO, "Unsupported configuration %#x\n",
index ef1812dc14022f10b45c6a19b3aa1769ca10c998..79c2aa4636100fc8b5056bbf4a6e53eee3dcd72f 100644 (file)
@@ -662,6 +662,12 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
+    if ( config->flags & XEN_DOMCTL_CDF_vpci )
+    {
+        dprintk(XENLOG_INFO, "vPCI cannot be enabled yet\n");
+        return -EINVAL;
+    }
+
     if ( config->vmtrace_size )
     {
         unsigned int size = config->vmtrace_size;
index 6ee5d033b0c223e524a8f648c71a7535cd3e0b5a..40d67ec342326fe2cd91aec20f065a78ec40abbb 100644 (file)
@@ -483,7 +483,7 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
          ~(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) )
+           XEN_DOMCTL_CDF_nested_virt | XEN_DOMCTL_CDF_vpci) )
     {
         dprintk(XENLOG_INFO, "Unknown CDF flags %#x\n", config->flags);
         return -EINVAL;
index 96696e3842da1cb97d6316371fa88e62630a5c5a..4cb3f662c28ccd30a49701241e910df6ef5cea17 100644 (file)
@@ -70,9 +70,10 @@ struct xen_domctl_createdomain {
 #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)
+#define XEN_DOMCTL_CDF_vpci           (1U << 7)
 
 /* Max XEN_DOMCTL_CDF_* constant.  Used for ABI checking. */
-#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_nested_virt
+#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_vpci
 
     uint32_t flags;