Re: [PATCH V1] PCI: dwc: Use dev_info for PCIe link down event logging

Vidya Sagar
2022-09-14T11:02:30Z

Agree with Mani.
Not all form factors support PRSNT pin (Ex:- M.2 Key-M form factor) and
even if the slot form factor supports PRSNT, it is not mandatory to have
a GPIO routed to the PRSNT pin of the slot.
Also, since these are development platforms, we wouldn't want to keep
changing a controller's status in the DT, instead want to know the
device's presence/absence (by way of link up) looking at the log.
In my honest opinion, I don't think the absence of a device in the slot
should be treated as an error.

Thanks,
Vidya Sagar

On 9/14/2022 11:54 AM, Manivannan Sadhasivam wrote:
> External email: Use caution opening links or attachments
>
>
> On Tue, Sep 13, 2022 at 03:07:46PM -0500, Bjorn Helgaas wrote:
>> On Tue, Sep 13, 2022 at 06:00:30PM +0100, Jon Hunter wrote:
>>> On 13/09/2022 17:51, Manivannan Sadhasivam wrote:
>>>> On Tue, Sep 13, 2022 at 03:42:37PM +0530, Vidya Sagar wrote:
>>>>> Some of the platforms (like Tegra194 and Tegra234) have open slots and
>>>>> not having an endpoint connected to the slot is not an error.
>>>>> So, changing the macro from dev_err to dev_info to log the event.
>>>>
>>>> But the link up not happening is an actual error and -ETIMEDOUT is being
>>>> returned. So I don't think the log severity should be changed.
>>>
>>> Yes it is an error in the sense it is a timeout, but reporting an error
>>> because nothing is attached to a PCI slot seems a bit noisy. Please note
>>> that a similar change was made by the following commit and it also seems
>>> appropriate here ...
>>>
>>> commit 4b16a8227907118e011fb396022da671a52b2272
>>> Author: Manikanta Maddireddy <mmaddireddy@nvidia.com>
>>> Date: Tue Jun 18 23:32:06 2019 +0530
>>>
>>> PCI: tegra: Change link retry log level to debug
>>>
>>>
>>> BTW, we check for error messages in the dmesg output and this is a new error
>>> seen as of Linux v6.0 and so this was flagged in a test. We can ignore the
>>> error, but in this case it seem more appropriate to make this a info or
>>> debug level print.
>>
>> Can you tell whether there's a device present, e.g., via Slot Status
>> Presence Detect? If there's nothing in the slot, I don't know why we
>> would print anything at all. If a card is present but there's no
>> link, that's probably worthy of dev_info() or even dev_err().
>>
>
> I don't think all form factors allow for the PRSNT pin to be wired up,
> so we cannot know if the device is actually present in the slot or not all
> the time. Maybe we should do if the form factor supports it?
>
>> I guess if you can tell the slot is empty, there's no point in even
>> trying to start the link, so you could avoid both the message and the
>> timeout by not even calling dw_pcie_wait_for_link().
>
> Right. There is an overhead of waiting for ~1ms during boot.
>
> We workaround this issue by disabling the PCIe instances in devicetree
> for which there would be no devices connected.
>
> Thanks,
> Mani
>
>>
>> Bjorn