* [RFC PATCH 0/3] RISC-V Sspesa: Linux perf precise sample attribution
@ 2026-08-17 16:02 Mayuresh Chitale
2026-08-17 16:02 ` [RFC PATCH 1/3] dt-bindings: riscv: Add Sspesa and Ssplcofi extensions Mayuresh Chitale
0 siblings, 1 reply; 3+ messages in thread
From: Mayuresh Chitale @ 2026-08-17 16:02 UTC (permalink / raw)
To: Albert Ou, Alexandre Ghiti, Andrew Jones, Andrew Morton,
Andy Chiu, Anup Patel, Atish Patra, Charlie Jenkins,
Chunyan Zhang, Clément Léger, Conor Dooley,
Deepak Gupta, Guodong Xu, Guodong Xu, Hui Wang,
Krzysztof Kozlowski, Mark Rutland, Mayuresh Chitale,
Palmer Dabbelt, Paul Walmsley, Pincheng Wang, Rob Herring,
Sergey Matyukevich, Thomas Huth, Will Deacon, Xu Lu
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-perf-users,
linux-riscv
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH 1/3] dt-bindings: riscv: Add Sspesa and Ssplcofi extensions
2026-08-17 16:02 [RFC PATCH 0/3] RISC-V Sspesa: Linux perf precise sample attribution Mayuresh Chitale
@ 2026-08-17 16:02 ` Mayuresh Chitale
2026-08-17 16:09 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Mayuresh Chitale @ 2026-08-17 16:02 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Guodong Xu,
Andrew Morton, Deepak Gupta, Xu Lu, Pincheng Wang
Cc: Mayuresh Chitale, devicetree, linux-riscv, linux-kernel
Document the RISC-V Performance Event Sampling extensions Sspesa
(Precise Event Sample Attribution) and Ssplcofi (Precise Local Counter
Overflow Interrupt) in the ISA extensions binding.
Add a dependency rule requiring Sspesa to be present whenever Ssplcofi
is present.
Signed-off-by: Mayuresh Chitale <mayuresh.chitale@oss.qualcomm.com>
---
.../devicetree/bindings/riscv/extensions.yaml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
index 5ffc40d599c0..f316b93754ff 100644
--- a/Documentation/devicetree/bindings/riscv/extensions.yaml
+++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
@@ -232,6 +232,18 @@ properties:
ratified at commit d70011dde6c2 ("Update to ratified state")
of riscv-j-extension.
+ - const: sspesa
+ description: |
+ The standard Sspesa supervisor-level extension for precise event
+ sample attribution, as defined in the RISC-V Performance Event
+ Sampling specification.
+
+ - const: ssplcofi
+ description: |
+ The standard Ssplcofi supervisor-level extension for precise local
+ counter overflow interrupts, as defined in the RISC-V Performance
+ Event Sampling specification. Ssplcofi depends on Sspesa.
+
- const: ssstateen
description: |
The standard Ssstateen extension for supervisor-mode view of the
@@ -934,6 +946,13 @@ properties:
const: smnpm
- contains:
const: ssnpm
+ # Ssplcofi depends on Sspesa
+ - if:
+ contains:
+ const: ssplcofi
+ then:
+ contains:
+ const: sspesa
# Za64rs and Ziccrse depend on Zalrsc or A
- if:
contains:
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH 1/3] dt-bindings: riscv: Add Sspesa and Ssplcofi extensions
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
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-17 16:09 UTC (permalink / raw)
To: Mayuresh Chitale; +Cc: conor+dt, robh, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `ssplcofi` extension is missing a dependency on `sscofpmf` in its validation rules.
--
--- Patch [1]: [RFC PATCH 1/3] dt-bindings: riscv: Add Sspesa and Ssplcofi extensions ---
commit d9c857c632fdf5807bbc999144379f6067037960
Author: Mayuresh Chitale <mayuresh.chitale@oss.qualcomm.com>
dt-bindings: riscv: Add Sspesa and Ssplcofi extensions
Document the RISC-V Performance Event Sampling extensions Sspesa and Ssplcofi
in the ISA extensions binding. This adds descriptions for both extensions
and a dependency rule requiring Sspesa when Ssplcofi is present.
> diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> index 5ffc40d599c02..f316b93754ff7 100644
> --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
[ ... ]
> @@ -934,6 +946,13 @@ properties:
> const: smnpm
> - contains:
> const: ssnpm
> + # Ssplcofi depends on Sspesa
> + - if:
> + contains:
> + const: ssplcofi
> + then:
> + contains:
> + const: sspesa
[Severity: Low]
Should this validation block also enforce a dependency on the base sscofpmf
extension?
Without requiring sscofpmf, an invalid device tree configuration declaring
ssplcofi without the base extension could silently pass dtbs_check.
> # Za64rs and Ziccrse depend on Zalrsc or A
> - if:
> contains:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260817160222.3313295-1-mayuresh.chitale@oss.qualcomm.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-17 16:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 16:02 [RFC PATCH 0/3] RISC-V Sspesa: Linux perf precise sample attribution Mayuresh Chitale
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox