]> Pileus Git - ~andy/linux/blob - arch/powerpc/include/asm/kvm_booke_hv_asm.h
KVM: PPC: booke: category E.HV (GS-mode) support
[~andy/linux] / arch / powerpc / include / asm / kvm_booke_hv_asm.h
1 /*
2  * Copyright 2010-2011 Freescale Semiconductor, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License, version 2, as
6  * published by the Free Software Foundation.
7  */
8
9 #ifndef ASM_KVM_BOOKE_HV_ASM_H
10 #define ASM_KVM_BOOKE_HV_ASM_H
11
12 #ifdef __ASSEMBLY__
13
14 /*
15  * All exceptions from guest state must go through KVM
16  * (except for those which are delivered directly to the guest) --
17  * there are no exceptions for which we fall through directly to
18  * the normal host handler.
19  *
20  * Expected inputs (normal exceptions):
21  *   SCRATCH0 = saved r10
22  *   r10 = thread struct
23  *   r11 = appropriate SRR1 variant (currently used as scratch)
24  *   r13 = saved CR
25  *   *(r10 + THREAD_NORMSAVE(0)) = saved r11
26  *   *(r10 + THREAD_NORMSAVE(2)) = saved r13
27  *
28  * Expected inputs (crit/mcheck/debug exceptions):
29  *   appropriate SCRATCH = saved r8
30  *   r8 = exception level stack frame
31  *   r9 = *(r8 + _CCR) = saved CR
32  *   r11 = appropriate SRR1 variant (currently used as scratch)
33  *   *(r8 + GPR9) = saved r9
34  *   *(r8 + GPR10) = saved r10 (r10 not yet clobbered)
35  *   *(r8 + GPR11) = saved r11
36  */
37 .macro DO_KVM intno srr1
38 #ifdef CONFIG_KVM_BOOKE_HV
39 BEGIN_FTR_SECTION
40         mtocrf  0x80, r11       /* check MSR[GS] without clobbering reg */
41         bf      3, kvmppc_resume_\intno\()_\srr1
42         b       kvmppc_handler_\intno\()_\srr1
43 kvmppc_resume_\intno\()_\srr1:
44 END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
45 #endif
46 .endm
47
48 #endif /*__ASSEMBLY__ */
49 #endif /* ASM_KVM_BOOKE_HV_ASM_H */