All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: xen-devel@lists.xenproject.org
Cc: Alejandro Vallejo <alejandro.vallejo@cloud.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>
Subject: [RFC PATCH 19/25] xen: Replace hand-crafted domctl/createdomain with autogenerated version
Date: Fri, 15 Nov 2024 11:51:48 +0000	[thread overview]
Message-ID: <20241115115200.2824-20-alejandro.vallejo@cloud.com> (raw)
In-Reply-To: <20241115115200.2824-1-alejandro.vallejo@cloud.com>

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@cloud.com>
---
 .../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



  parent reply	other threads:[~2024-11-15 12:02 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 11:51 [RFC PATCH 00/25] Introduce xenbindgen to autogen hypercall structs Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 01/25] xen/domctl: Refine grant_opts into max_grant_version Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 02/25] xen/domctl: Replace altp2m_opts with altp2m_mode Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 03/25] tools/xenbindgen: Introduce a Xen hypercall IDL generator Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 04/25] tools/xenbindgen: Add a TOML spec reader Alejandro Vallejo
2024-11-25 15:13   ` Teddy Astie
2024-11-25 16:51     ` Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 05/25] tools/xenbindgen: Add basic plumbing for the C backend Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 06/25] tools/xenbindgen: Add xenbindgen's Cargo.lock file Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 07/25] tools/xenbindgen: Add support for structs in TOML specs Alejandro Vallejo
2024-11-25 12:39   ` Teddy Astie
2024-11-25 17:07     ` Alejandro Vallejo
2024-11-25 15:03   ` Teddy Astie
2024-11-25 17:16     ` Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 08/25] tools/xenbindgen: Add support for enums " Alejandro Vallejo
2024-11-25 16:39   ` Teddy Astie
2024-11-25 17:18     ` Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 09/25] tools/xenbindgen: Add support for bitmaps " Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 10/25] tools/xenbindgen: Add support for includes in the " Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 11/25] tools/xenbindgen: Validate ABI rules at generation time Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version Alejandro Vallejo
2024-11-25 12:05   ` Jan Beulich
2024-11-25 18:51     ` Alejandro Vallejo
2024-11-26  9:40       ` Jan Beulich
2024-11-26 12:27         ` Alejandro Vallejo
2024-11-26 13:20           ` Jan Beulich
2024-11-26 14:36             ` Alejandro Vallejo
2024-11-26 16:30               ` Jan Beulich
2024-11-26 14:39             ` Teddy Astie
2024-11-26 16:28               ` Jan Beulich
2024-11-15 11:51 ` [RFC PATCH 13/25] xen: Replace hand-crafted altp2m_mode descriptions with autogenerated ones Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 14/25] xen: Replace common bitmaps in domctl.createdomain with autogenerated versions Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 15/25] xen/arm: Replace hand-crafted xen_arch_domainconfig with autogenerated one Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 16/25] xen/x86: " Alejandro Vallejo
2024-11-25 12:09   ` Jan Beulich
2024-11-25 18:53     ` Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 17/25] xen/ppc: Replace empty " Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 18/25] xen/riscv: " Alejandro Vallejo
2024-11-15 11:51 ` Alejandro Vallejo [this message]
2024-12-04 14:48   ` [RFC PATCH 19/25] xen: Replace hand-crafted domctl/createdomain with autogenerated version Teddy Astie
2024-11-15 11:51 ` [RFC PATCH 20/25] tools/xen-sys: Create a crate with autogenerated Rust constructs Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 21/25] tools/xenbindgen: Add Rust backend to xenbindgen Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 22/25] tools/xen-sys: Add autogenerated Rust files Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 23/25] licence: Add Unicode-DFS-2016 to the list of licences Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 24/25] tools/rust: Add deny.toml Alejandro Vallejo
2024-11-15 11:51 ` [RFC PATCH 25/25] ci: Add a CI checker for Rust-related helpful properties Alejandro Vallejo
2024-11-21 17:46 ` [RFC PATCH 00/25] Introduce xenbindgen to autogen hypercall structs Anthony PERARD
2024-11-22 10:52   ` Teddy Astie
2024-11-22 13:26     ` Alejandro Vallejo
2024-11-22 13:12   ` Alejandro Vallejo
2024-11-22 16:34     ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241115115200.2824-20-alejandro.vallejo@cloud.com \
    --to=alejandro.vallejo@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dpsmith@apertussolutions.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.