Skip to content

Commit a4e6584

Browse files
james-c-linaroSuzuki K Poulose
authored andcommitted
coresight: Only check bottom two claim bits
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 <[email protected]> Reviewed-by: Yeoreum Yun <[email protected]> Signed-off-by: James Clark <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fc7fed6 commit a4e6584

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/hwtracing/coresight/coresight-core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ coresight_find_out_connection(struct coresight_device *csdev,
131131

132132
static inline u32 coresight_read_claim_tags_unlocked(struct coresight_device *csdev)
133133
{
134-
return csdev_access_relaxed_read32(&csdev->access, CORESIGHT_CLAIMCLR);
134+
return FIELD_GET(CORESIGHT_CLAIM_MASK,
135+
csdev_access_relaxed_read32(&csdev->access, CORESIGHT_CLAIMCLR));
135136
}
136137

137138
static inline bool coresight_is_claimed_self_hosted(struct coresight_device *csdev)

drivers/hwtracing/coresight/coresight-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ extern const struct device_type coresight_dev_type[];
3535
* Coresight device CLAIM protocol.
3636
* See PSCI - ARM DEN 0022D, Section: 6.8.1 Debug and Trace save and restore.
3737
*/
38+
#define CORESIGHT_CLAIM_MASK GENMASK(1, 0)
3839
#define CORESIGHT_CLAIM_SELF_HOSTED BIT(1)
3940

4041
#define TIMEOUT_US 100

0 commit comments

Comments
 (0)