@@ -676,19 +676,19 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
LOG(DETAIL, "altp2m: %s", libxl_altp2m_mode_to_string(b_info->altp2m));
switch(b_info->altp2m) {
case LIBXL_ALTP2M_MODE_MIXED:
- create.altp2m_mode = XEN_DOMCTL_ALTP2M_mixed;
+ create.altp2m_mode = XEN_DOMCTL_ALTP2M_MODE_MIXED;
break;
case LIBXL_ALTP2M_MODE_EXTERNAL:
- create.altp2m_mode = XEN_DOMCTL_ALTP2M_external;
+ create.altp2m_mode = XEN_DOMCTL_ALTP2M_MODE_EXTERNAL;
break;
case LIBXL_ALTP2M_MODE_LIMITED:
- create.altp2m_mode = XEN_DOMCTL_ALTP2M_limited;
+ create.altp2m_mode = XEN_DOMCTL_ALTP2M_MODE_LIMITED;
break;
case LIBXL_ALTP2M_MODE_DISABLED:
- create.altp2m_mode = XEN_DOMCTL_ALTP2M_disabled;
+ create.altp2m_mode = XEN_DOMCTL_ALTP2M_MODE_DISABLED;
break;
}
new file mode 100644
@@ -0,0 +1,24 @@
+[[enums]]
+name = "xen_domctl_altp2m_mode"
+description = "Content of the `altp2m_mode` field of the domain creation hypercall."
+typ = { tag = "u8" }
+
+[[enums.variants]]
+name = "disabled"
+description = "Keep altp2m disabled"
+value = 0
+
+[[enums.variants]]
+name = "mixed"
+description = "Use mixed-mode for the altp2m (not yet evaluated for safety)."
+value = 1
+
+[[enums.variants]]
+name = "external"
+description = "Use external mode for the altp2m."
+value = 2
+
+[[enums.variants]]
+name = "limited"
+description = "Use limited mode for the altp2m."
+value = 3
@@ -661,19 +661,19 @@ int hvm_domain_initialise(struct domain *d,
/* Set altp2m based on domctl flags. */
switch ( config->altp2m_mode )
{
- case XEN_DOMCTL_ALTP2M_mixed:
+ case XEN_DOMCTL_ALTP2M_MODE_MIXED:
d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_mixed;
break;
- case XEN_DOMCTL_ALTP2M_external:
+ case XEN_DOMCTL_ALTP2M_MODE_EXTERNAL:
d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_external;
break;
- case XEN_DOMCTL_ALTP2M_limited:
+ case XEN_DOMCTL_ALTP2M_MODE_LIMITED:
d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_limited;
break;
- case XEN_DOMCTL_ALTP2M_disabled:
+ case XEN_DOMCTL_ALTP2M_MODE_DISABLED:
d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_disabled;
break;
}
new file mode 100644
@@ -0,0 +1,22 @@
+/*
+ * domctl
+ *
+ * AUTOGENERATED. DO NOT MODIFY
+ */
+#ifndef __XEN_AUTOGEN_DOMCTL_H
+#define __XEN_AUTOGEN_DOMCTL_H
+
+/* Content of the `altp2m_mode` field of the domain creation hypercall. */
+enum xen_domctl_altp2m_mode {
+ /* Keep altp2m disabled */
+ XEN_DOMCTL_ALTP2M_MODE_DISABLED = 0,
+ /* Use mixed-mode for the altp2m (not yet evaluated for safety). */
+ XEN_DOMCTL_ALTP2M_MODE_MIXED = 1,
+ /* Use external mode for the altp2m. */
+ XEN_DOMCTL_ALTP2M_MODE_EXTERNAL = 2,
+ /* Use limited mode for the altp2m. */
+ XEN_DOMCTL_ALTP2M_MODE_LIMITED = 3,
+};
+
+#endif /* __XEN_AUTOGEN_DOMCTL_H */
+
@@ -21,6 +21,8 @@
#include "hvm/save.h"
#include "memory.h"
+#include "autogen/domctl.h"
+
/*
* The interface version needs to be incremented by 1 in case the interface
* is modified in an incompatible way AND if the version hasn't been
@@ -103,21 +105,7 @@ struct xen_domctl_createdomain {
/* Unused. Reserved to zero. */
uint8_t rsvd0_a[3];
-/* Keep altp2m disabled */
-#define XEN_DOMCTL_ALTP2M_disabled (0U)
-/*
- * Enable altp2m mixed mode.
- *
- * Note that 'mixed' mode has not been evaluated for safety from a security
- * perspective. Before using this mode in a security-critical environment,
- * each subop should be evaluated for safety, with unsafe subops blacklisted in
- * XSM.
- */
-#define XEN_DOMCTL_ALTP2M_mixed (1U)
-/* Enable altp2m external mode. */
-#define XEN_DOMCTL_ALTP2M_external (2U)
-/* Enable altp2m limited mode. */
-#define XEN_DOMCTL_ALTP2M_limited (3U)
+ /* See xen_domctl_altp2m_mode */
uint8_t altp2m_mode;
/* Unused. Reserved to zero. */
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com> --- tools/libs/light/libxl_create.c | 8 +++---- .../xenbindgen/extra/domctl/createdomain.toml | 24 +++++++++++++++++++ xen/arch/x86/hvm/hvm.c | 8 +++---- xen/include/public/autogen/domctl.h | 22 +++++++++++++++++ xen/include/public/domctl.h | 18 +++----------- 5 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 tools/rust/xenbindgen/extra/domctl/createdomain.toml create mode 100644 xen/include/public/autogen/domctl.h