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

Re: [XEN PATCH v15 2/4] x86/irq: allow setting IRQ permissions from GSI instead of pIRQ


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 13 Sep 2024 06:58:34 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=cv8wuS2Hr2HD0+oKG/L46eeg8Z7vuW+BQ9S8y/xfvlE=; b=lnPf9A+/bi7ZFRyxYsAI57umjBGBkJ249CHjrzfpuKKXCwC86sBLGhyWfdt7TLsrA02zDsUJctjd2bb23aJAMPxfT9nhv5G78CBur/rbyaQRTXau+bpCwaRfIY6+OqTeyHmr9qplaZu8JljvLP/pNoJytaIuNApl2hDRdKHoCreyCI7p0QOOXgms3Ia5kyftpJa0eAkSxgLlYMpJh3MzIKLMlEDk5qGBVn6MfDvlHIszxo8UQhkFbvYRX4LfXP+Ot59eHIyemzDr/PIBnaZw1LczcCxZ02edXj+v7iUOnzfvG4/rNkkvNXy3nbbozbCYQWS46hhxfiA7lxh3m+qxBQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iJbL0fY8R+I5HA/ByF4d9WqF/tGBp2K2LH0LD84gaCJ873U4v3Agh4YikkwdaM1C4Gs7alXbGCpHL2vYyEaPMCA/8AJEYgwdAI+9wz6swZXvuG4AX7vfDRu/6f034ByqGUXG1L9hoC9wmkVGDrf9IcTYqoJIAGIUBB3rWxiBrIMtm4z2GXpEtgmPN6ohMCr6pSUbEPMYaJhyJgzufGShwNbopV+Aa2yspS6am+NnRGMJSNuY3Rke7Lj4cHemZaJ1CVcoMQowh+P3G6iurcRZ8Tci49NQkhnCfwlFQRuTaSna0DXm8W4Th2TLlgeW33qmjvpscalc8j493my/IX5uLA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Fri, 13 Sep 2024 06:58:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbBBiuopssrGEkhk6CaPzsYxSpJrJT9mIAgAAE1QCAAY3jgP//wbuAgACGsoA=
  • Thread-topic: [XEN PATCH v15 2/4] x86/irq: allow setting IRQ permissions from GSI instead of pIRQ

On 2024/9/13 14:52, Jan Beulich wrote:
> On 13.09.2024 04:38, Chen, Jiqian wrote:
>> On 2024/9/12 18:51, Jan Beulich wrote:
>>> On 12.09.2024 12:34, Daniel P. Smith wrote:
>>>> On 9/11/24 02:58, Jiqian Chen wrote:
>>>>> @@ -237,6 +238,34 @@ long arch_do_domctl(
>>>>>           break;
>>>>>       }
>>>>>   
>>>>> +    case XEN_DOMCTL_gsi_permission:
>>>>> +    {
>>>>> +        int irq;
>>>>> +        unsigned int gsi = domctl->u.gsi_permission.gsi;
>>>>> +        uint32_t flags = domctl->u.gsi_permission.flags;
>>>>> +
>>>>> +        /* Check only valid bits are set */
>>>>> +        ret = -EINVAL;
>>>>> +        if ( flags & ~XEN_DOMCTL_GSI_ACTION_MASK )
>>>>> +            break;
>>>>> +
>>>>> +        ret = irq = gsi_2_irq(gsi);
>>>>
>>>> I was recently informed that a = b = c; form is not MISRA compliant. 
>>>> Since you just overwrite ret after the check, why not drop the 
>>>> assignment to ret and mae the next check against irq instead.
>>>
>>> The Misra concern is valid, yet the suggestion doesn't look to be quite
>>> matching what is needed. After all if we take ...
>>>
>>>>> +        if ( ret <= 0 )
>>>>> +            break;
>>>
>>> ... the "break" path, "ret" needs to be set. Plus there's the problem of
>>> "ret" being zero when exiting the function indicates success, yet this
>>> is an error path (requiring ret < 0). So overall perhaps
>>>
>>>          irq = gsi_2_irq(gsi);
>>>          if ( irq <= 0 )
>>>          {
>>>              ret = irq ?: -EACCES;
>>>              break;
>>>          }
>>>
>>> ?
>>
>> Yes, ret needs to be set. And since gsi_2_irq doesn't return 0(if irq is 0, 
>> gsi_2_irq returns -EINVAL).
>> Maybe below is enough?
>>         irq = gsi_2_irq(gsi);
>>         if ( irq < 0 )
>>         {
>>             ret = irq;
>>             break;
>>         }
> 
> My proposal was to cover that elsewhere we exclude IRQ0, and hence
> it would be good to be consistent here.
Got it, I will use your proposal in next version. Thanks.

> 
> Jan

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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