]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
KVM: PPC: booke: Added DECAR support
authorBharat Bhushan <r65777@freescale.com>
Sun, 20 May 2012 23:21:23 +0000 (23:21 +0000)
committerAlexander Graf <agraf@suse.de>
Wed, 30 May 2012 09:43:11 +0000 (11:43 +0200)
Added the decrementer auto-reload support. DECAR is readable
on e500v2/e500mc and later cpus.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/booke.c
arch/powerpc/kvm/booke_emulate.c
arch/powerpc/kvm/e500_emulate.c

index dd783beb88b3e8fe577413117ee8ab80e259e630..50ea12fd7bf5eeab23e6fc1bccafdf4dbe2ad89b 100644 (file)
@@ -418,7 +418,9 @@ struct kvm_vcpu_arch {
        ulong mcsrr1;
        ulong mcsr;
        u32 dec;
+#ifdef CONFIG_BOOKE
        u32 decar;
+#endif
        u32 tbl;
        u32 tbu;
        u32 tcr;
index 72f13f4a06e0d0bb16e442b9840f87c9c8b1339b..86681eec60b1e81380417ad9dac009b84e1ca5f8 100644 (file)
@@ -1267,6 +1267,11 @@ void kvmppc_decrementer_func(unsigned long data)
 {
        struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
 
+       if (vcpu->arch.tcr & TCR_ARE) {
+               vcpu->arch.dec = vcpu->arch.decar;
+               kvmppc_emulate_dec(vcpu);
+       }
+
        kvmppc_set_tsr_bits(vcpu, TSR_DIS);
 }
 
index 6c76397f2af482d622caee0e92f2d0da8cf3e77e..9eb9809eb13e2aa8ffee131c3550ba73bb4ce2f1 100644 (file)
@@ -129,6 +129,9 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
                kvmppc_set_tcr(vcpu, spr_val);
                break;
 
+       case SPRN_DECAR:
+               vcpu->arch.decar = spr_val;
+               break;
        /*
         * Note: SPRG4-7 are user-readable.
         * These values are loaded into the real SPRGs when resuming the
index 8b99e076dc8183f0f82109c7304799a0f8d8ac81..e04b0ef55ce0e131df45cdadd06d95d004129bbb 100644 (file)
@@ -269,6 +269,9 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
                *spr_val = vcpu->arch.shared->mas7_3 >> 32;
                break;
 #endif
+       case SPRN_DECAR:
+               *spr_val = vcpu->arch.decar;
+               break;
        case SPRN_TLB0CFG:
                *spr_val = vcpu->arch.tlbcfg[0];
                break;