public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is" failed to apply to 6.5-stable tree
@ 2023-11-22 18:52 gregkh
  2023-11-23  9:30 ` Stefan Wahren
  2023-11-23 13:06 ` [PATCH 6.5.y] soc: bcm: bcm2835-power: check if the ASB register is equal to enable Maíra Canal
  0 siblings, 2 replies; 4+ messages in thread
From: gregkh @ 2023-11-22 18:52 UTC (permalink / raw)
  To: mcanal, florian.fainelli, stefan.wahren, ulf.hansson; +Cc: stable


The patch below does not apply to the 6.5-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.5.y
git checkout FETCH_HEAD
git cherry-pick -x 2e75396f1df61e1f1d26d0d703fc7292c4ae4371
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2023112257-putdown-prozac-affa@gregkh' --subject-prefix 'PATCH 6.5.y' HEAD^..

Possible dependencies:

2e75396f1df6 ("pmdomain: bcm: bcm2835-power: check if the ASB register is equal to enable")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 2e75396f1df61e1f1d26d0d703fc7292c4ae4371 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
Date: Tue, 24 Oct 2023 07:10:40 -0300
Subject: [PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is
 equal to enable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
refactored the ASB control by using a general function to handle both
the enable and disable. But this patch introduced a subtle regression:
we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just
check if (readl(base + reg) & ASB_ACK) == true.

Currently, this is causing an invalid register state in V3D when
unloading and loading the driver, because `bcm2835_asb_disable()` will
return -ETIMEDOUT and `bcm2835_asb_power_off()` will fail to disable the
ASB slave for V3D.

Fixes: c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20231024101251.6357-2-mcanal@igalia.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
index 1a179d4e011c..d2f0233cb620 100644
--- a/drivers/pmdomain/bcm/bcm2835-power.c
+++ b/drivers/pmdomain/bcm/bcm2835-power.c
@@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
 	}
 	writel(PM_PASSWORD | val, base + reg);
 
-	while (readl(base + reg) & ASB_ACK) {
+	while (!!(readl(base + reg) & ASB_ACK) == enable) {
 		cpu_relax();
 		if (ktime_get_ns() - start >= 1000)
 			return -ETIMEDOUT;


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

* Re: FAILED: patch "[PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is" failed to apply to 6.5-stable tree
  2023-11-22 18:52 FAILED: patch "[PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is" failed to apply to 6.5-stable tree gregkh
@ 2023-11-23  9:30 ` Stefan Wahren
  2023-11-23 11:44   ` Maira Canal
  2023-11-23 13:06 ` [PATCH 6.5.y] soc: bcm: bcm2835-power: check if the ASB register is equal to enable Maíra Canal
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Wahren @ 2023-11-23  9:30 UTC (permalink / raw)
  To: gregkh, mcanal, florian.fainelli, ulf.hansson; +Cc: stable

Hi,

Am 22.11.23 um 19:52 schrieb gregkh@linuxfoundation.org:
>
> The patch below does not apply to the 6.5-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> To reproduce the conflict and resubmit, you may use the following commands:
>
> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.5.y
> git checkout FETCH_HEAD
> git cherry-pick -x 2e75396f1df61e1f1d26d0d703fc7292c4ae4371
> # <resolve conflicts, build, test, etc.>
> git commit -s
> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2023112257-putdown-prozac-affa@gregkh' --subject-prefix 'PATCH 6.5.y' HEAD^..
>
> Possible dependencies:
>
> 2e75396f1df6 ("pmdomain: bcm: bcm2835-power: check if the ASB register is equal to enable")

the reason why this doesn't apply is that the driver has been moved
recently from soc/bcm/ to pmdomain/bcm/ . In this tree the directory
pmdomain doesn't exist.

@Maíra Do you want to send the adapted patch to linux-stable?

https://www.kernel.org/doc/Documentation/process/stable-kernel-rules.rst

Best regards

>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
>  From 2e75396f1df61e1f1d26d0d703fc7292c4ae4371 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
> Date: Tue, 24 Oct 2023 07:10:40 -0300
> Subject: [PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is
>   equal to enable
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
> refactored the ASB control by using a general function to handle both
> the enable and disable. But this patch introduced a subtle regression:
> we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just
> check if (readl(base + reg) & ASB_ACK) == true.
>
> Currently, this is causing an invalid register state in V3D when
> unloading and loading the driver, because `bcm2835_asb_disable()` will
> return -ETIMEDOUT and `bcm2835_asb_power_off()` will fail to disable the
> ASB slave for V3D.
>
> Fixes: c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/20231024101251.6357-2-mcanal@igalia.com
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
> index 1a179d4e011c..d2f0233cb620 100644
> --- a/drivers/pmdomain/bcm/bcm2835-power.c
> +++ b/drivers/pmdomain/bcm/bcm2835-power.c
> @@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
>   	}
>   	writel(PM_PASSWORD | val, base + reg);
>
> -	while (readl(base + reg) & ASB_ACK) {
> +	while (!!(readl(base + reg) & ASB_ACK) == enable) {
>   		cpu_relax();
>   		if (ktime_get_ns() - start >= 1000)
>   			return -ETIMEDOUT;
>

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

* Re: FAILED: patch "[PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is" failed to apply to 6.5-stable tree
  2023-11-23  9:30 ` Stefan Wahren
@ 2023-11-23 11:44   ` Maira Canal
  0 siblings, 0 replies; 4+ messages in thread
From: Maira Canal @ 2023-11-23 11:44 UTC (permalink / raw)
  To: Stefan Wahren, gregkh, florian.fainelli, ulf.hansson; +Cc: stable

Hi Stefan,

On 11/23/23 06:30, Stefan Wahren wrote:
> Hi,
> 
> Am 22.11.23 um 19:52 schrieb gregkh@linuxfoundation.org:
>>
>> The patch below does not apply to the 6.5-stable tree.
>> If someone wants it applied there, or to any other stable or longterm
>> tree, then please email the backport, including the original git commit
>> id to <stable@vger.kernel.org>.
>>
>> To reproduce the conflict and resubmit, you may use the following 
>> commands:
>>
>> git fetch 
>> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ 
>> linux-6.5.y
>> git checkout FETCH_HEAD
>> git cherry-pick -x 2e75396f1df61e1f1d26d0d703fc7292c4ae4371
>> # <resolve conflicts, build, test, etc.>
>> git commit -s
>> git send-email --to '<stable@vger.kernel.org>' --in-reply-to 
>> '2023112257-putdown-prozac-affa@gregkh' --subject-prefix 'PATCH 6.5.y' 
>> HEAD^..
>>
>> Possible dependencies:
>>
>> 2e75396f1df6 ("pmdomain: bcm: bcm2835-power: check if the ASB register 
>> is equal to enable")
> 
> the reason why this doesn't apply is that the driver has been moved
> recently from soc/bcm/ to pmdomain/bcm/ . In this tree the directory
> pmdomain doesn't exist.
> 
> @Maíra Do you want to send the adapted patch to linux-stable?

Yeah, I will work on that.

Best Regards,
- Maíra

> 
> https://www.kernel.org/doc/Documentation/process/stable-kernel-rules.rst
> 
> Best regards
> 
>>
>> thanks,
>>
>> greg k-h
>>
>> ------------------ original commit in Linus's tree ------------------
>>
>>  From 2e75396f1df61e1f1d26d0d703fc7292c4ae4371 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
>> Date: Tue, 24 Oct 2023 07:10:40 -0300
>> Subject: [PATCH] pmdomain: bcm: bcm2835-power: check if the ASB 
>> register is
>>   equal to enable
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
>>
>> The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
>> refactored the ASB control by using a general function to handle both
>> the enable and disable. But this patch introduced a subtle regression:
>> we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just
>> check if (readl(base + reg) & ASB_ACK) == true.
>>
>> Currently, this is causing an invalid register state in V3D when
>> unloading and loading the driver, because `bcm2835_asb_disable()` will
>> return -ETIMEDOUT and `bcm2835_asb_power_off()` will fail to disable the
>> ASB slave for V3D.
>>
>> Fixes: c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
>> Signed-off-by: Maíra Canal <mcanal@igalia.com>
>> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
>> Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
>> Cc: stable@vger.kernel.org
>> Link: https://lore.kernel.org/r/20231024101251.6357-2-mcanal@igalia.com
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>
>> diff --git a/drivers/pmdomain/bcm/bcm2835-power.c 
>> b/drivers/pmdomain/bcm/bcm2835-power.c
>> index 1a179d4e011c..d2f0233cb620 100644
>> --- a/drivers/pmdomain/bcm/bcm2835-power.c
>> +++ b/drivers/pmdomain/bcm/bcm2835-power.c
>> @@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct 
>> bcm2835_power *power, u32 reg, bool enable
>>       }
>>       writel(PM_PASSWORD | val, base + reg);
>>
>> -    while (readl(base + reg) & ASB_ACK) {
>> +    while (!!(readl(base + reg) & ASB_ACK) == enable) {
>>           cpu_relax();
>>           if (ktime_get_ns() - start >= 1000)
>>               return -ETIMEDOUT;
>>

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

* [PATCH 6.5.y] soc: bcm: bcm2835-power: check if the ASB register is equal to enable
  2023-11-22 18:52 FAILED: patch "[PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is" failed to apply to 6.5-stable tree gregkh
  2023-11-23  9:30 ` Stefan Wahren
@ 2023-11-23 13:06 ` Maíra Canal
  1 sibling, 0 replies; 4+ messages in thread
From: Maíra Canal @ 2023-11-23 13:06 UTC (permalink / raw)
  To: stable; +Cc: Maíra Canal, Florian Fainelli, Stefan Wahren, Ulf Hansson

The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
refactored the ASB control by using a general function to handle both
the enable and disable. But this patch introduced a subtle regression:
we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just
check if (readl(base + reg) & ASB_ACK) == true.

Currently, this is causing an invalid register state in V3D when
unloading and loading the driver, because `bcm2835_asb_disable()` will
return -ETIMEDOUT and `bcm2835_asb_power_off()` will fail to disable the
ASB slave for V3D.

Fixes: c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20231024101251.6357-2-mcanal@igalia.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 2e75396f1df61e1f1d26d0d703fc7292c4ae4371)
---
 drivers/soc/bcm/bcm2835-power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c
index 1a179d4e011c..d2f0233cb620 100644
--- a/drivers/soc/bcm/bcm2835-power.c
+++ b/drivers/soc/bcm/bcm2835-power.c
@@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
 	}
 	writel(PM_PASSWORD | val, base + reg);

-	while (readl(base + reg) & ASB_ACK) {
+	while (!!(readl(base + reg) & ASB_ACK) == enable) {
 		cpu_relax();
 		if (ktime_get_ns() - start >= 1000)
 			return -ETIMEDOUT;
--
2.41.0


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

end of thread, other threads:[~2023-11-23 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 18:52 FAILED: patch "[PATCH] pmdomain: bcm: bcm2835-power: check if the ASB register is" failed to apply to 6.5-stable tree gregkh
2023-11-23  9:30 ` Stefan Wahren
2023-11-23 11:44   ` Maira Canal
2023-11-23 13:06 ` [PATCH 6.5.y] soc: bcm: bcm2835-power: check if the ASB register is equal to enable Maíra Canal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox