]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
KVM: PPC: Override host vmx/vsx/dfp only when information known
authorAlexander Graf <agraf@suse.de>
Mon, 24 Oct 2011 18:43:22 +0000 (20:43 +0200)
committerAlexander Graf <agraf@suse.de>
Sun, 30 Oct 2011 19:03:27 +0000 (20:03 +0100)
The -cpu host feature tries to find out the host capabilities based
on device tree information. However, we don't always have that available
because it's an optional property in dt.

So instead of force unsetting values depending on an unreliable source
of information, let's just try to be clever about it and not override
capabilities when we don't know the device tree pieces.

This fixes altivec with -cpu host on YDL PowerStations.

Reported-by: Nishanth Aravamudan <nacc@us.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
target-ppc/kvm.c

index a090d79ad4eb2e4e7707e02a4e2ebf6e7e77c080..f3d0861a111e3fefd0f2d51b1161c263432b6309 100644 (file)
@@ -912,9 +912,15 @@ const ppc_def_t *kvmppc_host_cpu_def(void)
 
     /* Now fix up the spec with information we can query from the host */
 
-    alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0);
-    alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1);
-    alter_insns(&spec->insns_flags2, PPC2_DFP, dfp);
+    if (vmx != -1) {
+        /* Only override when we know what the host supports */
+        alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0);
+        alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1);
+    }
+    if (dfp != -1) {
+        /* Only override when we know what the host supports */
+        alter_insns(&spec->insns_flags2, PPC2_DFP, dfp);
+    }
 
     return spec;
 }