diff mbox series

[RESEND,v2,1/2] cpuidle: tegra: Fix C7 idling state on Tegra114

Message ID 20210302095405.28453-1-digetx@gmail.com (mailing list archive)
State Awaiting Upstream
Delegated to: Daniel Lezcano
Headers show
Series [RESEND,v2,1/2] cpuidle: tegra: Fix C7 idling state on Tegra114 | expand

Commit Message

Dmitry Osipenko March 2, 2021, 9:54 a.m. UTC
Trusted Foundation firmware doesn't implement the do_idle call and in
this case suspending should fall back to the common suspend path. In order
to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
C7 idling, like it was done by the older Tegra114 cpuidle driver.

Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
Cc: stable@vger.kernel.org # 5.7+
Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---

Changelog:

v2: - No changes. V1 got no attention, hence re-sending.

 drivers/cpuidle/cpuidle-tegra.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Daniel Lezcano March 2, 2021, 12:36 p.m. UTC | #1
On 02/03/2021 10:54, Dmitry Osipenko wrote:
> Trusted Foundation firmware doesn't implement the do_idle call and in
> this case suspending should fall back to the common suspend path. In order
> to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
> firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
> C7 idling, like it was done by the older Tegra114 cpuidle driver.
> 
> Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
> Cc: stable@vger.kernel.org # 5.7+
> Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
> Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> Changelog:
> 
> v2: - No changes. V1 got no attention, hence re-sending.
> 
>  drivers/cpuidle/cpuidle-tegra.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
> index 191966dc8d02..29c5e83500d3 100644
> --- a/drivers/cpuidle/cpuidle-tegra.c
> +++ b/drivers/cpuidle/cpuidle-tegra.c
> @@ -135,13 +135,13 @@ static int tegra_cpuidle_c7_enter(void)
>  {
>  	int err;
>  
> -	if (tegra_cpuidle_using_firmware()) {
> -		err = call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2);
> -		if (err)
> -			return err;
> +	err = call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2);
> +	if (err && err != -ENOSYS)
> +		return err;
>  
> -		return call_firmware_op(do_idle, 0);
> -	}
> +	err = call_firmware_op(do_idle, 0);
> +	if (err != -ENOSYS)
> +		return err;
>  
>  	return cpu_suspend(0, tegra30_pm_secondary_cpu_suspend);
>  }
>
Rafael J. Wysocki March 4, 2021, 1:55 p.m. UTC | #2
On Thu, Mar 4, 2021 at 1:30 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> On 02/03/2021 10:54, Dmitry Osipenko wrote:
> > Trusted Foundation firmware doesn't implement the do_idle call and in
> > this case suspending should fall back to the common suspend path. In order
> > to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
> > firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
> > C7 idling, like it was done by the older Tegra114 cpuidle driver.
> >
> > Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
> > Cc: stable@vger.kernel.org # 5.7+
> > Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> > Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> > Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
> > Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
> > Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>
> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

So do I gather correctly that I am expected to pick up this series?
Daniel Lezcano March 4, 2021, 2:05 p.m. UTC | #3
On 04/03/2021 14:55, Rafael J. Wysocki wrote:
> On Thu, Mar 4, 2021 at 1:30 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>
>> On 02/03/2021 10:54, Dmitry Osipenko wrote:
>>> Trusted Foundation firmware doesn't implement the do_idle call and in
>>> this case suspending should fall back to the common suspend path. In order
>>> to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
>>> firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
>>> C7 idling, like it was done by the older Tegra114 cpuidle driver.
>>>
>>> Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
>>> Cc: stable@vger.kernel.org # 5.7+
>>> Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
>>> Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
>>> Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
>>> Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>
>> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> So do I gather correctly that I am expected to pick up this series?

I had picked the cpuidle related patches in the past. As the traffic
became low, I assumed you directly pick them.

But I can take care of them and send a PR at -rc5 like before,
especially that we have new driver coming. It is not a problem.

Let me know what is you preferred way.
Rafael J. Wysocki March 4, 2021, 2:08 p.m. UTC | #4
On Thu, Mar 4, 2021 at 3:05 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> On 04/03/2021 14:55, Rafael J. Wysocki wrote:
> > On Thu, Mar 4, 2021 at 1:30 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
> >>
> >> On 02/03/2021 10:54, Dmitry Osipenko wrote:
> >>> Trusted Foundation firmware doesn't implement the do_idle call and in
> >>> this case suspending should fall back to the common suspend path. In order
> >>> to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
> >>> firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
> >>> C7 idling, like it was done by the older Tegra114 cpuidle driver.
> >>>
> >>> Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
> >>> Cc: stable@vger.kernel.org # 5.7+
> >>> Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> >>> Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> >>> Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
> >>> Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
> >>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> >>
> >> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >
> > So do I gather correctly that I am expected to pick up this series?
>
> I had picked the cpuidle related patches in the past. As the traffic
> became low, I assumed you directly pick them.
>
> But I can take care of them and send a PR at -rc5 like before,
> especially that we have new driver coming. It is not a problem.
>
> Let me know what is you preferred way.

If you can take care of ARM-specific cpuidle changes, that'll help.

Thanks!
Daniel Lezcano March 4, 2021, 2:09 p.m. UTC | #5
On 04/03/2021 15:08, Rafael J. Wysocki wrote:
> On Thu, Mar 4, 2021 at 3:05 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>
>> On 04/03/2021 14:55, Rafael J. Wysocki wrote:
>>> On Thu, Mar 4, 2021 at 1:30 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>>>
>>>> On 02/03/2021 10:54, Dmitry Osipenko wrote:
>>>>> Trusted Foundation firmware doesn't implement the do_idle call and in
>>>>> this case suspending should fall back to the common suspend path. In order
>>>>> to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
>>>>> firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
>>>>> C7 idling, like it was done by the older Tegra114 cpuidle driver.
>>>>>
>>>>> Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
>>>>> Cc: stable@vger.kernel.org # 5.7+
>>>>> Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
>>>>> Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
>>>>> Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
>>>>> Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
>>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>>
>>>> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>
>>> So do I gather correctly that I am expected to pick up this series?
>>
>> I had picked the cpuidle related patches in the past. As the traffic
>> became low, I assumed you directly pick them.
>>
>> But I can take care of them and send a PR at -rc5 like before,
>> especially that we have new driver coming. It is not a problem.
>>
>> Let me know what is you preferred way.
> 
> If you can take care of ARM-specific cpuidle changes, that'll help.

No problem, thanks
Daniel Lezcano March 4, 2021, 2:21 p.m. UTC | #6
On 02/03/2021 10:54, Dmitry Osipenko wrote:
> Trusted Foundation firmware doesn't implement the do_idle call and in
> this case suspending should fall back to the common suspend path. In order
> to fix this issue we will unconditionally set the NOFLUSH_L2 mode via
> firmware call, which is a NO-OP on Tegra30/124, and then proceed to the
> C7 idling, like it was done by the older Tegra114 cpuidle driver.
> 
> Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver")
> Cc: stable@vger.kernel.org # 5.7+
> Reported-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> Tested-by: Anton Bambura <jenneron@protonmail.com> # TF701 T114
> Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
> Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
index 191966dc8d02..29c5e83500d3 100644
--- a/drivers/cpuidle/cpuidle-tegra.c
+++ b/drivers/cpuidle/cpuidle-tegra.c
@@ -135,13 +135,13 @@  static int tegra_cpuidle_c7_enter(void)
 {
 	int err;
 
-	if (tegra_cpuidle_using_firmware()) {
-		err = call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2);
-		if (err)
-			return err;
+	err = call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2);
+	if (err && err != -ENOSYS)
+		return err;
 
-		return call_firmware_op(do_idle, 0);
-	}
+	err = call_firmware_op(do_idle, 0);
+	if (err != -ENOSYS)
+		return err;
 
 	return cpu_suspend(0, tegra30_pm_secondary_cpu_suspend);
 }