Re: [PATCH v2] soc: qcom: rpmh-rsc: Enhance check for VREG in-flight request

From: Bryan O'Donoghue
Date: Fri Jan 19 2024 - 05:34:20 EST


On 19/01/2024 08:26, Maulik Shah wrote:
Each RPMh VREG accelerator resource has 3 or 4 contiguous 4-byte aligned
addresses associated with it. These control voltage, enable state, mode,
and in legacy targets, voltage headroom. The current in-flight request
checking logic looks for exact address matches. Requests for different
addresses of the same RPMh resource as thus not detected as in-flight.

This commit log implies you are fixing a bug.

Can you do some inspection of the git commit log and figure out where to backport this change to ?

Your change would apply to 40482e4f73640d but a quick pass on the logic in check_for_req_inflight() shows its probably _applicable_ to 658628e7ef78e8

/*
* Here's a high level overview of how all the registers in RPMH work
* together:
@@ -557,7 +568,15 @@ static int check_for_req_inflight(struct rsc_drv *drv, struct tcs_group *tcs,
for_each_set_bit(j, &curr_enabled, MAX_CMDS_PER_TCS) {
addr = read_tcs_cmd(drv, drv->regs[RSC_DRV_CMD_ADDR], i, j);
for (k = 0; k < msg->num_cmds; k++) {
- if (addr == msg->cmds[k].addr)
+ /*
+ * Each RPMh VREG accelerator resource has 3 or 4 contiguous 4-byte
+ * aligned addresses associated with it. Ignore the offset to check
+ * for in-flight VREG requests.
+ */
+ if (ACCL_TYPE(msg->cmds[k].addr) == HW_ACCL_VREG &&
+ VREG_ADDR(msg->cmds[k].addr) == VREG_ADDR(addr))
+ return -EBUSY;
+ else if (addr == msg->cmds[k].addr)

Consider removing the /* comment */ if it helps to apply the change earlier than 658628e7ef78e8.

---
bod