From: Zane Leung <liangzhen@linux.spacemit.com>
To: gregkh@linuxfoundation.org, palmer@dabbelt.com, pjw@kernel.org,
alexander.shishkin@linux.intel.com, suzuki.poulose@arm.com,
mchitale@gmail.com, anup@brainfault.org, irogers@google.com
Cc: mike.leach@arm.com, james.clark@linaro.org, leo.yan@arm.com,
peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org,
mark.rutland@arm.com, jolsa@kernel.org, adrian.hunter@intel.com,
alex@ghiti.fr, atish.patra@linux.dev,
andrew.jones@oss.qualcomm.com, sunilvl@oss.qualcomm.com,
liangzhen@linux.spacemit.com, zhuangqiubin@linux.spacemit.com,
coresight@lists.linaro.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 03/24] gtrace: Drop trace format field and helper function
Date: Fri, 23 Oct 2026 11:14:44 +0800 [thread overview]
Message-ID: <20261023031505.2020925-4-liangzhen@linux.spacemit.com> (raw)
In-Reply-To: <20261023031505.2020925-1-liangzhen@linux.spacemit.com>
Remove the format field from struct gtrace_platform_data and drop
the associated gtrace_path_aux_format() helper function.
Signed-off-by: Zane Leung <liangzhen@linux.spacemit.com>
---
drivers/hwtracing/gtrace/gtrace-perf.c | 15 --------
drivers/hwtracing/gtrace/rvtrace-encoder.c | 39 ---------------------
drivers/hwtracing/gtrace/rvtrace-platform.c | 3 +-
drivers/hwtracing/gtrace/rvtrace-ramsink.c | 1 -
include/linux/gtrace.h | 3 --
5 files changed, 1 insertion(+), 60 deletions(-)
diff --git a/drivers/hwtracing/gtrace/gtrace-perf.c b/drivers/hwtracing/gtrace/gtrace-perf.c
index 928f0405c6c1..56713c8ee850 100644
--- a/drivers/hwtracing/gtrace/gtrace-perf.c
+++ b/drivers/hwtracing/gtrace/gtrace-perf.c
@@ -167,20 +167,6 @@ static void *gtrace_setup_aux(struct perf_event *event, void **pages,
return NULL;
}
-static u64 gtrace_path_aux_format(struct gtrace_path *path)
-{
- struct gtrace_component *src = gtrace_path_source(path);
-
- switch (src->pdata->format) {
- case GTRACE_FORMAT_ETRACE:
- return PERF_AUX_FLAG_GTRACE_FORMAT_ETRACE;
- case GTRACE_FORMAT_NTRACE:
- return PERF_AUX_FLAG_GTRACE_FORMAT_NTRACE;
- default:
- return PERF_AUX_FLAG_GTRACE_FORMAT_UNKNOWN;
- }
-}
-
static void gtrace_event_read(struct perf_event *event)
{
}
@@ -295,7 +281,6 @@ static void gtrace_event_stop(struct perf_event *event, int mode)
return;
ret = gtrace_path_copyto_auxbuf(path, &event_data->buf, &size, &format);
WARN_ON_ONCE(ret);
- format = gtrace_path_aux_format(path);
if (READ_ONCE(handle->event)) {
/* Tag the AUX data with the source's trace format. */
perf_aux_output_flag(handle, format);
diff --git a/drivers/hwtracing/gtrace/rvtrace-encoder.c b/drivers/hwtracing/gtrace/rvtrace-encoder.c
index 1f06b1a2b412..f24780b1ca1e 100644
--- a/drivers/hwtracing/gtrace/rvtrace-encoder.c
+++ b/drivers/hwtracing/gtrace/rvtrace-encoder.c
@@ -53,38 +53,11 @@ static void rvtrace_encoder_set_srcid(struct gtrace_platform_data *pdata, u32 sr
gtrace_write32(pdata, val, RVTRACE_COMPONENT_CTRL_OFFSET);
}
-/* Set requested trace format and return 0 if hardware supports that format */
-static int rvtrace_encoder_set_format(struct gtrace_platform_data *pdata)
-{
- u32 val, fmt;
-
- switch (pdata->format) {
- case GTRACE_FORMAT_ETRACE:
- fmt = RVTRACE_COMPONENT_CTRL_FORMAT_ETRACE;
- break;
- case GTRACE_FORMAT_NTRACE:
- fmt = RVTRACE_COMPONENT_CTRL_FORMAT_NTRACE;
- break;
- default:
- return -EINVAL;
- }
-
- val = gtrace_read32(pdata, RVTRACE_COMPONENT_CTRL_OFFSET);
- val &= ~(RVTRACE_COMPONENT_CTRL_FORMAT_MASK << RVTRACE_COMPONENT_CTRL_FORMAT_SHIFT);
- val |= fmt << RVTRACE_COMPONENT_CTRL_FORMAT_SHIFT;
- gtrace_write32(pdata, val, RVTRACE_COMPONENT_CTRL_OFFSET);
-
- val = gtrace_read32(pdata, RVTRACE_COMPONENT_CTRL_OFFSET);
- val = (val >> RVTRACE_COMPONENT_CTRL_FORMAT_SHIFT) & RVTRACE_COMPONENT_CTRL_FORMAT_MASK;
- return val == fmt ? 0 : -EOPNOTSUPP;
-}
-
static int rvtrace_encoder_probe(struct gtrace_component *comp)
{
struct gtrace_platform_data *pdata = comp->pdata;
struct rvtrace_encoder_priv *priv;
u32 val, hw_srcbits, srcbits;
- int ret;
if (pdata->bound_cpu < 0) {
dev_err(&comp->dev, "cpu property missing. Please fix firmware.\n");
@@ -95,12 +68,6 @@ static int rvtrace_encoder_probe(struct gtrace_component *comp)
if (!priv)
return -ENOMEM;
- ret = rvtrace_encoder_set_format(pdata);
- if (ret) {
- dev_err(&comp->dev, "failed to set format %d\n", pdata->format);
- return ret;
- }
-
/* Check if trTeInhibitSrc is hardwired to 1 */
val = gtrace_read32(pdata, RVTRACE_COMPONENT_CTRL_OFFSET);
val &= ~BIT(RVTRACE_COMPONENT_CTRL_INHIBITSRC_SHIFT);
@@ -144,12 +111,6 @@ static int rvtrace_encoder_start(struct gtrace_component *comp)
if (priv->srcbits)
rvtrace_encoder_set_srcid(pdata, priv->srcbits);
- ret = rvtrace_encoder_set_format(pdata);
- if (ret) {
- dev_err(&comp->dev, "failed to set format %d\n", pdata->format);
- return ret;
- }
-
ret = gtrace_enable_component(comp);
if (ret) {
dev_err(&comp->dev, "failed to enable encoder.\n");
diff --git a/drivers/hwtracing/gtrace/rvtrace-platform.c b/drivers/hwtracing/gtrace/rvtrace-platform.c
index 189ff0b8bc18..e5c1f47388a2 100644
--- a/drivers/hwtracing/gtrace/rvtrace-platform.c
+++ b/drivers/hwtracing/gtrace/rvtrace-platform.c
@@ -78,7 +78,6 @@ static int rvtrace_platform_probe(struct platform_device *pdev)
pdata->dev = dev;
pdata->impid = RVTRACE_COMPONENT_IMPID_UNKNOWN;
pdata->hw_ops = &rvtrace_hw_ops;
- pdata->format = (uintptr_t)device_get_match_data(dev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -146,7 +145,7 @@ static void rvtrace_platform_remove(struct platform_device *pdev)
}
static const struct of_device_id rvtrace_platform_match[] = {
- { .compatible = "riscv,trace-component", .data = (void *)GTRACE_FORMAT_ETRACE },
+ { .compatible = "riscv,trace-component" },
{}
};
diff --git a/drivers/hwtracing/gtrace/rvtrace-ramsink.c b/drivers/hwtracing/gtrace/rvtrace-ramsink.c
index 67b6779aacee..9588c32c5b13 100644
--- a/drivers/hwtracing/gtrace/rvtrace-ramsink.c
+++ b/drivers/hwtracing/gtrace/rvtrace-ramsink.c
@@ -161,7 +161,6 @@ static size_t rvtrace_ramsink_copyto_auxbuf(struct gtrace_component *comp,
dst.cur = buf->pos;
src.base = priv->va;
src.len = priv->size;
- *format = PERF_AUX_FLAG_GTRACE_FORMAT_ETRACE;
wp = rvtrace_ramsink_read_pair(comp->pdata, RVTRACE_RAMSINK_WPLOW_OFF);
wrap = wp & RVTRACE_RAMSINK_WPLOW_WRAP;
wp &= ~RVTRACE_RAMSINK_WPLOW_WRAP;
diff --git a/include/linux/gtrace.h b/include/linux/gtrace.h
index 9945303d2713..0a017f1f888d 100644
--- a/include/linux/gtrace.h
+++ b/include/linux/gtrace.h
@@ -96,7 +96,6 @@ struct gtrace_hw_ops {
* @bound_cpu: CPU to which the component is bound, or -1 if unbound. For a
* source component bound to a CPU this must not be -1.
* @control_poll_timeout_usecs: Delay in usecs when polling control bits.
- * @format: Trace format selected by the platform driver.
* @nr_inconns: Number of input connections.
* @inconns: Array of pointers to input connections.
* @nr_outconns: Number of output connections.
@@ -128,8 +127,6 @@ struct gtrace_platform_data {
/* Delay in microseconds when polling control register bits */
int control_poll_timeout_usecs;
- enum gtrace_format format;
-
/*
* Platform driver must only populate empty pointer array without
* any actual input connections.
--
2.34.1
next prev parent reply other threads:[~2026-10-23 3:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 3:14 [RFC PATCH 00/24] Add Linux RISC-V trace support via the gtrace framework Zane Leung
2026-10-23 3:14 ` [PATCH 01/24] gtrace: Move connection release into component unregister Zane Leung
2026-10-23 3:14 ` [PATCH 02/24] gtrace: Initial implementation of gtrace sysfs framework Zane Leung
2026-10-23 3:14 ` Zane Leung [this message]
2026-10-23 3:14 ` [PATCH 04/24] gtrace: Add RISC-V trace encoder sysfs support Zane Leung
2026-10-23 3:14 ` [PATCH 05/24] gtrace: Introduce some PMU format attributes Zane Leung
2026-10-23 3:14 ` [PATCH 06/24] gtrace: Replace owner PID with perf_event pointer in gtrace_path Zane Leung
2026-10-23 3:14 ` [PATCH 07/24] gtrace: Parse RISC-V Trace encoder config from perf event Zane Leung
2026-10-23 3:14 ` [PATCH 08/24] gtrace: add perf symlink support for gtrace components Zane Leung
2026-10-23 3:14 ` [PATCH 09/24] gtrace: Add port-level start/stop driver callbacks Zane Leung
2026-10-23 3:14 ` [PATCH 10/24] gtrace: Add RISC-V trace funnel driver Zane Leung
2026-10-23 3:14 ` [PATCH 11/24] gtrace: Add RISC-V trace timestamp support Zane Leung
2026-10-23 3:14 ` [PATCH 12/24] gtrace: Add RISC-V trace ATB bridge driver Zane Leung
2026-10-23 3:14 ` [PATCH 13/24] gtrace: Add CoreSight platform core APIs Zane Leung
2026-10-23 3:14 ` [PATCH 14/24] gtrace: Add CoreSight funnel driver Zane Leung
2026-10-23 3:14 ` [PATCH 15/24] gtrace: Only copy AUX data from the path sink Zane Leung
2026-10-23 3:14 ` [PATCH 16/24] perf: Flag whether gtrace AUX data carries CoreSight framing Zane Leung
2026-10-23 3:14 ` [PATCH 17/24] gtrace: Unify default sink selection across CPUs in perf setup Zane Leung
2026-10-23 3:14 ` [PATCH 18/24] gtrace: Add sink-specific buffer alloc/free callbacks Zane Leung
2026-10-23 3:15 ` [PATCH 19/24] gtrace: Add setup_sysfs_buf callback to setup sysfs sink buffer Zane Leung
2026-10-23 3:15 ` [PATCH 20/24] gtrace: Add CoreSight TMC driver support Zane Leung
2026-10-23 3:15 ` [PATCH 21/24] perf tools: riscv: making gtrace PMU listable Zane Leung
2026-10-23 3:15 ` [PATCH 22/24] perf tools: Add Nexus RISC-V Trace decoder Zane Leung
2026-10-23 3:15 ` [PATCH 23/24] perf tools: gtrace: Record and parse trace encoder metadata Zane Leung
2026-10-23 3:15 ` [PATCH 24/24] perf tools: gtrace: Add AUX trace decoder and branch sample synthesis Zane Leung
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=20261023031505.2020925-4-liangzhen@linux.spacemit.com \
--to=liangzhen@linux.spacemit.com \
--cc=adrian.hunter@intel.com \
--cc=alex@ghiti.fr \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrew.jones@oss.qualcomm.com \
--cc=anup@brainfault.org \
--cc=atish.patra@linux.dev \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mchitale@gmail.com \
--cc=mike.leach@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=sunilvl@oss.qualcomm.com \
--cc=suzuki.poulose@arm.com \
--cc=zhuangqiubin@linux.spacemit.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®