Message ID | 1588991208-26928-1-git-send-email-bbhatt@codeaurora.org |
---|---|
Headers | show |
Series | Bug fixes and improved logging in MHI | expand |
On Fri, May 08, 2020 at 07:26:42PM -0700, Bhaumik Bhatt wrote: > From: Hemant Kumar <hemantk@codeaurora.org> > > Driver is using zero initialized intmod value from mhi channel when > configuring TRE for bei field. This prevents interrupt moderation to > take effect in case it is supported by an event ring. Fix this by > copying intmod value from associated event ring to mhi channel upon > registering mhi controller. > > Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> > Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Thanks, Mani > --- > drivers/bus/mhi/core/init.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index eb2ab05..1a93d24 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -863,6 +863,10 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, > mutex_init(&mhi_chan->mutex); > init_completion(&mhi_chan->completion); > rwlock_init(&mhi_chan->lock); > + > + /* used in setting bei field of TRE */ > + mhi_event = &mhi_cntrl->mhi_event[mhi_chan->er_index]; > + mhi_chan->intmod = mhi_event->intmod; > } > > if (mhi_cntrl->bounce_buf) { > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project
On Fri, May 08, 2020 at 07:26:46PM -0700, Bhaumik Bhatt wrote: > When loading AMSS firmware using BHIe protocol, return -ETIMEDOUT if no > response is received within the timeout or return -EIO in case of a > protocol returned failure or an MHI error state. > > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> > Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Thanks, Mani > --- > drivers/bus/mhi/core/boot.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c > index 17c636b..cf6dc5a 100644 > --- a/drivers/bus/mhi/core/boot.c > +++ b/drivers/bus/mhi/core/boot.c > @@ -176,6 +176,7 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, > void __iomem *base = mhi_cntrl->bhie; > rwlock_t *pm_lock = &mhi_cntrl->pm_lock; > u32 tx_status, sequence_id; > + int ret; > > read_lock_bh(pm_lock); > if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) { > @@ -198,19 +199,19 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, > read_unlock_bh(pm_lock); > > /* Wait for the image download to complete */ > - wait_event_timeout(mhi_cntrl->state_event, > - MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || > - mhi_read_reg_field(mhi_cntrl, base, > - BHIE_TXVECSTATUS_OFFS, > - BHIE_TXVECSTATUS_STATUS_BMSK, > - BHIE_TXVECSTATUS_STATUS_SHFT, > - &tx_status) || tx_status, > - msecs_to_jiffies(mhi_cntrl->timeout_ms)); > - > - if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) > + ret = wait_event_timeout(mhi_cntrl->state_event, > + MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || > + mhi_read_reg_field(mhi_cntrl, base, > + BHIE_TXVECSTATUS_OFFS, > + BHIE_TXVECSTATUS_STATUS_BMSK, > + BHIE_TXVECSTATUS_STATUS_SHFT, > + &tx_status) || tx_status, > + msecs_to_jiffies(mhi_cntrl->timeout_ms)); > + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || > + tx_status != BHIE_TXVECSTATUS_STATUS_XFER_COMPL) > return -EIO; > > - return (tx_status == BHIE_TXVECSTATUS_STATUS_XFER_COMPL) ? 0 : -EIO; > + return (!ret) ? -ETIMEDOUT : 0; > } > > static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project
Hi Bhaumik, On Fri, May 08, 2020 at 07:26:40PM -0700, Bhaumik Bhatt wrote: > A set of patches for bug fixes and improved logging in mhi/core/boot.c. > Verified on x86 and arm64 platforms. > Series applied to mhi-next! I'll wait for one more -rc before sending the final series to Greg for v5.8. If any other series gets reviewed by that point, I'll club them together for the final one. Thanks, Mani > v7: > -Updated commit text for macro inclusion > -Updated channel ID bound checks > -Fixed non-uniform placement of function parameters to be within 80 characters > -Sent to correct Maintainer email ID > > v6: > -Updated the MHI_RANDOM_U32_NONZERO to only give a random number upto the > supplied bitmask > > v5: > -Updated the macro MHI_RANDOM_U32_NONZERO to take a bitmask as the input > parameter and output a non-zero value between 1 and U32_MAX > > v4: > -Dropped the change: bus: mhi: core: WARN_ON for malformed vector table > -Updated bus: mhi: core: Read transfer length from an event properly to include > parse rsc events > -Use prandom_u32_max() instead of prandom_u32 to avoid if check in > bus: mhi: core: Ensure non-zero session or sequence ID values are used > > v3: > -Fixed signed-off-by tags > -Add a refactor patch for MHI queue APIs > -Commit text fix in bus: mhi: core: Read transfer length from an event properly > -Fix channel ID range check for ctrl and data event rings processing > > v2: > -Fix channel ID range check potential infinite loop > -Add appropriate signed-off-by tags > > 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 (4): > 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 > > drivers/bus/mhi/core/boot.c | 75 +++++++++---------- > drivers/bus/mhi/core/init.c | 5 +- > drivers/bus/mhi/core/internal.h | 5 +- > drivers/bus/mhi/core/main.c | 156 +++++++++++++++++++++------------------- > drivers/bus/mhi/core/pm.c | 6 +- > include/linux/mhi.h | 2 - > 6 files changed, 129 insertions(+), 120 deletions(-) > > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project