mbox series

[00/14] MHI patches for v5.8

Message ID 20200521152540.17335-1-mani@kernel.org (mailing list archive)
Headers show
Series MHI patches for v5.8 | expand

Message

Manivannan Sadhasivam May 21, 2020, 3:25 p.m. UTC
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Hi Greg,

Here is the set of MHI patches for v5.8. Most of the patches are cleanup and
refactoring ones. All of them are reviewed by myself and Jeff and also
verified on x86 and ARM64 architectures for functionality.

Here is the short summary:
-------------------------------------------------------------

- The firmware download was handled by a worker thread which gets scheduled
when the device powers up. But this thread waits until the device gets into
PBL state (notified using PM state worker). Sometimes, there might be delay for
the device to enter PBL state and due to that the firmware worker thread will
timeout. So in order to handle this situation effectively, the firmware load
is now directly called by PM state worker instead of scheduling the thread.

- Return proper error codes incase of error while loading the AMSS firmware
through BHIE protocol

- The MHI register space of the device accepts only non-zero values for the
sequence identifier. But there is a possibility that the host might write zero
(due to the use of prandom_u32() API). Hence, a macro is introduced which
provides non-zero sequence identifiers and used them in all places.

- Moved all common TRE generation code to mhi_gen_tre() function

- The MHI host reads channel ID from the event ring element of the client
device. This ID can be of any value between 0 to 255 but the host may not
support all those IDs. So reject the event ring elements whose channel IDs
are not within the limits of the controller.

- Limit the transfer length read from the client device. This value should
be within the size of the MHI host buffer but there are chances this can
be larger.

- Remove the system worker thread for processing the SYS_ERR condition and
instead call the function directly from EE worker. This is done to avoid
any possible race while MHI shutting down.

- Handle MHI power off in the state worker thread as like MISSION_MODE. This
helps in preventing a possible race condition where a power off is issued by
the controller while processing mission mode.

- Skip the handling of BHI interrupt when the register access is not allowed
due to the device in wrong PM state.

- The write_lock of 'mhi_chan->lock' should only protect 'db_mode'. Hence, use
it properly in places where it is protecting other unwanted regions.

- Reset the client device if it is in SYS_ERR state during power up.

-------------------------------------------------------------

Please consider merging!

Thanks,
Mani

Bhaumik Bhatt (4):
  bus: mhi: core: Handle firmware load using state worker
  bus: mhi: core: Return appropriate error codes for AMSS load failure
  bus: mhi: core: Improve debug logs for loading firmware
  bus: mhi: core: Ensure non-zero session or sequence ID values are used

Hemant Kumar (9):
  bus: mhi: core: Refactor mhi queue APIs
  bus: mhi: core: Cache intmod from mhi event to mhi channel
  bus: mhi: core: Add range check for channel id received in event ring
  bus: mhi: core: Read transfer length from an event properly
  bus: mhi: core: Remove the system error worker thread
  bus: mhi: core: Handle disable transitions in state worker
  bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed
  bus: mhi: core: Do not process SYS_ERROR if RDDM is supported
  bus: mhi: core: Handle write lock properly in mhi_pm_m0_transition

Jeffrey Hugo (1):
  bus: mhi: core: Handle syserr during power_up

 drivers/bus/mhi/core/boot.c     |  75 ++++++------
 drivers/bus/mhi/core/init.c     |   8 +-
 drivers/bus/mhi/core/internal.h |   9 +-
 drivers/bus/mhi/core/main.c     | 194 ++++++++++++++++++--------------
 drivers/bus/mhi/core/pm.c       |  86 +++++++++-----
 include/linux/mhi.h             |   4 -
 6 files changed, 217 insertions(+), 159 deletions(-)

Comments

Manivannan Sadhasivam May 21, 2020, 3:29 p.m. UTC | #1
On Thu, May 21, 2020 at 08:55:26PM +0530, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> 
> Hi Greg,
> 
> Here is the set of MHI patches for v5.8. Most of the patches are cleanup and
> refactoring ones. All of them are reviewed by myself and Jeff and also
> verified on x86 and ARM64 architectures for functionality.
> 

Greg,

Sorry, something wrong happened with my git config and these patches were sent
from my korg ID. Please let me know if I have to resend from my linaro ID to
match the signed-off-by tag.

Sorry for the confusion!

Thanks,
Mani

> Here is the short summary:
> -------------------------------------------------------------
> 
> - The firmware download was handled by a worker thread which gets scheduled
> when the device powers up. But this thread waits until the device gets into
> PBL state (notified using PM state worker). Sometimes, there might be delay for
> the device to enter PBL state and due to that the firmware worker thread will
> timeout. So in order to handle this situation effectively, the firmware load
> is now directly called by PM state worker instead of scheduling the thread.
> 
> - Return proper error codes incase of error while loading the AMSS firmware
> through BHIE protocol
> 
> - The MHI register space of the device accepts only non-zero values for the
> sequence identifier. But there is a possibility that the host might write zero
> (due to the use of prandom_u32() API). Hence, a macro is introduced which
> provides non-zero sequence identifiers and used them in all places.
> 
> - Moved all common TRE generation code to mhi_gen_tre() function
> 
> - The MHI host reads channel ID from the event ring element of the client
> device. This ID can be of any value between 0 to 255 but the host may not
> support all those IDs. So reject the event ring elements whose channel IDs
> are not within the limits of the controller.
> 
> - Limit the transfer length read from the client device. This value should
> be within the size of the MHI host buffer but there are chances this can
> be larger.
> 
> - Remove the system worker thread for processing the SYS_ERR condition and
> instead call the function directly from EE worker. This is done to avoid
> any possible race while MHI shutting down.
> 
> - Handle MHI power off in the state worker thread as like MISSION_MODE. This
> helps in preventing a possible race condition where a power off is issued by
> the controller while processing mission mode.
> 
> - Skip the handling of BHI interrupt when the register access is not allowed
> due to the device in wrong PM state.
> 
> - The write_lock of 'mhi_chan->lock' should only protect 'db_mode'. Hence, use
> it properly in places where it is protecting other unwanted regions.
> 
> - Reset the client device if it is in SYS_ERR state during power up.
> 
> -------------------------------------------------------------
> 
> Please consider merging!
> 
> Thanks,
> Mani
> 
> Bhaumik Bhatt (4):
>   bus: mhi: core: Handle firmware load using state worker
>   bus: mhi: core: Return appropriate error codes for AMSS load failure
>   bus: mhi: core: Improve debug logs for loading firmware
>   bus: mhi: core: Ensure non-zero session or sequence ID values are used
> 
> Hemant Kumar (9):
>   bus: mhi: core: Refactor mhi queue APIs
>   bus: mhi: core: Cache intmod from mhi event to mhi channel
>   bus: mhi: core: Add range check for channel id received in event ring
>   bus: mhi: core: Read transfer length from an event properly
>   bus: mhi: core: Remove the system error worker thread
>   bus: mhi: core: Handle disable transitions in state worker
>   bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed
>   bus: mhi: core: Do not process SYS_ERROR if RDDM is supported
>   bus: mhi: core: Handle write lock properly in mhi_pm_m0_transition
> 
> Jeffrey Hugo (1):
>   bus: mhi: core: Handle syserr during power_up
> 
>  drivers/bus/mhi/core/boot.c     |  75 ++++++------
>  drivers/bus/mhi/core/init.c     |   8 +-
>  drivers/bus/mhi/core/internal.h |   9 +-
>  drivers/bus/mhi/core/main.c     | 194 ++++++++++++++++++--------------
>  drivers/bus/mhi/core/pm.c       |  86 +++++++++-----
>  include/linux/mhi.h             |   4 -
>  6 files changed, 217 insertions(+), 159 deletions(-)
> 
> -- 
> 2.26.GIT
>
Greg KH May 21, 2020, 4:19 p.m. UTC | #2
On Thu, May 21, 2020 at 08:59:30PM +0530, Manivannan Sadhasivam wrote:
> On Thu, May 21, 2020 at 08:55:26PM +0530, mani@kernel.org wrote:
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > 
> > Hi Greg,
> > 
> > Here is the set of MHI patches for v5.8. Most of the patches are cleanup and
> > refactoring ones. All of them are reviewed by myself and Jeff and also
> > verified on x86 and ARM64 architectures for functionality.
> > 
> 
> Greg,
> 
> Sorry, something wrong happened with my git config and these patches were sent
> from my korg ID. Please let me know if I have to resend from my linaro ID to
> match the signed-off-by tag.

Yes, please fix up and resend.

thanks,

greg k-h