[PATCH v3 0/7] platform/x86/amd/pmf: Add 1AH_M80H support and accumulator based NPU metrics

Shyam Sundar S K <[email protected]> Thu, 23 Jul 2026 16:45:27 +0530
Newsgroups org.kernel.vger.platform-driver-x86
Message-ID <[email protected]>
This series cleans up the PMF-SMU mailbox handling, adds support for the
AMD 1AH_M80H (Family 1AH Model 80H) platform, and introduces NPU metrics
retrieval for it based on a firmware managed DRAM metrics table.

Today the SMU mailbox register offsets are hardcoded in the send path,
which does not scale to platforms that use a different mailbox layout.
The first two patches address this: patch 1 moves the offsets into a
per-SoC struct amd_pmf_smu_regs carried as PCI driver_data, so all
existing platforms share a single legacy instance and new platforms only
add a table entry. Patch 2 then adds the 1AH_M80H device/ACPI IDs and its
extended mailbox, which uses three argument registers to return the
64-bit DRAM address and size of the metrics table.

Patches 3 and 4 are pure refactors with no functional change: the metrics
code moves out of core.c into a dedicated metrics.c, and the NPU metrics
retrieval is restructured around a per-CPU-ID switch so additional table
formats can be slotted in cleanly.

Patch 5 builds on that to add 1AH_M80H NPU metrics. Unlike earlier
platforms that copy a transfer table, 1AH_M80H exposes an accumulator
based metrics table (amd_pmf_metrics_v3) in DRAM; NPU values are derived
by delta calculation between consecutive samples, with the first sample
discarded to seed the baseline. This also extends amd_pmf_npu_metrics
with npu_temp, sourced from the new npu_temp_acc accumulator.

The series applies cleanly and existing platforms see no functional
change.

This series is based on top of the review-ilpo-next branch, with commit
caf8342512c3 as the head.

v3:
- Include Missing headers
- Make a new patch for trailing blank line in dev_err() 

v2:
- Change the amd_pmf_legacy_smu_regs to amd_pmf_smu_regs_v1 and v2 for 1ah_m80h
- Remove arg0, arg1, arg2 comments wriiten in the amd_pmf_smu_regs_v2 struct
- Update git commit messages with amd_pmf_smu_regs_v1 and amd_pmf_smu_regs_v2 accordingly
- Add includes and introduce separate patch for upper/lower_32_bits()
- Use DIV_U64_ROUND_CLOSEST() instead of DIV_ROUND_CLOSEST_ULL()
- Use macros present in units.h
- Replace is_amd_pmf_1ah_m80h() with amd_pmf_supports_accumulator_metrics()
- Add Reviewed-by tags

Shyam Sundar S K (7):
  platform/x86/amd/pmf: Use per-SoC smu_regs struct for SMU mailbox
    registers
  platform/x86/amd/pmf: Add 1AH_M80H device IDs and extended SMU mailbox
    registers
  platform/x86/amd/pmf: Move metrics code to dedicated file
  platform/x86/amd/pmf: Add missing newline in dev_err message
  platform/x86/amd/pmf: Use upper/lower_32_bits() in
    amd_pmf_set_dram_addr()
  platform/x86/amd/pmf: Refactor NPU metrics for platform extensibility
  platform/x86/amd/pmf: Add 1AH_M80H metrics table and NPU metrics
    support

 drivers/platform/x86/amd/pmf/Makefile  |   2 +-
 drivers/platform/x86/amd/pmf/core.c    | 256 +++++++------------
 drivers/platform/x86/amd/pmf/metrics.c | 330 +++++++++++++++++++++++++
 drivers/platform/x86/amd/pmf/pmf.h     | 236 ++++++++++++++++++
 include/linux/amd-pmf-io.h             |   2 +
 5 files changed, 658 insertions(+), 168 deletions(-)
 create mode 100644 drivers/platform/x86/amd/pmf/metrics.c

-- 
2.34.1