From: Mario Limonciello <mario.limonciello@amd.com>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)"
<linux-ide@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"Mario Limonciello" <mario.limonciello@amd.com>,
Nehal-bakulchandra Shah <Nehal-bakulchandra.Shah@amd.com>
Subject: [PATCH 2/2] ata: Adjust behavior when StorageD3Enable _DSD is set
Date: Fri, 12 Nov 2021 14:15:39 -0600 [thread overview]
Message-ID: <20211112201539.17377-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20211112201539.17377-1-mario.limonciello@amd.com>
The StorageD3Enable _DSD is used for the vendor to indicate that the disk
should be opted into or out of a different behavior based upon the platform
design.
For AMD's Renoir and Green Sardine platforms it's important that any
attached SATA storage has transitioned into DevSlp when s2idle is used.
If the disk is left in active/partial/slumber, then the system is not able
to resume properly.
When the StorageD3Enable _DSD is detected, check the system is using s2idle
and DevSlp is enabled and if so explicitly wait long enough for the disk to
enter DevSlp.
Cc: Nehal-bakulchandra Shah <Nehal-bakulchandra.Shah@amd.com>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214091
Link: https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/power-management-for-storage-hardware-devices-intro
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/ata/libahci.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 28430c093a7f..15c293da30ca 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -2322,6 +2322,18 @@ int ahci_port_resume(struct ata_port *ap)
}
EXPORT_SYMBOL_GPL(ahci_port_resume);
+static void ahci_handle_s2idle(struct ata_port *ap)
+{
+ void __iomem *port_mmio = ahci_port_base(ap);
+ u32 devslp;
+
+ if (pm_suspend_via_firmware())
+ return;
+ devslp = readl(port_mmio + PORT_DEVSLP);
+ if ((devslp & PORT_DEVSLP_ADSE))
+ ata_msleep(ap, devslp_idle_timeout);
+}
+
#ifdef CONFIG_PM
static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
{
@@ -2336,6 +2348,9 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
ata_port_freeze(ap);
}
+ if (acpi_storage_d3(ap->host->dev))
+ ahci_handle_s2idle(ap);
+
ahci_rpm_put_port(ap);
return rc;
}
--
2.25.1
next prev parent reply other threads:[~2021-11-12 20:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 20:15 [PATCH 1/2] ahci: Add Green Sardine vendor ID as board_ahci_mobile Mario Limonciello
2021-11-12 20:15 ` Mario Limonciello [this message]
2022-02-14 8:07 ` Paul Menzel
2022-02-14 16:07 ` Limonciello, Mario
2022-02-15 7:05 ` Paul Menzel
2022-02-15 11:43 ` Hans de Goede
2022-02-15 12:27 ` Paul Menzel
2022-02-15 12:52 ` Hans de Goede
2022-02-16 2:56 ` Limonciello, Mario
2022-02-15 12:55 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211112201539.17377-2-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Nehal-bakulchandra.Shah@amd.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®