mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
spapr: Handle VMX/VSX presence as an spapr capability flag
We currently have some conditionals in the spapr device tree code to decide whether or not to advertise the availability of the VMX (aka Altivec) and VSX vector extensions to the guest, based on whether the guest cpu has those features. This can lead to confusion and subtle failures on migration, since it makes a guest visible change based only on host capabilities. We now have a better mechanism for this, in spapr capabilities flags, which explicitly depend on user options rather than host capabilities. Rework the advertisement of VSX and VMX based on a new VSX capability. We no longer bother with a conditional for VMX support, because every CPU that's ever been supported by the pseries machine type supports VMX. NOTE: Some userspace distributions (e.g. RHEL7.4) already rely on availability of VSX in libc, so using cap-vsx=off may lead to a fatal SIGILL in init. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
3f2ca480eb
commit
2938664286
3 changed files with 39 additions and 9 deletions
|
@ -57,6 +57,19 @@ static void cap_htm_allow(sPAPRMachineState *spapr, Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
static void cap_vsx_allow(sPAPRMachineState *spapr, Error **errp)
|
||||
{
|
||||
PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
|
||||
/* Allowable CPUs in spapr_cpu_core.c should already have gotten
|
||||
* rid of anything that doesn't do VMX */
|
||||
g_assert(env->insns_flags & PPC_ALTIVEC);
|
||||
if (!(env->insns_flags2 & PPC2_VSX)) {
|
||||
error_setg(errp, "VSX support not available, try cap-vsx=off");
|
||||
}
|
||||
}
|
||||
|
||||
static sPAPRCapabilityInfo capability_table[] = {
|
||||
{
|
||||
.name = "htm",
|
||||
|
@ -65,6 +78,13 @@ static sPAPRCapabilityInfo capability_table[] = {
|
|||
.allow = cap_htm_allow,
|
||||
/* TODO: add cap_htm_disallow */
|
||||
},
|
||||
{
|
||||
.name = "vsx",
|
||||
.description = "Allow Vector Scalar Extensions (VSX)",
|
||||
.flag = SPAPR_CAP_VSX,
|
||||
.allow = cap_vsx_allow,
|
||||
/* TODO: add cap_vsx_disallow */
|
||||
},
|
||||
};
|
||||
|
||||
static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr,
|
||||
|
@ -81,6 +101,11 @@ static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr,
|
|||
caps.mask &= ~SPAPR_CAP_HTM;
|
||||
}
|
||||
|
||||
if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06,
|
||||
0, spapr->max_compat_pvr)) {
|
||||
caps.mask &= ~SPAPR_CAP_VSX;
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue