From 5f2770e39ea77529f6f48baa6f36c2ade02a3c4e Mon Sep 17 00:00:00 2001 From: Chris Guikema Date: Wed, 26 Oct 2022 23:11:50 -0400 Subject: [PATCH] vm_arm: set fdt pointer and gic name This commit sets the fdt pointer and gic node, which are used by the libraries to find the registers necessary to emulate the gic. Signed-off-by: Chris Guikema --- components/VM_Arm/src/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/VM_Arm/src/main.c b/components/VM_Arm/src/main.c index e577d0bd..cb6ec18c 100644 --- a/components/VM_Arm/src/main.c +++ b/components/VM_Arm/src/main.c @@ -531,6 +531,8 @@ static int vmm_init(void) assert(t_id >= 0); } + camkes_io_fdt(&(_io_ops.io_fdt)); + return 0; } @@ -802,9 +804,9 @@ static int generate_fdt(vm_t *vm, void *fdt_ori, void *gen_fdt, int buf_size, si } if (config_set(CONFIG_VM_PCI_SUPPORT)) { - int gic_offset = fdt_path_offset(fdt_ori, GIC_NODE_PATH); + int gic_offset = fdt_path_offset(fdt_ori, vm->gic_path); if (gic_offset < 0) { - ZF_LOGE("Failed to find gic node from path: %s", GIC_NODE_PATH); + ZF_LOGE("Failed to find gic node from path: %s", vm->gic_path); return -1; } int gic_phandle = fdt_get_phandle(fdt_ori, gic_offset); @@ -892,7 +894,6 @@ static int load_linux(vm_t *vm, const char *kernel_name, const char *dtb_name, c close(dtb_fd); fdt_ori = (void *)linux_gen_dtb_base_buf; } else { - camkes_io_fdt(&(_io_ops.io_fdt)); fdt_ori = (void *)ps_io_fdt_get(&_io_ops.io_fdt); } @@ -1166,6 +1167,9 @@ int main_continued(void) ZF_LOGF_IF(err, "Failed to bind CB to SID"); #endif /* CONFIG_ARM_SMMU */ + vm.fdt_ori = (void *)ps_io_fdt_get(&_io_ops.io_fdt); + vm.gic_path = GIC_NODE_PATH; + err = vm_create_default_irq_controller(&vm); assert(!err);