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

Re: [PATCH v3 1/2] arch/arm: irq: Add platform_get_irq_byname() implementation


  • To: Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrei Cherechesu <andrei.cherechesu@xxxxxxxxxxx>
  • Date: Wed, 22 Mar 2023 17:00:10 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=iCk+TvrW1VNq3EQ1RnOyiylEuzVv3sPxZOUDFM42nd0=; b=YOfY9zanvrysWP6iRftJlGm0zmTc4xGq7/gMz6UrjMIbRWY8eodnImRn/id4DWMlInofaYwlU6VMVSlAw3aeUAgnmmR3OI5lg2ELBrXbNE6/eyRti5QdWqpDB7/5Cem/JBkoTQWTvd/rFALAn6uG5Wy06xKhmQP3n2KG3dVDwnAwvR+1fVcw3Tk75Nio2cTBANg+nQ4nO43xJprENku9NJkQ/ZB09hhthn4TxV+hqHoqyGiF9Tg3tluT/5JnXL0jIoJEgqYVTVOMIfb0dqL/su9WIM/u/lRdbF9SUM6JUfFuyyGCWbPEPRLje8DJYXmW/Ujvncs6IOemD9MXvkX6rA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eD6dJMwnwljaQGvQmhdIukvXAeBC7o/Ip8YKTGNWMtyeLGEr0/FHJq8UOjSl5LmArWDNGErtaFMSIcR+t7/HeiM3LTIWZfZhjc6+2md6TOdf2/sXe6vOXWDzgqVqRol21pm6NDXQP6zNyZme7pJOnb4IyRbYNCx3kIyt5Qqaf4TcH0kWQR/VoXdsZyRRRJuJ8r+k0T1owJP21Q58tkP5rlRrKTIWsqt1d9/KlWQcJahiQiGjrA6WIbWv0PxVo/pBi0PbEq9su/EUIDOXzTUpnWESw8zcLF+zoVRCykeKqYJx+2JeuepKM9lNi612N11AmdW9dgZvQAoZSu6imTwB2A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com;
  • Cc: michal.orzel@xxxxxxx, sstabellini@xxxxxxxxxx, Bertrand.Marquis@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, rahul.singh@xxxxxxx, Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
  • Delivery-date: Wed, 22 Mar 2023 15:01:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien,

On 21/03/2023 18:56, Julien Grall wrote:
> Hi Andrei,
> 
> I realized this has already been merged. But I would like to point out a
> few things for future series.
> 
> On 13/03/2023 13:08, Andrei Cherechesu (OSS) wrote:
>> From: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
>>
>> Moved implementation for the function which parses the IRQs of a DT
>> node by the "interrupt-names" property from the SMMU-v3 driver
>> to the IRQ core code and made it non-static to be used as helper.
>>
>> Also changed it to receive a "struct dt_device_node*" as parameter,
>> like its counterpart, platform_get_irq(). Updated its usage inside
>> the SMMU-v3 driver accordingly.
>>
>> Signed-off-by: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
>> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>>   xen/arch/arm/include/asm/irq.h        |  2 ++
>>   xen/arch/arm/irq.c                    | 14 +++++++++++
>>   xen/drivers/passthrough/arm/smmu-v3.c | 35 +++++----------------------
>>   3 files changed, 22 insertions(+), 29 deletions(-)
>>
>> diff --git a/xen/arch/arm/include/asm/irq.h
>> b/xen/arch/arm/include/asm/irq.h
>> index 245f49dcba..af94f41994 100644
>> --- a/xen/arch/arm/include/asm/irq.h
>> +++ b/xen/arch/arm/include/asm/irq.h
>> @@ -89,6 +89,8 @@ int irq_set_type(unsigned int irq, unsigned int type);
>>     int platform_get_irq(const struct dt_device_node *device, int index);
>>   +int platform_get_irq_byname(struct dt_device_node *np, const char
>> *name);
>> +
>>   void irq_set_affinity(struct irq_desc *desc, const cpumask_t
>> *cpu_mask);
>>     /*
>> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
>> index 79718f68e7..ded495792b 100644
>> --- a/xen/arch/arm/irq.c
>> +++ b/xen/arch/arm/irq.c
>> @@ -718,6 +718,20 @@ int platform_get_irq(const struct dt_device_node
>> *device, int index)
>>       return irq;
>>   }
>>   +int platform_get_irq_byname(struct dt_device_node *np, const char
>> *name)
> 
> You are changing the name but don't really explain why. "np" also ought
> to be const as this is not meant to be modified.
> 

I did not necessarily see it as a name change, but rather as adding a
more generic helper to be used across the codebase, and the "_optional"
suffix did not seem a good fit since it is an alternative to
"platform_get_irq" functionally, and I tried to keep the naming
convention. I will have it in mind for future series.

I agree with "np" being const, I saw you have already submitted a patch
to change it.


>> +{
>> +    int index;
>> +
>> +    if ( unlikely(!name) )
>> +        return -EINVAL;
>> +
>> +    index = dt_property_match_string(np, "interrupt-names", name);
>> +    if ( index < 0 )
>> +        return index;
>> +
>> +    return platform_get_irq(np, index);
> 
> The existing helper was returning -ENODEV when there is an error. But
> here, you went differently. This is the sort of thing that ought to be
> explained in the commit message because it is not obvious why you
> changed it *and* that you actually checked the callers are OK with that.
> 
> Thankfully they are all.

The existing helper was only visible and used within the scope of
smmu-v3.c, so changing it was not a big impact. I agree that it is not
obvious, though, and I will mention something like that in future series.

Thank you for reviewing it.

Andrei

> 
> Cheers,
> 



 


Rackspace

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