From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-ppc@nongnu.org, Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 05/13] spapr/xive: Use device_class_set_parent_realize()
Date: Mon, 23 Dec 2019 15:27:50 +1100 [thread overview]
Message-ID: <20191223042750.GD21569@umbus.fritz.box> (raw)
In-Reply-To: <20191219181155.32530-6-clg@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 3786 bytes --]
On Thu, Dec 19, 2019 at 07:11:47PM +0100, Cédric Le Goater wrote:
> From: Greg Kurz <groug@kaod.org>
>
> 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 <groug@kaod.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied to ppc-for-5.0, thanks.
> ---
> include/hw/ppc/spapr_xive.h | 10 ++++++++++
> hw/intc/spapr_xive.c | 12 +++++++++++-
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h
> index 3a103c224d44..93d09d68deb7 100644
> --- a/include/hw/ppc/spapr_xive.h
> +++ b/include/hw/ppc/spapr_xive.h
> @@ -15,6 +15,10 @@
>
> #define TYPE_SPAPR_XIVE "spapr-xive"
> #define SPAPR_XIVE(obj) OBJECT_CHECK(SpaprXive, (obj), TYPE_SPAPR_XIVE)
> +#define SPAPR_XIVE_CLASS(klass) \
> + OBJECT_CLASS_CHECK(SpaprXiveClass, (klass), TYPE_SPAPR_XIVE)
> +#define SPAPR_XIVE_GET_CLASS(obj) \
> + OBJECT_GET_CLASS(SpaprXiveClass, (obj), TYPE_SPAPR_XIVE)
>
> typedef struct SpaprXive {
> XiveRouter parent;
> @@ -47,6 +51,12 @@ typedef struct SpaprXive {
> VMChangeStateEntry *change;
> } SpaprXive;
>
> +typedef struct SpaprXiveClass {
> + XiveRouterClass parent;
> +
> + DeviceRealize parent_realize;
> +} SpaprXiveClass;
> +
> /*
> * The sPAPR machine has a unique XIVE IC device. Assign a fixed value
> * to the controller block id value. It can nevertheless be changed
> diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
> index 57305c56d707..32322470a8b8 100644
> --- a/hw/intc/spapr_xive.c
> +++ b/hw/intc/spapr_xive.c
> @@ -286,10 +286,17 @@ static void spapr_xive_instance_init(Object *obj)
> static void spapr_xive_realize(DeviceState *dev, Error **errp)
> {
> SpaprXive *xive = SPAPR_XIVE(dev);
> + SpaprXiveClass *sxc = SPAPR_XIVE_GET_CLASS(xive);
> XiveSource *xsrc = &xive->source;
> XiveENDSource *end_xsrc = &xive->end_source;
> Error *local_err = NULL;
>
> + sxc->parent_realize(dev, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
> +
> if (!xive->nr_irqs) {
> error_setg(errp, "Number of interrupt needs to be greater 0");
> return;
> @@ -760,10 +767,12 @@ static void spapr_xive_class_init(ObjectClass *klass, void *data)
> XiveRouterClass *xrc = XIVE_ROUTER_CLASS(klass);
> SpaprInterruptControllerClass *sicc = SPAPR_INTC_CLASS(klass);
> XivePresenterClass *xpc = XIVE_PRESENTER_CLASS(klass);
> + SpaprXiveClass *sxc = SPAPR_XIVE_CLASS(klass);
>
> dc->desc = "sPAPR XIVE Interrupt Controller";
> dc->props = spapr_xive_properties;
> - dc->realize = spapr_xive_realize;
> + device_class_set_parent_realize(dc, spapr_xive_realize,
> + &sxc->parent_realize);
> dc->vmsd = &vmstate_spapr_xive;
>
> xrc->get_eas = spapr_xive_get_eas;
> @@ -794,6 +803,7 @@ static const TypeInfo spapr_xive_info = {
> .instance_init = spapr_xive_instance_init,
> .instance_size = sizeof(SpaprXive),
> .class_init = spapr_xive_class_init,
> + .class_size = sizeof(SpaprXiveClass),
> .interfaces = (InterfaceInfo[]) {
> { TYPE_SPAPR_INTC },
> { }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-12-23 4:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-19 18:11 [PATCH v2 00/13] ppc/pnv: remove the use of qdev_get_machine() and get_system_memory() Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 01/13] ppc/pnv: Modify the powerdown notifier to get the PowerNV machine Cédric Le Goater
2019-12-20 0:26 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 02/13] ppc/pnv: Introduce a "system-memory" property Cédric Le Goater
2019-12-19 18:56 ` Greg Kurz
2019-12-20 0:31 ` David Gibson
2019-12-20 6:49 ` Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 03/13] ppc/pnv: Introduce a "xics" property alias under the PSI model Cédric Le Goater
2019-12-22 9:33 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 04/13] ppc/pnv: Introduce a "xics" property under the POWER8 chip Cédric Le Goater
2019-12-23 4:17 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 05/13] spapr/xive: Use device_class_set_parent_realize() Cédric Le Goater
2019-12-23 4:27 ` David Gibson [this message]
2019-12-19 18:11 ` [PATCH v2 06/13] pnv/xive: " Cédric Le Goater
2019-12-23 4:29 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 07/13] spapr, pnv, xive: Add a "xive-fabric" link to the XIVE router Cédric Le Goater
2019-12-23 6:10 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 08/13] xive: Use the XIVE fabric link under " Cédric Le Goater
2019-12-23 6:11 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 09/13] ppc/pnv: Add an "nr-threads" property to the base chip class Cédric Le Goater
2019-12-23 6:12 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 10/13] ppc/pnv: Add a "pnor" const link property to the BMC internal simulator Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 11/13] xive: Add a "presenter" link property to the TCTX object Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 12/13] spapr/xive: Deduce the SpaprXive pointer from XiveTCTX::xptr Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 13/13] pnv/xive: Deduce the PnvXive " Cédric Le Goater
2019-12-23 6:16 ` [PATCH v2 00/13] ppc/pnv: remove the use of qdev_get_machine() and get_system_memory() David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191223042750.GD21569@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=clg@kaod.org \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).