libpmc: Query hwpmc for caps

This change allows for fine-grained capabilities per counter index. This
is particularly useful for AMD where subclasses are not exposed to the
general PMC code, but other architectures also have asymmetric behaviors
when it comes to specific counter indices.

A new PMC_OP_GETCAPS op is added to the hwpmc(4) ioctl interface.

Reviewed by:	mhorne
Sponsored by:	Netflix
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2058
This commit is contained in:
Ali Mashtizadeh
2026-03-01 22:08:30 +00:00
committed by Mitchell Horne
parent f0e0c4c529
commit 44a983d249
5 changed files with 87 additions and 11 deletions
+4
View File
@@ -325,6 +325,10 @@ This operation returns to the caller after the write operation
has returned.
The returned error code reflects any pending error state inside
.Nm .
.It Dv PMC_OP_GETCAPS
Retrieve the capabilities associated with a specific PMC counter.
Some capabilities may be limited to specific indices (i.e., not available
across all counters within a class).
.It Dv PMC_OP_GETCPUINFO
Retrieve information about the highest possible CPU number for the system,
and the number of hardware performance monitoring counters available per CPU.