qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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 v3 05/35] spapr/xive: add a single source block to the sPAPR XIVE model
Date: Thu, 26 Apr 2018 14:46:35 +1000	[thread overview]
Message-ID: <20180426044635.GG8800@umbus.fritz.box> (raw)
In-Reply-To: <6086f4d7-c927-6660-679b-719c59003f64@kaod.org>

[-- Attachment #1: Type: text/plain, Size: 6382 bytes --]

On Tue, Apr 24, 2018 at 10:19:58AM +0200, Cédric Le Goater wrote:
> On 04/24/2018 08:58 AM, David Gibson wrote:
> > On Thu, Apr 19, 2018 at 02:43:01PM +0200, Cédric Le Goater wrote:
> >> Bare-metal systems (PowerNV) have multiples interrupt sources. The
> >> XIVE interrupt controller has an internal source for IPIs and generic
> >> IPIs, the PSIHB has one and also the PHBs. But, for simplicity on the
> >> sPAPR machine, we use a unique XiveSource object for all IPIs and
> >> virtual device interrupts of the VM.
> >>
> >> The ESB MMIO region used to control the sources is mapped at the
> >> address of chip 0 of a real system and only the provisioned IRQ
> >> numbers are covered.
> > 
> > Is that MMIO address PAPR specified, or arbitrary?
> 
> There are no specified value for the ESB address. It's queried by 
> the guest using the H_INT_GET_SOURCE_INFO hcall. For KVM, I have
> introduced a ioctl to configure the KVM device.

Ok.

> 
> Same for the TIMA, but in this case, the address is exposed to the
> guest in the device tree.
>  
> > 
> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> ---
> >>  hw/intc/spapr_xive.c        | 34 ++++++++++++++++++++++++++++++++++
> >>  include/hw/ppc/spapr_xive.h |  3 +++
> >>  include/hw/ppc/xive.h       |  6 ++++++
> >>  3 files changed, 43 insertions(+)
> >>
> >> diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
> >> index 020444e2665a..90cde8a4082d 100644
> >> --- a/hw/intc/spapr_xive.c
> >> +++ b/hw/intc/spapr_xive.c
> >> @@ -14,12 +14,15 @@
> >>  #include "sysemu/cpus.h"
> >>  #include "monitor/monitor.h"
> >>  #include "hw/ppc/spapr_xive.h"
> >> +#include "hw/ppc/xive.h"
> >>  #include "hw/ppc/xive_regs.h"
> >>  
> >>  void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon)
> >>  {
> >>      int i;
> >>  
> >> +    xive_source_pic_print_info(&xive->source, mon);
> >> +
> >>      monitor_printf(mon, "IVE Table\n");
> >>      for (i = 0; i < xive->nr_irqs; i++) {
> >>          XiveIVE *ive = &xive->ivt[i];
> >> @@ -40,6 +43,9 @@ static void spapr_xive_reset(DeviceState *dev)
> >>      sPAPRXive *xive = SPAPR_XIVE(dev);
> >>      int i;
> >>  
> >> +    /* Xive Source reset is done through SysBus, it should put all
> >> +     * IRQs to OFF (!P|Q) */
> >> +
> >>      /* Mask all valid IVEs in the IRQ number space. */
> >>      for (i = 0; i < xive->nr_irqs; i++) {
> >>          XiveIVE *ive = &xive->ivt[i];
> >> @@ -51,18 +57,42 @@ static void spapr_xive_reset(DeviceState *dev)
> >>  
> >>  static void spapr_xive_init(Object *obj)
> >>  {
> >> +    sPAPRXive *xive = SPAPR_XIVE(obj);
> >>  
> >> +    object_initialize(&xive->source, sizeof(xive->source), TYPE_XIVE_SOURCE);
> >> +    object_property_add_child(obj, "source", OBJECT(&xive->source), NULL);
> >>  }
> >>  
> >>  static void spapr_xive_realize(DeviceState *dev, Error **errp)
> >>  {
> >>      sPAPRXive *xive = SPAPR_XIVE(dev);
> >> +    XiveSource *xsrc = &xive->source;
> >> +    Error *local_err = NULL;
> >>  
> >>      if (!xive->nr_irqs) {
> >>          error_setg(errp, "Number of interrupt needs to be greater 0");
> >>          return;
> >>      }
> >>  
> >> +    /* The XIVE interrupt controller has an internal source for IPIs
> >> +     * and generic IPIs, the PSIHB has one and also the PHBs. For
> >> +     * simplicity, we use a unique XIVE source object for *all*
> >> +     * interrupts on sPAPR. The ESBs pages are mapped at the address
> >> +     * of chip 0 of a real system.
> >> +     */
> >> +    object_property_set_int(OBJECT(xsrc), XIVE_VC_BASE, "bar",
> >> +                            &error_fatal);
> >> +    object_property_set_int(OBJECT(xsrc), xive->nr_irqs, "nr-irqs",
> >> +                            &error_fatal);
> >> +    object_property_add_const_link(OBJECT(xsrc), "xive", OBJECT(xive),
> >> +                                   &error_fatal);
> >> +    object_property_set_bool(OBJECT(xsrc), true, "realized", &local_err);
> >> +    if (local_err) {
> >> +        error_propagate(errp, local_err);
> >> +        return;
> >> +    }
> >> +    qdev_set_parent_bus(DEVICE(xsrc), sysbus_get_default());
> >> +
> >>      /* Allocate the Interrupt Virtualization Table */
> >>      xive->ivt = g_new0(XiveIVE, xive->nr_irqs);
> >>  }
> >> @@ -137,23 +167,27 @@ type_init(spapr_xive_register_types)
> >>  bool spapr_xive_irq_enable(sPAPRXive *xive, uint32_t lisn, bool lsi)
> >>  {
> >>      XiveIVE *ive = spapr_xive_get_ive(XIVE_FABRIC(xive), lisn);
> >> +    XiveSource *xsrc = &xive->source;
> >>  
> >>      if (!ive) {
> >>          return false;
> >>      }
> >>  
> >>      ive->w |= IVE_VALID;
> >> +    xive_source_irq_set(xsrc, lisn - xsrc->offset, lsi);
> >>      return true;
> >>  }
> >>  
> >>  bool spapr_xive_irq_disable(sPAPRXive *xive, uint32_t lisn)
> >>  {
> >>      XiveIVE *ive = spapr_xive_get_ive(XIVE_FABRIC(xive), lisn);
> >> +    XiveSource *xsrc = &xive->source;
> >>  
> >>      if (!ive) {
> >>          return false;
> >>      }
> >>  
> >>      ive->w &= ~IVE_VALID;
> >> +    xive_source_irq_set(xsrc, lisn - xsrc->offset, false);
> >>      return true;
> >>  }
> >> diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h
> >> index 1d966b5d3a96..4538c622b60a 100644
> >> --- a/include/hw/ppc/spapr_xive.h
> >> +++ b/include/hw/ppc/spapr_xive.h
> >> @@ -19,6 +19,9 @@
> >>  typedef struct sPAPRXive {
> >>      SysBusDevice parent;
> >>  
> >> +    /* Internal interrupt source for IPIs and virtual devices */
> >> +    XiveSource   source;
> >> +
> >>      /* Routing table */
> >>      XiveIVE      *ivt;
> >>      uint32_t     nr_irqs;
> >> diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
> >> index 5b145816acdc..57295715a4a5 100644
> >> --- a/include/hw/ppc/xive.h
> >> +++ b/include/hw/ppc/xive.h
> >> @@ -16,6 +16,12 @@
> >>  typedef struct XiveFabric XiveFabric;
> >>  
> >>  /*
> >> + * XIVE MMIO regions
> >> + */
> >> +
> >> +#define XIVE_VC_BASE   0x0006010000000000ull



> >> +
> >> +/*
> >>   * XIVE Interrupt Source
> >>   */
> >>  
> > 
> 

-- 
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 --]

  reply	other threads:[~2018-04-26  5:20 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 12:42 [Qemu-devel] [PATCH v3 00/35] ppc: support for the XIVE interrupt controller (POWER9) Cédric Le Goater
2018-04-19 12:42 ` [Qemu-devel] [PATCH v3 01/35] ppc/xive: introduce a XIVE interrupt source model Cédric Le Goater
2018-04-20  7:10   ` David Gibson
2018-04-20  8:27     ` Cédric Le Goater
2018-04-23  3:59       ` David Gibson
2018-04-23  7:11         ` Cédric Le Goater
2018-04-24  1:24           ` David Gibson
2018-04-19 12:42 ` [Qemu-devel] [PATCH v3 02/35] ppc/xive: add support for the LSI interrupt sources Cédric Le Goater
2018-04-23  6:44   ` David Gibson
2018-04-23  7:31     ` Cédric Le Goater
2018-04-24  6:41       ` David Gibson
2018-04-24  8:11         ` Cédric Le Goater
2018-04-26  3:28           ` David Gibson
2018-04-26 12:16             ` Cédric Le Goater
2018-04-27  2:43               ` David Gibson
2018-05-04 14:25                 ` Cédric Le Goater
2018-05-05  4:32                   ` David Gibson
2018-04-19 12:42 ` [Qemu-devel] [PATCH v3 03/35] ppc/xive: introduce the XiveFabric interface Cédric Le Goater
2018-04-23  6:46   ` David Gibson
2018-04-23  7:58     ` Cédric Le Goater
2018-04-24  6:46       ` David Gibson
2018-04-24  9:33         ` Cédric Le Goater
2018-04-26  3:54           ` David Gibson
2018-04-26 10:30             ` Cédric Le Goater
2018-04-27  6:32               ` David Gibson
2018-05-02 15:28                 ` Cédric Le Goater
2018-05-03  5:13                   ` David Gibson
2018-05-23 10:12                     ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 04/35] spapr/xive: introduce a XIVE interrupt controller for sPAPR Cédric Le Goater
2018-04-24  6:51   ` David Gibson
2018-04-24  9:46     ` Cédric Le Goater
2018-04-26  4:20       ` David Gibson
2018-04-26 10:43         ` Cédric Le Goater
2018-05-03  5:22           ` David Gibson
2018-05-03 16:50             ` Cédric Le Goater
2018-05-04  3:33               ` David Gibson
2018-05-04 13:05                 ` Cédric Le Goater
2018-05-05  4:26                   ` David Gibson
2018-05-09  7:23                     ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 05/35] spapr/xive: add a single source block to the sPAPR XIVE model Cédric Le Goater
2018-04-24  6:58   ` David Gibson
2018-04-24  8:19     ` Cédric Le Goater
2018-04-26  4:46       ` David Gibson [this message]
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 06/35] spapr/xive: introduce a XIVE interrupt presenter model Cédric Le Goater
2018-04-26  7:11   ` David Gibson
2018-04-26  9:27     ` Cédric Le Goater
2018-04-26 17:15       ` Cédric Le Goater
2018-05-03  5:39         ` David Gibson
2018-05-03 15:10           ` Cédric Le Goater
2018-05-04  4:44             ` David Gibson
2018-05-04 14:15               ` Cédric Le Goater
2018-05-03  5:35       ` David Gibson
2018-05-03 16:06         ` Cédric Le Goater
2018-05-04  4:51           ` David Gibson
2018-05-04 13:11             ` Cédric Le Goater
2018-05-05  4:27               ` David Gibson
2018-05-09  7:27                 ` Cédric Le Goater
2018-05-02  7:39     ` Cédric Le Goater
2018-05-03  5:43       ` David Gibson
2018-05-03 14:42         ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 07/35] spapr/xive: introduce the XIVE Event Queues Cédric Le Goater
2018-04-26  7:25   ` David Gibson
2018-04-26  9:48     ` Cédric Le Goater
2018-05-03  5:45       ` David Gibson
2018-05-03  6:07         ` Cédric Le Goater
2018-05-03  6:25           ` David Gibson
2018-05-03 14:37             ` Cédric Le Goater
2018-05-04  5:19               ` David Gibson
2018-05-04 13:29                 ` Cédric Le Goater
2018-05-05  4:29                   ` David Gibson
2018-05-09  8:01                     ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 08/35] spapr: push the XIVE EQ data in OS event queue Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 09/35] spapr: notify the CPU when the XIVE interrupt priority is more privileged Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 10/35] spapr: add support for the SET_OS_PENDING command (XIVE) Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 11/35] spapr: introduce a 'xive_exploitation' option to enable XIVE Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 12/35] spapr: add a sPAPRXive object to the machine Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 13/35] spapr: add hcalls support for the XIVE exploitation interrupt mode Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 14/35] spapr: add device tree support for the XIVE exploitation mode Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 15/35] sysbus: add a sysbus_mmio_unmap() helper Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 16/35] spapr: introduce a helper to map the XIVE memory regions Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 17/35] spapr: add XIVE support to spapr_qirq() Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 18/35] spapr: introduce a spapr_icp_create() helper Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 19/35] spapr: toggle the ICP depending on the selected interrupt mode Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 20/35] spapr: add support to dump XIVE information Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 21/35] spapr: advertise XIVE exploitation mode in CAS Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 22/35] spapr: add classes for the XIVE models Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 23/35] target/ppc/kvm: add Linux KVM definitions for XIVE Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 24/35] spapr/xive: add common realize routine for KVM Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 25/35] spapr/xive: add KVM support Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 26/35] spapr/xive: add a XIVE KVM device to the machine Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 27/35] migration: discard non-migratable RAMBlocks Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 28/35] intc: introduce a CPUIntc interface Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 29/35] spapr/xive, xics: use the CPU_INTC handlers to reset KVM Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 30/35] spapr/xive, xics: reset KVM at machine reset Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 31/35] spapr/xive: raise migration priority of the machine Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 32/35] ppc/pnv: introduce a pnv_icp_create() helper Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 33/35] ppc: externalize ppc_get_vcpu_by_pir() Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 34/35] ppc/pnv: add XIVE support Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 35/35] ppc/pnv: add a PSI bridge model for POWER9 processor Cédric Le Goater
2018-04-19 13:28 ` [Qemu-devel] [PATCH v3 00/35] ppc: support for the XIVE interrupt controller (POWER9) no-reply

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=20180426044635.GG8800@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).