path: root/net/qrtr/mhi.c
AgeCommit message (Collapse)Author
2022-08-15net: qrtr: start MHI channel after endpoit creationMaxim Kochetkov
MHI channel may generates event/interrupt right after enabling. It may leads to 2 race conditions issues. 1) Such event may be dropped by qcom_mhi_qrtr_dl_callback() at check: if (!qdev || mhi_res->transaction_status) return; Because dev_set_drvdata(&mhi_dev->dev, qdev) may be not performed at this moment. In this situation qrtr-ns will be unable to enumerate services in device. --------------------------------------------------------------- 2) Such event may come at the moment after dev_set_drvdata() and before qrtr_endpoint_register(). In this case kernel will panic with accessing wrong pointer at qcom_mhi_qrtr_dl_callback(): rc = qrtr_endpoint_post(&qdev->ep, mhi_res->buf_addr, mhi_res->bytes_xferd); Because endpoint is not created yet. -------------------------------------------------------------- So move mhi_prepare_for_transfer_autoqueue after endpoint creation to fix it. Fixes: a2e2cc0dbb11 ("net: qrtr: Start MHI channels during init") Signed-off-by: Maxim Kochetkov <> Reviewed-by: Hemant Kumar <> Reviewed-by: Manivannan Sadhasivam <> Reviewed-by: Loic Poulain <> Signed-off-by: David S. Miller <>
2021-12-17bus: mhi: core: Add an API for auto queueing buffers for DL channelManivannan Sadhasivam
Add a new API "mhi_prepare_for_transfer_autoqueue" for using with client drivers like QRTR to request MHI core to autoqueue buffers for the DL channel along with starting both UL and DL channels. So far, the "auto_queue" flag specified by the controller drivers in channel definition served this purpose but this will be removed at some point in future. Cc: Cc: Jakub Kicinski <> Cc: David S. Miller <> Cc: Greg Kroah-Hartman <> Co-developed-by: Loic Poulain <> Acked-by: Jakub Kicinski <> Signed-off-by: Loic Poulain <> Signed-off-by: Manivannan Sadhasivam <> Link: Signed-off-by: Greg Kroah-Hartman <>
2021-08-26Revert "net: really fix the build..."Kalle Valo
This reverts commit ce78ffa3ef1681065ba451cfd545da6126f5ca88. Wren and Nicolas reported that ath11k was failing to initialise QCA6390 Wi-Fi 6 device with error: qcom_mhi_qrtr: probe of mhi0_IPCR failed with error -22 Commit ce78ffa3ef16 ("net: really fix the build..."), introduced in v5.14-rc5, caused this regression in qrtr. Most likely all ath11k devices are broken, but I only tested QCA6390. Let's revert the broken commit so that ath11k works again. Reported-by: Wren Turkal <> Reported-by: Nicolas Schichan <> Signed-off-by: Kalle Valo <> Link: Signed-off-by: Jakub Kicinski <>
2021-08-03net: really fix the build...David S. Miller
Signed-off-by: David S. Miller <>
2021-04-21net: qrtr: Avoid potential use after free in MHI sendBjorn Andersson
It is possible that the MHI ul_callback will be invoked immediately following the queueing of the skb for transmission, leading to the callback decrementing the refcount of the associated sk and freeing the skb. As such the dereference of skb and the increment of the sk refcount must happen before the skb is queued, to avoid the skb to be used after free and potentially the sk to drop its last refcount.. Fixes: 6e728f321393 ("net: qrtr: Add MHI transport layer") Signed-off-by: Bjorn Andersson <> Signed-off-by: David S. Miller <>
2020-11-20net: qrtr: Unprepare MHI channels during removeBhaumik Bhatt
Reset MHI device channels when driver remove is called due to module unload or any crash scenario. This will make sure that MHI channels no longer remain enabled for transfers since the MHI stack does not take care of this anymore after the auto-start channels feature was removed. Signed-off-by: Bhaumik Bhatt <> Acked-by: Jakub Kicinski <> Reviewed-by: Manivannan Sadhasivam <> Signed-off-by: Manivannan Sadhasivam <>
2020-11-18net: qrtr: Start MHI channels during initLoic Poulain
Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore. Signed-off-by: Loic Poulain <> Reviewed-by: Manivannan Sadhasivam <> Acked-by: David S. Miller <> Signed-off-by: Manivannan Sadhasivam <>
2020-05-07net: qrtr: Add MHI transport layerManivannan Sadhasivam
MHI is the transport layer used for communicating to the external modems. Hence, this commit adds MHI transport layer support to QRTR for transferring the QMI messages over IPC Router. Reviewed-by: Bjorn Andersson <> Signed-off-by: Manivannan Sadhasivam <> Signed-off-by: David S. Miller <>