qemu-ppc
[Top][All Lists]
Advanced

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

[Qemu-ppc] [PATCH v3 11/35] spapr: introduce a 'xive_exploitation' optio


From: Cédric Le Goater
Subject: [Qemu-ppc] [PATCH v3 11/35] spapr: introduce a 'xive_exploitation' option to enable XIVE
Date: Thu, 19 Apr 2018 14:43:07 +0200

Also provide a 'both' option to activate both interrupt mode: XIVE
exploitation and legacy (XICS).

Signed-off-by: Cédric Le Goater <address@hidden>
---
 Changes since v2 :

 - changed the option to a string : "both|off|on"
 - option is not enabled by default anymore. To be discussed.

 hw/ppc/spapr.c         | 41 +++++++++++++++++++++++++++++++++++++++++
 include/hw/ppc/spapr.h |  1 +
 2 files changed, 42 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a81570e7c8b1..b459c0076792 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2907,6 +2907,39 @@ static void spapr_set_vsmt(Object *obj, Visitor *v, 
const char *name,
     visit_type_uint32(v, name, (uint32_t *)opaque, errp);
 }
 
+static char *spapr_get_xive_exploitation(Object *obj, Error **errp)
+{
+    sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
+
+    switch (spapr->xive_exploitation) {
+    case 0x80:
+        return g_strdup("both");
+    case 0x40:
+        return g_strdup("on");
+    case 0x0:
+        return g_strdup("off");
+    }
+    g_assert_not_reached();
+}
+
+static void spapr_set_xive_exploitation(Object *obj, const char *value,
+                                        Error **errp)
+{
+    sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
+
+    /* TODO: Don't let older machines activate XIVE */
+
+    if (strcmp(value, "both") == 0) {
+        spapr->xive_exploitation = 0x80;
+    } else if (strcmp(value, "on") == 0) {
+        spapr->xive_exploitation = 0x40;
+    } else if (strcmp(value, "off") == 0) {
+        spapr->xive_exploitation = 0;
+    } else {
+        error_setg(errp, "Bad value for \"xive-exploitation\" property");
+    }
+}
+
 static void spapr_instance_init(Object *obj)
 {
     sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
@@ -2944,6 +2977,14 @@ static void spapr_instance_init(Object *obj)
                                     " the host's SMT mode", &error_abort);
     object_property_add_bool(obj, "vfio-no-msix-emulation",
                              spapr_get_msix_emulation, NULL, NULL);
+    spapr->xive_exploitation = false;
+    object_property_add_str(obj, "xive-exploitation",
+                            spapr_get_xive_exploitation,
+                            spapr_set_xive_exploitation,
+                            NULL);
+    object_property_set_description(obj, "xive-exploitation",
+                                    "XIVE exploitation mode POWER9",
+                                    NULL);
 }
 
 static void spapr_machine_finalizefn(Object *obj)
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index d60b7c6d7a8b..3f8980310492 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -165,6 +165,7 @@ struct sPAPRMachineState {
     MemoryHotplugState hotplug_memory;
 
     const char *icp_type;
+    uint8_t xive_exploitation;
 
     bool cmd_line_caps[SPAPR_CAP_NUM];
     sPAPRCapabilities def, eff, mig;
-- 
2.13.6




reply via email to

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