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,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [Qemu-devel] [PATCH v8 09/12] spapr: set the interrupt presenter at reset
Date: Tue, 18 Dec 2018 11:00:18 +1100 [thread overview]
Message-ID: <20181218000018.GA23604@umbus.fritz.box> (raw)
In-Reply-To: <6f685f79-56b2-7ea4-57b6-e1f21bd34326@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 5401 bytes --]
On Mon, Dec 17, 2018 at 11:41:34PM +0100, Cédric Le Goater wrote:
> On 12/17/18 7:01 AM, David Gibson wrote:
> > On Thu, Dec 13, 2018 at 01:52:14PM +0100, Cédric Le Goater wrote:
> >> On 12/11/18 11:38 PM, Cédric Le Goater wrote:
> >>> Currently, the interrupt presenter of the vCPU is set at realize
> >>> time. Setting it at reset will become necessary when the new machine
> >>> supporting both interrupt modes is introduced. In this machine, the
> >>> interrupt mode is chosen at CAS time and activated after a reset.
> >>
> >> I think we need a second '->intc' pointer specific to XIVE instead.
> >> How about ->intc_xive ?
> >
> > Ah, interesting. If we're going to need that, we might as well go
> > to specific ->icp and ->tctx pointers with the right types.
>
> Hmm, PowerPCCPU is defined under target/ppc and adding the type might
> add some noise. I will check.
It's a pointer, so you can just declare the type without a
definition. That should be ok.
> > I don't particularly like having those machine specific pointers
> > within the cpu structure, but we can look at fixing that later by
> > reviving my patches to move various machine specific stuff within the
> > cpu into a separate sub-allocation.
>
> ok.
>
> Thanks,
>
> C.
>
> >>
> >> We could just drop this patch and easly get rid of the XiveTCTX object
> >> leak in spapr_unrealize_vcpu().
> >>
> >> C.
> >>
> >>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >>> ---
> >>>
> >>> Changes since v7:
> >>>
> >>> - introduced spapr_irq_reset_xics().
> >>>
> >>> include/hw/ppc/spapr_cpu_core.h | 2 ++
> >>> hw/ppc/spapr_cpu_core.c | 26 ++++++++++++++++++++++++++
> >>> hw/ppc/spapr_irq.c | 13 +++++++++++++
> >>> 3 files changed, 41 insertions(+)
> >>>
> >>> diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h
> >>> index 9e2821e4b31f..fc8ea9021656 100644
> >>> --- a/include/hw/ppc/spapr_cpu_core.h
> >>> +++ b/include/hw/ppc/spapr_cpu_core.h
> >>> @@ -53,4 +53,6 @@ static inline sPAPRCPUState *spapr_cpu_state(PowerPCCPU *cpu)
> >>> return (sPAPRCPUState *)cpu->machine_data;
> >>> }
> >>>
> >>> +void spapr_cpu_core_set_intc(PowerPCCPU *cpu, const char *intc_type);
> >>> +
> >>> #endif
> >>> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> >>> index 82666436e9b4..afc5d4f4e739 100644
> >>> --- a/hw/ppc/spapr_cpu_core.c
> >>> +++ b/hw/ppc/spapr_cpu_core.c
> >>> @@ -397,3 +397,29 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {
> >>> };
> >>>
> >>> DEFINE_TYPES(spapr_cpu_core_type_infos)
> >>> +
> >>> +typedef struct ForeachFindIntCArgs {
> >>> + const char *intc_type;
> >>> + Object *intc;
> >>> +} ForeachFindIntCArgs;
> >>> +
> >>> +static int spapr_cpu_core_find_intc(Object *child, void *opaque)
> >>> +{
> >>> + ForeachFindIntCArgs *args = opaque;
> >>> +
> >>> + if (object_dynamic_cast(child, args->intc_type)) {
> >>> + args->intc = child;
> >>> + }
> >>> +
> >>> + return args->intc != NULL;
> >>> +}
> >>> +
> >>> +void spapr_cpu_core_set_intc(PowerPCCPU *cpu, const char *intc_type)
> >>> +{
> >>> + ForeachFindIntCArgs args = { intc_type, NULL };
> >>> +
> >>> + object_child_foreach(OBJECT(cpu), spapr_cpu_core_find_intc, &args);
> >>> + g_assert(args.intc);
> >>> +
> >>> + cpu->intc = args.intc;
> >>> +}
> >>> diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
> >>> index 0999a2b2d69c..814500f22d34 100644
> >>> --- a/hw/ppc/spapr_irq.c
> >>> +++ b/hw/ppc/spapr_irq.c
> >>> @@ -12,6 +12,7 @@
> >>> #include "qemu/error-report.h"
> >>> #include "qapi/error.h"
> >>> #include "hw/ppc/spapr.h"
> >>> +#include "hw/ppc/spapr_cpu_core.h"
> >>> #include "hw/ppc/spapr_xive.h"
> >>> #include "hw/ppc/xics.h"
> >>> #include "sysemu/kvm.h"
> >>> @@ -208,6 +209,15 @@ static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_id)
> >>> return 0;
> >>> }
> >>>
> >>> +static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp)
> >>> +{
> >>> + CPUState *cs;
> >>> +
> >>> + CPU_FOREACH(cs) {
> >>> + spapr_cpu_core_set_intc(POWERPC_CPU(cs), spapr->icp_type);
> >>> + }
> >>> +}
> >>> +
> >>> #define SPAPR_IRQ_XICS_NR_IRQS 0x1000
> >>> #define SPAPR_IRQ_XICS_NR_MSIS \
> >>> (XICS_IRQ_BASE + SPAPR_IRQ_XICS_NR_IRQS - SPAPR_IRQ_MSI)
> >>> @@ -225,6 +235,7 @@ sPAPRIrq spapr_irq_xics = {
> >>> .dt_populate = spapr_dt_xics,
> >>> .cpu_intc_create = spapr_irq_cpu_intc_create_xics,
> >>> .post_load = spapr_irq_post_load_xics,
> >>> + .reset = spapr_irq_reset_xics,
> >>> };
> >>>
> >>> /*
> >>> @@ -325,6 +336,8 @@ static void spapr_irq_reset_xive(sPAPRMachineState *spapr, Error **errp)
> >>> CPU_FOREACH(cs) {
> >>> PowerPCCPU *cpu = POWERPC_CPU(cs);
> >>>
> >>> + spapr_cpu_core_set_intc(cpu, TYPE_XIVE_TCTX);
> >>> +
> >>> /* (TCG) Set the OS CAM line of the thread interrupt context. */
> >>> spapr_xive_set_tctx_os_cam(XIVE_TCTX(cpu->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:[~2018-12-18 2:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 22:38 [Qemu-devel] [PATCH v8 00/12] ppc: support for the XIVE interrupt controller (POWER9) Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 01/12] spapr: introduce a new machine IRQ backend for XIVE Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 02/12] spapr: add hcalls support for the XIVE exploitation interrupt mode Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 03/12] spapr: add device tree support for the XIVE exploitation mode Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 04/12] spapr: allocate the interrupt thread context under the CPU core Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 05/12] spapr: extend the sPAPR IRQ backend for XICS migration Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 06/12] spapr: add a 'reset' method to the sPAPR IRQ backend Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 07/12] spapr: add an extra OV5 field " Cédric Le Goater
2018-12-17 5:27 ` David Gibson
2018-12-17 8:02 ` Cédric Le Goater
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 08/12] spapr: introduce an 'ic-mode' machine option Cédric Le Goater
2018-12-17 5:35 ` David Gibson
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 09/12] spapr: set the interrupt presenter at reset Cédric Le Goater
2018-12-13 12:52 ` Cédric Le Goater
2018-12-17 6:01 ` David Gibson
2018-12-17 22:41 ` Cédric Le Goater
2018-12-18 0:00 ` David Gibson [this message]
2018-12-17 5:37 ` David Gibson
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 10/12] spapr: enable XIVE MMIOs " Cédric Le Goater
2018-12-17 6:04 ` David Gibson
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 11/12] spapr: introduce a new sPAPR IRQ backend supporting XIVE and XICS Cédric Le Goater
2018-12-17 6:07 ` David Gibson
2018-12-17 22:38 ` Cédric Le Goater
2018-12-19 19:15 ` Cédric Le Goater
2018-12-21 1:50 ` David Gibson
2018-12-11 22:38 ` [Qemu-devel] [PATCH v8 12/12] spapr: change default CPU type to POWER9 Cédric Le Goater
2018-12-17 6:07 ` David Gibson
2018-12-17 10:47 ` Cédric Le Goater
2018-12-17 5:29 ` [Qemu-devel] [PATCH v8 00/12] ppc: support for the XIVE interrupt controller (POWER9) David Gibson
2018-12-17 10:16 ` Cédric Le Goater
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=20181218000018.GA23604@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=benh@kernel.crashing.org \
--cc=clg@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).