Re: [PATCH v2 2/3] soc: qcom: cmd-db: add reverse address-to-name lookup

Navya Malempati <[email protected]>
Newsgroups gmane.linux.ports.arm.msm,gmane.linux.kernel
Message-ID <[email protected]>

On 7/17/2026 1:19 PM, Maulik Shah wrote:
> 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.
> 
> Assisted-by: Claude:claude-sonnet-4-5
> Signed-off-by: Maulik Shah <[email protected]>

Reviewed-by: Navya Malempati <[email protected]>

Thanks,
Navya
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.