From 466924d26830ebd56cb331c7b80a69b8277e1dab Mon Sep 17 00:00:00 2001 From: Deepak Kumar Singh Date: Fri, 18 Oct 2019 15:23:31 +0530 Subject: [PATCH] rpmsg: glink: reset read/write index after ssr While system is going down fifo index are not reset which can cause remote subsystem to read stale index. Now resetting the index while system is going down. CRs-Fixed: 2543040 Change-Id: Icb4010c120f4735da206a44a4eb1bcf06ae0a1b7 Signed-off-by: Deepak Kumar Singh --- drivers/rpmsg/qcom_glink_smem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c index 8da9ace1b8a5..3903f3ab2f90 100644 --- a/drivers/rpmsg/qcom_glink_smem.c +++ b/drivers/rpmsg/qcom_glink_smem.c @@ -46,6 +46,12 @@ struct glink_smem_pipe { #define to_smem_pipe(p) container_of(p, struct glink_smem_pipe, native) +static void glink_smem_rx_reset(struct qcom_glink_pipe *np) +{ + struct glink_smem_pipe *pipe = to_smem_pipe(np); + *pipe->tail = 0; +} + static size_t glink_smem_rx_avail(struct qcom_glink_pipe *np) { struct glink_smem_pipe *pipe = to_smem_pipe(np); @@ -120,6 +126,12 @@ static void glink_smem_rx_advance(struct qcom_glink_pipe *np, *pipe->tail = cpu_to_le32(tail); } +static void glink_smem_tx_reset(struct qcom_glink_pipe *np) +{ + struct glink_smem_pipe *pipe = to_smem_pipe(np); + *pipe->head = 0; +} + static size_t glink_smem_tx_avail(struct qcom_glink_pipe *np) { struct glink_smem_pipe *pipe = to_smem_pipe(np); @@ -279,11 +291,13 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, goto err_put_dev; } + rx_pipe->native.reset = glink_smem_rx_reset; rx_pipe->native.avail = glink_smem_rx_avail; rx_pipe->native.peak = glink_smem_rx_peak; rx_pipe->native.advance = glink_smem_rx_advance; rx_pipe->remote_pid = remote_pid; + tx_pipe->native.reset = glink_smem_tx_reset; tx_pipe->native.avail = glink_smem_tx_avail; tx_pipe->native.write = glink_smem_tx_write; tx_pipe->remote_pid = remote_pid;