]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/arch/arm/setup.c
arm: initialise hypervisor stage 1 MMU
[jailhouse.git] / hypervisor / arch / arm / setup.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013
5  *
6  * Authors:
7  *  Jan Kiszka <jan.kiszka@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #include <asm/percpu.h>
14 #include <asm/platform.h>
15 #include <asm/setup.h>
16 #include <asm/sysregs.h>
17 #include <jailhouse/entry.h>
18 #include <jailhouse/paging.h>
19 #include <jailhouse/string.h>
20
21 int arch_init_early(void)
22 {
23         return arch_map_device(UART_BASE_PHYS, UART_BASE_VIRT, PAGE_SIZE);
24 }
25
26 int arch_cpu_init(struct per_cpu *cpu_data)
27 {
28         int err = 0;
29
30         /*
31          * Copy the registers to restore from the linux stack here, because we
32          * won't be able to access it later
33          */
34         memcpy(&cpu_data->linux_reg, (void *)cpu_data->linux_sp, NUM_ENTRY_REGS
35                         * sizeof(unsigned long));
36
37         err = switch_exception_level(cpu_data);
38
39         /*
40          * Save pointer in the thread local storage
41          * Must be done early in order to handle aborts and errors in the setup
42          * code.
43          */
44         arm_write_sysreg(TPIDR_EL2, cpu_data);
45
46         return err;
47 }
48
49 int arch_init_late(void)
50 {
51         return -ENOSYS;
52 }
53
54 void arch_cpu_activate_vmm(struct per_cpu *cpu_data)
55 {
56         /* Return to the kernel */
57         cpu_return_el1(cpu_data);
58
59         while (1);
60 }
61
62 void arch_cpu_restore(struct per_cpu *cpu_data)
63 {
64 }
65
66 // catch missing symbols
67 #include <jailhouse/printk.h>
68 #include <jailhouse/processor.h>
69 #include <jailhouse/control.h>
70 #include <jailhouse/string.h>
71 void arch_suspend_cpu(unsigned int cpu_id) {}
72 void arch_resume_cpu(unsigned int cpu_id) {}
73 void arch_reset_cpu(unsigned int cpu_id) {}
74 void arch_park_cpu(unsigned int cpu_id) {}
75 void arch_shutdown_cpu(unsigned int cpu_id) {}
76 int arch_cell_create(struct cell *new_cell)
77 { return -ENOSYS; }
78 int arch_map_memory_region(struct cell *cell,
79                            const struct jailhouse_memory *mem)
80 { return -ENOSYS; }
81 int arch_unmap_memory_region(struct cell *cell,
82                              const struct jailhouse_memory *mem)
83 { return -ENOSYS; }
84 void arch_flush_cell_vcpu_caches(struct cell *cell) {}
85 void arch_cell_destroy(struct cell *new_cell) {}
86 void arch_config_commit(struct cell *cell_added_removed) {}
87 void arch_shutdown(void) {}
88 unsigned long arch_paging_gphys2phys(struct per_cpu *cpu_data,
89                                      unsigned long gphys, unsigned long flags)
90 { return INVALID_PHYS_ADDR; }
91 void arch_panic_stop(void) {__builtin_unreachable();}
92 void arch_panic_park(void) {}