accel/amdxdna: move get PMF data and query sensors to common code + AIE4 temp support#1286
Open
accel/amdxdna: move get PMF data and query sensors to common code + AIE4 temp support#1286
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors sensor/PMF metric handling in the AMD XDNA accel driver by moving duplicated “get PMF data + query sensors” logic into common AIE code, while also extending the UAPI/implementation to report a temperature sensor (and enabling sensors query on AIE4).
Changes:
- Add
AMDXDNA_SENSOR_TYPE_TEMPERATUREto the UAPI and report NPU temperature via the sensors query. - Introduce a shared
amdxdna_query_sensors()implementation inaie.cand route AIE2/AIE4 GET_INFO sensor queries to it. - Centralize PMF access macros into
aie.hand update NPU4 PMF metrics retrieval to use the common macro.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| include/uapi/drm/amdxdna_accel.h | Extends sensor type enum with temperature. |
| drivers/accel/amdxdna/npu4_regs.c | Switches to common PMF metrics macro and drops direct PMF header include. |
| drivers/accel/amdxdna/aie4_pci.c | Adds GET_INFO handling for DRM_AMDXDNA_QUERY_SENSORS on AIE4. |
| drivers/accel/amdxdna/aie2_pci.h | Removes AIE2-specific PMF macro helpers (moved to common code). |
| drivers/accel/amdxdna/aie2_pci.c | Replaces local sensor query implementation with amdxdna_query_sensors(). |
| drivers/accel/amdxdna/aie.h | Adds common PMF macro helpers and declares amdxdna_query_sensors(). |
| drivers/accel/amdxdna/aie.c | Implements shared amdxdna_query_sensors() and adds temperature reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
maxzhen
requested changes
May 4, 2026
…ayer Move aie2_get_sensors() from aie2_pci.c to aie.c, renaming to amdxdna_query_sensors(). Add parameter for total columns for different devices. Update call site in aie2_pci.c and add call site inside aie4_pci.c to enable query sensors for aie4 devices. Move AIE2_GET_PMF_NPU_METRICS / AIE2_GET_PMF_NPU_DATA from aie2_pci.h to aie.h, renaming them to AIE_GET_PMF_NPU_METRICS / AIE_GET_PMF_NPU_DATA. Both aie2 and aie4 now include linux/amd-pmf-io.h through aie.h, so the direct include in npu4_regs.c is dropped. Call site in aie4_pci.c is for npu3 device to return estimated power for command xrt-smi examine -r platform Signed-off-by: Hayden Laccabue <hlaccabu@amd.com>
maxzhen
reviewed
May 4, 2026
maxzhen
previously approved these changes
May 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add AMDXDNA_SENSOR_TYPE_TEMPERATURE to the amdxdna_sensor_type uAPI enum and add a corresponding entry into amdxdna_query_sensors(). Allows xrt-smi examine -r platform to populate temperature on NPUs whose PMF backend exposes amd_pmf_npu_metrics::npu_temp. Zero-initialize the on-stack amd_pmf_npu_metrics so platforms whose PMF arms do not write npu_temp report 0. Signed-off-by: Hayden Laccabue <hlaccabu@amd.com>
…one ioctl Signed-off-by: Hayden Laccabue <hlaccabu@amd.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.