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/irqchip.h>
15 #include <asm/percpu.h>
16 #include <asm/platform.h>
17 #include <asm/setup.h>
18 #include <asm/sysregs.h>
19 #include <jailhouse/control.h>
20 #include <jailhouse/entry.h>
21 #include <jailhouse/paging.h>
22 #include <jailhouse/string.h>
24 static int arch_check_features(void)
27 arm_read_sysreg(ID_PFR1_EL1, pfr1);
35 int arch_init_early(void)
39 if ((err = arch_check_features()) != 0)
42 err = arch_mmu_cell_init(&root_cell);
46 err = arch_map_device(UART_BASE_PHYS, UART_BASE_VIRT, PAGE_SIZE);
51 int arch_cpu_init(struct per_cpu *cpu_data)
54 unsigned long hcr = HCR_VM_BIT | HCR_IMO_BIT | HCR_FMO_BIT;
56 cpu_data->psci_mbox.entry = 0;
59 * Copy the registers to restore from the linux stack here, because we
60 * won't be able to access it later
62 memcpy(&cpu_data->linux_reg, (void *)cpu_data->linux_sp, NUM_ENTRY_REGS
63 * sizeof(unsigned long));
65 err = switch_exception_level(cpu_data);
70 * Save pointer in the thread local storage
71 * Must be done early in order to handle aborts and errors in the setup
74 arm_write_sysreg(TPIDR_EL2, cpu_data);
76 /* Setup guest traps */
77 arm_write_sysreg(HCR, hcr);
79 err = arch_mmu_cpu_cell_init(cpu_data);
87 err = irqchip_cpu_init(cpu_data);
92 int arch_init_late(void)
94 return map_root_memory_regions();
97 void arch_cpu_activate_vmm(struct per_cpu *cpu_data)
99 /* Return to the kernel */
100 cpu_return_el1(cpu_data);
105 void arch_cpu_restore(struct per_cpu *cpu_data)
109 // catch missing symbols
110 void arch_shutdown_cpu(unsigned int cpu_id) {}
111 void arch_flush_cell_vcpu_caches(struct cell *cell) {}
112 void arch_cell_destroy(struct cell *new_cell) {}
113 void arch_config_commit(struct cell *cell_added_removed) {}
114 void arch_shutdown(void) {}
115 void arch_panic_stop(void) {__builtin_unreachable();}
116 void arch_panic_park(void) {}