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

Re: [PATCH v4 01/12] xen/arm: gicv3: refactor obtaining GIC addresses for common operations


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Leonid Komarianskyi <Leonid_Komarianskyi@xxxxxxxx>
  • Date: Thu, 28 Aug 2025 16:17:12 +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=+BOAKc4ePu5k8MfT9JLdkRwTeGdUsTnHyAo04DW/HWw=; b=pqI9F5qXl1LeQ5ZKPkwpcNSAWae9BQwBFBnENah9oe1KnE9SeQFEgpNwKZJErbuO8fGTeqlP0eVQCM2rsNpUmYJe1ho/Erentyl6TIDYsVWgoZizCqvQWrC2jMBOrfSgeT8FKb2zQ0mGVr6q06kiuDTgUNpWYC96sk54HsAere/DfmaEb47tAWZIqVHcwwIme9VHU5qPgb6BnE1KEBeK71IZh1y0iXNm2p9mTfDZb0ImjKzvpMkEGHwv+xZDulJlr7raYdjYVI4A27aX9DhRoFF+fvIRQF9H2vZlKoWNCo0EiTYkznz+jvTVn/naTe1Adztc3B8kQ2n0SrZ95GsXag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pXPAF9wHF1xFcuNKPnofHDnzqgz7UBX+OHfoLkB2xktf2YTpj07dgun7hC5YIYj+PeQ5/5tmB/9fjqV1fUzdJ6eqc15G5mV0R5G++wCBYlNo516fTObgE6okHgYYpeXd9xYF7FXMSyuT3jSgVEL5jo2BDqEuuhBtrRRR7QRfPAbSWpesAgVmZkDbOS25xkRzdITV2gqCPrF7UOFu4zLnHFSQJPh62kuHg779/3O9f73mYQ78wCAduI9rdEoQ4ekUwNZEW27Uqaa32llMKYz76idGEMc1RRnxj65Abi7j9xOn4vTRPvX4l1M8JbQJkiqz0IzaJ7hz1a5QzBTwVAs0pA==
  • 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>
  • Delivery-date: Thu, 28 Aug 2025 16:17:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcF3/CtR1KedyUO0e9jC2sdgHn6rR396GAgABHyYA=
  • Thread-topic: [PATCH v4 01/12] xen/arm: gicv3: refactor obtaining GIC addresses for common operations

Hi Julien,


On 28.08.25 15:00, Julien Grall wrote:
> Hi Leonid,
> 
> On 27/08/2025 19:24, Leonid Komarianskyi wrote:
>> Currently, many common functions perform the same operations to calculate
>> GIC register addresses. This patch consolidates the similar code into
>> a separate helper function to improve maintainability and reduce 
>> duplication.
>> This refactoring also simplifies the implementation of eSPI support in 
>> future
>> changes.
>>
>> Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@xxxxxxxx>
>> Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
>>
>> ---
>> Changes in V4:
>> - no changes
>>
>> Changes in V3:
>> - changed panic() in get_addr_by_offset() to printing warning and
>>    ASSERT_UNREACHABLE()
>> - added verification of return pointer from get_addr_by_offset() in the
>>    callers
>> - moved invocation of get_addr_by_offset() from spinlock guards, since
>>    it is not necessarry
>> - added RB from Volodymyr Babchuk
> 
> Procces remark, here you said the Reviewed-by from Volodymyr was added 
> in v3. However, given the changes you made this should have been 
> invalidated (reviewed-by means the person read the code and confirmed it 
> is correct).
> 
> I see Volodymyr confirmed his reviewed-by on v3. So no issue, but this 
> should have been clarified in the changelog.
> 

Thank you for your explanation.
Just to clarify: would it be okay to leave the RB tag (with appropriate 
text in the changelog) if I fix some minor nit from another reviewer in 
the next version, like in this patch?

>>
>> Changes in V2:
>> - no changes
>> ---
>>   xen/arch/arm/gic-v3.c          | 114 +++++++++++++++++++++++----------
>>   xen/arch/arm/include/asm/irq.h |   1 +
>>   2 files changed, 81 insertions(+), 34 deletions(-)
>>
>> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
>> index cd3e1acf79..a959fefebe 100644
>> --- a/xen/arch/arm/gic-v3.c
>> +++ b/xen/arch/arm/gic-v3.c
>> @@ -445,17 +445,67 @@ static void gicv3_dump_state(const struct vcpu *v)
>>       }
>>   }
>> +static void __iomem *get_addr_by_offset(struct irq_desc *irqd, u32 
>> offset)
>> +{
>> +    switch ( irqd->irq )
>> +    {
>> +    case 0 ... (NR_GIC_LOCAL_IRQS - 1):
>> +        switch ( offset )
>> +        {
>> +        case GICD_ISENABLER:
>> +        case GICD_ICENABLER:
>> +        case GICD_ISPENDR:
>> +        case GICD_ICPENDR:
>> +        case GICD_ISACTIVER:
>> +        case GICD_ICACTIVER:
>> +            return (GICD_RDIST_SGI_BASE + offset);
>> +        case GICD_ICFGR:
>> +            return (GICD_RDIST_SGI_BASE + GICR_ICFGR1);
>> +        case GICD_IPRIORITYR:
>> +            return (GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + irqd->irq);
>> +        default:
>> +            break;
>> +        }
>> +    case NR_GIC_LOCAL_IRQS ... SPI_MAX_INTID:
>> +        switch ( offset )
>> +        {
>> +        case GICD_ISENABLER:
>> +        case GICD_ICENABLER:
>> +        case GICD_ISPENDR:
>> +        case GICD_ICPENDR:
>> +        case GICD_ISACTIVER:
>> +        case GICD_ICACTIVER:
>> +            return (GICD + offset + (irqd->irq / 32) * 4);
>> +        case GICD_ICFGR:
>> +            return (GICD + GICD_ICFGR + (irqd->irq / 16) * 4);
>> +        case GICD_IROUTER:
>> +            return (GICD + GICD_IROUTER + irqd->irq * 8);
>> +        case GICD_IPRIORITYR:
>> +            return (GICD + GICD_IPRIORITYR + irqd->irq);
>> +        default:
>> +            break;
>> +        }
>> +    default:
>> +        break;
>> +    }
>> +
>> +    /* Something went wrong, we shouldn't be able to reach here */
>> +    printk(XENLOG_WARNING "GICv3: WARNING: Invalid offset 0x%x for 
>> IRQ#%d",
> 
> NIT: I am not expecting the interrupt to be < 0. So it would be 
> preferable to use %u.
> 
> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Cheers,
> 

Thank you for your AB. I will fix the nit in V5.

Best regards,
Leonid

 


Rackspace

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