* Re: [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM
2023-05-18 6:22 [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM Qiang Yu
@ 2023-05-19 13:51 ` Manivannan Sadhasivam
2023-05-22 7:01 ` Qiang Yu
2023-05-30 10:40 ` Manivannan Sadhasivam
2023-05-30 10:44 ` Manivannan Sadhasivam
2 siblings, 1 reply; 5+ messages in thread
From: Manivannan Sadhasivam @ 2023-05-19 13:51 UTC (permalink / raw)
To: Qiang Yu
Cc: mani, quic_jhugo, mhi, linux-arm-msm, linux-kernel, quic_cang,
quic_mrana, stable
On Thu, May 18, 2023 at 02:22:39PM +0800, Qiang Yu wrote:
> In RDDM EE, device can not process MHI reset issued by host. In case of MHI
> power off, host is issuing MHI reset and polls for it to get cleared until
> it times out. Since this timeout can not be avoided in case of RDDM, skip
> the MHI reset in this scenarios.
>
> Cc: <stable@vger.kernel.org>
> Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions")
> Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> ---
> v1->v2: use ~75 columns in commit text, add Fixes tag
> v2->v3: update Fixes tag
> v3->v4: add review tag and CC stable
>
> drivers/bus/mhi/host/pm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
> index 0834590..8a4362d 100644
> --- a/drivers/bus/mhi/host/pm.c
> +++ b/drivers/bus/mhi/host/pm.c
> @@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
>
> /* Trigger MHI RESET so that the device will not access host memory */
> if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
> + /* Skip MHI RESET if in RDDM state */
> + if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM)
Do we really need to check for rddm_image? Wouldn't the EE check sufficient
enough?
In that case, the check can be moved to the prior if condition.
- Mani
> + goto skip_mhi_reset;
> +
> dev_dbg(dev, "Triggering MHI Reset in device\n");
> mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
>
> @@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
> }
> }
>
> +skip_mhi_reset:
> dev_dbg(dev,
> "Waiting for all pending event ring processing to complete\n");
> mhi_event = mhi_cntrl->mhi_event;
> --
> 2.7.4
>
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM
2023-05-19 13:51 ` Manivannan Sadhasivam
@ 2023-05-22 7:01 ` Qiang Yu
0 siblings, 0 replies; 5+ messages in thread
From: Qiang Yu @ 2023-05-22 7:01 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: quic_jhugo, mhi, linux-arm-msm, linux-kernel, quic_cang,
quic_mrana, stable
On 5/19/2023 9:51 PM, Manivannan Sadhasivam wrote:
> On Thu, May 18, 2023 at 02:22:39PM +0800, Qiang Yu wrote:
>> In RDDM EE, device can not process MHI reset issued by host. In case of MHI
>> power off, host is issuing MHI reset and polls for it to get cleared until
>> it times out. Since this timeout can not be avoided in case of RDDM, skip
>> the MHI reset in this scenarios.
>>
>> Cc: <stable@vger.kernel.org>
>> Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions")
>> Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
>> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
>> ---
>> v1->v2: use ~75 columns in commit text, add Fixes tag
>> v2->v3: update Fixes tag
>> v3->v4: add review tag and CC stable
>>
>> drivers/bus/mhi/host/pm.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
>> index 0834590..8a4362d 100644
>> --- a/drivers/bus/mhi/host/pm.c
>> +++ b/drivers/bus/mhi/host/pm.c
>> @@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
>>
>> /* Trigger MHI RESET so that the device will not access host memory */
>> if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
>> + /* Skip MHI RESET if in RDDM state */
>> + if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM)
> Do we really need to check for rddm_image? Wouldn't the EE check sufficient
> enough?
>
> In that case, the check can be moved to the prior if condition.
>
> - Mani
If rddm_image is NULL, that means this device does not support RDDM. In this case, it is unnecessary to access MMIO register.
>> + goto skip_mhi_reset;
>> +
>> dev_dbg(dev, "Triggering MHI Reset in device\n");
>> mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
>>
>> @@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
>> }
>> }
>>
>> +skip_mhi_reset:
>> dev_dbg(dev,
>> "Waiting for all pending event ring processing to complete\n");
>> mhi_event = mhi_cntrl->mhi_event;
>> --
>> 2.7.4
>>
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM
2023-05-18 6:22 [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM Qiang Yu
2023-05-19 13:51 ` Manivannan Sadhasivam
@ 2023-05-30 10:40 ` Manivannan Sadhasivam
2023-05-30 10:44 ` Manivannan Sadhasivam
2 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2023-05-30 10:40 UTC (permalink / raw)
To: Qiang Yu
Cc: quic_jhugo, mhi, linux-arm-msm, linux-kernel, quic_cang,
quic_mrana, stable
On Thu, May 18, 2023 at 02:22:39PM +0800, Qiang Yu wrote:
> In RDDM EE, device can not process MHI reset issued by host. In case of MHI
> power off, host is issuing MHI reset and polls for it to get cleared until
> it times out. Since this timeout can not be avoided in case of RDDM, skip
> the MHI reset in this scenarios.
>
> Cc: <stable@vger.kernel.org>
> Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions")
> Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
> ---
> v1->v2: use ~75 columns in commit text, add Fixes tag
> v2->v3: update Fixes tag
> v3->v4: add review tag and CC stable
>
> drivers/bus/mhi/host/pm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
> index 0834590..8a4362d 100644
> --- a/drivers/bus/mhi/host/pm.c
> +++ b/drivers/bus/mhi/host/pm.c
> @@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
>
> /* Trigger MHI RESET so that the device will not access host memory */
> if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
> + /* Skip MHI RESET if in RDDM state */
> + if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM)
> + goto skip_mhi_reset;
> +
> dev_dbg(dev, "Triggering MHI Reset in device\n");
> mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
>
> @@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
> }
> }
>
> +skip_mhi_reset:
> dev_dbg(dev,
> "Waiting for all pending event ring processing to complete\n");
> mhi_event = mhi_cntrl->mhi_event;
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM
2023-05-18 6:22 [PATCH v4] bus: mhi: host: Skip MHI reset if device is in RDDM Qiang Yu
2023-05-19 13:51 ` Manivannan Sadhasivam
2023-05-30 10:40 ` Manivannan Sadhasivam
@ 2023-05-30 10:44 ` Manivannan Sadhasivam
2 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2023-05-30 10:44 UTC (permalink / raw)
To: Qiang Yu
Cc: quic_jhugo, mhi, linux-arm-msm, linux-kernel, quic_cang,
quic_mrana, stable
On Thu, May 18, 2023 at 02:22:39PM +0800, Qiang Yu wrote:
> In RDDM EE, device can not process MHI reset issued by host. In case of MHI
> power off, host is issuing MHI reset and polls for it to get cleared until
> it times out. Since this timeout can not be avoided in case of RDDM, skip
> the MHI reset in this scenarios.
>
> Cc: <stable@vger.kernel.org>
> Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions")
> Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
Applied to mhi-next!
- Mani
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> ---
> v1->v2: use ~75 columns in commit text, add Fixes tag
> v2->v3: update Fixes tag
> v3->v4: add review tag and CC stable
>
> drivers/bus/mhi/host/pm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
> index 0834590..8a4362d 100644
> --- a/drivers/bus/mhi/host/pm.c
> +++ b/drivers/bus/mhi/host/pm.c
> @@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
>
> /* Trigger MHI RESET so that the device will not access host memory */
> if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
> + /* Skip MHI RESET if in RDDM state */
> + if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM)
> + goto skip_mhi_reset;
> +
> dev_dbg(dev, "Triggering MHI Reset in device\n");
> mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
>
> @@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
> }
> }
>
> +skip_mhi_reset:
> dev_dbg(dev,
> "Waiting for all pending event ring processing to complete\n");
> mhi_event = mhi_cntrl->mhi_event;
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread