2 * Jailhouse, a Linux-based partitioning hypervisor
4 * Copyright (c) Siemens AG, 2013
7 * Jan Kiszka <jan.kiszka@siemens.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
13 #include <asm/control.h>
14 #include <asm/percpu.h>
15 #include <asm/platform.h>
16 #include <asm/setup.h>
17 #include <asm/sysregs.h>
18 #include <jailhouse/control.h>
19 #include <jailhouse/entry.h>
20 #include <jailhouse/paging.h>
21 #include <jailhouse/string.h>
23 static int arch_check_features(void)
26 arm_read_sysreg(ID_PFR1_EL1, pfr1);
34 int arch_init_early(void)
38 if ((err = arch_check_features()) != 0)
41 err = arch_mmu_cell_init(&root_cell);
45 err = arch_map_device(UART_BASE_PHYS, UART_BASE_VIRT, PAGE_SIZE);
50 int arch_cpu_init(struct per_cpu *cpu_data)
53 unsigned long hcr = HCR_VM_BIT;
56 * Copy the registers to restore from the linux stack here, because we
57 * won't be able to access it later
59 memcpy(&cpu_data->linux_reg, (void *)cpu_data->linux_sp, NUM_ENTRY_REGS
60 * sizeof(unsigned long));
62 err = switch_exception_level(cpu_data);
67 * Save pointer in the thread local storage
68 * Must be done early in order to handle aborts and errors in the setup
71 arm_write_sysreg(TPIDR_EL2, cpu_data);
73 /* Setup guest traps */
74 arm_write_sysreg(HCR, hcr);
76 err = arch_mmu_cpu_cell_init(cpu_data);
81 int arch_init_late(void)
83 return map_root_memory_regions();
86 void arch_cpu_activate_vmm(struct per_cpu *cpu_data)
88 /* Return to the kernel */
89 cpu_return_el1(cpu_data);
94 void arch_cpu_restore(struct per_cpu *cpu_data)
98 // catch missing symbols
99 void arch_suspend_cpu(unsigned int cpu_id) {}
100 void arch_resume_cpu(unsigned int cpu_id) {}
101 void arch_reset_cpu(unsigned int cpu_id) {}
102 void arch_park_cpu(unsigned int cpu_id) {}
103 void arch_shutdown_cpu(unsigned int cpu_id) {}
104 int arch_cell_create(struct cell *new_cell)
106 void arch_flush_cell_vcpu_caches(struct cell *cell) {}
107 void arch_cell_destroy(struct cell *new_cell) {}
108 void arch_config_commit(struct cell *cell_added_removed) {}
109 void arch_shutdown(void) {}
110 void arch_panic_stop(void) {__builtin_unreachable();}
111 void arch_panic_park(void) {}