From: vijay.kilari@gmail.com
To: Ian.Campbell@citrix.com, julien.grall@citrix.com,
stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com,
tim@xen.org, xen-devel@lists.xen.org
Cc: Prasun.Kapoor@caviumnetworks.com,
Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com
Subject: [PATCH v7 10/28] xen/arm: ITS: Implement hw_irq_controller for LPIs
Date: Fri, 18 Sep 2015 18:38:57 +0530 [thread overview]
Message-ID: <1442581755-2668-11-git-send-email-vijay.kilari@gmail.com> (raw)
In-Reply-To: <1442581755-2668-1-git-send-email-vijay.kilari@gmail.com>
From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Implement hw_irq_controller callbacks required to
handle LPIs.
Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
---
v7: - Split this patch into two. In this patch implement
only hw_irq_controller callbacks for LPIs.
v6: - Moved this patch #15 in v5 to patch #9
- Introduce inv command
- Moved msi_desc helper functions to separate
"xen/arm: ITS: Introduce msi_desc for LPIs"
- Exported LPI hw_irq_controller structure and removed
helper function to access.
v5: - Fixed review comments
- Exposed gicv3_[host|guest]_irq_end and hook to its
v4: - Implement separate hw_irq_controller for LPIs
- Drop setting LPI affinity
- virq and vid are moved under union
- Introduced inv command handling
- its_device is stored in irq_desc
---
xen/arch/arm/gic-v3-its.c | 119 +++++++++++++++++++++++++++++++++++++
xen/arch/arm/gic-v3.c | 2 +-
xen/include/asm-arm/gic_v3_defs.h | 2 +
3 files changed, 122 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index bc3b73c..0d5c61c 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -444,6 +444,125 @@ static void its_send_discard(struct its_device *dev, u32 event)
its_send_single_command(dev->its, &cmd, col);
}
+static void its_flush_and_invalidate_prop(struct irq_desc *desc, u8 *cfg)
+{
+ struct its_device *its_dev = irqdesc_get_its_device(desc);
+ u32 vid = irqdesc_get_lpi_event(desc);
+
+ ASSERT(vid < its_dev->event_map.nr_lpis);
+
+ /*
+ * Make the above write visible to the redistributors.
+ * And yes, we're flushing exactly: One. Single. Byte.
+ * Humpf...
+ */
+ if ( gic_rdists->flags & RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING )
+ clean_and_invalidate_dcache_va_range(cfg, sizeof(*cfg));
+ else
+ dsb(ishst);
+
+ its_send_inv(its_dev, vid);
+}
+
+static void its_set_lpi_state(struct irq_desc *desc, int enable)
+{
+ u8 *cfg;
+
+ ASSERT(spin_is_locked(&its_lock));
+
+ cfg = gic_rdists->prop_page + desc->irq - FIRST_GIC_LPI;
+ if ( enable )
+ *cfg |= LPI_PROP_ENABLED;
+ else
+ *cfg &= ~LPI_PROP_ENABLED;
+
+ its_flush_and_invalidate_prop(desc, cfg);
+}
+
+static void its_irq_enable(struct irq_desc *desc)
+{
+ unsigned long flags;
+
+ ASSERT(spin_is_locked(&desc->lock));
+
+ spin_lock_irqsave(&its_lock, flags);
+ clear_bit(_IRQ_DISABLED, &desc->status);
+ dsb(sy);
+ its_set_lpi_state(desc, 1);
+ spin_unlock_irqrestore(&its_lock, flags);
+}
+
+static void its_irq_disable(struct irq_desc *desc)
+{
+ unsigned long flags;
+
+ ASSERT(spin_is_locked(&desc->lock));
+
+ spin_lock_irqsave(&its_lock, flags);
+ its_set_lpi_state(desc, 0);
+ set_bit(_IRQ_DISABLED, &desc->status);
+ spin_unlock_irqrestore(&its_lock, flags);
+}
+
+static unsigned int its_irq_startup(struct irq_desc *desc)
+{
+ its_irq_enable(desc);
+
+ return 0;
+}
+
+static void its_irq_shutdown(struct irq_desc *desc)
+{
+ its_irq_disable(desc);
+}
+
+static void its_irq_ack(struct irq_desc *desc)
+{
+ /* No ACK -- reading IAR has done this for us */
+}
+
+static void its_host_irq_end(struct irq_desc *desc)
+{
+ /* Lower the priority */
+ gicv3_eoi_irq(desc);
+ /* LPIs does not have active state. Do not deactivate */
+}
+
+static void its_guest_irq_end(struct irq_desc *desc)
+{
+ gicv3_eoi_irq(desc);
+}
+
+static void its_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
+{
+ /*TODO: Yet to support */
+ printk(XENLOG_G_WARNING "ITS: Setting Affinity of LPI is not supported\n");
+
+ return;
+}
+
+const hw_irq_controller its_host_lpi_type = {
+ .typename = "gic-its",
+ .startup = its_irq_startup,
+ .shutdown = its_irq_shutdown,
+ .enable = its_irq_enable,
+ .disable = its_irq_disable,
+ .ack = its_irq_ack,
+ .end = its_host_irq_end,
+ .set_affinity = its_irq_set_affinity,
+};
+
+const hw_irq_controller its_guest_lpi_type = {
+ .typename = "gic-its",
+ .startup = its_irq_startup,
+ .shutdown = its_irq_shutdown,
+ .enable = its_irq_enable,
+ .disable = its_irq_disable,
+ .ack = its_irq_ack,
+ .end = its_guest_irq_end,
+ .set_affinity = its_irq_set_affinity,
+};
+
/*
* How we allocate LPIs:
*
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 6680bd2..4f0b28b 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -440,7 +440,7 @@ static void gicv3_mask_irq(struct irq_desc *irqd)
gicv3_poke_irq(irqd, GICD_ICENABLER);
}
-static void gicv3_eoi_irq(struct irq_desc *irqd)
+void gicv3_eoi_irq(struct irq_desc *irqd)
{
/* Lower the priority */
WRITE_SYSREG32(irqd->irq, ICC_EOIR1_EL1);
diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h
index 2c322da..1bc88f6 100644
--- a/xen/include/asm-arm/gic_v3_defs.h
+++ b/xen/include/asm-arm/gic_v3_defs.h
@@ -199,6 +199,8 @@ struct rdist_prop {
DECLARE_PER_CPU(struct rdist, rdist);
+void gicv3_eoi_irq(struct irq_desc *irqd);
+
#endif /* __ASM_ARM_GIC_V3_DEFS_H__ */
/*
--
1.7.9.5
next prev parent reply other threads:[~2015-09-18 13:08 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 13:08 [PATCH v7 00/28] Add ITS support vijay.kilari
2015-09-18 13:08 ` [PATCH v7 01/28] xen/arm: Add bitmap_find_next_zero_area helper function vijay.kilari
2015-09-18 13:08 ` [PATCH v7 02/28] xen: Add log2 functionality vijay.kilari
2015-09-18 13:08 ` [PATCH v7 03/28] xen/arm: Set nr_cpu_ids to available number of cpus vijay.kilari
2015-09-18 13:08 ` [PATCH v7 04/28] xen/arm: Rename NR_IRQs and vgic_num_irqs helper function vijay.kilari
2015-09-21 10:40 ` Julien Grall
2015-09-18 13:08 ` [PATCH v7 05/28] xen/arm: ITS: Port ITS driver to Xen vijay.kilari
2015-09-21 11:23 ` Julien Grall
2015-09-22 9:55 ` Vijay Kilari
2015-09-22 10:01 ` Julien Grall
2015-09-22 10:34 ` Vijay Kilari
2015-09-22 12:34 ` Julien Grall
2015-09-21 13:08 ` Julien Grall
2015-09-18 13:08 ` [PATCH v7 06/28] xen/arm: ITS: Add helper functions to manage its_devices vijay.kilari
2015-09-18 14:15 ` Julien Grall
2015-09-21 11:26 ` Julien Grall
2015-09-18 13:08 ` [PATCH v7 07/28] xen/arm: ITS: Introduce msi_desc for LPIs vijay.kilari
2015-09-18 13:08 ` [PATCH v7 08/28] xen/arm: ITS: Add APIs to add and assign device vijay.kilari
2015-09-21 13:47 ` Julien Grall
2015-09-22 7:33 ` Vijay Kilari
2015-09-22 13:19 ` Julien Grall
2015-09-18 13:08 ` [PATCH v7 09/28] xen/arm: ITS: Introduce gic_is_lpi helper function vijay.kilari
2015-09-21 14:20 ` Julien Grall
2015-09-22 9:10 ` Vijay Kilari
2015-09-22 13:24 ` Julien Grall
2015-09-18 13:08 ` vijay.kilari [this message]
2015-09-21 14:35 ` [PATCH v7 10/28] xen/arm: ITS: Implement hw_irq_controller for LPIs Julien Grall
2015-09-18 13:08 ` [PATCH v7 11/28] xen/arm: ITS: Enable compilation of physical ITS driver vijay.kilari
2015-09-18 13:08 ` [PATCH v7 12/28] xen/arm: ITS: Plumbing hw_irq_controller for LPIs vijay.kilari
2015-09-21 14:44 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 13/28] xen/arm: Move vgic rank locking inside get_irq_priority vijay.kilari
2015-09-21 14:49 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 14/28] xen/arm: ITS: Initialize physical ITS and export lpi support vijay.kilari
2015-09-21 15:20 ` Julien Grall
2015-09-22 9:17 ` Vijay Kilari
2015-09-22 9:45 ` Julien Grall
2015-09-22 10:05 ` Ian Campbell
2015-09-22 10:29 ` Julien Grall
2015-09-22 10:44 ` Ian Campbell
2015-09-22 12:31 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 15/28] xen/arm: ITS: Add virtual ITS driver vijay.kilari
2015-09-21 15:34 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 16/28] xen/arm: ITS: Add virtual ITS commands support vijay.kilari
2015-09-22 13:47 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 17/28] xen/arm: ITS: Add GITS registers emulation vijay.kilari
2015-09-22 14:30 ` Julien Grall
2015-09-24 5:07 ` Vijay Kilari
2015-09-24 11:05 ` Julien Grall
2015-09-24 11:29 ` Ian Campbell
2015-09-24 11:43 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 18/28] xen/arm: ITS: Export ITS info to Virtual ITS vijay.kilari
2015-09-23 8:31 ` Julien Grall
2015-09-24 5:26 ` Vijay Kilari
2015-09-24 8:27 ` Ian Campbell
2015-09-24 11:31 ` Julien Grall
2015-09-24 11:41 ` Ian Campbell
2015-09-18 13:09 ` [PATCH v7 19/28] xen/arm: ITS: Store LPIs allocated per domain vijay.kilari
2015-09-23 8:37 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 20/28] xen/arm: ITS: Add virtual ITS availability check helper vijay.kilari
2015-09-23 8:52 ` Julien Grall
2015-09-24 6:44 ` Vijay Kilari
2015-09-24 11:47 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 21/28] xen/arm: ITS: Add GICR register emulation vijay.kilari
2015-09-23 10:22 ` Julien Grall
2015-09-26 16:08 ` Vijay Kilari
2015-09-28 9:53 ` Ian Campbell
2015-09-28 10:37 ` Vijay Kilari
2015-09-28 11:03 ` Julien Grall
2015-09-29 9:35 ` Vijay Kilari
2015-09-18 13:09 ` [PATCH v7 22/28] xen/arm: ITS: Allocate irq descriptors for LPIs vijay.kilari
2015-09-23 10:28 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 23/28] xen/arm: ITS: Allocate pending_lpi " vijay.kilari
2015-09-24 12:38 ` Julien Grall
2015-09-18 13:09 ` [PATCH v7 24/28] xen/arm: ITS: Route LPIs vijay.kilari
2015-09-18 13:09 ` [PATCH v7 25/28] xen/arm: ITS: Add domain specific ITS initialization vijay.kilari
2015-09-18 13:09 ` [PATCH v7 26/28] xen/arm: ITS: Map ITS translation space vijay.kilari
2015-09-18 13:09 ` [PATCH v7 27/28] xen/arm: ITS: Generate ITS node for Dom0 vijay.kilari
2015-09-18 13:09 ` [PATCH v7 28/28] xen/arm: ITS: Add pci devices in ThunderX vijay.kilari
2015-09-22 15:09 ` Julien Grall
2015-09-18 13:51 ` [PATCH v7 00/28] Add ITS support Julien Grall
2015-09-21 6:52 ` Vijay Kilari
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=1442581755-2668-11-git-send-email-vijay.kilari@gmail.com \
--to=vijay.kilari@gmail.com \
--cc=Ian.Campbell@citrix.com \
--cc=Prasun.Kapoor@caviumnetworks.com \
--cc=Vijaya.Kumar@caviumnetworks.com \
--cc=julien.grall@citrix.com \
--cc=manish.jaggi@caviumnetworks.com \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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).