Skip to content

Commit

Permalink
hypervisor: arm64: reanimate the root cell back from the dead
Browse files Browse the repository at this point in the history
We have now enough implemented functionality to return to the root
cell. We just need to enable guest traps, which will be handled by
the MMU, MMIO, and GIC code we already plugged to the port. Finally,
we restore the state of the root cell that we previously stored in
the stack.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
  • Loading branch information
tvelocity committed Jan 25, 2016
1 parent 4fa46d1 commit e011a78
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions hypervisor/arch/arm64/setup.c
Expand Up @@ -31,6 +31,8 @@ int arch_init_early(void)
int arch_cpu_init(struct per_cpu *cpu_data)
{
int err = 0;
unsigned long hcr = HCR_VM_BIT | HCR_IMO_BIT | HCR_FMO_BIT
| HCR_TSC_BIT | HCR_TAC_BIT | HCR_RW_BIT;

/* switch to the permanent page tables */
enable_mmu_el2(hv_paging_structs.root_table);
Expand All @@ -39,6 +41,9 @@ int arch_cpu_init(struct per_cpu *cpu_data)
cpu_data->virt_id = cpu_data->cpu_id;
arm_read_sysreg(MPIDR_EL1, cpu_data->mpidr.val);

/* Setup guest traps */
arm_write_sysreg(HCR_EL2, hcr);

err = arch_mmu_cpu_cell_init(cpu_data);
if (err)
return err;
Expand All @@ -60,8 +65,12 @@ int arch_init_late(void)

void __attribute__((noreturn)) arch_cpu_activate_vmm(struct per_cpu *cpu_data)
{
trace_error(-EINVAL);
while (1);
struct registers *regs = guest_regs(cpu_data);

/* return to the caller in Linux */
arm_write_sysreg(ELR_EL2, regs->usr[30]);

vmreturn(regs);
}

int arch_map_device(void *paddr, void *vaddr, unsigned long size)
Expand Down

0 comments on commit e011a78

Please sign in to comment.