]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: ppc: Add emulation of E500 register mmucsr0
authorLiu Yu <yu.liu@freescale.com>
Tue, 17 Feb 2009 08:52:08 +0000 (16:52 +0800)
committerAvi Kivity <avi@redhat.com>
Tue, 24 Mar 2009 09:03:12 +0000 (11:03 +0200)
Latest kernel flushes TLB via mmucsr0.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/kvm/e500_emulate.c
arch/powerpc/kvm/e500_tlb.c
arch/powerpc/kvm/e500_tlb.h

index 7a98d4a4c1edef5946a89982dd9ca4a4e6d7e189..3f760414b9f8d3dc52b08be371cb0f39490ea544 100644 (file)
@@ -105,6 +105,11 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
        case SPRN_HID1:
                vcpu_e500->hid1 = vcpu->arch.gpr[rs]; break;
 
+       case SPRN_MMUCSR0:
+               emulated = kvmppc_e500_emul_mt_mmucsr0(vcpu_e500,
+                               vcpu->arch.gpr[rs]);
+               break;
+
        /* extra exceptions */
        case SPRN_IVOR32:
                vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = vcpu->arch.gpr[rs];
@@ -172,6 +177,9 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
        case SPRN_HID1:
                vcpu->arch.gpr[rt] = vcpu_e500->hid1; break;
 
+       case SPRN_MMUCSR0:
+               vcpu->arch.gpr[rt] = 0; break;
+
        /* extra exceptions */
        case SPRN_IVOR32:
                vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];
index d437160d388c1bc895560e0a48fa3540ddbdf540..72386ddbd9d5a1a1d64d4b776177e77958490325 100644 (file)
@@ -391,6 +391,22 @@ static int kvmppc_e500_gtlbe_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500,
        return 0;
 }
 
+int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *vcpu_e500, ulong value)
+{
+       int esel;
+
+       if (value & MMUCSR0_TLB0FI)
+               for (esel = 0; esel < vcpu_e500->guest_tlb_size[0]; esel++)
+                       kvmppc_e500_gtlbe_invalidate(vcpu_e500, 0, esel);
+       if (value & MMUCSR0_TLB1FI)
+               for (esel = 0; esel < vcpu_e500->guest_tlb_size[1]; esel++)
+                       kvmppc_e500_gtlbe_invalidate(vcpu_e500, 1, esel);
+
+       _tlbil_all();
+
+       return EMULATE_DONE;
+}
+
 int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb)
 {
        struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
index ab49e93551852d6c59a5741ec110ad9c6af99650..4d5cc0f7d796bf6cc3a3ea3a53e3812d182c4eaf 100644 (file)
@@ -44,6 +44,7 @@
           | E500_TLB_USER_PERM_MASK | E500_TLB_SUPER_PERM_MASK)
 
 extern void kvmppc_dump_tlbs(struct kvm_vcpu *);
+extern int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *, ulong);
 extern int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *);
 extern int kvmppc_e500_emul_tlbre(struct kvm_vcpu *);
 extern int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *, int, int);