Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] soc: qcom: aoss: Read back before triggering the IRQ
@ 2020-01-22  8:24 Arun Kumar Neelakantam
  2020-02-12  6:32 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Arun Kumar Neelakantam @ 2020-01-22  8:24 UTC (permalink / raw)
  To: bjorn.andersson, clew
  Cc: Arun Kumar Neelakantam, Andy Gross, linux-arm-msm, linux-kernel

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(+)

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] soc: qcom: aoss: Read back before triggering the IRQ
  2020-01-22  8:24 [PATCH] soc: qcom: aoss: Read back before triggering the IRQ Arun Kumar Neelakantam
@ 2020-02-12  6:32 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2020-02-12  6:32 UTC (permalink / raw)
  To: Arun Kumar Neelakantam
  Cc: clew, Andy Gross, open list:ARM/QUALCOMM SUPPORT, open list

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22  8:24 [PATCH] soc: qcom: aoss: Read back before triggering the IRQ Arun Kumar Neelakantam
2020-02-12  6:32 ` Bjorn Andersson

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git