FROMLIST: Output debug information from RSC - #1645
Merged
maulik-k-shah merged 3 commits intoAug 6, 2026
Merged
Conversation
RPMh resource addresses encode the accelerator type (ARC, VRM, BCM) in bits [19:16], matching the cmd_db_hw_type enum values. Add cmd_db_hw_type_str() to map an RPMh address to its accelerator type name string using the existing SLAVE_ID() macro, and export it so drivers that handle raw RPMh addresses can produce human-readable diagnostic output without duplicating the address encoding knowledge. Link: https://lore.kernel.org/linux-arm-msm/20260717-rpmh-timeout-debug-v1-v2-1-81ade4fcdb49@oss.qualcomm.com/ Assisted-by: Claude:claude-sonnet-4-5 Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
RPMh resource addresses are opaque 32-bit values. While the slave ID in bits [19:16] identifies the accelerator type (ARC/VRM/BCM), the lower bits encode a resource index that is only meaningful when mapped back to the human-readable resource name stored in the command DB (e.g. 0x30000 -> cx.lvl). Add cmd_db_read_name() to perform this reverse lookup by iterating the command DB entries and matching on address. Unlike other exported cmd-db APIs which go through cmd_db_get_header() (which calls cmd_db_ready() internally), this function iterates cmd_db_header directly for address matching, so it calls cmd_db_ready() itself. For VRM resources, which have up to 4 contiguous 4-byte-aligned addresses per resource, the match uses VRM_ADDR() on bits [19:4] so that any sub-address (enable, voltage, mode, headroom) resolves to the same resource name. Also export CMD_DB_ID_SIZE so callers can size their name buffers correctly without open-coding the magic constant 8. Link: https://lore.kernel.org/linux-arm-msm/20260717-rpmh-timeout-debug-v1-v2-2-81ade4fcdb49@oss.qualcomm.com/ Assisted-by: Claude:claude-sonnet-4-5 Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
When an RPMh transfer times out there is no visibility into which TCS was stuck, what commands it was carrying, or whether the completion IRQ was pending at the GIC. Add rpmh_rsc_debug() to capture this state at timeout: - Iterates all in-use TCSes and dumps per-TCS control register state (controller status, AMC mode, IRQ status) and per-command register state (address, data, message ID, completion status). The accelerator type (ARC/VRM/BCM) is decoded from the address using cmd_db_hw_type_str(). - Queries the GIC pending state for the RSC IRQ via irq_get_irqchip_state() to distinguish two failure modes: * AOSS firmware did not respond (IRQ never fired) * Linux lockup (IRQ pending at GIC but handler never ran) - Reports the completion object state to cross-check with the IRQ status. Store the IRQ number in struct rsc_drv to enable the GIC query. Link: https://lore.kernel.org/linux-arm-msm/20260717-rpmh-timeout-debug-v1-v2-3-81ade4fcdb49@oss.qualcomm.com/ Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org> Co-developed-by: Maulik Shah <maulik.shah@oss.qualcomm.com> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
qcomlnxci
requested review from
a team and
smankad-oss
and removed request for
a team
August 6, 2026 04:23
smankad-oss
approved these changes
Aug 6, 2026
maulik-k-shah
merged commit Aug 6, 2026
f712532
into
qualcomm-linux:tech/pm/power
7 of 9 checks passed
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.
Add https://lore.kernel.org/linux-arm-msm/20260717-rpmh-timeout-debug-v1-v2-0-81ade4fcdb49@oss.qualcomm.com/
RPMh transfer timeouts are hard to debug — the only indication today
is a WARN_ON() with no record of which TCS was stuck, what resource
it was voting for, or whether AOSS firmware or completion IRQ handling
delay caused the hang.
This series adds structured diagnostics that fire at timeout.
When a timeout occurs today, the only kernel output is a bare warning:
WARNING: drivers/soc/qcom/rpmh.c:386 rpmh_write_batch+0x190/0x2b0
Workqueue: events_unbound deferred_probe_work_func
Call trace:
rpmh_write_batch+0x190/0x2b0 (P)
qcom_icc_bcm_voter_commit+0x33c/0x500
qcom_icc_set+0x20/0x34
icc_node_add+0xf8/0x118
qcom_icc_rpmh_probe+0x194/0x540
platform_probe+0x5c/0xa4
This gives no indication of which TCS was stuck, what resource it was
voting for, or whether AOSS firmware or Linux itself caused the hang.
Patch 1 adds cmd_db_hw_type_str() to cmd-db to decode the accelerator
type (ARC/VRM/BCM) from an RPMh resource address using the existing
SLAVE_ID() encoding. This lives in cmd-db because SLAVE_ID() is a
private macro there and the address encoding is cmd-db's domain.
Patch 2 adds cmd_db_read_name() to cmd-db to reverse-look up the
human-readable resource name (e.g. cx.lvl) from an RPMh address. For
VRM resources, which have up to 4 contiguous addresses per resource,
the match uses VRM_ADDR() on bits [19:4] so any sub-address resolves
to the same name.
Patch 3 adds rpmh_rsc_debug() to rpmh-rsc.c and wires it into both
rpmh_write() and rpmh_write_batch() timeout paths. Per-command output
now shows the accelerator type, resource name, whether the command
requires a response, and the decoded TCS command status bits sourced
from the CMD_STATUS_{TRIGGERED,ISSUED,COMPL} definitions:
addr=0x30000(ARC/cx.lvl) resp-required sts=triggered+sent-to-aoss+resp-received.
CRs-fixed: 4635299