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

Re: [RFC XEN PATCH v6 4/5] libxl: Use gsi instead of irq for mapping pirq


  • To: Anthony PERARD <anthony.perard@xxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 29 Mar 2024 03:30:09 +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=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=nwiNTHxaHbwZ4OFEbcYYoIQWloqK5FOrBoK86xtQ8m4=; b=SRcUncrmJf5I16xgvb5dqP3HWWVwkRkMlRMrbmG6jjSUbWO2nI4bnM9LFl8qiLwBMVytgDGD+okWYCB+8LmTgMYR/+7jOSzysMM2gP4ZvSqTQtg7e3FxjTuwY95xqHyRRf0/FYEblgP540f9jPdN9Ct7LdVSJMJySLKiHqR5YH6kKxDUFUg6nkC3B6liMpL2VSt9JQbyIjnFf9oChpEN24O6AgmmF2/8zVlkk2rFF8ZvASubuG0M4BF7lFnubkiAl7rFQ6aYgSHUaI3pl732zMJ6ylqugQrnxR2faZ2KDQ6GyuxSafx/unrovY0zjouPxHqIRGTYsxgSHvyn2hH8Aw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXTF5y9Ba1JUFutFTZI0UvG3o6TC91tZB63qeKhPjdPYF1I+L98H7SZ8y1UJTBbg6wssPPWPcuGjdYbwUfr4xVWsPx21N0uWj63p3UbsPJMlybFJtf4XIe/NIF9quonhL/l5QEG30FsvUOgJe2Tal4XCPu1YQVQhulB+oWTWQD6qXz602KxFDMDZvB0qvRHQqzHgxF6uUoGzqC6OSIa2RDTJYhRTjYEtDEK/EiuP1d3Qal6wMwyw+SqSsMMAMIXOxXQsixqvGgrupejiNz+p/9kTXKX5IquAAb2Gt0UHS2S+LDS1Yld7nwXw8P/alaVmdFGEOzr1ns5v9jd4FRA5og==
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Daniel P . Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Fri, 29 Mar 2024 03:30:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHagNoDtKajNm2Sn02wRhj0zSTb0rFNag6AgAEsdoA=
  • Thread-topic: [RFC XEN PATCH v6 4/5] libxl: Use gsi instead of irq for mapping pirq

On 2024/3/29 01:32, Anthony PERARD wrote:
> On Thu, Mar 28, 2024 at 02:34:01PM +0800, Jiqian Chen wrote:
>> diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
>> index 96cb4da0794e..2cec83e0b734 100644
>> --- a/tools/libs/light/libxl_pci.c
>> +++ b/tools/libs/light/libxl_pci.c
>> @@ -1478,8 +1478,14 @@ static void pci_add_dm_done(libxl__egc *egc,
>>      fclose(f);
>>      if (!pci_supp_legacy_irq())
>>          goto out_no_irq;
>> -    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
>> +    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/gsi", pci->domain,
>>                                  pci->bus, pci->dev, pci->func);
>> +    r = access(sysfs_path, F_OK);
>> +    if (r && errno == ENOENT) {
>> +        /* To compitable with old version of kernel, still need to use irq 
>> */
> 
> There's a typo, this would be "To be compatible ...". Also maybe
> something like "Fallback to "/irq" for compatibility with old version of
> the kernel." might sound better.
> 
>> +        sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
>> +                               pci->bus, pci->dev, pci->func);
>> +    }
>>      f = fopen(sysfs_path, "r");
>>      if (f == NULL) {
>>          LOGED(ERROR, domainid, "Couldn't open %s", sysfs_path);
>> @@ -2229,9 +2235,15 @@ skip_bar:
>>      if (!pci_supp_legacy_irq())
>>          goto skip_legacy_irq;
>>  
>> -    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
>> +    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/gsi", pci->domain,
>>                             pci->bus, pci->dev, pci->func);
>>  
>> +    rc = access(sysfs_path, F_OK);
> 
> Please, don't use the variable `rc` here, this one is reserved for libxl
> error/return code in libxl. Introduce `int r` instead.
> 
>> +    if (rc && errno == ENOENT) {
>> +        /* To compitable with old version of kernel, still need to use irq 
>> */
>> +        sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
>> +                               pci->bus, pci->dev, pci->func);
>> +    }
>>      f = fopen(sysfs_path, "r");
>>      if (f == NULL) {
>>          LOGED(ERROR, domid, "Couldn't open %s", sysfs_path);
> 
> With those two things fixed: Reviewed-by: Anthony PERARD 
> <anthony.perard@xxxxxxxxxx>
Thank you very much!
I will fix those two in next version.

> 
> Thanks,
> 

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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