Skip to content

Commit

Permalink
platform/x86: amd-pmc: Drop CPU QoS workaround
Browse files Browse the repository at this point in the history
A workaround was previously introduced as part of commit 646f429ec2de
("platform/x86: amd-pmc: Set QOS during suspend on CZN w/ timer wakeup")
to prevent CPUs from going into the deepest state during the execution
of the `noirq` stage of `amd_pmc`.  As `amd_pmc` has been pushed to the
last step for suspend on AMD platforms, this workaround is no longer
necessary.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220317141445.6498-4-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Mario Limonciello authored and Hans de Goede committed Mar 17, 2022
1 parent 23f5f70 commit 0d64787
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions drivers/platform/x86/amd-pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
#include <linux/rtc.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
Expand Down Expand Up @@ -96,9 +95,6 @@
#define PMC_MSG_DELAY_MIN_US 50
#define RESPONSE_REGISTER_LOOP_MAX 20000

/* QoS request for letting CPUs in idle states, but not the deepest */
#define AMD_PMC_MAX_IDLE_STATE_LATENCY 3

#define SOC_SUBSYSTEM_IP_MAX 12
#define DELAY_MIN_US 2000
#define DELAY_MAX_US 3000
Expand Down Expand Up @@ -153,7 +149,6 @@ struct amd_pmc_dev {
struct device *dev;
struct pci_dev *rdev;
struct mutex lock; /* generic mutex lock */
struct pm_qos_request amd_pmc_pm_qos_req;
#if IS_ENABLED(CONFIG_DEBUG_FS)
struct dentry *dbgfs_dir;
#endif /* CONFIG_DEBUG_FS */
Expand Down Expand Up @@ -628,14 +623,6 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
rc = rtc_alarm_irq_enable(rtc_device, 0);
dev_dbg(pdev->dev, "wakeup timer programmed for %lld seconds\n", duration);

/*
* Prevent CPUs from getting into deep idle states while sending OS_HINT
* which is otherwise generally safe to send when at least one of the CPUs
* is not in deep idle states.
*/
cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, AMD_PMC_MAX_IDLE_STATE_LATENCY);
wake_up_all_idle_cpus();

return rc;
}

Expand All @@ -655,7 +642,7 @@ static void amd_pmc_s2idle_prepare(void)
rc = amd_pmc_verify_czn_rtc(pdev, &arg);
if (rc) {
dev_err(pdev->dev, "failed to set RTC: %d\n", rc);
goto fail;
return;
}
}

Expand All @@ -665,20 +652,13 @@ static void amd_pmc_s2idle_prepare(void)
rc = amd_pmc_send_cmd(pdev, arg, NULL, msg, 0);
if (rc) {
dev_err(pdev->dev, "suspend failed: %d\n", rc);
goto fail;
return;
}

if (enable_stb)
rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF);
if (rc) {
if (rc)
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
goto fail;
}
return;
fail:
if (pdev->cpu_id == AMD_CPU_ID_CZN)
cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req,
PM_QOS_DEFAULT_VALUE);
}

static void amd_pmc_s2idle_restore(void)
Expand All @@ -704,11 +684,6 @@ static void amd_pmc_s2idle_restore(void)
if (rc)
dev_err(pdev->dev, "error writing to STB: %d\n", rc);

/* Restore the QoS request back to defaults if it was set */
if (pdev->cpu_id == AMD_CPU_ID_CZN)
cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req,
PM_QOS_DEFAULT_VALUE);

/* Notify on failed entry */
amd_pmc_validate_deepest(pdev);
}
Expand Down Expand Up @@ -887,7 +862,6 @@ static int amd_pmc_probe(struct platform_device *pdev)
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");

amd_pmc_dbgfs_register(dev);
cpu_latency_qos_add_request(&dev->amd_pmc_pm_qos_req, PM_QOS_DEFAULT_VALUE);
return 0;

err_pci_dev_put:
Expand Down

0 comments on commit 0d64787

Please sign in to comment.