[PATCH v8 10/17] perf header: In print_pmu_caps use perf_env e_machine

Ian Rogers
2026-05-02T07:00:13Z

Switch from arch to e_machine in print_pmu_caps.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/header.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 8d5152bde25d..c6436269df4b 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2348,15 +2348,16 @@ static void print_cpu_pmu_caps(struct feat_fd *ff, FILE *fp)
static void print_pmu_caps(struct feat_fd *ff, FILE *fp)
{
struct perf_env *env = &ff->ph->env;
- struct pmu_caps *pmu_caps;
+ uint16_t e_machine = perf_env__e_machine(env, /*e_flags=*/NULL);

for (int i = 0; i < env->nr_pmus_with_caps; i++) {
- pmu_caps = &env->pmu_caps[i];
+ struct pmu_caps *pmu_caps = &env->pmu_caps[i];
+
__print_pmu_caps(fp, pmu_caps->nr_caps, pmu_caps->caps,
pmu_caps->pmu_name);
}

- if (strcmp(perf_env__arch(env), "x86") == 0 &&
+ if ((e_machine == EM_X86_64 || e_machine == EM_386) &&
perf_env__has_pmu_mapping(env, "ibs_op")) {
char *max_precise = perf_env__find_pmu_cap(env, "cpu", "max_precise");

--
2.54.0.545.g6539524ca2-goog