| 309ab14f | 27-Nov-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Add checks for read/write callbacks while registering controllers
The MHI EP controller drivers has to support both sync and async read/write callbacks. Hence, add a check for it.
Sig
bus: mhi: ep: Add checks for read/write callbacks while registering controllers
The MHI EP controller drivers has to support both sync and async read/write callbacks. Hence, add a check for it.
Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| 2547beb0 | 21-Aug-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Add support for async DMA read operation
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 transf
bus: mhi: ep: Add support for async DMA read operation
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 <[email protected]>
show more ...
|
| ee08acb5 | 02-Nov-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Add support for async DMA write operation
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 comp
bus: mhi: ep: Add support for async DMA write operation
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 <[email protected]>
show more ...
|
| 92710524 | 27-Nov-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Rename read_from_host() and write_to_host() APIs
In the preparation for adding async API support, let's rename the existing APIs to read_sync() and write_sync() to make it explicit tha
bus: mhi: ep: Rename read_from_host() and write_to_host() APIs
In the preparation for adding async API support, let's rename the existing APIs to read_sync() and write_sync() to make it explicit that these APIs are used for synchronous read/write.
Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| b08ded2e | 17-Aug-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Pass mhi_ep_buf_info struct to read/write APIs
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 str
bus: mhi: ep: Pass mhi_ep_buf_info struct to read/write APIs
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 <[email protected]>
show more ...
|
| cea4bcbf | 26-Oct-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Add support for interrupt moderation timer
MHI spec defines the interrupt moderation timer feature using which the host can limit the number of interrupts being raised for an event rin
bus: mhi: ep: Add support for interrupt moderation timer
MHI spec defines the interrupt moderation timer feature using which the host can limit the number of interrupts being raised for an event ring by the device. This feature allows the host to process multiple event ring elements by a single IRQ from the device, thereby eliminating the need to process IRQ for each element.
The INTMODT field in the event context array provides the value to be used for delaying the IRQ generation from device. This value, along with the Block Event Interrupt (BEI) flag of the TRE defines how IRQ is generated to the host.
Support for interrupt moderation timer is implemented using delayed workqueue in kernel. And a separate delayed work item is used for each event ring.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| 3c54a3ff | 26-Jan-2023 |
Dan Carpenter <[email protected]> |
bus: mhi: ep: Fix off by one in mhi_ep_process_cmd_ring()
The > comparison should be changed to >= to prevent an out of bounds access into the mhi_cntrl->mhi_chan[] array. The mhi_cntrl->mhi_chan[]
bus: mhi: ep: Fix off by one in mhi_ep_process_cmd_ring()
The > comparison should be changed to >= to prevent an out of bounds access into the mhi_cntrl->mhi_chan[] array. The mhi_cntrl->mhi_chan[] array is allocated in mhi_ep_chan_init() and has mhi_cntrl->max_chan elements.
Fixes: 6de4941c0215 ("bus: mhi: ep: Check if the channel is supported by the controller") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Alex Elder <[email protected]> Link: https://lore.kernel.org/r/Y9JH5sudiZWvbODv@kili Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| 1ddc7618 | 23-Jan-2023 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Change state_lock to mutex
state_lock, the spinlock type is meant to protect race against concurrent MHI state transitions. In mhi_ep_set_m0_state(), while the state_lock is being held
bus: mhi: ep: Change state_lock to mutex
state_lock, the spinlock type is meant to protect race against concurrent MHI state transitions. In mhi_ep_set_m0_state(), while the state_lock is being held, the channels are resumed in mhi_ep_resume_channels() if the previous state was M3. This causes sleeping in atomic bug, since mhi_ep_resume_channels() use mutex internally.
Since the state_lock is supposed to be held throughout the state change, it is not ideal to drop the lock before calling mhi_ep_resume_channels(). So to fix this issue, let's change the type of state_lock to mutex. This would also allow holding the lock throughout all state transitions thereby avoiding any potential race.
Cc: <[email protected]> # 5.19 Fixes: e4b7b5f0f30a ("bus: mhi: ep: Add support for suspending and resuming channels") Reported-by: Dan Carpenter <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| 8a1c24bb | 28-Dec-2022 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Save channel state locally during suspend and resume
During suspend and resume, the channel state needs to be saved locally. Otherwise, the endpoint may access the channels while they
bus: mhi: ep: Save channel state locally during suspend and resume
During suspend and resume, the channel state needs to be saved locally. Otherwise, the endpoint may access the channels while they were being suspended and causing access violations.
Fix it by saving the channel state locally during suspend and resume.
Cc: <[email protected]> # 5.19 Fixes: e4b7b5f0f30a ("bus: mhi: ep: Add support for suspending and resuming channels") Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]) Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| 8d6a1fea | 28-Dec-2022 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Move chan->lock to the start of processing queued ch ring
There is a good chance that while the channel ring gets processed, the STOP or RESET command for the channel might be received
bus: mhi: ep: Move chan->lock to the start of processing queued ch ring
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: <[email protected]> # 5.19 Fixes: 03c0bb8ec983 ("bus: mhi: ep: Add support for processing channel rings") Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| e6cebcc2 | 28-Dec-2022 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Only send -ENOTCONN status if client driver is available
For the STOP and RESET commands, only send the channel disconnect status -ENOTCONN if client driver is available. Otherwise, it
bus: mhi: ep: Only send -ENOTCONN status if client driver is available
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: <[email protected]> # 5.19 Fixes: e827569062a8 ("bus: mhi: ep: Add support for processing command rings") Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| 6de4941c | 28-Dec-2022 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Check if the channel is supported by the controller
Before processing the command ring for the channel, check if the channel is supported by the controller or not.
Signed-off-by: Mani
bus: mhi: ep: Check if the channel is supported by the controller
Before processing the command ring for the channel, check if the channel is supported by the controller or not.
Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
show more ...
|
| e4b7b5f0 | 05-Apr-2022 |
Manivannan Sadhasivam <[email protected]> |
bus: mhi: ep: Add support for suspending and resuming channels
Add support for suspending and resuming the channels in MHI endpoint stack. The channels will be moved to the suspended state during M3
bus: mhi: ep: Add support for suspending and resuming channels
Add support for suspending and resuming the channels in MHI endpoint stack. The channels will be moved to the suspended state during M3 state transition and will be resumed during M0 transition.
Reviewed-by: Alex Elder <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|