On 2024/1/5 15:36, Jan Beulich wrote:
> On 05.01.2024 08:09, Jiqian Chen wrote:
>> --- a/tools/libs/light/libxl_pci.c
>> +++ b/tools/libs/light/libxl_pci.c
>> @@ -1479,8 +1479,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);
>> +
>> +    if (access(sysfs_path, F_OK) != 0) {
> 
> I suppose you want to also check errno, and fall back only when you got
> back (I guess) ENOENT.
Ok, will check errno in next version, if it is ENOENT, then use irq, if it is 
not ENOENT, then log error and go to out.

> 
> Jan
> 
>> +        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);
>> @@ -2231,9 +2237,14 @@ 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);
>>  
>> +    if (access(sysfs_path, F_OK) != 0) {
>> +        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);
> 

-- 
Best regards,
Jiqian Chen.

Reply via email to