spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
/*
|
|
|
|
* QEMU PowerPC pSeries Logical Partition capabilities handling
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 David Gibson, Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
2017-12-11 12:09:37 +08:00
|
|
|
#include "qemu/error-report.h"
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
#include "qapi/error.h"
|
|
|
|
#include "qapi/visitor.h"
|
2017-12-11 10:10:44 +08:00
|
|
|
#include "sysemu/hw_accel.h"
|
|
|
|
#include "target/ppc/cpu.h"
|
|
|
|
#include "cpu-models.h"
|
|
|
|
#include "kvm_ppc.h"
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
|
|
|
|
#include "hw/ppc/spapr.h"
|
|
|
|
|
|
|
|
typedef struct sPAPRCapabilityInfo {
|
|
|
|
const char *name;
|
|
|
|
const char *description;
|
2018-01-12 13:33:43 +08:00
|
|
|
int index;
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
/* Getter and Setter Function Pointers */
|
|
|
|
ObjectPropertyAccessor *get;
|
|
|
|
ObjectPropertyAccessor *set;
|
|
|
|
const char *type;
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
/* Make sure the virtual hardware can support this capability */
|
2018-01-12 13:33:43 +08:00
|
|
|
void (*apply)(sPAPRMachineState *spapr, uint8_t val, Error **errp);
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
} sPAPRCapabilityInfo;
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
static void spapr_cap_get_bool(Object *obj, Visitor *v, const char *name,
|
|
|
|
void *opaque, Error **errp)
|
|
|
|
{
|
|
|
|
sPAPRCapabilityInfo *cap = opaque;
|
|
|
|
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
bool value = spapr_get_cap(spapr, cap->index) == SPAPR_CAP_ON;
|
|
|
|
|
|
|
|
visit_type_bool(v, name, &value, errp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void spapr_cap_set_bool(Object *obj, Visitor *v, const char *name,
|
|
|
|
void *opaque, Error **errp)
|
2017-12-11 10:10:44 +08:00
|
|
|
{
|
2018-01-12 13:33:43 +08:00
|
|
|
sPAPRCapabilityInfo *cap = opaque;
|
|
|
|
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
bool value;
|
|
|
|
Error *local_err = NULL;
|
|
|
|
|
|
|
|
visit_type_bool(v, name, &value, &local_err);
|
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
spapr->cmd_line_caps[cap->index] = true;
|
|
|
|
spapr->eff.caps[cap->index] = value ? SPAPR_CAP_ON : SPAPR_CAP_OFF;
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:02 +08:00
|
|
|
static void spapr_cap_get_tristate(Object *obj, Visitor *v, const char *name,
|
|
|
|
void *opaque, Error **errp)
|
2018-01-19 13:00:01 +08:00
|
|
|
{
|
|
|
|
sPAPRCapabilityInfo *cap = opaque;
|
|
|
|
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
char *val = NULL;
|
|
|
|
uint8_t value = spapr_get_cap(spapr, cap->index);
|
|
|
|
|
|
|
|
switch (value) {
|
|
|
|
case SPAPR_CAP_BROKEN:
|
|
|
|
val = g_strdup("broken");
|
|
|
|
break;
|
|
|
|
case SPAPR_CAP_WORKAROUND:
|
|
|
|
val = g_strdup("workaround");
|
|
|
|
break;
|
|
|
|
case SPAPR_CAP_FIXED:
|
|
|
|
val = g_strdup("fixed");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error_setg(errp, "Invalid value (%d) for cap-%s", value, cap->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
visit_type_str(v, name, &val, errp);
|
|
|
|
g_free(val);
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:02 +08:00
|
|
|
static void spapr_cap_set_tristate(Object *obj, Visitor *v, const char *name,
|
|
|
|
void *opaque, Error **errp)
|
2018-01-19 13:00:01 +08:00
|
|
|
{
|
|
|
|
sPAPRCapabilityInfo *cap = opaque;
|
|
|
|
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
char *val;
|
|
|
|
Error *local_err = NULL;
|
|
|
|
uint8_t value;
|
|
|
|
|
|
|
|
visit_type_str(v, name, &val, &local_err);
|
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcasecmp(val, "broken")) {
|
|
|
|
value = SPAPR_CAP_BROKEN;
|
|
|
|
} else if (!strcasecmp(val, "workaround")) {
|
|
|
|
value = SPAPR_CAP_WORKAROUND;
|
|
|
|
} else if (!strcasecmp(val, "fixed")) {
|
|
|
|
value = SPAPR_CAP_FIXED;
|
|
|
|
} else {
|
|
|
|
error_setg(errp, "Invalid capability mode \"%s\" for cap-%s", val,
|
|
|
|
cap->name);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
spapr->cmd_line_caps[cap->index] = true;
|
|
|
|
spapr->eff.caps[cap->index] = value;
|
|
|
|
out:
|
|
|
|
g_free(val);
|
|
|
|
}
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
static void cap_htm_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp)
|
|
|
|
{
|
|
|
|
if (!val) {
|
|
|
|
/* TODO: We don't support disabling htm yet */
|
|
|
|
return;
|
|
|
|
}
|
2017-12-11 10:10:44 +08:00
|
|
|
if (tcg_enabled()) {
|
|
|
|
error_setg(errp,
|
|
|
|
"No Transactional Memory support in TCG, try cap-htm=off");
|
|
|
|
} else if (kvm_enabled() && !kvmppc_has_cap_htm()) {
|
|
|
|
error_setg(errp,
|
|
|
|
"KVM implementation does not support Transactional Memory, try cap-htm=off"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
static void cap_vsx_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp)
|
2017-12-07 14:08:47 +08:00
|
|
|
{
|
|
|
|
PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
|
|
|
|
CPUPPCState *env = &cpu->env;
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
if (!val) {
|
|
|
|
/* TODO: We don't support disabling vsx yet */
|
|
|
|
return;
|
|
|
|
}
|
2017-12-07 14:08:47 +08:00
|
|
|
/* 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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
static void cap_dfp_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp)
|
2017-12-11 14:34:30 +08:00
|
|
|
{
|
|
|
|
PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
|
|
|
|
CPUPPCState *env = &cpu->env;
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
if (!val) {
|
|
|
|
/* TODO: We don't support disabling dfp yet */
|
|
|
|
return;
|
|
|
|
}
|
2017-12-11 14:34:30 +08:00
|
|
|
if (!(env->insns_flags2 & PPC2_DFP)) {
|
|
|
|
error_setg(errp, "DFP support not available, try cap-dfp=off");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:02 +08:00
|
|
|
static void cap_safe_cache_apply(sPAPRMachineState *spapr, uint8_t val,
|
|
|
|
Error **errp)
|
|
|
|
{
|
|
|
|
if (tcg_enabled() && val) {
|
|
|
|
/* TODO - for now only allow broken for TCG */
|
|
|
|
error_setg(errp, "Requested safe cache capability level not supported by tcg, try a different value for cap-cfpc");
|
|
|
|
} else if (kvm_enabled() && (val > kvmppc_get_cap_safe_cache())) {
|
|
|
|
error_setg(errp, "Requested safe cache capability level not supported by kvm, try a different value for cap-cfpc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:03 +08:00
|
|
|
static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t val,
|
|
|
|
Error **errp)
|
|
|
|
{
|
|
|
|
if (tcg_enabled() && val) {
|
|
|
|
/* TODO - for now only allow broken for TCG */
|
|
|
|
error_setg(errp, "Requested safe bounds check capability level not supported by tcg, try a different value for cap-sbbc");
|
|
|
|
} else if (kvm_enabled() && (val > kvmppc_get_cap_safe_bounds_check())) {
|
|
|
|
error_setg(errp, "Requested safe bounds check capability level not supported by kvm, try a different value for cap-sbbc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:04 +08:00
|
|
|
static void cap_safe_indirect_branch_apply(sPAPRMachineState *spapr,
|
|
|
|
uint8_t val, Error **errp)
|
|
|
|
{
|
|
|
|
if (tcg_enabled() && val) {
|
|
|
|
/* TODO - for now only allow broken for TCG */
|
|
|
|
error_setg(errp, "Requested safe indirect branch capability level not supported by tcg, try a different value for cap-ibs");
|
|
|
|
} else if (kvm_enabled() && (val > kvmppc_get_cap_safe_indirect_branch())) {
|
|
|
|
error_setg(errp, "Requested safe indirect branch capability level not supported by kvm, try a different value for cap-ibs");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:02 +08:00
|
|
|
#define VALUE_DESC_TRISTATE " (broken, workaround, fixed)"
|
2018-01-12 13:33:43 +08:00
|
|
|
|
|
|
|
sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = {
|
|
|
|
[SPAPR_CAP_HTM] = {
|
2017-12-11 10:10:44 +08:00
|
|
|
.name = "htm",
|
|
|
|
.description = "Allow Hardware Transactional Memory (HTM)",
|
2018-01-12 13:33:43 +08:00
|
|
|
.index = SPAPR_CAP_HTM,
|
|
|
|
.get = spapr_cap_get_bool,
|
|
|
|
.set = spapr_cap_set_bool,
|
|
|
|
.type = "bool",
|
|
|
|
.apply = cap_htm_apply,
|
2017-12-11 10:10:44 +08:00
|
|
|
},
|
2018-01-12 13:33:43 +08:00
|
|
|
[SPAPR_CAP_VSX] = {
|
2017-12-07 14:08:47 +08:00
|
|
|
.name = "vsx",
|
|
|
|
.description = "Allow Vector Scalar Extensions (VSX)",
|
2018-01-12 13:33:43 +08:00
|
|
|
.index = SPAPR_CAP_VSX,
|
|
|
|
.get = spapr_cap_get_bool,
|
|
|
|
.set = spapr_cap_set_bool,
|
|
|
|
.type = "bool",
|
|
|
|
.apply = cap_vsx_apply,
|
2017-12-07 14:08:47 +08:00
|
|
|
},
|
2018-01-12 13:33:43 +08:00
|
|
|
[SPAPR_CAP_DFP] = {
|
2017-12-11 14:34:30 +08:00
|
|
|
.name = "dfp",
|
|
|
|
.description = "Allow Decimal Floating Point (DFP)",
|
2018-01-12 13:33:43 +08:00
|
|
|
.index = SPAPR_CAP_DFP,
|
|
|
|
.get = spapr_cap_get_bool,
|
|
|
|
.set = spapr_cap_set_bool,
|
|
|
|
.type = "bool",
|
|
|
|
.apply = cap_dfp_apply,
|
2017-12-11 14:34:30 +08:00
|
|
|
},
|
2018-01-19 13:00:02 +08:00
|
|
|
[SPAPR_CAP_CFPC] = {
|
|
|
|
.name = "cfpc",
|
|
|
|
.description = "Cache Flush on Privilege Change" VALUE_DESC_TRISTATE,
|
|
|
|
.index = SPAPR_CAP_CFPC,
|
|
|
|
.get = spapr_cap_get_tristate,
|
|
|
|
.set = spapr_cap_set_tristate,
|
|
|
|
.type = "string",
|
|
|
|
.apply = cap_safe_cache_apply,
|
|
|
|
},
|
2018-01-19 13:00:03 +08:00
|
|
|
[SPAPR_CAP_SBBC] = {
|
|
|
|
.name = "sbbc",
|
|
|
|
.description = "Speculation Barrier Bounds Checking" VALUE_DESC_TRISTATE,
|
|
|
|
.index = SPAPR_CAP_SBBC,
|
|
|
|
.get = spapr_cap_get_tristate,
|
|
|
|
.set = spapr_cap_set_tristate,
|
|
|
|
.type = "string",
|
|
|
|
.apply = cap_safe_bounds_check_apply,
|
|
|
|
},
|
2018-01-19 13:00:04 +08:00
|
|
|
[SPAPR_CAP_IBS] = {
|
|
|
|
.name = "ibs",
|
|
|
|
.description = "Indirect Branch Serialisation" VALUE_DESC_TRISTATE,
|
|
|
|
.index = SPAPR_CAP_IBS,
|
|
|
|
.get = spapr_cap_get_tristate,
|
|
|
|
.set = spapr_cap_set_tristate,
|
|
|
|
.type = "string",
|
|
|
|
.apply = cap_safe_indirect_branch_apply,
|
|
|
|
},
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr,
|
|
|
|
CPUState *cs)
|
|
|
|
{
|
|
|
|
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
|
2017-12-11 10:10:44 +08:00
|
|
|
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
sPAPRCapabilities caps;
|
|
|
|
|
|
|
|
caps = smc->default_caps;
|
|
|
|
|
2017-12-11 10:10:44 +08:00
|
|
|
if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_07,
|
|
|
|
0, spapr->max_compat_pvr)) {
|
2018-01-12 13:33:43 +08:00
|
|
|
caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_OFF;
|
2017-12-11 10:10:44 +08:00
|
|
|
}
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
|
2017-12-07 14:08:47 +08:00
|
|
|
if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06,
|
|
|
|
0, spapr->max_compat_pvr)) {
|
2018-01-12 13:33:43 +08:00
|
|
|
caps.caps[SPAPR_CAP_VSX] = SPAPR_CAP_OFF;
|
|
|
|
caps.caps[SPAPR_CAP_DFP] = SPAPR_CAP_OFF;
|
2017-12-07 14:08:47 +08:00
|
|
|
}
|
|
|
|
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
int spapr_caps_pre_load(void *opaque)
|
2017-12-11 12:09:37 +08:00
|
|
|
{
|
|
|
|
sPAPRMachineState *spapr = opaque;
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
/* Set to default so we can tell if this came in with the migration */
|
|
|
|
spapr->mig = spapr->def;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int spapr_caps_pre_save(void *opaque)
|
|
|
|
{
|
|
|
|
sPAPRMachineState *spapr = opaque;
|
|
|
|
|
|
|
|
spapr->mig = spapr->eff;
|
|
|
|
return 0;
|
2017-12-11 12:09:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This has to be called from the top-level spapr post_load, not the
|
|
|
|
* caps specific one. Otherwise it wouldn't be called when the source
|
|
|
|
* caps are all defaults, which could still conflict with overridden
|
|
|
|
* caps on the destination */
|
|
|
|
int spapr_caps_post_migration(sPAPRMachineState *spapr)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
bool ok = true;
|
2018-01-12 13:33:43 +08:00
|
|
|
sPAPRCapabilities dstcaps = spapr->eff;
|
2017-12-11 12:09:37 +08:00
|
|
|
sPAPRCapabilities srccaps;
|
|
|
|
|
|
|
|
srccaps = default_caps_with_cpu(spapr, first_cpu);
|
2018-01-12 13:33:43 +08:00
|
|
|
for (i = 0; i < SPAPR_CAP_NUM; i++) {
|
|
|
|
/* If not default value then assume came in with the migration */
|
|
|
|
if (spapr->mig.caps[i] != spapr->def.caps[i]) {
|
|
|
|
srccaps.caps[i] = spapr->mig.caps[i];
|
|
|
|
}
|
|
|
|
}
|
2017-12-11 12:09:37 +08:00
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
for (i = 0; i < SPAPR_CAP_NUM; i++) {
|
2017-12-11 12:09:37 +08:00
|
|
|
sPAPRCapabilityInfo *info = &capability_table[i];
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
if (srccaps.caps[i] > dstcaps.caps[i]) {
|
|
|
|
error_report("cap-%s higher level (%d) in incoming stream than on destination (%d)",
|
|
|
|
info->name, srccaps.caps[i], dstcaps.caps[i]);
|
2017-12-11 12:09:37 +08:00
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
if (srccaps.caps[i] < dstcaps.caps[i]) {
|
|
|
|
warn_report("cap-%s lower level (%d) in incoming stream than on destination (%d)",
|
|
|
|
info->name, srccaps.caps[i], dstcaps.caps[i]);
|
2017-12-11 12:09:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ok ? 0 : -EINVAL;
|
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:00 +08:00
|
|
|
/* Used to generate the migration field and needed function for a spapr cap */
|
|
|
|
#define SPAPR_CAP_MIG_STATE(cap, ccap) \
|
|
|
|
static bool spapr_cap_##cap##_needed(void *opaque) \
|
|
|
|
{ \
|
|
|
|
sPAPRMachineState *spapr = opaque; \
|
|
|
|
\
|
|
|
|
return spapr->cmd_line_caps[SPAPR_CAP_##ccap] && \
|
|
|
|
(spapr->eff.caps[SPAPR_CAP_##ccap] != \
|
|
|
|
spapr->def.caps[SPAPR_CAP_##ccap]); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
const VMStateDescription vmstate_spapr_cap_##cap = { \
|
|
|
|
.name = "spapr/cap/" #cap, \
|
|
|
|
.version_id = 1, \
|
|
|
|
.minimum_version_id = 1, \
|
|
|
|
.needed = spapr_cap_##cap##_needed, \
|
|
|
|
.fields = (VMStateField[]) { \
|
|
|
|
VMSTATE_UINT8(mig.caps[SPAPR_CAP_##ccap], \
|
|
|
|
sPAPRMachineState), \
|
|
|
|
VMSTATE_END_OF_LIST() \
|
|
|
|
}, \
|
2017-12-11 12:09:37 +08:00
|
|
|
}
|
|
|
|
|
2018-01-19 13:00:00 +08:00
|
|
|
SPAPR_CAP_MIG_STATE(htm, HTM);
|
|
|
|
SPAPR_CAP_MIG_STATE(vsx, VSX);
|
|
|
|
SPAPR_CAP_MIG_STATE(dfp, DFP);
|
2018-01-19 13:00:02 +08:00
|
|
|
SPAPR_CAP_MIG_STATE(cfpc, CFPC);
|
2018-01-19 13:00:03 +08:00
|
|
|
SPAPR_CAP_MIG_STATE(sbbc, SBBC);
|
2018-01-19 13:00:04 +08:00
|
|
|
SPAPR_CAP_MIG_STATE(ibs, IBS);
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
void spapr_caps_reset(sPAPRMachineState *spapr)
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
{
|
2018-01-12 13:33:43 +08:00
|
|
|
sPAPRCapabilities default_caps;
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
int i;
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
/* First compute the actual set of caps we're running with.. */
|
|
|
|
default_caps = default_caps_with_cpu(spapr, first_cpu);
|
|
|
|
|
|
|
|
for (i = 0; i < SPAPR_CAP_NUM; i++) {
|
|
|
|
/* Store the defaults */
|
|
|
|
spapr->def.caps[i] = default_caps.caps[i];
|
|
|
|
/* If not set on the command line then apply the default value */
|
|
|
|
if (!spapr->cmd_line_caps[i]) {
|
|
|
|
spapr->eff.caps[i] = default_caps.caps[i];
|
|
|
|
}
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
}
|
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
/* .. then apply those caps to the virtual hardware */
|
|
|
|
|
|
|
|
for (i = 0; i < SPAPR_CAP_NUM; i++) {
|
|
|
|
sPAPRCapabilityInfo *info = &capability_table[i];
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
/*
|
|
|
|
* If the apply function can't set the desired level and thinks it's
|
|
|
|
* fatal, it should cause that.
|
|
|
|
*/
|
|
|
|
info->apply(spapr, spapr->eff.caps[i], &error_fatal);
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void spapr_caps_add_properties(sPAPRMachineClass *smc, Error **errp)
|
|
|
|
{
|
|
|
|
Error *local_err = NULL;
|
|
|
|
ObjectClass *klass = OBJECT_CLASS(smc);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(capability_table); i++) {
|
|
|
|
sPAPRCapabilityInfo *cap = &capability_table[i];
|
|
|
|
const char *name = g_strdup_printf("cap-%s", cap->name);
|
2018-01-12 13:33:43 +08:00
|
|
|
char *desc;
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
|
2018-01-12 13:33:43 +08:00
|
|
|
object_class_property_add(klass, name, cap->type,
|
|
|
|
cap->get, cap->set,
|
|
|
|
NULL, cap, &local_err);
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-01-15 10:51:22 +08:00
|
|
|
desc = g_strdup_printf("%s", cap->description);
|
2018-01-12 13:33:43 +08:00
|
|
|
object_class_property_set_description(klass, name, desc, &local_err);
|
|
|
|
g_free(desc);
|
spapr: Capabilities infrastructure
Because PAPR is a paravirtual environment access to certain CPU (or other)
facilities can be blocked by the hypervisor. PAPR provides ways to
advertise in the device tree whether or not those features are available to
the guest.
In some places we automatically determine whether to make a feature
available based on whether our host can support it, in most cases this is
based on limitations in the available KVM implementation.
Although we correctly advertise this to the guest, it means that host
factors might make changes to the guest visible environment which is bad:
as well as generaly reducing reproducibility, it means that a migration
between different host environments can easily go bad.
We've mostly gotten away with it because the environments considered mature
enough to be well supported (basically, KVM on POWER8) have had consistent
feature availability. But, it's still not right and some limitations on
POWER9 is going to make it more of an issue in future.
This introduces an infrastructure for defining "sPAPR capabilities". These
are set by default based on the machine version, masked by the capabilities
of the chosen cpu, but can be overriden with machine properties.
The intention is at reset time we verify that the requested capabilities
can be supported on the host (considering TCG, KVM and/or host cpu
limitations). If not we simply fail, rather than silently modifying the
advertised featureset to the guest.
This does mean that certain configurations that "worked" may now fail, but
such configurations were already more subtly broken.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
2017-12-08 07:35:35 +08:00
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|