aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr_events.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2018-06-18 19:34:00 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2018-06-21 21:22:53 +1000
commit4fe75a8ccd8005f8d0322c5b85ebee6243b2e753 (patch)
tree0c92f857ae9de3c5d01b04c15d227875bbeb46ed /hw/ppc/spapr_events.c
parent24c6863c7b61efcfe4a0f0916ed4e8b797c8d281 (diff)
downloadqemu-4fe75a8ccd8005f8d0322c5b85ebee6243b2e753.zip
qemu-4fe75a8ccd8005f8d0322c5b85ebee6243b2e753.tar.gz
qemu-4fe75a8ccd8005f8d0322c5b85ebee6243b2e753.tar.bz2
spapr: split the IRQ allocation sequence
Today, when a device requests for IRQ number in a sPAPR machine, the spapr_irq_alloc() routine first scans the ICSState status array to find an empty slot and then performs the assignement of the selected numbers. Split this sequence in two distinct routines : spapr_irq_find() for lookups and spapr_irq_claim() for claiming the IRQ numbers. This will ease the introduction of a static layout of IRQ numbers. Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_events.c')
-rw-r--r--hw/ppc/spapr_events.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 86836f0..e4f5946 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -707,13 +707,18 @@ void spapr_clear_pending_events(sPAPRMachineState *spapr)
void spapr_events_init(sPAPRMachineState *spapr)
{
+ int epow_irq;
+
+ epow_irq = spapr_irq_findone(spapr, &error_fatal);
+
+ spapr_irq_claim(spapr, epow_irq, false, &error_fatal);
+
QTAILQ_INIT(&spapr->pending_events);
spapr->event_sources = spapr_event_sources_new();
spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_EPOW,
- spapr_irq_alloc(spapr, 0, false,
- &error_fatal));
+ epow_irq);
/* NOTE: if machine supports modern/dedicated hotplug event source,
* we add it to the device-tree unconditionally. This means we may
@@ -724,9 +729,14 @@ void spapr_events_init(sPAPRMachineState *spapr)
* checking that it's enabled.
*/
if (spapr->use_hotplug_event_source) {
+ int hp_irq;
+
+ hp_irq = spapr_irq_findone(spapr, &error_fatal);
+
+ spapr_irq_claim(spapr, hp_irq, false, &error_fatal);
+
spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_HOT_PLUG,
- spapr_irq_alloc(spapr, 0, false,
- &error_fatal));
+ hp_irq);
}
spapr->epow_notifier.notify = spapr_powerdown_req;