Optimize the Coresight Trace id allocation logic - #1032
Open
Jie Gan (jiegan0107) wants to merge 2 commits into
Open
Optimize the Coresight Trace id allocation logic#1032Jie Gan (jiegan0107) wants to merge 2 commits into
Jie Gan (jiegan0107) wants to merge 2 commits into
Conversation
When coresight_path_assign_trace_id() cannot assign a valid trace ID, coresight_enable_sysfs() takes the err_path goto with ret still 0, returning success to the caller despite no trace session being started. Change coresight_path_assign_trace_id() to return int, moving the IS_VALID_CS_TRACE_ID() check inside it so it returns -EINVAL on failure and 0 on success. Update both callers to propagate this return value directly instead of inspecting path->trace_id after the call. Fixes: d87d76d ("Coresight: Allocate trace ID after building the path") Reviewed-by: James Clark <james.clark@linaro.org> Reviewed-by: Richard Cheng <icheng@nvidia.com> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com> Reviewed-by: Leo Yan <leo.yan@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20260512-fix-trace-id-error-v4-1-eb3de789767a@oss.qualcomm.com
…vices coresight_path_assign_trace_id() only treats a trace_id of 0 as "this device has no ID assignment, keep searching downstream". Pass-through NoC links such as itnoc (qcom,coresight-itnoc) intentionally return -EOPNOTSUPP from their .trace_id callback since they have no ATID register to program, but that negative value falls through to the IS_VALID_CS_TRACE_ID() check and is rejected, aborting the whole path with -EINVAL before the real trace ID owner further downstream is ever reached. This breaks enabling any source whose path traverses an itnoc, e.g. writing 1 to tpdm/enable_source for a TPDM fails with: sh: write error: Invalid argument Skip devices that return -EOPNOTSUPP the same way as devices that return 0, so the search continues to the next device on the path. Fixes: f4526ff ("coresight: fix missing error code when trace ID is invalid") Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com> Link: https://lore.kernel.org/all/20260817-fix-trace-id-assign-issue-v1-1-b2164e33f9fa@oss.qualcomm.com/
Jie Gan (jiegan0107)
requested review from
a team,
Amit Kucheria (idlethread),
jingyiwang42 and
Kaushal Kumar (quic-kaushalk)
August 31, 2026 02:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimize the Coresight Trace id allocation logic
CRs-Fixed: 4661884