From nobody Sat Oct 4 15:55:17 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.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 B0EA5318148 for ; Thu, 14 Aug 2025 10:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168684; cv=none; b=N04CPhoS4FLEVV6PAF/AdAABWYw6eJvC3NRw82OlSMAWrXrqRTqySvkyuAuVOG1sExmZbnyqS3+2IE6tKP0AjeGeC76XdUh+jcoc9O5mx3eZdJXK/PQ/aJZaKBi/nsztTXLr9a+ibXTOGsLESZqGbqQ09na63XXm/h8lW/dejLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168684; c=relaxed/simple; bh=4aYl0ZlZfO9PKf1O2NFxApvTlFmO+ImWPT/xpvy6zJ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gxlqOGnW98uxf5G6wJGPst6ErBMKLfp9cjYlDEPdJUuHfIWnGXZ6ptXTYRjzw5kbzzsTsJOChnYus05i+qt1GzzMm4tQ6m0to105bnXn5k8cwLx2wetbCL+EirxPmwVVd1Sc9T4P13e5Rj9nJgmubOB4I1Oz5VotjkF4EgY0Q6c= 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=H0ADKPDA; arc=none smtp.client-ip=209.85.128.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="H0ADKPDA" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-45a1b05ac1eso3464445e9.1 for ; Thu, 14 Aug 2025 03:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755168681; x=1755773481; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=flPVDp6drpFtCapB44BZdn+149SFai2CStzeZGBA02s=; b=H0ADKPDAsxo6vhr5Goo7l2G3il5EtV9nvm6W2j0YYJm4GbHw01A5s2MdEoKabtL2ik 7MF0IYaJ7Bwrtt/hbWfwSknkWcCoRtU0nk7rgjItCFTSY5rb+44+d0eFJhsZNQK93Vx1 TQ6SEXgz5XeURscGQ+IYljvLS8AD4+IBNk3Gkv6ebJBvl+VOFgk9nwBhlqsfJLGvOQOL Ffa3o0K9Hbv5xZti2KIY+idZlhajew8t9NdmOh347vo7ylyWNGNDEVR8DXdoa8B/NBN5 G4bHkjTq+J3NW6vj7dlVR27nv9cXl6axM3Jl2DqyR0x0Aqf1LBQIrO7fFSD4gXRnGpPJ BnGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755168681; x=1755773481; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=flPVDp6drpFtCapB44BZdn+149SFai2CStzeZGBA02s=; b=ERBTfUKHZm6jB/19hpwLAZCjzsAWcrDJZ5MZy02kqemhFxxZzwDCiB3xZ8m2UTeirz bp2O6A5I4MG6db+/6spiIxL71DR+IxSd9Tf0hrrwiIEB7MYZ08VHObE8p8kYY/ExJY23 cO0bx5ELnMtKGgr2iP86MK21J3Yl2GNryd4dzVNXAnEb6cmKuufsvNkRGJuyZkRnMkt3 TWi2PQAYT4lnNE64BNgyyCTbRuV4Cs+b8QKKEylsBxLA62sStGrio0UKDmzvHlW/3W4v ur4O0ggkVK8Luv5cmp/01rMgnQ6aZToScftZ+2OPXCswXDFwafXQyFle+Up2kuy0svia RXXw== X-Forwarded-Encrypted: i=1; AJvYcCURb3SG1IkOm1xqMiAh7r7fnp6Shq7oeE3prD9oNT8ToBEsmjKtszSPRU/pEZ8TNt8hqFclli+E+CUqYls=@vger.kernel.org X-Gm-Message-State: AOJu0YynW1m4BbS7/UIhPa7btE2BCbiijOz42g9HlL9VbWOMw67yw0+C KdCRa8QyR3NR2kZvcYQO/2UYCcIttcOwLYrNzYFCbCsKkMmf7ji/aKjFDSwDly74Axg= X-Gm-Gg: ASbGncv2w227n3t4kJ1hgT0VA75r3a9w25eoN6v+sw/baPhvG7FHv2s1ABA/pw1kxh0 SN9wv+CZD1LeS5cgucSToYNKa4CjQufaVia6nvarmztkXieHIQofg5ci06E4QG5zqKdQPTMSxqO AmY283jmy0injymvEcHLorVsyOG352ajG6rM/lso9ekLbFQSZvjOkeOZDB2dOHOGzR4SKcR0li8 k+vNJnpHfqEQZN/2sFJGjXOueY8bNEdWcyrdZtoxsq3tXnwGsgVt5e2TJz/vdYH0840m8tLLLgM HAG0N0sVydT+I0jVT5cMAI/WQSuD3GLImQ1n9dk3Pof8KshkYU251fYGcou8tjK8CnaSYk/NdZ6 SKIMqHix5jqD17frBpnPCvDBbxggUfWA= X-Google-Smtp-Source: AGHT+IETr1S2IB5p0qvTLAX5im7MRWeRvzS+YGEJ7c0VQq1WWHunLmPo9zoxHd949lhLeds4azm7BQ== X-Received: by 2002:a05:600c:4ece:b0:455:f187:6203 with SMTP id 5b1f17b1804b1-45a1b654a11mr20355505e9.27.1755168680945; Thu, 14 Aug 2025 03:51:20 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b226eecsm14228345e9.1.2025.08.14.03.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 03:51:20 -0700 (PDT) From: James Clark Date: Thu, 14 Aug 2025 11:49:52 +0100 Subject: [PATCH v2 1/6] coresight: Change syncfreq to be a u8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250814-james-cs-syncfreq-v2-1-c76fcb87696d@linaro.org> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> In-Reply-To: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 TRCSYNCPR.PERIOD is the only functional part of TRCSYNCPR and it only has 5 valid bits so it can be stored in a u8. Signed-off-by: James Clark Tested-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 ac649515054d..746627476bd3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -824,7 +824,6 @@ struct etmv4_config { u32 eventctrl1; u32 stall_ctrl; u32 ts_ctrl; - u32 syncfreq; u32 ccctlr; u32 bb_ctrl; u32 vinst_ctrl; @@ -832,6 +831,7 @@ struct etmv4_config { u32 vissctlr; u32 vipcssctlr; u8 seq_idx; + u8 syncfreq; u32 seq_ctrl[ETM_MAX_SEQ_STATES]; u32 seq_rst; u32 seq_state; --=20 2.34.1 From nobody Sat Oct 4 15:55:17 2025 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1F852F83BA for ; Thu, 14 Aug 2025 10:51:23 +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=1755168686; cv=none; b=rFdo8viHhRwAr6kvMumOeQ7OaaoYgI4553nSQjRGuRLDSKi1NE6xL0rCEf49vPutEHu+u9tXIbUvwFXs7wWQAN1Vho4fBxNWJSyui3nldsl/YmQH7lE3I7noQKCPVWHXfmTY4OvZfhC3zoJQt2URUWX35vNReO6inrP8xLWbu9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168686; c=relaxed/simple; bh=Ghk9v8X6ZI95UzDotAn+mX7JIMr1ajnOOt+YAT0AZyc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bwoNJzpsYgyBMGXkjLYZXQ7hzKO45DtxNFJOkU3j4aMDb2hOW/Gr2nfCk7DXpa0OBIL5UKlfnVJs2O2GwkMutfMAyH7vIPIupbzNgDgJIwquFHYaNE9jH8eu4SIIHf4yaYG/jaz4Fg7jXCwzXZkPqpvUSl5lThlWcHOfQ5OEgSg= 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=OmtX9LTj; 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="OmtX9LTj" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-45a1ac7c066so5075685e9.1 for ; Thu, 14 Aug 2025 03:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755168682; x=1755773482; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KdeJ4JSRd2ijrq8xQhXxaRgP6MLKlDNmproFaVga4Ac=; b=OmtX9LTjaAzR9ffv9I0XS1DaypOTDqAeBJNizUCg/DwkKSlxy9MAEfc4dfTPbZedxN qela5LeGTD9jubgN1tWmqQAd4XmFvHO6T1KKXZdjXy5IDi7Kh2cypGFitnVxhwyURn/Y 3BkDHk8M5CRexplgBklaeeiElb45lIoB0Ddftdgh6I0FvXWcqHBQLZO1+pYFFlr6S2Nd 4JhaMcmEuYBUEsYDqKCNt1D3iz5sTzUVwHEu/hlyzbXX3p7SdAVRmmUZa5VN7KH/OY/b KacQlQ1UPf+eBoyLDwUPanxe839rYxn4Y4dEOV7ATX3V+JtqR88wWCHbD2GtVXAh6lIS 5/+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755168682; x=1755773482; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KdeJ4JSRd2ijrq8xQhXxaRgP6MLKlDNmproFaVga4Ac=; b=mSStsMX57FHkg5epQksKLZ5gVlG7HSW0eYoWQDypzsIlDiucp1/2l9o0LAUG/sD8uK notQDAeJXo3Ys9Igdy9XHBU7R8YzPZkZ8wr6ymRKdvr8KY4F2ZtgcCT+p6vuFzmEtpkF Q+C8Og7cW6LhmVZlnpTWHj+mRwiWB9T+KW9UTJxjoF6Cb4bxtlBBKPCj6QeefCizWc0G OB1udT88JOTvaxeESdN/XBr31c/vAomx4FPs5efZfcDy3d2JDGYx4ECZLvaigCuYkeFM uv6W9rEToYCNl997e53ll5JFS7DtY3/cRU3aA9zXKj5/YCCvDc+VFFkN0gc6gdirSRfz TxSQ== X-Forwarded-Encrypted: i=1; AJvYcCUQiag6YqZ5995J/TnnYoc7k1LW+DXCP/b03gYjxgaYmZ6OOjQXGCX5aVuDZdBExiWdkzCpJaLttg3aXtE=@vger.kernel.org X-Gm-Message-State: AOJu0YzlYrryVqcoxGqMf/cvXWTrT9dZ/kAVeviVvhjLDNs0qOGLJ6iS lBcrnoKEkm17+w9pSxO4UCyfMr7T0Lp3rza8eU2uqnIA4ZACXGKP+DrLE/0zx0qt7Bg= X-Gm-Gg: ASbGncuvbOxAClcsWNIzIOf1f3vc7NyNnUYE7st0FtLBBndG6aiAag28mXE8WaQbV3e WZcjNolXK9QR34d0YwuCJj+tV4TEJpjH1fVF2J6bRel3jJ66cp7fjhJ6we2BZYCKnNAqE/earu1 6dhsV72ODy1mjc6G1JO9SjWpqlWLzT2hSwdw8Rs/arL21Dedpb4r+2xkZBi0Oa/St5cxDQZhzH0 Whi7qepGEYyxFdLZUXTpSxP5w/U4lRLcf0Bf15+nVy8WEu3xfODwA+GeBMyC+3YDrKs5VkspZlB rYpYIN+yPC9GK06WnhnRDT5kmlWSGPcy0WX8j3QFCkX3Z/Eochwl/1Z+Eib6J5VmlCzRpdiIQxc 4tDzXoAptK7pRmA4tLVAbNiqELqpskTA= X-Google-Smtp-Source: AGHT+IGiw9zB/I+LYQU9OZmJehztvJAaw6EEWckqoahlG6F9UH7uBsO+Dc2b7nrazKkmaZlJ83qC6Q== X-Received: by 2002:a05:600c:8b05:b0:459:eeee:2759 with SMTP id 5b1f17b1804b1-45a1b6c7e20mr20628185e9.14.1755168681929; Thu, 14 Aug 2025 03:51:21 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b226eecsm14228345e9.1.2025.08.14.03.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 03:51:21 -0700 (PDT) From: James Clark Date: Thu, 14 Aug 2025 11:49:53 +0100 Subject: [PATCH v2 2/6] coresight: Fix holes in struct etmv4_config Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250814-james-cs-syncfreq-v2-2-c76fcb87696d@linaro.org> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> In-Reply-To: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 Lots of u8s are mixed with u64s and u32s so repack it to save a bit of space because there's one of these for each ETM. Signed-off-by: James Clark Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm4x.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 746627476bd3..a355a1e9606d 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -832,28 +832,33 @@ struct etmv4_config { u32 vipcssctlr; u8 seq_idx; u8 syncfreq; + u8 cntr_idx; + u8 res_idx; + u8 ss_idx; + u8 addr_idx; + u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP]; + u8 ctxid_idx; + u8 vmid_idx; u32 seq_ctrl[ETM_MAX_SEQ_STATES]; u32 seq_rst; u32 seq_state; - u8 cntr_idx; + u32 cntrldvr[ETMv4_MAX_CNTR]; u32 cntr_ctrl[ETMv4_MAX_CNTR]; u32 cntr_val[ETMv4_MAX_CNTR]; - u8 res_idx; + u32 res_ctrl[ETM_MAX_RES_SEL]; - u8 ss_idx; + u32 ss_ctrl[ETM_MAX_SS_CMP]; u32 ss_status[ETM_MAX_SS_CMP]; u32 ss_pe_cmp[ETM_MAX_SS_CMP]; - u8 addr_idx; + u64 addr_val[ETM_MAX_SINGLE_ADDR_CMP]; u64 addr_acc[ETM_MAX_SINGLE_ADDR_CMP]; - u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP]; - u8 ctxid_idx; + u64 ctxid_pid[ETMv4_MAX_CTXID_CMP]; u32 ctxid_mask0; u32 ctxid_mask1; - u8 vmid_idx; u64 vmid_val[ETM_MAX_VMID_CMP]; u32 vmid_mask0; u32 vmid_mask1; --=20 2.34.1 From nobody Sat Oct 4 15:55:17 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97AAA2F99BC for ; Thu, 14 Aug 2025 10:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168686; cv=none; b=afsC6jHpYwpGYiqWp9bR+IKeSA+7S4i4vZoSGHt9jesTzW5W+ipsJCU6UJExqvtnx5MowGfCkpKt+GgpbH6NyFWbURez4rNKKsX8DIpn3Lvgg3H2MC+rtglQ8kyjXAL/YOQg2uIKSWeblmYMy82v3Cvd91aMsxDkNBwIrxz/sOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168686; c=relaxed/simple; bh=m7ucCcGVN0FUBECCGdzVEI3m8S2GTPWLCEum9ShUMNA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G7NW5ixhHgndsI+12tsEmHpBihXVXpzoRMFXLX00xR9wniFzsiMqGq23+H6U4Pcp6/rr0MuSnShXby3ggqZmRIKSCz/pCLcqe+884+v/p6KaSyoxqG1svhwEyEkoLvv2KmPayWpmc7QT+aUyISVDT4D2ezbofcSqgF/5D0nY8uI= 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=RtiOu9ut; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RtiOu9ut" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3b9d41cd38dso496540f8f.0 for ; Thu, 14 Aug 2025 03:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755168683; x=1755773483; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3GDsN9LxSDEitQ0pzvRQqf9bGA4AutUNUEYwRrkhQ70=; b=RtiOu9utFfz+FjMdc7GSDmmMWdyK6WgSNNETXNohXIpAKfY8ob2E40xm+e0afCNeN/ XnQY9Y7e1KMfQdWPQsF5v7c+Os0PDmjc58bCrpIQ076Jr1SfYAtglbvZO5fbqV9FVqV4 lB2YKsXJ76qW/tZJJXfSy9gp8pRtDwMxhhLkONPlmsJ8mUB2HAq6DYUP1DDCEWnGRNvJ 6i3wB6yF2x5Il0uhFRPKjktwgsAQe7R3yKe+yzHTi2PXn+TXNZ32UCGZalrvQqsWX59S sP7L62v6Rj6T+j/Rzr46pfHW2HNleQbl7blpPYzpzIdG4yhfaOJ/p2ozPoS9TsZVZda/ bZCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755168683; x=1755773483; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3GDsN9LxSDEitQ0pzvRQqf9bGA4AutUNUEYwRrkhQ70=; b=BSPjqfGHwuCknng0K+9ZdktwCPsks/bJp+5A1oriGeydbhTNBFXNPnSE5u846QbASx A/lrYY4XsRTX/VncX96AaTKcVwiPM/FdCO/DQZXn4CfY2JPAjeUBnqs7WyHgCS8zc3Wh VZ7vnZuTNHP5k52pp1vXr5+x3nhj3/LvNGRjjfEBLi93PHR3fbB5MFc4M6wODcdeE9Gg SOY79ljyb4EqiKQpnjmBldi3DK+JEA9WmiZaT5niG5APXmWemxpvJzkwz25hZ1iUjDHZ WnACPnDeNIPKf46wRNbwGmlsbVRwJKWkecHIp81ZJ3g5+Ku/xC3Jx//OQ0SrrF+nGxAp cvlw== X-Forwarded-Encrypted: i=1; AJvYcCUFpJSwiNuepRUcrMP4Ek4kp5glH1i5JIVM+pgpHo7d99sTfng8xoaZRK+3hcqyfU4UCJa0Vtun263dAOk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4YCOvtKL2U9D7Wk+d+M/PfYsPXiLSn+iLqfAQ1vOV/uksgbDs HoAEYrElbx/+dCNRTo6MuNJ11hgLndqV5pkjFy3MfiLENAwszjj4+9rjMltO2EpG7Tg= X-Gm-Gg: ASbGncugCQmhqV+t9q0JpvPka5udLrMQ6NcZwUrr00Epw2F9HoRo8X8qvPl5lJhCgcQ 1BsThewJdx+ehEudUbGwGPHwF7+F9fpe67NqVfsoO1ayVUwa0MvkwJfWp1fsUkqc62BhzGYpCa9 0Xm+3Sh/aRZ1PqYbMB2rhrlgbbldrvtQzoc1k4h+v8MOJV0SEVYH84ybA1IUT2HXcBSB+SKPjQs k1VwaxY3cXL87uIqU4wFviSjh9w1MMEh7YiF9Ls7Wmr3Qe+2tT5PpWehtonACxn4nd7HClW2sRq 9ih7ggcQbVlgZi47a1wMXRModaLKJ1aNw8GVoD9Lc4dOigGPcqQOFlx2fUrCItFBazNAexQnUV2 PlnfoIgb+x3Yj2VX7XPTj7w5HvbCF+5o= X-Google-Smtp-Source: AGHT+IF5P4dyVkR12cBMw+uYpwiYnNAlcSu0vH+8udQzxGRbHLddJ/1K+6aeezIw6lInsN/G1CLYWg== X-Received: by 2002:a05:6000:1889:b0:3b9:7c1f:86b1 with SMTP id ffacd0b85a97d-3b9edf35019mr1847829f8f.37.1755168682900; Thu, 14 Aug 2025 03:51:22 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b226eecsm14228345e9.1.2025.08.14.03.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 03:51:22 -0700 (PDT) From: James Clark Date: Thu, 14 Aug 2025 11:49:54 +0100 Subject: [PATCH v2 3/6] coresight: Repack struct etmv4_drvdata Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250814-james-cs-syncfreq-v2-3-c76fcb87696d@linaro.org> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> In-Reply-To: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 Fix holes and convert the long list of bools to single bits to save some space because there's one of these for each ETM. Signed-off-by: James Clark Reviewed-by: Leo Yan Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm4x.h | 39 ++++++++++++++---------= ---- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index a355a1e9606d..1c67b263b01b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -1020,29 +1020,30 @@ struct etmv4_drvdata { u8 ns_ex_level; u8 q_support; u8 os_lock_model; - bool sticky_enable; - bool boot_enable; - bool os_unlock; - bool instrp0; - bool q_filt; - bool trcbb; - bool trccond; - bool retstack; - bool trccci; - bool trc_error; - bool syncpr; - bool stallctl; - bool sysstall; - bool nooverflow; - bool atbtrig; - bool lpoverride; + bool sticky_enable : 1; + bool boot_enable : 1; + bool os_unlock : 1; + bool instrp0 : 1; + bool q_filt : 1; + bool trcbb : 1; + bool trccond : 1; + bool retstack : 1; + bool trccci : 1; + bool trc_error : 1; + bool syncpr : 1; + bool stallctl : 1; + bool sysstall : 1; + bool nooverflow : 1; + bool atbtrig : 1; + bool lpoverride : 1; + bool state_needs_restore : 1; + bool skip_power_up : 1; + bool paused : 1; u64 trfcr; struct etmv4_config config; u64 save_trfcr; struct etmv4_save_state *save_state; - bool state_needs_restore; - bool skip_power_up; - bool paused; + DECLARE_BITMAP(arch_features, ETM4_IMPDEF_FEATURE_MAX); }; =20 --=20 2.34.1 From nobody Sat Oct 4 15:55:17 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDA1028C009 for ; Thu, 14 Aug 2025 10:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168687; cv=none; b=nIAWMm1ubrprcY2iiVtB9nvhi0KdAakUqGIoBuht1h9JJ0nZbBZZ7OTtf1H7OeRklnuU1kFnS0AN04UdfNzUH7ooZkFsG70Ohx+vDAnereHLf6oxkNdIE7pmOvuQUI40N2DWajPtRGWZCzcwkAk0J1rvDTZVFx8r9KSSeTXKSNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168687; c=relaxed/simple; bh=U8TkMqWfDTBWjb8GRi9+VCChj3K0XOJrpYPU0RGTnw8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W6LlWu0r0DrY6eWH6qYlw+/qYrTPchqvnp1Mw1xD/4tbPIp0CDE9GxuOX/xQROQ/rFlB8Zb4ZcvhFNk9afcNIrtiNN/D6zkhjCslQQ61MPQIl2cVCP8l+UmohX5mfSry3f49lmtd8j/bL82TifOVqtqWkn+9hV8s9pbAHMMfBVk= 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=JpxeUPRT; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JpxeUPRT" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-45a1b281d25so3005195e9.3 for ; Thu, 14 Aug 2025 03:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755168684; x=1755773484; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UCFJWq6hVWDLLnb3WEoK3x2DCujP3OgS7K9EwJG0Zgk=; b=JpxeUPRTUfJ0LWzhgQk/956rzEbCvFWFjIRJrrzAQapiaZ/xqyTfoihurrx9da3jN0 Fis4fVleLxt9QZSszHkDedAxRluq06JlCJ3P7HizZkpbwshdpiKq4fJTrCpZV0tpMaB3 kK475ZrxF6Bg9lfys/fXQY7bb59//rnx5KIIf5IsZtz81/yFCfVX/Tkc84ns8OHgz4aY imIcXkuEqje8bLKWnUKUOBYW2a3PdB75uIjf1ae8Fm35lgkWna3dWC0IQDt7RB3EuY/W p8+exz0tdEPZJcvcyhZlWOf3Q28/abEefiAUwmTF7+KKcyeOgLNe7sZp3bJCRP+Jgqqg N8zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755168684; x=1755773484; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UCFJWq6hVWDLLnb3WEoK3x2DCujP3OgS7K9EwJG0Zgk=; b=pvQDQkuUepTl1Yxfqj39jGuqnkEFWkf3Rzc8bD1H/iyeyiEYhB7Dj9jJMgYJ2pYvn7 /mJ9kC+CeXz7NSGuT3gYwRWqRmckFCDFDcJvo2N0eCEFvtDTrz/EV95kgdpsJej/WGJs 3LamctZj0BUlbgFuqNgixHdmsMWP1qp5GNSfY2SN24qWZqN2CbzLvL9apCtuwghUhOKh SGbNi3rcqG2Rcc1uGnSS528hGW5f8xHPxwVby2ICVtPdH0G5qTSCfjacg5JSUim9+3vJ joVrLlA6OHsnZ0CnRhu9ewS/xxYI3t/c0T4y5nGggjDNQq2JiMdZjQ5Pt0hnpXJOZJVR Yzrw== X-Forwarded-Encrypted: i=1; AJvYcCXFUldyZ/ZvNphYZdmzTotoeLLXeA2yjPSazYUENsn7YXK6i/03D1mVR8NLEueIhPt16qvL5ezLScr1QsY=@vger.kernel.org X-Gm-Message-State: AOJu0YwPUKvnkvhQY1Y59Lk1qsyYrHQJtSPFnW2P6B3RFGL1nWehGgXF JV2Mr/SxRGWiF7xjJhZBifkHSA7k22X+k62Cq+fG7tjFWJLBUrZ1b0DCkqMW3iB3kYE= X-Gm-Gg: ASbGnctJNGfEe26nn44+ZGRzQS0I3FtabAExh061lHnuMmkH/R4NP2Sz9kCQAjyDNAy uvmGmJD8t9ww0dEFSs0S9ikKMt1mklrU1h4ewNsPGwl3VlsgjPFPe9nEX9hSNRPzUE2LlbS0+Ov sBP/iPzbV4ToiOhlpargyjV0mVZMPPoobTJQt5WyXpODpbL1p+J1J7a9I/v6ur7PnRJEBrmA8Fz 8UEGFzLuZC/ePqi57sXhsMuNzRzh+T0vzNGe0Xij8ejdyoZkWAnfph1ec2tNweEOCQnKEtNqf3R PJ2zR8g+bTWog2JF9GQay23Mg9wyifSI8lOLYA+giDXu8DgU73EcIqmOzgZ9SJ25yr2ruj5smw7 XnmJEXxo0W0sr+sP1SMDtOeurEzjOzdo= X-Google-Smtp-Source: AGHT+IH7V3UbaGrUJe9fOSW+9cf1k9RfdPPJpO57OeoAxEN+FtVoytlc5UFLEqj9CTFJZLY7Ywq0nw== X-Received: by 2002:a05:600c:1ca7:b0:456:285b:db24 with SMTP id 5b1f17b1804b1-45a1f8e2320mr1517955e9.28.1755168683865; Thu, 14 Aug 2025 03:51:23 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b226eecsm14228345e9.1.2025.08.14.03.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 03:51:23 -0700 (PDT) From: James Clark Date: Thu, 14 Aug 2025 11:49:55 +0100 Subject: [PATCH v2 4/6] coresight: Refactor etm4_config_timestamp_event() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250814-james-cs-syncfreq-v2-4-c76fcb87696d@linaro.org> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> In-Reply-To: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 Remove some of the magic numbers and try to clarify some of the documentation so it's clearer how this sets up the timestamp interval. Return errors directly instead of jumping to out and returning ret, nothing needs to be cleaned up at the end and it only obscures the flow and return value. Signed-off-by: James Clark Reviewed-by: Leo Yan Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 95 ++++++++++++++----= ---- drivers/hwtracing/coresight/coresight-etm4x.h | 20 +++-- 2 files changed, 77 insertions(+), 38 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index cbea200489c8..1a2d02bdcb88 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -608,18 +608,33 @@ static void etm4_enable_hw_smp_call(void *info) * TRCRSCTLR1 (always true) used to get the counter to decrement. From * there a resource selector is configured with the counter and the * timestamp control register to use the resource selector to trigger the - * event that will insert a timestamp packet in the stream. + * event that will insert a timestamp packet in the stream: + * + * +--------------+ + * | Resource 1 | fixed "always-true" resource + * +--------------+ + * | + * +------v-------+ + * | Counter x | (reload to 1 on underflow) + * +--------------+ + * | + * +------v--------------+ + * | Resource Selector y | (trigger on counter x =3D=3D 0) + * +---------------------+ + * | + * +------v---------------+ + * | Timestamp Generator | (timestamp on resource y) + * +----------------------+ */ static int etm4_config_timestamp_event(struct etmv4_drvdata *drvdata) { - int ctridx, ret =3D -EINVAL; - int counter, rselector; - u32 val =3D 0; + int ctridx; + int rselector; struct etmv4_config *config =3D &drvdata->config; =20 /* No point in trying if we don't have at least one counter */ if (!drvdata->nr_cntr) - goto out; + return -EINVAL; =20 /* Find a counter that hasn't been initialised */ for (ctridx =3D 0; ctridx < drvdata->nr_cntr; ctridx++) @@ -629,15 +644,17 @@ static int etm4_config_timestamp_event(struct etmv4_d= rvdata *drvdata) /* All the counters have been configured already, bail out */ if (ctridx =3D=3D drvdata->nr_cntr) { pr_debug("%s: no available counter found\n", __func__); - ret =3D -ENOSPC; - goto out; + return -ENOSPC; } =20 /* - * Searching for an available resource selector to use, starting at - * '2' since every implementation has at least 2 resource selector. - * ETMIDR4 gives the number of resource selector _pairs_, - * hence multiply by 2. + * Searching for an available resource selector to use, starting at '2' + * since resource 0 is the fixed 'always returns false' resource and 1 + * is the fixed 'always returns true' resource. See IHI0064H_b '7.3.64 + * TRCRSCTLRn, Resource Selection Control Registers, n=3D2-31'. + * + * ETMIDR4 gives the number of resource selector _pairs_, hence multiply + * by 2. */ for (rselector =3D 2; rselector < drvdata->nr_resource * 2; rselector++) if (!config->res_ctrl[rselector]) @@ -646,13 +663,9 @@ static int etm4_config_timestamp_event(struct etmv4_dr= vdata *drvdata) if (rselector =3D=3D drvdata->nr_resource * 2) { pr_debug("%s: no available resource selector found\n", __func__); - ret =3D -ENOSPC; - goto out; + return -ENOSPC; } =20 - /* Remember what counter we used */ - counter =3D 1 << ctridx; - /* * Initialise original and reload counter value to the smallest * possible value in order to get as much precision as we can. @@ -660,26 +673,42 @@ static int etm4_config_timestamp_event(struct etmv4_d= rvdata *drvdata) config->cntr_val[ctridx] =3D 1; config->cntrldvr[ctridx] =3D 1; =20 - /* Set the trace counter control register */ - val =3D 0x1 << 16 | /* Bit 16, reload counter automatically */ - 0x0 << 7 | /* Select single resource selector */ - 0x1; /* Resource selector 1, i.e always true */ - - config->cntr_ctrl[ctridx] =3D val; - - val =3D 0x2 << 16 | /* Group 0b0010 - Counter and sequencers */ - counter << 0; /* Counter to use */ - - config->res_ctrl[rselector] =3D val; + /* + * Trace Counter Control Register TRCCNTCTLRn + * + * CNTCHAIN =3D 0, don't reload on the previous counter + * RLDSELF =3D true, reload counter automatically on underflow + * RLDTYPE =3D 0, one reload input resource + * RLDSEL =3D 0, reload on resource 0 (fixed always false resource, never + * reload) + * CNTTYPE =3D 0, one count input resource + * CNTSEL =3D 1, count on resource 1 (fixed always true resource, always + * decrement) + */ + config->cntr_ctrl[ctridx] =3D TRCCNTCTLRn_RLDSELF | + FIELD_PREP(TRCCNTCTLRn_CNTSEL_MASK, 1); =20 - val =3D 0x0 << 7 | /* Select single resource selector */ - rselector; /* Resource selector */ + /* + * Resource Selection Control Register TRCRSCTLRn + * + * PAIRINV =3D 0, INV =3D 0, don't invert + * GROUP =3D 2, SELECT =3D ctridx, trigger when counter 'ctridx' reaches 0 + * + * Multiple counters can be selected, and each bit signifies a counter, + * so set bit 'ctridx' to select our counter. + */ + config->res_ctrl[rselector] =3D FIELD_PREP(TRCRSCTLRn_GROUP_MASK, 2) | + FIELD_PREP(TRCRSCTLRn_SELECT_MASK, 1 << ctridx); =20 - config->ts_ctrl =3D val; + /* + * Global Timestamp Control Register TRCTSCTLR + * + * TYPE =3D 0, one input resource + * SEL =3D rselector, generate timestamp on resource 'rselector' + */ + config->ts_ctrl =3D FIELD_PREP(TRCTSCTLR_SEL_MASK, rselector); =20 - ret =3D 0; -out: - return ret; + return 0; } =20 static int etm4_parse_event_config(struct coresight_device *csdev, diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 1c67b263b01b..aaa6633b2d67 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -224,6 +224,16 @@ #define TRCRSCTLRn_GROUP_MASK GENMASK(19, 16) #define TRCRSCTLRn_SELECT_MASK GENMASK(15, 0) =20 +#define TRCCNTCTLRn_CNTCHAIN BIT(17) +#define TRCCNTCTLRn_RLDSELF BIT(16) +#define TRCCNTCTLRn_RLDTYPE BIT(15) +#define TRCCNTCTLRn_RLDSEL_MASK GENMASK(12, 8) +#define TRCCNTCTLRn_CNTTYPE_MASK BIT(7) +#define TRCCNTCTLRn_CNTSEL_MASK GENMASK(4, 0) + +#define TRCTSCTLR_TYPE BIT(7) +#define TRCTSCTLR_SEL_MASK GENMASK(4, 0) + /* * System instructions to access ETM registers. * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions @@ -823,7 +833,7 @@ struct etmv4_config { u32 eventctrl0; u32 eventctrl1; u32 stall_ctrl; - u32 ts_ctrl; + u32 ts_ctrl; /* TRCTSCTLR */ u32 ccctlr; u32 bb_ctrl; u32 vinst_ctrl; @@ -843,11 +853,11 @@ struct etmv4_config { u32 seq_rst; u32 seq_state; =20 - u32 cntrldvr[ETMv4_MAX_CNTR]; - u32 cntr_ctrl[ETMv4_MAX_CNTR]; - u32 cntr_val[ETMv4_MAX_CNTR]; + u32 cntrldvr[ETMv4_MAX_CNTR]; /* TRCCNTRLDVRn */ + u32 cntr_ctrl[ETMv4_MAX_CNTR]; /* TRCCNTCTLRn */ + u32 cntr_val[ETMv4_MAX_CNTR]; /* TRCCNTVRn */ =20 - u32 res_ctrl[ETM_MAX_RES_SEL]; + u32 res_ctrl[ETM_MAX_RES_SEL]; /* TRCRSCTLRn */ =20 u32 ss_ctrl[ETM_MAX_SS_CMP]; u32 ss_status[ETM_MAX_SS_CMP]; --=20 2.34.1 From nobody Sat Oct 4 15:55:17 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 DB2AD2FC899 for ; Thu, 14 Aug 2025 10:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168688; cv=none; b=lru5zg8EPMlRQya8jpIfEiP/8v9a7OyDHnPsjBpBJQZboFIUZzebgifyQBUtVNdxAGsv+vU8FOnTtaCAn0LDmDPfA48GZ+xTmfcCm/JTAoV7lALi3hHzLgWbL6CuHokmPc3WyCPUfVppSwlqKqyFqJlH//WY0fTquPEsXwbkxcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168688; c=relaxed/simple; bh=AGQlaXNKIOkbmOaAcaSIjJPEbPTH5PtLNFnrZRHqrcY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Soq87knj55H3tkHcZwhhBDcZ+YeX8rqBlZ/0W9VBdJqY/f6/+erJTWXflriw0VEQEVt47xx9rGAjoST/llNTrDSuClRIUA5lP/Dp+Wbk4LDd+cj6GgMDIUejOz5jNsM6s/to9BXyFoNx0Mmaptk/7tNy+TBgVkxAlHKUYRQnivk= 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=MtR1aJML; arc=none smtp.client-ip=209.85.128.45 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="MtR1aJML" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-45a1b04f8b5so3886705e9.1 for ; Thu, 14 Aug 2025 03:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755168685; x=1755773485; 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=DqVfHeCT5TjsbIyweENQ6jJYwaBKt/ltAWn8RP0BaME=; b=MtR1aJMLDT2aMOioG7HIj3p7HNe/kS1RhEcX4Enh7cHN8bkZH+ysKyqdfnxsj37wD6 W6+ghVaClwSiRTiPGo2wxlTvGGD6Z+C4ykKHByJWwAkPqVIreW8av4HcOWPHBbrNqJT2 7TLowg17h//JhDXOEYyONws74RJzRjVjfKJETnhpUYshWGdYDyIevRE/O2FAsadRTtxJ OFsBWcoDu67QF4RocLvbCN5MX4Wdotg39M+8vr1R449b1MnYdDI3JsBl04192EpmJTfO sSfqPKuoul96TVrDu/awZZsgepD8gKxeDrJyVM0h8wOJNPB6EnR+kFptkffR3T1ZdUez 3sIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755168685; x=1755773485; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DqVfHeCT5TjsbIyweENQ6jJYwaBKt/ltAWn8RP0BaME=; b=s8M7aiaYUAmawPlGdmI0o1pGTf3S9qMvKJ5yU3/U3ARvv8y1r4fk9GutQMLcDpaow8 wzXQjQl5tUalmnj9lxthPInSegP/AoayA4mY21fqqIQK0mrLdaSKeGeCrSDrDN6l4r0j 2CryCOddGrwSuanfw2cxb+2me/cNb0zosKMfblSeu4iv9Rmzg2pJNGr6Mg9ZORT27jJV 4LgHb4c05C16XICEnORBiO2s6DpOLsp33E7ahPHRlBxXd5Eh5OsmzBJmw913PnwyiIn0 TAySBxj8wK7BObv6dmQZnOeVZXdA0iLvNgQ6X4miAL/U/9CElmnHULodYrzanrJrHmlH HTMQ== X-Forwarded-Encrypted: i=1; AJvYcCUGvJKJQb5vMej85JWFyfCG2QXn3j5xOh344tdntXXjMM1YGBXWjQoFHLypZr3ihYuGMkirwFaKd+4rQ6c=@vger.kernel.org X-Gm-Message-State: AOJu0YyY2aUBcxe9bhZZ9MG2ix7+GvFcKCqQHoR01HvXGnxPVBqiZ5G2 4Q7hWvvgsBzoGwsg4vAatoNyvF/2IbPK5ojrJq4YhtgPRLeEppMjpYktT+sZMECgkhI= X-Gm-Gg: ASbGncsF8dyaiIB5XO5yLLI/frJekBhujlvQFCHbz36WQrj/3vP129D26+gBdhxJzSU xkWYYtdsFnc3tGPCfefLW2bxgSTsJFPgHnfHAB+4VadWOHc7Vq5tupYb/YY0tbI/hSX3O548m+W yEcMfEloHjXUjOWodY4fVCbBhgi60ltGMwPrkYtNvvhf37tSasTAqpjJdVAdle7rlFpOn4ma3vn x7IyYvzE8ifSXYAJyLqtDh9qgsTWcYfIXFo/11r7Gm0VHGY43p5K5267BQ7ZR/llYDwtu8G9vRm JXZW1zb7lXKlz2SNK7pxwReGrTQmPMx73NWve7LmZerANhSZ1V47vi3JOeUejGLQlYHeqlMRIT0 URCXGdZCQYEq4Y7t/38GDZoc8P/yOsE3mUmqPiaIxXw== X-Google-Smtp-Source: AGHT+IHDChGA1M3koaJTPEReHQ1naKvyBQUGZKbVCxvANx+2eQKbWPeXZwN0lTI5x4qlNeP7iC6e4w== X-Received: by 2002:a05:600c:35ca:b0:459:dc99:51bf with SMTP id 5b1f17b1804b1-45a1b656c57mr17079495e9.25.1755168684997; Thu, 14 Aug 2025 03:51:24 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b226eecsm14228345e9.1.2025.08.14.03.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 03:51:24 -0700 (PDT) From: James Clark Date: Thu, 14 Aug 2025 11:49:56 +0100 Subject: [PATCH v2 5/6] coresight: Add format attribute for setting the timestamp interval Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250814-james-cs-syncfreq-v2-5-c76fcb87696d@linaro.org> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> In-Reply-To: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 Timestamps are currently emitted at the maximum rate possible, which is much too frequent for most use cases. Add an attribute to be able to set the interval. Granular control is not required, so save space in the config by interpreting it as 2 ^ ts_interval. And then 4 bits (0 - 15) is enough to set the interval to be larger than the existing SYNC timestamp interval. No sysfs file is needed for this attribute because counter generated timestamps are only configured for Perf mode. Only show this attribute for ETM4x because timestamps aren't configured in the same way for ETM3x. The attribute is only ever read in coresight-etm4x-core.c. Signed-off-by: James Clark Reviewed-by: Leo Yan Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm-perf.c | 13 ++++++++++++- drivers/hwtracing/coresight/coresight-etm4x-core.c | 21 ++++++++++++------= --- drivers/hwtracing/coresight/coresight-etm4x.h | 6 ++++++ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index f677c08233ba..af937bbb933c 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -25,6 +25,11 @@ #include "coresight-syscfg.h" #include "coresight-trace-id.h" =20 +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) +#include +#include "coresight-etm4x.h" +#endif + static struct pmu etm_pmu; static bool etm_perf_up; =20 @@ -69,7 +74,10 @@ PMU_FORMAT_ATTR(sinkid, "config2:0-31"); /* config ID - set if a system configuration is selected */ PMU_FORMAT_ATTR(configid, "config2:32-63"); PMU_FORMAT_ATTR(cc_threshold, "config3:0-11"); - +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) +/* Interval =3D (2 ^ ts_level) */ +GEN_PMU_FORMAT_ATTR(ts_level); +#endif =20 /* * contextid always traces the "PID". The PID is in CONTEXTIDR_EL1 @@ -103,6 +111,9 @@ static struct attribute *etm_config_formats_attr[] =3D { &format_attr_configid.attr, &format_attr_branch_broadcast.attr, &format_attr_cc_threshold.attr, +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) + &format_attr_ts_level.attr, +#endif NULL, }; =20 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index 1a2d02bdcb88..42277c201d4f 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -615,7 +616,7 @@ static void etm4_enable_hw_smp_call(void *info) * +--------------+ * | * +------v-------+ - * | Counter x | (reload to 1 on underflow) + * | Counter x | (reload to 2 ^ ts_level on underflow) * +--------------+ * | * +------v--------------+ @@ -626,11 +627,17 @@ static void etm4_enable_hw_smp_call(void *info) * | Timestamp Generator | (timestamp on resource y) * +----------------------+ */ -static int etm4_config_timestamp_event(struct etmv4_drvdata *drvdata) +static int etm4_config_timestamp_event(struct etmv4_drvdata *drvdata, + struct perf_event_attr *attr) { int ctridx; int rselector; struct etmv4_config *config =3D &drvdata->config; + u8 ts_level =3D ATTR_CFG_GET_FLD(attr, ts_level); + + /* Disable when ts_level =3D=3D MAX */ + if (ts_level =3D=3D FIELD_GET(ATTR_CFG_FLD_ts_level_MASK, UINT_MAX)) + return 0; =20 /* No point in trying if we don't have at least one counter */ if (!drvdata->nr_cntr) @@ -666,12 +673,8 @@ static int etm4_config_timestamp_event(struct etmv4_dr= vdata *drvdata) return -ENOSPC; } =20 - /* - * Initialise original and reload counter value to the smallest - * possible value in order to get as much precision as we can. - */ - config->cntr_val[ctridx] =3D 1; - config->cntrldvr[ctridx] =3D 1; + /* Initialise original and reload counter value. */ + config->cntr_val[ctridx] =3D config->cntrldvr[ctridx] =3D 1 << ts_level; =20 /* * Trace Counter Control Register TRCCNTCTLRn @@ -761,7 +764,7 @@ static int etm4_parse_event_config(struct coresight_dev= ice *csdev, * order to correlate instructions executed on different CPUs * (CPU-wide trace scenarios). */ - ret =3D etm4_config_timestamp_event(drvdata); + ret =3D etm4_config_timestamp_event(drvdata, attr); =20 /* * No need to go further if timestamp intervals can't diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index aaa6633b2d67..54558de158fa 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -598,6 +598,12 @@ #define ETM_CNTR_MAX_VAL 0xFFFF #define ETM_TRACEID_MASK 0x3f =20 +#define ATTR_CFG_FLD_ts_level_CFG config3 +#define ATTR_CFG_FLD_ts_level_LO 12 +#define ATTR_CFG_FLD_ts_level_HI 15 +#define ATTR_CFG_FLD_ts_level_MASK GENMASK(ATTR_CFG_FLD_ts_level_HI, \ + ATTR_CFG_FLD_ts_level_LO) + /* ETMv4 programming modes */ #define ETM_MODE_EXCLUDE BIT(0) #define ETM_MODE_LOAD BIT(1) --=20 2.34.1 From nobody Sat Oct 4 15:55:17 2025 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 933682FD1B5 for ; Thu, 14 Aug 2025 10:51:27 +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=1755168689; cv=none; b=AZLCoLny6Losej8m5u3ydvZmMIfmW8sAVbIs1X3PavH9VJvyAlcm2Zou5WcosGGGF48KSkXmTAPJ5e0MvIY/B3TlqB8mjqZ8/UM9ka97F8O6FVR5zNqAwns6U25Koz2dH1dKPH5P2/oXoMHV0WRlFC2CzRANZMO6aEwD1ri4SXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755168689; c=relaxed/simple; bh=o8uIpvdm8rS/o+S1mykUYGGLHkWfPhCsX3cg0yw1X58=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rLaNrtRdDfM0J5O5upRNBT66kcJGoqOtd+9WbuZV8W13TvOATk2MNcYwL5cnZkDJdvL+9G7AmeQMgElIHKhvZjs6QxfB16UW5SPaD5oJ5ex46LvPkV7uFffGvyvyP6HHJtdRN3kmOTSybKfFeZotXaB2DuMsN3F0dxBpEJ4hg10= 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=zBdbMAJs; 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="zBdbMAJs" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-45a1b0d224dso3986105e9.3 for ; Thu, 14 Aug 2025 03:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755168686; x=1755773486; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=S28JNZPWK+3sAmARH83rSsyGla0uTsZRncPjJTp9toA=; b=zBdbMAJs9CCm85BjdAfc74UUMg1aS1BRv72lP5XEfJ2MdK4TkcC6mninks4lzA4ZnF ScPR4mxDiXyAJuGHSfi57AZjJl4HHdBeENXsNnwYNIZQumInYrjWtxDZIq5SmkWLpvFw TVnZV+IC3ZbrYnj6tTvTjB5wq+5WgM93J2OctEMrQX2nWiKRqZzlJGpmjCwS+82mKNLA i177iYLDLG3Y+/WRIkKd6B/Ub+sa482ghzzGM80S5bCFyvXx1YOvNoLunk08eK7hEiK3 JsoUcak5mPGDMx/cuGqbUmokmuMQUAfFX4dyW5VZI3rMvE8evkcsbAwjZFQTGiV6pfkK 9GeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755168686; x=1755773486; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S28JNZPWK+3sAmARH83rSsyGla0uTsZRncPjJTp9toA=; b=lHyn2bb35l59/2JLYaAWKqCSggbc3opz+rBebwi91GzfzQ47KMI1Fh9Qvx7jaU/dbX j8pVkbvc+DhWAj9ZquRgUUzAQ+57Qfqz6LXwxzpRgpVaJSFo69AQIh26zCeapqfDazgj jB83FCoagEqw3i4DuUG0U4KGbwgrlX+h1maOSSTeYgu+VdyTih4sOFn+jZy4ePy6t5A0 JRXLfcg2vJ3a6YdjF1DT4wrf5XmfOmKNpCn1L6tFND62TrLpGuWARdxn0GENtxtvYUtR 5N1tbRqJItyOIcKkfobsPu+Zc9J30nRUU599WL3LHeHTNg8GbL3Li0uBDGJv+cEAI+dJ Zlag== X-Forwarded-Encrypted: i=1; AJvYcCVsY2/0X5B5C4tsR2+ko8XEVjhDQmjQFeI5MDx8K0GnZIbpAqKBC4s949T3+zB72JxF3tAPCTmK3bgWXVg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz15IM7Mhsdfknb5Wh+OPLIT2ztThznD8Dy7BA4IB25ff6zy3JN L2bJE5PJfpeY1I0IPtYtILkCLg5Rm/aBMO+zsDqjuKpN0vfOC8F+619UCLBo67AnpAQ= X-Gm-Gg: ASbGnctG/izBn12vAUhj2nqUz8mHdJ1+mo9jt3ibhlnpyP6alC15AKme+QpuLH07v4i cjs99yW3dsQ/BRfjasRklL99yev9KmmU1Z9g+/WiklwpYrCZRr79k/BZkjElzb4ayt/Q4VzTCgn spQp/b6w7vR5tJJlP2qd83YBsrDT3R6sUllyjAvUEXEcRHZGc+HrzlEPKTRy/vMOKB2k3AUnDxD QrqUgBz+gQRJERT9nHzhkEvTeUHi2eTMW/BVs/e9SkrcZuGPLvzubmJIHfSRZXQe+sAUVQa9UPZ BNgqQnJaG/X4G/egBfZCkhiXJSVWaUbMsvLIqxrp0MYLNj6ls2gxTLr5KP1282nyvblUxQMkv00 2haYAHJ9cgr4UP5Jy7LYgHjr3K9mABic= X-Google-Smtp-Source: AGHT+IF68KOqRUAOMHDKBpVY9t7uVgR8MmpK7ImpWi3/zcrlNC+5/ptZ2W1zXkHPP+sNnqPRzwGUWw== X-Received: by 2002:a05:600c:4708:b0:459:e025:8c5b with SMTP id 5b1f17b1804b1-45a1b674677mr23813915e9.30.1755168685858; Thu, 14 Aug 2025 03:51:25 -0700 (PDT) Received: from ho-tower-lan.lan ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b226eecsm14228345e9.1.2025.08.14.03.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 03:51:25 -0700 (PDT) From: James Clark Date: Thu, 14 Aug 2025 11:49:57 +0100 Subject: [PATCH v2 6/6] coresight: docs: Document etm4x ts_interval Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250814-james-cs-syncfreq-v2-6-c76fcb87696d@linaro.org> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> In-Reply-To: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@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 Tested-by: Leo Yan --- Documentation/trace/coresight/coresight.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/tr= ace/coresight/coresight.rst index 806699871b80..0cd83119b83f 100644 --- a/Documentation/trace/coresight/coresight.rst +++ b/Documentation/trace/coresight/coresight.rst @@ -619,6 +619,20 @@ They are also listed in the folder /sys/bus/event_sour= ce/devices/cs_etm/format/ - Cycle count threshold value. If nothing is provided here or the pro= vided value is 0, then the default value i.e 0x100 will be used. If provided value is less tha= n minimum cycles threshold value, as indicated via TRCIDR3.CCITMIN, then the minimum value wil= l be used instead. + * - ts_level + - Controls frequency of timestamps. The reload value of the + timestamp counter is 2 raised to the power of this value. If the va= lue is + 0 then the reload value is 1, if the value is 10 then the reload va= lue is + 1024. Maximum allowed value is 15, and setting the maximum disables + generation of timestamps via the counter, freeing the counter resou= rces. + Timestamps will be generated after 2 ^ ts_level cycles. + + Separately to this value, timestamps will also be emitted when a SY= NC + packet is generated, although this is only for every 4096 bytes of = trace. + Therefore it's not possible to generate timestamps less frequently = than + that and ts_level timestamps are always in addition to SYNC timesta= mps. + Timestamps must be enabled for this to have effect. + =20 How to use the STM module ------------------------- --=20 2.34.1