Re: [PATCH v3 03/15] cxl/pci: Introduce PCIe helper functions pcie_is_cxl() and pcie_is_cxl_port()

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

 




On 11/15/2024 2:47 AM, Lukas Wunner wrote:
> On Thu, Nov 14, 2024 at 11:07:26AM -0600, Bowman, Terry wrote:
>>> Can you have a CXL port that is not a CXL device?
>>>
>>> If not, it would seem to me that checking for Flexbus DVSEC presence
>>> *is* redundant.  Or do you anticipate broken devices which lack the
>>> Flexbus DVSEC and that you explicitly want to exclude?
>> No, the CXL port device is always a CXL device per spec.
>>
>> This was added to short-circuit the function by returning immediately
>> if the device is _not_ a CXL device. Otherwise for PCIe Port devices,
>> the CXL Port DVSEC will be searched. I was trying to avoid the unnecessary
>> CXL port DVSEC search unless the other criteria are met.
>> And I expect most cases will not be a CXL device.
>>
>> I will remove the "if (!pcie_is_cxl(dev))" block as you suggested.
> Ah, this is meant as a speed-up.  Actually that makes sense,
> so feel free to keep it.
>
> If you do remove it, I think you'll have to move the cxl_port_dvsec()
> invocation up in the function, in front of the pci_pcie_type() checks.
> The latter require that one first checks that the device is PCIe.
> That's done implicitly by cxl_port_dvsec() because it returns 0 in
> the non-PCIe case.  (Due to the "if (dev->cfg_size <= PCI_CFG_SPACE_SIZE)"
> check in pci_find_next_ext_capability().)
>
> Another idea would be to put a "if (!pcie_is_cxl(dev)) return 0;" speed-up
> in cxl_port_dvsec() so that the other caller benefits from it as well.
>
> Thanks,
>
> Lukas
Ok, I'll look at adding the same pcie_is_cxl() call and check in cxl_port_devsec().

Regards,
Terry




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux