From: cp0613@linux.alibaba.com
To: paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, alex@ghiti.fr, guoren@kernel.org
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
Chen Pei <cp0613@linux.alibaba.com>
Subject: [RFC PATCH 0/4] riscv: tarce: Implement riscv trace pmu driver and perf support
Date: Thu, 11 Sep 2025 20:44:44 +0800 [thread overview]
Message-ID: <20250911124448.1771-1-cp0613@linux.alibaba.com> (raw)
From: Chen Pei <cp0613@linux.alibaba.com>
The RISC-V Trace Specification defines a standardized framework for
capturing and analyzing the execution of RISC-V processors. Its main
uses include: instruction and data tracing, real-time debugging, etc.
Similar to Intel-PT and ARM-CoreSight.
According to the RISC-V Trace Control Interface specification [1].
There are two standard RISC-V trace protocols which will utilize
this RISC-V Trace Control Interface:
- RISC-V N-Trace (Nexus-based Trace) Specification
- Efficient Trace for RISC-V Specification
So, this is a complete guideline for any standard RISC-V trace
implementation.
This series of patches is mainly used to start related work and
communication. It completes the following tasks:
1. dt-bindings completes the basic definition of riscv trace
component properties, but is still incomplete.
2. Implemented the basic RISC-V Trace PMU driver, including
support for the aux buffer.
3. Implemented basic support for AUXTRACE integration with perf
tools.
There's still more work to be done, such as:
1. Complete RISC-V Trace PMU implementation.
2. The perf.data generation and parsing including AUXTRACE events.
3. Taking RISC-V N-Trace as an example, implement the parsing of
Nexus Trace data format, including support for perf report and
perf script commands.
We are still sorting out.
Any comments or suggestions are welcome.
[1] https://github.com/riscv-non-isa/tg-nexus-trace.git
Chen Pei (4):
dt-bindings: riscv: Add trace components description
riscv: event: Initial riscv trace driver support
tools: perf: Support perf record with aux buffer for riscv trace
riscv: trace: Support sink using dma buffer
.../riscv/trace/riscv,trace,encoder.yaml | 41 +++
.../riscv/trace/riscv,trace,funnel.yaml | 46 ++++
.../riscv/trace/riscv,trace,sink.yaml | 37 +++
arch/riscv/Kbuild | 1 +
arch/riscv/Kconfig | 2 +
arch/riscv/events/Kconfig | 11 +
arch/riscv/events/Makefile | 3 +
arch/riscv/events/riscv_trace.c | 253 ++++++++++++++++++
arch/riscv/events/riscv_trace.h | 133 +++++++++
arch/riscv/events/riscv_trace_encoder.c | 109 ++++++++
arch/riscv/events/riscv_trace_funnel.c | 160 +++++++++++
arch/riscv/events/riscv_trace_sink.c | 100 +++++++
tools/perf/arch/riscv/util/Build | 3 +
tools/perf/arch/riscv/util/auxtrace.c | 33 +++
tools/perf/arch/riscv/util/pmu.c | 18 ++
tools/perf/arch/riscv/util/riscv-trace.c | 183 +++++++++++++
tools/perf/arch/riscv/util/tsc.c | 15 ++
tools/perf/util/Build | 1 +
tools/perf/util/auxtrace.c | 4 +
tools/perf/util/auxtrace.h | 1 +
tools/perf/util/riscv-trace.c | 162 +++++++++++
tools/perf/util/riscv-trace.h | 18 ++
22 files changed, 1334 insertions(+)
create mode 100644 Documentation/devicetree/bindings/riscv/trace/riscv,trace,encoder.yaml
create mode 100644 Documentation/devicetree/bindings/riscv/trace/riscv,trace,funnel.yaml
create mode 100644 Documentation/devicetree/bindings/riscv/trace/riscv,trace,sink.yaml
create mode 100644 arch/riscv/events/Kconfig
create mode 100644 arch/riscv/events/Makefile
create mode 100644 arch/riscv/events/riscv_trace.c
create mode 100644 arch/riscv/events/riscv_trace.h
create mode 100644 arch/riscv/events/riscv_trace_encoder.c
create mode 100644 arch/riscv/events/riscv_trace_funnel.c
create mode 100644 arch/riscv/events/riscv_trace_sink.c
create mode 100644 tools/perf/arch/riscv/util/auxtrace.c
create mode 100644 tools/perf/arch/riscv/util/pmu.c
create mode 100644 tools/perf/arch/riscv/util/riscv-trace.c
create mode 100644 tools/perf/arch/riscv/util/tsc.c
create mode 100644 tools/perf/util/riscv-trace.c
create mode 100644 tools/perf/util/riscv-trace.h
--
2.49.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2025-09-11 12:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 12:44 cp0613 [this message]
2025-09-11 12:44 ` [RFC PATCH 1/4] dt-bindings: riscv: Add trace components description cp0613
2025-09-11 17:24 ` Krzysztof Kozlowski
2025-09-15 2:39 ` cp0613
2025-09-11 12:44 ` [RFC PATCH 2/4] riscv: event: Initial riscv trace driver support cp0613
2025-09-11 12:44 ` [RFC PATCH 3/4] tools: perf: Support perf record with aux buffer for riscv trace cp0613
2025-09-11 12:44 ` [RFC PATCH 4/4] riscv: trace: Support sink using dma buffer cp0613
2025-09-17 7:27 ` [RFC PATCH 0/4] riscv: tarce: Implement riscv trace pmu driver and perf support Bo Gan
2025-09-18 6:19 ` cp0613
2025-10-13 4:22 ` Anup Patel
2025-10-14 2:54 ` Guo Ren
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=20250911124448.1771-1-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=guoren@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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