mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/ocaml: implement stub_xc_domain_create() for ARM
stub_xc_domain_create() fails unconditionally with "Unhandled: ARM" for the ARM variant of arch_domainconfig, so no OCaml toolstack (e.g. xenopsd) can create an ARM domain. To fix this, convert the two fields of xen_arm_arch_domainconfig, gic_version and nr_spis, into the corresponding fields of struct xen_arch_domainconfig and reject values that do not fit, as is already done for other parameters. The remaining fields (sve_vl, tee_type, arm_sci_type and v8r_el1_msa) aren't exposed to OCaml yet, so they stay zero. Also add a BUILD_BUG_ON() on the size of the createdomain struct, just like the x86 case, to catch future ABI changes. Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech> Signed-off-by: Julian Vetter <julian.vetter@vates.tech> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
30e2d8b4c5
commit
dbf9a090ba
1 file changed
+27
-1
@@ -257,8 +257,34 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
|
|||||||
arch_domconfig = Field(VAL_ARCH, 0);
|
arch_domconfig = Field(VAL_ARCH, 0);
|
||||||
switch ( Tag_val(VAL_ARCH) )
|
switch ( Tag_val(VAL_ARCH) )
|
||||||
{
|
{
|
||||||
case 0: /* ARM - nothing to do */
|
case 0: /* ARM */
|
||||||
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
|
{
|
||||||
|
/* Quick & dirty check for ABI changes. */
|
||||||
|
BUILD_BUG_ON(sizeof(cfg) != 72);
|
||||||
|
|
||||||
|
/* Mnemonics for the named fields inside xen_arm_arch_domainconfig */
|
||||||
|
#define VAL_GIC_VERSION Field(arch_domconfig, 0)
|
||||||
|
#define VAL_NR_SPIS Field(arch_domconfig, 1)
|
||||||
|
|
||||||
|
uint8_t gic_version = Long_val(VAL_GIC_VERSION);
|
||||||
|
uint32_t nr_spis = Long_val(VAL_NR_SPIS);
|
||||||
|
|
||||||
|
if ( gic_version != Long_val(VAL_GIC_VERSION) )
|
||||||
|
caml_invalid_argument("gic_version");
|
||||||
|
|
||||||
|
if ( nr_spis != Long_val(VAL_NR_SPIS) )
|
||||||
|
caml_invalid_argument("nr_spis");
|
||||||
|
|
||||||
|
cfg.arch.gic_version = gic_version;
|
||||||
|
cfg.arch.nr_spis = nr_spis;
|
||||||
|
|
||||||
|
#undef VAL_NR_SPIS
|
||||||
|
#undef VAL_GIC_VERSION
|
||||||
|
}
|
||||||
|
#else
|
||||||
caml_failwith("Unhandled: ARM");
|
caml_failwith("Unhandled: ARM");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /* X86 - emulation flags in the block */
|
case 1: /* X86 - emulation flags in the block */
|
||||||
|
|||||||