[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 22/26] ppc/xive: create an XIVE interrupt source
From: |
Cédric Le Goater |
Subject: |
[Qemu-devel] [RFC PATCH 22/26] ppc/xive: create an XIVE interrupt source to handle IPIs |
Date: |
Wed, 5 Jul 2017 19:13:35 +0200 |
Isolate the IPIs in their own interrupt source.
This is not strictly needed for sPAPR, but it might useful for
PowerNV.
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/intc/xive-internal.h | 2 ++
hw/intc/xive.c | 24 +++++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/hw/intc/xive-internal.h b/hw/intc/xive-internal.h
index 5e8b78a1ea6a..f37e07f00038 100644
--- a/hw/intc/xive-internal.h
+++ b/hw/intc/xive-internal.h
@@ -204,6 +204,8 @@ struct XIVE {
uint32_t tm_shift;
hwaddr tm_base;
MemoryRegion tm_iomem;
+
+ XiveICSState ipi_xs;
};
void xive_reset(void *dev);
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 42eefbe7fd65..257b324e1d32 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -821,6 +821,9 @@ static uint32_t xive_alloc_ipi_irqs(XIVE *x, uint32_t
count, uint32_t align)
#define TM_SHIFT 16
#define TM_BAR_SIZE (XIVE_TM_RING_COUNT * (1 << TM_SHIFT))
+/* One 64k page. OPAL has two */
+#define IPI_ESB_SHIFT (16)
+
static uint64_t xive_esb_default_read(void *p, hwaddr offset, unsigned size)
{
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
@@ -863,12 +866,18 @@ void xive_reset(void *dev)
static void xive_init(Object *obj)
{
- ;
+ XIVE *x = XIVE(obj);
+
+ object_initialize(&x->ipi_xs, sizeof(x->ipi_xs), TYPE_ICS_XIVE);
+ object_property_add_child(obj, "ipis", OBJECT(&x->ipi_xs), NULL);
}
static void xive_realize(DeviceState *dev, Error **errp)
{
+ Error *error = NULL;
XIVE *x = XIVE(dev);
+ uint32_t ipi_base;
+ int i;
if (!x->nr_targets) {
error_setg(errp, "Number of interrupt targets needs to be greater 0");
@@ -917,6 +926,19 @@ static void xive_realize(DeviceState *dev, Error **errp)
"xive.tm", TM_BAR_SIZE);
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &x->tm_iomem);
+ /* IPI source */
+ ipi_base = xive_alloc_ipi_irqs(x, x->nr_targets, 1);
+
+ xive_ics_create(&x->ipi_xs, x, ipi_base, x->nr_targets,
+ IPI_ESB_SHIFT, XIVE_SRC_TRIGGER, &error);
+ if (error) {
+ error_propagate(errp, error);
+ return;
+ }
+
+ for (i = 0; i < ICS_BASE(&x->ipi_xs)->nr_irqs; i++) {
+ ics_set_irq_type(ICS_BASE(&x->ipi_xs), i, false);
+ }
qemu_register_reset(xive_reset, dev);
}
--
2.7.5
- Re: [Qemu-devel] [Qemu-ppc] [RFC PATCH 17/26] ppc/xive: add hcalls support, (continued)
[Qemu-devel] [RFC PATCH 18/26] ppc/xive: add device tree support, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 19/26] ppc/xive: introduce a helper to map the XIVE memory regions, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 20/26] ppc/xive: introduce a helper to create XIVE interrupt source objects, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 21/26] ppc/xive: introduce routines to allocate IRQ numbers, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 22/26] ppc/xive: create an XIVE interrupt source to handle IPIs,
Cédric Le Goater <=
[Qemu-devel] [RFC PATCH 23/26] spapr: add a XIVE object to the sPAPR machine, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 24/26] spapr: include the XIVE interrupt source for IPIs, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 25/26] spapr: print the XIVE interrupt source for IPIs in the monitor, Cédric Le Goater, 2017/07/05
[Qemu-devel] [RFC PATCH 26/26] spapr: force XIVE exploitation mode for POWER9 (HACK), Cédric Le Goater, 2017/07/05
Re: [Qemu-devel] [RFC PATCH 00/26] guest exploitation of the XIVE interrupt controller (POWER9), David Gibson, 2017/07/10
Re: [Qemu-devel] [RFC PATCH 00/26] guest exploitation of the XIVE interrupt controller (POWER9), David Gibson, 2017/07/18