Re: [PATCH v5 3/3] PCI: qcom: Implement shutdown() callback

From: Krishna Chaitanya Chundru

Date: Wed Sep 09 2026 - 08:03:36 EST




On 9/9/2026 4:26 PM, Konrad Dybcio wrote:
> On 9/5/26 2:48 AM, Krishna Chaitanya Chundru wrote:
>> From: Manivannan Sadhasivam <mani@xxxxxxxxxx>
>>
>> PCIe host controllers should bring the link down cleanly before system
>> shutdown/reboot proceeds to remove power/clocks from the controller.
>> Without this, the link may still be up and endpoints still have
>> transactions in flight when power/clocks are cut, which can trip SMMU
>> translation faults or NoC protocol errors.
> [...]
>
>> +static void qcom_pcie_shutdown(struct platform_device *pdev)
>> +{
>> + const struct qcom_pcie_cfg *pcie_cfg = of_device_get_match_data(&pdev->dev);
>> + struct qcom_pcie *pcie;
>> +
>> + if (pcie_cfg && pcie_cfg->firmware_managed) {
>> + /*
>> + * Firmware owns the link teardown and clock/PHY shutdown in
>> + * this mode; Linux only owns the chained MSI IRQ(s), which
>> + * still need to be masked off before shutdown proceeds.
>> + */
>> + struct dw_pcie *pci = platform_get_drvdata(pdev);
>> +
>> + if (pci->pp.use_imsi_rx)
>> + dw_pcie_free_msi(&pci->pp);
>> + return;
>> + }
>> +
>> + pcie = platform_get_drvdata(pdev);
>> + if (pcie) {
>> + if (pcie->pci->pp.use_imsi_rx)
>> + dw_pcie_free_msi(&pcie->pci->pp);
>> +
>> + if (pcie->global_irq)
>> + disable_irq(pcie->global_irq);
>> +
>> + pcie->pci->pp.force_d3cold = true;
>> + dw_pcie_suspend_noirq(pcie->pci);
>> + }
>> +
> if (!pcie)
> return/warn (should it be possible?)
>
> if (pci->pp.use_imsi_rx)
> dw_pcie_free_msi(&pci->pp);
>
> /* abc xyz */
> if (firwmare_managed)
> return;
>
> will save you indentation and de-duplicate the free_msi() call
Ack.

- Krishna Chaitanya.
>
> Konrad