From: Mayuresh Chitale <mayuresh.chitale@oss.qualcomm.com>
To: "Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Andrew Jones" <ajones@ventanamicro.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Andy Chiu" <andybnac@gmail.com>,
"Anup Patel" <anup@brainfault.org>,
"Atish Patra" <atish.patra@linux.dev>,
"Charlie Jenkins" <charlie@rivosinc.com>,
"Chunyan Zhang" <zhangchunyan@iscas.ac.cn>,
"Clément Léger" <cleger@rivosinc.com>,
"Conor Dooley" <conor+dt@kernel.org>,
"Deepak Gupta" <debug@rivosinc.com>,
"Guodong Xu" <docular.xu@gmail.com>,
"Guodong Xu" <guodong@riscstar.com>,
"Hui Wang" <hui.wang@canonical.com>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Mayuresh Chitale" <mayuresh.chitale@oss.qualcomm.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Paul Walmsley" <pjw@kernel.org>,
"Pincheng Wang" <pincheng.plct@isrc.iscas.ac.cn>,
"Rob Herring" <robh@kernel.org>,
"Sergey Matyukevich" <geomatsi@gmail.com>,
"Thomas Huth" <thuth@redhat.com>, "Will Deacon" <will@kernel.org>,
"Xu Lu" <luxu.kernel@bytedance.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: [RFC PATCH 0/3] RISC-V Sspesa: Linux perf precise sample attribution
Date: Mon, 17 Aug 2026 21:32:16 +0530 [thread overview]
Message-ID: <20260817160222.3313295-1-mayuresh.chitale@oss.qualcomm.com> (raw)
This Linux series adds kernel support for the RISC-V Performance Event
Sampling extensions Sspesa (Precise Event Sample Attribution) and
Ssplcofi (Precise Local Counter Overflow Interrupt).
The first two patches add the DT binding and ISA-extension detection
(Ssplcofi depends on Sspesa). The third patch uses shpmspc to report the
sample PC via PERF_SAMPLE_IP in the SBI PMU overflow handler, and
exports shpmsdata as PERF_SAMPLE_RAW.
Reproducing the full setup:
Sspesa support requires three projects: OpenSBI, Linux and QEMU. The
matching branches are:
OpenSBI: https://github.com/mdchitale/opensbi/tree/riscv_sspesa_rfc_v1
Linux: https://github.com/mdchitale/linux/tree/riscv_sspesa_rfc_v1
QEMU: https://github.com/mdchitale/qemu/tree/riscv_sspesa_rfc_v1
To test Sspesa, build OpenSBI, Linux and QEMU from the branches above,
then boot Linux with:
qemu-system-riscv64 -nographic -machine virt -smp 2 -m 2G \
-cpu rv64,sscofpmf=on,sspesa=on \
-bios /path/to/fw_dynamic.bin -kernel /path/to/Image \
-drive file=/path/to/rootfs.img,id=hd0,format=raw,if=none \
-device virtio-blk-device,drive=hd0 \
-append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
With all three in place, a counter overflow (e.g. 'perf record -e
cycles -c 1000000 -- <workload>') is attributed using the
hardware-provided sample PC (shpmspc) and counter ID (shpmsdata)
instead of falling back to epc.
Mayuresh Chitale (3):
dt-bindings: riscv: Add Sspesa and Ssplcofi extensions
riscv: Add detection for Sspesa and Ssplcofi extensions
perf/riscv: Use Sspesa for precise sample attribution
.../devicetree/bindings/riscv/extensions.yaml | 19 ++++++++++++
arch/riscv/include/asm/csr.h | 7 +++++
arch/riscv/include/asm/hwcap.h | 2 ++
arch/riscv/kernel/cpufeature.c | 12 ++++++++
drivers/perf/riscv_pmu_sbi.c | 29 +++++++++++++++++++
5 files changed, 69 insertions(+)
--
2.43.0
next reply other threads:[~2026-08-17 16:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 16:02 Mayuresh Chitale [this message]
2026-08-17 16:02 ` [RFC PATCH 1/3] dt-bindings: riscv: Add Sspesa and Ssplcofi extensions Mayuresh Chitale
2026-08-17 16:09 ` sashiko-bot
2026-08-18 9:35 ` Conor Dooley
2026-08-25 13:16 ` Mayuresh Chitale
2026-08-25 16:42 ` Conor Dooley
2026-08-31 7:01 ` Mayuresh Chitale
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260817160222.3313295-1-mayuresh.chitale@oss.qualcomm.com \
--to=mayuresh.chitale@oss.qualcomm.com \
--cc=ajones@ventanamicro.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=andybnac@gmail.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@linux.dev \
--cc=charlie@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=conor+dt@kernel.org \
--cc=debug@rivosinc.com \
--cc=devicetree@vger.kernel.org \
--cc=docular.xu@gmail.com \
--cc=geomatsi@gmail.com \
--cc=guodong@riscstar.com \
--cc=hui.wang@canonical.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luxu.kernel@bytedance.com \
--cc=mark.rutland@arm.com \
--cc=palmer@dabbelt.com \
--cc=pincheng.plct@isrc.iscas.ac.cn \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=thuth@redhat.com \
--cc=will@kernel.org \
--cc=zhangchunyan@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox