summaryrefslogtreecommitdiffstats
path: root/include/hw/ppc/spapr_irq.h
diff options
context:
space:
mode:
authorDavid Gibson2019-09-26 07:41:39 +0200
committerDavid Gibson2019-10-24 00:36:55 +0200
commit81106ddd1aee5c06e390eaffb07f857f925628f4 (patch)
tree6623bcc6770d775fecfb05e2840b35233476efc0 /include/hw/ppc/spapr_irq.h
parentspapr, xics, xive: Move irq claim and free from SpaprIrq to SpaprInterruptCon... (diff)
downloadqemu-81106ddd1aee5c06e390eaffb07f857f925628f4.tar.gz
qemu-81106ddd1aee5c06e390eaffb07f857f925628f4.tar.xz
qemu-81106ddd1aee5c06e390eaffb07f857f925628f4.zip
spapr: Formalize notion of active interrupt controller
spapr now has the mechanism of constructing both XICS and XIVE instances of the SpaprInterruptController interface. However, only one of the interrupt controllers will actually be active at any given time, depending on feature negotiation with the guest. This is handled in the current code via spapr_irq_current() which checks the OV5 vector from feature negotiation to determine the current backend. Determining the active controller at the point we need it like this can be pretty confusing, because it makes it very non obvious at what points the active controller can change. This can make it difficult to reason about the code and where a change of active controller could appear in sequence with other events. Make this mechanism more explicit by adding an 'active_intc' pointer and an explicit spapr_irq_update_active_intc() function to update it from the CAS state. We also add hooks on the intc backend which will get called when it is activated or deactivated. For now we just introduce the switch and hooks, later patches will actually start using them. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'include/hw/ppc/spapr_irq.h')
-rw-r--r--include/hw/ppc/spapr_irq.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index adfef0fcbe..593059eff5 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -44,6 +44,9 @@ typedef struct SpaprInterruptController SpaprInterruptController;
typedef struct SpaprInterruptControllerClass {
InterfaceClass parent;
+ int (*activate)(SpaprInterruptController *intc, Error **errp);
+ void (*deactivate)(SpaprInterruptController *intc);
+
/*
* These methods will typically be called on all intcs, active and
* inactive
@@ -55,6 +58,8 @@ typedef struct SpaprInterruptControllerClass {
void (*free_irq)(SpaprInterruptController *intc, int irq);
} SpaprInterruptControllerClass;
+void spapr_irq_update_active_intc(SpaprMachineState *spapr);
+
int spapr_irq_cpu_intc_create(SpaprMachineState *spapr,
PowerPCCPU *cpu, Error **errp);