mbox series

[0/6] MHI EP fixes and improvements

Message ID 20221228161704.255268-1-manivannan.sadhasivam@linaro.org
Headers show
Series MHI EP fixes and improvements | expand

Message

Manivannan Sadhasivam Dec. 28, 2022, 4:16 p.m. UTC
This series fixes several issues on the MHI EP stack and also improves
the suspend and resume functionality.

Thanks,
Mani

Manivannan Sadhasivam (6):
  bus: mhi: ep: Power up/down MHI stack during MHI RESET
  bus: mhi: ep: Check if the channel is supported by the controller
  bus: mhi: ep: Only send -ENOTCONN status if client driver is available
  bus: mhi: ep: Fix the debug message for MHI_PKT_TYPE_RESET_CHAN_CMD
    cmd
  bus: mhi: ep: Move chan->lock to the start of processing queued ch
    ring
  bus: mhi: ep: Save channel state locally during suspend and resume

 drivers/bus/mhi/ep/main.c | 79 +++++++++++++++++++++------------------
 1 file changed, 42 insertions(+), 37 deletions(-)

Comments

Jeffrey Hugo Jan. 5, 2023, 4:09 a.m. UTC | #1
On 12/28/2022 9:16 AM, Manivannan Sadhasivam wrote:
> During graceful shutdown scenario, host will issue MHI RESET to the
> endpoint device before initiating shutdown. In that case, it makes sense
> to completely power down the MHI stack as sooner or later the access to
> MMIO registers will be prohibited. Also, the stack needs to be powered
> up in the case of SYS_ERR to recover the device.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Jeffrey Hugo Jan. 5, 2023, 4:12 a.m. UTC | #2
On 12/28/2022 9:17 AM, Manivannan Sadhasivam wrote:
> For the STOP and RESET commands, only send the channel disconnect status
> -ENOTCONN if client driver is available. Otherwise, it will result in
> null pointer dereference.
> 
> Cc: <stable@vger.kernel.org> # 5.19
> Fixes: e827569062a8 ("bus: mhi: ep: Add support for processing command rings")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Jeffrey Hugo Jan. 5, 2023, 3:56 p.m. UTC | #3
On 12/28/2022 9:17 AM, Manivannan Sadhasivam wrote:
> There is a good chance that while the channel ring gets processed, the STOP
> or RESET command for the channel might be received from the MHI host. In
> those cases, the entire channel ring processing needs to be protected by
> chan->lock to prevent the race where the corresponding channel ring might
> be reset.
> 
> While at it, let's also add a sanity check to make sure that the ring is
> started before processing it. Because, if the STOP/RESET command gets
> processed while mhi_ep_ch_ring_worker() waited for chan->lock, the ring
> would've been reset.
> 
> Cc: <stable@vger.kernel.org> # 5.19
> Fixes: 03c0bb8ec983 ("bus: mhi: ep: Add support for processing channel rings")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Manivannan Sadhasivam Jan. 23, 2023, 7:23 a.m. UTC | #4
On Wed, Dec 28, 2022 at 09:46:58PM +0530, Manivannan Sadhasivam wrote:
> This series fixes several issues on the MHI EP stack and also improves
> the suspend and resume functionality.
> 

Applied to mhi-next!

Thanks,
Mani

> Thanks,
> Mani
> 
> Manivannan Sadhasivam (6):
>   bus: mhi: ep: Power up/down MHI stack during MHI RESET
>   bus: mhi: ep: Check if the channel is supported by the controller
>   bus: mhi: ep: Only send -ENOTCONN status if client driver is available
>   bus: mhi: ep: Fix the debug message for MHI_PKT_TYPE_RESET_CHAN_CMD
>     cmd
>   bus: mhi: ep: Move chan->lock to the start of processing queued ch
>     ring
>   bus: mhi: ep: Save channel state locally during suspend and resume
> 
>  drivers/bus/mhi/ep/main.c | 79 +++++++++++++++++++++------------------
>  1 file changed, 42 insertions(+), 37 deletions(-)
> 
> -- 
> 2.25.1
>