blob: 5b75046743975704a01f6e612b80867d64796c84 [file] [log] [blame]
Hollis Blanchardbbf45ba2008-04-16 23:28:09 -05001/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __POWERPC_KVM_ASM_H__
21#define __POWERPC_KVM_ASM_H__
22
23/* IVPR must be 64KiB-aligned. */
24#define VCPU_SIZE_ORDER 4
25#define VCPU_SIZE_LOG (VCPU_SIZE_ORDER + 12)
26#define VCPU_TLB_PGSZ PPC44x_TLB_64K
27#define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG)
28
29#define BOOKE_INTERRUPT_CRITICAL 0
30#define BOOKE_INTERRUPT_MACHINE_CHECK 1
31#define BOOKE_INTERRUPT_DATA_STORAGE 2
32#define BOOKE_INTERRUPT_INST_STORAGE 3
33#define BOOKE_INTERRUPT_EXTERNAL 4
34#define BOOKE_INTERRUPT_ALIGNMENT 5
35#define BOOKE_INTERRUPT_PROGRAM 6
36#define BOOKE_INTERRUPT_FP_UNAVAIL 7
37#define BOOKE_INTERRUPT_SYSCALL 8
38#define BOOKE_INTERRUPT_AP_UNAVAIL 9
39#define BOOKE_INTERRUPT_DECREMENTER 10
40#define BOOKE_INTERRUPT_FIT 11
41#define BOOKE_INTERRUPT_WATCHDOG 12
42#define BOOKE_INTERRUPT_DTLB_MISS 13
43#define BOOKE_INTERRUPT_ITLB_MISS 14
44#define BOOKE_INTERRUPT_DEBUG 15
Hollis Blanchardbb3a8a12009-01-03 16:23:13 -060045
46/* E500 */
47#define BOOKE_INTERRUPT_SPE_UNAVAIL 32
48#define BOOKE_INTERRUPT_SPE_FP_DATA 33
49#define BOOKE_INTERRUPT_SPE_FP_ROUND 34
50#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
Hollis Blanchardbbf45ba2008-04-16 23:28:09 -050051
Alexander Graf83cd2592009-10-30 05:47:03 +000052/* book3s */
53
54#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
55#define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200
56#define BOOK3S_INTERRUPT_DATA_STORAGE 0x300
57#define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380
58#define BOOK3S_INTERRUPT_INST_STORAGE 0x400
59#define BOOK3S_INTERRUPT_INST_SEGMENT 0x480
60#define BOOK3S_INTERRUPT_EXTERNAL 0x500
Alexander Graf17bd1582010-08-30 10:44:15 +020061#define BOOK3S_INTERRUPT_EXTERNAL_LEVEL 0x501
Alexander Graf83cd2592009-10-30 05:47:03 +000062#define BOOK3S_INTERRUPT_ALIGNMENT 0x600
63#define BOOK3S_INTERRUPT_PROGRAM 0x700
64#define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800
65#define BOOK3S_INTERRUPT_DECREMENTER 0x900
66#define BOOK3S_INTERRUPT_SYSCALL 0xc00
67#define BOOK3S_INTERRUPT_TRACE 0xd00
68#define BOOK3S_INTERRUPT_PERFMON 0xf00
69#define BOOK3S_INTERRUPT_ALTIVEC 0xf20
70#define BOOK3S_INTERRUPT_VSX 0xf40
71
72#define BOOK3S_IRQPRIO_SYSTEM_RESET 0
73#define BOOK3S_IRQPRIO_DATA_SEGMENT 1
74#define BOOK3S_IRQPRIO_INST_SEGMENT 2
75#define BOOK3S_IRQPRIO_DATA_STORAGE 3
76#define BOOK3S_IRQPRIO_INST_STORAGE 4
77#define BOOK3S_IRQPRIO_ALIGNMENT 5
78#define BOOK3S_IRQPRIO_PROGRAM 6
79#define BOOK3S_IRQPRIO_FP_UNAVAIL 7
80#define BOOK3S_IRQPRIO_ALTIVEC 8
81#define BOOK3S_IRQPRIO_VSX 9
82#define BOOK3S_IRQPRIO_SYSCALL 10
83#define BOOK3S_IRQPRIO_MACHINE_CHECK 11
84#define BOOK3S_IRQPRIO_DEBUG 12
85#define BOOK3S_IRQPRIO_EXTERNAL 13
86#define BOOK3S_IRQPRIO_DECREMENTER 14
87#define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15
Alexander Graf17bd1582010-08-30 10:44:15 +020088#define BOOK3S_IRQPRIO_EXTERNAL_LEVEL 16
89#define BOOK3S_IRQPRIO_MAX 17
Alexander Graf83cd2592009-10-30 05:47:03 +000090
91#define BOOK3S_HFLAG_DCBZ32 0x1
Alexander Grafe15a1132009-11-30 03:02:02 +000092#define BOOK3S_HFLAG_SLB 0x2
Alexander Graf3c402a72010-02-19 11:00:32 +010093#define BOOK3S_HFLAG_PAIRED_SINGLE 0x4
Alexander Grafb83d4a92010-04-20 02:49:54 +020094#define BOOK3S_HFLAG_NATIVE_PS 0x8
Alexander Graf83cd2592009-10-30 05:47:03 +000095
Hollis Blanchardbbf45ba2008-04-16 23:28:09 -050096#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
97#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
98
99#define RESUME_GUEST 0
100#define RESUME_GUEST_NV RESUME_FLAG_NV
101#define RESUME_HOST RESUME_FLAG_HOST
102#define RESUME_HOST_NV (RESUME_FLAG_HOST|RESUME_FLAG_NV)
103
Alexander Grafb4433a72010-01-08 02:58:04 +0100104#define KVM_GUEST_MODE_NONE 0
105#define KVM_GUEST_MODE_GUEST 1
106#define KVM_GUEST_MODE_SKIP 2
107
108#define KVM_INST_FETCH_FAILED -1
109
Hollis Blanchardbbf45ba2008-04-16 23:28:09 -0500110#endif /* __POWERPC_KVM_ASM_H__ */