aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLiu Yu <yu.liu@freescale.com>2009-02-17 03:52:08 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:03:12 -0400
commitb0a1835d53c57bc38b36867c04436b60454cb610 (patch)
tree8d3cd9f1d01b8d13f82bddda759c1f3335147221 /arch
parent71450f78853b82d55cda4e182c9db6e26b631485 (diff)
KVM: ppc: Add emulation of E500 register mmucsr0
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/e500_emulate.c8
-rw-r--r--arch/powerpc/kvm/e500_tlb.c16
-rw-r--r--arch/powerpc/kvm/e500_tlb.h1
3 files changed, 25 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index 7a98d4a4c1ed..3f760414b9f8 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -105,6 +105,11 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
105 case SPRN_HID1: 105 case SPRN_HID1:
106 vcpu_e500->hid1 = vcpu->arch.gpr[rs]; break; 106 vcpu_e500->hid1 = vcpu->arch.gpr[rs]; break;
107 107
108 case SPRN_MMUCSR0:
109 emulated = kvmppc_e500_emul_mt_mmucsr0(vcpu_e500,
110 vcpu->arch.gpr[rs]);
111 break;
112
108 /* extra exceptions */ 113 /* extra exceptions */
109 case SPRN_IVOR32: 114 case SPRN_IVOR32:
110 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = vcpu->arch.gpr[rs]; 115 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)
172 case SPRN_HID1: 177 case SPRN_HID1:
173 vcpu->arch.gpr[rt] = vcpu_e500->hid1; break; 178 vcpu->arch.gpr[rt] = vcpu_e500->hid1; break;
174 179
180 case SPRN_MMUCSR0:
181 vcpu->arch.gpr[rt] = 0; break;
182
175 /* extra exceptions */ 183 /* extra exceptions */
176 case SPRN_IVOR32: 184 case SPRN_IVOR32:
177 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL]; 185 vcpu->arch.gpr[rt] = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index d437160d388c..72386ddbd9d5 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -391,6 +391,22 @@ static int kvmppc_e500_gtlbe_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500,
391 return 0; 391 return 0;
392} 392}
393 393
394int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *vcpu_e500, ulong value)
395{
396 int esel;
397
398 if (value & MMUCSR0_TLB0FI)
399 for (esel = 0; esel < vcpu_e500->guest_tlb_size[0]; esel++)
400 kvmppc_e500_gtlbe_invalidate(vcpu_e500, 0, esel);
401 if (value & MMUCSR0_TLB1FI)
402 for (esel = 0; esel < vcpu_e500->guest_tlb_size[1]; esel++)
403 kvmppc_e500_gtlbe_invalidate(vcpu_e500, 1, esel);
404
405 _tlbil_all();
406
407 return EMULATE_DONE;
408}
409
394int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb) 410int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb)
395{ 411{
396 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 412 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
diff --git a/arch/powerpc/kvm/e500_tlb.h b/arch/powerpc/kvm/e500_tlb.h
index ab49e9355185..4d5cc0f7d796 100644
--- a/arch/powerpc/kvm/e500_tlb.h
+++ b/arch/powerpc/kvm/e500_tlb.h
@@ -44,6 +44,7 @@
44 | E500_TLB_USER_PERM_MASK | E500_TLB_SUPER_PERM_MASK) 44 | E500_TLB_USER_PERM_MASK | E500_TLB_SUPER_PERM_MASK)
45 45
46extern void kvmppc_dump_tlbs(struct kvm_vcpu *); 46extern void kvmppc_dump_tlbs(struct kvm_vcpu *);
47extern int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *, ulong);
47extern int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *); 48extern int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *);
48extern int kvmppc_e500_emul_tlbre(struct kvm_vcpu *); 49extern int kvmppc_e500_emul_tlbre(struct kvm_vcpu *);
49extern int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *, int, int); 50extern int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *, int, int);