From nobody Mon Dec 1 22:35:07 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0AAF32572C for ; Fri, 28 Nov 2025 11:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764330956; cv=none; b=lH24CIN3S+GhGCwWd5ztcP4EG4jx5YkvbOVb8jB8q1V5PIq55Wlno0w5FC0gRd3Yo8rrOsBcIXdTZc0HDgDJjMssfWK5e401CLHU489k7YjiYPbTct0j6DE7s6gCnNloP7YJ420+FbE3eDaO9FNFq8UN+80W+37G6dm7OHVHSMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764330956; c=relaxed/simple; bh=my4t4Zpp3sJgeh5MjovHvwT3pYLLhzF0nierX1jtTJM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fRkOA441gt74Wyfbz4EnvSCb6QIEfXTRyA6EDf9lI9SdqrCiSWl6m6Jyx21aB+kkBUNz7EP2unoOa2ndZLLI0HPFsoh1/t3uj9dkaGZSfmhVvH6CjPBHgQF2yyLMpIfe69apIVjyIMG1yqrSJyBMSaHj18Aa4/PXLSy3J42lThc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XTMDHbPx; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XTMDHbPx" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-47118259fd8so15247125e9.3 for ; Fri, 28 Nov 2025 03:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764330953; x=1764935753; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=P6NKswHRt2B1T1Lth0kajA34+egQTqFsQQ3qShHJFKE=; b=XTMDHbPxS9snz/aIgff75/Qeo4eFx7pff1azBWSGZhYceSoA2oFnHf8601Qst/Ve80 jHwGDzBzboLyhJWbA13Z+twiWeYhbc6OJE7927kCEknFlEFucYs45Rc2fYudsQDGuTjn 10MFdWHrIe/XuclbfUenbSZkG6Spy6ki/wg1u1KZXJlCUiSto76X4odSjeASudf8SFY/ MYMELVYIyrqF+9rB3m1ps3q5JBClbim3wdAcWGkbBn3oJxYvRJQDqkTVEzSyNHTn0ZEt LhnwKfJ9dtqhB2nv5zYPCFwda1HbR+P3wFBo2UO0F50FiE9PJ85jJbM3LezlZagNbed+ 7VUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764330953; x=1764935753; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=P6NKswHRt2B1T1Lth0kajA34+egQTqFsQQ3qShHJFKE=; b=Z/v0xNKozEEToyr9gqxweZZnS68I+GFM4ud4VJpEtcamqHv7H6XYApnuuAbU7mpQPB 71feU5pmhBc2Duu20j24vpMvAUPDznHIzLGZQTlKfkP8G2i7lb8JOr/Nd9pGNz/tPvoQ XUtpSaMVrJIrv5hIBqKT6oyauTyJgb1DDIv+E94m5kA0xuN2kvaarpLRohZJEIQV38mI z3HMI0M19WGHfuuc8Gz4G2IQIeNgE3YoA3xttAl1W50ElSYNTGlaySeSiG0Z1jAeijZQ uvt0EfEnDhc/sASqWT+pHA7RpSUqnjDKrSuGplKJzCuLw3uexz5cbA9uZ4YXWuoG/WKN 2Yhw== X-Forwarded-Encrypted: i=1; AJvYcCXXB5DxFKSQuUv6Q6lFYaPzx1hrOma62JMKE/Oaaku3nmQds8skkiIaassaoz/NRrC5KoQ8yRnfwSj7l/c=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7Mwz16eqf1Cg/6E7pbqlxj9YLK4Tzm7yUCtFShX4bjPz96mPt gMhFIJJoxkl0zmHq0oSo56uZlnJXLWKuNPFIAPsle3hjYbep7dyv/dMfJQt703kixyI= X-Gm-Gg: ASbGnct2UyyQMPNWyCYH7NRmPKpPvKuxcCQrtN7C1q3rVtweA2qjejNelIY7KDbg8LS eLy6+Q9x9dzd5xdtOnrnQyEcUmjwzdsu5ORrnvfg8b52TQcA8+hP0ekwl3jobF4CVmFJKl/DKFw I16J7NGZUUtzynKlRHwCFhcswT/Er3+tl4fKBMySPwodkHPuQopEjXHHVeIxiq/tg8bdavlGWOY Ohy7YQW8Tx/SIh7LiTS3/XarMeTk9DdTxYUmN0oiWWg7eBUDCwZUGA/u2aUe4WBTr76pJ0x5S7c htX0TZIRvmfpONTDEzC3ifVSXoOO7AbSh6gKKdrW+kmxWyTKvy5b7PUyfX/3CthXmGr8Pyjp3wi R5cYoeadcdbFffqF9Otq2536eP1aSkdoJHDv/h/V4OptxpQe6JeNpu9sf21h8l2/pgpO5vlqubU FY8tL2peMHQdDP8WcSLiTY X-Google-Smtp-Source: AGHT+IGG6SyR+Pc3XkdqQLhR9KbEorBs/XuSc16Qz/v7snsfS3YnRvRgeWVwY1cYlOPb/CmMrFBsjg== X-Received: by 2002:a05:600c:4f46:b0:477:fcb:226b with SMTP id 5b1f17b1804b1-47904ac44c0mr158757575e9.2.1764330953033; Fri, 28 Nov 2025 03:55:53 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790adc8bc7sm158974465e9.1.2025.11.28.03.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Nov 2025 03:55:52 -0800 (PST) From: James Clark Date: Fri, 28 Nov 2025 11:55:16 +0000 Subject: [PATCH v8 04/13] coresight: Hide unused ETMv3 format attributes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251128-james-cs-syncfreq-v8-4-4d319764cc58@linaro.org> References: <20251128-james-cs-syncfreq-v8-0-4d319764cc58@linaro.org> In-Reply-To: <20251128-james-cs-syncfreq-v8-0-4d319764cc58@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan , Randy Dunlap Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 ETMv3 only has a few attributes, and setting unused ones results in an error, so hide them to begin with. Reviewed-by: Mike Leach Tested-by: Leo Yan Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm-perf.c | 37 +++++++++++++-------= ---- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index 17afa0f4cdee..3805282b97e8 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -50,27 +50,23 @@ struct etm_ctxt { static DEFINE_PER_CPU(struct etm_ctxt, etm_ctxt); static DEFINE_PER_CPU(struct coresight_device *, csdev_src); =20 -/* - * The PMU formats were orignally for ETMv3.5/PTM's ETMCR 'config'; - * now take them as general formats and apply on all ETMs. - */ -PMU_FORMAT_ATTR(branch_broadcast, "config:"__stringify(ETM_OPT_BRANCH_BROA= DCAST)); PMU_FORMAT_ATTR(cycacc, "config:" __stringify(ETM_OPT_CYCACC)); -/* contextid1 enables tracing CONTEXTIDR_EL1 for ETMv4 */ -PMU_FORMAT_ATTR(contextid1, "config:" __stringify(ETM_OPT_CTXTID)); -/* contextid2 enables tracing CONTEXTIDR_EL2 for ETMv4 */ -PMU_FORMAT_ATTR(contextid2, "config:" __stringify(ETM_OPT_CTXTID2)); PMU_FORMAT_ATTR(timestamp, "config:" __stringify(ETM_OPT_TS)); PMU_FORMAT_ATTR(retstack, "config:" __stringify(ETM_OPT_RETSTK)); +PMU_FORMAT_ATTR(sinkid, "config2:0-31"); + +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) +PMU_FORMAT_ATTR(branch_broadcast, "config:"__stringify(ETM_OPT_BRANCH_BROA= DCAST)); +/* contextid1 enables tracing CONTEXTIDR_EL1*/ +PMU_FORMAT_ATTR(contextid1, "config:" __stringify(ETM_OPT_CTXTID)); +/* contextid2 enables tracing CONTEXTIDR_EL2*/ +PMU_FORMAT_ATTR(contextid2, "config:" __stringify(ETM_OPT_CTXTID2)); /* preset - if sink ID is used as a configuration selector */ PMU_FORMAT_ATTR(preset, "config:0-3"); -/* Sink ID - same for all ETMs */ -PMU_FORMAT_ATTR(sinkid, "config2:0-31"); /* config ID - set if a system configuration is selected */ PMU_FORMAT_ATTR(configid, "config2:32-63"); PMU_FORMAT_ATTR(cc_threshold, "config3:0-11"); =20 - /* * contextid always traces the "PID". The PID is in CONTEXTIDR_EL1 * when the kernel is running at EL1; when the kernel is at EL2, @@ -82,27 +78,34 @@ static ssize_t format_attr_contextid_show(struct device= *dev, { int pid_fmt =3D ETM_OPT_CTXTID; =20 -#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) pid_fmt =3D is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; -#endif return sprintf(page, "config:%d\n", pid_fmt); } =20 static struct device_attribute format_attr_contextid =3D __ATTR(contextid, 0444, format_attr_contextid_show, NULL); +#endif =20 +/* + * ETMv3 only uses the first 3 attributes for programming itself (see + * ETM3X_SUPPORTED_OPTIONS). Sink ID is also supported for selecting a + * sink in both, but not used for configuring the ETM. The remaining + * attributes are ETMv4 specific. + */ static struct attribute *etm_config_formats_attr[] =3D { &format_attr_cycacc.attr, - &format_attr_contextid.attr, - &format_attr_contextid1.attr, - &format_attr_contextid2.attr, &format_attr_timestamp.attr, &format_attr_retstack.attr, &format_attr_sinkid.attr, +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) + &format_attr_contextid.attr, + &format_attr_contextid1.attr, + &format_attr_contextid2.attr, &format_attr_preset.attr, &format_attr_configid.attr, &format_attr_branch_broadcast.attr, &format_attr_cc_threshold.attr, +#endif NULL, }; =20 --=20 2.34.1