From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E1B4CA5FDD for ; Fri, 2 Oct 2026 19:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nKznQVmbpitWreTp2e5YYfGgiNUZz6meafcsoh3XCZc=; b=vw4harq7FDp/qye3+SaVUGAaNo oHbMAhRxbsePwjN18rsijbOnx1rSuIiN1pTh8Y4V5SoynqHaspEIwneBb1opG+nsV7Sonj9Ml+Ixj gu0Hw9vmFb11orQNrrwa07yMnp3RlXsEkcoVKf4PzDgxr3FD96M2m0dpkAX35oqwtkM+0/JgIXRjG 4Gn6q7rkumkD/WiZzYBLS3iqRYvPiyFHhoxPEBxDfsSPkxJ4JdAiI64O+GUpC97ZqWK1iwTntmbdb O3PoEm2P0RKv0xiBbYGfZA6AQFpBrCRL3ybI3D7rdQk1WxIf+XPKy/CttRr6m22D9vFxkbPlqkeeB Tthgmirw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCiXn-0000000CLiK-2Mid; Fri, 02 Oct 2026 19:03:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCiXk-0000000CLgC-15tY for linux-arm-kernel@lists.infradead.org; Fri, 02 Oct 2026 19:03:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2522F143D; Fri, 2 Oct 2026 12:03:36 -0700 (PDT) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 85A4E3F85F; Fri, 2 Oct 2026 12:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790967819; bh=/LTIVchcSYeV2GdWMsw9q/5+SrFXYHpc2drQmo5k3iU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aT0sNsfviVxPNATmbhcyBxXAOVAx3R9gnCgUfw66GVkFS4ppj8V7k0S8+8hhcKOOf dTL5OLCcj0b4IHf+9RyUdpq+NME1uqatlyS03awqxcA0R7aQ+gnZcXmYGFRKcAn5dW sN4h0gTq3BLABYdUbSF2pVhorYx+7FKOrW7w9sbs= From: Yeoreum Yun Date: Fri, 02 Oct 2026 20:03:22 +0100 Subject: [PATCH v13 01/14] coresight: etm4x: read-back TRCSEQSTR at disabling and prohibit modifying seq_state while enabling. MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261002-separate_etm_cfg_v2-v13-1-fe429d8d96fb@arm.com> References: <20261002-separate_etm_cfg_v2-v13-0-fe429d8d96fb@arm.com> In-Reply-To: <20261002-separate_etm_cfg_v2-v13-0-fe429d8d96fb@arm.com> To: Mike Leach , James Clark , Leo Yan , Greg Kroah-Hartman , Mathieu Poirier , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev Cc: Suzuki K Poulose , Alexander Shishkin , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Yeoreum Yun X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1970; i=yeoreum.yun@arm.com; h=from:subject:message-id; bh=/LTIVchcSYeV2GdWMsw9q/5+SrFXYHpc2drQmo5k3iU=; b=owEB7QES/pANAwAKAW3Vw9FaxTEzAcsmYgBqv///9VUKc6rivLVuGZ3pF7zctdNW30JEAt83a TTuwEFcbiqJAbMEAAEKAB0WIQQtg+CS3QUzuFh1pJ1t1cPRWsUxMwUCar///wAKCRBt1cPRWsUx MzSlC/9lcq/dhBMe/2rI3OVtkt/qBuf/DqV6YdDCvTGe3Kb8T1HYlI8y2YhsPFmG4bSCXBEuma4 8D2zgZfmhhO1VAMU22lvoT1UzcyuyeBDY8WJIobZjV/JhBlEM8Cjrs/TA21YPlYdlwPlWDHVz69 PMnPG3umS+5y6U7Ws2b332aJBl9dMKSIbAgu1F+d4u0oqqWw9At+WErwXLag2PRUeHrfM6t5BeY 4jhwCPgEvmBAQth1GV8dWhZEQ8gx87RtToOEqwNpm+aauT/XO6e5iKoC8NaQ+bX9hPTnvbeR+Kx 1RSfhWWyAdbMlT99q921rLzho9EiuB+RVvcEz/s3a1vFaOjVDdH63hcCRMOdJJ++QWg6fC9nT7p LUnaiGFSOA1dtNXsLjFoFSdJbRH5FVz3MiILfMKzJMlyoG0GE6WH1dexnD44tL2AU0T0AWKiQnR VJ3w39OchpZnR/eIKP8MYI9c7bl8FC6Oii7rvzW1d56+A7GPzdjpQ1aV5r37Zpmh5teo4= X-Developer-Key: i=yeoreum.yun@arm.com; a=openpgp; fpr=2D83E092DD0533B85875A49D6DD5C3D15AC53133 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_120340_387905_20A0E68E X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org TRCSEQSTR can be changed by the ETM while a session is active. Its value therefore needs to be preserved when a sysfs session is disabled so that users can read the current sequence state after the session ends. This means that any changes made to TRCSEQSTR while the sysfs-session is active would be lost when the session is disabled. Copy the TRCSEQSTR value when disabling a sysfs session, and prohibit modifying seq_state while the session is active. Suggested-by: Mike Leach Reviewed-by: Mike Leach Signed-off-by: Yeoreum Yun --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 ++++ drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 2247ad55d444..9ca03a5913a3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1073,6 +1073,10 @@ static void etm4_disable_hw(struct etmv4_drvdata *drvdata) etm4x_relaxed_read32(csa, TRCCNTVRn(i)); } + /* read back the sequence state */ + if (drvdata->nrseqstate) + config->seq_state = etm4x_relaxed_read32(csa, TRCSEQSTR); + coresight_disclaim_device_unlocked(csdev); etm4_cs_lock(drvdata, csa); diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index cc6cdd3ae29d..2c72ea831fe6 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -1435,6 +1435,8 @@ static ssize_t seq_state_store(struct device *dev, if (kstrtoul(buf, 16, &val)) return -EINVAL; + if (IS_ERR_OR_NULL(drvdata) || coresight_get_mode(drvdata->csdev)) + return -EBUSY; if (val >= drvdata->nrseqstate) return -EINVAL; -- 2.43.0