Skip to content

ACPI / cpufreq: CPPC: Preserve OSPM-set registers and add ospm_nominal_perf

Sumit Gupta acpica-devel linux-acpi linux-pm linux-tegra lkml 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v9 Latest8 patches 5 repliesIn review
  2. v75 patches 2 repliesSuperseded
  3. v65 patches 5 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v54 patches7 repliesSuperseded
v44 patches12 repliesSuperseded
v34 patches8 repliesSuperseded
v23 patches7 repliesSuperseded
v11 patch8 repliesSuperseded

Changes in v9 from the cover letter

- Combine the two series into one. (Christian, Rafael)
- Rebase on 7.4-rc1.
- Add Christian's tags.

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8ACPI: CPPC: Order performance-control updatesdrivers/acpi/cppc_acpi.c drivers/cpufreq/cppc_cpufreq.c include/acpi/cppc_acpi.h+348 -922 replies
2/8cpufreq: CPPC: Keep the policy across CPU hotplugdrivers/cpufreq/cppc_cpufreq.c+97 -90 replies
3/8ACPI: CPPC: Make autonomous selection helpers take a u64drivers/acpi/cppc_acpi.c drivers/cpufreq/amd-pstate.c drivers/cpufreq/cppc_cpufreq.c +1 more+11 -230 replies
4/8cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unloaddrivers/cpufreq/cppc_cpufreq.c+222 -50 replies
5/8cpufreq: CPPC: Preserve OSPM-set registers across suspend/resumedrivers/cpufreq/cppc_cpufreq.c+62 -120 replies
6/8ACPI: CPPC: Add ospm_nominal_perf supportdrivers/acpi/cppc_acpi.c include/acpi/cppc_acpi.h+54 -03 replies
7/8cpufreq: CPPC: Add ospm_nominal_freq attributeDocumentation/ABI/testing/sysfs-devices-system-cpu drivers/cpufreq/cppc_cpufreq.c+121 -70 replies
8/8cpufreq: CPPC: Reflect the OSPM nominal in boost and limitsDocumentation/ABI/testing/sysfs-devices-system-cpu drivers/cpufreq/cppc_cpufreq.c+73 -30 replies

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchChristian LoehleK Prateek Nayak
1/8
2/8R-b T-b
3/8R-b T-b R-b T-b
4/8T-b
5/8T-b
6/8R-b
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v9 thread

Cover letter [PATCH v9 0/8] ACPI / cpufreq: CPPC: Preserve OSPM-set registers and add ospm_nominal_perf

This series combines two series, as the second one builds on the first:
- Patches 1-5:
cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload, v7 [1].
- Patches 6-8:
ACPI / cpufreq: CPPC: Add ospm_nominal_perf support, v8 [2].

There are no code changes from those versions. The series applies on 7.4-rc1.

Patches 1-5
-----------
These preserve the OSPM-set CPPC registers (Energy Performance Preference, Autonomous Activity Window, Autonomous Selection - set via sysfs) across CPU hotplug and suspend/resume. On driver unload, they put back the values the registers had before the driver loaded.

To do this, the driver keeps the CPPC cpufreq policy alive across CPU hotplug. It also orders the performance-control writes in cppc_set_perf(), so that restoring them after a platform reset never sends an invalid request.

Without online()/offline() callbacks, the core tears a policy down when its last CPU goes offline and rebuilds it on the way back, re-reading the CPPC capabilities each time. The values written to these registers can be lost:

- Across CPU hotplug or suspend/resume: the platform may reset them while the CPU is offline or suspended.
- On driver unload: the driver-written value is left in the register instead of returning to its pre-driver state.

Handle these with:

- Patch 1: orders the Desired, MIN and MAX writes in cppc_set_perf(), so that the platform never sees an invalid request.
- Patch 2: adds online()/offline() callbacks so the core keeps policy alive across CPU hotplug instead of tearing it down and rebuilding it.
- Patch 3: makes the autonomous selection register helpers take a u64.
- Patch 4: saves each register's firmware value at init() and each successful sysfs write as the requested value. offline() restores the firmware values, and online() reapplies the requested values.
- Patch 5: extends the same restore and reapply to system suspend/resume.

Patches 6-8
-----------
These add support for the OSPM Nominal Performance register (ACPI 6.6, Section 8.4.6.1.2.6) to the CPPC ACPI and cpufreq drivers.

Unlike the read-only Nominal Performance register, OSPM Nominal Performance is writable and lets OSPM request a nominal level below the platform-reported nominal. The platform treats performance above this level as boost and below as throttle.

- Patch 6: adds ACPI helpers to write the register and to check that the platform supports it.
- Patch 7: adds the per-policy ospm_nominal_freq attribute in kHz. The value is kept across CPU hotplug and suspend/resume. The register cannot be read back, so a read returns the last value written.
- Patch 8: uses the OSPM nominal as the maximum frequency while boost is off. Lowering the nominal creates a boost range on a platform that has none, and boost can then be enabled.

v8 -> v9:
- Combine the two series into one. (Christian, Rafael)
- Rebase on 7.4-rc1.
- Add Christian's tags.

Christian Loehle (1):
ACPI: CPPC: Order performance-control updates

Sumit Gupta (7):
cpufreq: CPPC: Keep the policy across CPU hotplug
ACPI: CPPC: Make autonomous selection helpers take a u64
cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload
cpufreq: CPPC: Preserve OSPM-set registers across suspend/resume
ACPI: CPPC: Add ospm_nominal_perf support
cpufreq: CPPC: Add ospm_nominal_freq attribute
cpufreq: CPPC: Reflect the OSPM nominal in boost and limits

 .../ABI/testing/sysfs-devices-system-cpu      |  31 +
 drivers/acpi/cppc_acpi.c                      | 362 +++++++--
 drivers/cpufreq/amd-pstate.c                  |   2 +-
 drivers/cpufreq/cppc_cpufreq.c                | 689 ++++++++++++++++--
 include/acpi/cppc_acpi.h                      |  19 +-
 5 files changed, 970 insertions(+), 133 deletions(-)

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

Signature · 1 line
2.34.1