From a9c4e0c3714858fa00f1f7bfbf9804ca6cf8965b Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 11 Nov 2021 16:15:08 +0100 Subject: [PATCH] ac/spm: fix determining the counter slot Signed-off-by: Samuel Pitoiset Fixes: e928f475ccf ("ac: add initial SPM support") Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/amd/common/ac_spm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/common/ac_spm.c b/src/amd/common/ac_spm.c index f64e86711e2..04a9426fca4 100644 --- a/src/amd/common/ac_spm.c +++ b/src/amd/common/ac_spm.c @@ -103,7 +103,7 @@ ac_spm_map_counter(struct ac_spm_trace_data *spm_trace, /* Generic blocks. */ for (unsigned i = 0; i < block_sel->num_counters; i++) { struct ac_spm_counter_select *cntr_sel = &block_sel->counters[i]; - int index = ffs(~cntr_sel->active); + int index = ffs(~cntr_sel->active) - 1; switch (index) { case 0: /* use S_037004_PERF_SEL */