Merge tag 'microblaze-4.17-rc1' of git://git.monstr.eu/linux-2.6-microblaze
[linux-block.git] / arch / arm / include / asm / kvm_asm.h
CommitLineData
749cf76c
CD
1/*
2 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
4 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef __ARM_KVM_ASM_H__
20#define __ARM_KVM_ASM_H__
21
1a61ae7a
MZ
22#include <asm/virt.h>
23
435bca5f
MZ
24#define ARM_EXIT_WITH_ABORT_BIT 31
25#define ARM_EXCEPTION_CODE(x) ((x) & ~(1U << ARM_EXIT_WITH_ABORT_BIT))
26#define ARM_ABORT_PENDING(x) !!((x) & (1U << ARM_EXIT_WITH_ABORT_BIT))
27
749cf76c
CD
28#define ARM_EXCEPTION_RESET 0
29#define ARM_EXCEPTION_UNDEFINED 1
30#define ARM_EXCEPTION_SOFTWARE 2
31#define ARM_EXCEPTION_PREF_ABORT 3
32#define ARM_EXCEPTION_DATA_ABORT 4
33#define ARM_EXCEPTION_IRQ 5
34#define ARM_EXCEPTION_FIQ 6
342cd0ab 35#define ARM_EXCEPTION_HVC 7
386627d8 36#define ARM_EXCEPTION_HYP_GONE HVC_STUB_ERR
19b0e60a
VK
37/*
38 * The rr_lo_hi macro swaps a pair of registers depending on
39 * current endianness. It is used in conjunction with ldrd and strd
40 * instructions that load/store a 64-bit value from/to memory to/from
41 * a pair of registers which are used with the mrrc and mcrr instructions.
42 * If used with the ldrd/strd instructions, the a1 parameter is the first
43 * source/destination register and the a2 parameter is the second
44 * source/destination register. Note that the ldrd/strd instructions
45 * already swap the bytes within the words correctly according to the
46 * endianness setting, but the order of the registers need to be effectively
47 * swapped when used with the mrrc/mcrr instructions.
48 */
49#ifdef CONFIG_CPU_ENDIAN_BE8
50#define rr_lo_hi(a1, a2) a2, a1
51#else
52#define rr_lo_hi(a1, a2) a1, a2
53#endif
54
a0bf9776
AB
55#define kvm_ksym_ref(kva) (kva)
56
342cd0ab 57#ifndef __ASSEMBLY__
d5d8184d 58struct kvm;
342cd0ab
CD
59struct kvm_vcpu;
60
61extern char __kvm_hyp_init[];
62extern char __kvm_hyp_init_end[];
63
342cd0ab
CD
64extern char __kvm_hyp_vector[];
65
342cd0ab 66extern void __kvm_flush_vm_context(void);
48762767 67extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
72fc36b6 68extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
94d0e598 69extern void __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu);
342cd0ab 70
688c50aa
CD
71extern void __kvm_timer_set_cntvoff(u32 cntvoff_low, u32 cntvoff_high);
72
3f5c90b8
CD
73/* no VHE on 32-bit :( */
74static inline int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) { BUG(); return 0; }
75
76extern int __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu);
d4c7688c
MZ
77
78extern void __init_stage2_translation(void);
e537ecd7 79
acda5430 80extern u64 __vgic_v3_get_ich_vtr_el2(void);
328e5664
CD
81extern u64 __vgic_v3_read_vmcr(void);
82extern void __vgic_v3_write_vmcr(u32 vmcr);
acda5430 83extern void __vgic_v3_init_lrs(void);
328e5664 84
342cd0ab 85#endif
749cf76c
CD
86
87#endif /* __ARM_KVM_ASM_H__ */