From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Yeoreum Yun <yeoreum.yun@arm.com>,
Mike Leach <mike.leach@arm.com>,
James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH RESEND v13 09/14] coresight: etm4x: remove s_ex_level from config
Date: Sat, 3 Oct 2026 07:14:38 +0100 [thread overview]
Message-ID: <5ea4d985-d0ae-46a8-ad01-2ef6999f9ad2@arm.com> (raw)
In-Reply-To: <20261003-separate_etm_cfg_v2-v13-9-5d8a29aead95@arm.com>
On 03/10/2026 03:52, Yeoreum Yun wrote:
> s_ex_level is a hardware capability rather than a configurable parameter.
> As such, it should not be stored in the configuration structure.
>
> Remove s_ex_level from the config structure and pass etm4_caps to the
Checkpatch complains:
ERROR: code indent should use tabs where possible
#74: FILE: drivers/hwtracing/coresight/coresight-etm4x-core.c:1569:
+^I^I^I const struct etmv4_caps *caps)$
ERROR: code indent should use tabs where possible
#83: FILE: drivers/hwtracing/coresight/coresight-etm4x-core.c:1576:
+^I^I^I const struct etmv4_caps *caps)$
I have fixed them locally.
Cheers
Suzuki
> functions that need to access this capability.
>
> Reviewed-by: Mike Leach <mike.leach@arm.com>
> Tested-by: Leo Yan <leo.yan@arm.com>
> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-etm4x-core.c | 58 +++++++++++++---------
> .../hwtracing/coresight/coresight-etm4x-sysfs.c | 2 +-
> drivers/hwtracing/coresight/coresight-etm4x.h | 5 +-
> 3 files changed, 38 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 4a8c1070bbcb..99d4e2d39e66 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -66,10 +66,12 @@ MODULE_PARM_DESC(pm_save_enable,
> "Save/restore state on power down: 1 = never, 2 = self-hosted. MMIO and DT only.");
>
> static struct etmv4_drvdata *etmdrvdata[NR_CPUS];
> -static void etm4_set_default_config(struct etmv4_config *config);
> +static void etm4_set_default_config(struct etmv4_config *config,
> + const struct etmv4_caps *caps);
> static int etm4_set_event_filters(struct etmv4_drvdata *drvdata,
> struct perf_event *event);
> -static u64 etm4_get_access_type(struct etmv4_config *config);
> +static u64 etm4_get_access_type(struct etmv4_config *config,
> + const struct etmv4_caps *caps);
>
> static enum cpuhp_state hp_online;
>
> @@ -800,7 +802,7 @@ static int etm4_parse_event_config(struct coresight_device *csdev,
> config->mode |= ETM_MODE_EXCL_GUEST;
>
> /* Always start from the default config */
> - etm4_set_default_config(config);
> + etm4_set_default_config(config, caps);
>
> /* Configure filters specified on the perf cmd line, if any. */
> ret = etm4_set_event_filters(drvdata, event);
> @@ -1474,7 +1476,6 @@ static void etm4_init_arch_data(void *info)
>
> /* EXLEVEL_S, bits[19:16] Secure state instruction tracing */
> caps->s_ex_level = FIELD_GET(TRCIDR3_EXLEVEL_S_MASK, etmidr3);
> - drvdata->config.s_ex_level = caps->s_ex_level;
> /* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */
> caps->ns_ex_level = FIELD_GET(TRCIDR3_EXLEVEL_NS_MASK, etmidr3);
> /*
> @@ -1557,19 +1558,22 @@ static void etm4_init_arch_data(void *info)
> cpu_detect_trace_filtering(drvdata);
> }
>
> -static u32 etm4_get_victlr_access_type(struct etmv4_config *config)
> +static u32 etm4_get_victlr_access_type(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> - return etm4_get_access_type(config) << __bf_shf(TRCVICTLR_EXLEVEL_MASK);
> + return etm4_get_access_type(config, caps) << __bf_shf(TRCVICTLR_EXLEVEL_MASK);
> }
>
> /* Set ELx trace filter access in the TRCVICTLR register */
> -static void etm4_set_victlr_access(struct etmv4_config *config)
> +static void etm4_set_victlr_access(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> config->vinst_ctrl &= ~TRCVICTLR_EXLEVEL_MASK;
> - config->vinst_ctrl |= etm4_get_victlr_access_type(config);
> + config->vinst_ctrl |= etm4_get_victlr_access_type(config, caps);
> }
>
> -static void etm4_set_default_config(struct etmv4_config *config)
> +static void etm4_set_default_config(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> /* disable all events tracing */
> config->eventctrl0 = 0x0;
> @@ -1588,7 +1592,7 @@ static void etm4_set_default_config(struct etmv4_config *config)
> config->vinst_ctrl = FIELD_PREP(TRCVICTLR_EVENT_MASK, 0x01);
>
> /* TRCVICTLR::EXLEVEL_NS:EXLEVELS: Set kernel / user filtering */
> - etm4_set_victlr_access(config);
> + etm4_set_victlr_access(config, caps);
> }
>
> static u64 etm4_get_ns_access_type(struct etmv4_config *config)
> @@ -1620,21 +1624,24 @@ static u64 etm4_get_ns_access_type(struct etmv4_config *config)
> * This must be shifted to the corresponding register field
> * for usage.
> */
> -static u64 etm4_get_access_type(struct etmv4_config *config)
> +static u64 etm4_get_access_type(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> /* All Secure exception levels are excluded from the trace */
> - return etm4_get_ns_access_type(config) | (u64)config->s_ex_level;
> + return etm4_get_ns_access_type(config) | (u64)caps->s_ex_level;
> }
>
> -static u64 etm4_get_comparator_access_type(struct etmv4_config *config)
> +static u64 etm4_get_comparator_access_type(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> - return etm4_get_access_type(config) << TRCACATR_EXLEVEL_SHIFT;
> + return etm4_get_access_type(config, caps) << TRCACATR_EXLEVEL_SHIFT;
> }
>
> static void etm4_set_comparator_filter(struct etmv4_config *config,
> + const struct etmv4_caps *caps,
> u64 start, u64 stop, int comparator)
> {
> - u64 access_type = etm4_get_comparator_access_type(config);
> + u64 access_type = etm4_get_comparator_access_type(config, caps);
>
> /* First half of default address comparator */
> config->addr_val[comparator] = start;
> @@ -1665,11 +1672,12 @@ static void etm4_set_comparator_filter(struct etmv4_config *config,
> }
>
> static void etm4_set_start_stop_filter(struct etmv4_config *config,
> + const struct etmv4_caps *caps,
> u64 address, int comparator,
> enum etm_addr_type type)
> {
> int shift;
> - u64 access_type = etm4_get_comparator_access_type(config);
> + u64 access_type = etm4_get_comparator_access_type(config, caps);
>
> /* Configure the comparator */
> config->addr_val[comparator] = address;
> @@ -1701,7 +1709,8 @@ static void etm4_set_default_filter(struct etmv4_config *config)
> config->vissctlr = 0x0;
> }
>
> -static void etm4_set_default(struct etmv4_config *config)
> +static void etm4_set_default(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> if (WARN_ON_ONCE(!config))
> return;
> @@ -1713,7 +1722,7 @@ static void etm4_set_default(struct etmv4_config *config)
> * full instruction trace - with a default filter for trace all
> * achieved by having no filtering.
> */
> - etm4_set_default_config(config);
> + etm4_set_default_config(config, caps);
> etm4_set_default_filter(config);
> }
>
> @@ -1761,6 +1770,7 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata,
> {
> int i, comparator, ret = 0;
> u64 address;
> + const struct etmv4_caps *caps = &drvdata->caps;
> struct etmv4_config *config = &drvdata->curr_config;
> struct etm_filters *filters = event->hw.addr_filters;
>
> @@ -1790,7 +1800,7 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata,
>
> switch (type) {
> case ETM_ADDR_TYPE_RANGE:
> - etm4_set_comparator_filter(config,
> + etm4_set_comparator_filter(config, caps,
> filter->start_addr,
> filter->stop_addr,
> comparator);
> @@ -1811,7 +1821,7 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata,
> filter->stop_addr);
>
> /* Configure comparator */
> - etm4_set_start_stop_filter(config, address,
> + etm4_set_start_stop_filter(config, caps, address,
> comparator, type);
>
> /*
> @@ -1847,7 +1857,8 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata,
> return ret;
> }
>
> -void etm4_config_trace_mode(struct etmv4_config *config)
> +void etm4_config_trace_mode(struct etmv4_config *config,
> + const struct etmv4_caps *caps)
> {
> u32 mode;
>
> @@ -1861,7 +1872,7 @@ void etm4_config_trace_mode(struct etmv4_config *config)
> if (!(mode & ETM_MODE_EXCL_KERN) && !(mode & ETM_MODE_EXCL_USER))
> return;
>
> - etm4_set_victlr_access(config);
> + etm4_set_victlr_access(config, caps);
> }
>
> static int etm4_online_cpu(unsigned int cpu)
> @@ -2173,6 +2184,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg)
> struct coresight_platform_data *pdata = NULL;
> struct device *dev = init_arg->dev;
> struct etmv4_drvdata *drvdata = dev_get_drvdata(dev);
> + const struct etmv4_caps *caps = &drvdata->caps;
> struct coresight_desc desc = { 0 };
> u8 major, minor;
> char *type_name;
> @@ -2202,7 +2214,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg)
> if (!desc.name)
> return -ENOMEM;
>
> - etm4_set_default(&drvdata->config);
> + etm4_set_default(&drvdata->config, caps);
>
> if (etm4x_always_pm_save(dev, init_arg->csa))
> pm_save = true;
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> index 9dd60fa67ef1..aa3deb15ba96 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> @@ -443,7 +443,7 @@ static ssize_t mode_store(struct device *dev,
> config->vinst_ctrl &= ~TRCVICTLR_TRCERR;
>
> if (config->mode & (ETM_MODE_EXCL_KERN | ETM_MODE_EXCL_USER))
> - etm4_config_trace_mode(config);
> + etm4_config_trace_mode(config, caps);
>
> raw_spin_unlock(&drvdata->spinlock);
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
> index 67071f7cbdbc..ae97c5c004bf 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
> @@ -956,7 +956,6 @@ struct etmv4_caps {
> * @vmid_mask0: VM ID comparator mask for comparator 0-3.
> * @vmid_mask1: VM ID comparator mask for comparator 4-7.
> * @ext_inp: External input selection.
> - * @s_ex_level: Secure ELs where tracing is supported.
> */
> struct etmv4_config {
> u64 mode;
> @@ -999,7 +998,6 @@ struct etmv4_config {
> u32 vmid_mask0;
> u32 vmid_mask1;
> u32 ext_inp;
> - u8 s_ex_level;
> };
>
> /**
> @@ -1117,7 +1115,8 @@ enum etm_addr_ctxtype {
> };
>
> extern const struct attribute_group *coresight_etmv4_groups[];
> -void etm4_config_trace_mode(struct etmv4_config *config);
> +void etm4_config_trace_mode(struct etmv4_config *config,
> + const struct etmv4_caps *caps);
>
> u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit);
> void etm4x_sysreg_write(u64 val, u32 offset, bool _relaxed, bool _64bit);
>
next prev parent reply other threads:[~2026-10-03 6:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 2:52 [PATCH RESEND v13 00/14] fix several inconsistencies with sysfs configuration in etmX Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 01/14] coresight: etm4x: read-back TRCSEQSTR at disabling and prohibit modifying seq_state while enabling Yeoreum Yun
2026-10-03 3:08 ` sashiko-bot
2026-10-03 3:44 ` Yeoreum Yun
2026-10-03 6:07 ` Suzuki K Poulose
2026-10-03 2:52 ` [PATCH RESEND v13 02/14] coresight: etm4x: prohibit modifying cntr_val while session is enabled Yeoreum Yun
2026-10-03 3:06 ` sashiko-bot
2026-10-03 4:29 ` Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 03/14] coresight: etm3x: prohibit modifying cntr_val and reset " Yeoreum Yun
2026-10-03 3:06 ` sashiko-bot
2026-10-03 4:34 ` Yeoreum Yun
2026-10-03 6:10 ` Suzuki K Poulose
2026-10-03 2:52 ` [PATCH RESEND v13 04/14] coresight: etm4x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-10-03 3:06 ` sashiko-bot
2026-10-03 4:40 ` Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 05/14] coresight: etm3x: " Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 06/14] coresight: etm3x: remove redundant cpu online check on etm_enable_sysfs() Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 07/14] coresight: etm4x: introduce struct etm4_caps Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 08/14] coresight: etm4x: exclude ss_status from drvdata->config Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 09/14] coresight: etm4x: remove s_ex_level from config Yeoreum Yun
2026-10-03 6:14 ` Suzuki K Poulose [this message]
2026-10-03 2:52 ` [PATCH RESEND v13 10/14] coresight: etm4x: rename local config as curr_config referring drvdata->curr_config Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 11/14] coresight: etm4x: rename drvdata->config to sysfs_config Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 12/14] coresight: etm3x: introduce struct etm_caps Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 13/14] coresight: etm3x: rename local config as curr_config referring drvdata->curr_config Yeoreum Yun
2026-10-03 2:52 ` [PATCH RESEND v13 14/14] coresight: etm3x: rename drvdata->config to sysfs_config Yeoreum Yun
2026-10-03 6:56 ` [PATCH RESEND v13 00/14] fix several inconsistencies with sysfs configuration in etmX Suzuki K Poulose
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=5ea4d985-d0ae-46a8-ad01-2ef6999f9ad2@arm.com \
--to=suzuki.poulose@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@arm.com \
--cc=rostedt@goodmis.org \
--cc=yeoreum.yun@arm.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®