From nobody Tue Dec 2 02:29:11 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 2C03536C593 for ; Wed, 19 Nov 2025 16:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763569113; cv=none; b=Oye3JelRSehBpkt//8Z3uHTFLQSAc1eWB5UsuqcKHPsVwGsminnKMNJwwhVHEWQ4uYKnvRcuSRsPUzbjmRwbv8OOp0TED5DKG30zJCyGerAm3ff1d4SS+iiDC7SsZaF4ODJwTIDLVR7JZyyoNsuF56AeS5l9qji2eA4ITicSb7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763569113; c=relaxed/simple; bh=NNFr/LjPuIJwgQLBqv1tSqAvrhacpNfmsSLLmV7jXvU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qXvraTvZpNmohhsurBCGNJlkpMFeQ7D2mBHD1wgGC5ZXaKJs9Fxprt5bqbQIDc/FtVJQgZ0lin6ixqPh7iPYOCzSTcLMbsJrHeZetuYVs6N34aPBD8sdq9erqHP9rSiI3jiDU72LQxP5DvaPH9lzjX2I+Lv1Z+lrLvPnNsRC8t8= 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=FdacGPBV; arc=none smtp.client-ip=209.85.128.53 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="FdacGPBV" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-477549b3082so57158355e9.0 for ; Wed, 19 Nov 2025 08:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763569109; x=1764173909; 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=eb0nZRqG3wPO7nucW1Po+d3Kj8IK/8D9zMABw4V5b10=; b=FdacGPBV0Sjd2pVBV6elQNaWvKqQudp2N1rNrQmdcDkChToscqAzSni+cjkdvMSEta m2Wo6HB/pSsCrBNhx+t141itUmwsYplyAPa/KJ0xyD2F/NsugVg0Ls/jloDJBHtoBeD7 OyF7K59+pRhzhGpNPXdO04QiKVyvWd5th9YEollpWINP9VAP75KuPWEPrD0xIiaYaMKX 1K0FJXsX8CEWnwdidGHt765ldNwD2fmwWQWwa2mEIhWGDM0u88yNRHt/A7zBcSK2Oinq Cwjzdr3ovkBVpnz0zxVKSL4EiAiyM6VNEZIXwVeZBT0yHbGawDv1P1f2J4GEHz4v/cPq WMRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763569109; x=1764173909; 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=eb0nZRqG3wPO7nucW1Po+d3Kj8IK/8D9zMABw4V5b10=; b=q7LyQURzZDCvRwQLrZsyA9brh1gpm0fDgMMTLuSwTHSscxWviXdA6/kpcY9V88CWJ/ M2QOYOUb9KyOmaGuXh62pKDWD+jcYvCGU7jIUS35ckr/zCS/GC0YfpH73m3fm3HpFa+1 rKXlag1/cdKZwdIa54ck17ZwPkwDvo5PtC1y1cCOXqZPbGosoLq4Kn3u79DKj0elCo4j 6HWJjdk59KYI8f++8xUMoGUbud5kJdGMtoGv6Wgx/VvnD4MYT2tvVerEguAUtQjUM/rA MeRF2I71K7Va0SSQXyweWJHTLrVeG2BPU/EKHfywVKgza1pPWgKFLofio7BpAnxNVg5B KsRQ== X-Forwarded-Encrypted: i=1; AJvYcCWji01Z7OYtekhagLYZVlzP49C2zDMHy1EPP04+HLpBa5gq5SAU7t04jJB0iAcRry8H8WYgwuTJxQwIxjg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9vS7Kguk9eLx3Okb4uGWZVVb/o1gmxnU4hqa0ePgiFwvWFX5V qWzm+1sNaG0dN1jql5x61719XlI8V94jeuRbMvTelYbCdzyFSr9ksaDqsqP2Ml4Svhs= X-Gm-Gg: ASbGnctIzFAaDSqkpNc4NkxU2eC7ybytyqXt/D0k2W9GH1nm2ggpD4bOxIpKzBStgms 1w4VHKxwu5auRDUo3yAOgjqip0N3h2R70rNEmLQsWJdE9gl1W1Yj6gcwBhZ/A7wFExHTg+39bgL 6nMFV7j/+fd9wXuBTD6AiWTDRnioKFEH24DQ11YYqJZQdrdukCqnPAhQMgHJUoZoYqZcPbqXYzq M78lZ2UAsiNnOSzkvsp8CyHiUla7A1m6XAgA9HANDFdshhHy6bjGf6rBmuwBAfXF+xJABu2lZES Ie5va07jyidNirNSx6fIMidXJKkl26OBZJK53ynPzERSCifiGC+t+lcD7+WkypJ5js5q146P8bx u1ufnqXsYRG34yxJ2C0z3AABIfmxp7UnoV3k3DqZ/uCv2iPUaKsgFKkTNiuylKrD/v7HMHbD2qc adxkDq+9YXrCdBVNLuonK52KNlFKgglP0= X-Google-Smtp-Source: AGHT+IGDAoHjrNiuL0wt3S1CON20jtX8GRGXrTHnizlFbQ1DR9gz3tuquij5PgE+xexhigojLp1k8A== X-Received: by 2002:a05:600c:c4a2:b0:477:c37:2ea7 with SMTP id 5b1f17b1804b1-4778fe9ac28mr192009635e9.21.1763569109415; Wed, 19 Nov 2025 08:18:29 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477b10142d3sm63205425e9.5.2025.11.19.08.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 08:18:29 -0800 (PST) From: James Clark Date: Wed, 19 Nov 2025 16:18:07 +0000 Subject: [PATCH v6 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: <20251119-james-cs-syncfreq-v6-11-740d24a29e51@linaro.org> References: <20251119-james-cs-syncfreq-v6-0-740d24a29e51@linaro.org> In-Reply-To: <20251119-james-cs-syncfreq-v6-0-740d24a29e51@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 c7208ffc9432..cfd6d2b7bc50 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