public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ata: ahci: Add force LPM policy quirk for ASUS B1400CEAE
@ 2024-01-30  9:59 Jian-Hong Pan
  2024-01-30 10:13 ` Mika Westerberg
  0 siblings, 1 reply; 15+ messages in thread
From: Jian-Hong Pan @ 2024-01-30  9:59 UTC (permalink / raw)
  To: Mika Westerberg, David Box, Damien Le Moal, Niklas Cassel,
	Nirmal Patel, Jonathan Derrick
  Cc: linux-ide, linux-pci, linux-kernel, linux, Jian-Hong Pan

Some systems, like ASUS B1400CEAE equipped with the SATA controller
[8086:a0d3] can use LPM policy to save power, especially for s2idle.

However, the same controller may be failed on other platforms. So,
commit (ata: ahci: Revert "ata: ahci: Add Tiger Lake UP{3,4} AHCI
controller") drops LPM policy for [8086:a0d3]. But, this blocks going
to deeper CPU Package C-state when s2idle with enabled Intel VMD.

This patch adds ahci_force_lpm_policy DMI quirk for ASUS B1400CEAE to
fix s2idle's power consumption issue when Intel VMD feature is enabled.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=218394
Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
---
 drivers/ata/ahci.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index d2460fa985b7..6bc5298a4adf 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1434,6 +1434,33 @@ static bool ahci_broken_devslp(struct pci_dev *pdev)
 	return pci_match_id(ids, pdev);
 }
 
+static bool ahci_force_lpm_policy(void)
+{
+	/*
+	 * Some systems, like ASUS B1400CEAE equipped with the SATA controller
+	 * [8086:a0d3] can use LPM policy to save power, especially for s2idle.
+	 * However, the same controller may be failed on other platforms. So,
+	 * commit (ata: ahci: Revert "ata: ahci: Add Tiger Lake UP{3,4} AHCI
+	 * controller") drops LPM policy for [8086:a0d3].
+	 *
+	 * https://bugzilla.kernel.org/show_bug.cgi?id=218394
+	 */
+	static const struct dmi_system_id sysids[] = {
+		{
+			.ident = "ASUS B1400CEAE",
+			.matches = {
+				DMI_MATCH(DMI_SYS_VENDOR,
+					  "ASUSTeK COMPUTER INC."),
+				DMI_MATCH(DMI_PRODUCT_NAME,
+					  "ASUS EXPERTBOOK B1400CEAE"),
+			},
+		},
+		{ }	/* terminate list */
+	};
+
+	return dmi_first_match(sysids);
+}
+
 #ifdef CONFIG_ATA_ACPI
 static void ahci_gtf_filter_workaround(struct ata_host *host)
 {
@@ -1760,6 +1787,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 			ahci_pci_bar = AHCI_PCI_BAR_LOONGSON;
 	}
 
+	if (ahci_force_lpm_policy()) {
+		pi = ahci_port_info[board_ahci_low_power];
+		dev_info(&pdev->dev, "force controller follow LPM policy\n");
+	}
+
 	/* acquire resources */
 	rc = pcim_enable_device(pdev);
 	if (rc)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-07  6:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30  9:59 [PATCH 1/2] ata: ahci: Add force LPM policy quirk for ASUS B1400CEAE Jian-Hong Pan
2024-01-30 10:13 ` Mika Westerberg
2024-01-31  8:56   ` Jian-Hong Pan
2024-01-31 10:57     ` Niklas Cassel
2024-01-31 11:08       ` Daniel Drake
2024-01-31 22:43         ` Niklas Cassel
     [not found]           ` <CADMpKLrNmmQ3PRTsiDXWBQ6iiJ9F+93xEk6HpuuK4Ev=n-i7wA@mail.gmail.com>
2024-02-01 10:35             ` Niklas Cassel
2024-02-01 15:01           ` Niklas Cassel
2024-02-02  8:49             ` Jian-Hong Pan
2024-02-05 11:33               ` Niklas Cassel
2024-02-06  8:39                 ` Jian-Hong Pan
2024-02-06 13:12                   ` Niklas Cassel
2024-02-06 22:07                     ` Niklas Cassel
2024-02-07  6:35                       ` Jian-Hong Pan
2024-02-07  6:31                     ` Jian-Hong Pan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox