summaryrefslogtreecommitdiff
path: root/drivers/perf/riscv_pmu_legacy.c
diff options
context:
space:
mode:
authorSergey Matyukevich <sergey.matyukevich@syntacore.com>2022-08-30 18:53:05 +0300
committerPalmer Dabbelt <palmer@rivosinc.com>2022-09-08 23:34:50 +0300
commit1537bf26e212ffcf007d0590958025f6bfdd4ac8 (patch)
treeb2a498f8d14239173d11ee1a97a7911b356504e9 /drivers/perf/riscv_pmu_legacy.c
parent82c75dca6f95c9ac4649031a493456156ddfec2f (diff)
downloadlinux-1537bf26e212ffcf007d0590958025f6bfdd4ac8.tar.xz
perf: RISC-V: exclude invalid pmu counters from SBI calls
SBI firmware may not provide information for some counters in response to SBI_EXT_PMU_COUNTER_GET_INFO call. Exclude such counters from the subsequent SBI requests. For this purpose use global mask to keep track of fully specified counters. Signed-off-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Link: https://lore.kernel.org/r/20220830155306.301714-3-geomatsi@gmail.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'drivers/perf/riscv_pmu_legacy.c')
-rw-r--r--drivers/perf/riscv_pmu_legacy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c
index 342778782359..7d7131c47bc0 100644
--- a/drivers/perf/riscv_pmu_legacy.c
+++ b/drivers/perf/riscv_pmu_legacy.c
@@ -14,7 +14,6 @@
#define RISCV_PMU_LEGACY_CYCLE 0
#define RISCV_PMU_LEGACY_INSTRET 1
-#define RISCV_PMU_LEGACY_NUM_CTR 2
static bool pmu_init_done;
@@ -83,7 +82,8 @@ static void pmu_legacy_init(struct riscv_pmu *pmu)
{
pr_info("Legacy PMU implementation is available\n");
- pmu->num_counters = RISCV_PMU_LEGACY_NUM_CTR;
+ pmu->cmask = BIT(RISCV_PMU_LEGACY_CYCLE) |
+ BIT(RISCV_PMU_LEGACY_INSTRET);
pmu->ctr_start = pmu_legacy_ctr_start;
pmu->ctr_stop = NULL;
pmu->event_map = pmu_legacy_event_map;