diff options
author | Atish Patra <atishp@rivosinc.com> | 2023-12-07 14:23:49 -0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-12-08 22:50:21 +0530 |
commit | ee725174bada254f8a081937d870feb837618d6e (patch) | |
tree | 12030a822aaa6cec70ed38aabd019cd860ce9eb7 /lib | |
parent | 93da66b7d40605c3288ba05e70de8ef1914cdb60 (diff) | |
download | opensbi-ee725174bada254f8a081937d870feb837618d6e.zip opensbi-ee725174bada254f8a081937d870feb837618d6e.tar.gz opensbi-ee725174bada254f8a081937d870feb837618d6e.tar.bz2 |
lib: sbi_pmu: Add PMU snapshot definitions
OpenSBI doesn't support SBI PMU snapshot yet as there is not much benefit
unless the multiple counters overflow at the same time.
Just add the definition and return not supported error at this moment. The
default returned error is also not supported. Thus, no functional change
intended.
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sbi/sbi_ecall_pmu.c | 2 | ||||
-rw-r--r-- | lib/sbi/sbi_pmu.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/sbi/sbi_ecall_pmu.c b/lib/sbi/sbi_ecall_pmu.c index 1d5d512..c585911 100644 --- a/lib/sbi/sbi_ecall_pmu.c +++ b/lib/sbi/sbi_ecall_pmu.c @@ -74,6 +74,8 @@ static int sbi_ecall_pmu_handler(unsigned long extid, unsigned long funcid, case SBI_EXT_PMU_COUNTER_STOP: ret = sbi_pmu_ctr_stop(regs->a0, regs->a1, regs->a2); break; + case SBI_EXT_PMU_SNAPSHOT_SET_SHMEM: + /* fallthrough as OpenSBI doesn't support snapshot yet */ default: ret = SBI_ENOTSUPP; } diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c index 4b0f5be..5f70730 100644 --- a/lib/sbi/sbi_pmu.c +++ b/lib/sbi/sbi_pmu.c @@ -442,6 +442,9 @@ int sbi_pmu_ctr_start(unsigned long cbase, unsigned long cmask, if ((cbase + sbi_fls(cmask)) >= total_ctrs) return ret; + if (flags & SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT) + return SBI_ENO_SHMEM; + if (flags & SBI_PMU_START_FLAG_SET_INIT_VALUE) bUpdate = true; @@ -540,6 +543,9 @@ int sbi_pmu_ctr_stop(unsigned long cbase, unsigned long cmask, if ((cbase + sbi_fls(cmask)) >= total_ctrs) return SBI_EINVAL; + if (flag & SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT) + return SBI_ENO_SHMEM; + for_each_set_bit(i, &cmask, BITS_PER_LONG) { cidx = i + cbase; event_idx_type = pmu_ctr_validate(phs, cidx, &event_code); |