From nobody Mon Dec 1 23:02:30 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 8014F3246ED for ; Wed, 26 Nov 2025 10:57:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154677; cv=none; b=kaGTa+KiCGNQvYhHWETlvKoXBKbmTJAizzZOoZCj4/u4KJRuTvmv8yqsls9/vHOplyQEllI6HQMa3Q08A/55wp+L9o6upqk99cO+xF4mXUSuFlojf1Blmqq0BXdwi/7s+bEQsrUnYPcyCWD845s1yBbw5mz2s15YSvjUF/p+Wzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154677; c=relaxed/simple; bh=XfsVAbfflmddsFvUZmGMPKpPfRjWdP9dqrqERzlZQE8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QRBuCrTOlPwdCaVyAyOkGUcHiOcak/DbrKcE9w+MUENEgu6oB5GxB3dQQD20Hu3qz1g4eS9VWNytvxJXsElV6GnxFg+onn1hypxDMyM5zz6ZGxjLCCU/s1GPW83fOoOmkMVJMn90MvgqHC+qX8JX9wtbYoUEoviAxc70AcJnTe0= 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=T5cAPjMR; arc=none smtp.client-ip=209.85.128.51 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="T5cAPjMR" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-47796a837c7so43378855e9.0 for ; Wed, 26 Nov 2025 02:57:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764154674; x=1764759474; 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=Bwt8cEG57tdOF8BASxzVxlljz5Pjbs6lZvjUWFDTXHg=; b=T5cAPjMRmtuQ2af7ao3JdlTedxsZOJpiEJGODWZVks/2QwpGl5ZDVdS61AKB87HYFI 2LSRlJQmo1Tw7zWUFjcz76WIKoQEcUtB//juNA6LUNo4h9D+C7K0EHK1j9cliu5L64Fw 5OQIDqCa9FH/nB4aFN2ewjrw32Qo8Qaj0sgXB0ChfiBrgEXTbYftzQhzZuZEVbOmUHtY tY52rhlZfGo6rCvKGlcr1aOF5eDky2km0uG8w3im+Wy7UfAGzcZ9Iv8WyFtbmkzkEVVl gE3+nPKbnGRAJkC9rGOzw3mnhRcuK1opUu6MF80Ta0arlwPUdDJyTcuBikXnNV8gREIT b7zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764154674; x=1764759474; 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=Bwt8cEG57tdOF8BASxzVxlljz5Pjbs6lZvjUWFDTXHg=; b=PZMo8ouUBvzqgAusjcOV8bDrfaDRmbTLbAPDK4fhy+tLgZFoh4g85t6zP9CUcyyFPK TBVUrnMruLtpZ3mxUiyPSJMgUm506mJj7G1OR4SGvPwVZxqX4NdLhRxlH5oOlR84AugT +nsTM2B8sar8vaiOXM+7OQQ/HtTNov4gh10RAPmNzpXN9L9T9yJyQZsjxnQMZWMB8L19 +W/emLuiXHrvOCL5hwTZlmnLIXb9eIDzFL3tzsVs4u71XTpCaaFtOug4TmR8d6S/EDz1 7Jp4DNnky6zUKgmVyPwg/Y4cv8szt5bNwCblsu+12nPLNC+AiKAfZ4WnN74hJWTXdFK6 oZlQ== X-Forwarded-Encrypted: i=1; AJvYcCXERV03M8zhihRC6BcFLcgTFeLWmKnCfOx7FK86jBqn8R+ohlftMr5AV37zq5C4NA96zQxOJqgknwtwoUw=@vger.kernel.org X-Gm-Message-State: AOJu0YxeiQUq5kAll+/0DxMSKDlXXy5Q6hVyidxh+bypDVpJn7yzL3K8 rWHlueVXOlFIOcVSgo0G4B46jRaT1ktu19BTWRl+6V9lCZFkfNRbmn0gP9kLQJ2o6VQ= X-Gm-Gg: ASbGncvmwSO+JFWd+Fs1tpgeb1wOSXjcocHScyX0oNhQW95c2amYHsCfyQGROShSuzW EF5yD5q3XgpPQTzuspQi1yRx84cPrMWzVlYyXwnbIZPQNAaTLIa+lYDs3kM6WWj8A6z8IqLvtVe FNrt5a+OiLr9OV1ohWHToQQv40sB6Q9Xvd0oBYfrkXZ+fKyZkCF1Ns+B731JC3gOPR46q0oS6Fo gYjkCtyi91Qn2gYuqPqnrI41LQ+hxj0khxFfMzZ+n1OTU0AylDK2t50kbX5KRoGBXXLoxCqErir qVSJcomQaYJOGd4hA82lDTf84cP/GAX283Mf3HERkg8RwAAPLQn0+eZIgUNI77psMUS3tn24+6V AAp9XukMqLmyOfHmVFnH+Bj7TakXo13Ouwjk8w8ufcpR2PA/S2a4sNawTZxEvWOdz1TH4atTGcl X4HmHS/eEN33jMmo0LIjv5 X-Google-Smtp-Source: AGHT+IHu3VMV/nia9zExacgXf1CG1quUw46Gmf589tkbMqB6kt7gsqIoCudhkMzjlBbUakuyMJJKdA== X-Received: by 2002:a05:600c:4ec7:b0:46f:b32e:5094 with SMTP id 5b1f17b1804b1-477c01ea075mr176599335e9.32.1764154673792; Wed, 26 Nov 2025 02:57:53 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790ade13ddsm36991765e9.8.2025.11.26.02.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 02:57:53 -0800 (PST) From: James Clark Date: Wed, 26 Nov 2025 10:54:40 +0000 Subject: [PATCH v7 11/13] coresight: Extend width of timestamp format attribute 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: <20251126-james-cs-syncfreq-v7-11-7fae5e0e5e16@linaro.org> References: <20251126-james-cs-syncfreq-v7-0-7fae5e0e5e16@linaro.org> In-Reply-To: <20251126-james-cs-syncfreq-v7-0-7fae5e0e5e16@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 'timestamp' is currently 1 bit wide for on/off. To enable setting different intervals in a later commit, extend it to 4 bits wide. Keep the old bit position for backward compatibility but don't publish in the format/ folder. It will be removed from the documentation and can be removed completely after enough time has passed. ETM3x doesn't support different intervals, so validate that the value is either 0 or 1. Tools that read the bit positions from the format/ folder will continue to work as before, setting either 0 or 1 for off/on. Tools that incorrectly didn't do this and set the ETM_OPT_TS bit directly will also continue to work because that old bit is still checked. This avoids adding a second timestamp attribute for setting the interval. This would be awkward to use because tools would have to be updated to ensure that the timestamps are always enabled when an interval is set, and the driver would have to validate that both options are provided together. All this does is implement the semantics of a single enum but spread over multiple fields. Reviewed-by: Leo Yan Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm-perf.h | 13 ++++++++++--- drivers/hwtracing/coresight/coresight-etm3x-core.c | 9 ++++++++- drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 +++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwt= racing/coresight/coresight-etm-perf.h index c794087a0e99..24d929428633 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -23,6 +23,9 @@ struct cscfg_config_desc; #define ATTR_CFG_FLD_preset_CFG config #define ATTR_CFG_FLD_preset_LO 0 #define ATTR_CFG_FLD_preset_HI 3 +#define ATTR_CFG_FLD_timestamp_CFG config +#define ATTR_CFG_FLD_timestamp_LO 4 +#define ATTR_CFG_FLD_timestamp_HI 7 #define ATTR_CFG_FLD_branch_broadcast_CFG config #define ATTR_CFG_FLD_branch_broadcast_LO 8 #define ATTR_CFG_FLD_branch_broadcast_HI 8 @@ -35,9 +38,13 @@ struct cscfg_config_desc; #define ATTR_CFG_FLD_contextid2_CFG config #define ATTR_CFG_FLD_contextid2_LO 15 #define ATTR_CFG_FLD_contextid2_HI 15 -#define ATTR_CFG_FLD_timestamp_CFG config -#define ATTR_CFG_FLD_timestamp_LO 28 -#define ATTR_CFG_FLD_timestamp_HI 28 +/* + * Old position of 'timestamp' and not published in sysfs. Remove at a lat= er + * date if necessary. + */ +#define ATTR_CFG_FLD_deprecated_timestamp_CFG config +#define ATTR_CFG_FLD_deprecated_timestamp_LO 28 +#define ATTR_CFG_FLD_deprecated_timestamp_HI 28 #define ATTR_CFG_FLD_retstack_CFG config #define ATTR_CFG_FLD_retstack_LO 29 #define ATTR_CFG_FLD_retstack_HI 29 diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/h= wtracing/coresight/coresight-etm3x-core.c index 584d653eda81..d4c04e563bf6 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -338,9 +338,16 @@ static int etm_parse_event_config(struct etm_drvdata *= drvdata, if (ATTR_CFG_GET_FLD(attr, cycacc)) config->ctrl |=3D ETMCR_CYC_ACC; =20 - if (ATTR_CFG_GET_FLD(attr, timestamp)) + if (ATTR_CFG_GET_FLD(attr, deprecated_timestamp) || + ATTR_CFG_GET_FLD(attr, timestamp)) config->ctrl |=3D ETMCR_TIMESTAMP_EN; =20 + if (ATTR_CFG_GET_FLD(attr, timestamp) > 1) { + dev_dbg(&drvdata->csdev->dev, + "timestamp format attribute should be 0 (off) or 1 (on)\n"); + return -EINVAL; + } + /* * Possible to have cores with PTM (supports ret stack) and ETM (never * has ret stack) on the same SoC. So only enable when it can be honored diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index b457f182efbe..c7bf73c8f2d7 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -791,7 +792,8 @@ static int etm4_parse_event_config(struct coresight_dev= ice *csdev, cc_threshold =3D drvdata->ccitmin; config->ccctlr =3D cc_threshold; } - if (ATTR_CFG_GET_FLD(attr, timestamp)) { + if (ATTR_CFG_GET_FLD(attr, deprecated_timestamp) || + ATTR_CFG_GET_FLD(attr, timestamp)) { /* * Configure timestamps to be emitted at regular intervals in * order to correlate instructions executed on different CPUs --=20 2.34.1