| From: |
| Eric Lin <eric.lin-AT-sifive.com> |
| To: |
| Mayuresh Chitale <mchitale-AT-gmail.com>, Anup Patel <anup-AT-brainfault.org>, Rob Herring <robh-AT-kernel.org>, Krzysztof Kozlowski <krzk+dt-AT-kernel.org>, Conor Dooley <conor+dt-AT-kernel.org>, Paul Walmsley <pjw-AT-kernel.org>, Palmer Dabbelt <palmer-AT-dabbelt.com>, Albert Ou <aou-AT-eecs.berkeley.edu>, Alexandre Ghiti <alex-AT-ghiti.fr>, Samuel Holland <samuel.holland-AT-sifive.com>, Alexander Shishkin <alexander.shishkin-AT-linux.intel.com> |
| Subject: |
| [PATCH RFC 00/12] rvtrace: Add SiFive pre-ratified trace device support |
| Date: |
| Tue, 30 Jun 2026 17:46:23 +0800 |
| Message-ID: |
| <20260630-dev-ericl-riscv_trace_support_v3-new_sifive-v3-v1-0-c9c1ffc64e4b@sifive.com> |
| Cc: |
| linux-riscv-AT-lists.infradead.org, devicetree-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, Greentime Hu <greentime.hu-AT-sifive.com>, Eric Lin <dslin1010-AT-gmail.com>, Eric Lin <eric.lin-AT-sifive.com>, Nick Hu <nick.hu-AT-sifive.com>, Vincent Chen <vincent.chen-AT-sifive.com> |
| Archive-link: |
| Article |
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.198349...
Signed-off-by: Eric Lin <eric.lin@sifive.com>
---
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 <eric.lin@sifive.com>