[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v2 10/19] spapr: introduce a 'xive_exploitation' boole
From: |
Cédric Le Goater |
Subject: |
[Qemu-ppc] [PATCH v2 10/19] spapr: introduce a 'xive_exploitation' boolean to enable XIVE |
Date: |
Sat, 9 Dec 2017 09:43:29 +0100 |
The XIVE exploitation interrupt mode will be enabled for newer
machines and disabled for older ones. Also provide a command line
machine option to switch XIVE off on newer machines if needed.
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/intc/spapr_xive.c | 10 ++++++----
hw/ppc/spapr.c | 35 +++++++++++++++++++++++++++++++++++
include/hw/ppc/spapr.h | 1 +
3 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 38e1f569ea82..bf30edc87bee 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -756,8 +756,9 @@ static const VMStateDescription vmstate_spapr_xive_ive = {
static bool vmstate_spapr_xive_needed(void *opaque)
{
- /* TODO check machine XIVE support */
- return true;
+ sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
+
+ return spapr->xive_exploitation;
}
static const VMStateDescription vmstate_spapr_xive = {
@@ -885,8 +886,9 @@ static const VMStateDescription vmstate_spapr_xive_nvt_eq =
{
static bool vmstate_spapr_xive_nvt_needed(void *opaque)
{
- /* TODO check machine XIVE support */
- return true;
+ sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
+
+ return spapr->xive_exploitation;
}
static const VMStateDescription vmstate_spapr_xive_nvt = {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 306875e12320..b5b9e7f1b3b6 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2820,6 +2820,29 @@ static void spapr_set_vsmt(Object *obj, Visitor *v,
const char *name,
visit_type_uint32(v, name, (uint32_t *)opaque, errp);
}
+static bool spapr_get_xive_exploitation(Object *obj, Error **errp)
+{
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
+
+ return spapr->xive_exploitation;
+}
+
+static void spapr_set_xive_exploitation(Object *obj, bool value,
+ Error **errp)
+{
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
+
+ if (value) {
+ /* Don't let older machines activate XIVE */
+ if (!spapr->xive_exploitation) {
+ error_setg(errp, "\"xive-exploitation\" option can not be "
+ "switched on");
+ }
+ } else {
+ spapr->xive_exploitation = false;
+ }
+}
+
static void spapr_machine_initfn(Object *obj)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
@@ -2855,6 +2878,15 @@ static void spapr_machine_initfn(Object *obj)
object_property_set_description(obj, "vsmt",
"Virtual SMT: KVM behaves as if this were"
" the host's SMT mode", &error_abort);
+
+ spapr->xive_exploitation = true;
+ object_property_add_bool(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)
@@ -3890,7 +3922,10 @@ DEFINE_SPAPR_MACHINE(2_12, "2.12", true);
static void spapr_machine_2_11_instance_options(MachineState *machine)
{
+ sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
+
spapr_machine_2_12_instance_options(machine);
+ spapr->xive_exploitation = false;
}
static void spapr_machine_2_11_class_options(MachineClass *mc)
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 14757b805e84..1d6d2c690d7f 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -127,6 +127,7 @@ struct sPAPRMachineState {
MemoryHotplugState hotplug_memory;
const char *icp_type;
+ bool xive_exploitation;
};
#define H_SUCCESS 0
--
2.13.6
- Re: [Qemu-ppc] [PATCH v2 03/19] spapr: introduce the XIVE interrupt sources, (continued)
[Qemu-ppc] [PATCH v2 04/19] spapr: add support for the LSI interrupt sources, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 05/19] spapr: introduce a XIVE interrupt presenter model, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 06/19] spapr: introduce the XIVE Event Queues, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 07/19] spapr: push the XIVE EQ data in OS event queue, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 08/19] spapr: notify the CPU when the XIVE interrupt priority is more privileged, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 09/19] spapr: add support for the SET_OS_PENDING command (XIVE), Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 10/19] spapr: introduce a 'xive_exploitation' boolean to enable XIVE,
Cédric Le Goater <=
[Qemu-ppc] [PATCH v2 11/19] spapr: add a sPAPRXive object to the machine, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 12/19] spapr: add hcalls support for the XIVE exploitation interrupt mode, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 13/19] spapr: add device tree support for the XIVE interrupt mode, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 14/19] spapr: introduce a helper to map the XIVE memory regions, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 15/19] spapr: add XIVE support to spapr_qirq(), Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 16/19] spapr: introduce a spapr_icp_create() helper, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 17/19] spapr: toggle the ICP depending on the selected interrupt mode, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 18/19] spapr: add support to dump XIVE information, Cédric Le Goater, 2017/12/09
[Qemu-ppc] [PATCH v2 19/19] spapr: advertise XIVE exploitation mode in CAS, Cédric Le Goater, 2017/12/09