[PATCH RFC 00/12] rvtrace: Add SiFive pre-ratified trace device support
From: Eric Lin <hidden>
Date: 2026-06-30 09:47:05
Also in:
linux-riscv, lkml
This series adds support for SiFive's pre-ratified trace devices on
top of the Linux RISC-V trace framework patch set [1].
The pre-ratified trace hardware is not fully compliant with the
RISC-V trace specification. The key differences are as follows:
1) The pre-ratified trace component major version is 0, and the
implementation register bitfields are different. PATCH 2
introduces a get_impl() callback to translate the pre-ratified
hardware implementation register information into the standard
RISC-V trace implementation register format.
2) A pre-ratified trace component might support different trace
sinks, and its trace sink availability information is embedded
within the implementation register. PATCH 3 introduces a
get_data() callback to retrieve the component's supported trace
sinks.
3) For routing trace data from a source to an output trace component,
the pre-ratified hardware needs to configure the current
component's control MMIO register, which differs from the standard
RISC-V trace. PATCH 4 passes 'struct rvtrace_path_node' to the
start callback to provide full path topology information,
supporting data flow control for both ratified and pre-ratified
trace components.
4) Unlike the standard RISC-V trace RAM sink, which is an independent
device, the pre-ratified RAM sinks are embedded within the trace
encoder or funnel MMIO registers and utilize a different register
layout. PATCH 8 introduces 'struct rvtrace_ramsink_regs' to
abstract register offsets, allowing pre-ratified trace sinks to
leverage the existing rvtrace_ramsink_setup() functions.
This patch series has been tested on the HiFive Premier P550 board,
and the resulting trace logs match expectations.
Note: The PATCH 12 reset RAM sink write pointer on every context switch
to avoid wrap quickly.
[1] https://lore.kernel.org/linux-riscv/20260429125135.1983498-1-anup.patel@oss.qualcomm.com/ (local)
Signed-off-by: Eric Lin <redacted>
---
Eric Lin (12):
dt-bindings: riscv: Add SiFive pre-ratified trace components
rvtrace: Add pre-ratified implementation callback
rvtrace: Add pre-ratified private data callback
rvtrace: Pass struct rvtrace_path_node to start callback
rvtrace: encoder: Add pre-ratified support
rvtrace: Add pre-ratified trace sink config
rvtrace: Add pre-ratified trace funnel driver
rvtrace: Introduce struct rvtrace_ramsink_regs to abstract register offsets
rvtrace: Add pre-ratified ramsink setup
rvtrace: Add copyto_auxbuf callback for pre-ratified encoder and funnel
rvtrace: encoder: Add probe success message
rvtrace: Reset RAM sink write pointer on every context switch
.../bindings/riscv/riscv,trace-component.yaml | 73 ++++++++-
drivers/hwtracing/rvtrace/Kconfig | 16 ++
drivers/hwtracing/rvtrace/Makefile | 2 +
drivers/hwtracing/rvtrace/rvtrace-core.c | 42 +++---
drivers/hwtracing/rvtrace/rvtrace-encoder.c | 54 +++++--
drivers/hwtracing/rvtrace/rvtrace-funnel.c | 127 ++++++++++++++++
drivers/hwtracing/rvtrace/rvtrace-platform.c | 32 +++-
drivers/hwtracing/rvtrace/rvtrace-ramsink.c | 166 +++++++++++++++------
drivers/hwtracing/rvtrace/rvtrace-ramsink.h | 13 ++
drivers/hwtracing/rvtrace/rvtrace-v0.c | 130 ++++++++++++++++
drivers/hwtracing/rvtrace/rvtrace-v0.h | 65 ++++++++
include/linux/rvtrace.h | 26 +++-
12 files changed, 658 insertions(+), 88 deletions(-)
---
base-commit: 79783024b7bd12897e21fecfaf6ac7dad02a8f0e
change-id: 20260630-dev-ericl-riscv_trace_support_v3-new_sifive-v3-e4534f9b45fd
Best regards,
--
Eric Lin [off-list ref]