[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 15/25] xen/arm: Replace hand-crafted xen_arch_domainconfig with autogenerated one
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx> --- .../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 diff --git a/tools/rust/xenbindgen/extra/arch-arm/domainconfig.toml b/tools/rust/xenbindgen/extra/arch-arm/domainconfig.toml new file mode 100644 index 000000000000..d32963445765 --- /dev/null +++ b/tools/rust/xenbindgen/extra/arch-arm/domainconfig.toml @@ -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" } diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 54e849b02f9e..57ed11598754 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -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; } diff --git a/xen/arch/arm/tee/tee.c b/xen/arch/arm/tee/tee.c index 3f65e45a7892..c5f7629a227a 100644 --- a/xen/arch/arm/tee/tee.c +++ b/xen/arch/arm/tee/tee.c @@ -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; diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index e2412a17474e..42ce9e64ed00 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -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 { diff --git a/xen/include/public/autogen/arch_arm.h b/xen/include/public/autogen/arch_arm.h new file mode 100644 index 000000000000..d19f639671e0 --- /dev/null +++ b/xen/include/public/autogen/arch_arm.h @@ -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 */ + -- 2.47.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |