Re: [PATCH] nvme: Add a module parameter for users to force simple suspend

From: Mario Limonciello
Date: Tue Feb 28 2023 - 18:48:41 EST


On 2/28/23 16:34, Keith Busch wrote:
On Tue, Feb 28, 2023 at 04:11:48PM -0600, Mario Limonciello wrote:
+static bool nvme_use_simple_suspend(struct pci_dev *pdev)
+{
+ if (!simple_suspend)
+ return false;
+ if (simple_suspend == 1)
+ return true;
+ return !noacpi && acpi_storage_d3(&pdev->dev);
+}
+
static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
int node, result = -ENOMEM;
@@ -3128,11 +3145,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
quirks |= check_vendor_combination_bug(pdev);
- if (!noacpi && acpi_storage_d3(&pdev->dev)) {
- /*
- * Some systems use a bios work around to ask for D3 on
- * platforms that support kernel managed suspend.
- */
+ if (nvme_use_simple_suspend(pdev)) {
dev_info(&pdev->dev,
"platform quirk: setting simple suspend\n");
quirks |= NVME_QUIRK_SIMPLE_SUSPEND;

Do you want the user setting "never" to override the driver's default quirks?

That hadn't occurred to me, but if offering a 0/1/-1 it certainly makes sense. I'll add something to explicitly clear it if present for a V2.

Another way I've hypothesized that this problem (at least as reported) can be approached is to examine if ANY disks in the system have simple suspend set to apply a "global" change to all NVME disks.

If that is preferable I'm fine to spin it that way too.