]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
coresight: Only check bottom two claim bits
authorJames Clark <james.clark@linaro.org>
Tue, 25 Mar 2025 11:58:47 +0000 (11:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:33 +0000 (15:57 +0200)
[ 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 <leo.yan@arm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250325-james-coresight-claim-tags-v4-2-dfbd3822b2e5@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-priv.h

index 3ea6900542223362d008293b0cd415dfa482c30e..f6989a74fec9400b9f08c4d9912942238227573b 100644 (file)
@@ -161,7 +161,8 @@ static int coresight_find_link_outport(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)
index ff1dd2092ac5bbe9a476637be33099b45922cb36..b416edcdf797d43a40804514860e3d9445692add 100644 (file)
@@ -32,6 +32,7 @@
  * 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