]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pmdomain: bcm: bcm2835-power: Increase ASB control timeout
authorMaíra Canal <mcanal@igalia.com>
Tue, 17 Mar 2026 22:41:49 +0000 (19:41 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:48 +0000 (11:08 +0100)
commit b826d2c0b0ecb844c84431ba6b502e744f5d919a upstream.

The bcm2835_asb_control() function uses a tight polling loop to wait
for the ASB bridge to acknowledge a request. During intensive workloads,
this handshake intermittently fails for V3D's master ASB on BCM2711,
resulting in "Failed to disable ASB master for v3d" errors during
runtime PM suspend. As a consequence, the failed power-off leaves V3D in
a broken state, leading to bus faults or system hangs on later accesses.

As the timeout is insufficient in some scenarios, increase the polling
timeout from 1us to 5us, which is still negligible in the context of a
power domain transition. Also, replace the open-coded ktime_get_ns()/
cpu_relax() polling loop with readl_poll_timeout_atomic().

Cc: stable@vger.kernel.org
Fixes: 670c672608a1 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pmdomain/bcm/bcm2835-power.c

index 12d098a13f148960f68b0740ee5d8ed5cf224b79..20130549a7a537101ddf3c855b04d429eb698995 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/mfd/bcm2835-pm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -152,7 +153,6 @@ struct bcm2835_power {
 static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable)
 {
        void __iomem *base = power->asb;
-       u64 start;
        u32 val;
 
        switch (reg) {
@@ -165,8 +165,6 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
                break;
        }
 
-       start = ktime_get_ns();
-
        /* Enable the module's async AXI bridges. */
        if (enable) {
                val = readl(base + reg) & ~ASB_REQ_STOP;
@@ -175,11 +173,9 @@ 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) == enable) {
-               cpu_relax();
-               if (ktime_get_ns() - start >= 1000)
-                       return -ETIMEDOUT;
-       }
+       if (readl_poll_timeout_atomic(base + reg, val,
+                                     !!(val & ASB_ACK) != enable, 0, 5))
+               return -ETIMEDOUT;
 
        return 0;
 }