From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 AC5BB224B14 for ; Wed, 12 Nov 2025 15:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960953; cv=none; b=vGu8GVn/o7WL8qWMN0yoojdDnJk2mdOJ2OX0dB3Ew9aKpQ38sMo1GiA46Qg91SDiEcPdpW5/R++snp78KVEsJyZqd/HgVB+Rrve7COm0MDnyKzKYkutqyG6tWj1r+aeLRCrDe08TOwEfL2ao5swB0JYZKzMRWvsqUGfcvn9WJ08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960953; c=relaxed/simple; bh=thGvUXe9EBJVjRo9zSLEvcWrnhmXPs68T9d9mh3yfxw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=scAKMbjF6tmzxyYnyLELdFpyO5ls9eoCE7pUuYrNUuYScIFe/dNjEjHjuHitOELCILXrJiqr/BGs7Q+nWbV2EUcxx082+IxkS/zXM//AH08RbIAYvpyVLjVyjc9QK7uvBHC8B5M2AIrVPv5qwSeZ8dNuT5YQPYkBAdAJOD8HBkQ= 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=ERh989SS; arc=none smtp.client-ip=209.85.221.41 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="ERh989SS" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-429c4c65485so759875f8f.0 for ; Wed, 12 Nov 2025 07:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960950; x=1763565750; 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=FHWft60bOhabLyvWPLsf9Lg98jcEqwRduNX+1kYsZ4Q=; b=ERh989SS0br/fLIqkyHtsKNvataLKMoqtsnbjeTsyTnpy5msOD5FNbUbvzqGqOY86u bN3uUNghcKjSbjo+tQ3jP9FylEl4anURf8H+LC7WwA4gYg+l3awUDWFyB6oXEuTGwk6V KarkE3KtNuX6L+PSICn01ITNoXoHKRAMTD+ULzJDClnvX0RRPcbOAZitvdOICpmrRr1k jNgu2JPKloBNxZwZSPhviZIodK7NhQkZ7KL1Zv3pPabaknlv+pojfECb+NwxA4hn1FT+ Wolpci1c5XMDvNj2BNR7IDnWGK2qm1Ejq9B/zah9yiuBzHl4MCKbS/awPE/i4PkZmjJx CMOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960950; x=1763565750; 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=FHWft60bOhabLyvWPLsf9Lg98jcEqwRduNX+1kYsZ4Q=; b=cqRSPH2rEJjd1xZGdf5JlzswjIclNNc+Bd/ioLOS5eE8w7YUBAyD4zhvIYxFn1LJb4 YFjG1w0q/CJ3cGQO0na4waGDAgsI+1HUgeYebKRwF7DyBolM9SF9HINDUipOcxTYDH3H qloWQJy7AbvYNCgXzjmRCT0vw+WeCZz4omNhNp6I6H78KSSnddSpN1dk3J2EeWer36mJ VAoW94hW1+Z78FoMWYndHymxCJuBjvfO1xt2X6P1Ny1lr9uV1dPFREc+K/Tu1jYgYajm yHY7kNObsYK2wypehEGMem5Qrob0JRZIlWQkZ2y2p9L9GKhrMeqm9d/G2iAGZBigIYwZ oqTg== X-Forwarded-Encrypted: i=1; AJvYcCXsh2SelUI8o1YrBpyywtVbSUrKO0xk2NTFrHbzGu9c9M3RIAhdKx+WQ/pSouWf47QqHHWjp8imxZeq4mU=@vger.kernel.org X-Gm-Message-State: AOJu0YyLObEZYmSA9w3Y+EKmluOGeB4/TcsFPxSSQPSKZr0tfqfCiCSt Ak19oFIS9UfCX4qNEnGtz9BZk/uGI3q7xnmq5vj53Iu/piYOgswNa1Ys9bkVhtRaB6etJRf1qey mM+mN+PA= X-Gm-Gg: ASbGncsqGHdXK81TjMmfzeFU1Dl3CfUYwS3sANsP8SENiJ/zNO2dBsNaNgLgJ14mI0K 8ulZZm7N0jXuAyd+3UMqTn6+9zHX+T+NAbeHt6kNrnWS2QkK/a3mqzDyBBaZSY3G8BCBiUE4QVp 0dis7/7fvCf5V8mpJx2HInjRxasQNf3P5HNa6JAWteXIfpYMV5EYe3jqt/ntvzqNs8u1AzSKMMa Gg4zPUBxXQ+gjQfS8+Vg/GxQNgu0hcUrDtHtQ+WdMA4TDd4V0lhCcjZ5vTMnddbTp0RrAPXu7Wa GGVW3eVdo9J28xsq+x0EMveBnV8EaS4Pcg8KU7WvHI3jXK72MYgcedZhdI1q1P6r4OXHGGruo6T 7kEbOdRA8auKX8QEwXJ5mhZsq8nGCa0ipbziOfgBFFQyUspBerF0ggcaGoWDxnTEjIC5kEze19X 9B3lO8Rk6L0Q== X-Google-Smtp-Source: AGHT+IH52DNTLBb7al5zttlsVEiexafiX+OCjlQQr0fildUN7BN1eWHybUmsF+e2JGT9znBkdM3Dzw== X-Received: by 2002:a05:6000:3106:b0:42b:3ab7:b8a8 with SMTP id ffacd0b85a97d-42b4bb91763mr3253408f8f.17.1762960950054; Wed, 12 Nov 2025 07:22:30 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:29 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:07 +0000 Subject: [PATCH v4 01/13] 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: <20251112-james-cs-syncfreq-v4-1-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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. Reviewed-by: Mike Leach Signed-off-by: James Clark Reviewed-by: Leo Yan --- 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 8d4a1f0f1e52..56a359184c6f 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -826,7 +826,6 @@ struct etmv4_config { u32 eventctrl1; u32 stall_ctrl; u32 ts_ctrl; - u32 syncfreq; u32 ccctlr; u32 bb_ctrl; u32 vinst_ctrl; @@ -834,6 +833,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 Feb 8 22:07:49 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 7BB2F285C84 for ; Wed, 12 Nov 2025 15:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960954; cv=none; b=uIvgjUm7v2eLbNpsM7wo3dTuCHiAP7tRcCTa3tnTRHZvi5/I3vwqY/1owWGWWpyyfTdekY+1fgK11M9/p1BmNjhjRB4PeaFErb4IgT3cSjmO0wngJNH1CmX1Kaft32hZduBozp86MUKzMk1cre3g3okLCJUNHI9jd4qBPmYyfvQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960954; c=relaxed/simple; bh=OwkdKB4I5DhVWVGSI73e7fFifbHjwD0w7111SvrRlUM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b1Z+jPOzxsyH8pZugSXQpW10aWPJpuAwQQ3+E3geI9sAekyX4FTj+4XmO9EL5VzJmYRegCPsKQGG0x7sNm2uNhOJ3nhhkbhM64PHcb602v57vXxl0ZLLdQ6Bywe2fpJU9RzYBrZy9eUXxRavqnzYDIHL1RLOD8LPOY0ESl7wSSA= 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=n4yaMC9Z; arc=none smtp.client-ip=209.85.221.54 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="n4yaMC9Z" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42b3669ca3dso514733f8f.0 for ; Wed, 12 Nov 2025 07:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960951; x=1763565751; 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=bzxatPwaT12t+oimIyPlP1cYh9Rjm5+9wuJjQjgausI=; b=n4yaMC9ZDRX7T0jXeyvQaK+6uXNxf9Md2b0AZQM9/lMWDKUjWveRqnskc3ihVV/Xhw p40M3YY+XIqWkJ2bYtxl5pCsEP356GxrxpFs3/9jqoZ907U6J8e6EXmyVBqgsV6RPJ27 4CUjTu7km/mBU5RY8T7SVAQiznB+5JUyj1hQfk555s7QaPFBkU+XGomrtx/i96kJsOzB 6kxqvgFXQOqR7Y45o/eumg8ZjS90CQZ9p3i07haY0v4Jo832pD24r0OfAatiJL1EaL+W qChiPVRR84FWPpq7hyTncKh7gdlaCsCc1C2P15Y1glrTUNLKo20YOKURq4+UcGxJ9lIJ DnjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960951; x=1763565751; 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=bzxatPwaT12t+oimIyPlP1cYh9Rjm5+9wuJjQjgausI=; b=JoHFv5t9Pb8WxZztdTQEQHrLqb9/1OjCYlA+zXkYxLECS9qk1cqbiWWwUU7gpQbdLi hawXp9MfY5lT3D/bukW9h1oT83M8XEZgddQ49ut/arB+fgV9l+/xVbAxSIRIFQEXaBl2 esCqXNWgFf3ZmeVY88XxDcGfN3oAscz+3Pke1Hv8h04pF4zDmmvq946M1Axd1Qkwq0ig 7ssx88J2LmZWoLSG0dIXzgOSMeTGwvg61UUkF2HgvsSZz6O7KWJVRxxeR1+uEFdL2jhF yvHedeJ79jvb4JqjKeTLNXilxtKrlhwuWtgWmD4zrPeGnv8r9FzmtImh+ysRCq7LUmWE ktEg== X-Forwarded-Encrypted: i=1; AJvYcCWXlXcmslu1tLaMRNW4wzx2sBnIfvJzQFKrEYj3o/Nk1xtOs1X9uWAPcjk/yYLPzyilkgbZ4qot1PRfPlM=@vger.kernel.org X-Gm-Message-State: AOJu0YwWhqJWPR9haWkU4Oa4mnGo+z0VPvGVWX6zRkUPjuNz4V8Bcj1F WtERoK7N7NS6Tuf/Rtx6sEI8p5wnQ+B7urn58T53SanUpqvTUY75UMUP7D+/FcPKdwDmLzjSUVs jANngLRk= X-Gm-Gg: ASbGncuo3LCAi/J/9gx+AhNIML2ifXNZsk2Dd6uc+Nr/V4o02EyE+Dd/ijisONreY8M WYH825j87TuHUgfgypxFLLoFV5tEJdHU3+LKYKB3uA14Mhw3WModsPFZyJzDssPWl/u8S6fl2hc ZG0Q8DHvOUUp0doro7u6ejYqWifx3Eq5Tme2iyByDoc5gEWau/4rLQlQSsqZx1+SgJE6FtvVdQg JdrQtakP5GDNDOZDAanI/UVNe2vZ5QXOm9EpN8mCYoFX/CSFDrVlh2Ak25GXHdlbVoq8FRC4Sft h2iwylNqxL5OqpEizzofwI+Sj+kqXYPYxihHKx9qok/N7Hir2gFWevkwg5+CLVnRQaPdhvzQyTN ubDY9uVjgRw4mVfnTdWtEJOf+fYD2aONxqWfnLRDon36BNWyT0mvnbcMWUqAJUPlCv0l6xo4JoF dTWI8KwSeG4w== X-Google-Smtp-Source: AGHT+IGB7ysGckgxYCnh4ScRny7zYE81+b6VpNLPB820Ao4qDE7C2hKXOhk1d2vMPEvdwcsZY1zqmQ== X-Received: by 2002:a05:6000:184e:b0:429:c4ce:eeaa with SMTP id ffacd0b85a97d-42b4bdd625bmr3030116f8f.60.1762960950859; Wed, 12 Nov 2025 07:22:30 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:30 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:08 +0000 Subject: [PATCH v4 02/13] 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: <20251112-james-cs-syncfreq-v4-2-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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. Reviewed-by: Leo Yan Reviewed-by: Mike Leach Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm4x.h | 37 ++++++++++++++---------= ---- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 56a359184c6f..8f546764908c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -962,26 +962,27 @@ 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 skip_power_up : 1; + bool paused : 1; u64 trfcr; struct etmv4_config config; - bool skip_power_up; - bool paused; + DECLARE_BITMAP(arch_features, ETM4_IMPDEF_FEATURE_MAX); }; =20 --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 7CF872BEC31 for ; Wed, 12 Nov 2025 15:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960955; cv=none; b=lxUCU0I9+25/a9uW3WkGpqDnfm46AiOheNETkxGfGqN4MsgzTXHcENZiwsM7QD1O2GJ7SRpV6PdxDOg5/pX8dU74cpO1PCaR7WpPXpMi6MzPb8DOCCzcZiZukQCpH7tMDlfFlQMLbnhNoTL661N1mguQHsdJ0OorJ/FQYyeh6Ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960955; c=relaxed/simple; bh=S/F+Q8EHvKO9iseD/uYd6QcoJRU9qpbbRgMtnDRy1DQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sOdibg0Q3RUne7qnGLQJLiKubx99jZdEuq0/2e0H7SAqqRuGaIzOOkKaK1aMvPVF/6HuywCehnAo1ENn6yem+e/PeECcpNHPMXymPVfggd9pzsah0Sjnv9D33EU7VJBuGJgWbGwyMcypB2ZdIAwmIm0aE0a9bAN5a5u0hqWu/O4= 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=AighG2nT; arc=none smtp.client-ip=209.85.128.43 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="AighG2nT" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-47118259fd8so7084215e9.3 for ; Wed, 12 Nov 2025 07:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960952; x=1763565752; 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=2uusonc4IVmEmKIwyNSABzF5dmeq8W3J1RDTb9RhE1k=; b=AighG2nTC4EFpU//Fi0suUurF2WWtNHHGL+cwg93mgZTBUfMSZDs39Y11rItRd7Mn/ WBtOm2CV1ryWyv/vRxJh62sXTi5w+itBsFPr+qww/WGTFdIfNNl8Ht1f/x+aQ+CKZM/C RpnfXz+ti92wLao8f1mmaxEf4Qm58iSxrcRjA3ipFC6rFdBgIVkkjqxdEt+0qURSR7Sg UFIRX8wahEBt+Hhrv4QdyyDb4d9sTpol71KTOMhI3MM0tq/ZzLEjMl44waP2aMl0/NHg UsSNbS3zYaS1S9sCvKcGAwx6MgrQXogSWAUltLn0q/QXSHzPOORXH0tL92mKZC9eCeeo KXVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960952; x=1763565752; 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=2uusonc4IVmEmKIwyNSABzF5dmeq8W3J1RDTb9RhE1k=; b=LEPK+KQD5/XSV9a+0E4kRxsr352OhEm0EeTU14fAA2UeWocEtmiGAdu7tiyOSgY9ZE aakwc5uDeyoS/rkHBEIEH6hsLKlI6N4WA6Y8B0zcOIXt8QRkGoB31zPSFYSfkRbEc2DJ 45kMJSDmPRGqZIPUr4l1N9boJAtIix3R20gpurgw6WexAUVqxTVupZsxUkDqmSURgX98 QCbylAwfYRlQOM7GrVb4Yn/d1U5vMiadHWW+ybaUKP0s5spvCL07xAmU+Sp3ccffP1vp xGJdbX6L5Pb4OgmDelI5hlZaYcVBU/YPMeqNebTjROMq4REiHKWAZtXTvudUmvhTTmIg 20MA== X-Forwarded-Encrypted: i=1; AJvYcCWjPl638qV7XyLu5mLwzVI7rpBtau9UtQ0TUCGm3VCJ+ckZwYBDdlP866d5FLNx14fyPFdeSe+2CqqKwl4=@vger.kernel.org X-Gm-Message-State: AOJu0YyLMLZN79OwzBCIfFm0x3qQY04OexrfG93SUO2ljVJna0iQsdfZ z8ZKSK8swyXXVsQZNpsLjBB68J+Utc/5n4ANBCW7YH9kyKsDbqsQv0z/Ox5qdpDrPbuNaCN+aBF DvcBEeiE= X-Gm-Gg: ASbGnctSdhv4uKLm1WmBXilSfyQMqI3RBndVLTsd7oirM1tXXB3tAoh8E0JoQ/THcc+ usqQdsReMJI6kGg8gaVmRBR0G7YpB656tQuiq721NmqP50JgvUg6YTTjvYQhaSV57Iufqp3+YGb YYJi+lnIym31REq9bZd21x2VgNa/l4TaWT0MO8D6epRFo0bVzNphN1xm5LO7PtyoL0MjH+OAp4k gQaX4/v+0V6gFMzktz4fQxfFe0/ioN5p0HRHXNDzGCVmSHsnRNLWPJzPxCG8HPLXReZNBR0A5pd ZQiO2iB0pZTuUtVdqCNzfARIxIV/tmRVFrbXtgMsJ21MT1dgFyImLTWZEAt5n5ipfJm4jqZ2agU LddhaquQHfVUelc2tVT8zJDPCZnUXCon5HFfQuGYylSpfoSn2WBTfI1kWqlyGZVeTdcBiwV2cgw MiYhKfMurtIg== X-Google-Smtp-Source: AGHT+IE9sB9s/FnD51s9bvHKIuSCDAZDLn+Lwu16yVjVYz52tbr9N0U5pqNtEoKseunsJWxOI0/4tA== X-Received: by 2002:a05:600c:a43:b0:477:73cc:82c2 with SMTP id 5b1f17b1804b1-4778707ba5bmr33877885e9.9.1762960951695; Wed, 12 Nov 2025 07:22:31 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:31 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:09 +0000 Subject: [PATCH v4 03/13] 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: <20251112-james-cs-syncfreq-v4-3-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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. Reviewed-by: Leo Yan Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 96 ++++++++++++++----= ---- drivers/hwtracing/coresight/coresight-etm4x.h | 23 ++++-- 2 files changed, 81 insertions(+), 38 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index 1c17d5472920..380a7840adb8 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -651,18 +651,33 @@ static void etm4_enable_sysfs_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++) @@ -672,15 +687,19 @@ 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'. If there + * are no resources, there would also be no counters so wouldn't get + * here. + * + * 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]) @@ -689,13 +708,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. @@ -703,26 +718,41 @@ 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 RES_SEL_FALSE (0), reload on false resource (never reload) + * CNTTYPE =3D 0, one count input resource + * CNTSEL =3D RES_SEL_TRUE (1), count fixed 'always true' resource (alway= s decrement) + */ + config->cntr_ctrl[ctridx] =3D TRCCNTCTLRn_RLDSELF | + FIELD_PREP(TRCCNTCTLRn_RLDSEL_MASK, ETM_RES_SEL_FALSE) | + FIELD_PREP(TRCCNTCTLRn_CNTSEL_MASK, ETM_RES_SEL_TRUE); =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 8f546764908c..0f83a29320e6 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -225,6 +225,19 @@ #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) + +#define ETM_RES_SEL_FALSE 0 /* Fixed function 'always false' resource sele= ctor */ +#define ETM_RES_SEL_TRUE 1 /* Fixed function 'always true' resource selec= tor */ + /* * System instructions to access ETM registers. * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions @@ -825,7 +838,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; @@ -838,11 +851,11 @@ struct etmv4_config { 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]; + u32 cntrldvr[ETMv4_MAX_CNTR]; /* TRCCNTRLDVRn */ + u32 cntr_ctrl[ETMv4_MAX_CNTR]; /* TRCCNTCTLRn */ + u32 cntr_val[ETMv4_MAX_CNTR]; /* TRCCNTVRn */ u8 res_idx; - u32 res_ctrl[ETM_MAX_RES_SEL]; + u32 res_ctrl[ETM_MAX_RES_SEL]; /* TRCRSCTLRn */ u8 ss_idx; u32 ss_ctrl[ETM_MAX_SS_CMP]; u32 ss_status[ETM_MAX_SS_CMP]; --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 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 66FDE30AAC1 for ; Wed, 12 Nov 2025 15:22:34 +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=1762960956; cv=none; b=dkwBu/yqFsOAqjeK/1cLE0YjnHWK+HwpxmDPLEShNnmt50CdCFveuYVQi3DIbqVNS+5cM5bAAjy6VI5NchNw7a6toJzehF9TPjlB1ejvMzs68I3jPD0+UvVThxWzRHbScpbGgQbxWnA1qWJENB1eE++bglgcJ9PWXCGMocFYVvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960956; c=relaxed/simple; bh=210QQ0X8fq0FsJsy+nHQRHwEoHeTT7356Y9zDU0LrD4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AOUZ5CLu9L4tuWGmv7AglHM3J0comUA0P1RzKInpAYbGxfIDNhnGn+nlERdktpPBKGKia/U3NHafRf53aJEnQtDNk3/+ZEApnkAQFgzvNqwLS+qjkW1PQNSntHhkEtzuMeJU41bwLi30U8yPqZh3Dws6ftGLH8ywyNPRRBbo7UU= 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=nZ+xoPmq; 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="nZ+xoPmq" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4710022571cso8657455e9.3 for ; Wed, 12 Nov 2025 07:22:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960953; x=1763565753; 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=0f7cHeyj48y6Jvj7oQh+IhrQ2eaIAgk3d7czkbJdpbg=; b=nZ+xoPmqxjpzgnBm5PEj4FpVTUpDKQ/fXNiPB5bC8Do1/F76fU9QWX9Sk8mYPJtt/w yXvmzBEak/F4gbws7ZA5bnzr83HOri3KuTnuYQO5t67aAOJ4btkPt0Q0LLIsO/ZdAUfZ 7ftRfFSvmGKWYO/5qa8E/OESgYSUb5YJPBk/8f1LuePnb4RS1gJE2P9BNbj46KIq85NJ c+KmXDUogXKOizWFCMLibTX1SOp2vcJXXFlvytaQPbFtIeqK4mGGJzfFQFIb78LarP9h RXuTpOteudWDWoVsCt7mF5tmCQpuJxJsjS3IfXXSUKvy+PWlNcrXS7/h/W2tVoMyZpfv Me/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960953; x=1763565753; 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=0f7cHeyj48y6Jvj7oQh+IhrQ2eaIAgk3d7czkbJdpbg=; b=p7U6JWEthddxJ7rpio2KaY5o5rFo+iLVPZhO5grniJpZ5IbKieBHG0mHy0OJZDK/2P VUsG7NleGm3tfMvBG9FliO3FS+oZADF80qYXOdCTI8IbNc2aZ0vCOTPUEvPS0xiL7gRn ADU33Ieveje6PNsy4b54+kvDVGjQDX4LYJV9tSpkLxqj1PpBXmXNDZdLuASoCyHrKxyx THg4D+yYgdeuBNgvZ2YwmkywlVE7CewSrtm4gLatgi2yhqz9BYKv7E3RSvgATtgk6EJo 7hKUTkIYmKPrXaURM8ia91gRgTQcbRue8eKCrcklX6P9XYKja3HNQJHXXV2R9DOakyeF ehTw== X-Forwarded-Encrypted: i=1; AJvYcCWm6uiZDD8UqtKM9gbWhSplO9toDMeGYfNb8ZIpkM1w82BZT29QByKnW35VY0WYyUnnyykIrGm4Q5zXlno=@vger.kernel.org X-Gm-Message-State: AOJu0YzRN7wpMFbeGLGk5UxZUHLkbpYAP0fVn4/5bplxFi/mPi3um2DU DIfkvZYbljvla3RnpA3DY32UZN+PQ8i1LGdwaIkYylZZ2FtfJcwAiIj6XWdWPgiaPx3tkczksDY qFoPjVBI= X-Gm-Gg: ASbGnctXLgcW5hD7OI7/aIgstp/USuVueS5q00wjLAIKcBdI53TvT3ojnkInRmmoHvk T5w/wSp0YFUH/j/d6B4RSQCNCsSzkHL9732JCPkziaSLjf8NuiefayPVg+7iJ5sEKmIh1Q78kjw j58ZyoFUqAzb9Q78ug/sd5WCRNCAt6cq2w9AXpl75voSyMgZXBSGTmJ0CLxsSQ7OXshE2aSpC3D c9mMoaPKf0Ltgg7d17Jw8/Mefb0DFgX14fpmQfXLHyAkWxeO2yvu3YWJlJd5vTWSi7nyCsYXg1y qH7dOpkGsOZkRv9LTUGidMHgy98BLjgNv6tHDeYbpSK/JbVHrlOH5dehKnnDevLGTjrGRKcm71W PXxmzWi2A19FkLQEz9/VWygJLuTyCQAP4i+iSX9gs5J5VaPvryhvXZnDhTnIM4br1URdBp7FS+s T+do6762GYEw== X-Google-Smtp-Source: AGHT+IGTWs97Njo9/LOi7JghZmPdDO+lqDr8Zjnw1ns9XWNM4GTecb2CrtmosaObhr2irKbWuwRS0g== X-Received: by 2002:a05:600c:1f8c:b0:471:16b1:b824 with SMTP id 5b1f17b1804b1-477871c47b6mr35226945e9.28.1762960952689; Wed, 12 Nov 2025 07:22:32 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:32 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:10 +0000 Subject: [PATCH v4 04/13] coresight: Hide unused ETMv3 format attributes 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: <20251112-james-cs-syncfreq-v4-4-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 ETMv3 only has a few attributes, and setting unused ones results in an error, so hide them to begin with. Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm-perf.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index 17afa0f4cdee..91132abca244 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -106,8 +106,27 @@ static struct attribute *etm_config_formats_attr[] =3D= { NULL, }; =20 +static umode_t etm_format_attr_is_visible(struct kobject *kobj, + struct attribute *attr, int unused) +{ + /* ETM4 has all attributes */ + if (IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)) + return attr->mode; + + /* ETM3 only has these attributes */ + if (attr =3D=3D &format_attr_cycacc.attr || + attr =3D=3D &format_attr_timestamp.attr || + attr =3D=3D &format_attr_retstack.attr || + attr =3D=3D &format_attr_sinkid.attr || + attr =3D=3D &format_attr_configid.attr) + return attr->mode; + + return 0; +} + static const struct attribute_group etm_pmu_format_group =3D { .name =3D "format", + .is_visible =3D etm_format_attr_is_visible, .attrs =3D etm_config_formats_attr, }; =20 --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.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 34942339B2F for ; Wed, 12 Nov 2025 15:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960957; cv=none; b=Y4DxIv9rkD+0gvg5GmBUKxinnbdWIMqeIM7G80MOBP3BdyYnNfavBoDBzD9BA8eDLVc5UNWLc0QZQU6/9C+Iod+wplK4MnyW9p7gRWHIzpQ2gEoYEN1zTjudIpFZNAq7Y3YeenlLKBhWEr6Uxa6gYPiDJIyI+5i7b43h+6uYfTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960957; c=relaxed/simple; bh=TLWZEcPkUQ1LuudIRJ1tUEAv2V1B6bDgYPEzB+p3ndQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DOPrv/kTAE6abHoJGlkogpyo24HRnhqCPbdO6uACurnQejZk6uZ3AiW46+BYYnb70bBlYFjFT6aAoZv9cQesh8Bqay6FgU6KIZ57oLJVikzYetWLeh4KB67AKXaoBgvRXideNsW1Mo1Bo7nF1+whhh6cNG+dtEn34F5G1nA18po= 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=GnL0fCgN; arc=none smtp.client-ip=209.85.221.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="GnL0fCgN" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-429ce7e79f8so705520f8f.0 for ; Wed, 12 Nov 2025 07:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960953; x=1763565753; 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=Oy/vEIMWCNxmvdfWxz9XMqAUZ1LIkGJ8bknBvSZDaPw=; b=GnL0fCgNCFiOG5wUxOZVOq0JNYLl99N2/8c7fZtBIBKVa/rPeRdkeD4JarlbxqMLO8 v9Agytlbc+oWq59GOK1I+45+/q+4KWTpWa0/aMjc15DQ3gZgikNfihum/PqH12TrfcUl OEw36bkN5TFFpjDv7ijHXcGI3K2ITm5+9lfybuBqknwXcztqkB2ybHaaXnx7dHg35tnh RC1+FSo1JrAQrGOCcwoCQjIZ2Zi5INa3vymzGsdmRh67avRG7SwyQnpq/hn7mpSh3wor dYzdqdlH3Ub188nYOsvtN6bc9ssp2QJlbaDh1Xn/KZiwN2spQjUlNWIHu3Uqc/ipIcx1 TqGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960953; x=1763565753; 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=Oy/vEIMWCNxmvdfWxz9XMqAUZ1LIkGJ8bknBvSZDaPw=; b=nGHI6+aTpyICCE5X4kjlmdRWSX8AdKnbe+CcR6P9h0JOzo5CK98RBQ+/EoEyryK3kI 3R0vD91sGhT+gDhRbjVHQ1rclp7G+50raRR0dgrsIxEcbtwQflAsZG0BA0l6QWqUlXv2 LO9FVxXwnNgAyUrgAdeMSaz/ElIPgS55DQSSeEUOjD9SzI0bSRsbwJuwV63qoJo3GRZ0 UqziPU0+2LhBYctHSGQw5hg8kLAaF3829SWGZSDmEYv89fx+RCAnKwAhrxkjOlTY2L8B V9iVJ7tGmAgc8JDv1zwNkKmlYfeVBA9kzYehBGggPHLsJBv/QXFSj9focaT8nNmhYwoa h0Pw== X-Forwarded-Encrypted: i=1; AJvYcCW5u0El8gf10qQg/btX52NluLVVgj5kbKmjxxm8oD55cLrWwJdzM8sPRIgZXa/kKwEYPaAjgbFjYWvTeDs=@vger.kernel.org X-Gm-Message-State: AOJu0Yxe0rPI7QhftDRCZ5jDBtlND4OXLXRTH/hx8ooFzu4ao4Bt+Mm3 xUFKzIahA8IXLhojo2C9QEyVmIpQXrOT/WJ/AOhc89/iXCoLXS1llnbmoMX0bhV0AQwsFjL+p02 kais7WQo= X-Gm-Gg: ASbGncuaMRyOMhFBhVryW3GNUs912AgfTyA3NkoR+ngxGz68Xufve9u5Jk8/gODgrsV 2MSuUrNUtCG73cGTwnRESO2mEIBH2QQMW+vraS1Vz3ZZAdPpLmeQLgQ6WdVymzzlrpyvvaKzzCO ELrvIKaVwPs/grDDM1FD3wZYQKmskNioeqlKWQ3i14NzyJdqYQOH0ZFNmc60IgtxcHtHHdAcRTe kUwsrt1RGRQ5mLrn+xqU6ZyobusmX2JvvYpdIocavJF+OsgSSH28KhNnguWnFQh5+bY4rohxqhr 21JqkDfHouhEFGs8d1A8DkJOuzMpH6ejWXmsaIJo4SLPhrAknLmztXezKDHSQVbmAAm5aH4N9mg 4HrCd1j9iIbwiAjs1iQ6nJT1PgSoFabOTdIKI7sNoICJ8MQHaZXLJ6y0GyWGXxY3pNnCiZx+d0A MNEzeYhMbQ0w== X-Google-Smtp-Source: AGHT+IFq9p78WOUWmhrHEtusd6G6TUySqV0Pm+H4B4or80xw+cl5zLOKvMpvaFJz7M7ANx6M64mshw== X-Received: by 2002:a05:6000:3106:b0:3f7:b7ac:f3d2 with SMTP id ffacd0b85a97d-42b4bdb947amr2650518f8f.43.1762960953526; Wed, 12 Nov 2025 07:22:33 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:33 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:11 +0000 Subject: [PATCH v4 05/13] coresight: Define format attributes with GEN_PMU_FORMAT_ATTR() 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: <20251112-james-cs-syncfreq-v4-5-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 This allows us to define and consume them in a unified way in later commits. A lot of the existing code has open coded bit shifts or direct usage of whole config values which is error prone and hides which bits are in use and which are free. Signed-off-by: James Clark Reviewed-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm-perf.c | 22 ++++++++--------- drivers/hwtracing/coresight/coresight-etm-perf.h | 31 ++++++++++++++++++++= ++++ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index 91132abca244..d19e2568a0d1 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -54,22 +55,21 @@ static DEFINE_PER_CPU(struct coresight_device *, csdev_= src); * The PMU formats were orignally for ETMv3.5/PTM's ETMCR 'config'; * now take them as general formats and apply on all ETMs. */ -PMU_FORMAT_ATTR(branch_broadcast, "config:"__stringify(ETM_OPT_BRANCH_BROA= DCAST)); -PMU_FORMAT_ATTR(cycacc, "config:" __stringify(ETM_OPT_CYCACC)); +GEN_PMU_FORMAT_ATTR(branch_broadcast); +GEN_PMU_FORMAT_ATTR(cycacc); /* contextid1 enables tracing CONTEXTIDR_EL1 for ETMv4 */ -PMU_FORMAT_ATTR(contextid1, "config:" __stringify(ETM_OPT_CTXTID)); +GEN_PMU_FORMAT_ATTR(contextid1); /* contextid2 enables tracing CONTEXTIDR_EL2 for ETMv4 */ -PMU_FORMAT_ATTR(contextid2, "config:" __stringify(ETM_OPT_CTXTID2)); -PMU_FORMAT_ATTR(timestamp, "config:" __stringify(ETM_OPT_TS)); -PMU_FORMAT_ATTR(retstack, "config:" __stringify(ETM_OPT_RETSTK)); +GEN_PMU_FORMAT_ATTR(contextid2); +GEN_PMU_FORMAT_ATTR(timestamp); +GEN_PMU_FORMAT_ATTR(retstack); /* preset - if sink ID is used as a configuration selector */ -PMU_FORMAT_ATTR(preset, "config:0-3"); +GEN_PMU_FORMAT_ATTR(preset); /* Sink ID - same for all ETMs */ -PMU_FORMAT_ATTR(sinkid, "config2:0-31"); +GEN_PMU_FORMAT_ATTR(sinkid); /* config ID - set if a system configuration is selected */ -PMU_FORMAT_ATTR(configid, "config2:32-63"); -PMU_FORMAT_ATTR(cc_threshold, "config3:0-11"); - +GEN_PMU_FORMAT_ATTR(configid); +GEN_PMU_FORMAT_ATTR(cc_threshold); =20 /* * contextid always traces the "PID". The PID is in CONTEXTIDR_EL1 diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwt= racing/coresight/coresight-etm-perf.h index 5febbcdb8696..c794087a0e99 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -20,6 +20,37 @@ struct cscfg_config_desc; */ #define ETM_ADDR_CMP_MAX 8 =20 +#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_branch_broadcast_CFG config +#define ATTR_CFG_FLD_branch_broadcast_LO 8 +#define ATTR_CFG_FLD_branch_broadcast_HI 8 +#define ATTR_CFG_FLD_cycacc_CFG config +#define ATTR_CFG_FLD_cycacc_LO 12 +#define ATTR_CFG_FLD_cycacc_HI 12 +#define ATTR_CFG_FLD_contextid1_CFG config +#define ATTR_CFG_FLD_contextid1_LO 14 +#define ATTR_CFG_FLD_contextid1_HI 14 +#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 +#define ATTR_CFG_FLD_retstack_CFG config +#define ATTR_CFG_FLD_retstack_LO 29 +#define ATTR_CFG_FLD_retstack_HI 29 +#define ATTR_CFG_FLD_sinkid_CFG config2 +#define ATTR_CFG_FLD_sinkid_LO 0 +#define ATTR_CFG_FLD_sinkid_HI 31 +#define ATTR_CFG_FLD_configid_CFG config2 +#define ATTR_CFG_FLD_configid_LO 32 +#define ATTR_CFG_FLD_configid_HI 63 +#define ATTR_CFG_FLD_cc_threshold_CFG config3 +#define ATTR_CFG_FLD_cc_threshold_LO 0 +#define ATTR_CFG_FLD_cc_threshold_HI 11 + /** * struct etm_filter - single instruction range or start/stop configuratio= n. * @start_addr: The address to start tracing on. --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 05BD233ADBE for ; Wed, 12 Nov 2025 15:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960958; cv=none; b=fziav+uJEtV3lu0ExuGhdq8cE1p7CFpXMdr3+tHjLdqtw8Sw1IKV8JmeLhtiz/UBWx1HdXnv0IRLBTnf3We2YYVZl5x88/xANTo1u2ZmDsN9hH0BYm1udyoukk4oJ92aSc40GWDwvZbi0zInETR0Dmjb09y3CwHttTd2GTfvpx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960958; c=relaxed/simple; bh=IP0Ixd8dEZ7x1vJ8I4FOfIjKpu5OiZ3TlRpY0wiZBcI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VmsiHPKG+iq//84HsnWS/CJrcmyavPZmaPFLq2i1unM+7EbItcGbo9Oszlvl6g8w5U21otr3KBZDCTi4WM/uS+gHuOyQ+pDMVu6XowPmHyZdakt+/O950F7AlWs40ZmYP7l9ruwnvBC6i6JzRLoMDYES7R5r6ws9iw0InCx3Sv4= 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=JbWAUDIB; arc=none smtp.client-ip=209.85.128.42 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="JbWAUDIB" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4711810948aso6644155e9.2 for ; Wed, 12 Nov 2025 07:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960954; x=1763565754; 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=WTx9IrqWxLtZaQBaoNbG+/dbV5fx8CFro3lQ5MrSIGY=; b=JbWAUDIBJCrafYXsLOigKStKvlex+vPCsmvNvMOU2XAQ1/fPMR/0vdzg0m/7s9knkj hEKEn97xv8zIT2AKLEfx9cblFAtALY0LY5QM9VyFnwB3oobGs0WM9w9+pv2jPFJ8MPi4 nG3WwcR1FCiT43IdKssFBaXQeuiIC1LOSFwr0u+AHBZFrKIf9j83tyPSt62FmZqac/tK 43Dw9pt6p9Rfr33BVwY/ASi2FxD15KSOpS/ZTFKPvbo7alk35no0gwvPe2zPovXz2Ui5 0rsIHDmVOhGm8cPk7ZbEUbM2h1h/uxtewjeAyK3zjqKI6N1GSTaj7O46OUiSpp8IIXJy y34A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960954; x=1763565754; 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=WTx9IrqWxLtZaQBaoNbG+/dbV5fx8CFro3lQ5MrSIGY=; b=STZFLXX7n0K4ZW8D6+JEWJZ5quOl5zn8iw5HJ458E9tzbTemNRsciZQad7rfcN+KpV 7mQBQX2vuTA5rxbu0trCl+ZmLAF4HjYXe0ddDa7AVNN8iXWb2TMG1b6HXboGGi+dBPbc I3yK/bQn4i+32oN6Z4VrRfUgOkAurTN4l+PdF8J3GnFwk8UrRZgDop9Gu87B8foSZYZ4 bi8+3t5qh3F6YqlLaRJ3nDHngty6sK+Efj8NlVTPHoftCiy+G+QcDA/oRBgjZPntnzR4 m22YyuqbRVoYobVzOSZhg1KdesDIIXFWDKHGHAj5MC7UXFQKsu6DkWcU5BfhWCi8Qgwu tJBQ== X-Forwarded-Encrypted: i=1; AJvYcCV00t8XkQ3dVrli5EegQ9aE5AVi75oH/36IvfrLLvK0kWvVCAwPsxDwR7aWGXZ7VXG8DLGYFtBeY+22yQo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8EQrDuYFy4tBSRrm7ncntwcqMOaIhvVCSnrY1rVuNSh2aHoEO XTuM3CzDUfpArP3qJf+6iuI/xUk9yDhfw9C1o5aOTh58AOho+WXB+eKsfd5DOIBKH/cAKHfrZl6 5XjLFfIU= X-Gm-Gg: ASbGnctCzjHjYBK9jskYP6BQx92tmhWmiSGuf+WWM/68u+SgEr3g+4y0PVy/KMXGmJw gbi6w9z/8dbYqD4iAMyGnWtX46Q/XK3tS5uXp+cxB7XDnR0n8Mynp/o4SmXr7Wy3j5sg4TD739t tTAm7aBYKOLISg5M8+aOGz2srbcseKxPDUmvJjIxvvsAg87wJwaeQmQGwc3f9gwxjfe0Nyc37iq d86qEP1uX3Pm/TFJ+Ne05SYqLCJfN7cVeGqwu7wYIO0mdfndfj+K54cilBaBZ4YCZNUxGGE6Zj4 ICm29rM+7ZB6lnEDtgX9WB83Ckes1ysNBOdNz8UqQ/o2QzX2naLSU0afYdQDqzuk82m0Ed08EfR 0/+dYcvaZvNOC37iuR/KEukk859T7my8QonlJKafeKHjyEaCK0TTEA4AEGXwww284c6JSiH3jMq 5WWOvXE219LA== X-Google-Smtp-Source: AGHT+IFw5cqZamC5mYofHQFAGIs+CpErGeW7hJbNKdZt2prmVHC1gv1dK5HcvPNjN2fBGVGfPd1yoA== X-Received: by 2002:a05:600c:c4a1:b0:477:63b5:6f3a with SMTP id 5b1f17b1804b1-477870b2d84mr28776855e9.27.1762960954356; Wed, 12 Nov 2025 07:22:34 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:34 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:12 +0000 Subject: [PATCH v4 06/13] coresight: Interpret ETMv3 config with ATTR_CFG_GET_FLD() 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: <20251112-james-cs-syncfreq-v4-6-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 Currently we're programming attr->config directly into ETMCR after some validation. This obscures which fields are being used, and also makes it impossible to move fields around or use other configN fields in the future. Improve it by only reading the fields that are valid and then setting the appropriate ETMCR bits based on each one. The ETMCR_CTXID_SIZE part can be removed as it was never a valid option because it's not in ETM3X_SUPPORTED_OPTIONS. Signed-off-by: James Clark Reviewed-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm3x-core.c | 24 ++++++++++++------= ---- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/h= wtracing/coresight/coresight-etm3x-core.c index a5e809589d3e..4511fc2f8d72 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include =20 #include "coresight-etm.h" @@ -339,21 +340,22 @@ static int etm_parse_event_config(struct etm_drvdata = *drvdata, if (attr->config & ~ETM3X_SUPPORTED_OPTIONS) return -EINVAL; =20 - config->ctrl =3D attr->config; + config->ctrl =3D 0; =20 - /* Don't trace contextID when runs in non-root PID namespace */ - if (!task_is_in_init_pid_ns(current)) - config->ctrl &=3D ~ETMCR_CTXID_SIZE; + if (ATTR_CFG_GET_FLD(attr, cycacc)) + config->ctrl |=3D ETMCR_CYC_ACC; + + if (ATTR_CFG_GET_FLD(attr, timestamp)) + config->ctrl |=3D ETMCR_TIMESTAMP_EN; =20 /* - * Possible to have cores with PTM (supports ret stack) and ETM - * (never has ret stack) on the same SoC. So if we have a request - * for return stack that can't be honoured on this core then - * clear the bit - trace will still continue normally + * 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 + * - trace will still continue normally otherwise. */ - if ((config->ctrl & ETMCR_RETURN_STACK) && - !(drvdata->etmccer & ETMCCER_RETSTACK)) - config->ctrl &=3D ~ETMCR_RETURN_STACK; + if (ATTR_CFG_GET_FLD(attr, retstack) && + (drvdata->etmccer & ETMCCER_RETSTACK)) + config->ctrl |=3D ETMCR_RETURN_STACK; =20 return 0; } --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 E9AC733B979 for ; Wed, 12 Nov 2025 15:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960959; cv=none; b=LBnTVWsaqTcIzzRnf03ddK/IC2Y5Mp3PQE4EpAPyWOTx2u8tjEoN0PJ3OAiIxbAr0/A2+T+z7L26nEA4NI969XQwX+eaC/6L736udxnvh1DgxfN66S01wGjEoI150YiV23ubHJeNq+IJFxujuwWEwrmiTEBSGObWs4vgVFlig6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960959; c=relaxed/simple; bh=0Kw4cpAnclJkB05dC5A9233l+BCrc/iioVGiD2gkc6w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JTNB1ekDAmH7xvdN//V94wHB89bA2LV+xJpe4ODSpwketRfa1bNDnexyxBvTVF91b6siiy0dyshnIDI5JED/YUvsZZznuRVYgwDZlLWIgt7kzN2avZegBtDfY9jLvRC4t46V9GGnk3Q7uOX0uG1oCLcPLIp6NkgCDkVSw9MZBQw= 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=UmspWNsv; arc=none smtp.client-ip=209.85.221.43 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="UmspWNsv" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-42b3720e58eso887180f8f.3 for ; Wed, 12 Nov 2025 07:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960955; x=1763565755; 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=4QaaKNFNqowM2WQP3QSzkztxHtPDe8RFUGO77+dvhWo=; b=UmspWNsvPvOWfvCEgO4livn3MDzJHD+lGmgXXC9cF/wiNRgEbKuHAa6dKc/ygACMuO +9cggkIjOkZK3JokUj3iASvyQoNrpT62S9VfCr/jAlJgLnUbPkjdF8JZ5fAnHtXbswg5 vHn7KQpIQG5Ojd2vXxlOsa3OfKljo4HRN8q/H9Gc56QRY9sznACw8eKUiFq3in7kxJLl jeJPRo4KMMQznf+NvbPK6PExPfMfTMMZyecz67iQazPbmsJzfp9whDIOr30iWgWUVIZA 9o4vwjtyjS6gXwkgt/1dMCAkXRktTZvDEKZoIJv0mVxlnnRYqqXSLqPQJRM01XutDjsc ZdLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960955; x=1763565755; 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=4QaaKNFNqowM2WQP3QSzkztxHtPDe8RFUGO77+dvhWo=; b=IZuWETnjzZmTfJalz+mY47k1WpZJUW8N/0n72yxz5pD1ftFzAa9cc3KGjT2Kau6ys2 u4OVxFpkpsdAsT26TJWggSGU7d/hQ2/WAF+oV73Cx+ssPr1SsinBZZNNpwpuBEfVlAnf 4XZZTmPMwKYCxJIa1gwezwI+xuCR4yhUWQE01uPvlzSTuWVBRWqr2yc9+0KnxkMcwLU0 lxkxSSgZuzqs8JbFdfqLvG9v62CL0LW1S3qkLLi6Bm8vUMuNPPlfIcICqnIM8Ujf05eH 6iVxgy5cxKiaoKJHai4grhLnf/3Ry3v7Lk4J1zl/hRywqGf9qO+morgIoU/J9AmvKI/8 9jWA== X-Forwarded-Encrypted: i=1; AJvYcCUbGo/qzP9kXG5COxHOy9pq/Ak9tnFMe8uVQfu63FhGLyGROF1iadIJ6BN/6FtqzbfHyJxKE4ShRGSFFSM=@vger.kernel.org X-Gm-Message-State: AOJu0YytxOmpxFkf6ebtkmNH31OPWz9H+1fllXpcMn3+Y7h/QtEG5H9j d3hxqatdWUITtmG84dyPBj1E1Mr340ig9KEh4G4WDO48dBdI5m3elamX0HI4ePiGlScHAHP7V1V IgPEPaMg= X-Gm-Gg: ASbGncundvRIahB5r/L5/sfemdKf66f72z528L778QvVO1QwM1Jv6aSOtd6ewFVbB9r JaMR4XGeojbG+dtQ6m2ihlKhNeHnXZog+/Ob8T8uGoj9JI/lmno5p6+4npgw1Xa5idM15eI1sa3 yHo3FrHI08qwLuPVX5ofv8tSTOJMIMZbtjPOZYEgj5ntUMWbU70RulZtzbCopORPLQoMUHq/di4 S8aUcbY7mOS6+iETY0mTSFt8O2/cG23fTze7QqgHBojYpdSUr5y4L8FQmneaOtOUY8MpLUqZ+BS bK2LOdwCB4+7ZPFHLwBfAvhVr/HJlvMh39Z5qlAJiJqPuJyKOIwgNVyDuOHQuzZzKtPhkE5Lhe2 WVJgvMP9kPoxFOIsgkSvwZjfYVLzenVLxNRV6YiVu/rWaBDwlLmfR9XcN8y+vJgsHmbypJwQt3k IGGQnQbzQJfQ== X-Google-Smtp-Source: AGHT+IFw8jUIYvhHHQaSc4qHGp9oC+g6GYxlDDWV26ZjuQvhCnuoCCgNV1aDlJVXL+R28ybNJLrR3w== X-Received: by 2002:a05:6000:1786:b0:42b:3ccc:91ec with SMTP id ffacd0b85a97d-42b4bb9fb98mr2774010f8f.22.1762960955263; Wed, 12 Nov 2025 07:22:35 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:34 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:13 +0000 Subject: [PATCH v4 07/13] coresight: Don't reject unrecognized ETMv3 format attributes 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: <20251112-james-cs-syncfreq-v4-7-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 config isn't the only field, there are also config1, config2, etc. Rejecting unrecognized attributes is therefore inconsistent as it wasn't done for all fields. It was only necessary when we were directly programming attr->config into ETMCR and didn't hide the unsupported fields, but now it's not needed so remove it. Signed-off-by: James Clark Reviewed-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm3x-core.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/h= wtracing/coresight/coresight-etm3x-core.c index 4511fc2f8d72..584d653eda81 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -333,13 +333,6 @@ static int etm_parse_event_config(struct etm_drvdata *= drvdata, if (config->mode) etm_config_trace_mode(config); =20 - /* - * At this time only cycle accurate, return stack and timestamp - * options are available. - */ - if (attr->config & ~ETM3X_SUPPORTED_OPTIONS) - return -EINVAL; - config->ctrl =3D 0; =20 if (ATTR_CFG_GET_FLD(attr, cycacc)) --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 EE2EB33C539 for ; Wed, 12 Nov 2025 15:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960960; cv=none; b=S36L/5I+sKSZ/yZ4C1RxmM6GTjif/QQiP3ImkJwHI9R7MgnvZ09bjqvjoAknBJh9oKEKmiT6bQ/PppJhGpXbXJpCm35fjAtna8tNic3ZeG1y+vQBcDhG178xr6CagZ8Cr1vt1vktjLOGF/uCe5HUj/+8UgRxUgw9kASOBi1KeFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960960; c=relaxed/simple; bh=1D6ao/Bm/0EBOm0yR+7qj+Q6nV0W56TWm4eeVFjArZ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dn6fX/0HzX+cKus6jY4oWStuDuiGdQ7Ci6k0Eeu72bPP9G2LvkS7u/5JEXWwW45YULl5VdFwvn8frW5XAJr6AY4mQ9u4aba/eWE+Nl0hUt2BmooVnOAILHYMCqeejMd/0EC6+x19rbN5FqbhaNVIOFvS3xRlsdGiBrzFPIkrt5Y= 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=Wy6wRMt4; arc=none smtp.client-ip=209.85.221.50 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="Wy6wRMt4" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-42b32900c8bso550682f8f.0 for ; Wed, 12 Nov 2025 07:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960956; x=1763565756; 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=cUj0j3n1vb2Wu9GInL+qCS54uhf2SL5HLPcj1zO45w8=; b=Wy6wRMt4wyQ0Rg2ay/ZNCnfCZ0lrmTskbgXDkdtRR7gdc4KmTpS92Ty3g8UJHRpkpY XXYtJNSRCOaHPYzlLpJ4eXgFWZpU98stod5MpYQfGFTXvMFzhdZ0Nbhx64S0m1jqrDqx RuJCgV6Fj2RT71XC8oDdmK+/UUPMvqg06I539pppM9vX0K7M+SmRULo4grf8SGy6CCTl UalSaEUb/oe4PPmdbGu7N349ejpi9vsUMmxDAzcsxCdQB/nylWy3NEgp/67yrdeErl3P 37DKmzwn69l0/1BYpfeNq4yTYAO0w174quaAMIAKjgFsau2FOtQzxNataMqJp+aTGpmp h3iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960956; x=1763565756; 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=cUj0j3n1vb2Wu9GInL+qCS54uhf2SL5HLPcj1zO45w8=; b=DAP6BKGl3LruP3/jZ1UNOhmZ1QchFpNvRyhbfLHmTiVpCJKqtfAA4PG8uObaA6Bqph oxYlmzsgqhoaqz0O1JGRHg2JwF8iVlY79niyZXZMelJwyiMXVxob455pSoFFKYAIHCoE 5yEMaWGPMeKjhslUzvK1VNuO3hY8/VEBINMLrpfTpWeo7VZRMAoL3te7kIRPvNmdVYXO p26mErQAB1BdCGVbIiRvACAQkhGGyMS4P57M3eSf4PAjDbxn4NfY43DwmPYuz8HTiF9A cdsb28FqiCpuZNuWu9J/poHBDnrBgR+DXn61xl4HtUrBgZZvVGf7kSWhXkBCbW/zmzoO 7DBw== X-Forwarded-Encrypted: i=1; AJvYcCWHJp/v7AuMSj0ePgGP+EKTv7AxWuV7/X0ZtlGcJsz9rkBC0Qx8Bu1DMG8JJDp19ILWy5La8yVEMnj5+zY=@vger.kernel.org X-Gm-Message-State: AOJu0YxaT2XcB6XjqT0jvDKpo66pLoEkitNPJCZcXBWJxoVp17SCLg5j NHjQmYma/trc5czrAhK6Wy+Cm+/LqWqrp3JXBgXN3WrON+eGpw9hl47TfbIh3KOEKP1YOTgbsEn zG3DBSkY= X-Gm-Gg: ASbGncv6leQdQleFhobu2lZiIzXvviZLXDWI88LGcunQUmfUnb3jATgsyqYyJYZCcgq 2ygXwWywYmnG8atA32TqIdHerE0aDW7P6R/yRNTKupfkJ4WH1NQ39VPP5o+uVNRIgE6mKkGM70s hEnzXEI4QURLiynYTsfV1VuBoHGZc+00l0Z4BY5wYDYd4vsmj1AZelDmLBOBuJ6TJRrRTK6J5Tg YOkDDSJQ8rGh4rAqJjqcE+8yHmN8m7BJW0ea0ur1r/A52YUvX2/ruiBzIyGh3iI5EE6H2mdnI8o E005vFTZHlLejuiz3hcEonToVe4LWJuuUALEYhHuCG/pfdF4szKPWprp5srZvwQvIPBA+vG1Cg/ /6mSzoRUyl9t+V2TkQPkySoM7o6wMnqnqmWBKBtuiJgdG9Zh+bGpzl8tiD0HgNIeylb92tazdIW 1CVNQI5G3Q4Q== X-Google-Smtp-Source: AGHT+IFlw5Lz/ACVGaZYBTkar+BWPh1yCKM0EeqPcMg7SFjnpxyLc8kUfqQFePDdrWGjsDSOCoDNlg== X-Received: by 2002:a05:6000:2509:b0:42b:3e20:f1b2 with SMTP id ffacd0b85a97d-42b4bb8b8fcmr2593627f8f.4.1762960956140; Wed, 12 Nov 2025 07:22:36 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:35 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:14 +0000 Subject: [PATCH v4 08/13] coresight: Interpret perf config with ATTR_CFG_GET_FLD() 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: <20251112-james-cs-syncfreq-v4-8-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 The "config:" string construction in format_attr_contextid_show() can be removed because it either showed the existing context1 or context2 formats which have already been generated, so can be called themselves. The other conversions are straightforward replacements. Signed-off-by: James Clark Reviewed-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm-perf.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index d19e2568a0d1..7272e758aebf 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -80,12 +80,11 @@ static ssize_t format_attr_contextid_show(struct device= *dev, struct device_attribute *attr, char *page) { - int pid_fmt =3D ETM_OPT_CTXTID; - #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) - pid_fmt =3D is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; + if (is_kernel_in_hyp_mode()) + return contextid2_show(dev, attr, page); #endif - return sprintf(page, "config:%d\n", pid_fmt); + return contextid1_show(dev, attr, page); } =20 static struct device_attribute format_attr_contextid =3D @@ -334,7 +333,7 @@ static bool sinks_compatible(struct coresight_device *a, static void *etm_setup_aux(struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - u32 id, cfg_hash; + u32 sink_hash, cfg_hash; int cpu =3D event->cpu; cpumask_t *mask; struct coresight_device *sink =3D NULL; @@ -347,13 +346,12 @@ static void *etm_setup_aux(struct perf_event *event, = void **pages, INIT_WORK(&event_data->work, free_event_data); =20 /* First get the selected sink from user space. */ - if (event->attr.config2 & GENMASK_ULL(31, 0)) { - id =3D (u32)event->attr.config2; - sink =3D user_sink =3D coresight_get_sink_by_id(id); - } + sink_hash =3D ATTR_CFG_GET_FLD(&event->attr, sinkid); + if (sink_hash) + sink =3D user_sink =3D coresight_get_sink_by_id(sink_hash); =20 /* check if user wants a coresight configuration selected */ - cfg_hash =3D (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32); + cfg_hash =3D ATTR_CFG_GET_FLD(&event->attr, configid); if (cfg_hash) { if (cscfg_activate_config(cfg_hash)) goto err; --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 D3D5E33E37B for ; Wed, 12 Nov 2025 15:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960961; cv=none; b=dtiDY5Cihdb7MxgS7vXIhgVvuOoYwVM6t8wfKKJPrlrIXZdnc55GYSRy5211rBCPCdAh5GByWdq0agtyfE7CROetO1UStE63lvYIwVWL+lHSYYIM0zCvloKNhYjmlTUhZoaVnsZpOmj0FwIr2p1jG7rMa2L3tc7RRA21HCZG6bI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960961; c=relaxed/simple; bh=PW3kIBJggwQVq6G7LiQ7p8cztUnoxekkC1BRA1rqKzs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q60N0V442p9l/kdhE4588ZFcxD3cEE3hP1M/1P+Ec7sSwN0u/J2IennvKxsbQ868sKiyfCGJ9OvaXPEye/hu34Zmgwnt0IIpoLYeV3EV+IEZww3CxgaRljqoZBy/VjJOTCkZh/iY/me7d+M8MimtvNi6yO+lCyZTqJCmlN+Nv6c= 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=DZ9V/sgN; arc=none smtp.client-ip=209.85.128.41 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="DZ9V/sgN" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-477619f8ae5so7716525e9.3 for ; Wed, 12 Nov 2025 07:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960957; x=1763565757; 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=YETsnt5LWQuxxsuLBsy1SxsGYRqR4GjZ60Oc430mZIU=; b=DZ9V/sgNr3jqp66BVzq8auwCugdqdLgzUGe+Ehh0i+iDhKP1G8c45tqMC0ZtjKL9XC 7lUw6Wyd2Rkw6YMwjQJVclLytNYcZFKDb12agvIhWikZfi8Xa4BsUgd9KSNmsQy9dfhg H7UljZG6x6rQAlAf0Aua69TZkB2eENmeUcfliLN3T5khAxNVQG+bghJpHHyNyhIQTDdw 8KksCIG9gni7LJjiGvtXLxc12zGrL/yZGCcJBGvVpaP7B98+eR3LuG7pnzLy/Pi0C+tt eQp8mEWjln8Y+El5Ob5G9RWDjDb9nZRCRWWbioY2LCoc30Vb3/8pEeLduerHKlb2/zGO SnmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960957; x=1763565757; 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=YETsnt5LWQuxxsuLBsy1SxsGYRqR4GjZ60Oc430mZIU=; b=SZFt0Dh7w8pzzCXXQCaJ8SFA+33RUlJKFTOV0yT8fxty+Oh+J+MSYhRuGMnwSAp2qN wPmvQZsfgUW7eGXq1KJzLzu5UA+FGJkqwkVCYJwvFP5nkJIfgxSt4TSfSiwm8Q3FHyMw ayJnNk4EDefPTS9Brvxu3Jza0tp3yNj/l/L3BKpsdkXHIujnNOA7Qr8WRkaTgAEg94xO 5cwAfxUPhqWETur+UeMfph8L80dsAcH7ODm/5bd78RIDp+uvguZ0nZw/fED08CDvD9Gp 2AGCA62m3Ysog5tYPC/K90ID5AkOroK+Fqa1RYpdEUekJqRa7/HfwS+zRqIRuNxzfz+1 8afw== X-Forwarded-Encrypted: i=1; AJvYcCUS41vpqtQKaVWI7XDu8wTALEQDmadkH4aHjjEKdfLjqVZH6mfN2twG6bVhKu2KCfFD3uzj21sxqSIxCTY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw08s+EVLCv3fiZ64+XIjs7wXfnq3h2PF+kVnGO4StY8ubFd/zQ 8hcWFNA/ObA8mg1UwFVZFmQsqr3+rQt3kV/RaXE2UrDMC84sotvYA20cyUiMwp3+wuU7zXDpjGB tr/JxZBI= X-Gm-Gg: ASbGncu8foZ1vFK0q7MvIUGs9J5pljEeKnoBH+y+uXK94LDqV+bmogfspgqDRYB8ryj XIUkDF6TOJMblcVfAk0EnGkh3VzVK72uDsKm3KuNGxgelzoxaw/Tp2fhNKeZJUOPfaoi1dcM1bB wrhcC/NrW+EWxmV3voRKO0F/btpyHRJOQzbz3L796qFYR2rcj/wIVi0EF2oLM6Hu3YSYF15raAY U3zNVOaolXs9edyqItDvkPEFQKVz7fZlwkkkBpPjxoUmCah/iHBtpYZF8US7DZgx8oj5zqzYuTi TDR4AXtucakT1ACWj+fS+MTnnsWGrW11CHRSJMVl7p//gfRMVATivBkO6c6+qYFf+dzPkIbd7qa ZYGSKTHEkpzuYqpaFP4LTEDxahp1sVKDy3xJnPh4jOM9TkyDrpu44tmgdzAelBdGNFZByg4fFsX kItTeptuZub5zyb1mdvZZ9 X-Google-Smtp-Source: AGHT+IGkUdJ1tT6maJPY0NlY8NR0Mlq7ejN67NI2u5oaHXO9CTIjlAkj6ENeRyhSR6+QoDIl3mZfwA== X-Received: by 2002:a5d:5f50:0:b0:42b:3661:305c with SMTP id ffacd0b85a97d-42b4bdce2damr2544670f8f.55.1762960957062; Wed, 12 Nov 2025 07:22:37 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:36 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:15 +0000 Subject: [PATCH v4 09/13] coresight: Interpret ETMv4 config with ATTR_CFG_GET_FLD() 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: <20251112-james-cs-syncfreq-v4-9-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 hard coded bitfield extractions and shifts and replace with ATTR_CFG_GET_FLD(). ETM4_CFG_BIT_BB was defined to give the register bit positions to userspace, TRCCONFIGR_BB should be used in the kernel so replace it. Signed-off-by: James Clark Reviewed-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 44 ++++++++++--------= ---- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index 380a7840adb8..1aa0357a5ce7 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -789,17 +790,17 @@ static int etm4_parse_event_config(struct coresight_d= evice *csdev, goto out; =20 /* Go from generic option to ETMv4 specifics */ - if (attr->config & BIT(ETM_OPT_CYCACC)) { + if (ATTR_CFG_GET_FLD(attr, cycacc)) { config->cfg |=3D TRCCONFIGR_CCI; /* TRM: Must program this for cycacc to work */ - cc_threshold =3D attr->config3 & ETM_CYC_THRESHOLD_MASK; + cc_threshold =3D ATTR_CFG_GET_FLD(attr, cc_threshold); if (!cc_threshold) cc_threshold =3D ETM_CYC_THRESHOLD_DEFAULT; if (cc_threshold < drvdata->ccitmin) cc_threshold =3D drvdata->ccitmin; config->ccctlr =3D cc_threshold; } - if (attr->config & BIT(ETM_OPT_TS)) { + if (ATTR_CFG_GET_FLD(attr, timestamp)) { /* * Configure timestamps to be emitted at regular intervals in * order to correlate instructions executed on different CPUs @@ -819,17 +820,17 @@ static int etm4_parse_event_config(struct coresight_d= evice *csdev, } =20 /* Only trace contextID when runs in root PID namespace */ - if ((attr->config & BIT(ETM_OPT_CTXTID)) && + if (ATTR_CFG_GET_FLD(attr, contextid1) && task_is_in_init_pid_ns(current)) /* bit[6], Context ID tracing bit */ config->cfg |=3D TRCCONFIGR_CID; =20 /* - * If set bit ETM_OPT_CTXTID2 in perf config, this asks to trace VMID - * for recording CONTEXTIDR_EL2. Do not enable VMID tracing if the - * kernel is not running in EL2. + * If set bit contextid2 in perf config, this asks to trace VMID for + * recording CONTEXTIDR_EL2. Do not enable VMID tracing if the kernel + * is not running in EL2. */ - if (attr->config & BIT(ETM_OPT_CTXTID2)) { + if (ATTR_CFG_GET_FLD(attr, contextid2)) { if (!is_kernel_in_hyp_mode()) { ret =3D -EINVAL; goto out; @@ -840,26 +841,22 @@ static int etm4_parse_event_config(struct coresight_d= evice *csdev, } =20 /* return stack - enable if selected and supported */ - if ((attr->config & BIT(ETM_OPT_RETSTK)) && drvdata->retstack) + if (ATTR_CFG_GET_FLD(attr, retstack) && drvdata->retstack) /* bit[12], Return stack enable bit */ config->cfg |=3D TRCCONFIGR_RS; =20 /* - * Set any selected configuration and preset. - * - * This extracts the values of PMU_FORMAT_ATTR(configid) and PMU_FORMAT_A= TTR(preset) - * in the perf attributes defined in coresight-etm-perf.c. - * configid uses bits 63:32 of attr->config2, preset uses bits 3:0 of att= r->config. - * A zero configid means no configuration active, preset =3D 0 means no p= reset selected. + * Set any selected configuration and preset. A zero configid means no + * configuration active, preset =3D 0 means no preset selected. */ - if (attr->config2 & GENMASK_ULL(63, 32)) { - cfg_hash =3D (u32)(attr->config2 >> 32); - preset =3D attr->config & 0xF; + if (ATTR_CFG_GET_FLD(attr, configid)) { + cfg_hash =3D ATTR_CFG_GET_FLD(attr, configid); + preset =3D ATTR_CFG_GET_FLD(attr, preset); ret =3D cscfg_csdev_enable_active_config(csdev, cfg_hash, preset); } =20 /* branch broadcast - enable if selected and supported */ - if (attr->config & BIT(ETM_OPT_BRANCH_BROADCAST)) { + if (ATTR_CFG_GET_FLD(attr, branch_broadcast)) { if (!drvdata->trcbb) { /* * Missing BB support could cause silent decode errors @@ -868,7 +865,7 @@ static int etm4_parse_event_config(struct coresight_dev= ice *csdev, ret =3D -EINVAL; goto out; } else { - config->cfg |=3D BIT(ETM4_CFG_BIT_BB); + config->cfg |=3D TRCCONFIGR_BB; } } =20 @@ -1104,11 +1101,8 @@ static int etm4_disable_perf(struct coresight_device= *csdev, return -EINVAL; =20 etm4_disable_hw(drvdata); - /* - * The config_id occupies bits 63:32 of the config2 perf event attr - * field. If this is non-zero then we will have enabled a config. - */ - if (attr->config2 & GENMASK_ULL(63, 32)) + /* If configid is non-zero then we will have enabled a config. */ + if (ATTR_CFG_GET_FLD(attr, configid)) cscfg_csdev_disable_active_config(csdev); =20 /* --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.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 A8B9333F39A for ; Wed, 12 Nov 2025 15:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960962; cv=none; b=PUfTL1hAowtzHSd+Jx9Q1TfGC0NX4kSD6yUONdnDQq9UyOScrRTgXl225aCo+UGTBxzvHpjZ/+KQm/XSLsHxyC8U1ln07ZdfNDABYiGlRXilF1CyVq/QYa7HwddmGjXoI9QnZxhdFDFpb1I8zRqUnZcPJfA+v/YdWeeSGWEr5gE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960962; c=relaxed/simple; bh=uJVSK5aYHf9PqYstWTAX4v/czLiKhA9I0TGHQKP62RA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=onRvE++yWL8zbEFK+wnArUgBNn0tNaAR8EXLWPjMBxWbBBZyRXVsGp5KzCYVuKRrANaOGlALiN583HulCk+StPVCzbU86KtDx6uewaBPkdaJCn/4B4u8FfM0/UZFoUJOnSSi2q7d4pJGRsynfAF5BsHZUTtbf5C8JxrNY29tOy8= 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=BZOq0iz7; arc=none smtp.client-ip=209.85.221.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="BZOq0iz7" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-42b2a0c18caso795068f8f.1 for ; Wed, 12 Nov 2025 07:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960958; x=1763565758; 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=ILLjcNFKCShCpCjFdgdkPREBFmKKVtEX1F/DK1p7azU=; b=BZOq0iz70zOcpAtmPOxSzKDpl+7PbUSZAntimF8njn4Yf9xY91zHMhTJGdD8JPcBme 4av2kPiFcnDm3+FBlQTqOVnbwt5i3yshyEthtNFb31fDQBZlxCJ1V+G/jSCpzuF/tQlY 4K2wuRDYIjH02fmCpSyEYyrXsSmKbcFJZdtaEGwY4Hjg0uAvcMDXbpMerAiNLN65Vg1m tdTj28quiuUgUW17druyQCgQEgGVZaVt9LpUTXfRKh0b5A37X5+T7bjc4ZpVrdOEq0O3 uvnqJZ0/4knv0sK4hlq3E1fHAqG2T/SAK4W8l7k83safQL6UJIa9bphGBc1UpeYCAnMi csAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960958; x=1763565758; 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=ILLjcNFKCShCpCjFdgdkPREBFmKKVtEX1F/DK1p7azU=; b=SwYwMdQUw9C6/UzHxM5y5Qt0UW2BvuXizYRkwUDB0al6VDiGEn/k0fxWAhcrM5SL3+ 9eaFOqJs+YAH43oS/bwrRsa1Th54EleizBHROW+KwXqrDO2sdadN2GqgigjNDImfrhNH n+RwFbAeBCPY4u+3GbydWu3Pz1vhBSxC0zbMtWxfRo4eiTSDATj/sMevqrPnNk7nxzy1 /ff7mWqbNb3LCFTfwNzBVBKQFPwuLpAi6WrwpxzMmg5PMuzQoyiAWJpvLrZWMi4X6s+7 MFGn4FVZzcDNubhHeDeUS1sQtm9opSAiIJaaOSQ+BPuC48cy8To2jkrCxXpyOCj7+FX5 lAUA== X-Forwarded-Encrypted: i=1; AJvYcCUsG8FSKNgqGSLFJxT6tBrcJ9Lug9QNUqt2elfAFBRE5uzcoZfBBfzp3YluHIZbyK0rEGHS1XIswERypI8=@vger.kernel.org X-Gm-Message-State: AOJu0Yzs4F4hInjGnCiOtI+AhL8vJ3wSf/cSquI6CGl7UDj+RDND2vXf FGSWb6u93n3xteqDWO0ScfmnrJvDu2/n2oCRn3vElzI/5aFyBL8sD8NkgFzTLX/h1uVWBaykD9P LQvP/jGg= X-Gm-Gg: ASbGnctRp43XLQCxTqmCTpuIrL95sghvOftJVwVNk4mHJVyCult/DIve6Au9hYzQHMR r+41Jfpq++QBhivbqpjpHR8XtUi/hZiBrYZ63IyAjUCusFpeDw75zZcGAuEvVvX+C+0of83WCyQ TVBf/fUMYbK21Arz1toObV5SvvFfc5bjI71Du5YbElWhssYxqVmGgpMbigoua+ApkO+5v+tM/64 L7xxmbmphf+uQqBhq4GNiyDlxT34nZbFuq3fNdFfxPJvfwBE+Wy3zq4Q7u8HXwbNpYEc+qBZsU6 w9RDwx42fhIAj5RREgzIRDwHMGWOR9fzSZ96o79w8Zd77mGg4MTRsRcxOCdFu5wHohwUPXQZuJx XCaBqrGkDe+pbRHngbc5CRcMrETR+O0lMzVfH4NKjS/C9OZ8oLbOd+Q5tGSMXLWuWhX6x3YBKqw fe91BxPfH2DQ== X-Google-Smtp-Source: AGHT+IGjdUCcCG92Q/jqFroCRNOfWwVifVOKjjlFDKz+QCM71f6L1+0atNpuSmvuBiDEBaoYhQJwCQ== X-Received: by 2002:a05:6000:420e:b0:42b:43cc:982f with SMTP id ffacd0b85a97d-42b4bdb0267mr3253494f8f.39.1762960957948; Wed, 12 Nov 2025 07:22:37 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:37 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:16 +0000 Subject: [PATCH v4 10/13] coresight: Remove misleading definitions 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: <20251112-james-cs-syncfreq-v4-10-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 ETM_OPT_* definitions duplicate the PMU format attributes that have always been published in sysfs. Hardcoding them here makes it misleading as to what the 'real' PMU API is and prevents attributes from being rearranged in the future. ETM4_CFG_BIT_* definitions just define what the Arm Architecture is which is not the responsibility of the kernel to do and doesn't scale to other registers or versions of ETM. It's not an actual software ABI/API and these definitions here mislead that it is. Any tools using the first ones would be broken anyway as they won't work when attributes are moved, so removing them is the right thing to do and will prompt a fix. Tools using the second ones can trivially redefine them locally. Perf also has its own copy of the headers so both of these things can be fixed up at a later date. Signed-off-by: James Clark Reviewed-by: Leo Yan --- include/linux/coresight-pmu.h | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h index 89b0ac0014b0..2e179abe472a 100644 --- a/include/linux/coresight-pmu.h +++ b/include/linux/coresight-pmu.h @@ -21,30 +21,6 @@ */ #define CORESIGHT_LEGACY_CPU_TRACE_ID(cpu) (0x10 + (cpu * 2)) =20 -/* - * Below are the definition of bit offsets for perf option, and works as - * arbitrary values for all ETM versions. - * - * Most of them are orignally from ETMv3.5/PTM's ETMCR config, therefore, - * ETMv3.5/PTM doesn't define ETMCR config bits with prefix "ETM3_" and - * directly use below macros as config bits. - */ -#define ETM_OPT_BRANCH_BROADCAST 8 -#define ETM_OPT_CYCACC 12 -#define ETM_OPT_CTXTID 14 -#define ETM_OPT_CTXTID2 15 -#define ETM_OPT_TS 28 -#define ETM_OPT_RETSTK 29 - -/* ETMv4 CONFIGR programming bits for the ETM OPTs */ -#define ETM4_CFG_BIT_BB 3 -#define ETM4_CFG_BIT_CYCACC 4 -#define ETM4_CFG_BIT_CTXTID 6 -#define ETM4_CFG_BIT_VMID 7 -#define ETM4_CFG_BIT_TS 11 -#define ETM4_CFG_BIT_RETSTK 12 -#define ETM4_CFG_BIT_VMID_OPT 15 - /* * Interpretation of the PERF_RECORD_AUX_OUTPUT_HW_ID payload. * Used to associate a CPU with the CoreSight Trace ID. --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 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 80C9D33D6F1 for ; Wed, 12 Nov 2025 15:22:40 +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=1762960963; cv=none; b=r13UYwVoe9bQXnh9TvxwE4XuO3liqH+Or1nIGhwHWfWAojCZyAQ6CtPLFvaXB+AH1m+n18zNXOKOG2jvn+rmx+3/wc8OMscZ3N7N3RGKAbAjE4EiZ05CIIipCCYabCPpDIBCIKIMVutmIlg/wlj3RmhvJjptncy1iZ/kF+/WZgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960963; c=relaxed/simple; bh=CVyCyQt/4XeVwaXkLI2sx+lGIsU0DfdrUUdJXTKDH1Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FthrGdYqh6+2chi77doJNAtk2Fk2As17gQXr/W3tygfyJvwc/G/EAGXmvAS1S41gLDX3OAxVEAWk24UKeD0zv+Zp2RhGT6AZ+4u15fSqd2qTC/QN+Lxppondm4WgsfD4BsxQTjBrhrLwBbUJwetHkkLHeanXGeNnOC/ESk/xlAQ= 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=v4EcFteb; 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="v4EcFteb" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-477442b1de0so6917215e9.1 for ; Wed, 12 Nov 2025 07:22:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960959; x=1763565759; 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=wh23cgVTrsuEAgMOdQ2R3Fyv92omKUsnmPcgOaLOE0w=; b=v4EcFteb08qZVC3aLlY70Wkgt1laK5PAgaNzSjgDyiuchshVod/s261Hw5z80pEfly jDacIWjWomdVtH2yaczchch1SCbyQdf9hb8SgSmNYv4EW8hT92I82wy6larPUoy5t0K5 rqRnUemsFJ+ns63+osNF6jecJ3zmuBeSiQEThL1cqCkLi4hqSAoW7pxXofWYZwXy5pmi HEO4YkU7ab6CosdIv9Jf4p1tf4O9DHkoquIrxTtPNF/4lbzPDIJBfyioAtU7e76VocRw jMaAmmfs9RLLLinCWqdxjT/LzYBV6+9Lcwn2upgV1uCUeOsdb601/DLQFQlf83d/FPxb DWOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960959; x=1763565759; 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=wh23cgVTrsuEAgMOdQ2R3Fyv92omKUsnmPcgOaLOE0w=; b=Wo0aVilMRCmuSuMldIAetZGtVBtg375UwYvCeG4NjxvGHqJftw73zlTnlxp3BBzIvZ W0nLduj3SeKfJ5dZZ9rxYR3Q3T/RppKkVbYZ8v9cjrDyoHo7Nzltjb+HVx9L/dIo4Kje +nM2uZMe5NrynknwMyPbU8U0lSwD9T3ID+OdpASdw6hkSkxDJ04zVhaa7JvqLm6Lt3dP e4gajt3Gt9btHADIb3BS0PawzQy9AKtprS1QrLbUSBAzQYruWWKCg5RabNuOskBtx9Gx 53pqCcsSQ0J59hoMVJ5VoYVGHbAfStvx320PJvTP9WW25GnGqJVToXs1zw2ZGtw1W/3p Aoww== X-Forwarded-Encrypted: i=1; AJvYcCVmAzVYORVidFgcG/issgBxfer0wmUgpAdRn3WHuZ9k2yHRPKsm332QCGFVxwNseRv/5C8GCuMT0Cwmk9g=@vger.kernel.org X-Gm-Message-State: AOJu0YwuTwusKEzI5DDNagi0jFZ+liwjZomKKgU5wnt2GW+ggXyCtK+e 9rbBG6UskKYbh4hSe8adaLVZTtv/5rOiFEfXuCdwq+eSxuv12OX9VRws/a1MTAcuUR9n7arr0OO sv19zsTY= X-Gm-Gg: ASbGncvXA48vFkm6dI+/YSMv3cCWa5YNk69IRlmnFVev2MdG/GiqkSb2De+inKWgwfk waX6B0MeJbA3hauuFVeFDw2lAwpsMzlG6jGR4qCbY62FMYGHINA3hL0Oh57E8IJHoWSLu39pWf0 jCqm3Go5e2LgcIDYYvNcyiTIrVFi0Dta4qHlp1z0IwwjzX369E1ChFlYjyMlRLdcBRF8v5NjCcH oCiVR/q5w3r8JLWws5z+eAYFR++vc48p2AnsFMcVH0LsoP87N9RHEhxxf+kM200yNWPTq+7CbeT z5MYRMNIfjkz7+u/ItYtQmIQFodGuFD7OJbl5vt8abEfb94w5q6WuF3HnPL67lMUTN78CiJsDVk Pg9+oLyIPZSgVbkExLgudWS/4rLblk2WSZCEJYuYf0Tvy3hbkmJkEH7osM2lCvqKTtME6usxNGm s1H3FUNbfKRg== X-Google-Smtp-Source: AGHT+IF+L/8DtFqvQEmvBjAnJLhDcKijbfYq7KDpw5oNA46EuTEQqeHPWKCbNq+YJQfVY3elkWIKSQ== X-Received: by 2002:a05:600c:3b11:b0:477:6b4f:3fbd with SMTP id 5b1f17b1804b1-477870b935dmr27757175e9.38.1762960958765; Wed, 12 Nov 2025 07:22:38 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:38 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:17 +0000 Subject: [PATCH v4 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: <20251112-james-cs-syncfreq-v4-11-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 '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. Signed-off-by: James Clark Reviewed-by: Leo Yan --- 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 1aa0357a5ce7..d4e294cd48ae 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 @@ -800,7 +801,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 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 8082834250C for ; Wed, 12 Nov 2025 15:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960964; cv=none; b=e4IO5x1SKTQF3mcInGMrwODYeTB4JY+vt9OunDiZbq4rtPi6PQkUfzNpMPt3ogCYTpvSigWM2osk9wz0+WTtzIg1ylGDi50PNUcGVdeC+e+x/tvGyxLnn64nKzN5gVj/Dx9PiIvotYZ5HbrA36CSGNnkuqdnBpUndNrenH4O8b4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960964; c=relaxed/simple; bh=UjTGmax723De5eoOdMzd7P6vXMUjHRdJqKjlLjKreAY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sJAX+qr7QC6fXcPygAFH2+A5tPXxOaJqQEo7bHUF/qK8CIsR4HMtVjGJEI4dRI0csB02emXACtFStYrdXTQa6D3b0Ta5ljeJh5pkuKBICPE+VNUHtpnYFUHjoiOPqT4l52DtYB97yhXqwP+QWB8Jm+NYe9+GtL+DZZ3zUxyMU6E= 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=GOSAZo8L; arc=none smtp.client-ip=209.85.221.49 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="GOSAZo8L" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-42b2dc17965so906467f8f.3 for ; Wed, 12 Nov 2025 07:22:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960960; x=1763565760; 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=KsbUilQ/qm8vmmBkUOmxmlvBhtXtwp/NWlCF2+8uaAM=; b=GOSAZo8LN8sF686FTc8musfn+SfJjIKzsHoWl81iugw3UYt7u+kS1YeOB6URfeRNqT L/ExyhUNneubqwF6eOLJAIo6mBr4C/wppKi2SJJK7uNank5q+IHoDA5M500PyDdc6stw pzDky+vX+/Vv2Pwv7K99sFG7+nB70IgswV8hwxoEp73AMMpGC4N1kEAMyWsDpOmMzaHA bKh/OMGjkKsw5EL2DG+0H3ZQkzKZpCK4/CF3PN5orqMYjlqjz3FkyhBQrCEuUkZp9xHx P+j8pF0UR9ymk7OOxcleDzWSsFy31y2VFoXOAe9mmTGAJGGPnVzg+54DqRpO9uvfdit0 iRnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960960; x=1763565760; 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=KsbUilQ/qm8vmmBkUOmxmlvBhtXtwp/NWlCF2+8uaAM=; b=WQcf+5N4LRPV9q0S59TvoXn/M4D50s1N6/CaqjZJSPjqZcAG/DxQuP4MH7Svco8g5q VhyOnR6uyA1RNng82ZbHqGlfFwvE6Ffhps18/7OfeIjohFB0jZIr2PGBhWe3ki764/GP PgVIaG4M+S+7RIFHX0O16gXgEgk9R+pcE/lStNDNoO4HD0Qqx3hnvuQ0vAbLkfAiInhQ ZaXJqvYrONW07jYHSfqm1Xvl1sIbJ5+GdhsTEljzDI8FBcbbfRi98pPgo17T9sW8SM52 hw0ftY31CUyDcxlY8WV/0olC3pre5cmilLaXZaF0+m+pJXikMQt0pciqMGId6WTkSCCA 47sg== X-Forwarded-Encrypted: i=1; AJvYcCVEi3ysdV4OF37uVhat+nneuu9va0B8g93vwEDo/oMPuBsEZEoR+2kmGuQStQmmaynB7P/aPXlaRNjlhpc=@vger.kernel.org X-Gm-Message-State: AOJu0YyB0WTCL0m0otJa6Im4moYL9CKpDc6q6UsfK8Se+fE+Cmw3auQw qLjuN6veYOuWIO5zhi3Fp8SCQGWwqZFffCmvx9FNdKXg0v9yvv6He7CYWmm2YsFg1vBi+xdXbRo BSKzr/Fs= X-Gm-Gg: ASbGnctGDh+e1AK1B1SuDBMYP1oaKTcyNiwHpwsjYbS+nQUm+eCXLyNVD76KkjNKnhN gzHP0WklB0iU1zPBn2pL1nhwfKwtnrrS+QFxcb2pCIfb5L/2IjcqAeUsBhYE/TwoDFQRQl/pIJI kPAtKZaWtyHIV/wl00L9kRg3BaIwD/N9Hi+5P+TlygkLNEXoJhHV05BqAPwjNTWJMxuJhrHo9Iy V7xZJaqQRAtnIJSzUxtR7KkrQSi7bC77CpyZVEV7SVrfJ3xQTnb5yaqCyWwH9Tld5K+JikeD8Dg D2Z0mzx+u3qvegA2h/PJNjE9E+oiETE2neMetSAGwvtA8ucitxbq4YmoueWSd5n7wVkFKJGQ4C2 PbXx4/WE2n4iVP2YRqlgAmll94VoNhZ+gcwNVZIk6s/O3GKkJx7QCUGFrKOIaMwqdH+PVbAUqMN 8X1uLgm7eOuA== X-Google-Smtp-Source: AGHT+IG9+YPot+b+QaDWCuQamvFnTs1arej/50qBF58IBiHamnww69TGhn7gm30P7ZLTOf4+6BWvrg== X-Received: by 2002:a05:6000:2505:b0:42b:2c54:d9ba with SMTP id ffacd0b85a97d-42b4bb7ce86mr3285791f8f.20.1762960959666; Wed, 12 Nov 2025 07:22:39 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:39 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:18 +0000 Subject: [PATCH v4 12/13] coresight: 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: <20251112-james-cs-syncfreq-v4-12-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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. Set the interval using the value from the timestamp field. Granular control is not required, so save space in the config by interpreting it as 2 ^ timestamp. And then 4 bits (0 - 15) is 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-etm-perf.h | 1 + drivers/hwtracing/coresight/coresight-etm4x-core.c | 28 +++++++++++++++---= ---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwt= racing/coresight/coresight-etm-perf.h index 24d929428633..128f80bb1443 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -7,6 +7,7 @@ #ifndef _CORESIGHT_ETM_PERF_H #define _CORESIGHT_ETM_PERF_H =20 +#include #include #include "coresight-priv.h" =20 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index d4e294cd48ae..cb6f08510dc0 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -660,7 +660,7 @@ static void etm4_enable_sysfs_smp_call(void *info) * +--------------+ * | * +------v-------+ - * | Counter x | (reload to 1 on underflow) + * | Counter x | (reload to 2 ^ timestamp on underflow) * +--------------+ * | * +------v--------------+ @@ -671,11 +671,25 @@ 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, + struct perf_event_attr *attr) { int ctridx; int rselector; struct etmv4_config *config =3D &drvdata->config; + struct perf_event_attr max_timestamp =3D { + .ATTR_CFG_FLD_timestamp_CFG =3D U64_MAX, + }; + + /* timestamp may be 0 if deprecated_timestamp is used, so make min 1 */ + u8 ts_level =3D max(1, ATTR_CFG_GET_FLD(attr, timestamp)); + + /* + * Disable counter generated timestamps when timestamp =3D=3D MAX. Leave + * only SYNC timestamps. + */ + if (ts_level =3D=3D ATTR_CFG_GET_FLD(&max_timestamp, timestamp)) + return 0; =20 /* No point in trying if we don't have at least one counter */ if (!drvdata->nr_cntr) @@ -713,12 +727,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 @@ -808,7 +818,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 --=20 2.34.1 From nobody Sun Feb 8 22:07:49 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 7CA13342CB4 for ; Wed, 12 Nov 2025 15:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960964; cv=none; b=rPWA3FL9ZyJlEN3v8+MAOCRYqoBD6qKeW3EGbfRl4NR7j1WNLa7m4b6IrKzNMTe41M+tqwzb93pVQoGoHHqpJNElqKsYDO81K1/7eAr9ru7H2ZP8qC0Fa7SViy2CbNQJQQnou1rDnYlOAlWaeNlRgsWpbS27k4Qd2FaWxswYFDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960964; c=relaxed/simple; bh=vIoSuKUIgKlvMmrNCjvc9BmN+EVbN2mv6N8L+3PJiaI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uB9hNmP5LmJbFDDhQAFxzqtT7KlXpRJ8yQUA68fx4w5JbRF0NsQURVakBDBvNNzJuYqeydoW/+o6Tjl3LBgwJVq7ZtvWYeiVluAiH1khJ4xMpSjRybSag3niwlICPTlpbyiQePML67iIQkqnV6lJ2/ZDHAiH2ZrPsVZ9OsQfXV0= 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=R8crMwDP; arc=none smtp.client-ip=209.85.128.42 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="R8crMwDP" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-477563e28a3so5975085e9.1 for ; Wed, 12 Nov 2025 07:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762960961; x=1763565761; 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=RDsBSlb7WeG4t+Zz0qQoWGyQAvxf7H4neeIGYfC2zjY=; b=R8crMwDPpFAUn5w0IF4ncHYxxs9Iu4PIxV7XARy1fhlPUpxtPysJn7w7Y+fnWWjwn9 +nxwTfh8EOvlf6OJkX2OKNerRCFNB2XvsmojRgmbFp4t2eKXRX/df8aMHTdrGvnL8uFF KvfrqFB/YgGhbdPSwhJfVL+9bt6VSqSumHkCYf3wj7jG1EHDxCyhiQY9I3BdpTzilXup CMcMStDT4xhtpDnQHhxtT2lSH+tut65rJ+R9F/cYrwIiCtfvipQBKl9eQr8/ASh9ysMX zrZafXqGcMN7e92FHsMRtZGwmW9nidrORJSds8lej5/TEGkS0GhXtWYLxzRyH+iDboGT BKXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762960961; x=1763565761; 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=RDsBSlb7WeG4t+Zz0qQoWGyQAvxf7H4neeIGYfC2zjY=; b=uTWhnp+bRXlu8j74eO2ZWb9kaMlDpQBLjgFzB9LMlq/wP2N0YNRe0Pj2JnP7jY77MG 8SaG3x3qk48jsQUWddS2cEg8ZpXM7eWWcKaEjbc9qS9LvbYgPoih7e+P8M6Vj9vmJTLg bayT5eDdnSpoOBlC4zPQnXbVvCY2GGrWX8xwugfGts+abBY3kgQS3qqFyZz8z+9NUULZ GvS5W+HXrrWJCNSe+iEL8kpDwjIur3uVifMLdEkuAyp02Vf1ys65POlInIiziJSGUINY /cU4vAkDk1402VUtD37hOIrS540UcbGaKyqHfYYSwMdNU2hbTjcwDz9CkrGNgCElqcj+ kSDg== X-Forwarded-Encrypted: i=1; AJvYcCVaYc9rxsfSrL5kK8o08OUlq+OU3KAoOlclwG15xvbBECgJxLHSue91dQ6KV0jM7Q/vQGyPRKx8W6zAsJM=@vger.kernel.org X-Gm-Message-State: AOJu0YzGEDsKY7zSQHHZW5HpuFG5RiOPc5aREIeyhlXiGq6lcftswEUC xjmvs6SeeTietqWdvRsSsBlqXftisLBTwxaZZwBMz3GgVZ/Al4zrrA+yy6Yk1YYETLSQ78f5Mae wGVtgfxQ= X-Gm-Gg: ASbGncu3VptxQmG7txkesqoX3dP3rbOMeyK+MFlmev/7yTKKgnOmHFJYX2/cVPElqp1 iiNRW0taT3ge2N6SCnc34P4EpNk0VZMVO0mMhGl4gyBdecqcemePvmCO7KEtfiDSpLHoDh8nkMM xGxZRXYUc6W3PvV5vC/EYP0qoSSizXPtC95l68ur25+SYqxRj8Rj8Wfp0fNvy5sNZVn/ZGqcBMo 5rHfyfSmc8eAuvc5MmwuPInvzoSXLJhswi98wCEAVLTdHTHBGmAQbuNA4FFaQ8jywJ6I9vdj+qc vJIuHIFUenOeiz5b4phciwdv5yzmPO7WdfRa/m2L7fYmr+lKVZ8sQIk4bPnZVcZx7yZBYipIySP gRuQHgirMmU/13M4Oxrsc8kbSgU30WB49i2wMlD0Mzn/wST0TehqsNoZfHePFS07HsaC9gPCZaB QTdEpmTIV6og== X-Google-Smtp-Source: AGHT+IEuc3bgQChegQeV43CchL7U+HtACup7lJPgzLmedOPZfHtTOSw9g16bfGt0TS1oBLr+C/CdKQ== X-Received: by 2002:a05:600c:80c5:b0:477:7588:c8cc with SMTP id 5b1f17b1804b1-4778142013amr40810085e9.7.1762960960555; Wed, 12 Nov 2025 07:22:40 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac677ab75sm33573485f8f.35.2025.11.12.07.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 07:22:40 -0800 (PST) From: James Clark Date: Wed, 12 Nov 2025 15:22:19 +0000 Subject: [PATCH v4 13/13] coresight: docs: Document etm4x timestamp interval option 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: <20251112-james-cs-syncfreq-v4-13-165ba21401dc@linaro.org> References: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@linaro.org> In-Reply-To: <20251112-james-cs-syncfreq-v4-0-165ba21401dc@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 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/tr= ace/coresight/coresight.rst index 806699871b80..80b5ed09d69b 100644 --- a/Documentation/trace/coresight/coresight.rst +++ b/Documentation/trace/coresight/coresight.rst @@ -613,8 +613,19 @@ They are also listed in the folder /sys/bus/event_sour= ce/devices/cs_etm/format/ - Session local version of the system wide setting: :ref:`ETM_MODE_RE= TURNSTACK ` * - timestamp - - Session local version of the system wide setting: :ref:`ETMv4_MODE_= TIMESTAMP - ` + - Controls generation and interval of timestamps. + + 0 =3D off, 1 =3D maximum interval .. 15 =3D minimum interval. + + Values 1 - 14 use a counter that decrements every cycle to generate= a + timestamp on underflow. The reload value for the counter is 2 raise= d to + the power of timestamp interval - 1. If the value is 1 then the rel= oad + value is 1, if the value is 11 then the reload value is 1024 etc. + + Setting the minimum interval (15) will disable the counter generated + timestamps, freeing the counter resource, leaving only ones emitted= when + a SYNC packet is generated for every 4096 bytes of trace. + * - cc_threshold - 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 --=20 2.34.1