Skip to content

Commit

Permalink
vm_arm: set fdt pointer and gic name
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
chrisguikema committed Oct 27, 2022
1 parent 3e2268d commit 5f2770e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/VM_Arm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ static int vmm_init(void)
assert(t_id >= 0);
}

camkes_io_fdt(&(_io_ops.io_fdt));

return 0;
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 5f2770e

Please sign in to comment.