linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
@ 2022-04-28 18:30 Stefan Wahren
  2022-05-03 14:58 ` Maxime Ripard
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stefan Wahren @ 2022-04-28 18:30 UTC (permalink / raw)
  To: Florian Fainelli, Ray Jui, Scott Branden, Michael Turquette,
	Stephen Boyd
  Cc: bcm-kernel-feedback-list, Maxime Ripard, linux-clk,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, Stefan Wahren

The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
accidentially breaks the behavior of bcm2835_clock_choose_div() and
booting of Raspberry Pi. The removed do_div macro call had side effects,
so we need to restore it.

Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/clk/bcm/clk-bcm2835.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 3ad20e75fd23..48a1eb9f2d55 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -941,6 +941,7 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
 	u64 temp = (u64)parent_rate << CM_DIV_FRAC_BITS;
 	u32 div, mindiv, maxdiv;
 
+	do_div(temp, rate);
 	div = temp;
 	div &= ~unused_frac_mask;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
  2022-04-28 18:30 [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div Stefan Wahren
@ 2022-05-03 14:58 ` Maxime Ripard
  2022-05-07  9:26   ` Stefan Wahren
  2022-05-15  7:34 ` Thorsten Leemhuis
  2022-05-17  7:01 ` Stephen Boyd
  2 siblings, 1 reply; 7+ messages in thread
From: Maxime Ripard @ 2022-05-03 14:58 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Florian Fainelli, Ray Jui, Scott Branden, Michael Turquette,
	Stephen Boyd, bcm-kernel-feedback-list, linux-clk,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]

Hi,

On Thu, Apr 28, 2022 at 08:30:10PM +0200, Stefan Wahren wrote:
> The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> accidentially breaks the behavior of bcm2835_clock_choose_div() and
> booting of Raspberry Pi. The removed do_div macro call had side effects,
> so we need to restore it.
> 
> Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

I only found this patch after debugging why the HDMI driver was
returning -EINVAL at probe on -rc5.

Acked-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Maxime Ripard <maxime@cerno.tech>

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
  2022-05-03 14:58 ` Maxime Ripard
@ 2022-05-07  9:26   ` Stefan Wahren
  2022-05-10 13:27     ` Maxime Ripard
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Wahren @ 2022-05-07  9:26 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Florian Fainelli, Ray Jui, Scott Branden, Michael Turquette,
	Stephen Boyd, bcm-kernel-feedback-list, linux-clk,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

Am 03.05.22 um 16:58 schrieb Maxime Ripard:
> Hi,
>
> On Thu, Apr 28, 2022 at 08:30:10PM +0200, Stefan Wahren wrote:
>> The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
>> accidentially breaks the behavior of bcm2835_clock_choose_div() and
>> booting of Raspberry Pi. The removed do_div macro call had side effects,
>> so we need to restore it.
>>
>> Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> I only found this patch after debugging why the HDMI driver was
> returning -EINVAL at probe on -rc5.
>
> Acked-by: Maxime Ripard <maxime@cerno.tech>
> Tested-by: Maxime Ripard <maxime@cerno.tech>

Thanks,

does this go via clk-fixes?

>
> Thanks!
> Maxime

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
  2022-05-07  9:26   ` Stefan Wahren
@ 2022-05-10 13:27     ` Maxime Ripard
  2022-05-14  8:17       ` Stefan Wahren
  0 siblings, 1 reply; 7+ messages in thread
From: Maxime Ripard @ 2022-05-10 13:27 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Florian Fainelli, Ray Jui, Scott Branden, Michael Turquette,
	Stephen Boyd, bcm-kernel-feedback-list, linux-clk,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Sat, May 07, 2022 at 11:26:28AM +0200, Stefan Wahren wrote:
> Am 03.05.22 um 16:58 schrieb Maxime Ripard:
> > Hi,
> > 
> > On Thu, Apr 28, 2022 at 08:30:10PM +0200, Stefan Wahren wrote:
> > > The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> > > accidentially breaks the behavior of bcm2835_clock_choose_div() and
> > > booting of Raspberry Pi. The removed do_div macro call had side effects,
> > > so we need to restore it.
> > > 
> > > Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> > > Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> > I only found this patch after debugging why the HDMI driver was
> > returning -EINVAL at probe on -rc5.
> > 
> > Acked-by: Maxime Ripard <maxime@cerno.tech>
> > Tested-by: Maxime Ripard <maxime@cerno.tech>
> 
> Thanks,
> 
> does this go via clk-fixes?

Yep, it should.

Stephen, could we merge this?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
  2022-05-10 13:27     ` Maxime Ripard
@ 2022-05-14  8:17       ` Stefan Wahren
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2022-05-14  8:17 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Linus Torvalds
  Cc: Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-clk, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, Maxime Ripard, regressions

Hi,

Am 10.05.22 um 15:27 schrieb Maxime Ripard:
> On Sat, May 07, 2022 at 11:26:28AM +0200, Stefan Wahren wrote:
>> Am 03.05.22 um 16:58 schrieb Maxime Ripard:
>>> Hi,
>>>
>>> On Thu, Apr 28, 2022 at 08:30:10PM +0200, Stefan Wahren wrote:
>>>> The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
>>>> accidentially breaks the behavior of bcm2835_clock_choose_div() and
>>>> booting of Raspberry Pi. The removed do_div macro call had side effects,
>>>> so we need to restore it.
>>>>
>>>> Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>>> I only found this patch after debugging why the HDMI driver was
>>> returning -EINVAL at probe on -rc5.
>>>
>>> Acked-by: Maxime Ripard <maxime@cerno.tech>
>>> Tested-by: Maxime Ripard <maxime@cerno.tech>
>> Thanks,
>>
>> does this go via clk-fixes?
> Yep, it should.
>
> Stephen, could we merge this?
Is there any chance to get this regression fix into mainline before 5.18 
is released?
>
> Maxime

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
  2022-04-28 18:30 [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div Stefan Wahren
  2022-05-03 14:58 ` Maxime Ripard
@ 2022-05-15  7:34 ` Thorsten Leemhuis
  2022-05-17  7:01 ` Stephen Boyd
  2 siblings, 0 replies; 7+ messages in thread
From: Thorsten Leemhuis @ 2022-05-15  7:34 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: bcm-kernel-feedback-list, linux-clk, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

[TLDR: I'm adding this regression report to the list of tracked
regressions; all text from me you find below is based on a few templates
paragraphs you might have encountered already already in similar form.]

Hi, this is your Linux kernel regression tracker. Thx for CCing the
regression list in a later mail.

On 28.04.22 20:30, Stefan Wahren wrote:
> The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> accidentially breaks the behavior of bcm2835_clock_choose_div() and
> booting of Raspberry Pi. The removed do_div macro call had side effects,
> so we need to restore it.
> 
> Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

To be sure the issue doesn't fall through the cracks unnoticed as it
mentioned in the weekly reports, I'm adding it to regzbot, my Linux
kernel regression tracking bot:

#regzbot ^introduced 09e3b18ca5de
#regzbot title clk: bcm2835: 09e3b18ca5de broke the behavior of
bcm2835_clock_choose_div() and booting of Raspberry Pi booting of
Raspberry Pi
#regzbot ignore-activity


> ---
>  drivers/clk/bcm/clk-bcm2835.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> index 3ad20e75fd23..48a1eb9f2d55 100644
> --- a/drivers/clk/bcm/clk-bcm2835.c
> +++ b/drivers/clk/bcm/clk-bcm2835.c
> @@ -941,6 +941,7 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
>  	u64 temp = (u64)parent_rate << CM_DIV_FRAC_BITS;
>  	u32 div, mindiv, maxdiv;
>  
> +	do_div(temp, rate);
>  	div = temp;
>  	div &= ~unused_frac_mask;
>  

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)

P.S.: As the Linux kernel's regression tracker I deal with a lot of
reports and sometimes miss something important when writing mails like
this. If that's the case here, don't hesitate to tell me in a public
reply, it's in everyone's interest to set the public record straight.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div
  2022-04-28 18:30 [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div Stefan Wahren
  2022-05-03 14:58 ` Maxime Ripard
  2022-05-15  7:34 ` Thorsten Leemhuis
@ 2022-05-17  7:01 ` Stephen Boyd
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2022-05-17  7:01 UTC (permalink / raw)
  To: Florian Fainelli, Michael Turquette, Ray Jui, Scott Branden,
	Stefan Wahren
  Cc: bcm-kernel-feedback-list, Maxime Ripard, linux-clk,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, Stefan Wahren

Quoting Stefan Wahren (2022-04-28 11:30:10)
> The commit 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> accidentially breaks the behavior of bcm2835_clock_choose_div() and
> booting of Raspberry Pi. The removed do_div macro call had side effects,
> so we need to restore it.
> 
> Fixes: 09e3b18ca5de ("clk: bcm2835: Remove unused variable")
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---

Applied to clk-fixes

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-17  7:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 18:30 [PATCH] clk: bcm2835: fix bcm2835_clock_choose_div Stefan Wahren
2022-05-03 14:58 ` Maxime Ripard
2022-05-07  9:26   ` Stefan Wahren
2022-05-10 13:27     ` Maxime Ripard
2022-05-14  8:17       ` Stefan Wahren
2022-05-15  7:34 ` Thorsten Leemhuis
2022-05-17  7:01 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).