From: Antonios Motakis <antonios.mota...@huawei.com>

Enable the MMU mappings for the hypervisor running in EL2, and add
functions to map device regions to the hypervisor address space.

Signed-off-by: Antonios Motakis <antonios.mota...@huawei.com>
[Jan: rebase, remove obsolete arch_map/unmap_device and asm/head.h]
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 hypervisor/arch/arm64/include/asm/setup.h | 25 +++++++++++++++++++++++++
 hypervisor/arch/arm64/setup.c             | 14 +++++++++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 hypervisor/arch/arm64/include/asm/setup.h

diff --git a/hypervisor/arch/arm64/include/asm/setup.h 
b/hypervisor/arch/arm64/include/asm/setup.h
new file mode 100644
index 0000000..00dd9e1
--- /dev/null
+++ b/hypervisor/arch/arm64/include/asm/setup.h
@@ -0,0 +1,25 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef _JAILHOUSE_ASM_SETUP_H
+#define _JAILHOUSE_ASM_SETUP_H
+
+#include <asm/percpu.h>
+
+#ifndef __ASSEMBLY__
+
+#include <jailhouse/string.h>
+
+void enable_mmu_el2(page_table_t ttbr0_el2);
+
+#endif /* !__ASSEMBLY__ */
+#endif /* !_JAILHOUSE_ASM_SETUP_H */
diff --git a/hypervisor/arch/arm64/setup.c b/hypervisor/arch/arm64/setup.c
index ca83940..616c324 100644
--- a/hypervisor/arch/arm64/setup.c
+++ b/hypervisor/arch/arm64/setup.c
@@ -10,22 +10,30 @@
  * the COPYING file in the top-level directory.
  */
 
+#include <jailhouse/cell.h>
 #include <jailhouse/entry.h>
 #include <jailhouse/printk.h>
+#include <asm/control.h>
+#include <asm/setup.h>
 
 int arch_init_early(void)
 {
-       return trace_error(-EINVAL);
+       return arm_paging_cell_init(&root_cell);
 }
 
 int arch_cpu_init(struct per_cpu *cpu_data)
 {
-       return trace_error(-EINVAL);
+       /* switch to the permanent page tables */
+       enable_mmu_el2(hv_paging_structs.root_table);
+
+       arm_paging_vcpu_init(&root_cell.arch.mm);
+
+       return 0;
 }
 
 int arch_init_late(void)
 {
-       return trace_error(-EINVAL);
+       return map_root_memory_regions();
 }
 
 void __attribute__((noreturn)) arch_cpu_activate_vmm(struct per_cpu *cpu_data)
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to