From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Mykola Kvach <Mykola_Kvach@epam.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>
Subject: Re: [PATCH v3 1/4] xen/arm: its: initialize host LPI state before activating ITSes
Date: Tue, 22 Sep 2026 23:56:22 +0000 [thread overview]
Message-ID: <8733v06dsq.fsf@epam.com> (raw)
In-Reply-To: <e93b497d55dbfeb2aaaa9ff4b55b8925f902d395.1790089161.git.mykola_kvach@epam.com> (Mykola Kvach's message of "Tue, 22 Sep 2026 18:58:39 +0300")
Hi Mykola,
Mykola Kvach <mykola_kvach@epam.com> writes:
> The boot CPU pending table must use the memory attributes selected by
> ITS quirks. gicv3_lpi_init_host_lpis() is therefore called after
> gicv3_its_init(). However, gicv3_its_init() also programs and enables
> each ITS before host LPI state is allocated. No ITS commands are
> submitted at that point, but this ordering relies on that implementation
> detail.
>
> Split per-ITS initialization into preparation and activation phases.
> First map and disable every ITS and collect its quirks. Then initialize
> host LPI state. Only after that, allocate and program the ITS tables and
> command queue, and enable each ITS.
>
> The subsequent gicv3_cpu_init() sequence remains unchanged: it programs
> the Redistributor LPI tables, enables LPIs, and then submits the first
> MAPC and SYNC commands.
>
> Suggested-by: Julien Grall <julien@xen.org>
> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
> ---
> Changes in v3:
> - New patch implementing the post-4.22 initialization order discussed
> during review of the ordering fix.
>
> Link: https://patchew.org/Xen/341edd8de63dcd84ccc6e7b6c03e9e8fc7105184.1781847061.git.mykola._5Fkvach@epam.com/
> ---
> xen/arch/arm/gic-v3-its.c | 32 ++++++++++++++++++++++-----
> xen/arch/arm/gic-v3.c | 15 ++-----------
> xen/arch/arm/include/asm/gic_v3_its.h | 4 ++--
> 3 files changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 325835b0ad..972825bf06 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -11,6 +11,7 @@
> #include <xen/lib.h>
> #include <xen/delay.h>
> #include <xen/iocap.h>
> +#include <xen/init.h>
> #include <xen/libfdt/libfdt.h>
> #include <xen/mm.h>
> #include <xen/rbtree.h>
> @@ -549,10 +550,9 @@ static int gicv3_disable_its(struct host_its *hw_its)
> return -ETIMEDOUT;
> }
>
> -static int gicv3_its_init_single_its(struct host_its *hw_its)
> +static int __init gicv3_its_prepare_single_its(struct host_its *hw_its)
> {
> - uint64_t reg;
> - int i, ret;
> + int ret;
>
> hw_its->its_base = ioremap_nocache(hw_its->addr, hw_its->size);
> if ( !hw_its->its_base )
> @@ -564,6 +564,14 @@ static int gicv3_its_init_single_its(struct host_its *hw_its)
>
> gicv3_its_enable_quirks(hw_its);
>
> + return 0;
> +}
> +
> +static int __init gicv3_its_init_single_its(struct host_its *hw_its)
> +{
> + uint64_t reg;
> + int i, ret;
> +
> reg = readq_relaxed(hw_its->its_base + GITS_TYPER);
> hw_its->devid_bits = GITS_TYPER_DEVICE_ID_BITS(reg);
> hw_its->evid_bits = GITS_TYPER_EVENT_ID_BITS(reg);
> @@ -1189,7 +1197,7 @@ static void gicv3_its_acpi_init(void)
>
> #endif
>
> -int gicv3_its_init(void)
> +int __init gicv3_its_init(unsigned int host_lpi_bits)
> {
> struct host_its *hw_its;
> int ret;
> @@ -1201,13 +1209,27 @@ int gicv3_its_init(void)
>
> list_for_each_entry(hw_its, &host_its_list, entry)
> {
> - ret = gicv3_its_init_single_its(hw_its);
> + ret = gicv3_its_prepare_single_its(hw_its);
> if ( ret )
> return ret;
> }
>
> gicv3_its_validate_quirks();
>
> + if ( list_empty(&host_its_list) )
> + return 0;
What is the purpose of this check here? I'd expect to see it before the
first list_for_each_entry() loop.
> +
> + ret = gicv3_lpi_init_host_lpis(host_lpi_bits);
> + if ( ret )
> + return ret;
> +
> + list_for_each_entry(hw_its, &host_its_list, entry)
> + {
> + ret = gicv3_its_init_single_its(hw_its);
> + if ( ret )
> + return ret;
> + }
> +
> return 0;
> }
[...]
--
WBR, Volodymyr
next prev parent reply other threads:[~2026-09-22 23:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 15:58 [PATCH v3 0/4] xen/arm: gicv3: defer host LPI init and split ITS/LPI quirk scopes Mykola Kvach
2026-09-22 15:58 ` [PATCH v3 1/4] xen/arm: its: initialize host LPI state before activating ITSes Mykola Kvach
2026-09-22 23:56 ` Volodymyr Babchuk [this message]
2026-09-24 5:00 ` Mykola Kvach
2026-09-25 17:45 ` Volodymyr Babchuk
2026-09-29 17:25 ` Mykola Kvach
2026-09-22 15:58 ` [PATCH v3 2/4] xen/arm: its: separate ITS and host LPI quirk scopes Mykola Kvach
2026-09-23 0:13 ` Volodymyr Babchuk
2026-09-22 15:58 ` [PATCH v3 3/4] xen/arm: its: refactor ITS quirk matching Mykola Kvach
2026-09-23 0:21 ` Volodymyr Babchuk
2026-09-24 5:00 ` Mykola Kvach
2026-09-25 17:40 ` Volodymyr Babchuk
2026-09-22 15:58 ` [PATCH v3 4/4] xen/arm: its: handle dma-noncoherent on GIC and ITS nodes Mykola Kvach
2026-09-23 0:29 ` Volodymyr Babchuk
2026-09-24 6:48 ` Mykola Kvach
2026-09-25 17:46 ` Volodymyr Babchuk
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=8733v06dsq.fsf@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=Mykola_Kvach@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.