[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 05/12] xen/arm: gicv3: implement handling of GICv3.1 eSPI


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Leonid Komarianskyi <Leonid_Komarianskyi@xxxxxxxx>
  • Date: Fri, 5 Sep 2025 10:27:41 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SyaXlZlue/VSvNKKuFYSywkqSORzXhWatkdZNX0Rm1A=; b=Bz+G6QWjzRtGv/bQam+5w0WLk0Md5HOi+zQN849J742A64RxgLXyP8ZRxnX6nsqoZRc2WlgUZXulUClbjiBiVVEfRTFdPAgS1Xo+DO4Mza/o5ZPw1cDb86B2p1y5guUGQDCRwVj1hYjwVI3yXq8kfK0Q7IK4jL5iaHf7llnTP2ByvkWw1VrmJIGt+GIYxFhvLacjxbeBktSvGf3Fs4xnf15mnV88KuFx226yqs1ntr7lwyR62G49R8QHY0vnFinl9MY27NVI+4u4DiGCqSedxrAwgpW0v+QzXOUpdbsq8nxoR260RKvOEHkq8nhM7whHqFexsLdzB8ZwSJSONTxaPw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CZbEINSlfnAJR2A8TlseX7rD0GrcvF63FPJ/c58KrW0TqoIL0ksg4Ezwa6X2JpO7/rSHWnldmjRkpVuvPO74I6aKwq47zH/CRsWqHv5dki3KsQ0rr/6v7RMdNI7KHgVNESraTeSERrrAh13AbsOAtBnJ818FtIqaVwD9Aq4BpvliMGHQoCUzqchPhhXeIzFGi1iv9HsUo0Rku+0O0mmIwjLRvjDSzZVsNG+kp+N4NaF5GfAmFm5O0AG5oU+PioP9JqBYYALgomO9qV1DUdII2zrDHVA/6jIXXzo21agE5BAdZrtOQICkry2zkQD6UkHvKBob1578fObp4AVE986BDw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: "olekstysh@xxxxxxxxx" <olekstysh@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>
  • Delivery-date: Fri, 05 Sep 2025 10:27:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcHdazISYJ96ARO0ihPlIvp7RWE7SEMBaAgAAzpgA=
  • Thread-topic: [PATCH v7 05/12] xen/arm: gicv3: implement handling of GICv3.1 eSPI

Hi Julien,

Thank you for your comments and AB.

On 05.09.25 10:22, Julien Grall wrote:
> Hi Leonid,
> 
> On 04/09/2025 21:01, Leonid Komarianskyi wrote:
>> +#ifdef CONFIG_GICV3_ESPI
>> +unsigned int gic_number_espis(void)
>> +{
>> +    return gic_hw_ops->info->nr_espi;
>> +}
>> +
>> +static void __init gicv3_dist_espi_common_init(uint32_t type)
>> +{
>> +    unsigned int espi_nr, i;
>> +
>> +    espi_nr = min(1024U, GICD_TYPER_ESPIS_NUM(type));
>> +    gicv3_info.nr_espi = espi_nr;
>> +    /* The GIC HW doesn't support eSPI, so we can leave from here */
>> +    if ( gicv3_info.nr_espi == 0 )
>> +        return;
>> +
>> +    printk("GICv3: %d eSPI lines\n", gicv3_info.nr_espi);
> 
> Style: nr_espi is unsigned. So it should be %u. Can be fixed on commit 
> if there is nothing else major to change.
> 
>> +
>> +    /* The configuration for eSPIs is similar to that for regular 
>> SPIs */
>> +    for ( i = 0; i < espi_nr; i += 16 )
>> +        writel_relaxed(0, GICD + GICD_ICFGRnE + (i / 16) * 4);
>> +
>> +    for ( i = 0; i < espi_nr; i += 4 )
>> +        writel_relaxed(GIC_PRI_IRQ_ALL,
>> +                       GICD + GICD_IPRIORITYRnE + (i / 4) * 4);
>> +
>> +    for ( i = 0; i < espi_nr; i += 32 )
>> +    {
>> +        writel_relaxed(GENMASK(31, 0), GICD + GICD_ICENABLERnE + (i / 
>> 32) * 4);
> 
> Sorry I only spotted now.
> 
> The goal of gicv3_dist_espi_common_init() is to make sure the GIC is in 
> a sane state for Xen (the previous OS or firmware may have left some 
> state). Now the firmware may decide to use eSPI but not Xen (e.g. 
> because CONFIG_ESPI=n).
> 
> This would means we may have eSPI interrupts that may be enabled and 
> pending. So as soon as we re-enable the GIC we may receive interrupts we 
> can't handle. So I think we may need to initialize the eSPI part of the 
> distributor unconditionally. What do you think?
> 
> 
> This could be handled as a follow-up but within the timeframe of Xen 
> 4.21. So for this patch:
> 
> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Cheers,
> 

Yes, that's a really good point about firmware initialization - I did 
not think about that. In that case, we just need to move the nr_espi 
field out of the ifdef, remove the stubs for 
gicv3_dist_espi_common_init() and gicv3_dist_espi_init_aff(), and remove 
the ifdef for these functions. The verifications at the beginning of 
gicv3_dist_espi_common_init() should work correctly, simply returning 0 
on platforms without eSPI.

I will prepare a follow-up patch for this.

Best regards,
Leonid

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.