[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/12] pnv/xive: Use device_class_set_parent_realize()
From: |
Cédric Le Goater |
Subject: |
[PATCH v3 03/12] pnv/xive: Use device_class_set_parent_realize() |
Date: |
Mon, 6 Jan 2020 15:56:36 +0100 |
From: Greg Kurz <address@hidden>
The XIVE router base class currently inherits an empty realize hook
from the sysbus device base class, but it will soon implement one
of its own to perform some sanity checks. Do the preliminary plumbing
to have it called.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: Cédric Le Goater <address@hidden>
Reviewed-by: David Gibson <address@hidden>
---
include/hw/ppc/pnv_xive.h | 10 ++++++++++
hw/intc/pnv_xive.c | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h
index f4c7caad40ee..76cf16f64472 100644
--- a/include/hw/ppc/pnv_xive.h
+++ b/include/hw/ppc/pnv_xive.h
@@ -16,6 +16,10 @@ struct PnvChip;
#define TYPE_PNV_XIVE "pnv-xive"
#define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE)
+#define PNV_XIVE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(PnvXiveClass, (klass), TYPE_PNV_XIVE)
+#define PNV_XIVE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(PnvXiveClass, (obj), TYPE_PNV_XIVE)
#define XIVE_BLOCK_MAX 16
@@ -85,6 +89,12 @@ typedef struct PnvXive {
uint64_t edt[XIVE_TABLE_EDT_MAX];
} PnvXive;
+typedef struct PnvXiveClass {
+ XiveRouterClass parent_class;
+
+ DeviceRealize parent_realize;
+} PnvXiveClass;
+
void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon);
#endif /* PPC_PNV_XIVE_H */
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index a0a69b98a713..6412cf222eae 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -1816,10 +1816,17 @@ static void pnv_xive_init(Object *obj)
static void pnv_xive_realize(DeviceState *dev, Error **errp)
{
PnvXive *xive = PNV_XIVE(dev);
+ PnvXiveClass *pxc = PNV_XIVE_GET_CLASS(dev);
XiveSource *xsrc = &xive->ipi_source;
XiveENDSource *end_xsrc = &xive->end_source;
Error *local_err = NULL;
+ pxc->parent_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
assert(xive->chip);
/*
@@ -1947,10 +1954,12 @@ static void pnv_xive_class_init(ObjectClass *klass,
void *data)
XiveRouterClass *xrc = XIVE_ROUTER_CLASS(klass);
XiveNotifierClass *xnc = XIVE_NOTIFIER_CLASS(klass);
XivePresenterClass *xpc = XIVE_PRESENTER_CLASS(klass);
+ PnvXiveClass *pxc = PNV_XIVE_CLASS(klass);
xdc->dt_xscom = pnv_xive_dt_xscom;
dc->desc = "PowerNV XIVE Interrupt Controller";
+ device_class_set_parent_realize(dc, pnv_xive_realize,
&pxc->parent_realize);
dc->realize = pnv_xive_realize;
dc->props = pnv_xive_properties;
@@ -1971,6 +1980,7 @@ static const TypeInfo pnv_xive_info = {
.instance_init = pnv_xive_init,
.instance_size = sizeof(PnvXive),
.class_init = pnv_xive_class_init,
+ .class_size = sizeof(PnvXiveClass),
.interfaces = (InterfaceInfo[]) {
{ TYPE_PNV_XSCOM_INTERFACE },
{ }
--
2.21.1
- [PATCH v3 00/12] ppc/pnv: remove the use of qdev_get_machine(), Cédric Le Goater, 2020/01/06
- [PATCH v3 01/12] ppc/pnv: Introduce a "xics" property alias under the PSI model, Cédric Le Goater, 2020/01/06
- [PATCH v3 02/12] ppc/pnv: Introduce a "xics" property under the POWER8 chip, Cédric Le Goater, 2020/01/06
- [PATCH v3 03/12] pnv/xive: Use device_class_set_parent_realize(),
Cédric Le Goater <=
- [PATCH v3 04/12] spapr, pnv, xive: Add a "xive-fabric" link to the XIVE router, Cédric Le Goater, 2020/01/06
- [PATCH v3 05/12] xive: Use the XIVE fabric link under the XIVE router, Cédric Le Goater, 2020/01/06
- [PATCH v3 06/12] ppc/pnv: Add an "nr-threads" property to the base chip class, Cédric Le Goater, 2020/01/06
- [PATCH v3 07/12] ppc/pnv: Add a "pnor" const link property to the BMC internal simulator, Cédric Le Goater, 2020/01/06
- [PATCH v3 08/12] xive: Add a "presenter" link property to the TCTX object, Cédric Le Goater, 2020/01/06
- [PATCH v3 09/12] spapr/xive: Deduce the SpaprXive pointer from XiveTCTX::xptr, Cédric Le Goater, 2020/01/06
- [PATCH v3 10/12] pnv/xive: Deduce the PnvXive pointer from XiveTCTX::xptr, Cédric Le Goater, 2020/01/06
- [PATCH v3 11/12] pnv/psi: Add device reset hook, Cédric Le Goater, 2020/01/06