From nobody Sun Oct 5 01:46:24 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 7884B21ABA8 for ; Mon, 11 Aug 2025 09:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904764; cv=none; b=p0B5U1CYRVuGIS7EkfvvhB0tiF4b9a4ZbY11iZL//Lf4VgBhu6SOmkcoZ4gHSu/yImHpu+d1fQ0qRDfj5vYJ2jTN+yzkaAD4OFVc+qskZVFhb/dkaXPG9sqYA3n38i4lNy6xgNV3vYkCkVC5UcLwxAj2wWIXX1DblZ8W+Rb0xPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904764; c=relaxed/simple; bh=4aYl0ZlZfO9PKf1O2NFxApvTlFmO+ImWPT/xpvy6zJ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nvwU6A1IDwS1PY724SNtY1gPehoC+eBu8BuwXfQsYX2s3KBny2f2luWd3O/Bham/F6HxueJfShnHQk5d1kYptZsaK2GDfUtsVID5EjZ7ctHUAkr8yLHZIe/2r2OlOCcSmFwxMR6zIPs2RMS6f1lE3vJdvE06M3ehnCJtcSqGQnE= 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=K1SdOJXA; arc=none smtp.client-ip=209.85.128.46 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="K1SdOJXA" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-459e72abdd2so23744725e9.2 for ; Mon, 11 Aug 2025 02:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754904761; x=1755509561; 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=flPVDp6drpFtCapB44BZdn+149SFai2CStzeZGBA02s=; b=K1SdOJXAHZNRwKl4MCArq+IXqJgyKu0plDhI96JvCiAOfwwAlfCu3caJB7lTqE3zjS HYWqtaArVYTADDEf9KZhuaJuxmXGpN+RT9mSvxbwA1yC07ERoXs06yeyt+8n5VdSnbx2 BzBHja4Dp/qyMFFeRuL7DzwkeHREoiSQycr5/YM+Ul5DeJw9R/y9vyglWoTzyOgsSdWH HbW/HdPlBVW6jftdYFTUFtki9QXt4LWRZO1LGvPPT+N5pK32c0x5vH4cArCEG1jKl9KD DeV/vJVDGN1EypiLfHEAbgH3AunfraScibyqV5jZMhC0wOEBbTM3F5iagHTSABiONK5p 6xGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754904761; x=1755509561; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=flPVDp6drpFtCapB44BZdn+149SFai2CStzeZGBA02s=; b=TcGCFLmLGDYTTLo4IwlqMir9NqOe38jxQeuM6r4sbAAm86ZtmMPMM+UvNwFsQEATtM iw9HNlw9663N3LdUis50F/I9Spd8w5Sd4SHM7l8gFBxTBxqzkM1XewzP57F/qewVh0W7 LF94hSoN1u5SQdoR16g/50T04iOLX01FJET3gLtS47qaAeO0c8N7ZOJWYdh3C97B7FAz ioQDKIoUAbWDCtggQCI1c8Jr87LT+t+LWX4/wJsP6rupJylLYSxJm5cn70dOd/3yBRod dmRx+Q44LCveic9CAQFwNStbUXgy1O6dLqCl8vx1gmqKnurvqcLXZJ6xRe93VdSJJuyj 72lw== X-Forwarded-Encrypted: i=1; AJvYcCW2P0X0EERU6sT6wUDSilrlqo+SxV2M+udywmrTMg48y9E/feZ4kfEf0QWuchh8qHF22A5AHT3TGVViEzA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4LmfKIKdNHLi7tCPx3BYfJosULR51E/w6QOH4Y0Z2y4QDvCi5 J3f7p+pa9KAmNParB/FWVZ8/xTufHwOobAi+hKp0RjdYfp84ZIqda2pu8sI/Y3oefyhQIamY75b BU2dmOJ4= X-Gm-Gg: ASbGncurPVOa5LSMX1O9utJREN0c5moTl6+dpIA9uJS8DoLfp1Hd2iLTkDL7DbXHuM1 7xanUZN6JcEiR67HCJJSE6cFyPBlJktWIl6J4VRI3wAst3NTwXS466mR15sWt2ufJsBcCrK9Pc8 4TJr++1sn5CtA9IXBSNnqPEHY8jeItgDOUuN7W5wHqkZLaDEM3iD3041DmSy13T/enrwQQP5FtH PcOpphmmDsJlvgQQtRK8Kg0iIzhc0ZEj1cZ50+a+rBvXwVomtgDsiH6fGkURhHxUr4GHdGRx4K1 HzvZiIiflxW7JrVduLBRHarSFfqD68Hi33sS4ruTthqsSy5zRzyZxHA0GAg0uBIzxFvS1oNasN2 oTo0O9/q4rP0MtOH6oCqxQhFwnOgVOa0= X-Google-Smtp-Source: AGHT+IEnPjhNqasqLPJXNXfyUk55gExFDeENYeLrLoOeeRhVHgumgF4nMbyLg4qCMWphC66ZYVvMpQ== X-Received: by 2002:a05:600c:444d:b0:43c:fe5e:f040 with SMTP id 5b1f17b1804b1-459f4faf68cmr95076395e9.23.1754904760755; Mon, 11 Aug 2025 02:32:40 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c45346asm39904799f8f.39.2025.08.11.02.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 02:32:40 -0700 (PDT) From: James Clark Date: Mon, 11 Aug 2025 10:32:06 +0100 Subject: [PATCH 1/6] coresight: Change syncfreq to be a u8 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: <20250811-james-cs-syncfreq-v1-1-b001cd6e3404@linaro.org> References: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> In-Reply-To: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan 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 TRCSYNCPR.PERIOD is the only functional part of TRCSYNCPR and it only has 5 valid bits so it can be stored in a u8. Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm4x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index ac649515054d..746627476bd3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -824,7 +824,6 @@ struct etmv4_config { u32 eventctrl1; u32 stall_ctrl; u32 ts_ctrl; - u32 syncfreq; u32 ccctlr; u32 bb_ctrl; u32 vinst_ctrl; @@ -832,6 +831,7 @@ struct etmv4_config { u32 vissctlr; u32 vipcssctlr; u8 seq_idx; + u8 syncfreq; u32 seq_ctrl[ETM_MAX_SEQ_STATES]; u32 seq_rst; u32 seq_state; --=20 2.34.1 From nobody Sun Oct 5 01:46:24 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 8F6ED1DED4C for ; Mon, 11 Aug 2025 09:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904765; cv=none; b=JH27GM7zof68fvgJJCvzKgQw+LzGv/MTndZrBWSL6YsOlBTbueVnBcYjH4L2Q28g7ymdVFFqyhH3pQAt72JPEOJhOCVCBnFpaUL9booykk5u+BzjrEq9F60twquJ24s88HrdJoxVCfikFdaErFd6pvgFGBJ/iJpNOMTwwuP8cx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904765; c=relaxed/simple; bh=Ghk9v8X6ZI95UzDotAn+mX7JIMr1ajnOOt+YAT0AZyc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kgsHDba8Yq9SYPFaXceHXoi68Tl2AR7/Qoj5UVxikTqHuIWZ74bzyBrZwG+CPH6MCeqpIAMl0cf73CZPxMp5zFgWPX423Q4pv3oCcQtbKiRJMJmdwi1n5PVEizgei/PGPpbGMybbN5Oqzy1ShJrHm34z/K6uRAbGlwqolV0mc8w= 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=a5m2uTZV; arc=none smtp.client-ip=209.85.221.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="a5m2uTZV" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3b7886bee77so3122459f8f.0 for ; Mon, 11 Aug 2025 02:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754904762; x=1755509562; 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=KdeJ4JSRd2ijrq8xQhXxaRgP6MLKlDNmproFaVga4Ac=; b=a5m2uTZVGIwKTuVt2sU1f5NGG8cD24Mr/QP9+AR6d/Z7XSzlSFMtVYphcXV18rC9pM RjFhWjl3Wq5Yqa8ooxYJofAEg228Oy2Zz4Dkjp9+YF0Ic5rhwOvYxQa129GekhbfsNpD mJPpE2a15zFvtBRlx0OlEG5O9bM0zosPoRcR4HOIUR4KyxvI9VZAQGD2eQJ3kl3NM6Hw hnqxkiSWTtQcqEf7ys9HkcbYKaJ1NjQOyWB2CNdycs8rD1yTsUhtecwVtFsMRZzrhCRr 8/akQpJeOJrODWaFH6jFDYYy6pOKlxEN8HIJFUrcbNGW2fEVCfjfqwrgxXOAuYefbTFp 5pyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754904762; x=1755509562; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KdeJ4JSRd2ijrq8xQhXxaRgP6MLKlDNmproFaVga4Ac=; b=hYFqN4yDw/5MXOR4Zp70bUGL76vjShtF+Dr9pCIK845W92EZUQ2YkuMX28UPe6450n fZMOuknpPXrxu+CHgqAMtjpVMJjihHWXtcPePRL8VKb5pIgzPnI+uih+1ry/OvemTFOd Hd1EfcW7viu1PND8FkkLELJHImMbUp9G2lUC/dDaLS4BbT69uNOV/SAJI3JdSc1WaVPV tvoZ5WjaV1EtTinclBJKc0A3xnyKus1xjwG77FxPmpIPHDxMjesBwdy/yknoO8l/yfCE 9XGWo9HGYgGDKj0TAUUJUSyIyp6pdEFWIJ7n/8DFw71wuJdB3Jh/AHnwicUU4INwJP+B 30/g== X-Forwarded-Encrypted: i=1; AJvYcCU/adaScMFcoZ9HtopFL98EwQcdPDF7Ya6ZtF69+OXxv5gs+4joJ0oGgTylOvmRDA7+5a4qeCLNYH0cHtU=@vger.kernel.org X-Gm-Message-State: AOJu0Yzqq8mXyUzM1lx9By23k1iOzebfPuvdU+n6gLk0kq7Obl4Mdn0b NjALT98xjbSm7Kgf/PK6ptFEY9PVpP2Pi8Wq2jgzVVGG+go6CoQ+JOb258ALZnTcpmZ+IHjgz/u NwkjCduw= X-Gm-Gg: ASbGncvJG2MWx+4LjrSOfiIvHfwP+5SnONtnDc9AYw5z+8sV+X8kJqYWlzR7lIZwQka XQkyVqz3kboOGW0WAu2aGNk9/ieukjPIPLD6QHPkyUIpTBjTzjHFZiQOTziVpT45+7k0RqCS/qd D1kLsOZRF9y8lJqq9O2a2DP5s9xxx1AH70QXqyx/jHAJA4o2qMi9k2MV1WLHc5M7rocO7uETlnR 2k2jrMIXbwgughqZcdyvoOFwAg8D1Hfb28lhDDZQYnVdyQmSZQEWpKiXq27/VeBAu9JwWFZzIkn K2u+ySH4reMnw3naG/eRu1uB51LksFr5XPtYBwXD471y5XBh99LvefXkKrKQA2Ny+fvGo+iDt8f R2wK5xwL5Bu+/VTvYWe73fGTqCrzAYck= X-Google-Smtp-Source: AGHT+IF4rGypTA6LAa8xSMn4qKFuOrcs8J0oYr3jFggkDuO4RAE4D4QxeRDmMlz2n46JWmeJ8gWF6w== X-Received: by 2002:a05:6000:290a:b0:3b7:9c79:3293 with SMTP id ffacd0b85a97d-3b900b8bf31mr8716728f8f.58.1754904761700; Mon, 11 Aug 2025 02:32:41 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c45346asm39904799f8f.39.2025.08.11.02.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 02:32:41 -0700 (PDT) From: James Clark Date: Mon, 11 Aug 2025 10:32:07 +0100 Subject: [PATCH 2/6] coresight: Fix holes in struct etmv4_config 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: <20250811-james-cs-syncfreq-v1-2-b001cd6e3404@linaro.org> References: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> In-Reply-To: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan 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 Lots of u8s are mixed with u64s and u32s so repack it to save a bit of space because there's one of these for each ETM. Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm4x.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 746627476bd3..a355a1e9606d 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -832,28 +832,33 @@ struct etmv4_config { u32 vipcssctlr; u8 seq_idx; u8 syncfreq; + u8 cntr_idx; + u8 res_idx; + u8 ss_idx; + u8 addr_idx; + u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP]; + u8 ctxid_idx; + u8 vmid_idx; u32 seq_ctrl[ETM_MAX_SEQ_STATES]; u32 seq_rst; u32 seq_state; - u8 cntr_idx; + u32 cntrldvr[ETMv4_MAX_CNTR]; u32 cntr_ctrl[ETMv4_MAX_CNTR]; u32 cntr_val[ETMv4_MAX_CNTR]; - u8 res_idx; + u32 res_ctrl[ETM_MAX_RES_SEL]; - u8 ss_idx; + u32 ss_ctrl[ETM_MAX_SS_CMP]; u32 ss_status[ETM_MAX_SS_CMP]; u32 ss_pe_cmp[ETM_MAX_SS_CMP]; - u8 addr_idx; + u64 addr_val[ETM_MAX_SINGLE_ADDR_CMP]; u64 addr_acc[ETM_MAX_SINGLE_ADDR_CMP]; - u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP]; - u8 ctxid_idx; + u64 ctxid_pid[ETMv4_MAX_CTXID_CMP]; u32 ctxid_mask0; u32 ctxid_mask1; - u8 vmid_idx; u64 vmid_val[ETM_MAX_VMID_CMP]; u32 vmid_mask0; u32 vmid_mask1; --=20 2.34.1 From nobody Sun Oct 5 01:46:24 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 A9DC8223DF0 for ; Mon, 11 Aug 2025 09:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904766; cv=none; b=GHduzfmNLy/MWAOFoFW4tthDny5rDBz0ypRK2vnd8Rr9a4e/oaWuNmV0M3gH/s+M6I0Gpz1X2L3rx/xGSYOt2Pt31hVrMlGQv3uRRAs8yXIsultBK/cqzJEbWF55HncvGZbDz90bXrxx4V84ClxdM7mRBprsZoyI8Vdied93PaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904766; c=relaxed/simple; bh=m7ucCcGVN0FUBECCGdzVEI3m8S2GTPWLCEum9ShUMNA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I6o/NeR2lUbPJEgT61+8qJD2ITGZXoblwzyUH6QZQz3APBsVvdnm1y6H7RSp5Q3XY+8hKKTsvdyea+PbI+TEkConiILYRGpKH5tuRliCxYjAfUEM+I1K2LDmBT5DXzrFZ0aXggNx6NTyfd94DmebHfTPIbitBILyYS9OuxkN9mE= 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=bOyCkbIl; arc=none smtp.client-ip=209.85.128.52 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="bOyCkbIl" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-45a0d5e4c45so2082065e9.3 for ; Mon, 11 Aug 2025 02:32:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754904763; x=1755509563; 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=3GDsN9LxSDEitQ0pzvRQqf9bGA4AutUNUEYwRrkhQ70=; b=bOyCkbIlQGlaaFvckPGg9UK/kyDTwKtKG7AHC5+YeUbp3TfntVNJ3nXrItmFgixAp+ NZZkhw7zgyL4TTXafNkqjvo25tmBZW62Nfisn5btteUQPxRd1ot0vXkbnhZoJ3TQTt7w d7JAodKnFY75Us+QSnAUI2Gkx2CxrNrgZVHNCesydn5F+s9Qn5TYdViybWRAACOySflg FlZ9tb97+HMR0U8i8y1qUmUbJto35VufmOBbllB8smXW4I3mEfnD38DwkJc1PANgRZuA WTCO7uyEBBAANyxIReAR85bRblqi+BZSX/OXmGw4njWcw3HL1owKUnbAMVIGQV3ugK7k VBXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754904763; x=1755509563; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3GDsN9LxSDEitQ0pzvRQqf9bGA4AutUNUEYwRrkhQ70=; b=C9cVik+eJBOa4qdtjkDcxDpxTGU8b6uz0AgqCifzTSdRkoxPIR6FVfI9XP/mwJjP2i 7xrSQUKo2NIVaZavMHmrHhN3zjSclbzNUNHrkNpQPqGRrjGT7gcgdsYBEdrZdYe/3Wxr IBCMHEQcTGd3U5ES7SdmBiEftrRUNzAGYv+bTOxxZ71+G3YmiqU4dbQEO3Zrk4TwoEZE 59h5hfMTqjwBkCk91ykYRvs1YQPWN4Nw2bPHr9MoYlGqHiMhJ5d6hGU7EuHJBNgODozS BGAlhYq6yG+PEwMjqMiqX04VXcfBLn+eDJJFZ/apU1cbn6QeHx1GQcJjQn3I5xrJUd1i zg8g== X-Forwarded-Encrypted: i=1; AJvYcCVig2MM77gfRNsvY9BD2FGVrRJKmIZrplSKRLmnxosQrjn82K3YhREDxm2TYLwOnrYLqPt5nLcbgMLhZ7o=@vger.kernel.org X-Gm-Message-State: AOJu0YwloFv9V0OJY/VnpjaY/CiTQuqIZgJX8JDUBknOBWrSme40/INt HsWIuFJ28BlDn5MCP95LU1Op/hiHAw+JKy2qM3RJJ2J7oWbr5bL4izQ+sAZdNqOmqlAS7FAgV5W LqMrZbaM= X-Gm-Gg: ASbGncvB1plbyxdrEkRnRsfqQz9/Pxd+2VkaMran27TyfNcebdGYVWtcgjTTgZMEXGA 55fzg2YIe9IbCQf1pAnsV7BQ9ee71hn16KE3RDklsfW8N9xjCJERHjukdYVxUpGYE7CFUI25/1J /BeQwBi56L3iwTjLxjlvtRT1HBJGpmf0V8TpDKGAN3CYXUUdykPLpjOD4U7SwD5I0bzoKijvVSt rib2jeJfnbJsROKdziXZYxZw5IbS4+6akZdDactb47L16kjNRb9KzA3IV8ImRbTZAb9kRVINhRP /Z53eJDGJZxLqBahbBh6TwxJmeKknSp0kuvrXwDCwC+AmJ/Gzw33rBLEO9TJ+pYQMRIOP/dFVaJ Tw06r5nMrPi5N72UM9BWdk3G+LBWLbrQ= X-Google-Smtp-Source: AGHT+IGq+ywQDRPYbHWh34YnCQ/IpGU3if6J27Zgp8ZmTttsheGYVInR3KO4d/MWZnAmbDz0jxuqcA== X-Received: by 2002:a05:600c:450e:b0:456:1006:5418 with SMTP id 5b1f17b1804b1-459f4eb5e2dmr95609655e9.13.1754904762901; Mon, 11 Aug 2025 02:32:42 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c45346asm39904799f8f.39.2025.08.11.02.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 02:32:42 -0700 (PDT) From: James Clark Date: Mon, 11 Aug 2025 10:32:08 +0100 Subject: [PATCH 3/6] coresight: Repack struct etmv4_drvdata 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: <20250811-james-cs-syncfreq-v1-3-b001cd6e3404@linaro.org> References: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> In-Reply-To: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan 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 Fix holes and convert the long list of bools to single bits to save some space because there's one of these for each ETM. Signed-off-by: James Clark Reviewed-by: Mike Leach --- drivers/hwtracing/coresight/coresight-etm4x.h | 39 ++++++++++++++---------= ---- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index a355a1e9606d..1c67b263b01b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -1020,29 +1020,30 @@ struct etmv4_drvdata { u8 ns_ex_level; u8 q_support; u8 os_lock_model; - bool sticky_enable; - bool boot_enable; - bool os_unlock; - bool instrp0; - bool q_filt; - bool trcbb; - bool trccond; - bool retstack; - bool trccci; - bool trc_error; - bool syncpr; - bool stallctl; - bool sysstall; - bool nooverflow; - bool atbtrig; - bool lpoverride; + bool sticky_enable : 1; + bool boot_enable : 1; + bool os_unlock : 1; + bool instrp0 : 1; + bool q_filt : 1; + bool trcbb : 1; + bool trccond : 1; + bool retstack : 1; + bool trccci : 1; + bool trc_error : 1; + bool syncpr : 1; + bool stallctl : 1; + bool sysstall : 1; + bool nooverflow : 1; + bool atbtrig : 1; + bool lpoverride : 1; + bool state_needs_restore : 1; + bool skip_power_up : 1; + bool paused : 1; u64 trfcr; struct etmv4_config config; u64 save_trfcr; struct etmv4_save_state *save_state; - bool state_needs_restore; - bool skip_power_up; - bool paused; + DECLARE_BITMAP(arch_features, ETM4_IMPDEF_FEATURE_MAX); }; =20 --=20 2.34.1 From nobody Sun Oct 5 01:46:24 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 291D68248B for ; Mon, 11 Aug 2025 09:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904769; cv=none; b=AwhRlC7Y2eUxTV/bVCNSgwO0+oPIvfsMmsaKCFup8tsaE6WCynjGn+MiZWE32WXo0rxb3HUY8xAVFt+Xi1UgN7GGoYmekCD+oLTyE7yCOkAxQtaf6hUxbh48jWMrxqSuReq2DOWDoJrY/+/82HZdBbnzWqpqPSZh8VsONo/cEMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904769; c=relaxed/simple; bh=U8TkMqWfDTBWjb8GRi9+VCChj3K0XOJrpYPU0RGTnw8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cECiy8kRK7dgnokArbjdXwEPDI6pKl7KLYujz+s7EogMN2KiY3GgXjwriaFA4AwFUoYFHPZ2GnZNNdTTIAGVI021LqUHD9yugyN0g4PDr/HDOKL8oLCuW0Hrd+MXYrICQ7jGsksJpib5zUsBt40raxF9tVa5KIgNFEnCdPE2JSk= 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=WaPV97H/; arc=none smtp.client-ip=209.85.221.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="WaPV97H/" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3b78d337dd9so2508392f8f.3 for ; Mon, 11 Aug 2025 02:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754904764; x=1755509564; 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=UCFJWq6hVWDLLnb3WEoK3x2DCujP3OgS7K9EwJG0Zgk=; b=WaPV97H/1HVJobO0jHweb5V7XspdUpfj+yWdrWKqhrFT7c2jh40RueECwPR6ijJPgi iWlHxaqkpgsPsw1nnbhw4uWt+O5uy+RParOlQU8or98tTgd+qQ/Q6FFO9Aauygz5hdnl vO2iK1X8rH78rhbsbCI1xUPA8yD5aLK8qwek8ukiQAfaEHZei2NkwuQRPpddsgG8fRz4 1nM0Vi3cgpSVRo7IxfqlMieyVsLzsxw+eYskWvgDW90Id3Ql9zNYcUH9I3WeJ87qNQV8 /tePCpy2Az/lvt3laqPj45j3K5xPzUmNHVMZzLcRzECt/4pm6yrAgTraL7bzc1wIqC1D eEog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754904764; x=1755509564; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UCFJWq6hVWDLLnb3WEoK3x2DCujP3OgS7K9EwJG0Zgk=; b=wjAlEu1JptwDhNjIjaTgLZi0TujGJrZG5sDpN0t7AqFvqFdF8ir44tFipgIaP4fzL2 2qXU3c23rn73Soyx46KNbMjI03h1lEdehlwt2e1fPOqZ0TOJuxwDNCNkCNYYUSYLsCI4 IChme4zr4OUO0NDoQtQkrznYHkMPqKiTyf+Gt6h+yAAIYzhpBhJfgv0RAR+FUavc0R3T YWeYCPeH+RB+iJnuoXUgB4xhuS79tXHV4kJijCyZbGFdCYaVeGdKL8p4FHusOHl0mY8B gB2HlhmOvPf+Yy1WMPqcvF/j6HvogDVozX3Sm92Es2raAhtHfXzGYm9Ban9hpv9pwv0b exKg== X-Forwarded-Encrypted: i=1; AJvYcCV0BAPMyUNhpWhsuWJnkopaexAarikP87J50fUPJHNA+vGvFblUN71YZUiH0zjrdkKsrBu67H6r4ry1pKY=@vger.kernel.org X-Gm-Message-State: AOJu0YzU+jFQ7gSE/84+8thY7rhqiOuVYHI1RRewk74l7y/YUd2noe7A SVctaughvrfQZXdcxa2gPSr7BiPtHGRq1T6880Fslmj/G7zrGiEvvnxyWfMaEI89ObUTYQdLUCd XL7SPaZA= X-Gm-Gg: ASbGncuzGJgyj+pF7k3yzLKiUvoFFQf36ay0B3hpH5WvS+yyFVFbK3HR575ALOX3F4r toBPhzE+fgsLwCPYnlN1F3yP/YUy914BerX/cbtl6TwzGmxTQjGSyD2415FD4IZkjWA6bXGCX8m u2PE7pUt65e+5Nx3FGEvjRy+87GICoQ+XIUajV7938tREVuaPm/0ywDNPeI3hGGfwv2ncPBrQHg 5zfYmgh4D6RBUp85VEqjuLCqM5URBamFrAHyvU/NnZYO7WadlfW3cBoZAyNxfdc7LwPY5NWH7Oc J/4XSOMqJlvrErAavhr0a1C3CfjDOThQQtiv/AX/3Aujtfan8AiM1+SS8Xlq8anqCiOloyB3+Pw juA8ZLdXeXD8aYDscPBj5ZjWHscogSJA= X-Google-Smtp-Source: AGHT+IGwXBJru7lzSvqSg6s6aOA3Q/MWqjAM+gI5z5Pyj6soY54J04BAuUaaiohr/CZ2BO2EaR5SGw== X-Received: by 2002:a05:6000:430e:b0:3b8:d12f:67ef with SMTP id ffacd0b85a97d-3b900b5060fmr9681173f8f.31.1754904764235; Mon, 11 Aug 2025 02:32:44 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c45346asm39904799f8f.39.2025.08.11.02.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 02:32:43 -0700 (PDT) From: James Clark Date: Mon, 11 Aug 2025 10:32:09 +0100 Subject: [PATCH 4/6] coresight: Refactor etm4_config_timestamp_event() 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: <20250811-james-cs-syncfreq-v1-4-b001cd6e3404@linaro.org> References: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> In-Reply-To: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan 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 Remove some of the magic numbers and try to clarify some of the documentation so it's clearer how this sets up the timestamp interval. Return errors directly instead of jumping to out and returning ret, nothing needs to be cleaned up at the end and it only obscures the flow and return value. Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 95 ++++++++++++++----= ---- drivers/hwtracing/coresight/coresight-etm4x.h | 20 +++-- 2 files changed, 77 insertions(+), 38 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index cbea200489c8..1a2d02bdcb88 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -608,18 +608,33 @@ static void etm4_enable_hw_smp_call(void *info) * TRCRSCTLR1 (always true) used to get the counter to decrement. From * there a resource selector is configured with the counter and the * timestamp control register to use the resource selector to trigger the - * event that will insert a timestamp packet in the stream. + * event that will insert a timestamp packet in the stream: + * + * +--------------+ + * | Resource 1 | fixed "always-true" resource + * +--------------+ + * | + * +------v-------+ + * | Counter x | (reload to 1 on underflow) + * +--------------+ + * | + * +------v--------------+ + * | Resource Selector y | (trigger on counter x =3D=3D 0) + * +---------------------+ + * | + * +------v---------------+ + * | Timestamp Generator | (timestamp on resource y) + * +----------------------+ */ static int etm4_config_timestamp_event(struct etmv4_drvdata *drvdata) { - int ctridx, ret =3D -EINVAL; - int counter, rselector; - u32 val =3D 0; + int ctridx; + int rselector; struct etmv4_config *config =3D &drvdata->config; =20 /* No point in trying if we don't have at least one counter */ if (!drvdata->nr_cntr) - goto out; + return -EINVAL; =20 /* Find a counter that hasn't been initialised */ for (ctridx =3D 0; ctridx < drvdata->nr_cntr; ctridx++) @@ -629,15 +644,17 @@ static int etm4_config_timestamp_event(struct etmv4_d= rvdata *drvdata) /* All the counters have been configured already, bail out */ if (ctridx =3D=3D drvdata->nr_cntr) { pr_debug("%s: no available counter found\n", __func__); - ret =3D -ENOSPC; - goto out; + return -ENOSPC; } =20 /* - * Searching for an available resource selector to use, starting at - * '2' since every implementation has at least 2 resource selector. - * ETMIDR4 gives the number of resource selector _pairs_, - * hence multiply by 2. + * Searching for an available resource selector to use, starting at '2' + * since resource 0 is the fixed 'always returns false' resource and 1 + * is the fixed 'always returns true' resource. See IHI0064H_b '7.3.64 + * TRCRSCTLRn, Resource Selection Control Registers, n=3D2-31'. + * + * ETMIDR4 gives the number of resource selector _pairs_, hence multiply + * by 2. */ for (rselector =3D 2; rselector < drvdata->nr_resource * 2; rselector++) if (!config->res_ctrl[rselector]) @@ -646,13 +663,9 @@ static int etm4_config_timestamp_event(struct etmv4_dr= vdata *drvdata) if (rselector =3D=3D drvdata->nr_resource * 2) { pr_debug("%s: no available resource selector found\n", __func__); - ret =3D -ENOSPC; - goto out; + return -ENOSPC; } =20 - /* Remember what counter we used */ - counter =3D 1 << ctridx; - /* * Initialise original and reload counter value to the smallest * possible value in order to get as much precision as we can. @@ -660,26 +673,42 @@ static int etm4_config_timestamp_event(struct etmv4_d= rvdata *drvdata) config->cntr_val[ctridx] =3D 1; config->cntrldvr[ctridx] =3D 1; =20 - /* Set the trace counter control register */ - val =3D 0x1 << 16 | /* Bit 16, reload counter automatically */ - 0x0 << 7 | /* Select single resource selector */ - 0x1; /* Resource selector 1, i.e always true */ - - config->cntr_ctrl[ctridx] =3D val; - - val =3D 0x2 << 16 | /* Group 0b0010 - Counter and sequencers */ - counter << 0; /* Counter to use */ - - config->res_ctrl[rselector] =3D val; + /* + * Trace Counter Control Register TRCCNTCTLRn + * + * CNTCHAIN =3D 0, don't reload on the previous counter + * RLDSELF =3D true, reload counter automatically on underflow + * RLDTYPE =3D 0, one reload input resource + * RLDSEL =3D 0, reload on resource 0 (fixed always false resource, never + * reload) + * CNTTYPE =3D 0, one count input resource + * CNTSEL =3D 1, count on resource 1 (fixed always true resource, always + * decrement) + */ + config->cntr_ctrl[ctridx] =3D TRCCNTCTLRn_RLDSELF | + FIELD_PREP(TRCCNTCTLRn_CNTSEL_MASK, 1); =20 - val =3D 0x0 << 7 | /* Select single resource selector */ - rselector; /* Resource selector */ + /* + * Resource Selection Control Register TRCRSCTLRn + * + * PAIRINV =3D 0, INV =3D 0, don't invert + * GROUP =3D 2, SELECT =3D ctridx, trigger when counter 'ctridx' reaches 0 + * + * Multiple counters can be selected, and each bit signifies a counter, + * so set bit 'ctridx' to select our counter. + */ + config->res_ctrl[rselector] =3D FIELD_PREP(TRCRSCTLRn_GROUP_MASK, 2) | + FIELD_PREP(TRCRSCTLRn_SELECT_MASK, 1 << ctridx); =20 - config->ts_ctrl =3D val; + /* + * Global Timestamp Control Register TRCTSCTLR + * + * TYPE =3D 0, one input resource + * SEL =3D rselector, generate timestamp on resource 'rselector' + */ + config->ts_ctrl =3D FIELD_PREP(TRCTSCTLR_SEL_MASK, rselector); =20 - ret =3D 0; -out: - return ret; + return 0; } =20 static int etm4_parse_event_config(struct coresight_device *csdev, diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 1c67b263b01b..aaa6633b2d67 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -224,6 +224,16 @@ #define TRCRSCTLRn_GROUP_MASK GENMASK(19, 16) #define TRCRSCTLRn_SELECT_MASK GENMASK(15, 0) =20 +#define TRCCNTCTLRn_CNTCHAIN BIT(17) +#define TRCCNTCTLRn_RLDSELF BIT(16) +#define TRCCNTCTLRn_RLDTYPE BIT(15) +#define TRCCNTCTLRn_RLDSEL_MASK GENMASK(12, 8) +#define TRCCNTCTLRn_CNTTYPE_MASK BIT(7) +#define TRCCNTCTLRn_CNTSEL_MASK GENMASK(4, 0) + +#define TRCTSCTLR_TYPE BIT(7) +#define TRCTSCTLR_SEL_MASK GENMASK(4, 0) + /* * System instructions to access ETM registers. * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions @@ -823,7 +833,7 @@ struct etmv4_config { u32 eventctrl0; u32 eventctrl1; u32 stall_ctrl; - u32 ts_ctrl; + u32 ts_ctrl; /* TRCTSCTLR */ u32 ccctlr; u32 bb_ctrl; u32 vinst_ctrl; @@ -843,11 +853,11 @@ struct etmv4_config { u32 seq_rst; u32 seq_state; =20 - u32 cntrldvr[ETMv4_MAX_CNTR]; - u32 cntr_ctrl[ETMv4_MAX_CNTR]; - u32 cntr_val[ETMv4_MAX_CNTR]; + u32 cntrldvr[ETMv4_MAX_CNTR]; /* TRCCNTRLDVRn */ + u32 cntr_ctrl[ETMv4_MAX_CNTR]; /* TRCCNTCTLRn */ + u32 cntr_val[ETMv4_MAX_CNTR]; /* TRCCNTVRn */ =20 - u32 res_ctrl[ETM_MAX_RES_SEL]; + u32 res_ctrl[ETM_MAX_RES_SEL]; /* TRCRSCTLRn */ =20 u32 ss_ctrl[ETM_MAX_SS_CMP]; u32 ss_status[ETM_MAX_SS_CMP]; --=20 2.34.1 From nobody Sun Oct 5 01:46:24 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 4C78C2DEA73 for ; Mon, 11 Aug 2025 09:32:47 +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=1754904769; cv=none; b=KdlnCE531yXPs5fR3bCfUP2CmDrjLRVhiH9IS166gwhtuYepU8/S/hxG+ogtNP/g5ABgZKdtJB+HHjH2Hv5THBOo29zSqGE+aC8jFMrqVJG7DNkEq7jPfNT+WzAAdQaPAywZH11YCE9KKrpf7EI2Ze8QlNn+bZSw0z8Z3vF61og= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904769; c=relaxed/simple; bh=wpvKm03JgBns8SErxtyGsvGNWNV6pSmX+F+F8Bl1AxQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sXF19lBef0bX5H3eY3CY3Vc65X1JZQm1rJJoTFjvG5zq0sLxjJ4ev1Hd6RO9tX4E1FHJylIk38ZzDM/FCBoL0Htcf0cvJz7laf9yfsoc7VFZdu/QrYlcSnHc7SZgSs5wGNDPUhJYAd0bozxze9SXep3UjbKrrVJuzxZSm7NV+Sk= 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=RYtj4f+E; 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="RYtj4f+E" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-459fdc391c6so14820725e9.3 for ; Mon, 11 Aug 2025 02:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754904765; x=1755509565; 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=+wY/wlxwOBKXlk5tbUQnKyA0OI06WJcUCTjg68F176k=; b=RYtj4f+EAXTN9pt/1sGOhvJj6fWfqjMgHUWdjrqQCaGpcmrgpNFFvcpQtCz0febv5z U86qJBdkRipOj0mjipLi30Dr9f0EqWB5tRYYWJDu0LI5J6bwmOZOVC1yP71JINEYNzY4 Sp2cbc/OiUruq+CdGzYxBR6AKho2j8mdeHB/iGzzqpCxBvU1BWmWfkdXNtmP7sIzIZqX yGcxWWscysoxVr+aT+N0Xk6ozLu9XL7QuYmgugByXPFAF5W/6QxqRmvGUbYxUzD2KOVM qwcQ4ysrmaxzC8iC1z0nz4B4pEmynCOrr0OcxH/4A5FEmk4Qo0v8C7+ddvc7MgUdeFLG 6DBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754904765; x=1755509565; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+wY/wlxwOBKXlk5tbUQnKyA0OI06WJcUCTjg68F176k=; b=QyL43tOYsmFl7i1Dtj6Go4AQfbn9H/UCLopNBs3joEvged3s1ZrZKy7CVLwaZcfPC6 AoH6ftfpmjtXp7pBdwrphLi8cz8Az1BkR34c1g1pagcCFlMWKk6JlDOe2WkrFi1R94I3 LmLLteREiapua+ZVZoWjY64nJSZfj0iclRK4jGQnMbT3Li3STgWBH7Z3gsAH1uM2Y/aL nd/Cy5DCh/HWM3WnVRQyMcIlwWnxL5UzJZnZ+XJpxie4Eyp0/6HBGj6JVmj3+3MG+VYg Rv2F8O5oQPOe6KV/Gzzf8/Y65HSWWpIcPCSaN42zD6fb916ioHNQigMcKN8SPUAUcxRy RnhA== X-Forwarded-Encrypted: i=1; AJvYcCUjD9dXL6JSDrfOprV270QhxkNb8a81ZB8gQSBRVblFEkIcEuoQvm2bxJ1l1RrBaj3bYgL4jDIiWBCLqP4=@vger.kernel.org X-Gm-Message-State: AOJu0YwYqhPdshtdALdsOQb3TNApjE6KoSfupoTkVVqBYigt9SlECK0y Yleff/t3CtZotis0YbQb6C5X39eu5HmRuCa+rUu73Q3EnygNchEApFkDA5fQ/nOiSQ/hSrkBAGg luoiIZKA= X-Gm-Gg: ASbGncvHdFoGQSIrJWJ6vOCxcFknuf8gI5ADv2d+f/Gqg5E0dwI8BURHLJI5BlJSBQI wpHs04NBXldaL0c1rebTaVIdBsSyJzunMABHG/EC4a+t3gWDVvZBUdrnaMif7cRoncBirT0BRcW ENBAo3Em8xDGZgEXRnp4Hloy4yixWDI12PjksCJNDNuNPvOZg+bJD5PFdJYacdobva9xyIYsd0p IYetnzK+Xkv/6gaUzTLuhjTLzJxDhEiR9WqnXzcOR8+Pnm/k0GEaV7YN8W/jkDaYj4JR+U9F9Qq hxRauyJYEz0JrD86+Qs55WNA+ZEQ2/5sgnsFiNIIJt9XOwBWICoZCF+U/9Tr4RIBNiMGUDB1Cdd OsohC3n4l3laXdQaeg4IpGCYj3iPpbTY= X-Google-Smtp-Source: AGHT+IF8WeH/oU2owgkUTiVQJ1UjH7XhvycJlh2P4qsYEEoxnO+VLtTmDk7n5fyagJVi0TbZzJM7jA== X-Received: by 2002:a05:600c:4588:b0:458:f70d:ebdd with SMTP id 5b1f17b1804b1-459f4f9b74cmr107921215e9.16.1754904765407; Mon, 11 Aug 2025 02:32:45 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c45346asm39904799f8f.39.2025.08.11.02.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 02:32:44 -0700 (PDT) From: James Clark Date: Mon, 11 Aug 2025 10:32:10 +0100 Subject: [PATCH 5/6] coresight: Add format attribute for 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: <20250811-james-cs-syncfreq-v1-5-b001cd6e3404@linaro.org> References: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> In-Reply-To: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan 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. Add an attribute to be able to set the interval. Granular control is not required, so save space in the config by interpreting it as 2 ^ ts_interval. And then 4 bits (0 - 15) is enough to set the interval to be larger than the existing SYNC timestamp interval. No sysfs file is needed for this attribute because counter generated timestamps are only configured for Perf mode. Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm-perf.c | 6 +++++- drivers/hwtracing/coresight/coresight-etm4x-core.c | 21 ++++++++++++------= --- drivers/hwtracing/coresight/coresight-etm4x.h | 6 ++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index f677c08233ba..c28ed6e63550 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,7 @@ =20 #include "coresight-config.h" #include "coresight-etm-perf.h" +#include "coresight-etm4x.h" #include "coresight-priv.h" #include "coresight-syscfg.h" #include "coresight-trace-id.h" @@ -69,7 +71,8 @@ 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"); - +/* Interval =3D (2 ^ ts_level) */ +GEN_PMU_FORMAT_ATTR(ts_level); =20 /* * contextid always traces the "PID". The PID is in CONTEXTIDR_EL1 @@ -103,6 +106,7 @@ static struct attribute *etm_config_formats_attr[] =3D { &format_attr_configid.attr, &format_attr_branch_broadcast.attr, &format_attr_cc_threshold.attr, + &format_attr_ts_level.attr, NULL, }; =20 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index 1a2d02bdcb88..42277c201d4f 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 @@ -615,7 +616,7 @@ static void etm4_enable_hw_smp_call(void *info) * +--------------+ * | * +------v-------+ - * | Counter x | (reload to 1 on underflow) + * | Counter x | (reload to 2 ^ ts_level on underflow) * +--------------+ * | * +------v--------------+ @@ -626,11 +627,17 @@ static void etm4_enable_hw_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, + struct perf_event_attr *attr) { int ctridx; int rselector; struct etmv4_config *config =3D &drvdata->config; + u8 ts_level =3D ATTR_CFG_GET_FLD(attr, ts_level); + + /* Disable when ts_level =3D=3D MAX */ + if (ts_level =3D=3D FIELD_GET(ATTR_CFG_FLD_ts_level_MASK, UINT_MAX)) + return 0; =20 /* No point in trying if we don't have at least one counter */ if (!drvdata->nr_cntr) @@ -666,12 +673,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; =20 /* * Trace Counter Control Register TRCCNTCTLRn @@ -761,7 +764,7 @@ static int etm4_parse_event_config(struct coresight_dev= ice *csdev, * 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, attr); =20 /* * No need to go further if timestamp intervals can't diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index aaa6633b2d67..54558de158fa 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -598,6 +598,12 @@ #define ETM_CNTR_MAX_VAL 0xFFFF #define ETM_TRACEID_MASK 0x3f =20 +#define ATTR_CFG_FLD_ts_level_CFG config3 +#define ATTR_CFG_FLD_ts_level_LO 12 +#define ATTR_CFG_FLD_ts_level_HI 15 +#define ATTR_CFG_FLD_ts_level_MASK GENMASK(ATTR_CFG_FLD_ts_level_HI, \ + ATTR_CFG_FLD_ts_level_LO) + /* ETMv4 programming modes */ #define ETM_MODE_EXCLUDE BIT(0) #define ETM_MODE_LOAD BIT(1) --=20 2.34.1 From nobody Sun Oct 5 01:46:24 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 D1C932BF3E0 for ; Mon, 11 Aug 2025 09:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904771; cv=none; b=tnfyJg5FlwuXykatCr5k0ROA33TXJbJQlD/OlBpi84fBCHZIrW3Fxy8V3+zSVhbcf3PiZ8r/uyVlu2xonoaahnOSUAWDTAjPYqiiVege1dpM5fKaQYCWd8z9TATTVUOomAnq8KP+8olbuphQxCKgMPV9DE8GHiIO6CQN455G4Aw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754904771; c=relaxed/simple; bh=o8uIpvdm8rS/o+S1mykUYGGLHkWfPhCsX3cg0yw1X58=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OzDIH5ROt8PkSszNiTqmCXwAG11fXiUQjXM/BxVCridGJbsLl7POaUGXV3AN8U8aYj5V+t0G/le2FP0dkD45ArjjullOE3cRdcHZg12nsFACKo0bGzsavnByeSKHl0RTiC/GBtqDSNbgeWu7gJbCQN2kObgKvJ4LurQYsEM3mrA= 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=l1+Db/9x; arc=none smtp.client-ip=209.85.128.52 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="l1+Db/9x" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-458b885d6eeso25656855e9.3 for ; Mon, 11 Aug 2025 02:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754904766; x=1755509566; 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=S28JNZPWK+3sAmARH83rSsyGla0uTsZRncPjJTp9toA=; b=l1+Db/9xG7MHbrXegbBRTEwdSYzS59sxv21Cik8GWAbImQn4MZ4UAm5FNjQzKdbc2Q 1QeFmuEwWLKk7IviqZq3PU63dFt97pahZrznp39RbZvnojyTbFjGarDPsjwreh1cvkEk Fa+Uq9QnMb6RBnXkuN02q83aXgl3KEhzcPWYCDys5p58orENTARKWat9Ux/cbCsEl0Bd tEfcArtd3dQZF0P2dWyY8fQj22t9i6KfSwA4UznMG0F6KPMOvGDaFKEgJ7eLmD8y+5b2 uCKPYthgmE2I3mMbcchffRnZRVeYlqzm1g1RP2dzyikgej9S5vj2azpZ6qO96ASL+9LG q9hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754904766; x=1755509566; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S28JNZPWK+3sAmARH83rSsyGla0uTsZRncPjJTp9toA=; b=Kiz7mbzaWn+l6iVXbBOQNHdOSfN3g79P/w/pAClQs9aTGz9jQV4JpwtL0C86cUkmUH 0l9bzvK0CVHaQJTKtnD0dMtQeuUzLINhdiAUWSUyVaCn5Pe+/HZebEKS0JlNPFCVZldI jUKAzXSXOzmGhKPJNRA8W8N8mxEzoqSLATCaUBuQfxT66h1ZjjhOMUjVhjQyFExQ/yxA 5j8aURAVogBo5/RYKldgRXKVo6x7P6cM4NRsMkeaH6zL5CeKXd6FDB7YOil4+5i91YLu pEdbjnnEcdFLUE1EbDoCy+dTTOKef0lRCxJs21lzWySuB4XKI5Xj1qO8MqMrCDu20q70 n6UQ== X-Forwarded-Encrypted: i=1; AJvYcCVIRPC+t9FjKojryUVHzkd3QUNSS4HhUF+ICiLi3yzG01vQngFZeoqkqdZwn1Sg7RWeSo1ePl3/dRo6c9U=@vger.kernel.org X-Gm-Message-State: AOJu0YxqKqlQ8JdiG4gpUFKRrq/9T9TtFN2fgypEZZdep4QkmiWKPkEy jk5azWuBtr74WEgOtAsxa78ExLtFJ3MuDQQS5dGbr1zjJtO/cuVjw3w+GBWGqNp/jIe/IKgLILF /9UahrCw= X-Gm-Gg: ASbGncv9FH73yJY61R+ipC6Ai2h59IVRdL4F/eEIUAJmB5IS7YGIQ9UlpJvfxdGmKyv 6JPjXhv96TYb/DjxPx3/DiFxwuMDhKWoQzt4wwko0BPlHFmaPtzy6xudEIF12/fWPazFDQHj42C HZ6XCUmzH3DMsiEcAeUnbHm/ilUafyS0VSh6AwiFHMyIt6Mj/rHOfucgSk2sLE2mYrq2D93OV1r Vr1yUjOnat7RAXfqXRHczS9rY+k0R+tXg730gFu9snBJ3e1l6TIppo/A3GDq9+V02Wsc9UWWxEl J2lu8th+acCGoqcKB4WtT1GmzmHGq4R3e2gMSGhLGDGa8bKaDU6pHVbSVNqaWPv4syWK6aBonmj w7hnU8g0MIOJfYwyQS5XGNOKwx7FUnmI= X-Google-Smtp-Source: AGHT+IFaTuEhnneSdqUPVkp8FKoh0YP1/7nEOnYDv0UVx8tWLL1thpj3XGM6kh71NmUAd49x6WzJSg== X-Received: by 2002:a05:600c:4509:b0:456:496:2100 with SMTP id 5b1f17b1804b1-459f4f2bac3mr129344465e9.31.1754904766361; Mon, 11 Aug 2025 02:32:46 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c45346asm39904799f8f.39.2025.08.11.02.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 02:32:45 -0700 (PDT) From: James Clark Date: Mon, 11 Aug 2025 10:32:11 +0100 Subject: [PATCH 6/6] coresight: docs: Document etm4x ts_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: <20250811-james-cs-syncfreq-v1-6-b001cd6e3404@linaro.org> References: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> In-Reply-To: <20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan 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 Document how the new field is used, maximum value and the interaction with SYNC timestamps. Signed-off-by: James Clark --- Documentation/trace/coresight/coresight.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/tr= ace/coresight/coresight.rst index 806699871b80..0cd83119b83f 100644 --- a/Documentation/trace/coresight/coresight.rst +++ b/Documentation/trace/coresight/coresight.rst @@ -619,6 +619,20 @@ They are also listed in the folder /sys/bus/event_sour= ce/devices/cs_etm/format/ - Cycle count threshold value. If nothing is provided here or the pro= vided value is 0, then the default value i.e 0x100 will be used. If provided value is less tha= n minimum cycles threshold value, as indicated via TRCIDR3.CCITMIN, then the minimum value wil= l be used instead. + * - ts_level + - Controls frequency of timestamps. The reload value of the + timestamp counter is 2 raised to the power of this value. If the va= lue is + 0 then the reload value is 1, if the value is 10 then the reload va= lue is + 1024. Maximum allowed value is 15, and setting the maximum disables + generation of timestamps via the counter, freeing the counter resou= rces. + Timestamps will be generated after 2 ^ ts_level cycles. + + Separately to this value, timestamps will also be emitted when a SY= NC + packet is generated, although this is only for every 4096 bytes of = trace. + Therefore it's not possible to generate timestamps less frequently = than + that and ts_level timestamps are always in addition to SYNC timesta= mps. + Timestamps must be enabled for this to have effect. + =20 How to use the STM module ------------------------- --=20 2.34.1