diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2017-12-11 17:34:30 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-01-17 09:35:24 +1100 |
commit | 2d1fb9bc8e6e78931d8e1bfeb0ed7a4d223b0480 (patch) | |
tree | 7bef5e81ef5c6581bbfc9009c1ed3d47aeecc6cb /hw/ppc/spapr_caps.c | |
parent | 2938664286499c0c30d6e455a7e2e5d3e6c3f63d (diff) |
spapr: Handle Decimal Floating Point (DFP) as an optional capability
Decimal Floating Point has been available on POWER7 and later (server)
cpus. However, it can be disabled on the hypervisor, meaning that it's
not available to guests.
We currently handle this by conditionally advertising DFP support in the
device tree depending on whether the guest CPU model supports it - which
can also depend on what's allowed in the host for -cpu host. That can lead
to confusion on migration, since host properties are silently affecting
guest visible properties.
This patch handles it by treating it as an optional capability for the
pseries machine type.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/ppc/spapr_caps.c')
-rw-r--r-- | hw/ppc/spapr_caps.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 7c855c67ad..9d070a306c 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -70,6 +70,16 @@ static void cap_vsx_allow(sPAPRMachineState *spapr, Error **errp) } } +static void cap_dfp_allow(sPAPRMachineState *spapr, Error **errp) +{ + PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + CPUPPCState *env = &cpu->env; + + if (!(env->insns_flags2 & PPC2_DFP)) { + error_setg(errp, "DFP support not available, try cap-dfp=off"); + } +} + static sPAPRCapabilityInfo capability_table[] = { { .name = "htm", @@ -85,6 +95,13 @@ static sPAPRCapabilityInfo capability_table[] = { .allow = cap_vsx_allow, /* TODO: add cap_vsx_disallow */ }, + { + .name = "dfp", + .description = "Allow Decimal Floating Point (DFP)", + .flag = SPAPR_CAP_DFP, + .allow = cap_dfp_allow, + /* TODO: add cap_dfp_disallow */ + }, }; static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, @@ -104,6 +121,7 @@ static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06, 0, spapr->max_compat_pvr)) { caps.mask &= ~SPAPR_CAP_VSX; + caps.mask &= ~SPAPR_CAP_DFP; } return caps; |