Commit | Line | Data |
---|---|---|
bbf45ba5 HB |
1 | /* |
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. 2007 | |
16 | * | |
17 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> | |
18 | */ | |
19 | ||
20 | #ifndef __POWERPC_KVM_HOST_H__ | |
21 | #define __POWERPC_KVM_HOST_H__ | |
22 | ||
23 | #include <linux/mutex.h> | |
24 | #include <linux/timer.h> | |
25 | #include <linux/types.h> | |
26 | #include <linux/kvm_types.h> | |
27 | #include <asm/kvm_asm.h> | |
28 | ||
29 | #define KVM_MAX_VCPUS 1 | |
30 | #define KVM_MEMORY_SLOTS 32 | |
31 | /* memory slots that does not exposed to userspace */ | |
32 | #define KVM_PRIVATE_MEM_SLOTS 4 | |
33 | ||
588968b6 LV |
34 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 |
35 | ||
bbf45ba5 HB |
36 | /* We don't currently support large pages. */ |
37 | #define KVM_PAGES_PER_HPAGE (1<<31) | |
38 | ||
39 | struct kvm; | |
40 | struct kvm_run; | |
41 | struct kvm_vcpu; | |
42 | ||
43 | struct kvm_vm_stat { | |
44 | u32 remote_tlb_flush; | |
45 | }; | |
46 | ||
47 | struct kvm_vcpu_stat { | |
48 | u32 sum_exits; | |
49 | u32 mmio_exits; | |
50 | u32 dcr_exits; | |
51 | u32 signal_exits; | |
52 | u32 light_exits; | |
53 | /* Account for special types of light exits: */ | |
54 | u32 itlb_real_miss_exits; | |
55 | u32 itlb_virt_miss_exits; | |
56 | u32 dtlb_real_miss_exits; | |
57 | u32 dtlb_virt_miss_exits; | |
58 | u32 syscall_exits; | |
59 | u32 isi_exits; | |
60 | u32 dsi_exits; | |
61 | u32 emulated_inst_exits; | |
62 | u32 dec_exits; | |
63 | u32 ext_intr_exits; | |
45c5eb67 | 64 | u32 halt_wakeup; |
bbf45ba5 HB |
65 | }; |
66 | ||
73e75b41 HB |
67 | enum kvm_exit_types { |
68 | MMIO_EXITS, | |
69 | DCR_EXITS, | |
70 | SIGNAL_EXITS, | |
71 | ITLB_REAL_MISS_EXITS, | |
72 | ITLB_VIRT_MISS_EXITS, | |
73 | DTLB_REAL_MISS_EXITS, | |
74 | DTLB_VIRT_MISS_EXITS, | |
75 | SYSCALL_EXITS, | |
76 | ISI_EXITS, | |
77 | DSI_EXITS, | |
78 | EMULATED_INST_EXITS, | |
79 | EMULATED_MTMSRWE_EXITS, | |
80 | EMULATED_WRTEE_EXITS, | |
81 | EMULATED_MTSPR_EXITS, | |
82 | EMULATED_MFSPR_EXITS, | |
83 | EMULATED_MTMSR_EXITS, | |
84 | EMULATED_MFMSR_EXITS, | |
85 | EMULATED_TLBSX_EXITS, | |
86 | EMULATED_TLBWE_EXITS, | |
87 | EMULATED_RFI_EXITS, | |
88 | DEC_EXITS, | |
89 | EXT_INTR_EXITS, | |
90 | HALT_WAKEUP, | |
91 | USR_PR_INST, | |
92 | FP_UNAVAIL, | |
93 | DEBUG_EXITS, | |
94 | TIMEINGUEST, | |
95 | __NUMBER_OF_KVM_EXIT_TYPES | |
96 | }; | |
97 | ||
73e75b41 | 98 | /* allow access to big endian 32bit upper/lower parts and 64bit var */ |
7b701591 | 99 | struct kvmppc_exit_timing { |
73e75b41 HB |
100 | union { |
101 | u64 tv64; | |
102 | struct { | |
103 | u32 tbu, tbl; | |
104 | } tv32; | |
105 | }; | |
106 | }; | |
73e75b41 | 107 | |
bbf45ba5 HB |
108 | struct kvm_arch { |
109 | }; | |
110 | ||
111 | struct kvm_vcpu_arch { | |
bbf45ba5 HB |
112 | u32 host_stack; |
113 | u32 host_pid; | |
6a0ab738 HB |
114 | u32 host_dbcr0; |
115 | u32 host_dbcr1; | |
116 | u32 host_dbcr2; | |
117 | u32 host_iac[4]; | |
118 | u32 host_msr; | |
bbf45ba5 HB |
119 | |
120 | u64 fpr[32]; | |
5cf8ca22 | 121 | ulong gpr[32]; |
bbf45ba5 | 122 | |
5cf8ca22 | 123 | ulong pc; |
bbf45ba5 | 124 | u32 cr; |
5cf8ca22 HB |
125 | ulong ctr; |
126 | ulong lr; | |
127 | ulong xer; | |
bbf45ba5 | 128 | |
5cf8ca22 | 129 | ulong msr; |
bbf45ba5 | 130 | u32 mmucr; |
5cf8ca22 HB |
131 | ulong sprg0; |
132 | ulong sprg1; | |
133 | ulong sprg2; | |
134 | ulong sprg3; | |
135 | ulong sprg4; | |
136 | ulong sprg5; | |
137 | ulong sprg6; | |
138 | ulong sprg7; | |
139 | ulong srr0; | |
140 | ulong srr1; | |
141 | ulong csrr0; | |
142 | ulong csrr1; | |
143 | ulong dsrr0; | |
144 | ulong dsrr1; | |
145 | ulong dear; | |
146 | ulong esr; | |
bbf45ba5 HB |
147 | u32 dec; |
148 | u32 decar; | |
149 | u32 tbl; | |
150 | u32 tbu; | |
151 | u32 tcr; | |
152 | u32 tsr; | |
153 | u32 ivor[16]; | |
5cf8ca22 | 154 | ulong ivpr; |
bbf45ba5 | 155 | u32 pir; |
49dd2c49 HB |
156 | |
157 | u32 shadow_pid; | |
bbf45ba5 | 158 | u32 pid; |
49dd2c49 HB |
159 | u32 swap_pid; |
160 | ||
bbf45ba5 HB |
161 | u32 pvr; |
162 | u32 ccr0; | |
163 | u32 ccr1; | |
164 | u32 dbcr0; | |
165 | u32 dbcr1; | |
166 | ||
73e75b41 | 167 | #ifdef CONFIG_KVM_EXIT_TIMING |
7b701591 HB |
168 | struct kvmppc_exit_timing timing_exit; |
169 | struct kvmppc_exit_timing timing_last_enter; | |
73e75b41 HB |
170 | u32 last_exit_type; |
171 | u32 timing_count_type[__NUMBER_OF_KVM_EXIT_TYPES]; | |
172 | u64 timing_sum_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | |
173 | u64 timing_sum_quad_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | |
174 | u64 timing_min_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | |
175 | u64 timing_max_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | |
176 | u64 timing_last_exit; | |
177 | struct dentry *debugfs_exit_timing; | |
178 | #endif | |
179 | ||
bbf45ba5 | 180 | u32 last_inst; |
5cf8ca22 HB |
181 | ulong fault_dear; |
182 | ulong fault_esr; | |
bbf45ba5 HB |
183 | gpa_t paddr_accessed; |
184 | ||
185 | u8 io_gpr; /* GPR used as IO source/target */ | |
186 | u8 mmio_is_bigendian; | |
187 | u8 dcr_needed; | |
188 | u8 dcr_is_write; | |
189 | ||
190 | u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ | |
191 | ||
192 | struct timer_list dec_timer; | |
193 | unsigned long pending_exceptions; | |
194 | }; | |
195 | ||
bbf45ba5 | 196 | #endif /* __POWERPC_KVM_HOST_H__ */ |