soc: qcom: aoss: Read back before triggering the IRQ
diff mbox series

Message ID 1579681454-1229-1-git-send-email-aneela@codeaurora.org
State Accepted
Commit a5fccb62cc8967b40c6f420f0d40a0636b587f74
Headers show
Series
  • soc: qcom: aoss: Read back before triggering the IRQ
Related show

Commit Message

Arun Kumar Neelakantam Jan. 22, 2020, 8:24 a.m. UTC
In some device memory used by msm_qmp, there can be an early ack of a
write to memory succeeding. This may cause the outgoing interrupt to be
triggered before the msgram reflects the write.

Add a readback to ensure the data is flushed to device memory before
triggering the ipc interrupt.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/soc/qcom/qcom_aoss.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bjorn Andersson Feb. 12, 2020, 6:32 a.m. UTC | #1
On Wed 22 Jan 00:24 PST 2020, Arun Kumar Neelakantam wrote:

> In some device memory used by msm_qmp, there can be an early ack of a
> write to memory succeeding. This may cause the outgoing interrupt to be
> triggered before the msgram reflects the write.
> 
> Add a readback to ensure the data is flushed to device memory before
> triggering the ipc interrupt.
> 
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>

Applied

Thanks,
Bjorn

> ---
>  drivers/soc/qcom/qcom_aoss.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
> index fe79661..f43a2e0 100644
> --- a/drivers/soc/qcom/qcom_aoss.c
> +++ b/drivers/soc/qcom/qcom_aoss.c
> @@ -225,6 +225,7 @@ static bool qmp_message_empty(struct qmp *qmp)
>  static int qmp_send(struct qmp *qmp, const void *data, size_t len)
>  {
>  	long time_left;
> +	size_t tlen;
>  	int ret;
>  
>  	if (WARN_ON(len + sizeof(u32) > qmp->size))
> @@ -239,6 +240,9 @@ static int qmp_send(struct qmp *qmp, const void *data, size_t len)
>  	__iowrite32_copy(qmp->msgram + qmp->offset + sizeof(u32),
>  			 data, len / sizeof(u32));
>  	writel(len, qmp->msgram + qmp->offset);
> +
> +	/* Read back len to confirm data written in message RAM */
> +	tlen = readl(qmp->msgram + qmp->offset);
>  	qmp_kick(qmp);
>  
>  	time_left = wait_event_interruptible_timeout(qmp->event,
> -- 
> 1.9.1

Patch
diff mbox series

diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
index fe79661..f43a2e0 100644
--- a/drivers/soc/qcom/qcom_aoss.c
+++ b/drivers/soc/qcom/qcom_aoss.c
@@ -225,6 +225,7 @@  static bool qmp_message_empty(struct qmp *qmp)
 static int qmp_send(struct qmp *qmp, const void *data, size_t len)
 {
 	long time_left;
+	size_t tlen;
 	int ret;
 
 	if (WARN_ON(len + sizeof(u32) > qmp->size))
@@ -239,6 +240,9 @@  static int qmp_send(struct qmp *qmp, const void *data, size_t len)
 	__iowrite32_copy(qmp->msgram + qmp->offset + sizeof(u32),
 			 data, len / sizeof(u32));
 	writel(len, qmp->msgram + qmp->offset);
+
+	/* Read back len to confirm data written in message RAM */
+	tlen = readl(qmp->msgram + qmp->offset);
 	qmp_kick(qmp);
 
 	time_left = wait_event_interruptible_timeout(qmp->event,