Add Qualcomm NPU monitoring support#488
Open
Srinivas-Kandagatla wants to merge 3 commits into
Open
Conversation
added 3 commits
July 3, 2026 07:33
Add support for monitoring the Qualcomm NPU (Neural Processing Unit) via the qcnpuperf library. The driver reports Q6 utilization and clock speed, HVX and HMX utilization, temperature, and system memory usage. The DSP session is opened with qcom_dsp_open() in get_device_handles() and stored as an opaque qcom_dsp_ctx pointer in the per-device struct. qcom_dsp_get_arch_version() is used to form the device name as "Qualcomm Hexagon vXX NPU" where XX is the Hexagon ISA version. NSP thermal zones are discovered at startup by scanning /sys/class/thermal/thermal_zone*/type for entries whose type starts with "nsp". The hottest zone is reported as the NPU temperature on each refresh, avoiding hardcoded zone numbers that differ across SoCs. System memory (from /proc/meminfo) is reported as device memory since the Hexagon DSP shares the host DRAM. The driver is built as part of MSM_SUPPORT and depends on qcnpuperf (found via pkg-config). Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Add a unit_name field to struct gpu_vendor so drivers can declare what kind of compute unit they represent (e.g. "NPU"). The interface uses this label in utilization meters, clock display, plot legends, and the integrated-device label, falling back to "GPU" when unset so existing drivers are unaffected. Pass the device list into populate_plot_data_from_ring_buffer() and draw_plots() so each plot legend can be prefixed with the correct unit name rather than the hardcoded "GPU" string. The Qualcomm NPU driver sets unit_name = "NPU", so its utilization bar, clock field, and plots now read "NPU" rather than "GPU". Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Add plot_hvx_util_rate and plot_hmx_util_rate to the plot information enum and wire up data collection in save_current_data_to_ring() and legend labels in populate_plot_data_from_ring_buffer(). Introduce plot_npu_default_draw_info() which extends the standard default with HVX and HMX plots. Devices whose vendor sets unit_name (i.e. NPU-like devices) get HVX and HMX in their default plot at startup; regular GPU devices are unaffected. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.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.
This series adds real-time monitoring of the Qualcomm Hexagon DSP/NPU
to nvtop, targeting Qualcomm SoCs.
Monitoring is implemented via the libqcnpuperf library [1], which uses
the FastRPC sysmon query interface to collect per-sample profiling data
from the DSP firmware. The library is separate from nvtop and must be
installed (pkg-config: qcnpuperf).
Patch 1 adds the core driver. It reports:
ISA version read via FASTRPC_IOCTL_GET_DSP_INFO at startup.
scanning /sys/class/thermal at startup, so no zone numbers are
hardcoded.
host DRAM.
Patches 2 and 3 extend the generic interface layer to carry these
new metrics cleanly:
Patch 2 adds a unit_name field to struct gpu_vendor so a driver
can advertise "NPU" instead of "GPU" in utilisation bars, clock
labels, and plot legends. Existing drivers are unaffected
(unit_name defaults to "GPU" when unset).
Patch 3 adds HVX and HMX time-series plots to the default plot
set for devices that set unit_name (i.e. NPU-class devices),
keeping the GPU plot layout unchanged.
Tested on a Snapdragon X Elite (SC8380XP), Arduino VENTUNO-Q running a mainline kernel.
There are few things that could be potentially added in future are Memory Bandwidth metrics and Process list.
[1] https://github.com/qualcomm/libqcnpuperf