[PATCH] nvme-pci: Force NVME_QUIRK_SIMPLE_SUSPEND on Qualcomm hosts
Konrad Dybcio
konrad.dybcio at oss.qualcomm.com
Fri Oct 25 08:30:05 PDT 2024
On 25.10.2024 1:35 PM, Christoph Hellwig wrote:
> On Thu, Oct 24, 2024 at 07:33:07PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio at oss.qualcomm.com>
>>
>> The Qualcomm SC8280XP SoC requires that all PCIe hosts are powered down
>> before the platform can reach S3-like sleep states. This is very much
>> similar in nature to the issue described in [1].
>>
>> Other Qualcomm platforms we support upstream require more complex code
>> additions across both the PCIe RC driver and other platform-specific
>> ones, before the link can be sustained in suspend. Hence, they
>> effectively need the same treatment for now.
>>
>> Force NVME_QUIRK_SIMPLE_SUSPEND on all Qualcomm platforms (as
>> identified by the upstream bridge having a Qualcomm VID) to address
>> that. Once the aforementioned issues on non-SC8280XP platforms are
>> addressed, the condition will be made more specific, with a PID check
>> limiting it to only the platform(s) that require it due to HW design.
>
> The NVMe driver is the wrong place for this, it needs to happen in the
> core by making acpi_storage_d3() evaluate to true. Preferably by
> actually setting the right ACPI attributes because a check for
> PCI vendor ID absolutely will never do the right thing in the long run.
(Un?)fortunately, said platforms use FDT, so we can't fix that in ACPI.
We also considered a DT property to indicate this, but:
a) PCIe devices are discoverable and it's really really really
discouraged to hardcode devices that are likely to be present
on the bus (and this wouldn't work if a NVMe device showed up
on a different-than-usual RC)
b) Adding such a property to the PCIe host node sounds a bit
saner, but the NVMe code isn't aware of the RC. We could add
something like:
struct pci_bus *pbus = pdev->bus;
while (!(pci_is_root_bus(pbus)))
pbus = pbus->parent;
if (of_property_present(pbus->dev.of_node, "broken-sleep-foo-bar"))
return NVME_QUIRK_SIMPLE_SUSPEND;
..but that implies we have to set that quirk in DT on all platforms
which only require an equivalent workaround temporarily. That in turn
is later much harder to undo than a simple driver change (e.g. if your
FDT is provided by the firmware).
In general, I don't think we can at all rely on firmware updates for
devices that are already on the market.
Konrad
More information about the Linux-nvme
mailing list