Message ID | 1618556075-24589-2-git-send-email-Prike.Liang@amd.com |
---|---|
State | Superseded |
Headers | show |
Series | nvme-pci: add AMD PCIe quirk for NVMe simple suspend/resume | expand |
On Fri, Apr 16, 2021 at 02:54:34PM +0800, Prike Liang wrote: > In the NVMe controller default suspend-resume seems only save/restore the > NVMe link state by APST opt and the NVMe remains in D0 during this time. > Then the NVMe device will be shutdown by SMU firmware in the s2idle entry > and then will lost the NVMe power context during s2idle resume.Finally, > the NVMe command queue request will be processed abnormally and result > in access timeout.This issue can be settled by using PCIe power set with > simple suspend-resume process path instead of APST get/set opt. > > In this patch prepare a PCIe RC bus flag to identify the platform whether > need the quirk. > > Cc: <stable@vger.kernel.org> # 5.11+ > Signed-off-by: Prike Liang <Prike.Liang@amd.com> > Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> > [ck: split patches for nvme and pcie] > Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> > Signed-off-by: Keith Busch <kbusch@kernel.org> Just a "Suggested-by:" from me is fine. I'm glad you were able to confirm this is successful, so I can add my Ack as well Acked-by: Keith Busch <kbusch@kernel.org>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 953f15a..34ba691e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -558,10 +558,13 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent) INIT_LIST_HEAD(&b->resources); b->max_bus_speed = PCI_SPEED_UNKNOWN; b->cur_bus_speed = PCI_SPEED_UNKNOWN; + if (parent) { #ifdef CONFIG_PCI_DOMAINS_GENERIC - if (parent) b->domain_nr = parent->domain_nr; #endif + if (parent->bus_flags & PCI_BUS_FLAGS_DISABLE_ON_S2I) + b->bus_flags |= PCI_BUS_FLAGS_DISABLE_ON_S2I; + } return b; } diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3..7c4bb8e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -312,6 +312,13 @@ static void quirk_nopciamd(struct pci_dev *dev) } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8151_0, quirk_nopciamd); +static void quirk_amd_s2i_fixup(struct pci_dev *dev) +{ + dev->bus->bus_flags |= PCI_BUS_FLAGS_DISABLE_ON_S2I; + pci_info(dev, "AMD simple suspend opt enabled\n"); +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x1630, quirk_amd_s2i_fixup); + /* Triton requires workarounds to be used by the drivers */ static void quirk_triton(struct pci_dev *dev) { diff --git a/include/linux/pci.h b/include/linux/pci.h index 53f4904..dc65219 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -240,6 +240,8 @@ enum pci_bus_flags { PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, PCI_BUS_FLAGS_NO_AERSID = (__force pci_bus_flags_t) 4, PCI_BUS_FLAGS_NO_EXTCFG = (__force pci_bus_flags_t) 8, + /* Driver must pci_disable_device() for suspend-to-idle */ + PCI_BUS_FLAGS_DISABLE_ON_S2I = (__force pci_bus_flags_t) 16, }; /* Values from Link Status register, PCIe r3.1, sec 7.8.8 */