From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Greg Kurz <groug@kaod.org>
Subject: Re: [Qemu-devel] [PATCH v4 12/14] spapr/irq: initialize the IRQ device only once
Date: Tue, 14 May 2019 11:52:47 +1000 [thread overview]
Message-ID: <20190514015246.GD6441@umbus.fritz.box> (raw)
In-Reply-To: <20190513084245.25755-13-clg@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 2805 bytes --]
On Mon, May 13, 2019 at 10:42:43AM +0200, Cédric Le Goater wrote:
> Add a check to make sure that the routine initializing the emulated
> IRQ device is called once. We don't have much to test on the XICS
> side, so we introduce a 'init' boolean under ICSState.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
I'm not entirely sure it's the best way to accomplish what we need,
but it will do for now.
> ---
>
> Changes since v3:
>
> - introduced a 'init' boolean under ICSState
>
> include/hw/ppc/xics.h | 1 +
> hw/intc/spapr_xive.c | 9 +++++++++
> hw/intc/xics_spapr.c | 7 +++++++
> 3 files changed, 17 insertions(+)
>
> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
> index eb65ad7e43b7..d6f8e4c4c282 100644
> --- a/include/hw/ppc/xics.h
> +++ b/include/hw/ppc/xics.h
> @@ -119,6 +119,7 @@ struct ICSState {
> uint32_t offset;
> ICSIRQState *irqs;
> XICSFabric *xics;
> + bool init; /* sPAPR ICS device initialized */
> };
>
> #define ICS_PROP_XICS "xics"
> diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
> index 246b21ae7f31..1e649d6cdbe1 100644
> --- a/hw/intc/spapr_xive.c
> +++ b/hw/intc/spapr_xive.c
> @@ -338,6 +338,15 @@ void spapr_xive_init(SpaprXive *xive, Error **errp)
> XiveSource *xsrc = &xive->source;
> XiveENDSource *end_xsrc = &xive->end_source;
>
> + /*
> + * The emulated XIVE device can only be initialized once. If the
> + * ESB memory region has been already mapped, it means we have been
> + * through there.
> + */
> + if (memory_region_is_mapped(&xsrc->esb_mmio)) {
> + return;
> + }
> +
> /* TIMA initialization */
> memory_region_init_io(&xive->tm_mmio, OBJECT(xive), &xive_tm_ops, xive,
> "xive.tima", 4ull << TM_SHIFT);
> diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
> index 9d2b8adef7c5..5a1835e8b1ed 100644
> --- a/hw/intc/xics_spapr.c
> +++ b/hw/intc/xics_spapr.c
> @@ -239,6 +239,13 @@ static void rtas_int_on(PowerPCCPU *cpu, SpaprMachineState *spapr,
>
> void xics_spapr_init(SpaprMachineState *spapr)
> {
> + /* Emulated mode can only be initialized once. */
> + if (spapr->ics->init) {
> + return;
> + }
> +
> + spapr->ics->init = true;
> +
> /* Registration of global state belongs into realize */
> spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_set_xive);
> spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_get_xive);
--
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-05-14 1:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 8:42 [Qemu-devel] [PATCH v4 00/14] spapr: add KVM support to the XIVE interrupt mode Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 01/14] linux-headers: update linux headers to kvm-ppc-next-5.2-1 Cédric Le Goater
2019-05-20 6:25 ` [Qemu-devel] [PATCH] linux-headers: Update linux headers to 5.2-rc1 Cédric Le Goater
2019-05-20 7:03 ` Cornelia Huck
2019-05-20 7:06 ` Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 02/14] spapr/xive: add KVM support Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 03/14] spapr/xive: add hcall support when under KVM Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 04/14] spapr/xive: add state synchronization with KVM Cédric Le Goater
2019-05-14 1:48 ` David Gibson
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 05/14] spapr/xive: introduce a VM state change handler Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 06/14] spapr/xive: add migration support for KVM Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 07/14] spapr/xive: activate KVM support Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 08/14] sysbus: add a sysbus_mmio_unmap() helper Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 09/14] spapr: introduce routines to delete the KVM IRQ device Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 10/14] spapr: check for the activation of " Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 11/14] spapr/irq: introduce a spapr_irq_init_device() helper Cédric Le Goater
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 12/14] spapr/irq: initialize the IRQ device only once Cédric Le Goater
2019-05-14 1:52 ` David Gibson [this message]
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 13/14] ppc/xics: fix irq priority in ics_set_irq_type() Cédric Le Goater
2019-05-14 1:54 ` David Gibson
2019-05-13 8:42 ` [Qemu-devel] [PATCH v4 14/14] spapr/irq: add KVM support to the 'dual' machine Cédric Le Goater
2019-05-21 1:53 ` [Qemu-devel] [PATCH v4 00/14] spapr: add KVM support to the XIVE interrupt mode 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=20190514015246.GD6441@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).