[PATCH v2] nvme: put some AMD PCIE downstream NVME device to simple suspend/resume path
Chaitanya Kulkarni
Chaitanya.Kulkarni at wdc.com
Wed Mar 31 21:47:00 BST 2021
> try do the NVME shutdown save and restore in the BIOS and still need PCIe
> power seting to resume from RTD3 for s2idle.
s/seting/setting/ ? idk.
> Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> ---
> Changes in v2:
> Fix the patch format and check chip root complex DID instead of PCIe RP
> to avoid the storage device plugged in internal PCIe RP by USB adaptor.
> ---
> drivers/nvme/host/pci.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 6bad4d4..1952da1 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -42,6 +42,9 @@
> #define NVME_MAX_KB_SZ 4096
> #define NVME_MAX_SEGS 127
>
> +#define AMD_PCIE_ID_CZN 0x1630
> +#define AMD_PCIE_ID_RN AMD_PCIE_ID_CZN
> +
> static int use_threaded_interrupts;
> module_param(use_threaded_interrupts, int, 0);
>
> @@ -70,6 +73,12 @@ static unsigned int io_queue_depth = 1024;
> module_param_cb(io_queue_depth, &io_queue_depth_ops, &io_queue_depth, 0644);
> MODULE_PARM_DESC(io_queue_depth, "set io queue depth, should >= 2");
>
> +static const struct pci_device_id pcie_ids[] = {
> + { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_PCIE_ID_RN) },
> + { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_PCIE_ID_CZN) },
> + { }
> +};
> +
why new global pci_device_id array is needed ?
> static int io_queue_count_set(const char *val, const struct kernel_param *kp)
> {
> unsigned int n;
> @@ -2832,6 +2841,7 @@ static bool nvme_acpi_storage_d3(struct pci_dev *dev)
> {
> struct acpi_device *adev;
> struct pci_dev *root;
> + struct pci_dev *rdev;
> acpi_handle handle;
> acpi_status status;
> u8 val;
> @@ -2845,6 +2855,15 @@ static bool nvme_acpi_storage_d3(struct pci_dev *dev)
> if (!root)
> return false;
>
> + rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
> + if (rdev && pci_match_id(pcie_ids, rdev)) {
> + /* Detect NVME device which pluged in the Renoir PCIE root port
> + * then force use quick suspend/resume path for handling the NVME
> + * timeout during s2idle resume.
> + */
The comment should something like this :-
if (rdev && pci_match_id(pcie_ids, rdev)) {
/*
* Detect NVMe device which pluged in the Renoir PCIe root port
* then force use quick suspend/resume path for handling the NVMe
* timeout during s2idle resume.
*/return NVME_QUIRK_SIMPLE_SUSPEND;
}
> + return NVME_QUIRK_SIMPLE_SUSPEND;
> + }
> +
> adev = ACPI_COMPANION(&root->dev);
> if (!adev)
> return false;
More information about the Linux-nvme
mailing list