[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 29/37] spapr: set the interrupt presenter at rese
From: |
Cédric Le Goater |
Subject: |
[Qemu-devel] [PATCH v6 29/37] spapr: set the interrupt presenter at reset |
Date: |
Thu, 6 Dec 2018 00:22:43 +0100 |
Currently, the interrupt presenter of the vCPU is set at realize
time. Setting it at reset will become useful when the new machine
supporting both interrupt modes is introduced. In this machine, the
interrupt mode is chosen at CAS time and activated after a reset.
Signed-off-by: Cédric Le Goater <address@hidden>
---
include/hw/ppc/spapr_cpu_core.h | 2 ++
hw/ppc/spapr_cpu_core.c | 26 ++++++++++++++++++++++++++
hw/ppc/spapr_irq.c | 11 +++++++++++
3 files changed, 39 insertions(+)
diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h
index 9e2821e4b31f..fc8ea9021656 100644
--- a/include/hw/ppc/spapr_cpu_core.h
+++ b/include/hw/ppc/spapr_cpu_core.h
@@ -53,4 +53,6 @@ static inline sPAPRCPUState *spapr_cpu_state(PowerPCCPU *cpu)
return (sPAPRCPUState *)cpu->machine_data;
}
+void spapr_cpu_core_set_intc(PowerPCCPU *cpu, const char *intc_type);
+
#endif
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 1811cd48db90..529de0b6b9c8 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -398,3 +398,29 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {
};
DEFINE_TYPES(spapr_cpu_core_type_infos)
+
+typedef struct ForeachFindIntCArgs {
+ const char *intc_type;
+ Object *intc;
+} ForeachFindIntCArgs;
+
+static int spapr_cpu_core_find_intc(Object *child, void *opaque)
+{
+ ForeachFindIntCArgs *args = opaque;
+
+ if (object_dynamic_cast(child, args->intc_type)) {
+ args->intc = child;
+ }
+
+ return args->intc != NULL;
+}
+
+void spapr_cpu_core_set_intc(PowerPCCPU *cpu, const char *intc_type)
+{
+ ForeachFindIntCArgs args = { intc_type, NULL };
+
+ object_child_foreach(OBJECT(cpu), spapr_cpu_core_find_intc, &args);
+ g_assert(args.intc);
+
+ cpu->intc = args.intc;
+}
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 951d4ff1350a..f9b5564b271c 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -211,6 +211,11 @@ static int spapr_irq_post_load_xics(sPAPRMachineState
*spapr, int version_id)
static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp)
{
+ CPUState *cs;
+
+ CPU_FOREACH(cs) {
+ spapr_cpu_core_set_intc(POWERPC_CPU(cs), spapr->icp_type);
+ }
}
#define SPAPR_IRQ_XICS_NR_IRQS 0x1000
@@ -349,6 +354,12 @@ static int spapr_irq_post_load_xive(sPAPRMachineState
*spapr, int version_id)
static void spapr_irq_reset_xive(sPAPRMachineState *spapr, Error **errp)
{
+ CPUState *cs;
+
+ CPU_FOREACH(cs) {
+ spapr_cpu_core_set_intc(POWERPC_CPU(cs), TYPE_XIVE_TCTX);
+ }
+
/*
* Set the OS CAM line of the cpu interrupt thread context. Needs
* to come after the XiveTCTX reset handlers.
--
2.17.2
- [Qemu-devel] [PATCH v6 18/37] spapr: add device tree support for the XIVE exploitation mode, (continued)
- [Qemu-devel] [PATCH v6 18/37] spapr: add device tree support for the XIVE exploitation mode, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 19/37] spapr: allocate the interrupt thread context under the CPU core, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 20/37] spapr: extend the sPAPR IRQ backend for XICS migration, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 17/37] spapr: add hcalls support for the XIVE exploitation interrupt mode, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 21/37] spapr: add a 'reset' method to the sPAPR IRQ backend, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 22/37] spapr: add a 'pseries-3.1-xive' machine type, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 23/37] linux-headers: update to 4.20-rc5, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 25/37] spapr/xive: add state synchronization with KVM, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 26/37] spapr/xive: introduce a VM state change handler, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 28/37] spapr/xive: fix migration of the XiveTCTX under TCG, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 29/37] spapr: set the interrupt presenter at reset,
Cédric Le Goater <=
- [Qemu-devel] [PATCH v6 30/37] spapr/xive: enable XIVE MMIOs at reset, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 27/37] spapr/xive: add migration support for KVM, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 24/37] spapr/xive: add KVM support, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 31/37] spapr: add a 'pseries-3.1-dual' machine type, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 32/37] ppc/xics: introduce a icp_kvm_connect() routine, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 33/37] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 34/37] sysbus: add a sysbus_mmio_unmap() helper, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 35/37] spapr: introduce routines to delete the KVM IRQ device, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 36/37] spapr: check for KVM IRQ device activation, Cédric Le Goater, 2018/12/05
- [Qemu-devel] [PATCH v6 37/37] spapr: add KVM support to the 'dual' machine, Cédric Le Goater, 2018/12/05