From nobody Mon Dec 1 22:35:06 2025 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 4530B329E69 for ; Fri, 28 Nov 2025 11:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764330964; cv=none; b=uXMugZpfXsa21pE1HJ8ODdynR6kd38cWd37nWFeJywZiOh8c5qIEv04jraOpmD017f8sICGiX9BdpnUQBo0ecORlEztqg/EOxiaqU4LhxNegmGqPWXzpelqd6S8hVpZV9Y+WU4oOho/uv8BS59xAwRuFWBvuqOqB/ShbdHojBSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764330964; c=relaxed/simple; bh=SS/s8QBA/va9cTDHskVqLAp1wGdCoVI/9SaA59A2p/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jC76dqg+aztA4i+15yUQCUuE2NdWRUMFi3fKAR21k+qaJfMuDnE3GctxhYqiSKc3gWIXj/VyldMDJGzZ6W3haSNOEXkvOdlGHqc6mMpWfLLj8keiDBGT2ywulMI8GBiDn5ns96/tJnV5Q3qIItyefpHknGLKPQkYd0CIqUb3AJY= 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=rDokXgqS; arc=none smtp.client-ip=209.85.128.47 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="rDokXgqS" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-477632d9326so10427775e9.1 for ; Fri, 28 Nov 2025 03:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764330960; x=1764935760; 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=EF8yFRu7uobTFdxOcMGHqxmlNjOlv3Yom5cRf9iiNv0=; b=rDokXgqSGZWIhlO3qYLC/dNSMZyWwPFjyqe99UCwkZWiZdtvh3Y/WQO4hziymfxd8S eqrOiid0azwED5qqspEarOEanU1taW/eWkKFtSMKUxVLPjqWuzmuTBiqIlXST5gzsyxS dyAO8ErT71rOgG096IJzQ13jlFTlRF7oTlHuuF0Mn15RLzNTysS6/pqwZ+GDLgHjgljW ddw0dddJY8nhHv4qBQf++nros/GDrNNnt2PsYsApraS9AlOsCy4F1QKkkqgXhokiHCfn 3XgxSs5d+qoba4kApnX6lv1PWEXQr5SXfI4tzXQSLZsZsPuEuTJhrvLP4IFUXOPke+iI QA1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764330960; x=1764935760; 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=EF8yFRu7uobTFdxOcMGHqxmlNjOlv3Yom5cRf9iiNv0=; b=Nk+j2kZD4UbYdYTf110TGn3w5TvBhmEuwN3BAmLU5aGWFiO5eKR3zVl7x8lRKqmDiH 5FBmMq1uM4pF5BFJ3m3Vf/urUtebtrnPWg1D3O4E5PF8LPWUPzBQCxYKhtC2UkPRd1ru opYuCNXpGfqV7EfKVvnBDd8nMUK30KN9V9l335YPPLEXCe37m+8tL1RijHo11Xkb1N3L j+re85S82JffZorVVVI4luxDg0XPeUNfgfJNWJTjH9bY/1oKWNYUVswV8e2n/B5prNEn Fkl9ma9rF1SDspbJ29mttZxAAOAJnh8jNaeuKwyqelZa4R+Wly6KGU30TF2A6rmdl4qx eIUQ== X-Forwarded-Encrypted: i=1; AJvYcCXch9eO16ljxQU7ToFSbKTSbDNkzMreWSmyEGvRIwFTZop7c+woJnKxrraskKxBj05AjVRdmyNj91JpPNc=@vger.kernel.org X-Gm-Message-State: AOJu0YwZmT2Vg3Bc1vYhp7Ab0JV+mzayx1DBy/pKmGTvEGcVAguKq62D 60TRIM1zmRtZOefzyKSgOlQq+pSyy0NOL8LqILt23yGTG2v+fFq7D0stjb+JjR9ouv0= X-Gm-Gg: ASbGnctCqdhaUdz4HNvj3/1ijErAKdjEGVK3WhLQMA4PEm45TC+nEYSYJlnijEpAVZh 86WbhnBxbUmNMZu67XeeN/We3ZqgSBF+LaDJmxJmHNzOZ6fmer86KSCfmwKj3xOyt8F4Q/IsnNq l/IBNOSiA1K1Ov6xsUhqBGZ630Ibn0o1lj0n4pDZKe/6zfzigrqDJNis/VtTIo/yy+SEKQvmNfy uKUB7Vaki6ae52jkYsTzdD1U9uu+i9iWkXLmItpOnDXsVcZ9yp/mywTJtT6rEyoKL9Eiy6u47zg uYHRfdkuJX/rMFEe5Md3t3VGDrHArkWjYsVWAzQdy/vcvYbSHzFAWLylwH0xn0zoiJATaoN+IE6 7RxU27V01fN/iNINjscDLCaZSNakSK4z+PMafPyGDD5ZqlL/vnRKgRhqRbjmGovlT+2Wii4dm1N W+9AWFrxv3wi3rKjMQKcM4quzp4qr4yBg= X-Google-Smtp-Source: AGHT+IF59snexuzfEwmE+hbBC+xfTP3fyiFQFy8xP9a0/ylOS8orxBtcZfG9ugUz3WwI+KQC1momlA== X-Received: by 2002:a05:600c:4fcb:b0:477:557b:691d with SMTP id 5b1f17b1804b1-477c01eea7fmr244407045e9.25.1764330960440; Fri, 28 Nov 2025 03:56:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Nov 2025 03:56:00 -0800 (PST) From: James Clark Date: Fri, 28 Nov 2025 11:55:23 +0000 Subject: [PATCH v8 11/13] coresight: Prepare to allow setting the timestamp interval 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-11-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 Timestamps are currently emitted at the maximum rate possible, which is much too frequent for most use cases. In the next commit, the timestamp field will be widened to take a value, so set the interval using the value now. Granular control is not required, so save space in the config by interpreting it as 2 ^ timestamp. And then 4 bits (0 - 15) will be enough to set the interval to be larger than the existing SYNC timestamp interval. No sysfs mode support is needed for this attribute because counter generated timestamps are only configured for Perf mode. Reviewed-by: Leo Yan Tested-by: Leo Yan Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 20 ++++++++++--------= -- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index b457f182efbe..7e9c923acf4b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -650,7 +650,7 @@ static void etm4_enable_sysfs_smp_call(void *info) * +--------------+ * | * +------v-------+ - * | Counter x | (reload to 1 on underflow) + * | Counter x | (reload to 2 ^ (ts_level - 1) on underflow) * +--------------+ * | * +------v--------------+ @@ -661,7 +661,8 @@ static void etm4_enable_sysfs_smp_call(void *info) * | Timestamp Generator | (timestamp on resource y) * +----------------------+ */ -static int etm4_config_timestamp_event(struct etmv4_drvdata *drvdata) +static int etm4_config_timestamp_event(struct etmv4_drvdata *drvdata, + u8 ts_level) { int ctridx; int rselector; @@ -703,12 +704,8 @@ static int etm4_config_timestamp_event(struct etmv4_dr= vdata *drvdata) return -ENOSPC; } =20 - /* - * Initialise original and reload counter value to the smallest - * possible value in order to get as much precision as we can. - */ - config->cntr_val[ctridx] =3D 1; - config->cntrldvr[ctridx] =3D 1; + /* Initialise original and reload counter value. */ + config->cntr_val[ctridx] =3D config->cntrldvr[ctridx] =3D 1 << (ts_level = - 1); =20 /* * Trace Counter Control Register TRCCNTCTLRn @@ -756,6 +753,7 @@ static int etm4_parse_event_config(struct coresight_dev= ice *csdev, struct perf_event_attr *attr =3D &event->attr; unsigned long cfg_hash; int preset, cc_threshold; + u8 ts_level; =20 /* Clear configuration from previous run */ memset(config, 0, sizeof(struct etmv4_config)); @@ -791,13 +789,15 @@ static int etm4_parse_event_config(struct coresight_d= evice *csdev, cc_threshold =3D drvdata->ccitmin; config->ccctlr =3D cc_threshold; } - if (ATTR_CFG_GET_FLD(attr, timestamp)) { + + ts_level =3D ATTR_CFG_GET_FLD(attr, timestamp); + if (ts_level) { /* * Configure timestamps to be emitted at regular intervals in * order to correlate instructions executed on different CPUs * (CPU-wide trace scenarios). */ - ret =3D etm4_config_timestamp_event(drvdata); + ret =3D etm4_config_timestamp_event(drvdata, ts_level); =20 /* * No need to go further if timestamp intervals can't --=20 2.34.1