>-----Original Message-----
>From: Eric Auger <eric.au...@redhat.com>
>Subject: Re: [PATCH v2 05/19] hw/pci: Export pci_device_get_iommu_bus_devfn()
>and return bool
>
>Hi Zhenzhong,
>
>On 6/20/25 9:17 AM, Zhenzhong Duan wrote:
>> Returns true if PCI device is aliased or false otherwise. This will be
>> used in following patch to determine if a PCI device is under a PCI
>> bridge.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com>
>> ---
>>  include/hw/pci/pci.h |  2 ++
>>  hw/pci/pci.c         | 12 ++++++++----
>>  2 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
>> index 829757b2c2..3029cdf26f 100644
>> --- a/include/hw/pci/pci.h
>> +++ b/include/hw/pci/pci.h
>> @@ -640,6 +640,8 @@ typedef struct PCIIOMMUOps {
>>                              bool is_write);
>>  } PCIIOMMUOps;
>>
>> +bool pci_device_get_iommu_bus_devfn(PCIDevice *dev, PCIBus
>**piommu_bus,
>> +                                    PCIBus **aliased_bus, int 
>> *aliased_devfn);
>if I am correct you have a single caller of the helper using the
>returned value, in intel_iommu.c, whereas all the existing callers are
>not using the returned value. You may simply pass a non NULL aliased_bus
>and aliased_devfn and check whether they differ from the original
>bus/devfn. Besides the patch looks ok to me.

I do this way initially, but it doesn't work if PCI device is the first device 
under
PCIE-to-PCI bridge, e.g., 01:00.0, in this case aliased BDF==real BDF.

Thanks
Zhenzhong

Reply via email to