Linux 3.17-rc2
[linux/fpc-iii.git] / arch / arm64 / include / asm / virt.h
blob7a5df5252dd736e4038e04e40510351820056183
1 /*
2 * Copyright (C) 2012 ARM Ltd.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef __ASM__VIRT_H
19 #define __ASM__VIRT_H
21 #define BOOT_CPU_MODE_EL1 (0xe11)
22 #define BOOT_CPU_MODE_EL2 (0xe12)
24 #ifndef __ASSEMBLY__
27 * __boot_cpu_mode records what mode CPUs were booted in.
28 * A correctly-implemented bootloader must start all CPUs in the same mode:
29 * In this case, both 32bit halves of __boot_cpu_mode will contain the
30 * same value (either 0 if booted in EL1, BOOT_CPU_MODE_EL2 if booted in EL2).
32 * Should the bootloader fail to do this, the two values will be different.
33 * This allows the kernel to flag an error when the secondaries have come up.
35 extern u32 __boot_cpu_mode[2];
37 void __hyp_set_vectors(phys_addr_t phys_vector_base);
38 phys_addr_t __hyp_get_vectors(void);
40 /* Reports the availability of HYP mode */
41 static inline bool is_hyp_mode_available(void)
43 return (__boot_cpu_mode[0] == BOOT_CPU_MODE_EL2 &&
44 __boot_cpu_mode[1] == BOOT_CPU_MODE_EL2);
47 /* Check if the bootloader has booted CPUs in different modes */
48 static inline bool is_hyp_mode_mismatched(void)
50 return __boot_cpu_mode[0] != __boot_cpu_mode[1];
53 /* The section containing the hypervisor text */
54 extern char __hyp_text_start[];
55 extern char __hyp_text_end[];
57 #endif /* __ASSEMBLY__ */
59 #endif /* ! __ASM__VIRT_H */