KVM: PPC: Override host vmx/vsx/dfp only when information known
PATCH 1/1 KVM: PPC: Override host vmx/vsx/dfp only when information known
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.
--- target-ppc/kvm.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
target-ppc/kvm.c +9 -3
@@ -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; }
Signature · 1 line
1.6.0.2
Quoted 9 lines · Alexander Graf
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.
Yeah, this is probably the best we can do. I forgot that we can only really rely on the ibm,vmx property on systems with IBM firmware. On those it does indicate that there is no VMX if the property is missing, but other firmwares just don't provide it at all.
Quoted 29 lines
Signed-off-by Alexander Graf <[email protected]>--- target-ppc/kvm.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)target-ppc/kvm.c +9
-3@@ -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; }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson