From: Julien Grall <julien.grall@linaro.org>
To: Andre Przywara <andre.przywara@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH 12/12] ARM: VGIC: rework gicv[23]_update_lr to not use pending_irq
Date: Thu, 26 Oct 2017 09:28:54 +0100 [thread overview]
Message-ID: <59e60ae6-cf4d-edb5-afda-a754a6d38a22@linaro.org> (raw)
In-Reply-To: <20171019124847.5978-13-andre.przywara@arm.com>
Hi Andre,
On 10/19/2017 01:48 PM, Andre Przywara wrote:
> The functions to actually populate a list register were accessing
> the VGIC internal pending_irq struct, although they should be abstracting
> from that.
> Break the needed information down to remove the reference to pending_irq
> from gic-v[23].c.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> xen/arch/arm/gic-v2.c | 14 +++++++-------
> xen/arch/arm/gic-v3.c | 12 ++++++------
> xen/arch/arm/gic-vgic.c | 3 ++-
> xen/include/asm-arm/gic.h | 4 ++--
> 4 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
> index 511c8d7294..e5acff8900 100644
> --- a/xen/arch/arm/gic-v2.c
> +++ b/xen/arch/arm/gic-v2.c
> @@ -428,8 +428,8 @@ static void gicv2_disable_interface(void)
> spin_unlock(&gicv2.lock);
> }
>
> -static void gicv2_update_lr(int lr, const struct pending_irq *p,
> - unsigned int state)
> +static void gicv2_update_lr(int lr, unsigned int virq, uint8_t priority,
> + unsigned int hw_irq, unsigned int state)
> {
> uint32_t lr_reg;
>
> @@ -437,12 +437,12 @@ static void gicv2_update_lr(int lr, const struct pending_irq *p,
> BUG_ON(lr < 0);
>
> lr_reg = (((state & GICH_V2_LR_STATE_MASK) << GICH_V2_LR_STATE_SHIFT) |
> - ((GIC_PRI_TO_GUEST(p->priority) & GICH_V2_LR_PRIORITY_MASK)
> - << GICH_V2_LR_PRIORITY_SHIFT) |
> - ((p->irq & GICH_V2_LR_VIRTUAL_MASK) << GICH_V2_LR_VIRTUAL_SHIFT));
> + ((GIC_PRI_TO_GUEST(priority) & GICH_V2_LR_PRIORITY_MASK)
> + << GICH_V2_LR_PRIORITY_SHIFT) |
> + ((virq & GICH_V2_LR_VIRTUAL_MASK) << GICH_V2_LR_VIRTUAL_SHIFT));
>
> - if ( p->desc != NULL )
> - lr_reg |= GICH_V2_LR_HW | ((p->desc->irq & GICH_V2_LR_PHYSICAL_MASK )
> + if ( hw_irq != -1 )
> + lr_reg |= GICH_V2_LR_HW | ((hw_irq & GICH_V2_LR_PHYSICAL_MASK )
> << GICH_V2_LR_PHYSICAL_SHIFT);
>
> writel_gich(lr_reg, GICH_LR + lr * 4);
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 74d00e0c54..3dec407a02 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -944,8 +944,8 @@ static void gicv3_disable_interface(void)
> spin_unlock(&gicv3.lock);
> }
>
> -static void gicv3_update_lr(int lr, const struct pending_irq *p,
> - unsigned int state)
> +static void gicv3_update_lr(int lr, unsigned int virq, uint8_t priority,
> + unsigned int hw_irq, unsigned int state)
> {
> uint64_t val = 0;
>
> @@ -961,11 +961,11 @@ static void gicv3_update_lr(int lr, const struct pending_irq *p,
> if ( current->domain->arch.vgic.version == GIC_V3 )
> val |= GICH_LR_GRP1;
>
> - val |= ((uint64_t)p->priority & 0xff) << GICH_LR_PRIORITY_SHIFT;
> - val |= ((uint64_t)p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT;
> + val |= (uint64_t)priority << GICH_LR_PRIORITY_SHIFT;
> + val |= ((uint64_t)virq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT;
>
> - if ( p->desc != NULL )
> - val |= GICH_LR_HW | (((uint64_t)p->desc->irq & GICH_LR_PHYSICAL_MASK)
> + if ( hw_irq != -1 )
hw_irq is unsigned to technically it should be ~0. Also, I would prefer
if you introduce a define making clear where the -1 comes from.
Lastly, I guess IRQ ~0 will never exist?
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-10-26 8:29 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 12:48 [PATCH 00/12] ARM: VGIC/GIC separation cleanups Andre Przywara
2017-10-19 12:48 ` [PATCH 01/12] ARM: remove unneeded gic.h inclusions Andre Przywara
2017-10-25 23:55 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 02/12] ARM: vGIC: fix nr_irq definition Andre Przywara
2017-10-26 0:00 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 03/12] ARM: VGIC: remove gic_clear_pending_irqs() Andre Przywara
2017-10-26 0:14 ` Stefano Stabellini
2017-11-10 16:42 ` Andre Przywara
2017-11-16 1:17 ` Stefano Stabellini
2017-11-16 14:32 ` Julien Grall
2017-12-06 18:01 ` Andre Przywara
2017-10-19 12:48 ` [PATCH 04/12] ARM: VGIC: move gic_remove_irq_from_queues() Andre Przywara
2017-10-26 0:19 ` Stefano Stabellini
2017-10-26 8:22 ` Julien Grall
2017-11-10 17:14 ` Andre Przywara
2017-11-10 19:04 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 05/12] ARM: VGIC: move gic_remove_from_lr_pending() Andre Przywara
2017-10-26 0:20 ` Stefano Stabellini
2017-12-06 18:02 ` Andre Przywara
2017-10-19 12:48 ` [PATCH 06/12] ARM: VGIC: streamline gic_restore_pending_irqs() Andre Przywara
2017-10-19 12:48 ` [PATCH 07/12] ARM: VGIC: split gic.c to observe hardware/virtual GIC separation Andre Przywara
2017-10-26 0:37 ` Stefano Stabellini
2017-12-06 18:04 ` Andre Przywara
2017-10-19 12:48 ` [PATCH 08/12] ARM: VGIC: split up gic_dump_info() to cover virtual part separately Andre Przywara
2017-10-26 0:41 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 09/12] ARM: VGIC: rework events_need_delivery() Andre Przywara
2017-10-26 0:47 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 10/12] ARM: VGIC: factor out vgic_connect_hw_irq() Andre Przywara
2017-10-26 0:49 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 11/12] ARM: VGIC: factor out vgic_get_hw_irq_desc() Andre Przywara
2017-10-26 0:50 ` Stefano Stabellini
2017-10-19 12:48 ` [PATCH 12/12] ARM: VGIC: rework gicv[23]_update_lr to not use pending_irq Andre Przywara
2017-10-26 0:51 ` Stefano Stabellini
2017-10-26 8:28 ` Julien Grall [this message]
2017-12-07 18:33 ` Andre Przywara
2017-10-19 15:37 ` [PATCH 00/12] ARM: VGIC/GIC separation cleanups Andre Przywara
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=59e60ae6-cf4d-edb5-afda-a754a6d38a22@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).