From: Ian Campbell <ian.campbell@citrix.com>
To: vijay.kilari@gmail.com
Cc: stefano.stabellini@eu.citrix.com,
Prasun.Kapoor@caviumnetworks.com,
vijaya.kumar@caviumnetworks.com, tim@xen.org,
xen-devel@lists.xen.org, julien.grall@citrix.com,
stefano.stabellini@citrix.com, manish.jaggi@caviumnetworks.com
Subject: Re: [PATCH v4 05/17] xen/arm: ITS: implement hw_irq_controller for LPIs
Date: Fri, 10 Jul 2015 14:46:38 +0100 [thread overview]
Message-ID: <1436535998.10074.29.camel@citrix.com> (raw)
In-Reply-To: <1436514172-3263-6-git-send-email-vijay.kilari@gmail.com>
On Fri, 2015-07-10 at 13:12 +0530, vijay.kilari@gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>
> Implements hw_irq_controller api's required
> to handle LPI's
>
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
> ---
> 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 | 132 +++++++++++++++++++++++++++++++++++++
> xen/arch/arm/gic-v3.c | 5 +-
> xen/arch/arm/gic.c | 32 +++++++--
> xen/arch/arm/irq.c | 40 ++++++++++-
> xen/include/asm-arm/gic-its.h | 4 ++
> xen/include/asm-arm/gic.h | 13 ++++
> xen/include/asm-arm/gic_v3_defs.h | 1 +
> xen/include/asm-arm/irq.h | 8 ++-
> 8 files changed, 227 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index b421a6f..b98d396 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -295,6 +295,19 @@ post:
> its_wait_for_range_completion(its, cmd, next_cmd);
> }
>
> +static void its_send_inv(struct its_device *dev, struct its_collection *col,
> + u32 event_id)
> +{
> + its_cmd_block cmd;
> +
> + memset(&cmd, 0x0, sizeof(its_cmd_block));
> + cmd.inv.cmd = GITS_CMD_INV;
> + cmd.inv.devid = dev->device_id;
> + cmd.inv.event = event_id;
> +
> + its_send_single_command(dev->its, &cmd, col);
> +}
This ought to be in the prior patch doing such things I think.
Oh I see, you didn't have struct its_device defined back then. I think
you can just reorder patches #3 and #4 to solve that.
> +static void its_host_irq_end(struct irq_desc *desc)
> +{
> + /* Lower the priority */
> + gicv3_eoi_irq(desc);
> + /* Deactivate */
> + gicv3_dir_irq(desc);
> +}
> +
> +static void its_guest_irq_end(struct irq_desc *desc)
> +{
> + gicv3_eoi_irq(desc);
> +}
Exposing those two gicv3 functions is a bit unfortunate, but I think it
will do for now.
Exposing gicv3_[host|guest]_irq_end might have been nicer, since you
could just insert them into your its_[host|guest]_lpi_type instead of
duplicating them.
Eventually we may want to refactor such that register_its_ops gives back
the ack/eoi hooks to use.
> +static void its_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
> +{
Please add
/* Not yet supported */
> @@ -104,7 +126,8 @@ static void gic_set_irq_properties(struct irq_desc *desc,
> const cpumask_t *cpu_mask,
> unsigned int priority)
> {
> - gic_hw_ops->set_irq_properties(desc, cpu_mask, priority);
> + if ( desc->irq < gic_number_lines() )
Should this be is_lpi as in other similar places?
> + gic_hw_ops->set_irq_properties(desc, cpu_mask, priority);
> }
>
> /* Program the GIC to route an interrupt to the host (i.e. Xen)
> @@ -114,11 +137,12 @@ void gic_route_irq_to_xen(struct irq_desc *desc, const cpumask_t *cpu_mask,
> unsigned int priority)
> {
> ASSERT(priority <= 0xff); /* Only 8 bits of priority */
> - ASSERT(desc->irq < gic_number_lines());/* Can't route interrupts that don't exist */
> + /* Can't route interrupts that don't exist */
> + ASSERT(desc->irq < gic_number_lines() || is_lpi(desc->irq));
As discussed in <1436284206.25646.258.camel@citrix.com> please make some
sort of is_valid_irq(irq) helper to encapsulate this logic.
> ocessor), priority);
> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
> index 2dd43ee..ba8528a 100644
> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -35,7 +35,13 @@ static DEFINE_SPINLOCK(local_irqs_type_lock);
> struct irq_guest
> {
> struct domain *d;
> - unsigned int virq;
> + union
> + {
> + /* virq refer to virtual irq in case of spi */
> + unsigned int virq;
> + /* virq refer to event ID in case of lpi */
"refers" in both cases
And I'd say "to the ..." not just "to ..." and "in the case of..." too.
> +unsigned int irq_to_vid(struct irq_desc *desc)
> +{
> + return irq_get_guest_info(desc)->vid;
> +}
> +
> +unsigned int irq_to_virq(struct irq_desc *desc)
> +{
> + return irq_get_guest_info(desc)->virq;
> +}
Please assert that irq_desc->arch.its_device is (non-)NULL as
appropriate in these two cases.
BTW, while checking the field name I spotted "struct msi_desc
*msi_desc" in the main struct irq_desc.
Since MSIs are effectively the same as LPIs as a future cleanup I think
we should s/its_device/msi_desc/g and use this field instead of adding a
second redundant type and pointer to it. THis is not a blocker for 4.6
though.
> +struct its_device *get_irq_device(struct irq_desc *desc)
> +{
> + ASSERT(spin_is_locked(&desc->lock));
> +
> + return desc->arch.dev;
> +}
> +
> +void set_irq_device(struct irq_desc *desc, struct its_device *dev)
> +{
> + ASSERT(spin_is_locked(&desc->lock));
> + desc->arch.dev = dev;
> +}
Please add _its to the names of both of these functions, ie..g
set_irq_its_device.
> diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h
> index b5e09bd..e8d244f 100644
> --- a/xen/include/asm-arm/gic-its.h
> +++ b/xen/include/asm-arm/gic-its.h
> @@ -161,6 +161,10 @@ typedef union {
> * The ITS view of a device.
> */
> struct its_device {
> + /* Physical ITS */
> + struct its_node *its;
> + /* Number of Physical LPIs assigned */
> + int nr_lpis;
> /* Physical Device id */
> u32 device_id;
> /* RB-tree entry */
> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
> index e9d5f36..44c2317 100644
> --- a/xen/include/asm-arm/gic.h
> +++ b/xen/include/asm-arm/gic.h
> @@ -20,6 +20,9 @@
>
> #define NR_GIC_LOCAL_IRQS NR_LOCAL_IRQS
> #define NR_GIC_SGI 16
> +#define FIRST_GIC_LPI 8192
> +#define NR_GIC_LPI 4096
> +#define MAX_LPI (FIRST_GIC_LPI + NR_GIC_LPI)
MAX_LPI and NR_GIC_LPI should be obtained from the hardware at init time
and put somewhere, like a global nr_lpis perhaps, to be used throughout.
> diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h
> index 051a95e..0443ae7 100644
> --- a/xen/include/asm-arm/gic_v3_defs.h
> +++ b/xen/include/asm-arm/gic_v3_defs.h
> @@ -169,6 +169,7 @@
> #define ICH_SGI_IRQ_MASK 0xf
> #define ICH_SGI_TARGETLIST_MASK 0xffff
> #define LPI_PROP_GROUP1 (1 << 1)
> +#define LPI_PROP_ENABLED (1 << 0)
Please order (1 << X) by the X.
> diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
> index 34b492b..55e219f 100644
> --- a/xen/include/asm-arm/irq.h
> +++ b/xen/include/asm-arm/irq.h
> @@ -17,6 +17,8 @@ struct arch_pirq
> struct arch_irq_desc {
> int eoi_cpu;
> unsigned int type;
> + struct its_device *dev;
> + u16 col_id;
There are probably opportunities to make eoi_cpu or type smaller so as
to allow col_id to be added without increasing the size of the struct.
Not a blocker for 4.6 though.
Ian.
next prev parent reply other threads:[~2015-07-10 13:46 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 7:42 [PATCH v4 00/17] Add ITS support vijay.kilari
2015-07-10 7:42 ` [PATCH v4 01/17] xen/arm: Add bitmap_find_next_zero_area helper function vijay.kilari
2015-07-10 9:01 ` Jan Beulich
2015-07-10 9:28 ` Vijay Kilari
2015-07-10 9:30 ` Vijay Kilari
2015-07-10 9:45 ` Vijay Kilari
2015-07-10 10:07 ` Jan Beulich
2015-07-10 7:42 ` [PATCH v4 02/17] xen: Add log2 functionality vijay.kilari
2015-07-10 7:42 ` [PATCH v4 03/17] xen/arm: ITS: Port ITS driver to Xen vijay.kilari
2015-07-10 13:01 ` Ian Campbell
2015-07-15 10:23 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 04/17] xen/arm: ITS: Add helper functions to manage its_devices vijay.kilari
2015-07-10 13:05 ` Ian Campbell
2015-07-15 10:37 ` Julien Grall
2015-07-15 14:21 ` Vijay Kilari
2015-07-15 14:28 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 05/17] xen/arm: ITS: implement hw_irq_controller for LPIs vijay.kilari
2015-07-10 13:46 ` Ian Campbell [this message]
2015-07-11 14:40 ` Vijay Kilari
2015-07-11 18:08 ` Julien Grall
2015-07-13 9:17 ` Ian Campbell
2015-07-13 21:18 ` Julien Grall
2015-07-15 7:16 ` Vijay Kilari
2015-07-15 8:26 ` Julien Grall
2015-07-15 9:32 ` Ian Campbell
2015-07-15 9:49 ` Julien Grall
2015-07-15 10:01 ` Ian Campbell
2015-07-15 14:15 ` Vijay Kilari
2015-07-15 14:22 ` Julien Grall
2015-07-15 14:28 ` Ian Campbell
2015-07-15 17:01 ` Vijay Kilari
2015-07-16 14:49 ` Ian Campbell
2015-07-16 15:21 ` Marc Zyngier
2015-07-16 16:18 ` Ian Campbell
2015-07-16 16:27 ` Marc Zyngier
2015-07-16 16:37 ` Ian Campbell
2015-07-18 10:13 ` Julien Grall
2015-07-20 11:52 ` Ian Campbell
2015-07-20 12:22 ` Ian Campbell
2015-07-15 18:19 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 06/17] xen/arm: ITS: Add virtual ITS driver vijay.kilari
2015-07-10 13:54 ` Ian Campbell
2015-07-11 14:48 ` Vijay Kilari
2015-07-13 9:27 ` Ian Campbell
2015-07-10 14:15 ` Ian Campbell
2015-07-11 14:48 ` Vijay Kilari
2015-07-13 9:25 ` Ian Campbell
2015-07-15 12:17 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 07/17] xen/arm: ITS: Add virtual ITS commands support vijay.kilari
2015-07-10 14:35 ` Ian Campbell
2015-07-11 14:49 ` Vijay Kilari
2015-07-13 9:22 ` Ian Campbell
2015-07-13 11:15 ` Vijay Kilari
2015-07-13 11:37 ` Ian Campbell
2015-07-17 15:01 ` Vijay Kilari
2015-07-15 13:02 ` Julien Grall
2015-07-15 13:56 ` Ian Campbell
2015-07-15 12:57 ` Julien Grall
2015-07-17 14:12 ` Vijay Kilari
2015-07-17 15:15 ` Julien Grall
2015-07-17 15:34 ` Ian Campbell
2015-07-17 15:44 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 08/17] xen/arm: ITS: Add APIs to add and assign device vijay.kilari
2015-07-10 14:52 ` Ian Campbell
2015-07-15 13:14 ` Julien Grall
2015-07-16 13:40 ` Vijay Kilari
2015-07-16 14:38 ` Julien Grall
2015-07-15 14:15 ` Julien Grall
2015-07-18 9:44 ` Vijay Kilari
2015-07-18 10:06 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 09/17] xen/arm: ITS: Add GITS registers emulation vijay.kilari
2015-07-10 14:56 ` Ian Campbell
2015-07-15 16:13 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 10/17] xen/arm: ITS: Enable physical and virtual ITS driver compilation vijay.kilari
2015-07-15 16:16 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 11/17] xen/arm: ITS: Add GICR register emulation vijay.kilari
2015-07-10 15:10 ` Ian Campbell
2015-07-11 18:25 ` Julien Grall
2015-07-13 9:28 ` Ian Campbell
2015-07-13 9:53 ` Ian Campbell
2015-07-13 16:53 ` Stefano Stabellini
2015-07-15 17:32 ` Julien Grall
2015-07-16 14:15 ` Vijay Kilari
2015-07-16 14:41 ` Julien Grall
2015-07-16 14:46 ` Vijay Kilari
2015-07-16 14:58 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 12/17] xen/arm: ITS: Initialize LPI irq descriptors and route vijay.kilari
2015-07-10 15:30 ` Ian Campbell
2015-07-20 13:07 ` Vijay Kilari
2015-07-20 13:25 ` Julien Grall
2015-07-22 13:31 ` Vijay Kilari
2015-07-22 13:39 ` Julien Grall
2015-07-22 14:17 ` Julien Grall
2015-07-13 17:03 ` Stefano Stabellini
2015-07-13 17:13 ` Stefano Stabellini
2015-07-13 17:36 ` Julien Grall
2015-07-15 18:13 ` Julien Grall
2015-07-16 8:06 ` Julien Grall
2015-07-16 8:37 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 13/17] xen/arm: ITS: Initialize physical ITS vijay.kilari
2015-07-13 17:06 ` Stefano Stabellini
2015-07-10 7:42 ` [PATCH v4 14/17] xen/arm: ITS: Add domain specific ITS initialization vijay.kilari
2015-07-10 15:41 ` Ian Campbell
2015-07-15 17:41 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 15/17] xen/arm: ITS: Map ITS translation space vijay.kilari
2015-07-10 15:43 ` Ian Campbell
2015-07-15 9:01 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 16/17] xen/arm: ITS: Generate ITS node for Dom0 vijay.kilari
2015-07-13 16:32 ` Stefano Stabellini
2015-07-13 17:31 ` Julien Grall
2015-07-13 17:36 ` Stefano Stabellini
2015-07-10 7:42 ` [PATCH v4 17/17] xen/arm: ITS: Add pci devices in ThunderX vijay.kilari
2015-07-10 15:45 ` Ian Campbell
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=1436535998.10074.29.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Prasun.Kapoor@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=vijay.kilari@gmail.com \
--cc=vijaya.kumar@caviumnetworks.com \
--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).