[Deepin-Kernel-SIG] [linux 6.18.y] [FROMLIST] ACPI: CPPC: Add support for CPPC v4#1833
[Deepin-Kernel-SIG] [linux 6.18.y] [FROMLIST] ACPI: CPPC: Add support for CPPC v4#1833Avenger-285714 wants to merge 1 commit into
Conversation
CPPC v4 (ACPI 6.6, Section 8.4.6) adds two optional entries to the _CPC package: 1. OSPM Nominal Performance (8.4.6.1.2.6): A write-only register that lets OSPM inform the platform what it considers nominal performance. The platform classifies performance above this level as boost and below as throttle for its power/thermal decisions. 2. Resource Priority (8.4.6.1.2.7): A Package of Resource Priority Register Descriptor sub-packages that allow OSPM to set relative priority among processors for shared resources (boost, throttle, L2/L3 cache, memory bandwidth). Parsing the full structure is not yet supported; such entries are marked as unsupported. Add v4 _CPC table parsing (25 entries) and update REG_OPTIONAL to mark the two new registers as optional. Signed-off-by: Sumit Gupta <sumitg@nvidia.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Link: https://patch.msgid.link/20260527194626.185286-2-sumitg@nvidia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=71e1815113f7e37e7e39ed69526cd7d399e5a0c9 Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Reviewer's GuideAdds CPPC v4 support to ACPI CPPC parsing, including handling two new optional _CPC entries (OSPM Nominal Performance and Resource Priority), updating revision/entry-count validation, and extending register metadata and limits while treating Resource Priority as currently unsupported. Flow diagram for CPPC revision and entry-count handling in acpi_cppc_processor_probeflowchart TD
A[Start acpi_cppc_processor_probe] --> B[Read cpc_rev and num_ent]
B --> C{cpc_rev == CPPC_V2_REV
and num_ent != CPPC_V2_NUM_ENT}
C -->|yes| Z[pr_debug and goto out_free]
C -->|no| D{cpc_rev == CPPC_V3_REV
and num_ent != CPPC_V3_NUM_ENT}
D -->|yes| Z
D -->|no| E{cpc_rev == CPPC_V4_REV
and num_ent != CPPC_V4_NUM_ENT}
E -->|yes| Z
E -->|no| F{cpc_rev > CPPC_V4_REV
and num_ent <= CPPC_V4_NUM_ENT}
F -->|yes| Z
F -->|no| G{cpc_rev > CPPC_V4_REV}
G -->|yes| H[Set num_ent = CPPC_V4_NUM_ENT
and cpc_rev = CPPC_V4_REV]
G -->|no| I[Keep existing num_ent and cpc_rev]
H --> J[Set cpc_ptr->num_entries = num_ent]
I --> J
J --> K[Continue CPPC parsing]
Z --> L[Exit acpi_cppc_processor_probe]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The REG_OPTIONAL bitmap is now a larger magic constant (0x7FC7D0); consider expressing it in terms of BIT() and the enum cppc_regs indices so it’s obvious which fields are optional and easier to maintain when adding future CPPC fields.
- For the RESOURCE_PRIORITY package you synthesize an ACPI_TYPE_INTEGER with value 0 to mark it unsupported; it might be clearer and safer to either leave the type unset/invalid or introduce a dedicated “unsupported” representation so later code cannot mistake this for a legitimate integer-valued register.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The REG_OPTIONAL bitmap is now a larger magic constant (0x7FC7D0); consider expressing it in terms of BIT() and the enum cppc_regs indices so it’s obvious which fields are optional and easier to maintain when adding future CPPC fields.
- For the RESOURCE_PRIORITY package you synthesize an ACPI_TYPE_INTEGER with value 0 to mark it unsupported; it might be clearer and safer to either leave the type unset/invalid or introduce a dedicated “unsupported” representation so later code cannot mistake this for a legitimate integer-valued register.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
Adds ACPI CPPC v4 (_CPC revision 4) awareness to the CPPC ACPI library, extending the parsed register set to include the two new optional v4 entries while keeping behavior compatible with older revisions.
Changes:
- Add CPPC v4 revision/entry-count definitions and extend the CPC register index enum for the two new v4 fields.
- Update _CPC package validation/capping logic to treat v4 as the baseline for future supersets.
- Treat the v4 “Resource Priority” package as unsupported for now (mark unsupported and log a debug message).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| include/acpi/cppc_acpi.h | Adds CPPC v4 constants, extends register enumeration, and bumps max CPC register entries to fit v4 layout. |
| drivers/acpi/cppc_acpi.c | Updates optional-register bitmap, relaxes validation for v4 supersets, and adds handling for the v4 Resource Priority package type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pr_debug("Invalid entry type (%d) in _CPC for CPU:%d\n", | ||
| i, pr->id); |
CPPC v4 (ACPI 6.6, Section 8.4.6) adds two optional entries to the _CPC package:
OSPM Nominal Performance (8.4.6.1.2.6): A write-only register that lets OSPM inform the platform what it considers nominal performance. The platform classifies performance above this level as boost and below as throttle for its power/thermal decisions.
Resource Priority (8.4.6.1.2.7): A Package of Resource Priority Register Descriptor sub-packages that allow OSPM to set relative priority among processors for shared resources (boost, throttle, L2/L3 cache, memory bandwidth). Parsing the full structure is not yet supported; such entries are marked as unsupported.
Add v4 _CPC table parsing (25 entries) and update REG_OPTIONAL to mark the two new registers as optional.
Reviewed-by: Mario Limonciello (AMD) superm1@kernel.org
Reviewed-by: Pierre Gondois pierre.gondois@arm.com
Link: https://patch.msgid.link/20260527194626.185286-2-sumitg@nvidia.com
Link: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=71e1815113f7e37e7e39ed69526cd7d399e5a0c9
Summary by Sourcery
Add support for ACPI CPPC v4 _CPC packages while remaining backward compatible with earlier revisions.
New Features:
Enhancements: