[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v3 14/15] spapr/irq: initialize the IRQ device onl
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH v3 14/15] spapr/irq: initialize the IRQ device only once |
Date: |
Fri, 22 Mar 2019 13:15:23 +1100 |
User-agent: |
Mutt/1.11.3 (2019-02-01) |
On Thu, Mar 21, 2019 at 03:49:13PM +0100, 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 'static bool'. Not very elegant but works well
> enough.
What's the rationale for this?
>
> Signed-off-by: Cédric Le Goater <address@hidden>
> ---
> hw/intc/spapr_xive.c | 9 +++++++++
> hw/intc/xics_spapr.c | 10 ++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
> index f889c89dc2e9..15d41d9cd36d 100644
> --- a/hw/intc/spapr_xive.c
> +++ b/hw/intc/spapr_xive.c
> @@ -337,6 +337,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..67e82f3720b0 100644
> --- a/hw/intc/xics_spapr.c
> +++ b/hw/intc/xics_spapr.c
> @@ -239,6 +239,16 @@ static void rtas_int_on(PowerPCCPU *cpu,
> SpaprMachineState *spapr,
>
> void xics_spapr_init(SpaprMachineState *spapr)
> {
> + static bool init_done;
> +
> + /*
> + * Emulated mode can only be initialized once.
> + */
> + if (init_done) {
> + return;
> + }
> + init_done = 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
signature.asc
Description: PGP signature
- [Qemu-ppc] [PATCH v3 08/15] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers, (continued)
- [Qemu-ppc] [PATCH v3 08/15] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers, Cédric Le Goater, 2019/03/21
- [Qemu-ppc] [PATCH v3 09/15] sysbus: add a sysbus_mmio_unmap() helper, Cédric Le Goater, 2019/03/21
- [Qemu-ppc] [PATCH v3 10/15] spapr: introduce routines to delete the KVM IRQ device, Cédric Le Goater, 2019/03/21
- [Qemu-ppc] [PATCH v3 11/15] spapr: check for the activation of the KVM IRQ device, Cédric Le Goater, 2019/03/21
- [Qemu-ppc] [PATCH v3 12/15] spapr/irq: remove spapr_ics_create(), Cédric Le Goater, 2019/03/21
- [Qemu-ppc] [PATCH v3 13/15] spapr/irq: introduce a spapr_irq_init_device() helper, Cédric Le Goater, 2019/03/21
- [Qemu-ppc] [PATCH v3 14/15] spapr/irq: initialize the IRQ device only once, Cédric Le Goater, 2019/03/21
- Re: [Qemu-ppc] [PATCH v3 14/15] spapr/irq: initialize the IRQ device only once,
David Gibson <=
- [Qemu-ppc] [PATCH v3 15/15] spapr/irq: add KVM support to the 'dual' machine, Cédric Le Goater, 2019/03/21