diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 11:42:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 11:42:08 -0400 |
commit | f4b10bc60a310916bab5413f821b99ef845cac17 (patch) | |
tree | 904532e8cd93b88261f21427c4ec4917d4b3e79d /arch/powerpc/include | |
parent | 53ee7569ce8beb3fd3fc0817116c29298d72353f (diff) | |
parent | c8cfbb555eb3632bf3dcbe1a591c1f4d0c28681c (diff) |
Merge branch 'kvm-updates/2.6.40' of git://git.kernel.org/pub/scm/virt/kvm/kvm
* 'kvm-updates/2.6.40' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (131 commits)
KVM: MMU: Use ptep_user for cmpxchg_gpte()
KVM: Fix kvm mmu_notifier initialization order
KVM: Add documentation for KVM_CAP_NR_VCPUS
KVM: make guest mode entry to be rcu quiescent state
KVM: x86 emulator: Make jmp far emulation into a separate function
KVM: x86 emulator: Rename emulate_grpX() to em_grpX()
KVM: x86 emulator: Remove unused arg from emulate_pop()
KVM: x86 emulator: Remove unused arg from writeback()
KVM: x86 emulator: Remove unused arg from read_descriptor()
KVM: x86 emulator: Remove unused arg from seg_override()
KVM: Validate userspace_addr of memslot when registered
KVM: MMU: Clean up gpte reading with copy_from_user()
KVM: PPC: booke: add sregs support
KVM: PPC: booke: save/restore VRSAVE (a.k.a. USPRG0)
KVM: PPC: use ticks, not usecs, for exit timing
KVM: PPC: fix exit accounting for SPRs, tlbwe, tlbsx
KVM: PPC: e500: emulate SVR
KVM: VMX: Cache vmcs segment fields
KVM: x86 emulator: consolidate segment accessors
KVM: VMX: Avoid reading %rip unnecessarily when handling exceptions
...
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/kvm.h | 184 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_44x.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_e500.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_ppc.h | 9 |
5 files changed, 200 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h index 18ea6963ad77..d2ca5ed3877b 100644 --- a/arch/powerpc/include/asm/kvm.h +++ b/arch/powerpc/include/asm/kvm.h | |||
@@ -45,6 +45,114 @@ struct kvm_regs { | |||
45 | __u64 gpr[32]; | 45 | __u64 gpr[32]; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define KVM_SREGS_E_IMPL_NONE 0 | ||
49 | #define KVM_SREGS_E_IMPL_FSL 1 | ||
50 | |||
51 | #define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */ | ||
52 | |||
53 | /* | ||
54 | * Feature bits indicate which sections of the sregs struct are valid, | ||
55 | * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers | ||
56 | * corresponding to unset feature bits will not be modified. This allows | ||
57 | * restoring a checkpoint made without that feature, while keeping the | ||
58 | * default values of the new registers. | ||
59 | * | ||
60 | * KVM_SREGS_E_BASE contains: | ||
61 | * CSRR0/1 (refers to SRR2/3 on 40x) | ||
62 | * ESR | ||
63 | * DEAR | ||
64 | * MCSR | ||
65 | * TSR | ||
66 | * TCR | ||
67 | * DEC | ||
68 | * TB | ||
69 | * VRSAVE (USPRG0) | ||
70 | */ | ||
71 | #define KVM_SREGS_E_BASE (1 << 0) | ||
72 | |||
73 | /* | ||
74 | * KVM_SREGS_E_ARCH206 contains: | ||
75 | * | ||
76 | * PIR | ||
77 | * MCSRR0/1 | ||
78 | * DECAR | ||
79 | * IVPR | ||
80 | */ | ||
81 | #define KVM_SREGS_E_ARCH206 (1 << 1) | ||
82 | |||
83 | /* | ||
84 | * Contains EPCR, plus the upper half of 64-bit registers | ||
85 | * that are 32-bit on 32-bit implementations. | ||
86 | */ | ||
87 | #define KVM_SREGS_E_64 (1 << 2) | ||
88 | |||
89 | #define KVM_SREGS_E_SPRG8 (1 << 3) | ||
90 | #define KVM_SREGS_E_MCIVPR (1 << 4) | ||
91 | |||
92 | /* | ||
93 | * IVORs are used -- contains IVOR0-15, plus additional IVORs | ||
94 | * in combination with an appropriate feature bit. | ||
95 | */ | ||
96 | #define KVM_SREGS_E_IVOR (1 << 5) | ||
97 | |||
98 | /* | ||
99 | * Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG. | ||
100 | * Also TLBnPS if MMUCFG[MAVN] = 1. | ||
101 | */ | ||
102 | #define KVM_SREGS_E_ARCH206_MMU (1 << 6) | ||
103 | |||
104 | /* DBSR, DBCR, IAC, DAC, DVC */ | ||
105 | #define KVM_SREGS_E_DEBUG (1 << 7) | ||
106 | |||
107 | /* Enhanced debug -- DSRR0/1, SPRG9 */ | ||
108 | #define KVM_SREGS_E_ED (1 << 8) | ||
109 | |||
110 | /* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ | ||
111 | #define KVM_SREGS_E_SPE (1 << 9) | ||
112 | |||
113 | /* External Proxy (EXP) -- EPR */ | ||
114 | #define KVM_SREGS_EXP (1 << 10) | ||
115 | |||
116 | /* External PID (E.PD) -- EPSC/EPLC */ | ||
117 | #define KVM_SREGS_E_PD (1 << 11) | ||
118 | |||
119 | /* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */ | ||
120 | #define KVM_SREGS_E_PC (1 << 12) | ||
121 | |||
122 | /* Page table (E.PT) -- EPTCFG */ | ||
123 | #define KVM_SREGS_E_PT (1 << 13) | ||
124 | |||
125 | /* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */ | ||
126 | #define KVM_SREGS_E_PM (1 << 14) | ||
127 | |||
128 | /* | ||
129 | * Special updates: | ||
130 | * | ||
131 | * Some registers may change even while a vcpu is not running. | ||
132 | * To avoid losing these changes, by default these registers are | ||
133 | * not updated by KVM_SET_SREGS. To force an update, set the bit | ||
134 | * in u.e.update_special corresponding to the register to be updated. | ||
135 | * | ||
136 | * The update_special field is zero on return from KVM_GET_SREGS. | ||
137 | * | ||
138 | * When restoring a checkpoint, the caller can set update_special | ||
139 | * to 0xffffffff to ensure that everything is restored, even new features | ||
140 | * that the caller doesn't know about. | ||
141 | */ | ||
142 | #define KVM_SREGS_E_UPDATE_MCSR (1 << 0) | ||
143 | #define KVM_SREGS_E_UPDATE_TSR (1 << 1) | ||
144 | #define KVM_SREGS_E_UPDATE_DEC (1 << 2) | ||
145 | #define KVM_SREGS_E_UPDATE_DBSR (1 << 3) | ||
146 | |||
147 | /* | ||
148 | * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a | ||
149 | * previous KVM_GET_REGS. | ||
150 | * | ||
151 | * Unless otherwise indicated, setting any register with KVM_SET_SREGS | ||
152 | * directly sets its value. It does not trigger any special semantics such | ||
153 | * as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct | ||
154 | * just received from KVM_GET_SREGS is always a no-op. | ||
155 | */ | ||
48 | struct kvm_sregs { | 156 | struct kvm_sregs { |
49 | __u32 pvr; | 157 | __u32 pvr; |
50 | union { | 158 | union { |
@@ -62,6 +170,82 @@ struct kvm_sregs { | |||
62 | __u64 dbat[8]; | 170 | __u64 dbat[8]; |
63 | } ppc32; | 171 | } ppc32; |
64 | } s; | 172 | } s; |
173 | struct { | ||
174 | union { | ||
175 | struct { /* KVM_SREGS_E_IMPL_FSL */ | ||
176 | __u32 features; /* KVM_SREGS_E_FSL_ */ | ||
177 | __u32 svr; | ||
178 | __u64 mcar; | ||
179 | __u32 hid0; | ||
180 | |||
181 | /* KVM_SREGS_E_FSL_PIDn */ | ||
182 | __u32 pid1, pid2; | ||
183 | } fsl; | ||
184 | __u8 pad[256]; | ||
185 | } impl; | ||
186 | |||
187 | __u32 features; /* KVM_SREGS_E_ */ | ||
188 | __u32 impl_id; /* KVM_SREGS_E_IMPL_ */ | ||
189 | __u32 update_special; /* KVM_SREGS_E_UPDATE_ */ | ||
190 | __u32 pir; /* read-only */ | ||
191 | __u64 sprg8; | ||
192 | __u64 sprg9; /* E.ED */ | ||
193 | __u64 csrr0; | ||
194 | __u64 dsrr0; /* E.ED */ | ||
195 | __u64 mcsrr0; | ||
196 | __u32 csrr1; | ||
197 | __u32 dsrr1; /* E.ED */ | ||
198 | __u32 mcsrr1; | ||
199 | __u32 esr; | ||
200 | __u64 dear; | ||
201 | __u64 ivpr; | ||
202 | __u64 mcivpr; | ||
203 | __u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */ | ||
204 | |||
205 | __u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */ | ||
206 | __u32 tcr; | ||
207 | __u32 decar; | ||
208 | __u32 dec; /* KVM_SREGS_E_UPDATE_DEC */ | ||
209 | |||
210 | /* | ||
211 | * Userspace can read TB directly, but the | ||
212 | * value reported here is consistent with "dec". | ||
213 | * | ||
214 | * Read-only. | ||
215 | */ | ||
216 | __u64 tb; | ||
217 | |||
218 | __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */ | ||
219 | __u32 dbcr[3]; | ||
220 | __u32 iac[4]; | ||
221 | __u32 dac[2]; | ||
222 | __u32 dvc[2]; | ||
223 | __u8 num_iac; /* read-only */ | ||
224 | __u8 num_dac; /* read-only */ | ||
225 | __u8 num_dvc; /* read-only */ | ||
226 | __u8 pad; | ||
227 | |||
228 | __u32 epr; /* EXP */ | ||
229 | __u32 vrsave; /* a.k.a. USPRG0 */ | ||
230 | __u32 epcr; /* KVM_SREGS_E_64 */ | ||
231 | |||
232 | __u32 mas0; | ||
233 | __u32 mas1; | ||
234 | __u64 mas2; | ||
235 | __u64 mas7_3; | ||
236 | __u32 mas4; | ||
237 | __u32 mas6; | ||
238 | |||
239 | __u32 ivor_low[16]; /* IVOR0-15 */ | ||
240 | __u32 ivor_high[18]; /* IVOR32+, plus room to expand */ | ||
241 | |||
242 | __u32 mmucfg; /* read-only */ | ||
243 | __u32 eptcfg; /* E.PT, read-only */ | ||
244 | __u32 tlbcfg[4];/* read-only */ | ||
245 | __u32 tlbps[4]; /* read-only */ | ||
246 | |||
247 | __u32 eplc, epsc; /* E.PD */ | ||
248 | } e; | ||
65 | __u8 pad[1020]; | 249 | __u8 pad[1020]; |
66 | } u; | 250 | } u; |
67 | }; | 251 | }; |
diff --git a/arch/powerpc/include/asm/kvm_44x.h b/arch/powerpc/include/asm/kvm_44x.h index d22d39942a92..a0e57618ff33 100644 --- a/arch/powerpc/include/asm/kvm_44x.h +++ b/arch/powerpc/include/asm/kvm_44x.h | |||
@@ -61,7 +61,6 @@ static inline struct kvmppc_vcpu_44x *to_44x(struct kvm_vcpu *vcpu) | |||
61 | return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu); | 61 | return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu); |
62 | } | 62 | } |
63 | 63 | ||
64 | void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid); | ||
65 | void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu); | 64 | void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu); |
66 | void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu); | 65 | void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu); |
67 | 66 | ||
diff --git a/arch/powerpc/include/asm/kvm_e500.h b/arch/powerpc/include/asm/kvm_e500.h index 7fea26fffb25..7a2a565f88c4 100644 --- a/arch/powerpc/include/asm/kvm_e500.h +++ b/arch/powerpc/include/asm/kvm_e500.h | |||
@@ -43,6 +43,7 @@ struct kvmppc_vcpu_e500 { | |||
43 | 43 | ||
44 | u32 host_pid[E500_PID_NUM]; | 44 | u32 host_pid[E500_PID_NUM]; |
45 | u32 pid[E500_PID_NUM]; | 45 | u32 pid[E500_PID_NUM]; |
46 | u32 svr; | ||
46 | 47 | ||
47 | u32 mas0; | 48 | u32 mas0; |
48 | u32 mas1; | 49 | u32 mas1; |
@@ -58,6 +59,7 @@ struct kvmppc_vcpu_e500 { | |||
58 | u32 hid1; | 59 | u32 hid1; |
59 | u32 tlb0cfg; | 60 | u32 tlb0cfg; |
60 | u32 tlb1cfg; | 61 | u32 tlb1cfg; |
62 | u64 mcar; | ||
61 | 63 | ||
62 | struct kvm_vcpu vcpu; | 64 | struct kvm_vcpu vcpu; |
63 | }; | 65 | }; |
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index bba3b9b72a39..186f150b9b89 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -223,6 +223,7 @@ struct kvm_vcpu_arch { | |||
223 | ulong hflags; | 223 | ulong hflags; |
224 | ulong guest_owned_ext; | 224 | ulong guest_owned_ext; |
225 | #endif | 225 | #endif |
226 | u32 vrsave; /* also USPRG0 */ | ||
226 | u32 mmucr; | 227 | u32 mmucr; |
227 | ulong sprg4; | 228 | ulong sprg4; |
228 | ulong sprg5; | 229 | ulong sprg5; |
@@ -232,6 +233,9 @@ struct kvm_vcpu_arch { | |||
232 | ulong csrr1; | 233 | ulong csrr1; |
233 | ulong dsrr0; | 234 | ulong dsrr0; |
234 | ulong dsrr1; | 235 | ulong dsrr1; |
236 | ulong mcsrr0; | ||
237 | ulong mcsrr1; | ||
238 | ulong mcsr; | ||
235 | ulong esr; | 239 | ulong esr; |
236 | u32 dec; | 240 | u32 dec; |
237 | u32 decar; | 241 | u32 decar; |
@@ -255,6 +259,7 @@ struct kvm_vcpu_arch { | |||
255 | u32 dbsr; | 259 | u32 dbsr; |
256 | 260 | ||
257 | #ifdef CONFIG_KVM_EXIT_TIMING | 261 | #ifdef CONFIG_KVM_EXIT_TIMING |
262 | struct mutex exit_timing_lock; | ||
258 | struct kvmppc_exit_timing timing_exit; | 263 | struct kvmppc_exit_timing timing_exit; |
259 | struct kvmppc_exit_timing timing_last_enter; | 264 | struct kvmppc_exit_timing timing_last_enter; |
260 | u32 last_exit_type; | 265 | u32 last_exit_type; |
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index ecb3bc74c344..9345238edecf 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h | |||
@@ -61,6 +61,7 @@ extern int kvmppc_emulate_instruction(struct kvm_run *run, | |||
61 | struct kvm_vcpu *vcpu); | 61 | struct kvm_vcpu *vcpu); |
62 | extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu); | 62 | extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu); |
63 | extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu); | 63 | extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu); |
64 | extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb); | ||
64 | 65 | ||
65 | /* Core-specific hooks */ | 66 | /* Core-specific hooks */ |
66 | 67 | ||
@@ -142,4 +143,12 @@ static inline u32 kvmppc_set_field(u64 inst, int msb, int lsb, int value) | |||
142 | return r; | 143 | return r; |
143 | } | 144 | } |
144 | 145 | ||
146 | void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); | ||
147 | int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); | ||
148 | |||
149 | void kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); | ||
150 | int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); | ||
151 | |||
152 | void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid); | ||
153 | |||
145 | #endif /* __POWERPC_KVM_PPC_H__ */ | 154 | #endif /* __POWERPC_KVM_PPC_H__ */ |