All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86/amd: pmc: Add a workaround for an s0i3 issue on Cezanne
@ 2022-11-16 15:43 Mario Limonciello
  2022-11-17 14:05 ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Mario Limonciello @ 2022-11-16 15:43 UTC (permalink / raw)
  To: Hans de Goede, Shyam Sundar S K
  Cc: Mario Limonciello, Mahapatra, Rajib, Raul Rangel, Mark Gross,
	platform-driver-x86, linux-kernel

Cezanne platforms under the right circumstances have a synchronization
problem where attempting to enter s2idle may fail if the x86 cores are
put into HLT before hardware resume from the previous attempt has
completed.

To avoid this issue add a 10-20ms delay before entering s2idle another
time. This workaround will only be applied on interrupts that wake the
hardware but don't break the s2idle loop.

Cc: "Mahapatra, Rajib" <Rajib.Mahapatra@amd.com>
Cc: "Raul Rangel" <rrangel@chromium.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/amd/pmc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
index ef4ae977b8e0..439d282aafd1 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -739,8 +739,14 @@ static void amd_pmc_s2idle_prepare(void)
 static void amd_pmc_s2idle_check(void)
 {
 	struct amd_pmc_dev *pdev = &pmc;
+	struct smu_metrics table;
 	int rc;
 
+	/* CZN: Ensure that future s0i3 entry attempts at least 10ms passed */
+	if (pdev->cpu_id == AMD_CPU_ID_CZN && !get_metrics_table(pdev, &table) &&
+	    table.s0i3_last_entry_status)
+		usleep_range(10000, 20000);
+
 	/* Dump the IdleMask before we add to the STB */
 	amd_pmc_idlemask_read(pdev, pdev->dev, NULL);
 
-- 
2.34.1


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

end of thread, other threads:[~2022-12-07 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 15:43 [PATCH] platform/x86/amd: pmc: Add a workaround for an s0i3 issue on Cezanne Mario Limonciello
2022-11-17 14:05 ` Hans de Goede
2022-11-17 16:06   ` Limonciello, Mario
2022-11-17 16:09     ` Hans de Goede
2022-12-05 23:02       ` Limonciello, Mario
2022-12-07 17:17         ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.