From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Zenghui Yu <yuzenghui@huawei.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev,
Jing Zhang <jingzhangos@google.com>
Subject: Re: [PATCH 2/3] irqchip/gic-v3-its: Spin off GICv4 init into a separate function
Date: Sat, 24 Feb 2024 10:30:04 +0000 [thread overview]
Message-ID: <87cysm9mtv.wl-maz@kernel.org> (raw)
In-Reply-To: <20240219185809.286724-3-oliver.upton@linux.dev>
On Mon, 19 Feb 2024 18:58:07 +0000,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> Burying the GICv4 redistributor initialization into the routine for LPIs
> is a bit confusing, and can lead to sillies where unexpected codepaths
> may not fully initialize the RD.
>
> Hoist it out of its_cpu_init_lpis() into a dedicated function.
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
> drivers/irqchip/irq-gic-v3-its.c | 32 +++++++++++++++++++++-----------
> 1 file changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 0022852ce494..63d1743f08cc 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -3173,8 +3173,25 @@ static void its_cpu_init_lpis(void)
> writel_relaxed(val, rbase + GICR_CTLR);
>
> out:
> - if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) {
> + /* Make sure the GIC has seen the above */
> + dsb(sy);
So having hoisted the dsb() here...
> + gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED;
> + pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n",
> + smp_processor_id(),
> + gic_data_rdist()->flags & RD_LOCAL_PENDTABLE_PREALLOCATED ?
> + "reserved" : "allocated",
> + &paddr);
> +}
> +
> +static void its_cpu_init_vlpis(void)
> +{
> + /* No vLPIs? No problem. */
> + if (!gic_rdists->has_vlpis)
> + return;
> +
> + if (!gic_rdists->has_rvpeid) {
> void __iomem *vlpi_base = gic_data_rdist_vlpi_base();
> + u64 val;
>
> /*
> * It's possible for CPU to receive VLPIs before it is
> @@ -3193,7 +3210,8 @@ static void its_cpu_init_lpis(void)
> * ancient programming gets left in and has possibility of
> * corrupting memory.
> */
> - val = its_clear_vpend_valid(vlpi_base, 0, 0);
> + its_clear_vpend_valid(vlpi_base, 0, 0);
> + return;
I'm not sure about the necessity of this return statement.
allocate_vpe_l1_table() checks for rvpeid already, so it should be
fine to carry on.
> }
>
> if (allocate_vpe_l1_table()) {
> @@ -3205,15 +3223,6 @@ static void its_cpu_init_lpis(void)
> gic_rdists->has_rvpeid = false;
> gic_rdists->has_vlpis = false;
> }
> -
> - /* Make sure the GIC has seen the above */
> - dsb(sy);
... we're now missing a dsb affecting the VPE table programming, as we
expect things to take effect immediately.
> - gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED;
> - pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n",
> - smp_processor_id(),
> - gic_data_rdist()->flags & RD_LOCAL_PENDTABLE_PREALLOCATED ?
> - "reserved" : "allocated",
> - &paddr);
> }
>
> static void its_cpu_init_collection(struct its_node *its)
> @@ -5265,6 +5274,7 @@ int its_cpu_init(void)
> return ret;
>
> its_cpu_init_lpis();
> + its_cpu_init_vlpis();
> its_cpu_init_collections();
> }
>
I'm otherwise OK with the idea of splitting things up.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-02-24 10:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 18:58 [PATCH 0/3] irqchip/gic-v3-its: Fix GICv4.1 initialization after kexec Oliver Upton
2024-02-19 18:58 ` [PATCH 1/3] irqchip/gic-v3-its: Do not assume vPE tables are preallocated Oliver Upton
2024-02-19 18:58 ` [PATCH 2/3] irqchip/gic-v3-its: Spin off GICv4 init into a separate function Oliver Upton
2024-02-24 10:30 ` Marc Zyngier [this message]
2024-02-24 11:02 ` Oliver Upton
2024-02-24 11:10 ` Marc Zyngier
2024-02-19 18:58 ` [PATCH 3/3] irqchip/gic-v3-its: Print the vPE table installed in redistributor Oliver Upton
2024-02-24 10:41 ` Marc Zyngier
2024-02-24 11:11 ` Oliver Upton
2024-02-24 11:31 ` Marc Zyngier
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=87cysm9mtv.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=jingzhangos@google.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.upton@linux.dev \
--cc=tglx@linutronix.de \
--cc=yuzenghui@huawei.com \
/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).