msm: gsi: Set cookie correctly for GCI channel TREs
Use the right index based on the cookie for GCI channel
TREs that are using the extra allocated buffers.
Change-Id: I19643223e4e496bf1b976b0bf73bbe3d8a1fe03a
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c
index 0e3fc66..cb51c78 100644
--- a/drivers/platform/msm/gsi/gsi.c
+++ b/drivers/platform/msm/gsi/gsi.c
@@ -3384,8 +3384,18 @@
}
}
- /* TODO: Increase escape buffer size if we hit this */
- GSIERR("user_data is full\n");
+ /* Go over original userdata when escape buffer is full (costly) */
+ GSIDBG("escape buffer is full\n");
+ for (i = 0; i < end; i++) {
+ if (!ctx->user_data[i].valid) {
+ ctx->user_data[i].valid = true;
+ return i;
+ }
+ }
+
+ /* Everything is full (possibly a stall) */
+ GSIERR("both userdata array and escape buffer is full\n");
+ BUG();
return 0xFFFF;
}
@@ -3422,7 +3432,7 @@
/* write the TRE to ring */
*tre_gci_ptr = gci_tre;
- ctx->user_data[idx].p = xfer->xfer_user_data;
+ ctx->user_data[gci_tre.cookie].p = xfer->xfer_user_data;
return 0;
}