new file mode 100644
@@ -0,0 +1,83 @@
+[[enums]]
+name = "xen_domctl_config_gic"
+description = "Content of the `gic_version` field of the domainconfig struct."
+typ = { tag = "u8" }
+
+[[enums.variants]]
+name = "native"
+description = "Emulate the underlying GIC present in the current host."
+value = 0
+
+[[enums.variants]]
+name = "v2"
+description = "Emulate a GICv2."
+value = 1
+
+[[enums.variants]]
+name = "v3"
+description = "Emulate a GICv3."
+value = 2
+
+################################################################################
+
+[[enums]]
+name = "xen_domctl_config_tee"
+description = "TEE mediator exposed to the guest"
+typ = { tag = "u16" }
+
+[[enums.variants]]
+name = "none"
+description = "No mediator. Guest can't communicate with the TEE."
+value = 0
+
+[[enums.variants]]
+name = "optee"
+description = "Expose an OP-TEE mediator."
+value = 1
+
+[[enums.variants]]
+name = "ffa"
+description = "Expose an FF-A mediator."
+value = 2
+
+################################################################################
+
+[[structs]]
+name = "xen_arch_domainconfig"
+description = "arm-specific domain settings."
+
+[[structs.fields]]
+name = "gic_version"
+description = """IN/OUT: GIC version exposed to the guest.
+
+When `native` on input the output value holds the automatically chosen version."""
+typ = { tag = "enum", args = "xen_domctl_config_gic" }
+
+[[structs.fields]]
+name = "sve_vl"
+description = "IN: SVE vector length (divided by 128) exposed to the guest."
+typ = { tag = "u8" }
+
+[[structs.fields]]
+name = "tee_type"
+description = "IN: TEE mediator exposed to the guest."
+typ = { tag = "enum", args = "xen_domctl_config_tee" }
+
+[[structs.fields]]
+name = "nr_spis"
+description = "IN: Number of SPIs exposed to the guest."
+typ = { tag = "u32" }
+
+[[structs.fields]]
+name = "clock_frequency"
+description = """OUT
+Based on the property clock-frequency in the DT timer node.
+The property may be present when the bootloader/firmware doesn't
+set correctly CNTFRQ which hold the timer frequency.
+
+As it's not possible to trap this register, we have to replicate
+the value in the guest DT.
+
+= 0 => property not present
+> 0 => Value of the property"""
+typ = { tag = "u32" }
@@ -639,10 +639,10 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
}
/* The P2M table must always be shared between the CPU and the IOMMU */
- if ( config->iommu_opts & XEN_DOMCTL_IOMMU_no_sharept )
+ if ( config->iommu_opts & XEN_DOMCTL_IOMMU_OPTS_NO_SHAREPT )
{
dprintk(XENLOG_INFO,
- "Unsupported iommu option: XEN_DOMCTL_IOMMU_no_sharept\n");
+ "Unsupported iommu option: XEN_DOMCTL_IOMMU_OPTS_NO_SHAREPT\n");
return -EINVAL;
}
@@ -21,6 +21,7 @@
#include <xen/types.h>
#include <asm/tee/tee.h>
+#include <public/autogen/arch_arm.h>
extern const struct tee_mediator_desc _steemediator[], _eteemediator[];
static const struct tee_mediator_desc __read_mostly *cur_mediator;
@@ -315,42 +315,6 @@ struct vcpu_guest_context {
typedef struct vcpu_guest_context vcpu_guest_context_t;
DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
-/*
- * struct xen_arch_domainconfig's ABI is covered by
- * XEN_DOMCTL_INTERFACE_VERSION.
- */
-#define XEN_DOMCTL_CONFIG_GIC_NATIVE 0
-#define XEN_DOMCTL_CONFIG_GIC_V2 1
-#define XEN_DOMCTL_CONFIG_GIC_V3 2
-
-#define XEN_DOMCTL_CONFIG_TEE_NONE 0
-#define XEN_DOMCTL_CONFIG_TEE_OPTEE 1
-#define XEN_DOMCTL_CONFIG_TEE_FFA 2
-
-struct xen_arch_domainconfig {
- /* IN/OUT */
- uint8_t gic_version;
- /* IN - Contains SVE vector length divided by 128 */
- uint8_t sve_vl;
- /* IN */
- uint16_t tee_type;
- /* IN */
- uint32_t nr_spis;
- /*
- * OUT
- * Based on the property clock-frequency in the DT timer node.
- * The property may be present when the bootloader/firmware doesn't
- * set correctly CNTFRQ which hold the timer frequency.
- *
- * As it's not possible to trap this register, we have to replicate
- * the value in the guest DT.
- *
- * = 0 => property not present
- * > 0 => Value of the property
- *
- */
- uint32_t clock_frequency;
-};
#endif /* __XEN__ || __XEN_TOOLS__ */
struct arch_vcpu_info {
new file mode 100644
@@ -0,0 +1,59 @@
+/*
+ * arch-arm
+ *
+ * AUTOGENERATED. DO NOT MODIFY
+ */
+#ifndef __XEN_AUTOGEN_ARCH_ARM_H
+#define __XEN_AUTOGEN_ARCH_ARM_H
+
+/* Content of the `gic_version` field of the domainconfig struct. */
+enum xen_domctl_config_gic {
+ /* Emulate the underlying GIC present in the current host. */
+ XEN_DOMCTL_CONFIG_GIC_NATIVE = 0,
+ /* Emulate a GICv2. */
+ XEN_DOMCTL_CONFIG_GIC_V2 = 1,
+ /* Emulate a GICv3. */
+ XEN_DOMCTL_CONFIG_GIC_V3 = 2,
+};
+
+/* TEE mediator exposed to the guest */
+enum xen_domctl_config_tee {
+ /* No mediator. Guest can't communicate with the TEE. */
+ XEN_DOMCTL_CONFIG_TEE_NONE = 0,
+ /* Expose an OP-TEE mediator. */
+ XEN_DOMCTL_CONFIG_TEE_OPTEE = 1,
+ /* Expose an FF-A mediator. */
+ XEN_DOMCTL_CONFIG_TEE_FFA = 2,
+};
+
+/* arm-specific domain settings. */
+struct xen_arch_domainconfig {
+ /*
+ * IN/OUT: GIC version exposed to the guest.
+ *
+ * When `native` on input the output value holds the automatically chosen version.
+ */
+ uint8_t gic_version /* See xen_domctl_config_gic */;
+ /* IN: SVE vector length (divided by 128) exposed to the guest. */
+ uint8_t sve_vl;
+ /* IN: TEE mediator exposed to the guest. */
+ uint16_t tee_type /* See xen_domctl_config_tee */;
+ /* IN: Number of SPIs exposed to the guest. */
+ uint32_t nr_spis;
+ /*
+ * OUT
+ * Based on the property clock-frequency in the DT timer node.
+ * The property may be present when the bootloader/firmware doesn't
+ * set correctly CNTFRQ which hold the timer frequency.
+ *
+ * As it's not possible to trap this register, we have to replicate
+ * the value in the guest DT.
+ *
+ * = 0 => property not present
+ * > 0 => Value of the property
+ */
+ uint32_t clock_frequency;
+};
+
+#endif /* __XEN_AUTOGEN_ARCH_ARM_H */
+
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com> --- .../extra/arch-arm/domainconfig.toml | 83 +++++++++++++++++++ xen/arch/arm/domain.c | 4 +- xen/arch/arm/tee/tee.c | 1 + xen/include/public/arch-arm.h | 36 -------- xen/include/public/autogen/arch_arm.h | 59 +++++++++++++ 5 files changed, 145 insertions(+), 38 deletions(-) create mode 100644 tools/rust/xenbindgen/extra/arch-arm/domainconfig.toml create mode 100644 xen/include/public/autogen/arch_arm.h