diff options
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_emulate.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index 46763d10ad52..5a56e1c5f851 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -81,6 +81,8 @@ struct kvmppc_vcpu_book3s { | |||
81 | u64 sdr1; | 81 | u64 sdr1; |
82 | u64 hior; | 82 | u64 hior; |
83 | u64 msr_mask; | 83 | u64 msr_mask; |
84 | u64 purr_offset; | ||
85 | u64 spurr_offset; | ||
84 | #ifdef CONFIG_PPC_BOOK3S_32 | 86 | #ifdef CONFIG_PPC_BOOK3S_32 |
85 | u32 vsid_pool[VSID_POOL_SIZE]; | 87 | u32 vsid_pool[VSID_POOL_SIZE]; |
86 | u32 vsid_next; | 88 | u32 vsid_next; |
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c index b9a989dc76cc..d31a716f7f2b 100644 --- a/arch/powerpc/kvm/book3s_emulate.c +++ b/arch/powerpc/kvm/book3s_emulate.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/kvm_book3s.h> | 22 | #include <asm/kvm_book3s.h> |
23 | #include <asm/reg.h> | 23 | #include <asm/reg.h> |
24 | #include <asm/switch_to.h> | 24 | #include <asm/switch_to.h> |
25 | #include <asm/time.h> | ||
25 | 26 | ||
26 | #define OP_19_XOP_RFID 18 | 27 | #define OP_19_XOP_RFID 18 |
27 | #define OP_19_XOP_RFI 50 | 28 | #define OP_19_XOP_RFI 50 |
@@ -395,6 +396,12 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) | |||
395 | (mfmsr() & MSR_HV)) | 396 | (mfmsr() & MSR_HV)) |
396 | vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; | 397 | vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; |
397 | break; | 398 | break; |
399 | case SPRN_PURR: | ||
400 | to_book3s(vcpu)->purr_offset = spr_val - get_tb(); | ||
401 | break; | ||
402 | case SPRN_SPURR: | ||
403 | to_book3s(vcpu)->spurr_offset = spr_val - get_tb(); | ||
404 | break; | ||
398 | case SPRN_GQR0: | 405 | case SPRN_GQR0: |
399 | case SPRN_GQR1: | 406 | case SPRN_GQR1: |
400 | case SPRN_GQR2: | 407 | case SPRN_GQR2: |
@@ -412,6 +419,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) | |||
412 | case SPRN_CTRLF: | 419 | case SPRN_CTRLF: |
413 | case SPRN_CTRLT: | 420 | case SPRN_CTRLT: |
414 | case SPRN_L2CR: | 421 | case SPRN_L2CR: |
422 | case SPRN_DSCR: | ||
415 | case SPRN_MMCR0_GEKKO: | 423 | case SPRN_MMCR0_GEKKO: |
416 | case SPRN_MMCR1_GEKKO: | 424 | case SPRN_MMCR1_GEKKO: |
417 | case SPRN_PMC1_GEKKO: | 425 | case SPRN_PMC1_GEKKO: |
@@ -483,9 +491,15 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val) | |||
483 | *spr_val = to_book3s(vcpu)->hid[5]; | 491 | *spr_val = to_book3s(vcpu)->hid[5]; |
484 | break; | 492 | break; |
485 | case SPRN_CFAR: | 493 | case SPRN_CFAR: |
486 | case SPRN_PURR: | 494 | case SPRN_DSCR: |
487 | *spr_val = 0; | 495 | *spr_val = 0; |
488 | break; | 496 | break; |
497 | case SPRN_PURR: | ||
498 | *spr_val = get_tb() + to_book3s(vcpu)->purr_offset; | ||
499 | break; | ||
500 | case SPRN_SPURR: | ||
501 | *spr_val = get_tb() + to_book3s(vcpu)->purr_offset; | ||
502 | break; | ||
489 | case SPRN_GQR0: | 503 | case SPRN_GQR0: |
490 | case SPRN_GQR1: | 504 | case SPRN_GQR1: |
491 | case SPRN_GQR2: | 505 | case SPRN_GQR2: |