43987659 | 03-Jun-2024 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
bus: mhi: ep: Do not allocate memory for MHI objects from DMA zone
[ Upstream commit c7d0b2db5bc5e8c0fdc67b3c8f463c3dfec92f77 ]
MHI endpoint stack accidentally started allocating memory for objects
bus: mhi: ep: Do not allocate memory for MHI objects from DMA zone
[ Upstream commit c7d0b2db5bc5e8c0fdc67b3c8f463c3dfec92f77 ]
MHI endpoint stack accidentally started allocating memory for objects from DMA zone since commit 62210a26cd4f ("bus: mhi: ep: Use slab allocator where applicable"). But there is no real need to allocate memory from this naturally limited DMA zone. This also causes the MHI endpoint stack to run out of memory while doing high bandwidth transfers.
So let's switch over to normal memory.
Cc: <stable@vger.kernel.org> # 6.8 Fixes: 62210a26cd4f ("bus: mhi: ep: Use slab allocator where applicable") Reviewed-by: Mayank Rana <quic_mrana@quicinc.com> Link: https://lore.kernel.org/r/20240603164354.79035-1-manivannan.sadhasivam@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
39601f49 | 21-Aug-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
bus: mhi: ep: Add support for async DMA read operation
[ Upstream commit 2547beb00ddb40e55b773970622421d978f71473 ]
As like the async DMA write operation, let's add support for async DMA read opera
bus: mhi: ep: Add support for async DMA read operation
[ Upstream commit 2547beb00ddb40e55b773970622421d978f71473 ]
As like the async DMA write operation, let's add support for async DMA read operation. In the async path, the data will be read from the transfer ring continuously and when the controller driver notifies the stack using the completion callback (mhi_ep_read_completion), then the client driver will be notified with the read data and the completion event will be sent to the host for the respective ring element (if requested by the host).
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Stable-dep-of: c7d0b2db5bc5 ("bus: mhi: ep: Do not allocate memory for MHI objects from DMA zone") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
b6af3a95 | 02-Nov-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
bus: mhi: ep: Add support for async DMA write operation
[ Upstream commit ee08acb58fe47fc3bc2c137965985cdb1df40b35 ]
In order to optimize the data transfer, let's use the async DMA operation for wr
bus: mhi: ep: Add support for async DMA write operation
[ Upstream commit ee08acb58fe47fc3bc2c137965985cdb1df40b35 ]
In order to optimize the data transfer, let's use the async DMA operation for writing (queuing) data to the host.
In the async path, the completion event for the transfer ring will only be sent to the host when the controller driver notifies the MHI stack of the actual transfer completion using the callback (mhi_ep_skb_completion) supplied in "struct mhi_ep_buf_info".
Also to accommodate the async operation, the transfer ring read offset (ring->rd_offset) is cached in the "struct mhi_ep_chan" and updated locally to let the stack queue further ring items to the controller driver. But the actual read offset of the transfer ring will only be updated in the completion callback.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Stable-dep-of: c7d0b2db5bc5 ("bus: mhi: ep: Do not allocate memory for MHI objects from DMA zone") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
ce16274a | 11-Dec-2023 |
Bhaumik Bhatt <bbhatt@codeaurora.org> |
bus: mhi: host: Add spinlock to protect WP access when queueing TREs
commit b89b6a863dd53bc70d8e52d50f9cfaef8ef5e9c9 upstream.
Protect WP accesses such that multiple threads queueing buffers for in
bus: mhi: host: Add spinlock to protect WP access when queueing TREs
commit b89b6a863dd53bc70d8e52d50f9cfaef8ef5e9c9 upstream.
Protect WP accesses such that multiple threads queueing buffers for incoming data do not race.
Meanwhile, if CONFIG_TRACE_IRQFLAGS is enabled, irq will be enabled once __local_bh_enable_ip is called as part of write_unlock_bh. Hence, let's take irqsave lock after TRE is generated to avoid running write_unlock_bh when irqsave lock is held.
Cc: stable@vger.kernel.org Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer") Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Tested-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/1702276972-41296-2-git-send-email-quic_qianyu@quicinc.com Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
eaefb946 | 11-Dec-2023 |
Qiang Yu <quic_qianyu@quicinc.com> |
bus: mhi: host: Drop chan lock before queuing buffers
commit 01bd694ac2f682fb8017e16148b928482bc8fa4b upstream.
Ensure read and write locks for the channel are not taken in succession by dropping t
bus: mhi: host: Drop chan lock before queuing buffers
commit 01bd694ac2f682fb8017e16148b928482bc8fa4b upstream.
Ensure read and write locks for the channel are not taken in succession by dropping the read lock from parse_xfer_event() such that a callback given to client can potentially queue buffers and acquire the write lock in that process. Any queueing of buffers should be done without channel read lock acquired as it can result in multiple locks and a soft lockup.
Cc: <stable@vger.kernel.org> # 5.7 Fixes: 1d3173a3bae7 ("bus: mhi: core: Add support for processing events from client device") Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Tested-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/1702276972-41296-3-git-send-email-quic_qianyu@quicinc.com [mani: added fixes tag and cc'ed stable] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
ad671dfc | 17-Aug-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
bus: mhi: ep: Pass mhi_ep_buf_info struct to read/write APIs
[ Upstream commit b08ded2ef2e98768d5ee5f71da8fe768b1f7774b ]
In the preparation of DMA async support, let's pass the parameters to read_
bus: mhi: ep: Pass mhi_ep_buf_info struct to read/write APIs
[ Upstream commit b08ded2ef2e98768d5ee5f71da8fe768b1f7774b ]
In the preparation of DMA async support, let's pass the parameters to read_from_host() and write_to_host() APIs using mhi_ep_buf_info structure.
No functional change.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Stable-dep-of: 327ec5f70609 ("PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single()") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
bd4f6f1f | 18-Oct-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
bus: mhi: ep: Use slab allocator where applicable
[ Upstream commit 62210a26cd4f8ad52683a71c0226dfe85de1144d ]
Use slab allocator for allocating the memory for objects used frequently and are of fi
bus: mhi: ep: Use slab allocator where applicable
[ Upstream commit 62210a26cd4f8ad52683a71c0226dfe85de1144d ]
Use slab allocator for allocating the memory for objects used frequently and are of fixed size. This reduces the overheard associated with kmalloc().
Suggested-by: Alex Elder <elder@linaro.org> Link: https://lore.kernel.org/r/20231018122812.47261-1-manivannan.sadhasivam@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Stable-dep-of: 327ec5f70609 ("PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single()") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
0724869e | 04-Aug-2023 |
Daniele Palmas <dnlplm@gmail.com> |
bus: mhi: host: pci_generic: add support for Telit FE990 modem
Add support for Telit FE990 that has the same configuration as FN990:
$ lspci -vv 04:00.0 Unassigned class [ff00]: Qualcomm Device 030
bus: mhi: host: pci_generic: add support for Telit FE990 modem
Add support for Telit FE990 that has the same configuration as FN990:
$ lspci -vv 04:00.0 Unassigned class [ff00]: Qualcomm Device 0308 Subsystem: Device 1c5d:2015
Signed-off-by: Daniele Palmas <dnlplm@gmail.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://lore.kernel.org/r/20230804094039.365102-1-dnlplm@gmail.com [mani: minor update to commit subject and adjusted comment] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
b0f9f360 | 11-Aug-2023 |
Arnd Bergmann <arnd@arndb.de> |
bus: mhi: host: remove unused-but-set parameter
Clang warns about a parameter that is decremented but never evaluated here:
bus/mhi/host/main.c:803:13: error: parameter 'event_quota' set but not us
bus: mhi: host: remove unused-but-set parameter
Clang warns about a parameter that is decremented but never evaluated here:
bus/mhi/host/main.c:803:13: error: parameter 'event_quota' set but not used [-Werror,-Wunused-but-set-parameter] u32 event_quota)
Remove the access to the variable to avoid that warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://lore.kernel.org/r/20230811134547.3231160-1-arnd@kernel.org [mani: minor spelling fix to commit message] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
7b672d70 | 06-Aug-2023 |
Duke Xin (辛安文) <duke_xinanwen@163.com> |
bus: mhi: host: pci_generic: Add support for Quectel RM520N-GL Lenovo variant
Quectel's RM520N-GL Lenovo variant is same as that of the existing RM520N-GL modem and uses the same config. But this on
bus: mhi: host: pci_generic: Add support for Quectel RM520N-GL Lenovo variant
Quectel's RM520N-GL Lenovo variant is same as that of the existing RM520N-GL modem and uses the same config. But this one is designed for Lenovo laptop usecase, hence Quectel got a new PID.
Signed-off-by: Duke Xin(辛安文) <duke_xinanwen@163.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Link: https://lore.kernel.org/r/20230807030454.37255-1-duke_xinanwen@163.com [mani: tweaked subject and commit message a bit] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
efe47a18 | 27-Jul-2023 |
Kalle Valo <quic_kvalo@quicinc.com> |
bus: mhi: host: allow MHI client drivers to provide the firmware via a pointer
Currently MHI loads the firmware image from the path provided by client devices. ath11k needs to support firmware image
bus: mhi: host: allow MHI client drivers to provide the firmware via a pointer
Currently MHI loads the firmware image from the path provided by client devices. ath11k needs to support firmware image embedded along with meta data (named as firmware-2.bin). So allow the client driver to request the firmware file from user space on it's own and provide the firmware image data and size to MHI via a pointer struct mhi_controller::fw_data.
This is an optional feature, if fw_data is NULL MHI load the firmware using the name from struct mhi_controller::fw_image string as before.
Tested with ath11k and WCN6855 hw2.0.
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://lore.kernel.org/r/20230727100430.3603551-2-kvalo@kernel.org [mani: wrapped commit message to 75 columns] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
d0184830 | 27-Jun-2023 |
Julia Lawall <Julia.Lawall@inria.fr> |
bus: mhi: host: use vmalloc_array and vcalloc
Use vmalloc_array and vcalloc to protect against multiplication overflows.
The changes were done using the following Coccinelle semantic patch:
// <sm
bus: mhi: host: use vmalloc_array and vcalloc
Use vmalloc_array and vcalloc to protect against multiplication overflows.
The changes were done using the following Coccinelle semantic patch:
// <smpl> @initialize:ocaml@ @@
let rename alloc = match alloc with "vmalloc" -> "vmalloc_array" | "vzalloc" -> "vcalloc" | _ -> failwith "unknown"
@@ size_t e1,e2; constant C1, C2; expression E1, E2, COUNT, x1, x2, x3; typedef u8; typedef __u8; type t = {u8,__u8,char,unsigned char}; identifier alloc = {vmalloc,vzalloc}; fresh identifier realloc = script:ocaml(alloc) { rename alloc }; @@
( alloc(x1*x2*x3) | alloc(C1 * C2) | alloc((sizeof(t)) * (COUNT), ...) | - alloc((e1) * (e2)) + realloc(e1, e2) | - alloc((e1) * (COUNT)) + realloc(COUNT, e1) | - alloc((E1) * (E2)) + realloc(E1, E2) ) // </smpl>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Link: https://lore.kernel.org/r/20230627144339.144478-11-Julia.Lawall@inria.fr Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
104a8c5d | 12-Jul-2023 |
Slark Xiao <slark_xiao@163.com> |
bus: mhi: host: pci_generic: Add support for Dell DW5932e
The DW5932e has 2 variants: eSIM(DW5932e-eSIM) and non-eSIM(DW5932e). Both of them are designed based on Qualcomm SDX62 and it will align wi
bus: mhi: host: pci_generic: Add support for Dell DW5932e
The DW5932e has 2 variants: eSIM(DW5932e-eSIM) and non-eSIM(DW5932e). Both of them are designed based on Qualcomm SDX62 and it will align with the Foxconn sdx65 settings.
Signed-off-by: Slark Xiao <slark_xiao@163.com> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://lore.kernel.org/r/20230712083741.7615-1-slark_xiao@163.com Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
1cad976a | 30-Jun-2023 |
Duke Xin (辛安文) <duke_xinanwen@163.com> |
bus: mhi: host: pci_generic: Add support for Quectel RM520N-GL modem
Add MHI interface definition for RM520 product based on Qualcomm SDX6X chip
Signed-off-by: Duke Xin(辛安文) <duke_xinanwen@163.com>
bus: mhi: host: pci_generic: Add support for Quectel RM520N-GL modem
Add MHI interface definition for RM520 product based on Qualcomm SDX6X chip
Signed-off-by: Duke Xin(辛安文) <duke_xinanwen@163.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://lore.kernel.org/r/20230630062318.12114-1-duke_xinanwen@163.com Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
110f113a | 08-Jun-2023 |
Duke Xin (辛安文) <duke_xinanwen@163.com> |
bus: mhi: host: pci_generic: Add support for Quectel EM160R-GL modem
This modem is identical to the previous EM160R-GL modem with same product name. But this one is designed for a specific laptop us
bus: mhi: host: pci_generic: Add support for Quectel EM160R-GL modem
This modem is identical to the previous EM160R-GL modem with same product name. But this one is designed for a specific laptop usecase, hence Quectel got a new PID.
Signed-off-by: Duke Xin(辛安文) <duke_xinanwen@163.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://lore.kernel.org/r/20230608092927.2893-1-duke_xinanwen@163.com [mani: modified the commit message and subject] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
15f67057 | 19-May-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
bus: mhi: host: pci_generic: Add support for IP_SW0 channels
IP_SW0 channels are used to transfer data over the networking interface between MHI endpoint and the host. Define the channels in the MHI
bus: mhi: host: pci_generic: Add support for IP_SW0 channels
IP_SW0 channels are used to transfer data over the networking interface between MHI endpoint and the host. Define the channels in the MHI v1 channel config along with dedicated event rings.
Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Link: https://lore.kernel.org/r/20230519135803.13850-1-manivannan.sadhasivam@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
1d1493bd | 10-Apr-2023 |
Jeffrey Hugo <quic_jhugo@quicinc.com> |
bus: mhi: host: Use mhi_tryset_pm_state() for setting fw error state
If firmware loading fails, the controller's pm_state is updated to MHI_PM_FW_DL_ERR unconditionally. This can corrupt the pm_sta
bus: mhi: host: Use mhi_tryset_pm_state() for setting fw error state
If firmware loading fails, the controller's pm_state is updated to MHI_PM_FW_DL_ERR unconditionally. This can corrupt the pm_state as the update is not done under the proper lock, and also does not validate the state transition. The firmware loading can fail due to a detected syserr, but if MHI_PM_FW_DL_ERR is unconditionally set as the pm_state, the handling of the syserr can break when it attempts to transition from syserr detect, to syserr process.
By grabbing the lock, we ensure we don't race with some other pm_state update. By using mhi_try_set_pm_state(), we check that the transition to MHI_PM_FW_DL_ERR is valid via the state machine logic. If it is not valid, then some other transition is occurring like syserr processing, and we assume that will resolve the firmware loading error.
Fixes: 12e050c77be0 ("bus: mhi: core: Move to an error state on any firmware load failure") Cc: stable@vger.kernel.org Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://lore.kernel.org/r/1681142292-27571-3-git-send-email-quic_jhugo@quicinc.com Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
d469d944 | 10-Apr-2023 |
Jeffrey Hugo <quic_jhugo@quicinc.com> |
bus: mhi: host: Remove duplicate ee check for syserr
If we detect a system error via intvec, we only process the syserr if the current ee is different than the last observed ee. The reason for this
bus: mhi: host: Remove duplicate ee check for syserr
If we detect a system error via intvec, we only process the syserr if the current ee is different than the last observed ee. The reason for this check is to prevent bhie from running multiple times, but with the single queue handling syserr, that is not possible.
The check can cause an issue with device recovery. If PBL loads a bad SBL via BHI, but that SBL hangs before notifying the host of an ee change, then issuing soc_reset to crash the device and retry (after supplying a fixed SBL) will not recover the device as the host will observe a PBL->PBL transition and not process the syserr. The device will be stuck until either the driver is reloaded, or the host is rebooted. Instead, remove the check so that we can attempt to recover the device.
Fixes: ef2126c4e2ea ("bus: mhi: core: Process execution environment changes serially") Cc: stable@vger.kernel.org Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://lore.kernel.org/r/1681142292-27571-2-git-send-email-quic_jhugo@quicinc.com Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|