On Tue, Aug 06, 2024 at 10:20:39PM +0200, Lukas Wunner wrote: > On Tue, Aug 06, 2024 at 08:09:18PM +0530, Manivannan Sadhasivam wrote: > > Regarding your comment on patch 3/4, we already have the sysfs attribute > > to control whether the device can be put into D3Cold or not and that is > > directly coming from userspace. So there is no guarantee to assume that > > D3Hot support is considered. > > If a device is not allowed to be suspended to D3cold, it will only be > suspended to D3hot. > > If a port is put into anything deeper than D0, its secondary bus is > no longer in B0 (PCI-PM r1.2 table 6-1) and children are inaccessible, > so they're "effectively" in D3cold. Hence if a device cannot be > suspended to D3cold, it will block all parent bridges from being > suspended. That's what the logic in pci_bridge_d3_update() and > pci_dev_check_d3cold() is doing. > Agree. But patch 3/4 is mostly based on the suggestion from Bjorn [1] for earlier revision. He specifically mentioned that the platform_pci_bridge_d3() function doesn't differentiate between D3Hot and D3Cold and that's why I splitted them: "These are two vastly different scenarios, and I would really like to untangle them so they aren't conflated. I see that you're extending platform_pci_bridge_d3(), which apparently has that conflation baked into it already, but my personal experience is that this is really hard to maintain." I agree with your point that if D3Hot is not possible, then D3Cold is also not possible as per the PCI PM reference you quoted. But here, D3Hot is possible, but D3Cold is not. And platform_pci_power_manageable(), platform_pci_choose_state() are already returning false for DT platforms. So if 'true' is returned from platform_pci_bridge_d3(), then it implies that D3Cold is also supported, but it doesn't on DT platforms. So a split seems to be necessary IMO. - Mani [1] https://lore.kernel.org/linux-pci/20240221182000.GA1533634@bhelgaas/ > The d3cold_allowed attribute in sysfs is just one of several reasons > why a device may not go to D3cold (see pci_dev_check_d3cold() for > details). > > The d3cold_allowed attribute was originally intended to disable D3cold > on devices where it was known to not work. Nowadays this should all > be handled automatically, which is why we've discussed moving the > attribute to debugfs: > > https://lore.kernel.org/all/20230918132424.GA11357@xxxxxxxxx/ > https://lore.kernel.org/all/20231002181025.82746-1-mario.limonciello@xxxxxxx/ > > Thanks, > > Lukas -- மணிவண்ணன் சதாசிவம்