]> www.infradead.org Git - users/dwmw2/linux.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)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 30 Apr 2025 13:58:18 +0000 (14:58 +0100)
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
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-priv.h

index 17f931f7e6165c901bce36b925a3cf8ef216fb44..9f183064285dae4277ed41918f0b41a175aa4091 100644 (file)
@@ -131,7 +131,8 @@ coresight_find_out_connection(struct coresight_device *csdev,
 
 static inline u32 coresight_read_claim_tags_unlocked(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 82644aff8d2b78a90100186e79cd9d557fbc7f82..38bb4e8b50ef6b7ea27dc7b9e9428808665b2fb6 100644 (file)
@@ -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