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

From: Maulik Shah (mkshah)
Date: Mon Jan 29 2024 - 01:21:17 EST


Hi,

On 1/28/2024 9:13 AM, Bjorn Andersson wrote:
On Fri, Jan 19, 2024 at 01:56:54PM +0530, Maulik Shah wrote:


Signed-off-by: Maulik Shah <quic_mkshah@xxxxxxxxxxx>
Signed-off-by: Elliot Berman <quic_eberman@xxxxxxxxxxx>

The s-o-b chain doesn't look right.

I will fix in v3.


---
+#define ACCL_TYPE(addr) FIELD_GET(GENMASK(19, 16), addr)

Command DB is there so we don't have to make assumptions about the
addresses of resources. As such, I dislike this define.

sure i will consider querying command db for resource type.


+#define VREG_ADDR(addr) FIELD_GET(GENMASK(19, 4), addr)
+
+enum {
+ HW_ACCL_CLK = 0x3,
+ HW_ACCL_VREG,
+ HW_ACCL_BUS,

We already define these in the kernel, but with different names:
CMD_DB_HW_ARC, CMD_DB_HW_VRM, CMD_DB_HW_BCM. I see no reason to use
different names for the same thing.

+};

Right, I missed it, With querying cmd-db would not need this enum.

+
/*
* 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))

I'm sure this work, at least for some targets, but I don't fancy
encoding this information here. It feels like a hack.

Furthermore, I really would like TP_printk() of trace_rpmh_send_msg() to
be able to resolve the symbolic names for VRMs as well, and it would
need the same information...

I can update in separate patch for trace_() to resolve symbolic names.


Please consider how we can query command db for the type and/or grouping
information.

Sure, i will update in v3 to query command db for the type.

Thanks,
Maulik