KVM: PPC: Add hidden flag for paired singles
authorAlexander Graf <agraf@suse.de>
Fri, 19 Feb 2010 10:00:32 +0000 (11:00 +0100)
committerAvi Kivity <avi@redhat.com>
Sun, 25 Apr 2010 09:34:50 +0000 (12:34 +0300)
The Gekko implements an extension called paired singles. When the guest wants
to use that extension, we need to make sure we're not running the host FPU,
because all FPU instructions need to get emulated to accomodate for additional
operations that occur.

This patch adds an hflag to track if we're in paired single mode or not.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/include/asm/kvm_asm.h
arch/powerpc/kvm/book3s.c

index aadf2dd6f84e15c919c9020e9271c3e8f7427a35..7238c048e5bbeff35d025a0a228e665a202fd003 100644 (file)
@@ -88,6 +88,7 @@
 
 #define BOOK3S_HFLAG_DCBZ32                    0x1
 #define BOOK3S_HFLAG_SLB                       0x2
+#define BOOK3S_HFLAG_PAIRED_SINGLE             0x4
 
 #define RESUME_FLAG_NV          (1<<0)  /* Reload guest nonvolatile state? */
 #define RESUME_FLAG_HOST        (1<<1)  /* Resume host? */
index 6416f227d34567c8737c39d37c3cfa201c0e1ace..8cb9f5a67464070ed1fd434db188bd2e91817b6c 100644 (file)
@@ -639,6 +639,10 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
        u64 *thread_fpr = (u64*)t->fpr;
        int i;
 
+       /* When we have paired singles, we emulate in software */
+       if (vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE)
+               return RESUME_GUEST;
+
        if (!(vcpu->arch.msr & msr)) {
                kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
                return RESUME_GUEST;