From nobody Tue Dec 2 02:42:37 2025 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 0CD703A79A9 for ; Tue, 18 Nov 2025 16:28:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763483309; cv=none; b=WaGKWIie7hbvTfyyRhVwmvVRVmNOveBoJYlOYMdAkl4xiSqXG2QShDa8l3a8PQuICDuBP3POXDWBVJDNY8WnyH48bOeTcWsQfJzGrDOOm6kEg8njZ4UX0CFqQPbbJDaYy4LlpIy2tXs5Y3ZEhKOeofFT9tplsyuKAE5c5ZMt7SU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763483309; c=relaxed/simple; bh=NNFr/LjPuIJwgQLBqv1tSqAvrhacpNfmsSLLmV7jXvU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ddJF5pVMP8XU2f3Bv3cyneJEfdaSEG84LdzHv7a91peoE0WKqDSmccJ6OzabDzZnmzScuUDkBc/J5r9M4ktwzzhqb1r9tUYa949c1r159+f4zAyKmvaRnO3yTTJwB4KVPlZ6fy2naIv/LuRLPer5UzaHuG3+JRlqnFB4XXZJxco= 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=xFafDVQ1; arc=none smtp.client-ip=209.85.128.48 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="xFafDVQ1" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so41175195e9.0 for ; Tue, 18 Nov 2025 08:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763483305; x=1764088105; 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=xFafDVQ1WWP4RnnFOpVxfZ0xTh3y6fO4nE/G0lPULSMngkFH4JExauXJ+qnd89TgGo FN1PzBcJoD3Uux8YxFCz+LnHZascbjJQNeeIDEbhiF/83Mgiky+3Ef3//DbRr6GSsCKs MVUKdBp+6zAyHtRubnqPIuULayr/kW2LOAF6OgWBrsID4aNjB3tCuyuYEIbUD91hDG8k kUBkFjqtnHIWAXyKR/0CeeNvHzr/urZyrHbk6vSXnjPDocSxcUmAISJR2H3OTuwdqDx0 wozQg24wYHOXam+O76EukDSkYW9AnELQBNsKL0O9Gfgnbr8lWCp2eDTjv9Jok6oJnE3p Hu8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763483305; x=1764088105; 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=Kk2Um9ZIf1/qWGAci2fteE4g6He5Y58ZMjYUZbsJNsR0dx6dX5tobmVjGOrqKTZenD w6cwV65gfYs+1CQGWchVp4EtGmO7bpL5m508G1buK/rK0HMqUef5lL3oy6nrougDblpQ j07pQrcNw9nYGTGHkYWNJAmOHraOvtZxbEGpHdab1uWMk6toKrRVNCNffSnimQoOXDeJ BHcrEEvC9zekVvdfdLiqNSEyhQFmbN68IZdJ3122aWp014nsooj0RxYRJGLqZYn21w0U 0ShuDWrlOuAlKkf2ITZJNAMFl43gnxHaBgRS5yS/OJd0JdfAyDTLUO2R9MZJagulO3y4 KjPA== X-Forwarded-Encrypted: i=1; AJvYcCUfkCDV7V9FN/75mOLMQVPi3gKWsl0Q8h3L3xBq/QjUfAIMsCHDF9EnV9Dsh4OeeawmOA8AaRWWfVg8jCQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywj+EOfhsD6uooIj4Wum4NX6sL6Oldqp8Jchu5vvRKSW/Bq9+9f oRU6mSq/w3MmVSfPAr7/GMS/0rg4pE1MpqKiJiPVsRDiFzgYG0HYmPogziYi6JPkqoM= X-Gm-Gg: ASbGncun+szvE61EaC49jUWSvXhWRBRtEprU0qAt0CIULQOTIiw2A2Xku/0LbrDd1Nj jw/caBk/WNqxAzhTCueYq1zG/bzXyUXgA0Qxe4kq3v8giTck/qKW5wfifC93YnLONUA+7zpVIhR zanUf0d3hVCGj6491femc72H3FOYiiUphDtnT+e4Avdo3WeH30W1J153mFBFLEthPF7RuhwANaU x+605yFfKMFaKypVlNDsqUlq1iOHjxvxXaFL389ffma0mM74KT+G9kMGYOaJyqHwvw3e2DsSGjB 8MbV9gInUqOCiRjfzG+Yqyys4UHFds2RTngFvyW8ZKvvR+bkVw9cIqSHjL0LYVlSIaCkXh4IFcJ rMB7m2IMSjM/6Mzvmk4nOZzfxOKS7SRS1oaH6Sj35LEWb5Ej1rRIJ5BMHw11NsQSeW0COq8rglb bv0/hcIhnYLDnAgqIdLeNc04bxALDl4CkRnqfFryPH8A== X-Google-Smtp-Source: AGHT+IEgxjocht+zd5sgZk9UgQUOz1bPvElgaDdpvXL42GO6HQTKk5jhNzNQ67G2WTvucSd0gdRSKg== X-Received: by 2002:a05:600c:8b5b:b0:477:7768:8da4 with SMTP id 5b1f17b1804b1-4778fe59f99mr148261815e9.7.1763483305277; Tue, 18 Nov 2025 08:28:25 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477a9dea7fcsm20369125e9.8.2025.11.18.08.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Nov 2025 08:28:24 -0800 (PST) From: James Clark Date: Tue, 18 Nov 2025 16:28:01 +0000 Subject: [PATCH v5 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: <20251118-james-cs-syncfreq-v5-11-82efd7b1a751@linaro.org> References: <20251118-james-cs-syncfreq-v5-0-82efd7b1a751@linaro.org> In-Reply-To: <20251118-james-cs-syncfreq-v5-0-82efd7b1a751@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