All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Leonid Komarianskyi <Leonid_Komarianskyi@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 v2 09/10] xen/arm: domain_build: adjust Dom0 IRQ handling to support eSPIs
Date: Thu, 21 Aug 2025 16:46:47 +0000	[thread overview]
Message-ID: <87o6s8d3m1.fsf@epam.com> (raw)
In-Reply-To: <abba685916e6637eedbd831352bed2e968eeb7dc.1754568795.git.leonid_komarianskyi@epam.com> (Leonid Komarianskyi's message of "Thu, 7 Aug 2025 12:33:34 +0000")




Leonid Komarianskyi <Leonid_Komarianskyi@epam.com> writes:

> The Dom0 configuration logic in create_dom0() has been updated
> to account for extended SPIs when supported by the hardware and
> enabled with CONFIG_GICV3_ESPI. These changes ensure the proper
> calculation of the maximum number of SPIs and eSPIs available for Dom0.
>
> When eSPIs are supported by the hardware and CONFIG_GICV3_ESPI is
> enabled, the maximum number of eSPI interrupts is calculated using
> the ESPI_BASE_INTID offset (4096) and limited at 1024, with 32 IRQs
> subtracted. To ensure compatibility with non-Dom0 domains, this
> adjustment is applied by the toolstack during domain creation, while
> for Dom0 it is handled directly during VGIC initialization. If eSPIs
> are not supported, the calculation defaults to using the standard SPI
> range, with a maximum value of 992 interrupt lines as it works now.
>
> Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
>
> ---
> Changes in V2:
> - no changes
> ---
>  xen/arch/arm/domain_build.c     | 10 ++++++++++
>  xen/arch/arm/include/asm/vgic.h | 11 +++++++++++
>  2 files changed, 21 insertions(+)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index d91a71acfd..fa5abf2dfb 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2055,6 +2055,16 @@ void __init create_dom0(void)
>      /* The vGIC for DOM0 is exactly emulating the hardware GIC */
>      dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
>      dom0_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
> +#ifdef CONFIG_GICV3_ESPI
> +    /*
> +     * Check if the hardware supports extended SPIs (even if the appropriate config is set).
> +     * If not, the common SPI range will be used. Otherwise overwrite the nr_spis with the
> +     * maximum available INTID from eSPI range. In that case, the number of regular SPIs will
> +     * be adjusted to the maximum value during vGIC initialization.
> +     */
> +    if ( gic_number_espis() > 0 )
> +        dom0_cfg.arch.nr_spis = VGIC_DEF_NR_ESPIS;
> +#endif
>      dom0_cfg.arch.tee_type = tee_get_type();
>      dom0_cfg.max_vcpus = dom0_max_vcpus();
>  
> diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
> index 9fa4523018..117b3aa92c 100644
> --- a/xen/arch/arm/include/asm/vgic.h
> +++ b/xen/arch/arm/include/asm/vgic.h
> @@ -353,6 +353,17 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
>  /* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
>  #define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
>  
> +#ifdef CONFIG_GICV3_ESPI
> +/*
> + * Returns the maximum eSPI INTID subtracted by 32. For non-Dom0 domains, the
> + * toolstack applies the same adjustment to cover local IRQs. We will add back
> + * this value during VGIC initialization. This ensures consistent handling for Dom0
> + * and other domains. For the regular SPI range interrupts in this case, the maximum
> + * value of VGIC_DEF_NR_SPIS will be used.
> + */
> +#define VGIC_DEF_NR_ESPIS (ESPI_BASE_INTID + min(gic_number_espis(), 1024U) - 32)
Name of the define is wrong, as it is not number of eSPIs. Actually, this is
maximum SPI (including eSPIs) number.

> +#endif
> +
>  extern bool vgic_is_valid_irq(struct domain *d, unsigned int virq);
>  
>  static inline bool vgic_is_shared_irq(struct domain *d, unsigned int virq)

-- 
WBR, Volodymyr

  reply	other threads:[~2025-08-21 16:47 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 12:33 [PATCH v2 00/10] Introduce eSPI support Leonid Komarianskyi
2025-08-07 12:33 ` [PATCH v2 01/10] xen/arm: gicv3: refactor obtaining GIC addresses for common operations Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 03/10] xen/arm: vgic: implement helper functions for virq checks Leonid Komarianskyi
2025-08-21 15:46     ` Volodymyr Babchuk
2025-08-22  7:55       ` Leonid Komarianskyi
2025-08-22 12:28         ` Volodymyr Babchuk
2025-08-22 15:08           ` Leonid Komarianskyi
2025-08-23 12:29     ` Oleksandr Tyshchenko
2025-08-24 18:08       ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 02/10] xen/arm: gic: implement helper functions for INTID checks Leonid Komarianskyi
2025-08-21 15:39     ` Volodymyr Babchuk
2025-08-21 16:24       ` Julien Grall
2025-08-22  7:30         ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 04/10] xen/arm/irq: add handling for IRQs in the eSPI range Leonid Komarianskyi
2025-08-21 15:59     ` Volodymyr Babchuk
2025-08-21 16:46       ` Julien Grall
2025-08-21 16:59         ` Volodymyr Babchuk
2025-08-21 17:13           ` Julien Grall
2025-08-21 17:38             ` Volodymyr Babchuk
2025-08-22 12:41             ` Leonid Komarianskyi
2025-08-22 12:59       ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 05/10] xen/arm: gicv3: implement handling of GICv3.1 eSPI Leonid Komarianskyi
2025-08-21 16:16     ` Volodymyr Babchuk
2025-08-22 14:39       ` Leonid Komarianskyi
2025-08-23 14:23     ` Oleksandr Tyshchenko
2025-08-24 18:17       ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 06/10] xen/arm/irq: allow eSPI processing in the do_IRQ function Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 07/10] xen/arm: gicv3: modify ICH_LR_PHYSICAL_MASK to allow eSPI processing Leonid Komarianskyi
2025-08-21 16:27     ` Volodymyr Babchuk
2025-08-22  6:56       ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 08/10] xen/arm: vgic: add resource management for extended SPIs Leonid Komarianskyi
2025-08-21 16:43     ` Volodymyr Babchuk
2025-08-22  8:27       ` Leonid Komarianskyi
2025-08-23 14:39     ` Oleksandr Tyshchenko
2025-08-24 18:28       ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 09/10] xen/arm: domain_build: adjust Dom0 IRQ handling to support eSPIs Leonid Komarianskyi
2025-08-21 16:46     ` Volodymyr Babchuk [this message]
2025-08-22  7:08       ` Leonid Komarianskyi
2025-08-22 12:26         ` Volodymyr Babchuk
2025-08-22 15:03           ` Leonid Komarianskyi
2025-08-23 13:02     ` Oleksandr Tyshchenko
2025-08-24 18:47       ` Leonid Komarianskyi
2025-08-07 12:33   ` [PATCH v2 10/10] xen/arm: vgic-v3: add emulation of GICv3.1 eSPI registers Leonid Komarianskyi
2025-08-21 16:17     ` Oleksandr Tyshchenko
2025-08-22 10:47       ` Leonid Komarianskyi
2025-08-21 17:26     ` Volodymyr Babchuk
2025-08-22 10:00       ` Leonid Komarianskyi
2025-08-25 14:07       ` Leonid Komarianskyi
2025-08-21 16:00   ` [PATCH v2 01/10] xen/arm: gicv3: refactor obtaining GIC addresses for common operations Volodymyr Babchuk
2025-08-21 16:14   ` Julien Grall
2025-08-22  9:09     ` Leonid Komarianskyi
2025-08-22  9:38       ` Julien Grall
2025-08-22 10:09         ` Leonid Komarianskyi
2025-08-24 17:21 ` [PATCH v2 00/10] Introduce eSPI support Oleksandr Tyshchenko
2025-08-24 18:58   ` Leonid Komarianskyi

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=87o6s8d3m1.fsf@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=Leonid_Komarianskyi@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.