xref: /openbmc/linux/arch/powerpc/include/asm/kvm_asm.h (revision d30f6e48)
1b8b572e1SStephen Rothwell /*
2b8b572e1SStephen Rothwell  * This program is free software; you can redistribute it and/or modify
3b8b572e1SStephen Rothwell  * it under the terms of the GNU General Public License, version 2, as
4b8b572e1SStephen Rothwell  * published by the Free Software Foundation.
5b8b572e1SStephen Rothwell  *
6b8b572e1SStephen Rothwell  * This program is distributed in the hope that it will be useful,
7b8b572e1SStephen Rothwell  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8b8b572e1SStephen Rothwell  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9b8b572e1SStephen Rothwell  * GNU General Public License for more details.
10b8b572e1SStephen Rothwell  *
11b8b572e1SStephen Rothwell  * You should have received a copy of the GNU General Public License
12b8b572e1SStephen Rothwell  * along with this program; if not, write to the Free Software
13b8b572e1SStephen Rothwell  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
14b8b572e1SStephen Rothwell  *
15b8b572e1SStephen Rothwell  * Copyright IBM Corp. 2008
16b8b572e1SStephen Rothwell  *
17b8b572e1SStephen Rothwell  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18b8b572e1SStephen Rothwell  */
19b8b572e1SStephen Rothwell 
20b8b572e1SStephen Rothwell #ifndef __POWERPC_KVM_ASM_H__
21b8b572e1SStephen Rothwell #define __POWERPC_KVM_ASM_H__
22b8b572e1SStephen Rothwell 
23b8b572e1SStephen Rothwell /* IVPR must be 64KiB-aligned. */
24b8b572e1SStephen Rothwell #define VCPU_SIZE_ORDER 4
25b8b572e1SStephen Rothwell #define VCPU_SIZE_LOG   (VCPU_SIZE_ORDER + 12)
26b8b572e1SStephen Rothwell #define VCPU_TLB_PGSZ   PPC44x_TLB_64K
27b8b572e1SStephen Rothwell #define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG)
28b8b572e1SStephen Rothwell 
29b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_CRITICAL 0
30b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_MACHINE_CHECK 1
31b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_DATA_STORAGE 2
32b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_INST_STORAGE 3
33b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_EXTERNAL 4
34b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_ALIGNMENT 5
35b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_PROGRAM 6
36b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_FP_UNAVAIL 7
37b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_SYSCALL 8
38b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_AP_UNAVAIL 9
39b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_DECREMENTER 10
40b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_FIT 11
41b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_WATCHDOG 12
42b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_DTLB_MISS 13
43b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_ITLB_MISS 14
44b8b572e1SStephen Rothwell #define BOOKE_INTERRUPT_DEBUG 15
45bb3a8a17SHollis Blanchard 
46bb3a8a17SHollis Blanchard /* E500 */
47bb3a8a17SHollis Blanchard #define BOOKE_INTERRUPT_SPE_UNAVAIL 32
48bb3a8a17SHollis Blanchard #define BOOKE_INTERRUPT_SPE_FP_DATA 33
49bb3a8a17SHollis Blanchard #define BOOKE_INTERRUPT_SPE_FP_ROUND 34
50bb3a8a17SHollis Blanchard #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
51d30f6e48SScott Wood #define BOOKE_INTERRUPT_DOORBELL 36
52d30f6e48SScott Wood #define BOOKE_INTERRUPT_DOORBELL_CRITICAL 37
53d30f6e48SScott Wood 
54d30f6e48SScott Wood /* booke_hv */
55d30f6e48SScott Wood #define BOOKE_INTERRUPT_GUEST_DBELL 38
56d30f6e48SScott Wood #define BOOKE_INTERRUPT_GUEST_DBELL_CRIT 39
57d30f6e48SScott Wood #define BOOKE_INTERRUPT_HV_SYSCALL 40
58d30f6e48SScott Wood #define BOOKE_INTERRUPT_HV_PRIV 41
59b8b572e1SStephen Rothwell 
6083cd259dSAlexander Graf /* book3s */
6183cd259dSAlexander Graf 
6283cd259dSAlexander Graf #define BOOK3S_INTERRUPT_SYSTEM_RESET	0x100
6383cd259dSAlexander Graf #define BOOK3S_INTERRUPT_MACHINE_CHECK	0x200
6483cd259dSAlexander Graf #define BOOK3S_INTERRUPT_DATA_STORAGE	0x300
6583cd259dSAlexander Graf #define BOOK3S_INTERRUPT_DATA_SEGMENT	0x380
6683cd259dSAlexander Graf #define BOOK3S_INTERRUPT_INST_STORAGE	0x400
6783cd259dSAlexander Graf #define BOOK3S_INTERRUPT_INST_SEGMENT	0x480
6883cd259dSAlexander Graf #define BOOK3S_INTERRUPT_EXTERNAL	0x500
6917bd1580SAlexander Graf #define BOOK3S_INTERRUPT_EXTERNAL_LEVEL	0x501
70a5d4f3adSBenjamin Herrenschmidt #define BOOK3S_INTERRUPT_EXTERNAL_HV	0x502
7183cd259dSAlexander Graf #define BOOK3S_INTERRUPT_ALIGNMENT	0x600
7283cd259dSAlexander Graf #define BOOK3S_INTERRUPT_PROGRAM	0x700
7383cd259dSAlexander Graf #define BOOK3S_INTERRUPT_FP_UNAVAIL	0x800
7483cd259dSAlexander Graf #define BOOK3S_INTERRUPT_DECREMENTER	0x900
75de56a948SPaul Mackerras #define BOOK3S_INTERRUPT_HV_DECREMENTER	0x980
7683cd259dSAlexander Graf #define BOOK3S_INTERRUPT_SYSCALL	0xc00
7783cd259dSAlexander Graf #define BOOK3S_INTERRUPT_TRACE		0xd00
78de56a948SPaul Mackerras #define BOOK3S_INTERRUPT_H_DATA_STORAGE	0xe00
79de56a948SPaul Mackerras #define BOOK3S_INTERRUPT_H_INST_STORAGE	0xe20
80de56a948SPaul Mackerras #define BOOK3S_INTERRUPT_H_EMUL_ASSIST	0xe40
8183cd259dSAlexander Graf #define BOOK3S_INTERRUPT_PERFMON	0xf00
8283cd259dSAlexander Graf #define BOOK3S_INTERRUPT_ALTIVEC	0xf20
8383cd259dSAlexander Graf #define BOOK3S_INTERRUPT_VSX		0xf40
8483cd259dSAlexander Graf 
8583cd259dSAlexander Graf #define BOOK3S_IRQPRIO_SYSTEM_RESET		0
8683cd259dSAlexander Graf #define BOOK3S_IRQPRIO_DATA_SEGMENT		1
8783cd259dSAlexander Graf #define BOOK3S_IRQPRIO_INST_SEGMENT		2
8883cd259dSAlexander Graf #define BOOK3S_IRQPRIO_DATA_STORAGE		3
8983cd259dSAlexander Graf #define BOOK3S_IRQPRIO_INST_STORAGE		4
9083cd259dSAlexander Graf #define BOOK3S_IRQPRIO_ALIGNMENT		5
9183cd259dSAlexander Graf #define BOOK3S_IRQPRIO_PROGRAM			6
9283cd259dSAlexander Graf #define BOOK3S_IRQPRIO_FP_UNAVAIL		7
9383cd259dSAlexander Graf #define BOOK3S_IRQPRIO_ALTIVEC			8
9483cd259dSAlexander Graf #define BOOK3S_IRQPRIO_VSX			9
9583cd259dSAlexander Graf #define BOOK3S_IRQPRIO_SYSCALL			10
9683cd259dSAlexander Graf #define BOOK3S_IRQPRIO_MACHINE_CHECK		11
9783cd259dSAlexander Graf #define BOOK3S_IRQPRIO_DEBUG			12
9883cd259dSAlexander Graf #define BOOK3S_IRQPRIO_EXTERNAL			13
9983cd259dSAlexander Graf #define BOOK3S_IRQPRIO_DECREMENTER		14
10083cd259dSAlexander Graf #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR	15
10117bd1580SAlexander Graf #define BOOK3S_IRQPRIO_EXTERNAL_LEVEL		16
10217bd1580SAlexander Graf #define BOOK3S_IRQPRIO_MAX			17
10383cd259dSAlexander Graf 
10483cd259dSAlexander Graf #define BOOK3S_HFLAG_DCBZ32			0x1
105e15a1137SAlexander Graf #define BOOK3S_HFLAG_SLB			0x2
1063c402a75SAlexander Graf #define BOOK3S_HFLAG_PAIRED_SINGLE		0x4
107b83d4a9cSAlexander Graf #define BOOK3S_HFLAG_NATIVE_PS			0x8
10883cd259dSAlexander Graf 
109b8b572e1SStephen Rothwell #define RESUME_FLAG_NV          (1<<0)  /* Reload guest nonvolatile state? */
110b8b572e1SStephen Rothwell #define RESUME_FLAG_HOST        (1<<1)  /* Resume host? */
111b8b572e1SStephen Rothwell 
112b8b572e1SStephen Rothwell #define RESUME_GUEST            0
113b8b572e1SStephen Rothwell #define RESUME_GUEST_NV         RESUME_FLAG_NV
114b8b572e1SStephen Rothwell #define RESUME_HOST             RESUME_FLAG_HOST
115b8b572e1SStephen Rothwell #define RESUME_HOST_NV          (RESUME_FLAG_HOST|RESUME_FLAG_NV)
116b8b572e1SStephen Rothwell 
117b4433a7cSAlexander Graf #define KVM_GUEST_MODE_NONE	0
118b4433a7cSAlexander Graf #define KVM_GUEST_MODE_GUEST	1
119b4433a7cSAlexander Graf #define KVM_GUEST_MODE_SKIP	2
120b4433a7cSAlexander Graf 
121b4433a7cSAlexander Graf #define KVM_INST_FETCH_FAILED	-1
122b4433a7cSAlexander Graf 
123b8b572e1SStephen Rothwell #endif /* __POWERPC_KVM_ASM_H__ */
124