[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 19/25] xen: Replace hand-crafted domctl/createdomain with autogenerated version



With xen_arch_domainconfig and every bitmap/enum already autogenerated,
add the final piece to enable autogeneration of the createdomain
hypercall.

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
---
 .../xenbindgen/extra/domctl/createdomain.toml | 96 +++++++++++++++++++
 xen/include/public/autogen/domctl.h           | 54 +++++++++++
 xen/include/public/domctl.h                   | 56 +----------
 xen/include/public/sysctl.h                   |  1 +
 4 files changed, 152 insertions(+), 55 deletions(-)

diff --git a/tools/rust/xenbindgen/extra/domctl/createdomain.toml 
b/tools/rust/xenbindgen/extra/domctl/createdomain.toml
index 3a6872aa325f..f20cb8790039 100644
--- a/tools/rust/xenbindgen/extra/domctl/createdomain.toml
+++ b/tools/rust/xenbindgen/extra/domctl/createdomain.toml
@@ -87,3 +87,99 @@ typ = { tag = "u32" }
 name = "no_sharept"
 description = "Set to _NOT_ share page tables between the CPU and the IOMMU 
when it would be possible to do so."
 shift = 0
+
+################################################################################
+
+[[structs]]
+name = "xen_domctl_createdomain"
+description = """
+Create a new domain with the passed parameters.
+
+IMPORTANT: The domid part of the domctl is IN/OUT. When the passed
+domid is 0 or over `DOMID_FIRST_RESERVED` a new domid is auto-allocated
+and returned."""
+
+[[structs.fields]]
+name = "ssidref"
+description = "IN: `Source Security IDentifier` (See XSM)."
+typ = { tag = "u32" }
+
+[[structs.fields]]
+name = "handle"
+description = "IN: Unique identifier for this guest given by the toolstack."
+typ = { tag = "array", args = [{ tag = "u8" }, 16]  }
+
+[[structs.fields]]
+name = "flags"
+description = "IN: Bitmap of domain features to enable/disable."
+typ = { tag = "bitmap", args = "xen_domctl_cdf" }
+
+[[structs.fields]]
+name = "iommu_opts"
+description = "IN: Bitmap of configuration settings for the IOMMU."
+typ = { tag = "bitmap", args = "xen_domctl_iommu_opts" }
+
+[[structs.fields]]
+name = "max_vcpus"
+description = "IN: Maximum number of CPUs this domain can hold, including 
hotplug."
+typ = { tag = "u32" }
+
+[[structs.fields]]
+name = "max_evtchn_port"
+description = "IN: Maximum number of usable event channels"
+typ = { tag = "u32" }
+
+[[structs.fields]]
+name = "max_grant_frames"
+description = '''
+IN: Maximum number of pages this domain is able
+    to grant access to for other domains.
+
+`< 0` means "use default value in the hypervisor."'''
+typ = { tag = "i32" }
+
+[[structs.fields]]
+name = "max_maptrack_frames"
+description = '''
+IN: Maximum number of pages of foreign domains
+    can be accessed via the grant mechanism.
+
+`< 0` means "use default value in the hypervisor."'''
+typ = { tag = "i32" }
+
+[[structs.fields]]
+name = "max_grant_version"
+description = "Maximum grant table version allowed for this domain"
+typ = { tag = "u8" }
+
+[[structs.fields]]
+name = "rsvd0_a"
+description = "Unused padding. Reserved to zero."
+typ = { tag = "array", args = [{ tag = "u8" }, 3]  }
+
+[[structs.fields]]
+name = "altp2m_mode"
+description = "Which mode to configure altp2m with"
+typ = { tag = "u8" }
+
+[[structs.fields]]
+name = "rsvd0_b"
+description = "Unused padding. Reserved to zero."
+typ = { tag = "array", args = [{ tag = "u8" }, 3]  }
+
+[[structs.fields]]
+name = "vmtrace_size"
+description = "IN: Per-vCPU buffer size in octets. 0 to disable."
+typ = { tag = "u32" }
+
+[[structs.fields]]
+name = "cpupool_id"
+description = "IN: CPU pool to use; 0 or an existing CPU pool."
+typ = { tag = "u32" }
+
+[[structs.fields]]
+name = "arch"
+description = """Arch-specific settings.
+
+Each architecture is free to make its fields IN/OUT/INOUT"""
+typ = { tag = "struct", args = "xen_arch_domainconfig" }
diff --git a/xen/include/public/autogen/domctl.h 
b/xen/include/public/autogen/domctl.h
index 276e05168688..8a0934039169 100644
--- a/xen/include/public/autogen/domctl.h
+++ b/xen/include/public/autogen/domctl.h
@@ -59,5 +59,59 @@ struct xen_domctl_iommu_opts {}; /* GREP FODDER */
 /* Mask covering all defined bits */
 #define XEN_DOMCTL_IOMMU_OPTS__ALL (0x1U)
 
+/*
+ * Create a new domain with the passed parameters.
+ *
+ * IMPORTANT: The domid part of the domctl is IN/OUT. When the passed
+ * domid is 0 or over `DOMID_FIRST_RESERVED` a new domid is auto-allocated
+ * and returned.
+ */
+struct xen_domctl_createdomain {
+    /* IN: `Source Security IDentifier` (See XSM). */
+    uint32_t ssidref;
+    /* IN: Unique identifier for this guest given by the toolstack. */
+    uint8_t handle[16];
+    /* IN: Bitmap of domain features to enable/disable. */
+    uint32_t flags /* See xen_domctl_cdf */;
+    /* IN: Bitmap of configuration settings for the IOMMU. */
+    uint32_t iommu_opts /* See xen_domctl_iommu_opts */;
+    /* IN: Maximum number of CPUs this domain can hold, including hotplug. */
+    uint32_t max_vcpus;
+    /* IN: Maximum number of usable event channels */
+    uint32_t max_evtchn_port;
+    /*
+     * IN: Maximum number of pages this domain is able
+     *     to grant access to for other domains.
+     *
+     * `< 0` means "use default value in the hypervisor."
+     */
+    int32_t max_grant_frames;
+    /*
+     * IN: Maximum number of pages of foreign domains
+     *     can be accessed via the grant mechanism.
+     *
+     * `< 0` means "use default value in the hypervisor."
+     */
+    int32_t max_maptrack_frames;
+    /* Maximum grant table version allowed for this domain */
+    uint8_t max_grant_version;
+    /* Unused padding. Reserved to zero. */
+    uint8_t rsvd0_a[3];
+    /* Which mode to configure altp2m with */
+    uint8_t altp2m_mode;
+    /* Unused padding. Reserved to zero. */
+    uint8_t rsvd0_b[3];
+    /* IN: Per-vCPU buffer size in octets. 0 to disable. */
+    uint32_t vmtrace_size;
+    /* IN: CPU pool to use; 0 or an existing CPU pool. */
+    uint32_t cpupool_id;
+    /*
+     * Arch-specific settings.
+     *
+     * Each architecture is free to make its fields IN/OUT/INOUT
+     */
+    struct xen_arch_domainconfig arch;
+};
+
 #endif /* __XEN_AUTOGEN_DOMCTL_H */
 
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 2d1423f6fd91..01404cf301fa 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -33,62 +33,8 @@
  *
  * Last version bump: Xen 4.19
  */
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017
-
-/*
- * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
- * If it is specified as an invalid value (0 or >= DOMID_FIRST_RESERVED),
- * an id is auto-allocated and returned.
- */
-/* XEN_DOMCTL_createdomain */
-struct xen_domctl_createdomain {
-    /* IN parameters */
-    uint32_t ssidref;
-    xen_domain_handle_t handle;
 
-    /* See xen_domctl_cdf */
-    uint32_t flags;
-    /* See xen_domctl_iommu_opts */
-    uint32_t iommu_opts;
-
-    /*
-     * Various domain limits, which impact the quantity of resources
-     * (global mapping space, xenheap, etc) a guest may consume.  For
-     * max_grant_frames and max_maptrack_frames, < 0 means "use the
-     * default maximum value in the hypervisor".
-     */
-    uint32_t max_vcpus;
-    uint32_t max_evtchn_port;
-    int32_t max_grant_frames;
-    int32_t max_maptrack_frames;
-
-    /*
-     * Maximum grant table version the domain can be configured with.
-     *
-     * Domains always start with v1 (if CONFIG_GRANT_TABLE) and can be bumped
-     * to use up to `max_grant_version` via GNTTABOP_set_version.
-     *
-     * Must be zero iff !CONFIG_GRANT_TABLE.
-     */
-    uint8_t max_grant_version;
-
-    /* Unused. Reserved to zero. */
-    uint8_t rsvd0_a[3];
-
-    /* See xen_domctl_altp2m_mode */
-    uint8_t altp2m_mode;
-
-    /* Unused. Reserved to zero. */
-    uint8_t rsvd0_b[3];
-
-    /* Per-vCPU buffer size in bytes.  0 to disable. */
-    uint32_t vmtrace_size;
-
-    /* CPU pool to use; specify 0 or a specific existing pool */
-    uint32_t cpupool_id;
-
-    struct xen_arch_domainconfig arch;
-};
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017
 
 /* XEN_DOMCTL_getdomaininfo */
 struct xen_domctl_getdomaininfo {
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 9e773490a5ac..e882c1e31059 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -17,6 +17,7 @@
 #include "xen.h"
 #include "domctl.h"
 #include "physdev.h"
+#include "autogen/sysctl.h"
 
 #include "autogen/sysctl.h"
 
-- 
2.47.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.