[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240217005738.3744121-20-atishp@rivosinc.com>
Date: Fri, 16 Feb 2024 16:57:37 -0800
From: Atish Patra <atishp@...osinc.com>
To: linux-kernel@...r.kernel.org
Cc: Atish Patra <atishp@...osinc.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Alexandre Ghiti <alexghiti@...osinc.com>,
Andrew Jones <ajones@...tanamicro.com>,
Anup Patel <anup@...infault.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Atish Patra <atishp@...shpatra.org>,
Christian Brauner <brauner@...nel.org>,
Clément Léger <cleger@...osinc.com>,
Conor Dooley <conor@...nel.org>,
devicetree@...r.kernel.org,
Evan Green <evan@...osinc.com>,
Guo Ren <guoren@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Ian Rogers <irogers@...gle.com>,
Ingo Molnar <mingo@...hat.com>,
James Clark <james.clark@....com>,
Jing Zhang <renyu.zj@...ux.alibaba.com>,
Jiri Olsa <jolsa@...nel.org>,
Ji Sheng Teoh <jisheng.teoh@...rfivetech.com>,
John Garry <john.g.garry@...cle.com>,
Jonathan Corbet <corbet@....net>,
Kan Liang <kan.liang@...ux.intel.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
kvm-riscv@...ts.infradead.org,
kvm@...r.kernel.org,
Ley Foon Tan <leyfoon.tan@...rfivetech.com>,
linux-doc@...r.kernel.org,
linux-perf-users@...r.kernel.org,
linux-riscv@...ts.infradead.org,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Peter Zijlstra <peterz@...radead.org>,
Rob Herring <robh+dt@...nel.org>,
Samuel Holland <samuel.holland@...ive.com>,
Weilin Wang <weilin.wang@...el.com>,
Will Deacon <will@...nel.org>,
kaiwenxue1@...il.com,
Yang Jihong <yangjihong1@...wei.com>
Subject: [PATCH RFC 19/20] RISC-V: Add hwprobe support for Counter delegation extensions
Even though the counter delegation extensions are all S-mode extension,
perf tool can use it decide whether it wants to map standard events
or not. Remapping is not required for if SBI PMU is being used
for hardware events.
Signed-off-by: Atish Patra <atishp@...osinc.com>
---
Documentation/arch/riscv/hwprobe.rst | 10 ++++++++++
arch/riscv/include/uapi/asm/hwprobe.h | 4 ++++
arch/riscv/kernel/sys_hwprobe.c | 3 +++
3 files changed, 17 insertions(+)
diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst
index b2bcc9eed9aa..77fa0ed09366 100644
--- a/Documentation/arch/riscv/hwprobe.rst
+++ b/Documentation/arch/riscv/hwprobe.rst
@@ -188,6 +188,16 @@ The following keys are defined:
manual starting from commit 95cf1f9 ("Add changes requested by Ved
during signoff")
+ * :c:macro:`RISCV_HWPROBE_EXT_SMCDELEG`: The Smcdeleg extension is supported as
+ defined in the RISC-V Counter Delegation extension manual starting from
+ commit ff61c1f ("switch to v1.0.0 and frozen")
+ * :c:macro:`RISCV_HWPROBE_EXT_SSCCFG`: The Ssccfg extension is supported as
+ defined in the RISC-V Counter Delegation extension manual starting from
+ commit ff61c1f ("switch to v1.0.0 and frozen")
+ * :c:macro:`RISCV_HWPROBE_EXT_SSCSRIND`: The Sscsrind extension is supported as
+ defined in the RISC-V Indirect CSR extension manual starting from
+ commit a28625c ("mark spec as frozen")
+
* :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance
information about the selected set of processors.
diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h
index 9f2a8e3ff204..fb7c6bd6822a 100644
--- a/arch/riscv/include/uapi/asm/hwprobe.h
+++ b/arch/riscv/include/uapi/asm/hwprobe.h
@@ -59,6 +59,10 @@ struct riscv_hwprobe {
#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33)
#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34)
#define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35)
+#define RISCV_HWPROBE_EXT_SSCSRIND (1ULL << 36)
+#define RISCV_HWPROBE_EXT_SMCDELEG (1ULL << 37)
+#define RISCV_HWPROBE_EXT_SSCCFG (1ULL << 38)
+
#define RISCV_HWPROBE_KEY_CPUPERF_0 5
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)
diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c
index a7c56b41efd2..befb6582b1ce 100644
--- a/arch/riscv/kernel/sys_hwprobe.c
+++ b/arch/riscv/kernel/sys_hwprobe.c
@@ -111,6 +111,9 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
EXT_KEY(ZTSO);
EXT_KEY(ZACAS);
EXT_KEY(ZICOND);
+ EXT_KEY(SSCSRIND);
+ EXT_KEY(SMCDELEG);
+ EXT_KEY(SSCCFG);
if (has_vector()) {
EXT_KEY(ZVBB);
--
2.34.1
Powered by blists - more mailing lists