]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf arm-spe: Don't hard code config attribute
authorJames Clark <james.clark@linaro.org>
Wed, 14 Jan 2026 15:57:26 +0000 (15:57 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Jan 2026 02:16:43 +0000 (23:16 -0300)
Use the config attribute that's published by the driver instead of
hard coding "attr.config".

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/arm64/util/arm-spe.c

index 51014f8bff97a8d434eb706de6c8f92d83915e28..17ced7bbbddaf15d52050990327c7ca074c3b411 100644 (file)
@@ -256,7 +256,7 @@ static __u64 arm_spe_pmu__sample_period(const struct perf_pmu *arm_spe_pmu)
 
 static void arm_spe_setup_evsel(struct evsel *evsel, struct perf_cpu_map *cpus)
 {
-       u64 bit;
+       u64 pa_enable_bit;
 
        evsel->core.attr.freq = 0;
        evsel->core.attr.sample_period = arm_spe_pmu__sample_period(evsel->pmu);
@@ -288,9 +288,10 @@ static void arm_spe_setup_evsel(struct evsel *evsel, struct perf_cpu_map *cpus)
         * inform that the resulting output's SPE samples contain physical addresses
         * where applicable.
         */
-       bit = perf_pmu__format_bits(evsel->pmu, "pa_enable");
-       if (evsel->core.attr.config & bit)
-               evsel__set_sample_bit(evsel, PHYS_ADDR);
+
+       if (!evsel__get_config_val(evsel, "pa_enable", &pa_enable_bit))
+               if (pa_enable_bit)
+                       evsel__set_sample_bit(evsel, PHYS_ADDR);
 }
 
 static int arm_spe_setup_aux_buffer(struct record_opts *opts)
@@ -397,6 +398,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
        struct perf_cpu_map *cpus = evlist->core.user_requested_cpus;
        bool discard = false;
        int err;
+       u64 discard_bit;
 
        sper->evlist = evlist;
 
@@ -425,9 +427,8 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
        evlist__for_each_entry_safe(evlist, tmp, evsel) {
                if (evsel__is_aux_event(evsel)) {
                        arm_spe_setup_evsel(evsel, cpus);
-                       if (evsel->core.attr.config &
-                           perf_pmu__format_bits(evsel->pmu, "discard"))
-                               discard = true;
+                       if (!evsel__get_config_val(evsel, "discard", &discard_bit))
+                               discard = !!discard_bit;
                }
        }