* [PATCH v4 1/3] clocksource: acpi_pm: Add stubs for suspend/resume callback helpers
2026-11-19 3:01 [PATCH v4 0/3] platform/x86/intel/pmc: Disable ACPI PM timer during suspend on PTL Tzung-Bi Shih
@ 2026-11-19 3:01 ` Tzung-Bi Shih
2026-11-19 3:01 ` [PATCH v4 2/3] platform/x86/intel/pmc: Support disabling ACPI PM timer during suspend Tzung-Bi Shih
2026-11-19 3:01 ` [PATCH v4 3/3] platform/x86/intel/pmc: Disable ACPI PM timer during suspend on Panther Lake Tzung-Bi Shih
2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-11-19 3:01 UTC (permalink / raw)
To: Rajneesh Bhardwaj, Xi Pardee, Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86, tzungbi, linux-kernel, tfiga
Commit 56bd72e9cd82 ("clocksource: acpi_pm: Add external callback for
suspend/resume") declared acpi_pmtmr_register_suspend_resume_callback()
and acpi_pmtmr_unregister_suspend_resume_callback() only under
CONFIG_X86_PM_TIMER.
Provide static inline stubs in the #else branch so callers can guard
registration with IS_ENABLED(CONFIG_X86_PM_TIMER).
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v4:
- New to the series.
---
include/linux/acpi_pmtmr.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/acpi_pmtmr.h b/include/linux/acpi_pmtmr.h
index cceed294d0b5..94ddc04fe3f1 100644
--- a/include/linux/acpi_pmtmr.h
+++ b/include/linux/acpi_pmtmr.h
@@ -48,6 +48,11 @@ static inline u32 acpi_pm_read_early(void)
return 0;
}
+static inline void acpi_pmtmr_register_suspend_resume_callback(void (*cb)(void *data, bool suspend),
+ void *data) {}
+
+static inline void acpi_pmtmr_unregister_suspend_resume_callback(void) {}
+
#endif
#endif
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v4 2/3] platform/x86/intel/pmc: Support disabling ACPI PM timer during suspend
2026-11-19 3:01 [PATCH v4 0/3] platform/x86/intel/pmc: Disable ACPI PM timer during suspend on PTL Tzung-Bi Shih
2026-11-19 3:01 ` [PATCH v4 1/3] clocksource: acpi_pm: Add stubs for suspend/resume callback helpers Tzung-Bi Shih
@ 2026-11-19 3:01 ` Tzung-Bi Shih
2026-11-19 3:01 ` [PATCH v4 3/3] platform/x86/intel/pmc: Disable ACPI PM timer during suspend on Panther Lake Tzung-Bi Shih
2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-11-19 3:01 UTC (permalink / raw)
To: Rajneesh Bhardwaj, Xi Pardee, Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86, tzungbi, linux-kernel, tfiga
The ACPI PM timer is used to drive the ACPI Watchdog Action Table
(wdat_wdt) hardware watchdog. Since the watchdog is stopped during
suspend, the timer does not need to remain active while suspended, and
leaving it running can block deep S0ix states.
Add acpi_pm_tmr_ctl_offset and acpi_pm_tmr_disable_bit to
struct pmc_reg_map so platforms can opt in to disabling the ACPI PM
timer on suspend and re-enabling it on resume only if it was enabled
prior to suspend.
When CONFIG_X86_PM_TIMER is set, toggle the timer via
acpi_pmtmr_register_suspend_resume_callback() so it runs inside
clocksource_suspend()/clocksource_resume() and never stops an active
acpi_pm clocksource while timekeeping reads it.
When CONFIG_X86_PM_TIMER is not set, fall back to
pmc_core_suspend()/pmc_core_resume().
Unlike commit e86c8186d03a ("platform/x86:intel/pmc: Enable the ACPI PM
Timer to be turned off when suspended"), which was later reverted in
commit 5fa607880168 ("platform/x86:intel/pmc: Revert "Enable the ACPI
PM Timer to be turned off when suspended""), access the register
without pmcdev->lock so it is safe in tick_freeze() atomic context.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v4:
- New to the series.
- Move code from ptl specific into common path (pmc_core).
---
drivers/platform/x86/intel/pmc/core.c | 49 +++++++++++++++++++++++++++
drivers/platform/x86/intel/pmc/core.h | 11 ++++++
2 files changed, 60 insertions(+)
diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 47759b2a8012..8d9b6962e3bc 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -16,6 +16,7 @@ enum header_type {
HEADER_VALUE,
};
+#include <linux/acpi_pmtmr.h>
#include <linux/bitfield.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -1923,6 +1924,38 @@ static void pmc_core_clean_structure(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
}
+static void pmc_core_set_acpi_pm_timer(void *data, bool suspend)
+{
+ struct pmc_dev *pmcdev = data;
+ struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
+ const struct pmc_reg_map *map;
+ u8 val, old_val;
+
+ if (!pmc || !pmc->regbase || !pmc->map)
+ return;
+
+ map = pmc->map;
+ if (!map->acpi_pm_tmr_ctl_offset)
+ return;
+
+ if (!suspend && !pmcdev->pm_timer_enabled)
+ return;
+
+ val = readb(pmc->regbase + map->acpi_pm_tmr_ctl_offset);
+ old_val = val;
+
+ if (suspend) {
+ pmcdev->pm_timer_enabled = !(old_val & map->acpi_pm_tmr_disable_bit);
+ if (pmcdev->pm_timer_enabled)
+ val |= map->acpi_pm_tmr_disable_bit;
+ } else {
+ val &= ~map->acpi_pm_tmr_disable_bit;
+ }
+
+ if (val != old_val)
+ writeb(val, pmc->regbase + map->acpi_pm_tmr_ctl_offset);
+}
+
static int pmc_core_probe(struct platform_device *pdev)
{
static bool device_initialized;
@@ -1985,6 +2018,11 @@ static int pmc_core_probe(struct platform_device *pdev)
pm_report_max_hw_sleep(FIELD_MAX(SLP_S0_RES_COUNTER_MASK) *
pmc_core_adjust_slp_s0_step(primary_pmc, 1));
+ if (IS_ENABLED(CONFIG_X86_PM_TIMER) &&
+ primary_pmc->map->acpi_pm_tmr_ctl_offset)
+ acpi_pmtmr_register_suspend_resume_callback(pmc_core_set_acpi_pm_timer,
+ pmcdev);
+
device_initialized = true;
dev_info(&pdev->dev, " initialized\n");
@@ -1994,6 +2032,11 @@ static int pmc_core_probe(struct platform_device *pdev)
static void pmc_core_remove(struct platform_device *pdev)
{
struct pmc_dev *pmcdev = platform_get_drvdata(pdev);
+
+ if (IS_ENABLED(CONFIG_X86_PM_TIMER) &&
+ pmcdev->pmcs[PMC_IDX_MAIN]->map->acpi_pm_tmr_ctl_offset)
+ acpi_pmtmr_unregister_suspend_resume_callback();
+
pmc_core_dbgfs_unregister(pmcdev);
pmc_core_clean_structure(pdev);
}
@@ -2032,6 +2075,9 @@ static __maybe_unused int pmc_core_suspend(struct device *dev)
if (pmc_core_dev_state_get(pmc, &pmcdev->s0ix_counter))
return -EIO;
+ if (!IS_ENABLED(CONFIG_X86_PM_TIMER))
+ pmc_core_set_acpi_pm_timer(pmcdev, true);
+
return 0;
}
@@ -2124,6 +2170,9 @@ static __maybe_unused int pmc_core_resume(struct device *dev)
{
struct pmc_dev *pmcdev = dev_get_drvdata(dev);
+ if (!IS_ENABLED(CONFIG_X86_PM_TIMER))
+ pmc_core_set_acpi_pm_timer(pmcdev, false);
+
if (ltr_ignore_all_suspend)
pmc_core_ltr_restore_all(pmcdev);
diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h
index e55164e5807f..0ec874f2a992 100644
--- a/drivers/platform/x86/intel/pmc/core.h
+++ b/drivers/platform/x86/intel/pmc/core.h
@@ -362,6 +362,10 @@ enum ppfear_regs {
#define PMC_DEVID_NVL_PCDS 0xd47e
#define PMC_DEVID_NVL_PCHS 0x6e27
+/* ACPI PM timer */
+#define ACPI_TMR_CTL_OFFSET 0x18fc
+#define ACPI_TIM_DIS BIT(1)
+
extern const char *pmc_lpm_modes[];
struct pmc_bit_map {
@@ -392,6 +396,8 @@ struct pmc_bit_map {
* @num_s0ix_blocker: Number of S0ix blockers
* @blocker_req_offset: Telemetry offset to S0ix blocker low power mode substate requirement table
* @lpm_req_guid: Telemetry GUID to read low power mode substate requirement table
+ * @acpi_pm_tmr_ctl_offset: PWRMBASE offset to ACPI PM timer control register
+ * @acpi_pm_tmr_disable_bit: Bit mask to disable ACPI PM timer
*
* Each PCH has unique set of register offsets and bit indexes. This structure
* captures them to have a common implementation.
@@ -435,6 +441,9 @@ struct pmc_reg_map {
const u32 pson_residency_counter_step;
/* GUID for telemetry regions */
const u32 lpm_req_guid;
+ /* ACPI PM timer registers */
+ const u32 acpi_pm_tmr_ctl_offset;
+ const u8 acpi_pm_tmr_disable_bit;
};
/**
@@ -487,6 +496,7 @@ struct pmc {
* @s0ix_counter: S0ix residency (step adjusted)
* @suspend: Function to perform platform specific suspend
* @resume: Function to perform platform specific resume
+ * @pm_timer_enabled: Whether the ACPI PM timer was enabled before suspend
*
* @pkgc_ltr_blocker_counters: Array of PKGC LTR blocker counters
* @pkgc_ltr_blocker_offset: Offset to PKGC LTR blockers in telemetry region
@@ -506,6 +516,7 @@ struct pmc_dev {
u64 s0ix_counter;
void (*suspend)(struct pmc_dev *pmcdev);
int (*resume)(struct pmc_dev *pmcdev);
+ bool pm_timer_enabled;
u64 *pkgc_res_cnt;
u8 num_of_pkgc;
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v4 3/3] platform/x86/intel/pmc: Disable ACPI PM timer during suspend on Panther Lake
2026-11-19 3:01 [PATCH v4 0/3] platform/x86/intel/pmc: Disable ACPI PM timer during suspend on PTL Tzung-Bi Shih
2026-11-19 3:01 ` [PATCH v4 1/3] clocksource: acpi_pm: Add stubs for suspend/resume callback helpers Tzung-Bi Shih
2026-11-19 3:01 ` [PATCH v4 2/3] platform/x86/intel/pmc: Support disabling ACPI PM timer during suspend Tzung-Bi Shih
@ 2026-11-19 3:01 ` Tzung-Bi Shih
2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-11-19 3:01 UTC (permalink / raw)
To: Rajneesh Bhardwaj, Xi Pardee, Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86, tzungbi, linux-kernel, tfiga
When the ACPI PM timer is enabled by firmware on Panther Lake to drive
wdat_wdt, leaving it running during s2idle prevents S0i2.2 entry
(staying in S0i2.1).
Populate acpi_pm_tmr_ctl_offset (PWRMBASE + 0x18fc) and
acpi_pm_tmr_disable_bit (BIT(1)) in ptl_pcdp_reg_map to disable the
timer during suspend.
Tested on a Panther Lake Android desktop device (coreboot with
CONFIG_USE_PM_ACPI_TIMER=y, kernel 6.18 with CONFIG_X86_PM_TIMER=n,
wdat_wdt not active):
- Without patch:
S0i2.1: 100.00% (345,382 ms), S0i2.2: 0.00% (0 ms)
- With patch:
S0i2.1: 0.00% (11 ms), S0i2.2: 99.99% (343,699 ms)
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v4:
- Reduce to ptl_pcdp_reg_map opt-in using the common helper from patch 2.
- Add S0i2.1/S0i2.2 residency results to the commit message.
---
drivers/platform/x86/intel/pmc/ptl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/platform/x86/intel/pmc/ptl.c b/drivers/platform/x86/intel/pmc/ptl.c
index a7d5d4f77934..a38b099679b3 100644
--- a/drivers/platform/x86/intel/pmc/ptl.c
+++ b/drivers/platform/x86/intel/pmc/ptl.c
@@ -529,6 +529,8 @@ static const struct pmc_reg_map ptl_pcdp_reg_map = {
.num_s0ix_blocker = PTL_NUM_S0IX_BLOCKER,
.blocker_req_offset = PTL_BLK_REQ_OFFSET,
.lpm_req_guid = PCDP_LPM_REQ_GUID,
+ .acpi_pm_tmr_ctl_offset = ACPI_TMR_CTL_OFFSET,
+ .acpi_pm_tmr_disable_bit = ACPI_TIM_DIS,
};
static struct pmc_info ptl_pmc_info_list[] = {
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply [flat|nested] 4+ messages in thread