From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B8202EAB95; Thu, 3 Jul 2025 14:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751554695; cv=none; b=T4MlFF/W1SVX9m1opmiJc5iroRSlgnNsEpIzDW2M+GCaxiAJIYamyRrVIiui/iF6D3wIlbJEmR6jFXLUh68H+/oydWSHzC9RuMQcX76n6Tro5NKKSGCe0dGkEvvJkv6/anGriAUTVH6t/5iSNdseMwHmJYU7o7IR6r1j8VrEDF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751554695; c=relaxed/simple; bh=hVetxFNP/Iz4tzDRudbYJwmH4XBbls6pKRdlLzVRO5w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CO6a5d3Epo7bbklYeFUxGJWjAJLBUhV1kPT7xI9l2ysKI/oO8BSXfzDDHi4tnI/8vI+gZ7XZzBNkKzw9H4EnpVUjJQu4RZxioELAyojTrPhZPLHuhK3/rfZT7+yFxuQsVnrO812kiCDhGf7k7J/xumu8/qT76m3UuZCpOk70Juw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=07dsLncW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="07dsLncW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D54BC4CEED; Thu, 3 Jul 2025 14:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751554695; bh=hVetxFNP/Iz4tzDRudbYJwmH4XBbls6pKRdlLzVRO5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=07dsLncWXUGKWV6OV+3nFCP9/qbFeloobB9+5dvBHSDxpsD7/kZXc+iVP7jKkqSpX s0mFSFbvlLsWgETY9sGFjQ3lC/0TtW9+HL5blIDNHK5HgEO0aVVS7mnxL/9viQKIRJ F/ZLfm2FLtnUzB20gEvayB3atO0HHypGtREP6Df8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Leo Yan , Yeoreum Yun , James Clark , Suzuki K Poulose , Sasha Levin Subject: [PATCH 6.15 049/263] coresight: Only check bottom two claim bits Date: Thu, 3 Jul 2025 16:39:29 +0200 Message-ID: <20250703144006.271992001@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703144004.276210867@linuxfoundation.org> References: <20250703144004.276210867@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Clark [ Upstream commit a4e65842e1142aa18ef36113fbd81d614eaefe5a ] The use of the whole register and == could break the claim mechanism if any of the other bits are used in the future. The referenced doc "PSCI - ARM DEN 0022D" also says to only read and clear the bottom two bits. Use FIELD_GET() to extract only the relevant part. Reviewed-by: Leo Yan Reviewed-by: Yeoreum Yun Signed-off-by: James Clark Signed-off-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20250325-james-coresight-claim-tags-v4-2-dfbd3822b2e5@linaro.org Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-core.c | 3 ++- drivers/hwtracing/coresight/coresight-priv.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index d3523f0262af8..dfcb30da2e20b 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -131,7 +131,8 @@ coresight_find_out_connection(struct coresight_device *csdev, static inline u32 coresight_read_claim_tags(struct coresight_device *csdev) { - return csdev_access_relaxed_read32(&csdev->access, CORESIGHT_CLAIMCLR); + return FIELD_GET(CORESIGHT_CLAIM_MASK, + csdev_access_relaxed_read32(&csdev->access, CORESIGHT_CLAIMCLR)); } static inline bool coresight_is_claimed_self_hosted(struct coresight_device *csdev) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 82644aff8d2b7..38bb4e8b50ef6 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -35,6 +35,7 @@ extern const struct device_type coresight_dev_type[]; * Coresight device CLAIM protocol. * See PSCI - ARM DEN 0022D, Section: 6.8.1 Debug and Trace save and restore. */ +#define CORESIGHT_CLAIM_MASK GENMASK(1, 0) #define CORESIGHT_CLAIM_SELF_HOSTED BIT(1) #define TIMEOUT_US 100 -- 2.39.5