[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v5 08/17] spapr_irq: Expose the phandle of the inter
From: |
Greg Kurz |
Subject: |
[qemu-s390x] [PATCH v5 08/17] spapr_irq: Expose the phandle of the interrupt controller |
Date: |
Tue, 19 Feb 2019 18:18:13 +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.
Signed-off-by: Greg Kurz <address@hidden>
---
v5: - return phandle by value
v4: - return phandle via a pointer
---
hw/ppc/spapr_irq.c | 21 +++++++++++++++++++++
include/hw/ppc/spapr_irq.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 359761494c6e..4145079d7fa5 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -638,6 +638,27 @@ void spapr_irq_reset(sPAPRMachineState *spapr, Error
**errp)
}
}
+int spapr_irq_get_phandle(sPAPRMachineState *spapr, void *fdt, Error **errp)
+{
+ const char *nodename = spapr->irq->get_nodename(spapr);
+ int offset, phandle;
+
+ 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;
+ }
+
+ phandle = fdt_get_phandle(fdt, offset);
+ if (!phandle) {
+ error_setg(errp, "Can't get phandle of node \"%s\"", nodename);
+ return -1;
+ }
+
+ return phandle;
+}
+
/*
* XICS legacy routines - to deprecate one day
*/
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index 8bf1a7291966..ec1ee64fa62b 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -61,6 +61,7 @@ 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, Error **errp);
/*
* XICS legacy routines
- [qemu-s390x] [PATCH v5 05/17] spapr/drc: Drop spapr_drc_attach() fdt argument, (continued)
- [qemu-s390x] [PATCH v5 06/17] xics: Write source state to KVM at claim time, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 04/17] spapr/pci: Generate FDT fragment at configure connector time, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 07/17] spapr: Expose the name of the interrupt controller node, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 08/17] spapr_irq: Expose the phandle of the interrupt controller,
Greg Kurz <=
- [qemu-s390x] [PATCH v5 11/17] spapr: populate PHB DRC entries for root DT node, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 09/17] spapr_pci: add PHB unrealize, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 12/17] spapr_events: add support for phb hotplug events, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 10/17] spapr: create DR connectors for PHBs, Greg Kurz, 2019/02/19
- [qemu-s390x] [PATCH v5 13/17] spapr_pci: provide node start offset via spapr_populate_pci_dt(), Greg Kurz, 2019/02/19