Skip to content

[Deepin-Kernel-SIG] [linux 6.18.y] [FROMLIST] ACPI: CPPC: Add support for CPPC v4#1833

Open
Avenger-285714 wants to merge 1 commit into
deepin-community:linux-6.18.yfrom
Avenger-285714:cppcv4-6.18
Open

[Deepin-Kernel-SIG] [linux 6.18.y] [FROMLIST] ACPI: CPPC: Add support for CPPC v4#1833
Avenger-285714 wants to merge 1 commit into
deepin-community:linux-6.18.yfrom
Avenger-285714:cppcv4-6.18

Conversation

@Avenger-285714

@Avenger-285714 Avenger-285714 commented Jun 9, 2026

Copy link
Copy Markdown
Member

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.

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:

  • Support CPPC v4 _CPC packages including the two new OSPM Nominal Performance and Resource Priority entries.

Enhancements:

  • Relax CPPC _CPC package validation to treat v4 as the new baseline for future supersets and cap higher revisions to the v4 layout.
  • Extend the optional-register bitmap and maximum CPC register entries to cover the additional CPPC v3/v4 fields.
  • Gracefully handle unsupported Resource Priority packages by marking them as unsupported and logging a debug message.

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>
@Avenger-285714 Avenger-285714 requested review from Copilot and opsiff June 9, 2026 16:30
@sourcery-ai

sourcery-ai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds 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_probe

flowchart 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]
Loading

File-Level Changes

Change Details Files
Extend CPPC revision and entry-count handling to support CPPC v4 _CPC packages.
  • Introduce CPPC_V4_REV and CPPC_V4_NUM_ENT constants for the new revision and its expected 25 entries
  • Update the _CPC package validation logic to treat v4 as the current baseline and ensure future revisions are proper supersets of v4
  • Clamp revisions greater than v4 down to v4 and cap the parsed entry count at the v4 number of entries
drivers/acpi/cppc_acpi.c
include/acpi/cppc_acpi.h
Add new CPPC register indices for the v4-only entries and increase internal limits.
  • Extend the cppc_regs enum with OSPM_NOMINAL_PERF and RESOURCE_PRIORITY indices at the end
  • Increase MAX_CPC_REG_ENT to cover the additional registers introduced in later CPPC revisions
include/acpi/cppc_acpi.h
Adjust optional-register bitmask and implement stub handling for Resource Priority entries in _CPC.
  • Modify the REG_OPTIONAL bitmask so that the new CPPC v4 registers are treated as optional
  • When a RESOURCE_PRIORITY entry appears as a package, log a debug message, mark it as unsupported, and store a dummy integer value instead of rejecting _CPC parsing
drivers/acpi/cppc_acpi.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from avenger-285714. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread drivers/acpi/cppc_acpi.c
Comment on lines 865 to 866
pr_debug("Invalid entry type (%d) in _CPC for CPU:%d\n",
i, pr->id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants