[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 20/24] ppc/spapr-caps: Convert cap-cfpc to custom spapr
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 20/24] ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap |
Date: |
Fri, 2 Mar 2018 17:03:46 +1100 |
From: Suraj Jitindar Singh <address@hidden>
Convert cap-cfpc (cache flush on privilege change) to a custom spapr-cap
type.
Signed-off-by: Suraj Jitindar Singh <address@hidden>
[dwg: Don't explicitly list "?"/help option, trusting convention]
[dwg: Strip no-longer-necessary ATTRIBUTE_UNUSED back off]
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_caps.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index 3d8b796df9..4a93a3b4de 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -149,9 +149,8 @@ out:
g_free(val);
}
-static void ATTRIBUTE_UNUSED spapr_cap_get_string(Object *obj, Visitor *v,
- const char *name,
- void *opaque, Error **errp)
+static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
sPAPRCapabilityInfo *cap = opaque;
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
@@ -169,9 +168,8 @@ static void ATTRIBUTE_UNUSED spapr_cap_get_string(Object
*obj, Visitor *v,
g_free(val);
}
-static void ATTRIBUTE_UNUSED spapr_cap_set_string(Object *obj, Visitor *v,
- const char *name,
- void *opaque, Error **errp)
+static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
sPAPRCapabilityInfo *cap = opaque;
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
@@ -250,14 +248,22 @@ static void cap_dfp_apply(sPAPRMachineState *spapr,
uint8_t val, Error **errp)
}
}
+sPAPRCapPossible cap_cfpc_possible = {
+ .num = 3,
+ .vals = {"broken", "workaround", "fixed"},
+ .help = "broken - no protection, workaround - workaround available, fixed
- fixed in hardware",
+};
+
static void cap_safe_cache_apply(sPAPRMachineState *spapr, uint8_t val,
Error **errp)
{
+ uint8_t kvm_val = kvmppc_get_cap_safe_cache();
+
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");
+ } else if (kvm_enabled() && (val > kvm_val)) {
+ error_setg(errp, "Requested safe cache capability level not supported
by kvm, try cap-cfpc=%s", cap_cfpc_possible.vals[kvm_val]);
}
}
@@ -319,9 +325,10 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = {
.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,
+ .get = spapr_cap_get_string,
+ .set = spapr_cap_set_string,
.type = "string",
+ .possible = &cap_cfpc_possible,
.apply = cap_safe_cache_apply,
},
[SPAPR_CAP_SBBC] = {
--
2.14.3
- [Qemu-ppc] [PULL 11/24] macio: move macio related structures and defines into separate macio.h file, (continued)
- [Qemu-ppc] [PULL 11/24] macio: move macio related structures and defines into separate macio.h file, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 12/24] mac_oldworld: use object link to pass heathrow PIC object to macio, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 06/24] macio: embed DBDMA device directly within macio, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 10/24] heathrow: change heathrow_pic_init() to return the heathrow device, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 08/24] heathrow: QOMify heathrow PIC, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 18/24] target/ppc: Check mask when setting cap_ppc_safe_indirect_branch, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 24/24] hw/ppc/spapr, e500: Use new property "stdout-path" for boot console, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 23/24] ppc/spapr-caps: Define the pseries-2.12-sxxm machine type, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 15/24] mac_newworld: use object link to pass OpenPIC object to macio, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 14/24] openpic: move OpenPIC state and related definitions to openpic.h, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 20/24] ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap,
David Gibson <=
- [Qemu-ppc] [PULL 02/24] ppc440: Add emulation of plb-pcix controller found in some 440 SoCs, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 16/24] macio: move setting of CUDA timebase frequency to macio_common_realize(), David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 17/24] macio: remove macio_init() function, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 19/24] ppc/spapr-caps: Add support for custom spapr_capabilities, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 22/24] ppc/spapr-caps: Convert cap-ibs to custom spapr-cap, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 07/24] macio: move ESCC device within the macio device, David Gibson, 2018/03/02
- [Qemu-ppc] [PULL 03/24] ppc: Add aCube Sam460ex board, David Gibson, 2018/03/02
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/24] ppc-for-2.12 queue 20180302, no-reply, 2018/03/02
- Re: [Qemu-ppc] [PULL 00/24] ppc-for-2.12 queue 20180302, Peter Maydell, 2018/03/02