qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [QEMU-PPC] [PATCH V2 3/7] ppc/spapr-caps: Convert cap-cfpc to


From: Suraj Jitindar Singh
Subject: [Qemu-ppc] [QEMU-PPC] [PATCH V2 3/7] ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap
Date: Thu, 1 Mar 2018 17:38:00 +1100

Convert cap-cfpc (cache flush on privilege change) to a custom spapr-cap
type.

Signed-off-by: Suraj Jitindar Singh <address@hidden>

---

V1 -> V2:
 - Patch added to series
---
 hw/ppc/spapr_caps.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index f971eb9c3e..41a9799ea8 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -248,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]);
     }
 }
 
@@ -283,8 +291,6 @@ static void 
cap_safe_indirect_branch_apply(sPAPRMachineState *spapr,
     }
 }
 
-#define VALUE_DESC_TRISTATE     " (broken, workaround, fixed)"
-
 sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = {
     [SPAPR_CAP_HTM] = {
         .name = "htm",
@@ -315,11 +321,12 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = {
     },
     [SPAPR_CAP_CFPC] = {
         .name = "cfpc",
-        .description = "Cache Flush on Privilege Change" VALUE_DESC_TRISTATE,
+        .description = "Cache Flush on Privilege Change (help, broken, 
workaround, fixed)",
         .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.13.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]