summaryrefslogtreecommitdiffstats
path: root/meta-yocto-bsp
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-02-11 11:56:43 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-18 11:08:36 +0000
commit959db9cb12c19c81c1114b09d8f3eadf9831d280 (patch)
tree0aa69d3424de46532b94a8a6535c0557dbc37a42 /meta-yocto-bsp
parent2ae32dae580105156a151fa3dc7cbfe8673636e5 (diff)
downloadpoky-959db9cb12c19c81c1114b09d8f3eadf9831d280.tar.gz
linux-yocto: revert omap8250 power management changes on genericarm64
The genericarm64 machine sets SERIAL_CONSOLES to a number of potential devices: SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0 115200;ttyS0 115200;ttyS1 115200;ttyS2" With sysvinit this turns into getty lines in inittab, and with systemd the systemd-serialgetty recipe creates explicit units to spawn gettys. This worked fine with 6.6, but since "serial: 8250_omap: Drop pm_runtime_irq_safe()"[1] in 6.7 onwards we see kernel hangs: BUG: scheduling while atomic: getty/957/0x00000002 Call trace: dump_stack+0x1c/0x30 __schedule_bug+0x60/0x90 __schedule+0x83c/0xcf8 schedule+0x40/0x158 schedule_timeout+0xb0/0x1b0 wait_for_completion_timeout+0x84/0x188 ti_sci_set_device_state+0x134/0x220 ti_sci_cmd_get_device_exclusive+0x24/0x40 ti_sci_pd_power_on+0x34/0x68 [ti_sci_pm_domains] _genpd_power_on+0xa4/0x178 genpd_power_on+0xb4/0x190 genpd_runtime_resume+0xc8/0x260 __rpm_callback+0x54/0x200 rpm_callback+0x78/0x90 rpm_resume+0x420/0x690 __pm_runtime_resume+0x5c/0xb0 omap8250_set_mctrl+0x38/0xe0 [8250_omap] serial8250_set_mctrl+0x2c/0x60 uart_update_mctrl+0x98/0x120 uart_shutdown+0x124/0x180 uart_hangup+0x7c/0x180 __tty_hangup.part.0+0x408/0x440 tty_vhangup_session+0x24/0x40 disassociate_ctty.part.0+0x48/0x1b0 disassociate_ctty+0x30/0x48 (full backtrace elided) With many thanks to TI, my understanding is that it was determined that the problem here is that we have a getty connected to ttyS1 which is actually the expansion port uart and on the BeaglePlay wired up to the wifi controller's debug port. The getty receives noise it doesn't know what to do with, and at some point the power management code does a suspend/result cycle of the device. The serial drivers assume that child nodes use the serdev driver and they manage runtime_pm, but the getty opening the tty breaks a series of bad assumptions in the drivers. So, there are two bugs: 1) The kernel shouldn't crash if this tty is opened 2) The only serial port for a console on the BeaglePlay is ttyS2, despite others existing. TI are looking at (1) and other patches to follow will deal with (2). Until one of these is resolved entirely, reverting this change to power management stops the crashes. [ YOCTO #15704 ] [1] linux 8700a7ea5519fb0b3bad2362adfeac358c2119ce (From meta-yocto rev: 49519579f8b6bacf181d2f00bdd256e71d0880c4) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-yocto-bsp')
-rw-r--r--meta-yocto-bsp/recipes-kernel/linux/files/0001-Revert-serial-8250_omap-Drop-pm_runtime_irq_safe.patch130
-rw-r--r--meta-yocto-bsp/recipes-kernel/linux/linux-yocto_6.12.bbappend2
2 files changed, 132 insertions, 0 deletions
diff --git a/meta-yocto-bsp/recipes-kernel/linux/files/0001-Revert-serial-8250_omap-Drop-pm_runtime_irq_safe.patch b/meta-yocto-bsp/recipes-kernel/linux/files/0001-Revert-serial-8250_omap-Drop-pm_runtime_irq_safe.patch
new file mode 100644
index 0000000000..8837dd2346
--- /dev/null
+++ b/meta-yocto-bsp/recipes-kernel/linux/files/0001-Revert-serial-8250_omap-Drop-pm_runtime_irq_safe.patch
@@ -0,0 +1,130 @@
1From cc255f5132cf39e9154340cf58780f8c763c6481 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Thu, 23 Jan 2025 17:06:08 +0000
4Subject: [PATCH] Revert "serial: 8250_omap: Drop pm_runtime_irq_safe()"
5
6This reverts commit 8700a7ea5519fb0b3bad2362adfeac358c2119ce.
7
8Upstream-Status: Inappropriate
9Signed-off-by: Ross Burton <ross.burton@arm.com>
10---
11 drivers/tty/serial/8250/8250_omap.c | 29 ++++++++---------------------
12 1 file changed, 8 insertions(+), 21 deletions(-)
13
14diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
15index 0dd68bdbfbcf7..db24d7d1dcb67 100644
16--- a/drivers/tty/serial/8250/8250_omap.c
17+++ b/drivers/tty/serial/8250/8250_omap.c
18@@ -8,7 +8,6 @@
19 *
20 */
21
22-#include <linux/atomic.h>
23 #include <linux/clk.h>
24 #include <linux/device.h>
25 #include <linux/io.h>
26@@ -134,7 +133,6 @@ struct omap8250_priv {
27
28 u8 tx_trigger;
29 u8 rx_trigger;
30- atomic_t active;
31 bool is_suspending;
32 int wakeirq;
33 u32 latency;
34@@ -636,23 +634,14 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
35 unsigned int iir, lsr;
36 int ret;
37
38- pm_runtime_get_noresume(port->dev);
39-
40- /* Shallow idle state wake-up to an IO interrupt? */
41- if (atomic_add_unless(&priv->active, 1, 1)) {
42- priv->latency = priv->calc_latency;
43- schedule_work(&priv->qos_work);
44- }
45-
46 #ifdef CONFIG_SERIAL_8250_DMA
47 if (up->dma) {
48 ret = omap_8250_dma_handle_irq(port);
49- pm_runtime_mark_last_busy(port->dev);
50- pm_runtime_put(port->dev);
51 return IRQ_RETVAL(ret);
52 }
53 #endif
54
55+ serial8250_rpm_get(up);
56 lsr = serial_port_in(port, UART_LSR);
57 iir = serial_port_in(port, UART_IIR);
58 ret = serial8250_handle_irq(port, iir);
59@@ -701,8 +690,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
60 schedule_delayed_work(&up->overrun_backoff, delay);
61 }
62
63- pm_runtime_mark_last_busy(port->dev);
64- pm_runtime_put(port->dev);
65+ serial8250_rpm_put(up);
66
67 return IRQ_RETVAL(ret);
68 }
69@@ -1314,8 +1302,11 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
70 u16 status;
71 u8 iir;
72
73+ serial8250_rpm_get(up);
74+
75 iir = serial_port_in(port, UART_IIR);
76 if (iir & UART_IIR_NO_INT) {
77+ serial8250_rpm_put(up);
78 return IRQ_HANDLED;
79 }
80
81@@ -1348,6 +1339,7 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
82
83 uart_unlock_and_check_sysrq(port);
84
85+ serial8250_rpm_put(up);
86 return 1;
87 }
88
89@@ -1539,6 +1531,8 @@ static int omap8250_probe(struct platform_device *pdev)
90 if (!of_get_available_child_count(pdev->dev.of_node))
91 pm_runtime_set_autosuspend_delay(&pdev->dev, -1);
92
93+ pm_runtime_irq_safe(&pdev->dev);
94+
95 pm_runtime_get_sync(&pdev->dev);
96
97 omap_serial_fill_features_erratas(&up, priv);
98@@ -1776,7 +1770,6 @@ static int omap8250_runtime_suspend(struct device *dev)
99
100 priv->latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE;
101 schedule_work(&priv->qos_work);
102- atomic_set(&priv->active, 0);
103
104 return 0;
105 }
106@@ -1786,10 +1779,6 @@ static int omap8250_runtime_resume(struct device *dev)
107 struct omap8250_priv *priv = dev_get_drvdata(dev);
108 struct uart_8250_port *up = NULL;
109
110- /* Did the hardware wake to a device IO interrupt before a wakeirq? */
111- if (atomic_read(&priv->active))
112- return 0;
113-
114 if (priv->line >= 0)
115 up = serial8250_get_port(priv->line);
116
117@@ -1805,10 +1794,8 @@ static int omap8250_runtime_resume(struct device *dev)
118 uart_port_unlock_irq(&up->port);
119 }
120
121- atomic_set(&priv->active, 1);
122 priv->latency = priv->calc_latency;
123 schedule_work(&priv->qos_work);
124-
125 return 0;
126 }
127
128--
1292.43.0
130
diff --git a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_6.12.bbappend b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_6.12.bbappend
index 1ffd2194d9..831cb556be 100644
--- a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_6.12.bbappend
+++ b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_6.12.bbappend
@@ -7,3 +7,5 @@ KMACHINE:beaglebone-yocto ?= "beaglebone"
7KMACHINE:genericx86 ?= "common-pc" 7KMACHINE:genericx86 ?= "common-pc"
8KMACHINE:genericx86-64 ?= "common-pc-64" 8KMACHINE:genericx86-64 ?= "common-pc-64"
9 9
10FILESEXTRAPATHS:prepend:genericarm64 := "${THISDIR}/files:"
11SRC_URI:append:genericarm64 = " file://0001-Revert-serial-8250_omap-Drop-pm_runtime_irq_safe.patch"