aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-02-19 05:00:33 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 05:34:53 -0400
commitd6d549b20776c937cb4717b24ef05baec4768f99 (patch)
tree10ba0ff79b97840854c548334e9d2008e777769c /arch/powerpc/kvm
parent3c402a75ea66e7aafa212077d1f93f1b560d0bd0 (diff)
KVM: PPC: Add Gekko SPRs
The Gekko has some SPR values that differ from other PPC core values and also some additional ones. Let's add support for them in our mfspr/mtspr emulator. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/book3s_64_emulate.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s_64_emulate.c b/arch/powerpc/kvm/book3s_64_emulate.c
index 2b0ee7e040c..bb4a7c1f8f0 100644
--- a/arch/powerpc/kvm/book3s_64_emulate.c
+++ b/arch/powerpc/kvm/book3s_64_emulate.c
@@ -42,6 +42,15 @@
42/* DCBZ is actually 1014, but we patch it to 1010 so we get a trap */ 42/* DCBZ is actually 1014, but we patch it to 1010 so we get a trap */
43#define OP_31_XOP_DCBZ 1010 43#define OP_31_XOP_DCBZ 1010
44 44
45#define SPRN_GQR0 912
46#define SPRN_GQR1 913
47#define SPRN_GQR2 914
48#define SPRN_GQR3 915
49#define SPRN_GQR4 916
50#define SPRN_GQR5 917
51#define SPRN_GQR6 918
52#define SPRN_GQR7 919
53
45int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 54int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
46 unsigned int inst, int *advance) 55 unsigned int inst, int *advance)
47{ 56{
@@ -268,7 +277,29 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
268 case SPRN_HID2: 277 case SPRN_HID2:
269 to_book3s(vcpu)->hid[2] = spr_val; 278 to_book3s(vcpu)->hid[2] = spr_val;
270 break; 279 break;
280 case SPRN_HID2_GEKKO:
281 to_book3s(vcpu)->hid[2] = spr_val;
282 /* HID2.PSE controls paired single on gekko */
283 switch (vcpu->arch.pvr) {
284 case 0x00080200: /* lonestar 2.0 */
285 case 0x00088202: /* lonestar 2.2 */
286 case 0x70000100: /* gekko 1.0 */
287 case 0x00080100: /* gekko 2.0 */
288 case 0x00083203: /* gekko 2.3a */
289 case 0x00083213: /* gekko 2.3b */
290 case 0x00083204: /* gekko 2.4 */
291 case 0x00083214: /* gekko 2.4e (8SE) - retail HW2 */
292 if (spr_val & (1 << 29)) { /* HID2.PSE */
293 vcpu->arch.hflags |= BOOK3S_HFLAG_PAIRED_SINGLE;
294 kvmppc_giveup_ext(vcpu, MSR_FP);
295 } else {
296 vcpu->arch.hflags &= ~BOOK3S_HFLAG_PAIRED_SINGLE;
297 }
298 break;
299 }
300 break;
271 case SPRN_HID4: 301 case SPRN_HID4:
302 case SPRN_HID4_GEKKO:
272 to_book3s(vcpu)->hid[4] = spr_val; 303 to_book3s(vcpu)->hid[4] = spr_val;
273 break; 304 break;
274 case SPRN_HID5: 305 case SPRN_HID5:
@@ -278,12 +309,30 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
278 (mfmsr() & MSR_HV)) 309 (mfmsr() & MSR_HV))
279 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; 310 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
280 break; 311 break;
312 case SPRN_GQR0:
313 case SPRN_GQR1:
314 case SPRN_GQR2:
315 case SPRN_GQR3:
316 case SPRN_GQR4:
317 case SPRN_GQR5:
318 case SPRN_GQR6:
319 case SPRN_GQR7:
320 to_book3s(vcpu)->gqr[sprn - SPRN_GQR0] = spr_val;
321 break;
281 case SPRN_ICTC: 322 case SPRN_ICTC:
282 case SPRN_THRM1: 323 case SPRN_THRM1:
283 case SPRN_THRM2: 324 case SPRN_THRM2:
284 case SPRN_THRM3: 325 case SPRN_THRM3:
285 case SPRN_CTRLF: 326 case SPRN_CTRLF:
286 case SPRN_CTRLT: 327 case SPRN_CTRLT:
328 case SPRN_L2CR:
329 case SPRN_MMCR0_GEKKO:
330 case SPRN_MMCR1_GEKKO:
331 case SPRN_PMC1_GEKKO:
332 case SPRN_PMC2_GEKKO:
333 case SPRN_PMC3_GEKKO:
334 case SPRN_PMC4_GEKKO:
335 case SPRN_WPAR_GEKKO:
287 break; 336 break;
288 default: 337 default:
289 printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn); 338 printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn);
@@ -320,19 +369,40 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
320 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[1]); 369 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[1]);
321 break; 370 break;
322 case SPRN_HID2: 371 case SPRN_HID2:
372 case SPRN_HID2_GEKKO:
323 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[2]); 373 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[2]);
324 break; 374 break;
325 case SPRN_HID4: 375 case SPRN_HID4:
376 case SPRN_HID4_GEKKO:
326 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[4]); 377 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[4]);
327 break; 378 break;
328 case SPRN_HID5: 379 case SPRN_HID5:
329 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[5]); 380 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->hid[5]);
330 break; 381 break;
382 case SPRN_GQR0:
383 case SPRN_GQR1:
384 case SPRN_GQR2:
385 case SPRN_GQR3:
386 case SPRN_GQR4:
387 case SPRN_GQR5:
388 case SPRN_GQR6:
389 case SPRN_GQR7:
390 kvmppc_set_gpr(vcpu, rt,
391 to_book3s(vcpu)->gqr[sprn - SPRN_GQR0]);
392 break;
331 case SPRN_THRM1: 393 case SPRN_THRM1:
332 case SPRN_THRM2: 394 case SPRN_THRM2:
333 case SPRN_THRM3: 395 case SPRN_THRM3:
334 case SPRN_CTRLF: 396 case SPRN_CTRLF:
335 case SPRN_CTRLT: 397 case SPRN_CTRLT:
398 case SPRN_L2CR:
399 case SPRN_MMCR0_GEKKO:
400 case SPRN_MMCR1_GEKKO:
401 case SPRN_PMC1_GEKKO:
402 case SPRN_PMC2_GEKKO:
403 case SPRN_PMC3_GEKKO:
404 case SPRN_PMC4_GEKKO:
405 case SPRN_WPAR_GEKKO:
336 kvmppc_set_gpr(vcpu, rt, 0); 406 kvmppc_set_gpr(vcpu, rt, 0);
337 break; 407 break;
338 default: 408 default: