2017-11-06 18:11:51 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2007-08-20 08:59:33 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-25 11:42:56 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-23 11:43:13 +01:00
|
|
|
|
2008-04-25 16:04:20 +09:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
|
|
|
|
|
2025-10-23 11:43:12 +01:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
2011-08-02 09:42:54 +00:00
|
|
|
|
2025-10-23 11:43:12 +01:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-23 11:43:13 +01:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
2023-03-17 15:04:03 +00:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
2025-10-23 11:43:12 +01:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
|
|
|
|
|
2025-10-23 11:43:13 +01:00
|
|
|
|
2013-12-06 10:59:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-25 16:04:20 +09:00
|
|
|
|
|
|
|
|
|
2019-10-03 11:29:12 +02:00
|
|
|
|
2025-10-23 11:43:12 +01:00
|
|
|
|
2006-02-01 03:06:06 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2025-10-23 11:43:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serial: sh-sci: Add support for SCIFA/SCIFB variable sampling rates
Add support for sparse variable sampling rates on SCIFA and SCIFB.
According to the datasheet, sampling rate 1/5 needs a small quirk to
avoid corrupting the first byte received.
This increases the range and accuracy of supported baud rates.
E.g. on r8a7791/koelsch:
- Supports now 134, 150, and standard 500000-4000000 bps,
- Perfect match for 134, 150, 500000, 1000000, 2000000, and 4000000
bps,
- Accuracy has increased for most standard bps values.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-04 14:45:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
serial: sh-sci: Save and restore more registers
On (H)SCIF with a Baud Rate Generator for External Clock (BRG), there
are multiple ways to configure the requested serial speed. If firmware
uses a different method than Linux, and if any debug info is printed
after the Bit Rate Register (SCBRR) is restored, but before termios is
reconfigured (which configures the alternative method), the system may
lock-up during resume.
Fix this by saving and restoring the contents of the BRG Frequency
Division (SCDL) and Clock Select (SCCKS) registers as well.
Also save and restore the HSCIF's Sampling Rate Register (HSSRR), which
configures the sampling point, and the SCIFA/SCIFB's Serial Port Control
and Data Registers (SCPCR/SCPDR), which configure the optional control
flow signals.
After this, all registers that are not saved/restored are either:
- read-only,
- write-only,
- status registers containing flags with clear-after-set semantics,
- FIFO Data Count Trigger registers, which do not matter much for
the serial console.
Fixes: 22a6984c5b5df8ea ("serial: sh-sci: Update the suspend/resume support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/11c2eab45d48211e75d8b8202cce60400880fe55.1741114989.git.geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-04 20:06:11 +01:00
|
|
|
|
|
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serial: sh-sci: Save and restore more registers
On (H)SCIF with a Baud Rate Generator for External Clock (BRG), there
are multiple ways to configure the requested serial speed. If firmware
uses a different method than Linux, and if any debug info is printed
after the Bit Rate Register (SCBRR) is restored, but before termios is
reconfigured (which configures the alternative method), the system may
lock-up during resume.
Fix this by saving and restoring the contents of the BRG Frequency
Division (SCDL) and Clock Select (SCCKS) registers as well.
Also save and restore the HSCIF's Sampling Rate Register (HSSRR), which
configures the sampling point, and the SCIFA/SCIFB's Serial Port Control
and Data Registers (SCPCR/SCPDR), which configure the optional control
flow signals.
After this, all registers that are not saved/restored are either:
- read-only,
- write-only,
- status registers containing flags with clear-after-set semantics,
- FIFO Data Count Trigger registers, which do not matter much for
the serial console.
Fixes: 22a6984c5b5df8ea ("serial: sh-sci: Update the suspend/resume support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/11c2eab45d48211e75d8b8202cce60400880fe55.1741114989.git.geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-04 20:06:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:32 +02:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
2011-10-03 15:16:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-10-03 15:16:47 +01:00
|
|
|
|
|
|
|
|
|
2018-08-30 14:54:03 +02:00
|
|
|
|
2025-04-03 23:29:09 +02:00
|
|
|
|
2018-08-30 14:54:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
2018-08-30 14:54:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2018-08-30 14:54:03 +02:00
|
|
|
|
|
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
2018-08-30 14:54:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2015-11-12 13:36:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-02 18:10:14 +01:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:17 +01:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:34 +02:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2023-04-12 15:50:49 +01:00
|
|
|
|
2023-07-04 16:48:18 +01:00
|
|
|
|
2023-04-12 15:50:49 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2023-04-12 15:50:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2023-04-12 15:50:51 +01:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2021-06-10 20:08:06 +09:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:08:06 +09:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:25 +02:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:25 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2015-08-21 20:02:25 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-08-21 20:02:25 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-08-21 20:02:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
2008-12-17 14:53:24 +09:00
|
|
|
|
|
|
|
|
|
2008-12-11 19:06:43 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2010-05-20 21:04:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-11 19:06:43 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2008-12-11 19:06:43 +09:00
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-17 14:53:24 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-12-11 19:06:43 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
2007-08-20 08:59:33 +09:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-20 08:59:33 +09:00
|
|
|
|
2006-02-01 03:06:06 -08:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-03-28 11:13:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-03-28 11:13:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:08 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-12-02 17:44:50 +09:00
|
|
|
|
2008-12-16 20:07:27 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2009-06-24 19:44:32 +09:00
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
2009-06-24 19:44:32 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-01-20 23:26:18 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-01-03 15:53:01 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-03 15:53:01 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2017-01-11 16:43:38 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
2020-03-27 18:17:28 +00:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2020-03-27 18:17:28 +00:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2020-03-27 18:17:28 +00:00
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 14:55:46 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
|
|
|
|
|
2008-12-16 18:55:26 +09:00
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-03 15:53:06 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-02-15 13:02:27 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-20 23:26:18 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-06-08 18:19:37 +09:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-12-06 10:59:17 +01:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
2013-12-06 10:59:17 +01:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
2013-12-06 10:59:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2017-01-11 16:43:38 +02:00
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2017-01-11 16:43:38 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
|
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
2013-01-03 15:53:06 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:06 +00:00
|
|
|
|
|
|
|
|
|
2026-03-12 08:26:59 +00:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:06 +00:00
|
|
|
|
|
|
|
|
|
2011-01-20 23:26:18 +09:00
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
2011-06-08 18:19:37 +09:00
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2015-04-30 18:21:32 +02:00
|
|
|
|
tty: serial: sh-sci: fix RSCI FIFO overrun handling
The receive error handling code is shared between RSCI and all other
SCIF port types, but the RSCI overrun_reg is specified as a memory
offset, while for other SCIF types it is an enum value used to index
into the sci_port_params->regs array, as mentioned above the
sci_serial_in() function.
For RSCI, the overrun_reg is CSR (0x48), causing the sci_getreg() call
inside the sci_handle_fifo_overrun() function to index outside the
bounds of the regs array, which currently has a size of 20, as specified
by SCI_NR_REGS.
Because of this, we end up accessing memory outside of RSCI's
rsci_port_params structure, which, when interpreted as a plat_sci_reg,
happens to have a non-zero size, causing the following WARN when
sci_serial_in() is called, as the accidental size does not match the
supported register sizes.
The existence of the overrun_reg needs to be checked because
SCIx_SH3_SCIF_REGTYPE has overrun_reg set to SCLSR, but SCLSR is not
present in the regs array.
Avoid calling sci_getreg() for port types which don't use standard
register handling.
Use the ops->read_reg() and ops->write_reg() functions to properly read
and write registers for RSCI, and change the type of the status variable
to accommodate the 32-bit CSR register.
sci_getreg() and sci_serial_in() are also called with overrun_reg in the
sci_mpxed_interrupt() interrupt handler, but that code path is not used
for RSCI, as it does not have a muxed interrupt.
------------[ cut here ]------------
Invalid register access
WARNING: CPU: 0 PID: 0 at drivers/tty/serial/sh-sci.c:522 sci_serial_in+0x38/0xac
Modules linked in: renesas_usbhs at24 rzt2h_adc industrialio_adc sha256 cfg80211 bluetooth ecdh_generic ecc rfkill fuse drm backlight ipv6
CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.17.0-rc1+ #30 PREEMPT
Hardware name: Renesas RZ/T2H EVK Board based on r9a09g077m44 (DT)
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : sci_serial_in+0x38/0xac
lr : sci_serial_in+0x38/0xac
sp : ffff800080003e80
x29: ffff800080003e80 x28: ffff800082195b80 x27: 000000000000000d
x26: ffff8000821956d0 x25: 0000000000000000 x24: ffff800082195b80
x23: ffff000180e0d800 x22: 0000000000000010 x21: 0000000000000000
x20: 0000000000000010 x19: ffff000180e72000 x18: 000000000000000a
x17: ffff8002bcee7000 x16: ffff800080000000 x15: 0720072007200720
x14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720
x11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000821a6a48
x8 : 0000000000057fa8 x7 : 0000000000000406 x6 : ffff8000821fea48
x5 : ffff00033ef88408 x4 : ffff8002bcee7000 x3 : ffff800082195b80
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff800082195b80
Call trace:
sci_serial_in+0x38/0xac (P)
sci_handle_fifo_overrun.isra.0+0x70/0x134
sci_er_interrupt+0x50/0x39c
__handle_irq_event_percpu+0x48/0x140
handle_irq_event+0x44/0xb0
handle_fasteoi_irq+0xf4/0x1a0
handle_irq_desc+0x34/0x58
generic_handle_domain_irq+0x1c/0x28
gic_handle_irq+0x4c/0x140
call_on_irq_stack+0x30/0x48
do_interrupt_handler+0x80/0x84
el1_interrupt+0x34/0x68
el1h_64_irq_handler+0x18/0x24
el1h_64_irq+0x6c/0x70
default_idle_call+0x28/0x58 (P)
do_idle+0x1f8/0x250
cpu_startup_entry+0x34/0x3c
rest_init+0xd8/0xe0
console_on_rootfs+0x0/0x6c
__primary_switched+0x88/0x90
---[ end trace 0000000000000000 ]---
Cc: stable <stable@kernel.org>
Fixes: 0666e3fe95ab ("serial: sh-sci: Add support for RZ/T2H SCI")
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20250923154707.1089900-1-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-23 18:47:06 +03:00
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
2025-11-29 16:43:06 +00:00
|
|
|
|
tty: serial: sh-sci: fix RSCI FIFO overrun handling
The receive error handling code is shared between RSCI and all other
SCIF port types, but the RSCI overrun_reg is specified as a memory
offset, while for other SCIF types it is an enum value used to index
into the sci_port_params->regs array, as mentioned above the
sci_serial_in() function.
For RSCI, the overrun_reg is CSR (0x48), causing the sci_getreg() call
inside the sci_handle_fifo_overrun() function to index outside the
bounds of the regs array, which currently has a size of 20, as specified
by SCI_NR_REGS.
Because of this, we end up accessing memory outside of RSCI's
rsci_port_params structure, which, when interpreted as a plat_sci_reg,
happens to have a non-zero size, causing the following WARN when
sci_serial_in() is called, as the accidental size does not match the
supported register sizes.
The existence of the overrun_reg needs to be checked because
SCIx_SH3_SCIF_REGTYPE has overrun_reg set to SCLSR, but SCLSR is not
present in the regs array.
Avoid calling sci_getreg() for port types which don't use standard
register handling.
Use the ops->read_reg() and ops->write_reg() functions to properly read
and write registers for RSCI, and change the type of the status variable
to accommodate the 32-bit CSR register.
sci_getreg() and sci_serial_in() are also called with overrun_reg in the
sci_mpxed_interrupt() interrupt handler, but that code path is not used
for RSCI, as it does not have a muxed interrupt.
------------[ cut here ]------------
Invalid register access
WARNING: CPU: 0 PID: 0 at drivers/tty/serial/sh-sci.c:522 sci_serial_in+0x38/0xac
Modules linked in: renesas_usbhs at24 rzt2h_adc industrialio_adc sha256 cfg80211 bluetooth ecdh_generic ecc rfkill fuse drm backlight ipv6
CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.17.0-rc1+ #30 PREEMPT
Hardware name: Renesas RZ/T2H EVK Board based on r9a09g077m44 (DT)
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : sci_serial_in+0x38/0xac
lr : sci_serial_in+0x38/0xac
sp : ffff800080003e80
x29: ffff800080003e80 x28: ffff800082195b80 x27: 000000000000000d
x26: ffff8000821956d0 x25: 0000000000000000 x24: ffff800082195b80
x23: ffff000180e0d800 x22: 0000000000000010 x21: 0000000000000000
x20: 0000000000000010 x19: ffff000180e72000 x18: 000000000000000a
x17: ffff8002bcee7000 x16: ffff800080000000 x15: 0720072007200720
x14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720
x11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000821a6a48
x8 : 0000000000057fa8 x7 : 0000000000000406 x6 : ffff8000821fea48
x5 : ffff00033ef88408 x4 : ffff8002bcee7000 x3 : ffff800082195b80
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff800082195b80
Call trace:
sci_serial_in+0x38/0xac (P)
sci_handle_fifo_overrun.isra.0+0x70/0x134
sci_er_interrupt+0x50/0x39c
__handle_irq_event_percpu+0x48/0x140
handle_irq_event+0x44/0xb0
handle_fasteoi_irq+0xf4/0x1a0
handle_irq_desc+0x34/0x58
generic_handle_domain_irq+0x1c/0x28
gic_handle_irq+0x4c/0x140
call_on_irq_stack+0x30/0x48
do_interrupt_handler+0x80/0x84
el1_interrupt+0x34/0x68
el1h_64_irq_handler+0x18/0x24
el1h_64_irq+0x6c/0x70
default_idle_call+0x28/0x58 (P)
do_idle+0x1f8/0x250
cpu_startup_entry+0x34/0x3c
rest_init+0xd8/0xe0
console_on_rootfs+0x0/0x6c
__primary_switched+0x88/0x90
---[ end trace 0000000000000000 ]---
Cc: stable <stable@kernel.org>
Fixes: 0666e3fe95ab ("serial: sh-sci: Add support for RZ/T2H SCI")
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20250923154707.1089900-1-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-23 18:47:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
tty: serial: sh-sci: fix RSCI FIFO overrun handling
The receive error handling code is shared between RSCI and all other
SCIF port types, but the RSCI overrun_reg is specified as a memory
offset, while for other SCIF types it is an enum value used to index
into the sci_port_params->regs array, as mentioned above the
sci_serial_in() function.
For RSCI, the overrun_reg is CSR (0x48), causing the sci_getreg() call
inside the sci_handle_fifo_overrun() function to index outside the
bounds of the regs array, which currently has a size of 20, as specified
by SCI_NR_REGS.
Because of this, we end up accessing memory outside of RSCI's
rsci_port_params structure, which, when interpreted as a plat_sci_reg,
happens to have a non-zero size, causing the following WARN when
sci_serial_in() is called, as the accidental size does not match the
supported register sizes.
The existence of the overrun_reg needs to be checked because
SCIx_SH3_SCIF_REGTYPE has overrun_reg set to SCLSR, but SCLSR is not
present in the regs array.
Avoid calling sci_getreg() for port types which don't use standard
register handling.
Use the ops->read_reg() and ops->write_reg() functions to properly read
and write registers for RSCI, and change the type of the status variable
to accommodate the 32-bit CSR register.
sci_getreg() and sci_serial_in() are also called with overrun_reg in the
sci_mpxed_interrupt() interrupt handler, but that code path is not used
for RSCI, as it does not have a muxed interrupt.
------------[ cut here ]------------
Invalid register access
WARNING: CPU: 0 PID: 0 at drivers/tty/serial/sh-sci.c:522 sci_serial_in+0x38/0xac
Modules linked in: renesas_usbhs at24 rzt2h_adc industrialio_adc sha256 cfg80211 bluetooth ecdh_generic ecc rfkill fuse drm backlight ipv6
CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.17.0-rc1+ #30 PREEMPT
Hardware name: Renesas RZ/T2H EVK Board based on r9a09g077m44 (DT)
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : sci_serial_in+0x38/0xac
lr : sci_serial_in+0x38/0xac
sp : ffff800080003e80
x29: ffff800080003e80 x28: ffff800082195b80 x27: 000000000000000d
x26: ffff8000821956d0 x25: 0000000000000000 x24: ffff800082195b80
x23: ffff000180e0d800 x22: 0000000000000010 x21: 0000000000000000
x20: 0000000000000010 x19: ffff000180e72000 x18: 000000000000000a
x17: ffff8002bcee7000 x16: ffff800080000000 x15: 0720072007200720
x14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720
x11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000821a6a48
x8 : 0000000000057fa8 x7 : 0000000000000406 x6 : ffff8000821fea48
x5 : ffff00033ef88408 x4 : ffff8002bcee7000 x3 : ffff800082195b80
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff800082195b80
Call trace:
sci_serial_in+0x38/0xac (P)
sci_handle_fifo_overrun.isra.0+0x70/0x134
sci_er_interrupt+0x50/0x39c
__handle_irq_event_percpu+0x48/0x140
handle_irq_event+0x44/0xb0
handle_fasteoi_irq+0xf4/0x1a0
handle_irq_desc+0x34/0x58
generic_handle_domain_irq+0x1c/0x28
gic_handle_irq+0x4c/0x140
call_on_irq_stack+0x30/0x48
do_interrupt_handler+0x80/0x84
el1_interrupt+0x34/0x68
el1h_64_irq_handler+0x18/0x24
el1h_64_irq+0x6c/0x70
default_idle_call+0x28/0x58 (P)
do_idle+0x1f8/0x250
cpu_startup_entry+0x34/0x3c
rest_init+0xd8/0xe0
console_on_rootfs+0x0/0x6c
__primary_switched+0x88/0x90
---[ end trace 0000000000000000 ]---
Cc: stable <stable@kernel.org>
Fixes: 0666e3fe95ab ("serial: sh-sci: Add support for RZ/T2H SCI")
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20250923154707.1089900-1-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-23 18:47:06 +03:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
2025-11-29 16:43:06 +00:00
|
|
|
|
2025-11-14 10:13:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
|
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
2013-01-03 15:53:06 +01:00
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-20 23:26:18 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-03-14 13:22:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:38 +02:00
|
|
|
|
2011-11-24 19:15:06 +09:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
[PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.
This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.
When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.
For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).
Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.
The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.
I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.
Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.
Description:
tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted
There are also
tty_buffer_request_room(tty, len)
which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.
and tty_insert_flip_string_flags(tty, str, flags, len)
to insert a string of characters and flags
For a smart interface the usual code is
len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);
More description!
At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)
I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.
So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.
At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say
int tty_buffer_request_room(tty, size)
Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.
int tty_insert_flip_char(tty, ch, flag)
As before insert a character if there is room. Now returns 1 for success, 0
for failure.
int tty_insert_flip_string(tty, str, len)
Insert a block of non error characters. Returns the number inserted.
int tty_prepare_flip_string(tty, strptr, len)
Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-09 20:54:13 -08:00
|
|
|
|
2013-01-03 15:53:06 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-02 18:10:16 +01:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-02-02 18:10:16 +01:00
|
|
|
|
|
|
|
|
|
2021-05-10 14:07:55 +02:00
|
|
|
|
|
|
|
|
|
2017-02-02 18:10:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2017-02-02 18:10:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-02-02 18:10:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-02 18:10:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 14:43:17 -07:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2025-05-09 07:51:14 +02:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
2019-07-31 14:45:55 +02:00
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-31 14:45:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-17 11:34:23 +03:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
2017-07-17 11:34:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-08 18:31:14 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2017-02-08 18:31:14 +01:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-31 14:45:55 +02:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-17 11:34:23 +03:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
2017-07-17 11:34:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 14:43:17 -07:00
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 10:15:07 -08:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2022-10-19 12:11:39 +03:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2023-04-12 15:50:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-07 16:56:50 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-06 13:40:18 +02:00
|
|
|
|
2019-01-07 17:23:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2024-05-06 13:40:17 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2024-05-06 13:40:17 +02:00
|
|
|
|
2019-01-07 17:23:17 +01:00
|
|
|
|
|
|
|
|
|
2024-05-06 13:40:17 +02:00
|
|
|
|
|
|
|
|
|
2018-07-06 11:05:43 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:18 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2023-04-12 15:50:50 +01:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:18 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2019-01-07 17:23:18 +01:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:30 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-06 13:40:19 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:30 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
2024-05-06 13:40:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2019-01-07 17:23:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2024-05-06 13:40:20 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:42 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:43 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-13 19:44:43 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2018-12-13 19:44:41 +01:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:43 +02:00
|
|
|
|
2019-01-07 17:23:17 +01:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2018-12-13 19:44:41 +01:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2018-12-13 19:44:43 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
|
|
|
|
|
2022-08-23 17:18:38 +03:00
|
|
|
|
serial: sh-sci: Fix TX DMA buffer flushing and workqueue races
When uart_flush_buffer() is called, the .flush_buffer() callback zeroes
the tx_dma_len field. This may race with the work queue function
handling transmit DMA requests:
1. If the buffer is flushed before the first DMA API call,
dmaengine_prep_slave_single() may be called with a zero length,
causing the DMA request to never complete, leading to messages
like:
rcar-dmac e7300000.dma-controller: Channel Address Error happen
and, with debug enabled:
sh-sci e6e88000.serial: sci_dma_tx_work_fn: ffff800639b55000: 0...0, cookie 126
and DMA timeouts.
2. If the buffer is flushed after the first DMA API call, but before
the second, dma_sync_single_for_device() may be called with a zero
length, causing the transmit data not to be flushed to RAM, and
leading to stale data being output.
Fix this by:
1. Letting sci_dma_tx_work_fn() return immediately if the transmit
buffer is empty,
2. Extending the critical section to cover all DMA preparational work,
so tx_dma_len stays consistent for all of it,
3. Using local copies of circ_buf.head and circ_buf.tail, to make sure
they match the actual operation above.
Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Suggested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Link: https://lore.kernel.org/r/20190624123540.20629-2-geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-24 14:35:39 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
serial: sh-sci: Fix TX DMA buffer flushing and workqueue races
When uart_flush_buffer() is called, the .flush_buffer() callback zeroes
the tx_dma_len field. This may race with the work queue function
handling transmit DMA requests:
1. If the buffer is flushed before the first DMA API call,
dmaengine_prep_slave_single() may be called with a zero length,
causing the DMA request to never complete, leading to messages
like:
rcar-dmac e7300000.dma-controller: Channel Address Error happen
and, with debug enabled:
sh-sci e6e88000.serial: sci_dma_tx_work_fn: ffff800639b55000: 0...0, cookie 126
and DMA timeouts.
2. If the buffer is flushed after the first DMA API call, but before
the second, dma_sync_single_for_device() may be called with a zero
length, causing the transmit data not to be flushed to RAM, and
leading to stale data being output.
Fix this by:
1. Letting sci_dma_tx_work_fn() return immediately if the transmit
buffer is empty,
2. Extending the critical section to cover all DMA preparational work,
so tx_dma_len stays consistent for all of it,
3. Using local copies of circ_buf.head and circ_buf.tail, to make sure
they match the actual operation above.
Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Suggested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Link: https://lore.kernel.org/r/20190624123540.20629-2-geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-24 14:35:39 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2015-09-18 13:08:32 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2016-11-07 16:56:50 +01:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:31 +02:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:31 +02:00
|
|
|
|
|
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2015-09-18 13:08:31 +02:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
2015-09-18 13:08:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2015-09-18 13:08:32 +02:00
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2015-09-18 13:08:32 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
2018-07-06 11:05:43 +02:00
|
|
|
|
2015-09-18 13:08:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:29 +02:00
|
|
|
|
2019-01-07 17:23:18 +01:00
|
|
|
|
2015-09-18 13:08:29 +02:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
2017-01-11 16:43:37 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2023-11-19 19:00:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
|
|
|
|
|
2023-03-22 07:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-14 23:29:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:37 +02:00
|
|
|
|
2015-09-18 13:08:33 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
2017-09-22 20:29:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-10 08:47:26 -06:00
|
|
|
|
2017-09-22 20:29:30 +02:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:37 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-05 08:08:23 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:37 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-04 15:21:19 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-05 11:45:59 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2018-10-09 19:41:58 +02:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-24 14:35:40 +02:00
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
|
|
|
|
|
2019-06-24 14:35:40 +02:00
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
2019-06-24 14:35:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-17 15:57:59 +02:00
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
|
|
|
|
|
2015-09-18 13:08:24 +02:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2023-04-12 15:50:50 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2023-04-12 15:50:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-19 13:53:04 +00:00
|
|
|
|
2019-01-07 17:23:20 +01:00
|
|
|
|
2018-12-13 19:44:43 +01:00
|
|
|
|
|
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2010-03-19 13:53:04 +00:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2010-03-19 13:53:04 +00:00
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-13 19:44:43 +01:00
|
|
|
|
|
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 14:55:46 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2009-07-29 23:01:24 +09:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
2025-11-29 16:43:06 +00:00
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-16 18:22:01 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2021-08-16 18:22:01 +02:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-11 09:41:30 -05:00
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 14:55:46 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:55 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
2018-07-11 09:41:30 -05:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2018-07-11 09:41:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-12-16 19:29:38 +09:00
|
|
|
|
2015-08-21 20:02:55 +02:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:56 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 14:55:46 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-03-17 01:19:19 +09:00
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
2015-03-17 01:19:19 +09:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2015-03-17 01:19:19 +09:00
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:35 +02:00
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-07-07 05:32:07 +00:00
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2011-01-13 15:06:28 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2021-08-16 18:22:01 +02:00
|
|
|
|
|
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-26 21:25:48 +09:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
2015-03-17 01:19:19 +09:00
|
|
|
|
2015-08-21 20:02:36 +02:00
|
|
|
|
|
|
|
|
|
2015-01-26 21:25:48 +09:00
|
|
|
|
2008-10-31 16:10:23 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:32 +02:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-04-12 15:50:52 +01:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
2015-08-21 20:02:32 +02:00
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-18 18:21:06 +09:00
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
2012-05-18 18:21:06 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2012-05-18 18:21:06 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
2016-12-03 18:40:25 +08:00
|
|
|
|
|
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
2016-12-03 18:40:25 +08:00
|
|
|
|
2008-12-16 18:55:26 +09:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-28 13:25:56 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2012-05-18 18:21:06 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2012-05-18 18:21:06 +09:00
|
|
|
|
|
|
|
|
|
2019-01-28 13:25:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-06-28 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-06-14 17:38:19 +09:00
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-24 20:18:32 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-24 20:20:53 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-24 20:18:32 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
2011-11-24 20:20:53 +09:00
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2011-11-24 20:20:53 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2011-11-24 20:20:53 +09:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2017-01-11 16:43:39 +02:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-24 20:18:32 +09:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2011-11-24 20:18:32 +09:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-14 11:29:24 +02:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2019-08-14 11:29:24 +02:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
2019-08-14 11:29:24 +02:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-06 09:59:14 +09:00
|
|
|
|
2017-11-02 11:14:55 +01:00
|
|
|
|
2012-04-06 09:59:14 +09:00
|
|
|
|
2021-03-10 11:07:02 +08:00
|
|
|
|
2016-06-03 12:00:05 +02:00
|
|
|
|
2012-04-06 09:59:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-12 19:19:21 +09:00
|
|
|
|
2012-04-06 09:59:14 +09:00
|
|
|
|
2012-04-12 19:19:21 +09:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2012-04-12 19:19:21 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-21 15:14:38 +00:00
|
|
|
|
2011-01-19 17:30:53 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2024-11-25 13:58:56 +02:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2011-01-19 17:30:53 +09:00
|
|
|
|
2017-02-27 15:56:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-21 15:14:38 +00:00
|
|
|
|
2012-11-16 10:54:49 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2025-02-17 07:21:53 +01:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2025-06-30 21:23:21 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2011-01-19 17:30:53 +09:00
|
|
|
|
2015-09-18 13:08:28 +02:00
|
|
|
|
2018-07-06 11:05:41 +02:00
|
|
|
|
2015-09-18 13:08:28 +02:00
|
|
|
|
|
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2015-09-18 13:08:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-06 11:08:36 +02:00
|
|
|
|
2025-04-05 10:17:26 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-02-27 15:56:31 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
|
|
|
|
|
2009-06-24 18:23:52 +09:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
|
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2013-12-06 10:59:20 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2016-01-04 14:45:20 +01:00
|
|
|
|
2011-01-19 17:51:37 +09:00
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-24 18:23:52 +09:00
|
|
|
|
|
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2016-01-04 14:45:20 +01:00
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
|
|
|
|
|
2015-11-16 17:22:16 +01:00
|
|
|
|
2025-11-29 16:43:10 +00:00
|
|
|
|
|
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2016-01-04 14:45:20 +01:00
|
|
|
|
2015-11-16 17:22:16 +01:00
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
|
|
|
|
|
2022-02-21 17:29:25 +01:00
|
|
|
|
2015-11-13 17:04:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
2015-11-13 17:04:56 +01:00
|
|
|
|
2015-11-16 15:54:47 +01:00
|
|
|
|
2015-11-13 17:04:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
2015-11-13 17:04:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-13 16:56:08 +01:00
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
2015-11-16 15:54:47 +01:00
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
|
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
2015-11-13 16:56:08 +01:00
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
|
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-16 16:33:22 +01:00
|
|
|
|
2015-11-16 15:54:47 +01:00
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
2025-11-29 16:43:10 +00:00
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
2011-08-03 03:47:36 +00:00
|
|
|
|
|
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2011-08-03 03:47:36 +00:00
|
|
|
|
2017-02-03 11:38:17 +01:00
|
|
|
|
2011-08-03 03:47:36 +00:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-08-03 03:47:36 +00:00
|
|
|
|
2011-11-24 18:35:49 +09:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-24 16:59:15 +02:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-24 16:59:16 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-24 16:59:16 +02:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-06-24 16:59:16 +02:00
|
|
|
|
2017-02-03 11:38:17 +01:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 14:43:17 -07:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2017-02-08 18:31:14 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
|
|
|
|
|
2011-08-03 03:47:36 +00:00
|
|
|
|
|
|
|
|
|
2006-12-08 02:38:45 -08:00
|
|
|
|
2022-08-16 14:57:37 +03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
|
|
|
|
|
2009-06-24 17:53:33 +09:00
|
|
|
|
2015-08-21 20:02:33 +02:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-02 11:14:55 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-05-19 11:18:04 +03:00
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
2022-05-19 11:18:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-14 16:10:00 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-22 03:37:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-22 03:37:28 +00:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-04 14:45:21 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2011-03-03 08:04:42 +00:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2017-11-02 11:14:55 +01:00
|
|
|
|
2011-08-03 03:47:36 +00:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-04 17:48:51 +02:00
|
|
|
|
2021-06-10 11:02:47 +02:00
|
|
|
|
2018-04-04 17:48:51 +02:00
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
serial: sh-sci: Add support for SCIFA/SCIFB variable sampling rates
Add support for sparse variable sampling rates on SCIFA and SCIFB.
According to the datasheet, sampling rate 1/5 needs a small quirk to
avoid corrupting the first byte received.
This increases the range and accuracy of supported baud rates.
E.g. on r8a7791/koelsch:
- Supports now 134, 150, and standard 500000-4000000 bps,
- Perfect match for 134, 150, 500000, 1000000, 2000000, and 4000000
bps,
- Accuracy has increased for most standard bps values.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-04 14:45:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-04 17:48:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-01 13:25:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-04 17:48:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-29 10:10:26 +01:00
|
|
|
|
2018-04-04 17:48:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2018-04-04 17:48:51 +02:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2016-01-04 14:45:19 +01:00
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-12-16 20:07:27 +09:00
|
|
|
|
2011-11-24 18:35:49 +09:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
2011-12-02 19:02:06 +09:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-11-24 18:35:49 +09:00
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-02 17:44:50 +09:00
|
|
|
|
2011-12-02 19:02:06 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
2011-11-24 18:35:49 +09:00
|
|
|
|
2017-03-28 11:13:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-02-01 03:06:06 -08:00
|
|
|
|
2023-04-12 15:50:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2023-04-12 15:50:51 +01:00
|
|
|
|
|
|
|
|
|
2024-03-04 11:52:44 +01:00
|
|
|
|
serial: sh-sci: Add support for SCIFA/SCIFB variable sampling rates
Add support for sparse variable sampling rates on SCIFA and SCIFB.
According to the datasheet, sampling rate 1/5 needs a small quirk to
avoid corrupting the first byte received.
This increases the range and accuracy of supported baud rates.
E.g. on r8a7791/koelsch:
- Supports now 134, 150, and standard 500000-4000000 bps,
- Perfect match for 134, 150, 500000, 1000000, 2000000, and 4000000
bps,
- Accuracy has increased for most standard bps values.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-04 14:45:22 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
serial: sh-sci: Add support for SCIFA/SCIFB variable sampling rates
Add support for sparse variable sampling rates on SCIFA and SCIFB.
According to the datasheet, sampling rate 1/5 needs a small quirk to
avoid corrupting the first byte received.
This increases the range and accuracy of supported baud rates.
E.g. on r8a7791/koelsch:
- Supports now 134, 150, and standard 500000-4000000 bps,
- Perfect match for 134, 150, 500000, 1000000, 2000000, and 4000000
bps,
- Accuracy has increased for most standard bps values.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-04 14:45:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2021-04-15 11:35:47 +02:00
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2018-02-15 13:02:41 +01:00
|
|
|
|
2010-03-19 13:53:04 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2011-03-03 08:04:42 +00:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2017-11-02 11:14:55 +01:00
|
|
|
|
2011-06-28 13:55:31 +09:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
serial: sh-sci: console runtime PM support (revisit)
The commit 1ba7622094 (serial: sh-sci: console Runtime PM support,
from Magnus Damm <damm@opensource.se>, 2011-08-03), tried to support
console runtime PM, but unfortunately it didn't work for us for some
reason. We did not investigated further at that time, instead would
like to propose a different approach.
In Linux tty/serial world, to get console PM work properly, a serial
client driver does not have to maintain .runtime_suspend()/..resume()
calls itself, but can leave console power power management handling to
the serial core driver.
This patch moves the sh-sci driver in that direction.
Notes:
* There is room to optimize console runtime PM more aggressively by
maintaining additional local runtime PM calls, but as a first step
having .pm() operation would suffice.
* We still have a couple of direct calls to sci_port_enable/..disable
left in the driver. We have to live with them, because they're out
of serial core's help.
Signed-off-by: Teppei Kamijou <teppei.kamijou.yb@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:51:55 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-11 11:11:20 +01:00
|
|
|
|
serial: sh-sci: console runtime PM support (revisit)
The commit 1ba7622094 (serial: sh-sci: console Runtime PM support,
from Magnus Damm <damm@opensource.se>, 2011-08-03), tried to support
console runtime PM, but unfortunately it didn't work for us for some
reason. We did not investigated further at that time, instead would
like to propose a different approach.
In Linux tty/serial world, to get console PM work properly, a serial
client driver does not have to maintain .runtime_suspend()/..resume()
calls itself, but can leave console power power management handling to
the serial core driver.
This patch moves the sh-sci driver in that direction.
Notes:
* There is room to optimize console runtime PM more aggressively by
maintaining additional local runtime PM calls, but as a first step
having .pm() operation would suffice.
* We still have a couple of direct calls to sci_port_enable/..disable
left in the driver. We have to live with them, because they're out
of serial core's help.
Signed-off-by: Teppei Kamijou <teppei.kamijou.yb@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:51:55 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
serial: sh-sci: console runtime PM support (revisit)
The commit 1ba7622094 (serial: sh-sci: console Runtime PM support,
from Magnus Damm <damm@opensource.se>, 2011-08-03), tried to support
console runtime PM, but unfortunately it didn't work for us for some
reason. We did not investigated further at that time, instead would
like to propose a different approach.
In Linux tty/serial world, to get console PM work properly, a serial
client driver does not have to maintain .runtime_suspend()/..resume()
calls itself, but can leave console power power management handling to
the serial core driver.
This patch moves the sh-sci driver in that direction.
Notes:
* There is room to optimize console runtime PM more aggressively by
maintaining additional local runtime PM calls, but as a first step
having .pm() operation would suffice.
* We still have a couple of direct calls to sci_port_enable/..disable
left in the driver. We have to live with them, because they're out
of serial core's help.
Signed-off-by: Teppei Kamijou <teppei.kamijou.yb@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:51:55 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-13 18:18:35 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-23 16:39:09 +00:00
|
|
|
|
|
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-09-04 18:53:58 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:24 +02:00
|
|
|
|
2020-01-06 09:43:50 +01:00
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-05 09:56:37 +09:00
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:24 +02:00
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-01 15:46:58 +09:00
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2011-01-20 21:24:03 +09:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-01 19:51:35 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-25 20:15:35 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
serial: sh-sci: console runtime PM support (revisit)
The commit 1ba7622094 (serial: sh-sci: console Runtime PM support,
from Magnus Damm <damm@opensource.se>, 2011-08-03), tried to support
console runtime PM, but unfortunately it didn't work for us for some
reason. We did not investigated further at that time, instead would
like to propose a different approach.
In Linux tty/serial world, to get console PM work properly, a serial
client driver does not have to maintain .runtime_suspend()/..resume()
calls itself, but can leave console power power management handling to
the serial core driver.
This patch moves the sh-sci driver in that direction.
Notes:
* There is room to optimize console runtime PM more aggressively by
maintaining additional local runtime PM calls, but as a first step
having .pm() operation would suffice.
* We still have a couple of direct calls to sci_port_enable/..disable
left in the driver. We have to live with them, because they're out
of serial core's help.
Signed-off-by: Teppei Kamijou <teppei.kamijou.yb@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:51:55 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-11 19:06:43 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-14 15:14:23 +03:00
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
2015-11-18 11:25:53 +01:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-14 15:14:23 +03:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
2026-03-12 08:26:59 +00:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2015-11-18 11:12:26 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-16 15:17:34 +01:00
|
|
|
|
|
|
|
|
|
2015-09-14 15:14:23 +03:00
|
|
|
|
2026-03-12 08:26:59 +00:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:02 +00:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2025-11-29 16:43:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-16 15:17:34 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-16 15:17:33 +01:00
|
|
|
|
2025-11-29 16:43:02 +00:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
2021-12-16 15:17:34 +01:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
2025-11-29 16:43:02 +00:00
|
|
|
|
2021-12-16 15:17:34 +01:00
|
|
|
|
2015-10-26 09:58:16 +01:00
|
|
|
|
|
|
|
|
|
2015-09-14 15:14:23 +03:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:35 +02:00
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2017-01-11 16:43:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-19 13:21:50 -05:00
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2017-01-11 16:43:35 +02:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2018-08-30 14:54:04 +02:00
|
|
|
|
2011-06-28 13:44:37 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2011-12-02 20:09:48 +09:00
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
|
|
|
|
|
2019-12-13 00:06:40 +00:00
|
|
|
|
2010-01-15 08:33:20 +09:00
|
|
|
|
2013-12-06 10:59:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2013-12-06 10:59:52 +01:00
|
|
|
|
2015-05-16 23:57:31 +09:00
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2019-10-01 20:07:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2023-03-17 15:04:03 +00:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2023-03-17 15:04:03 +00:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:06 +00:00
|
|
|
|
2023-03-17 15:04:03 +00:00
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:52 +01:00
|
|
|
|
|
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2018-07-31 05:41:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2017-02-03 11:38:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:13 +00:00
|
|
|
|
2026-03-12 08:26:59 +00:00
|
|
|
|
2017-02-03 11:38:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:07 +00:00
|
|
|
|
2025-11-29 16:42:58 +00:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2017-02-03 11:38:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2017-09-29 15:08:53 +02:00
|
|
|
|
2017-02-03 11:38:18 +01:00
|
|
|
|
2013-12-06 10:59:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:20 +01:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:20 +01:00
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2015-09-14 15:14:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-14 10:24:42 +00:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-01-11 16:43:24 +02:00
|
|
|
|
2017-01-11 16:43:36 +02:00
|
|
|
|
2011-01-19 15:24:40 +09:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2017-01-11 16:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-19 15:24:40 +09:00
|
|
|
|
2011-06-14 12:40:19 +09:00
|
|
|
|
2011-01-19 15:24:40 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2011-09-22 16:59:15 +08:00
|
|
|
|
2010-03-02 11:39:15 +09:00
|
|
|
|
2010-03-10 18:35:14 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
2022-03-03 09:08:31 +01:00
|
|
|
|
2009-01-21 15:14:06 +00:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2009-01-21 15:14:06 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serial: sh-sci: add locking to console write function to avoid SMP lockup
Symptom:
When entering the suspend with Android logcat running, printk() call
gets stuck and never returns. The issue can be observed at printk()s
on nonboot CPUs when going to offline with their interrupts disabled,
and never seen at boot CPU (core0 in our case).
Details:
serial_console_write() lacks of appropriate spinlock handling.
In SMP systems, as long as sci_transmit_chars() is being processed
at one CPU core, serial_console_write() can stuck at the other CPU
core(s), when it tries to access to the same serial port _without_
a proper locking. serial_console_write() waits for the transmit FIFO
getting empty, while sci_transmit_chars() writes data to the FIFO.
In general, peripheral interrupts are routed to boot CPU (core0) by
Linux ARM standard affinity settings. SCI(F) interrupts are handled
by core0, so sci_transmit_chars() is processed on core0 as well.
When logcat is running, it writes enormous log data to the kernel at
every moment, forever. So core0 can repeatedly continue to process
sci_transmit_chars() in its interrupt handler, which eventually makes
the other CPU core(s) stuck at serial_console_write().
Looking at serial/8250.c, this is a known console write lockup issue
with SMP kernels. Fix the sh-sci driver in the same way 8250.c does.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:54:15 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-12-13 00:06:40 +00:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
serial: sh-sci: add locking to console write function to avoid SMP lockup
Symptom:
When entering the suspend with Android logcat running, printk() call
gets stuck and never returns. The issue can be observed at printk()s
on nonboot CPUs when going to offline with their interrupts disabled,
and never seen at boot CPU (core0 in our case).
Details:
serial_console_write() lacks of appropriate spinlock handling.
In SMP systems, as long as sci_transmit_chars() is being processed
at one CPU core, serial_console_write() can stuck at the other CPU
core(s), when it tries to access to the same serial port _without_
a proper locking. serial_console_write() waits for the transmit FIFO
getting empty, while sci_transmit_chars() writes data to the FIFO.
In general, peripheral interrupts are routed to boot CPU (core0) by
Linux ARM standard affinity settings. SCI(F) interrupts are handled
by core0, so sci_transmit_chars() is processed on core0 as well.
When logcat is running, it writes enormous log data to the kernel at
every moment, forever. So core0 can repeatedly continue to process
sci_transmit_chars() in its interrupt handler, which eventually makes
the other CPU core(s) stuck at serial_console_write().
Looking at serial/8250.c, this is a known console write lockup issue
with SMP kernels. Fix the sh-sci driver in the same way 8250.c does.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:54:15 +09:00
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
serial: sh-sci: add locking to console write function to avoid SMP lockup
Symptom:
When entering the suspend with Android logcat running, printk() call
gets stuck and never returns. The issue can be observed at printk()s
on nonboot CPUs when going to offline with their interrupts disabled,
and never seen at boot CPU (core0 in our case).
Details:
serial_console_write() lacks of appropriate spinlock handling.
In SMP systems, as long as sci_transmit_chars() is being processed
at one CPU core, serial_console_write() can stuck at the other CPU
core(s), when it tries to access to the same serial port _without_
a proper locking. serial_console_write() waits for the transmit FIFO
getting empty, while sci_transmit_chars() writes data to the FIFO.
In general, peripheral interrupts are routed to boot CPU (core0) by
Linux ARM standard affinity settings. SCI(F) interrupts are handled
by core0, so sci_transmit_chars() is processed on core0 as well.
When logcat is running, it writes enormous log data to the kernel at
every moment, forever. So core0 can repeatedly continue to process
sci_transmit_chars() in its interrupt handler, which eventually makes
the other CPU core(s) stuck at serial_console_write().
Looking at serial/8250.c, this is a known console write lockup issue
with SMP kernels. Fix the sh-sci driver in the same way 8250.c does.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:54:15 +09:00
|
|
|
|
2015-11-18 16:20:44 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-11 19:06:43 +09:00
|
|
|
|
2009-01-21 15:14:30 +00:00
|
|
|
|
2009-02-24 15:57:12 +09:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-24 15:57:12 +09:00
|
|
|
|
serial: sh-sci: add locking to console write function to avoid SMP lockup
Symptom:
When entering the suspend with Android logcat running, printk() call
gets stuck and never returns. The issue can be observed at printk()s
on nonboot CPUs when going to offline with their interrupts disabled,
and never seen at boot CPU (core0 in our case).
Details:
serial_console_write() lacks of appropriate spinlock handling.
In SMP systems, as long as sci_transmit_chars() is being processed
at one CPU core, serial_console_write() can stuck at the other CPU
core(s), when it tries to access to the same serial port _without_
a proper locking. serial_console_write() waits for the transmit FIFO
getting empty, while sci_transmit_chars() writes data to the FIFO.
In general, peripheral interrupts are routed to boot CPU (core0) by
Linux ARM standard affinity settings. SCI(F) interrupts are handled
by core0, so sci_transmit_chars() is processed on core0 as well.
When logcat is running, it writes enormous log data to the kernel at
every moment, forever. So core0 can repeatedly continue to process
sci_transmit_chars() in its interrupt handler, which eventually makes
the other CPU core(s) stuck at serial_console_write().
Looking at serial/8250.c, this is a known console write lockup issue
with SMP kernels. Fix the sh-sci driver in the same way 8250.c does.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:54:15 +09:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serial: sh-sci: add locking to console write function to avoid SMP lockup
Symptom:
When entering the suspend with Android logcat running, printk() call
gets stuck and never returns. The issue can be observed at printk()s
on nonboot CPUs when going to offline with their interrupts disabled,
and never seen at boot CPU (core0 in our case).
Details:
serial_console_write() lacks of appropriate spinlock handling.
In SMP systems, as long as sci_transmit_chars() is being processed
at one CPU core, serial_console_write() can stuck at the other CPU
core(s), when it tries to access to the same serial port _without_
a proper locking. serial_console_write() waits for the transmit FIFO
getting empty, while sci_transmit_chars() writes data to the FIFO.
In general, peripheral interrupts are routed to boot CPU (core0) by
Linux ARM standard affinity settings. SCI(F) interrupts are handled
by core0, so sci_transmit_chars() is processed on core0 as well.
When logcat is running, it writes enormous log data to the kernel at
every moment, forever. So core0 can repeatedly continue to process
sci_transmit_chars() in its interrupt handler, which eventually makes
the other CPU core(s) stuck at serial_console_write().
Looking at serial/8250.c, this is a known console write lockup issue
with SMP kernels. Fix the sh-sci driver in the same way 8250.c does.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-16 10:54:15 +09:00
|
|
|
|
|
|
|
|
|
2023-09-14 20:44:17 +02:06
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-11-19 13:21:50 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-21 15:14:06 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-09 03:18:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-21 15:25:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-01 14:47:42 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2007-03-08 17:27:37 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2019-10-03 11:29:12 +02:00
|
|
|
|
2022-11-16 17:27:52 +01:06
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-14 10:24:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-16 17:27:52 +01:06
|
|
|
|
2009-12-14 10:24:42 +00:00
|
|
|
|
2011-01-21 16:19:53 +09:00
|
|
|
|
2009-12-14 10:24:42 +00:00
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
2012-11-19 13:21:50 -05:00
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
2017-01-11 16:43:35 +02:00
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-03 11:29:12 +02:00
|
|
|
|
2011-03-24 02:20:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
2012-11-19 13:21:50 -05:00
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-03-24 02:20:56 +00:00
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-03-11 11:11:17 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-04-20 14:13:01 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-10 16:30:06 +01:00
|
|
|
|
2009-01-21 15:13:42 +00:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
2009-01-21 15:13:42 +00:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2025-11-29 16:43:00 +00:00
|
|
|
|
2019-07-04 10:46:09 +02:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:00 +00:00
|
|
|
|
2009-01-21 15:13:42 +00:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2023-03-10 23:29:56 +01:00
|
|
|
|
serial: sh-sci: Correct SCIF type on RZ/A1H
The "renesas,scif" compatible value is currently used for the SCIF
variant in all Renesas SoCs of the R-Car and RZ families. However, the
variant used in the RZ family is not the common "SH-4(A)" variant, but
the "SH-2(A) with FIFO data count register" variant, as it has the
"Serial Extension Mode Register" (SCEMR), just like on sh7203, sh7263,
sh7264, and sh7269.
Use the (already documented) SoC-specific "renesas,scif-r7s72100"
compatible value to differentiate. The "renesas,scif" compatible value
can still be used as a common denominator for SCIF variants with the
"SH-4(A)" register layout (i.e. ignoring the SCEMR register).
Note that currently both variants are treated the same, but this may
change if support for the SCEMR register is ever added.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-10 16:16:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
serial: sh-sci: Correct SCIF type on RZ/A1H
The "renesas,scif" compatible value is currently used for the SCIF
variant in all Renesas SoCs of the R-Car and RZ families. However, the
variant used in the RZ family is not the common "SH-4(A)" variant, but
the "SH-2(A) with FIFO data count register" variant, as it has the
"Serial Extension Mode Register" (SCEMR), just like on sh7203, sh7263,
sh7264, and sh7269.
Use the (already documented) SoC-specific "renesas,scif-r7s72100"
compatible value to differentiate. The "renesas,scif" compatible value
can still be used as a common denominator for SCIF variants with the
"SH-4(A)" register layout (i.e. ignoring the SCEMR register).
Note that currently both variants are treated the same, but this may
change if support for the SCEMR register is ever added.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-10 16:16:54 +01:00
|
|
|
|
2018-08-30 14:54:03 +02:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2018-08-30 14:54:03 +02:00
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
2026-03-12 08:26:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:12 +00:00
|
|
|
|
2025-06-30 21:23:23 +01:00
|
|
|
|
|
|
|
|
|
2015-11-10 18:57:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-11-10 18:57:23 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-11-10 18:57:23 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2021-12-09 16:08:17 +09:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2025-07-03 04:52:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-10 18:57:23 +01:00
|
|
|
|
serial: sh-sci: Correct SCIF type on RZ/A1H
The "renesas,scif" compatible value is currently used for the SCIF
variant in all Renesas SoCs of the R-Car and RZ families. However, the
variant used in the RZ family is not the common "SH-4(A)" variant, but
the "SH-2(A) with FIFO data count register" variant, as it has the
"Serial Extension Mode Register" (SCEMR), just like on sh7203, sh7263,
sh7264, and sh7269.
Use the (already documented) SoC-specific "renesas,scif-r7s72100"
compatible value to differentiate. The "renesas,scif" compatible value
can still be used as a common denominator for SCIF variants with the
"SH-4(A)" register layout (i.e. ignoring the SCEMR register).
Note that currently both variants are treated the same, but this may
change if support for the SCEMR register is ever added.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-10 16:16:54 +01:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-01-28 02:53:55 +09:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-25 15:55:49 +01:00
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2017-01-11 16:43:39 +02:00
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2017-10-04 14:21:56 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2025-11-29 16:43:05 +00:00
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2015-08-21 20:02:34 +02:00
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2015-11-12 13:39:49 +01:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
serial: sh-sci: Add support for dynamic instances
On DT platforms, the sh-sci driver requires the presence of "serialN"
aliases in DT, from which instance IDs are derived. If a DT alias is
missing, the drivers fails to probe the corresponding serial port.
This becomes cumbersome when considering DT overlays, as currently
there is no upstream support for dynamically updating the /aliases node
in DT. Furthermore, even in the presence of such support, hardcoded
instance IDs in independent overlays are prone to conflicts.
Hence add support for dynamic instance IDs, to be used in the absence of
a DT alias. This makes serial ports behave similar to I2C and SPI
buses, which already support dynamic instances.
Ports in use are tracked using a simple bitmask of type unsigned long,
which is sufficient to handle all current hardware (max. 18 ports).
The maximum number of serial ports is still fixed, and configurable
through Kconfig. Range validation is done through both Kconfig and a
compile-time check.
Due to the fixed maximum number of serial ports, dynamic and static
instances share the same ID space. Static instances added later are
rejected when conflicting with dynamic instances registered earlier.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-05 18:17:40 +01:00
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2018-02-23 14:38:35 +01:00
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
2018-02-23 14:38:35 +01:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2017-01-11 16:43:39 +02:00
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2017-08-13 22:11:24 +03:00
|
|
|
|
2016-06-03 12:00:11 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-19 13:21:50 -05:00
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
|
|
|
|
|
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
The early_console_setup() function initializes sci_ports[0].port with an
object of type struct uart_port obtained from the struct earlycon_device
passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon
(e.g., port A) might be remapped to a different position in the sci_ports[]
array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the
data associated with the earlycon configuration. Consequently, after the
Linux boot process, any access to the serial port now mapped to
sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up
sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still
being used by earlycon, introduce the struct sci_port::probing flag and
account for it in early_console_exit().
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:48 +02:00
|
|
|
|
|
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-11 10:10:46 -07:00
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
2014-03-11 10:10:46 -07:00
|
|
|
|
2012-06-13 00:28:24 +02:00
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
serial: sh-sci: Add support for dynamic instances
On DT platforms, the sh-sci driver requires the presence of "serialN"
aliases in DT, from which instance IDs are derived. If a DT alias is
missing, the drivers fails to probe the corresponding serial port.
This becomes cumbersome when considering DT overlays, as currently
there is no upstream support for dynamically updating the /aliases node
in DT. Furthermore, even in the presence of such support, hardcoded
instance IDs in independent overlays are prone to conflicts.
Hence add support for dynamic instance IDs, to be used in the absence of
a DT alias. This makes serial ports behave similar to I2C and SPI
buses, which already support dynamic instances.
Ports in use are tracked using a simple bitmask of type unsigned long,
which is sufficient to handle all current hardware (max. 18 ports).
The maximum number of serial ports is still fixed, and configurable
through Kconfig. Range validation is done through both Kconfig and a
compile-time check.
Due to the fixed maximum number of serial ports, dynamic and static
instances share the same ID space. Static instances added later are
rejected when conflicting with dynamic instances registered earlier.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-05 18:17:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
2017-04-20 14:13:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:16 +01:00
|
|
|
|
2010-03-10 18:35:14 +09:00
|
|
|
|
|
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
2025-01-16 20:22:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
2019-08-02 10:04:10 +00:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
2017-01-11 16:43:39 +02:00
|
|
|
|
2019-08-14 11:29:24 +02:00
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-03 12:00:10 +02:00
|
|
|
|
2016-06-03 12:00:04 +02:00
|
|
|
|
|
|
|
|
|
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
The early_console_setup() function initializes sci_ports[0].port with an
object of type struct uart_port obtained from the struct earlycon_device
passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon
(e.g., port A) might be remapped to a different position in the sci_ports[]
array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the
data associated with the earlycon configuration. Consequently, after the
Linux boot process, any access to the serial port now mapped to
sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up
sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still
being used by earlycon, introduce the struct sci_port::probing flag and
account for it in early_console_exit().
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:48 +02:00
|
|
|
|
serial: sh-sci: Increment the runtime usage counter for the earlycon device
In the sh-sci driver, serial ports are mapped to the sci_ports[] array,
with earlycon mapped at index zero.
The uart_add_one_port() function eventually calls __device_attach(),
which, in turn, calls pm_request_idle(). The identified code path is as
follows:
uart_add_one_port() ->
serial_ctrl_register_port() ->
serial_core_register_port() ->
serial_core_port_device_add() ->
serial_base_port_add() ->
device_add() ->
bus_probe_device() ->
device_initial_probe() ->
__device_attach() ->
// ...
if (dev->p->dead) {
// ...
} else if (dev->driver) {
// ...
} else {
// ...
pm_request_idle(dev);
// ...
}
The earlycon device clocks are enabled by the bootloader. However, the
pm_request_idle() call in __device_attach() disables the SCI port clocks
while earlycon is still active.
The earlycon write function, serial_console_write(), calls
sci_poll_put_char() via serial_console_putchar(). If the SCI port clocks
are disabled, writing to earlycon may sometimes cause the SR.TDFE bit to
remain unset indefinitely, causing the while loop in sci_poll_put_char()
to never exit. On single-core SoCs, this can result in the system being
blocked during boot when this issue occurs.
To resolve this, increment the runtime PM usage counter for the earlycon
SCI device before registering the UART port.
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
The early_console_setup() function initializes sci_ports[0].port with an
object of type struct uart_port obtained from the struct earlycon_device
passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon
(e.g., port A) might be remapped to a different position in the sci_ports[]
array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the
data associated with the earlycon configuration. Consequently, after the
Linux boot process, any access to the serial port now mapped to
sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up
sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still
being used by earlycon, introduce the struct sci_port::probing flag and
account for it in early_console_exit().
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-16 20:22:46 +02:00
|
|
|
|
2009-01-21 15:13:50 +00:00
|
|
|
|
|
|
|
|
|
2012-11-19 13:21:50 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2025-01-16 20:22:47 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
2009-01-21 15:13:42 +00:00
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-03 11:29:12 +02:00
|
|
|
|
2019-10-03 11:29:13 +02:00
|
|
|
|
2011-01-21 00:05:48 +09:00
|
|
|
|
2019-10-03 11:29:12 +02:00
|
|
|
|
2009-12-14 10:24:42 +00:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2021-11-10 23:29:20 +00:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-16 20:22:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2009-01-21 15:13:42 +00:00
|
|
|
|
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
The early_console_setup() function initializes sci_ports[0].port with an
object of type struct uart_port obtained from the struct earlycon_device
passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon
(e.g., port A) might be remapped to a different position in the sci_ports[]
array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the
data associated with the earlycon configuration. Consequently, after the
Linux boot process, any access to the serial port now mapped to
sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up
sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still
being used by earlycon, introduce the struct sci_port::probing flag and
account for it in early_console_exit().
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:48 +02:00
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2012-06-13 00:28:23 +02:00
|
|
|
|
2009-01-21 15:13:42 +00:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
2019-07-04 10:46:09 +02:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
2025-11-29 16:43:00 +00:00
|
|
|
|
2019-07-04 10:46:09 +02:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
2025-11-29 16:43:00 +00:00
|
|
|
|
2017-02-03 11:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serial: sh-sci: Add support for dynamic instances
On DT platforms, the sh-sci driver requires the presence of "serialN"
aliases in DT, from which instance IDs are derived. If a DT alias is
missing, the drivers fails to probe the corresponding serial port.
This becomes cumbersome when considering DT overlays, as currently
there is no upstream support for dynamically updating the /aliases node
in DT. Furthermore, even in the presence of such support, hardcoded
instance IDs in independent overlays are prone to conflicts.
Hence add support for dynamic instance IDs, to be used in the absence of
a DT alias. This makes serial ports behave similar to I2C and SPI
buses, which already support dynamic instances.
Ports in use are tracked using a simple bitmask of type unsigned long,
which is sufficient to handle all current hardware (max. 18 ports).
The maximum number of serial ports is still fixed, and configurable
through Kconfig. Range validation is done through both Kconfig and a
compile-time check.
Due to the fixed maximum number of serial ports, dynamic and static
instances share the same ID space. Static instances added later are
rejected when conflicting with dynamic instances registered earlier.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-05 18:17:40 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 21:01:20 +02:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 21:01:20 +02:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-19 17:19:35 +09:00
|
|
|
|
2025-02-07 13:33:13 +02:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 21:01:20 +02:00
|
|
|
|
2009-06-15 07:07:38 +09:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
2024-10-07 22:58:04 +02:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
2025-07-09 21:01:20 +02:00
|
|
|
|
2013-12-06 10:59:54 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-11 11:11:17 +01:00
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2017-04-20 14:13:01 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2017-04-20 14:13:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2019-10-03 11:29:12 +02:00
|
|
|
|
2019-10-03 11:29:13 +02:00
|
|
|
|
2009-12-14 10:24:42 +00:00
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
2025-01-16 20:22:45 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
The early_console_setup() function initializes sci_ports[0].port with an
object of type struct uart_port obtained from the struct earlycon_device
passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon
(e.g., port A) might be remapped to a different position in the sci_ports[]
array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the
data associated with the earlycon configuration. Consequently, after the
Linux boot process, any access to the serial port now mapped to
sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up
sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still
being used by earlycon, introduce the struct sci_port::probing flag and
account for it in early_console_exit().
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2024-12-03 17:30:29 +01:00
|
|
|
|
2025-06-30 21:23:22 +01:00
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-16 20:22:47 +02:00
|
|
|
|
2025-04-03 23:29:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
The early_console_setup() function initializes sci_ports[0].port with an
object of type struct uart_port obtained from the struct earlycon_device
passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon
(e.g., port A) might be remapped to a different position in the sci_ports[]
array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the
data associated with the earlycon configuration. Consequently, after the
Linux boot process, any access to the serial port now mapped to
sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up
sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still
being used by earlycon, introduce the struct sci_port::probing flag and
account for it in early_console_exit().
Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250116182249.3828577-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-16 20:22:48 +02:00
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
2018-09-17 13:26:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2018-09-17 13:26:23 -05:00
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
|
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 23:29:11 +02:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-17 13:26:23 -05:00
|
|
|
|
2021-06-03 23:17:56 +01:00
|
|
|
|
2024-06-04 18:05:13 +01:00
|
|
|
|
2015-12-24 11:24:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-27 16:32:13 +09:00
|
|
|
|
2008-04-15 14:34:35 -07:00
|
|
|
|
2011-06-28 13:47:40 +09:00
|
|
|
|
2013-05-31 17:57:01 +02:00
|
|
|
|