blob: 3d5a5cd071bd15d648658473bc5a747e0ef1ff81 [file] [log] [blame]
Christoffer Dall749cf76c2013-01-20 18:28:06 -05001/*
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
Marc Zyngier1a61ae72016-01-02 13:57:18 +000022#include <asm/virt.h>
23
Christoffer Dall749cf76c2013-01-20 18:28:06 -050024#define ARM_EXCEPTION_RESET 0
25#define ARM_EXCEPTION_UNDEFINED 1
26#define ARM_EXCEPTION_SOFTWARE 2
27#define ARM_EXCEPTION_PREF_ABORT 3
28#define ARM_EXCEPTION_DATA_ABORT 4
29#define ARM_EXCEPTION_IRQ 5
30#define ARM_EXCEPTION_FIQ 6
Christoffer Dall342cd0a2013-01-20 18:28:06 -050031#define ARM_EXCEPTION_HVC 7
32
Victor Kamensky19b0e602014-06-12 09:30:02 -070033/*
34 * The rr_lo_hi macro swaps a pair of registers depending on
35 * current endianness. It is used in conjunction with ldrd and strd
36 * instructions that load/store a 64-bit value from/to memory to/from
37 * a pair of registers which are used with the mrrc and mcrr instructions.
38 * If used with the ldrd/strd instructions, the a1 parameter is the first
39 * source/destination register and the a2 parameter is the second
40 * source/destination register. Note that the ldrd/strd instructions
41 * already swap the bytes within the words correctly according to the
42 * endianness setting, but the order of the registers need to be effectively
43 * swapped when used with the mrrc/mcrr instructions.
44 */
45#ifdef CONFIG_CPU_ENDIAN_BE8
46#define rr_lo_hi(a1, a2) a2, a1
47#else
48#define rr_lo_hi(a1, a2) a1, a2
49#endif
50
Ard Biesheuvela0bf9772016-02-16 13:52:39 +010051#define kvm_ksym_ref(kva) (kva)
52
Christoffer Dall342cd0a2013-01-20 18:28:06 -050053#ifndef __ASSEMBLY__
Christoffer Dalld5d81842013-01-20 18:28:07 -050054struct kvm;
Christoffer Dall342cd0a2013-01-20 18:28:06 -050055struct kvm_vcpu;
56
57extern char __kvm_hyp_init[];
58extern char __kvm_hyp_init_end[];
59
Christoffer Dall342cd0a2013-01-20 18:28:06 -050060extern char __kvm_hyp_vector[];
61
Christoffer Dall342cd0a2013-01-20 18:28:06 -050062extern void __kvm_flush_vm_context(void);
Marc Zyngier48762762013-01-28 15:27:00 +000063extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
Mario Smarduch72fc36b2015-01-15 15:58:55 -080064extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
Christoffer Dall342cd0a2013-01-20 18:28:06 -050065
66extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
Marc Zyngierd4c76882016-02-01 19:56:31 +000067
68extern void __init_stage2_translation(void);
Christoffer Dall342cd0a2013-01-20 18:28:06 -050069#endif
Christoffer Dall749cf76c2013-01-20 18:28:06 -050070
71#endif /* __ARM_KVM_ASM_H__ */