RISC-V: Move counter info definition to sbi header file
authorAtish Patra <atishp@rivosinc.com>
Mon, 11 Jul 2022 17:46:31 +0000 (10:46 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 11 Aug 2022 21:58:22 +0000 (14:58 -0700)
Counter info encoding format is defined by the SBI specificaiton.
KVM implementation of SBI PMU extension will also leverage this definition.
Move the definition to common sbi header file from the sbi pmu driver.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20220711174632.4186047-5-atishp@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/sbi.h
drivers/perf/riscv_pmu_sbi.c

index 9e3c2cf..d633ac0 100644 (file)
@@ -122,6 +122,20 @@ enum sbi_ext_pmu_fid {
        SBI_EXT_PMU_COUNTER_FW_READ,
 };
 
+union sbi_pmu_ctr_info {
+       unsigned long value;
+       struct {
+               unsigned long csr:12;
+               unsigned long width:6;
+#if __riscv_xlen == 32
+               unsigned long reserved:13;
+#else
+               unsigned long reserved:45;
+#endif
+               unsigned long type:1;
+       };
+};
+
 #define RISCV_PMU_RAW_EVENT_MASK GENMASK_ULL(55, 0)
 #define RISCV_PMU_RAW_EVENT_IDX 0x20000
 
index bae614c..2412454 100644 (file)
 #include <asm/sbi.h>
 #include <asm/hwcap.h>
 
-union sbi_pmu_ctr_info {
-       unsigned long value;
-       struct {
-               unsigned long csr:12;
-               unsigned long width:6;
-#if __riscv_xlen == 32
-               unsigned long reserved:13;
-#else
-               unsigned long reserved:45;
-#endif
-               unsigned long type:1;
-       };
-};
-
 /*
  * RISC-V doesn't have hetergenous harts yet. This need to be part of
  * per_cpu in case of harts with different pmu counters