[PATCH v2 0/4] xen/arm: gicv3: defer host LPI init and split ITS/LPI quirk scopes

Mykola Kvach posted 4 patches 2 days, 10 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/cover.1779922874.git.mykola._5Fkvach@epam.com
xen/arch/arm/gic-v3-its.c             | 171 ++++++++++++++++----------
xen/arch/arm/gic-v3-lpi.c             |  66 ++++++++--
xen/arch/arm/gic-v3.c                 |  14 ++-
xen/arch/arm/include/asm/gic_v3_its.h |  19 ++-
4 files changed, 190 insertions(+), 80 deletions(-)
[PATCH v2 0/4] xen/arm: gicv3: defer host LPI init and split ITS/LPI quirk scopes
Posted by Mykola Kvach 2 days, 10 hours ago
From: Mykola Kvach <mykola_kvach@epam.com>

Hi all,

This series fixes the ordering of host LPI state initialization relative to
ITS quirk discovery, and then cleans up how ITS-private and host
LPI/Redistributor quirk effects are represented.

Patch 1 is the release-critical fix. It moves host LPI initialization after
gicv3_its_init(), so that the host LPI allocation path observes the ITS
quirks discovered during ITS initialization. This patch is intended for
4.22.

Patches 2-4 are follow-up cleanup and DT attribute handling. They are included
to show the intended direction and to avoid carrying the old global ITS quirk
model forward, but they are not required for taking the 4.22 fix if the
release freeze makes that preferable.

The main change from v1 is that this version no longer tries to pre-initialize
ITS quirks before host LPI setup. Instead, the minimal fix is to defer the
existing host LPI initialization until after ITS initialization. The follow-up
patches then split the quirk state by scope:

  * per-ITS flags are used for memory/state accessed by a particular ITS, such
    as GITS_CBASER, GITS_BASER<n> and ITT memory;

  * host LPI flags are used for shared Redistributor/LPI state, such as
    GICR_PROPBASER and GICR_PENDBASER.

This avoids relying on an implicit global aggregation of per-ITS quirk state.
If an ITS-discovered quirk also affects the host LPI/Redistributor path, that
effect is now expressed explicitly through the quirk entry's lpi_flags.

The series also handles the DT dma-noncoherent property according to the node
where it appears. An ITS subnode property affects only the corresponding ITS.
A top-level GIC node property affects only the host LPI/Redistributor policy.
The property is not inherited implicitly between the parent GIC node and ITS
subnodes.

The Orange Pi 5 / RK3588-specific quirk patch from v1 has been dropped. The
previous version modelled the issue as a 32-bit ITS addressing restriction.
This version handles the relevant non-coherent/non-shareable GIC integration
through the standard DT dma-noncoherent property on the GIC and ITS nodes
instead.
---

Changes since v1

* Reordered the series so that the minimal host LPI initialization ordering fix
  is first. Patch 1 is intended for 4.22.

* Dropped the v1 ITS pre-initialization hook.

* Moved the existing gicv3_lpi_init_host_lpis() call after gicv3_its_init()
  instead, so host LPI state is allocated after ITS workaround discovery.

* Checked the return value from gicv3_lpi_init_host_lpis() and made failure
  fatal once the ITS/LPI path is enabled.

* Replaced the old single global ITS quirk state with separate per-ITS and
  host LPI quirk scopes.

* Removed the implicit aggregation of all per-ITS quirks into the host LPI
  policy. Host LPI effects are now expressed explicitly with lpi_flags.

* Kept per-ITS flags for ITS-private allocations:
  - GITS_CBASER;
  - GITS_BASER<n>;
  - ITT memory.

* Kept host LPI flags for Redistributor/LPI state:
  - GICR_PROPBASER;
  - GICR_PENDBASER.

* Refactored ITS quirk matching from fixed IIDR/mask fields to a generic
  match(hw_its, data) callback plus opaque data.

* Kept first-match semantics explicit. More specific entries must be listed
  before broader IIDR-only entries.

* Added a reusable IIDR matcher and used it after checking the Renesas
  machine compatibles for the R-Car Gen4 quirk.

* Split dma-noncoherent handling by DT node scope:
  - ITS subnode dma-noncoherent affects only the matching ITS;
  - top-level GIC dma-noncoherent affects only the host LPI/Redistributor
    policy.

* Dropped the Orange Pi 5 / RK3588-specific quirk patch from v1. The
  non-coherent GIC integration is now handled through DT dma-noncoherent
  properties instead of a Xen-side platform quirk.

Mykola Kvach (4):
  xen/arm: gic: defer host LPI allocation until after ITS init
  xen/arm: its: separate ITS and host LPI quirk scopes
  xen/arm: its: refactor ITS quirk matching
  xen/arm: its: handle dma-noncoherent on GIC and ITS nodes

 xen/arch/arm/gic-v3-its.c             | 171 ++++++++++++++++----------
 xen/arch/arm/gic-v3-lpi.c             |  66 ++++++++--
 xen/arch/arm/gic-v3.c                 |  14 ++-
 xen/arch/arm/include/asm/gic_v3_its.h |  19 ++-
 4 files changed, 190 insertions(+), 80 deletions(-)

-- 
2.43.0
Re: [PATCH v2 0/4] xen/arm: gicv3: defer host LPI init and split ITS/LPI quirk scopes
Posted by Mykola Kvach 2 days, 9 hours ago
Hi all,

I forgot to include the v1 link in the cover letter.
For reference, v1 of this series is available here:
    https://patchew.org/Xen/cover.1774431310.git.mykola._5Fkvach@epam.com/

This v2 is the next revision of that series. Since the patch order and
subjects changed, some tooling may not associate the two automatically.

Thanks,
Mykola


On Thu, May 28, 2026 at 3:28 AM Mykola Kvach <xakep.amatop@gmail.com> wrote:
>
> From: Mykola Kvach <mykola_kvach@epam.com>
>
> Hi all,
>
> This series fixes the ordering of host LPI state initialization relative to
> ITS quirk discovery, and then cleans up how ITS-private and host
> LPI/Redistributor quirk effects are represented.
>
> Patch 1 is the release-critical fix. It moves host LPI initialization after
> gicv3_its_init(), so that the host LPI allocation path observes the ITS
> quirks discovered during ITS initialization. This patch is intended for
> 4.22.
>
> Patches 2-4 are follow-up cleanup and DT attribute handling. They are included
> to show the intended direction and to avoid carrying the old global ITS quirk
> model forward, but they are not required for taking the 4.22 fix if the
> release freeze makes that preferable.
>
> The main change from v1 is that this version no longer tries to pre-initialize
> ITS quirks before host LPI setup. Instead, the minimal fix is to defer the
> existing host LPI initialization until after ITS initialization. The follow-up
> patches then split the quirk state by scope:
>
>   * per-ITS flags are used for memory/state accessed by a particular ITS, such
>     as GITS_CBASER, GITS_BASER<n> and ITT memory;
>
>   * host LPI flags are used for shared Redistributor/LPI state, such as
>     GICR_PROPBASER and GICR_PENDBASER.
>
> This avoids relying on an implicit global aggregation of per-ITS quirk state.
> If an ITS-discovered quirk also affects the host LPI/Redistributor path, that
> effect is now expressed explicitly through the quirk entry's lpi_flags.
>
> The series also handles the DT dma-noncoherent property according to the node
> where it appears. An ITS subnode property affects only the corresponding ITS.
> A top-level GIC node property affects only the host LPI/Redistributor policy.
> The property is not inherited implicitly between the parent GIC node and ITS
> subnodes.
>
> The Orange Pi 5 / RK3588-specific quirk patch from v1 has been dropped. The
> previous version modelled the issue as a 32-bit ITS addressing restriction.
> This version handles the relevant non-coherent/non-shareable GIC integration
> through the standard DT dma-noncoherent property on the GIC and ITS nodes
> instead.
> ---
>
> Changes since v1
>
> * Reordered the series so that the minimal host LPI initialization ordering fix
>   is first. Patch 1 is intended for 4.22.
>
> * Dropped the v1 ITS pre-initialization hook.
>
> * Moved the existing gicv3_lpi_init_host_lpis() call after gicv3_its_init()
>   instead, so host LPI state is allocated after ITS workaround discovery.
>
> * Checked the return value from gicv3_lpi_init_host_lpis() and made failure
>   fatal once the ITS/LPI path is enabled.
>
> * Replaced the old single global ITS quirk state with separate per-ITS and
>   host LPI quirk scopes.
>
> * Removed the implicit aggregation of all per-ITS quirks into the host LPI
>   policy. Host LPI effects are now expressed explicitly with lpi_flags.
>
> * Kept per-ITS flags for ITS-private allocations:
>   - GITS_CBASER;
>   - GITS_BASER<n>;
>   - ITT memory.
>
> * Kept host LPI flags for Redistributor/LPI state:
>   - GICR_PROPBASER;
>   - GICR_PENDBASER.
>
> * Refactored ITS quirk matching from fixed IIDR/mask fields to a generic
>   match(hw_its, data) callback plus opaque data.
>
> * Kept first-match semantics explicit. More specific entries must be listed
>   before broader IIDR-only entries.
>
> * Added a reusable IIDR matcher and used it after checking the Renesas
>   machine compatibles for the R-Car Gen4 quirk.
>
> * Split dma-noncoherent handling by DT node scope:
>   - ITS subnode dma-noncoherent affects only the matching ITS;
>   - top-level GIC dma-noncoherent affects only the host LPI/Redistributor
>     policy.
>
> * Dropped the Orange Pi 5 / RK3588-specific quirk patch from v1. The
>   non-coherent GIC integration is now handled through DT dma-noncoherent
>   properties instead of a Xen-side platform quirk.
>
> Mykola Kvach (4):
>   xen/arm: gic: defer host LPI allocation until after ITS init
>   xen/arm: its: separate ITS and host LPI quirk scopes
>   xen/arm: its: refactor ITS quirk matching
>   xen/arm: its: handle dma-noncoherent on GIC and ITS nodes
>
>  xen/arch/arm/gic-v3-its.c             | 171 ++++++++++++++++----------
>  xen/arch/arm/gic-v3-lpi.c             |  66 ++++++++--
>  xen/arch/arm/gic-v3.c                 |  14 ++-
>  xen/arch/arm/include/asm/gic_v3_its.h |  19 ++-
>  4 files changed, 190 insertions(+), 80 deletions(-)
>
> --
> 2.43.0
>