aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-04-19 20:49:54 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:19:08 -0400
commitb83d4a9cfc81503a082331cc5d1e480d99f3a531 (patch)
tree50e042408f2f7cc16b23b2c83462e8d8cc71d987 /arch/powerpc/kvm/book3s.c
parent251585b5d02152973dbc24c803ca322bb977d4a2 (diff)
KVM: PPC: Enable native paired singles
When we're on a paired single capable host, we can just always enable paired singles and expose them to the guest directly. This approach breaks when multiple VMs run and access PS concurrently, but this should suffice until we get a proper framework for it in Linux. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r--arch/powerpc/kvm/book3s.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 397701d39ae7..9f97dbe25e4e 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -345,6 +345,8 @@ void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
345 345
346void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr) 346void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr)
347{ 347{
348 u32 host_pvr;
349
348 vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB; 350 vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB;
349 vcpu->arch.pvr = pvr; 351 vcpu->arch.pvr = pvr;
350#ifdef CONFIG_PPC_BOOK3S_64 352#ifdef CONFIG_PPC_BOOK3S_64
@@ -376,6 +378,23 @@ void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr)
376 /* 32 bit Book3S always has 32 byte dcbz */ 378 /* 32 bit Book3S always has 32 byte dcbz */
377 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; 379 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
378#endif 380#endif
381
382 /* On some CPUs we can execute paired single operations natively */
383 asm ( "mfpvr %0" : "=r"(host_pvr));
384 switch (host_pvr) {
385 case 0x00080200: /* lonestar 2.0 */
386 case 0x00088202: /* lonestar 2.2 */
387 case 0x70000100: /* gekko 1.0 */
388 case 0x00080100: /* gekko 2.0 */
389 case 0x00083203: /* gekko 2.3a */
390 case 0x00083213: /* gekko 2.3b */
391 case 0x00083204: /* gekko 2.4 */
392 case 0x00083214: /* gekko 2.4e (8SE) - retail HW2 */
393 case 0x00087200: /* broadway */
394 vcpu->arch.hflags |= BOOK3S_HFLAG_NATIVE_PS;
395 /* Enable HID2.PSE - in case we need it later */
396 mtspr(SPRN_HID2_GEKKO, mfspr(SPRN_HID2_GEKKO) | (1 << 29));
397 }
379} 398}
380 399
381/* Book3s_32 CPUs always have 32 bytes cache line size, which Linux assumes. To 400/* Book3s_32 CPUs always have 32 bytes cache line size, which Linux assumes. To