mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leo Yu-Chi Liang <leo.liang@sifive.com>
To: Mayuresh Chitale <mchitale@gmail.com>,
	Anup Patel <anup@brainfault.org>,  Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 Alexandre Ghiti <alex@ghiti.fr>,
	Samuel Holland <samuel.holland@sifive.com>,
	 Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Leo Yu-Chi Liang <leo.liang@sifive.com>,
	 linmin@eswincomputing.com, vincent.chen@sifive.com,
	 luyulin@eswincomputing.com, pritesh.patel@einfochips.com,
	 ganboing@gmail.com, dongxuyang@eswincomputing.com,
	 pinkesh.vaghela@einfochips.com, nick.hu@sifive.com,
	eric.lin@sifive.com,  huangyifeng@eswincomputing.com,
	darshan.prajapati@einfochips.com
Subject: [PATCH 05/10] gtrace: Terminate id_table iteration on GTRACE_COMPONENT_TYPE_NONE
Date: Thu, 26 Nov 2026 01:07:11 -0800	[thread overview]
Message-ID: <20261126-send-preratified-trace-v1-5-1e686fd75be7@sifive.com> (raw)
In-Reply-To: <20261126-send-preratified-trace-v1-0-1e686fd75be7@sifive.com>

gtrace_match_id() uses a non-zero id->version as the end-of-table
sentinel when walking a driver's id_table. This does not work for
pre-ratified components, whose version is 0, i.e.
rvtrace_component_mkversion(0, 0): an id_table holding only such an
entry is treated as empty, so the component never matches its driver.

Add GTRACE_COMPONENT_TYPE_NONE as the zero value of enum
gtrace_component_type and use it as the terminator instead. Existing
id_tables end with an empty entry, which maps to this value.

Signed-off-by: Leo Yu-Chi Liang <leo.liang@sifive.com>
---
 drivers/hwtracing/gtrace/gtrace-core.c | 2 +-
 include/linux/gtrace.h                 | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/gtrace/gtrace-core.c b/drivers/hwtracing/gtrace/gtrace-core.c
index 034987237abc..09b200bd1690 100644
--- a/drivers/hwtracing/gtrace/gtrace-core.c
+++ b/drivers/hwtracing/gtrace/gtrace-core.c
@@ -103,7 +103,7 @@ const struct gtrace_component_id *gtrace_match_id(struct gtrace_component *comp,
 {
 	const struct gtrace_component_id *id;
 
-	for (id = ids; id->version; id++) {
+	for (id = ids; id->type != GTRACE_COMPONENT_TYPE_NONE; id++) {
 		if (comp->id.type != id->type)
 			continue;
 
diff --git a/include/linux/gtrace.h b/include/linux/gtrace.h
index da8ba3779193..b8826b25d35a 100644
--- a/include/linux/gtrace.h
+++ b/include/linux/gtrace.h
@@ -19,6 +19,7 @@
  * uses the entries relevant to it.
  */
 enum gtrace_component_type {
+	GTRACE_COMPONENT_TYPE_NONE,
 	GTRACE_RVTRACE_ENCODER,
 	GTRACE_RVTRACE_FUNNEL,
 	GTRACE_RVTRACE_RAMSINK,

-- 
2.43.7


  parent reply	other threads:[~2026-11-26  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:07 [PATCH 00/10] gtrace: Add support for SiFive pre-ratified RISC-V trace components Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 01/10] dt-bindings: riscv: Add SiFive pre-ratified " Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 02/10] gtrace: rvtrace: Add pre-ratified implementation callback Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 03/10] gtrace: rvtrace: Add pre-ratified private data callback Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 04/10] gtrace: rvtrace: Add pre-ratified encoder support Leo Yu-Chi Liang
2026-11-26  9:07 ` Leo Yu-Chi Liang [this message]
2026-11-26  9:07 ` [PATCH 06/10] gtrace: rvtrace: Add pre-ratified trace sink config Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 07/10] gtrace: rvtrace: Add pre-ratified trace funnel driver Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 08/10] gtrace: rvtrace: Introduce struct rvtrace_ramsink_regs to abstract register offsets Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 09/10] gtrace: rvtrace: Add pre-ratified ramsink setup Leo Yu-Chi Liang
2026-11-26  9:07 ` [PATCH 10/10] gtrace: rvtrace: Add copyto_auxbuf callback for pre-ratified encoder and funnel Leo Yu-Chi Liang

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=20261126-send-preratified-trace-v1-5-1e686fd75be7@sifive.com \
    --to=leo.liang@sifive.com \
    --cc=alex@ghiti.fr \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=darshan.prajapati@einfochips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dongxuyang@eswincomputing.com \
    --cc=eric.lin@sifive.com \
    --cc=ganboing@gmail.com \
    --cc=huangyifeng@eswincomputing.com \
    --cc=krzk+dt@kernel.org \
    --cc=linmin@eswincomputing.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=luyulin@eswincomputing.com \
    --cc=mchitale@gmail.com \
    --cc=nick.hu@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=pinkesh.vaghela@einfochips.com \
    --cc=pjw@kernel.org \
    --cc=pritesh.patel@einfochips.com \
    --cc=robh@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=vincent.chen@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

all inboxes | Powered by JetHome®