]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drivers/perf: riscv: Add SBI v3.0 flag
authorAtish Patra <atishp@rivosinc.com>
Tue, 9 Sep 2025 07:03:20 +0000 (00:03 -0700)
committerAnup Patel <anup@brainfault.org>
Tue, 16 Sep 2025 06:19:30 +0000 (11:49 +0530)
There are new PMU related features introduced in SBI v3.0.
1. Raw Event v2 which allows mhpmeventX value to be 56 bit wide.
2. Get Event info function to do a bulk query at one shot.

Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Acked-by: Paul Walmsley <pjw@kernel.org>
Link: https://lore.kernel.org/r/20250909-pmu_event_info-v6-1-d8f80cacb884@rivosinc.com
Signed-off-by: Anup Patel <anup@brainfault.org>
drivers/perf/riscv_pmu_sbi.c

index 698de8ddf895ba8528c1b0acb5220d157f5f89a1..cfd6946fca42e6cfe0623926764f6bbede1fddcc 100644 (file)
@@ -63,6 +63,7 @@ PMU_FORMAT_ATTR(event, "config:0-47");
 PMU_FORMAT_ATTR(firmware, "config:62-63");
 
 static bool sbi_v2_available;
+static bool sbi_v3_available;
 static DEFINE_STATIC_KEY_FALSE(sbi_pmu_snapshot_available);
 #define sbi_pmu_snapshot_available() \
        static_branch_unlikely(&sbi_pmu_snapshot_available)
@@ -1452,6 +1453,9 @@ static int __init pmu_sbi_devinit(void)
        if (sbi_spec_version >= sbi_mk_version(2, 0))
                sbi_v2_available = true;
 
+       if (sbi_spec_version >= sbi_mk_version(3, 0))
+               sbi_v3_available = true;
+
        ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_RISCV_STARTING,
                                      "perf/riscv/pmu:starting",
                                      pmu_sbi_starting_cpu, pmu_sbi_dying_cpu);