Commit db55fb8a authored by Mario Limonciello's avatar Mario Limonciello Committed by Hans de Goede

platform/x86/amd: pmc: Add an extra STB message for checking s2idle entry

The `check` callback is run right before the cores are put into HLT.
This will allow checking synchronization problems with other software
that writes into the STB.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220829162953.5947-5-mario.limonciello@amd.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 90bec285
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define AMD_PMC_STB_PMI_0 0x03E30600 #define AMD_PMC_STB_PMI_0 0x03E30600
#define AMD_PMC_STB_S2IDLE_PREPARE 0xC6000001 #define AMD_PMC_STB_S2IDLE_PREPARE 0xC6000001
#define AMD_PMC_STB_S2IDLE_RESTORE 0xC6000002 #define AMD_PMC_STB_S2IDLE_RESTORE 0xC6000002
#define AMD_PMC_STB_S2IDLE_CHECK 0xC6000003
/* STB S2D(Spill to DRAM) has different message port offset */ /* STB S2D(Spill to DRAM) has different message port offset */
#define STB_SPILL_TO_DRAM 0xBE #define STB_SPILL_TO_DRAM 0xBE
...@@ -706,6 +707,16 @@ static void amd_pmc_s2idle_prepare(void) ...@@ -706,6 +707,16 @@ static void amd_pmc_s2idle_prepare(void)
dev_err(pdev->dev, "error writing to STB: %d\n", rc); dev_err(pdev->dev, "error writing to STB: %d\n", rc);
} }
static void amd_pmc_s2idle_check(void)
{
struct amd_pmc_dev *pdev = &pmc;
int rc;
rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_CHECK);
if (rc)
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
}
static void amd_pmc_s2idle_restore(void) static void amd_pmc_s2idle_restore(void)
{ {
struct amd_pmc_dev *pdev = &pmc; struct amd_pmc_dev *pdev = &pmc;
...@@ -733,6 +744,7 @@ static void amd_pmc_s2idle_restore(void) ...@@ -733,6 +744,7 @@ static void amd_pmc_s2idle_restore(void)
static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = { static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
.prepare = amd_pmc_s2idle_prepare, .prepare = amd_pmc_s2idle_prepare,
.check = amd_pmc_s2idle_check,
.restore = amd_pmc_s2idle_restore, .restore = amd_pmc_s2idle_restore,
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment