Re: [PATCH v2 3/3] PCI: qcom: properly implement RC shutdown/power up
From: Konrad Dybcio
Date: Wed Mar 27 2024 - 15:37:22 EST
On 20.02.2024 5:12 AM, Krishna Chaitanya Chundru wrote:
>
>
> On 2/10/2024 10:40 PM, Konrad Dybcio wrote:
>> Currently, we've only been minimizing the power draw while keeping the
>> RC up at all times. This is suboptimal, as it draws a whole lot of power
>> and prevents the SoC from power collapsing.
>>
>> Implement full shutdown and re-initialization to allow for powering off
>> the controller.
>>
>> This is mainly indended for SC8280XP with a broken power rail setup,
>> which requires a full RC shutdown/reinit in order to reach SoC-wide
>> power collapse, but sleeping is generally better than not sleeping and
>> less destructive suspend can be implemented later for platforms that
>> support it.
>>
>> Co-developed-by: Bjorn Andersson <quic_bjorande@xxxxxxxxxxx>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>
>> ---
[...]
>> + if (pcie->soc_is_rpmh) {
>> + /*
>> + * The PCIe RC may be covertly accessed by the secure firmware
>> + * on sleep exit. Use the WAKE bucket to let RPMh pull the plug
>> + * on PCIe in sleep, but guarantee it comes back up for resume.
>> + */
>> + icc_set_tag(pcie->icc_mem, QCOM_ICC_TAG_WAKE);
>> +
>> + /* Flush the tag change */
>> + ret = icc_enable(pcie->icc_mem);
>> + if (ret) {
>> + dev_err(pcie->pci->dev, "failed to icc_enable %d\n", ret);
>> +
>> + /* Revert everything and pray icc calls succeed */
>> + return qcom_pcie_resume_noirq(dev);
>> + }
>> + } else {
>> + /*
>> + * Set minimum bandwidth required to keep data path functional
>> + * during suspend.
>> + */
> calling qcom_pcie_host_deinit(&pcie->pci->pp) above will turn off all the resources, setting BW to 1Kbps will not make sense here.
This is preserving the current behavior, it may be revised later.
See ad9b9b6e36c9 ("PCI: qcom: Add support for system suspend and resume")
that introduced it, in a perhaps overly 8280-centric fashion.
Konrad