[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 05/15] spapr_irq: Expose the phandle of the inter
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH v4 05/15] spapr_irq: Expose the phandle of the interrupt controller |
Date: |
Tue, 12 Feb 2019 19:24:26 +0100 |
User-agent: |
StGit/unknown-version |
This will be used by PHB hotplug in order to create the "interrupt-map"
property of the PHB node.
Reviewed-by: Cédric Le Goater <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
---
v4: - return phandle via a pointer
---
hw/ppc/spapr_irq.c | 26 ++++++++++++++++++++++++++
include/hw/ppc/spapr_irq.h | 2 ++
2 files changed, 28 insertions(+)
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index b8d725e251ba..31495033c37c 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -692,6 +692,32 @@ void spapr_irq_reset(sPAPRMachineState *spapr, Error
**errp)
}
}
+int spapr_irq_get_phandle(sPAPRMachineState *spapr, void *fdt,
+ uint32_t *phandle, Error **errp)
+{
+ const char *nodename = spapr->irq->get_nodename(spapr);
+ int offset, ph;
+
+ offset = fdt_subnode_offset(fdt, 0, nodename);
+ if (offset < 0) {
+ error_setg(errp, "Can't find node \"%s\": %s", nodename,
+ fdt_strerror(offset));
+ return -1;
+ }
+
+ ph = fdt_get_phandle(fdt, offset);
+ if (!ph) {
+ error_setg(errp, "Can't get phandle of node \"%s\"", nodename);
+ return -1;
+ }
+
+ if (phandle) {
+ *phandle = ph;
+ }
+
+ return 0;
+}
+
/*
* XICS legacy routines - to deprecate one day
*/
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index ad7127355441..4b3303ef4f6a 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -62,6 +62,8 @@ void spapr_irq_free(sPAPRMachineState *spapr, int irq, int
num);
qemu_irq spapr_qirq(sPAPRMachineState *spapr, int irq);
int spapr_irq_post_load(sPAPRMachineState *spapr, int version_id);
void spapr_irq_reset(sPAPRMachineState *spapr, Error **errp);
+int spapr_irq_get_phandle(sPAPRMachineState *spapr, void *fdt,
+ uint32_t *phandle, Error **errp);
/*
* XICS legacy routines
- Re: [Qemu-devel] [PATCH v4 01/15] spapr_irq: Add an @xics_offset field to sPAPRIrq, (continued)
- [Qemu-devel] [PATCH v4 02/15] xive: Only set source type for LSIs, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 03/15] spapr_irq: Set LSIs at interrupt controller init, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 04/15] spapr: Expose the name of the interrupt controller node, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 05/15] spapr_irq: Expose the phandle of the interrupt controller,
Greg Kurz <=
- [Qemu-devel] [PATCH v4 06/15] spapr_pci: add PHB unrealize, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 08/15] spapr: populate PHB DRC entries for root DT node, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 07/15] spapr: create DR connectors for PHBs, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 09/15] spapr_events: add support for phb hotplug events, Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 10/15] qdev: pass an Object * to qbus_set_hotplug_handler(), Greg Kurz, 2019/02/12
- [Qemu-devel] [PATCH v4 12/15] spapr_pci: add ibm, my-drc-index property for PHB hotplug, Greg Kurz, 2019/02/12