From ada1a242cf1eb21aa96874501e7569b81ff9dade Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Jul 2020 13:50:09 +0200 Subject: [PATCH] 5.7-stable patches added patches: ovl-fix-regression-with-re-formatted-lower-squashfs.patch revert-serial-core-refactor-uart_unlock_and_check_sysrq.patch revert-tty-xilinx_uartps-fix-missing-id-assignment-to-the-console.patch serial-core-fix-sysrq-overhead-regression.patch serial-mxs-auart-add-missed-iounmap-in-probe-failure-and-remove.patch serial-sh-sci-initialize-spinlock-for-uart-console.patch tty-serial-cpm_uart-fix-behaviour-for-non-existing-gpios.patch virtio-virtio_console-add-missing-module_device_table-for-rproc-serial.patch --- ...ion-with-re-formatted-lower-squashfs.patch | 57 ++++ ...refactor-uart_unlock_and_check_sysrq.patch | 79 +++++ ...missing-id-assignment-to-the-console.patch | 36 +++ ...l-core-fix-sysrq-overhead-regression.patch | 269 ++++++++++++++++++ ...-iounmap-in-probe-failure-and-remove.patch | 76 +++++ ...initialize-spinlock-for-uart-console.patch | 65 +++++ queue-5.7/series | 8 + ...fix-behaviour-for-non-existing-gpios.patch | 63 ++++ ...module_device_table-for-rproc-serial.patch | 51 ++++ 9 files changed, 704 insertions(+) create mode 100644 queue-5.7/ovl-fix-regression-with-re-formatted-lower-squashfs.patch create mode 100644 queue-5.7/revert-serial-core-refactor-uart_unlock_and_check_sysrq.patch create mode 100644 queue-5.7/revert-tty-xilinx_uartps-fix-missing-id-assignment-to-the-console.patch create mode 100644 queue-5.7/serial-core-fix-sysrq-overhead-regression.patch create mode 100644 queue-5.7/serial-mxs-auart-add-missed-iounmap-in-probe-failure-and-remove.patch create mode 100644 queue-5.7/serial-sh-sci-initialize-spinlock-for-uart-console.patch create mode 100644 queue-5.7/tty-serial-cpm_uart-fix-behaviour-for-non-existing-gpios.patch create mode 100644 queue-5.7/virtio-virtio_console-add-missing-module_device_table-for-rproc-serial.patch diff --git a/queue-5.7/ovl-fix-regression-with-re-formatted-lower-squashfs.patch b/queue-5.7/ovl-fix-regression-with-re-formatted-lower-squashfs.patch new file mode 100644 index 00000000000..d5d0644a35f --- /dev/null +++ b/queue-5.7/ovl-fix-regression-with-re-formatted-lower-squashfs.patch @@ -0,0 +1,57 @@ +From a888db310195400f050b89c47673f0f8babfbb41 Mon Sep 17 00:00:00 2001 +From: Amir Goldstein +Date: Wed, 8 Jul 2020 16:16:13 +0300 +Subject: ovl: fix regression with re-formatted lower squashfs + +From: Amir Goldstein + +commit a888db310195400f050b89c47673f0f8babfbb41 upstream. + +Commit 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower +fs") relaxed the requirement for non null uuid with single lower layer to +allow enabling index and nfs_export features with single lower squashfs. + +Fabian reported a regression in a setup when overlay re-uses an existing +upper layer and re-formats the lower squashfs image. Because squashfs +has no uuid, the origin xattr in upper layer are decoded from the new +lower layer where they may resolve to a wrong origin file and user may +get an ESTALE or EIO error on lookup. + +To avoid the reported regression while still allowing the new features +with single lower squashfs, do not allow decoding origin with lower null +uuid unless user opted-in to one of the new features that require +following the lower inode of non-dir upper (index, xino, metacopy). + +Reported-by: Fabian +Link: https://lore.kernel.org/linux-unionfs/32532923.JtPX5UtSzP@fgdesktop/ +Fixes: 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower fs") +Cc: stable@vger.kernel.org # v4.20+ +Signed-off-by: Amir Goldstein +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman + +--- + fs/overlayfs/super.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/fs/overlayfs/super.c ++++ b/fs/overlayfs/super.c +@@ -1331,6 +1331,18 @@ static bool ovl_lower_uuid_ok(struct ovl + if (!ofs->config.nfs_export && !ofs->upper_mnt) + return true; + ++ /* ++ * We allow using single lower with null uuid for index and nfs_export ++ * for example to support those features with single lower squashfs. ++ * To avoid regressions in setups of overlay with re-formatted lower ++ * squashfs, do not allow decoding origin with lower null uuid unless ++ * user opted-in to one of the new features that require following the ++ * lower inode of non-dir upper. ++ */ ++ if (!ofs->config.index && !ofs->config.metacopy && !ofs->config.xino && ++ uuid_is_null(uuid)) ++ return false; ++ + for (i = 0; i < ofs->numfs; i++) { + /* + * We use uuid to associate an overlay lower file handle with a diff --git a/queue-5.7/revert-serial-core-refactor-uart_unlock_and_check_sysrq.patch b/queue-5.7/revert-serial-core-refactor-uart_unlock_and_check_sysrq.patch new file mode 100644 index 00000000000..5945759a7f5 --- /dev/null +++ b/queue-5.7/revert-serial-core-refactor-uart_unlock_and_check_sysrq.patch @@ -0,0 +1,79 @@ +From 10652a9e9fe3fbcaca090f99cd3060ac3fee2913 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 10 Jun 2020 17:22:30 +0200 +Subject: Revert "serial: core: Refactor uart_unlock_and_check_sysrq()" + +From: Johan Hovold + +commit 10652a9e9fe3fbcaca090f99cd3060ac3fee2913 upstream. + +This reverts commit da9a5aa3402db0ff3b57216d8dbf2478e1046cae. + +In order to ease backporting a fix for a sysrq regression, revert this +rewrite which was since added on top. + +The other sysrq helpers now bail out early when sysrq is not enabled; +it's better to keep that pattern here as well. + +Note that the __releases() attribute won't be needed after the follow-on +fix either. + +Fixes: da9a5aa3402d ("serial: core: Refactor uart_unlock_and_check_sysrq()") +Cc: stable +Signed-off-by: Johan Hovold +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20200610152232.16925-2-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/serial_core.c | 23 +++++++++++++---------- + include/linux/serial_core.h | 3 ++- + 2 files changed, 15 insertions(+), 11 deletions(-) + +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -3251,19 +3251,22 @@ int uart_prepare_sysrq_char(struct uart_ + } + EXPORT_SYMBOL_GPL(uart_prepare_sysrq_char); + +-void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags) +-__releases(&port->lock) ++void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) + { +- if (port->has_sysrq) { +- int sysrq_ch = port->sysrq_ch; ++ int sysrq_ch; + +- port->sysrq_ch = 0; +- spin_unlock_irqrestore(&port->lock, flags); +- if (sysrq_ch) +- handle_sysrq(sysrq_ch); +- } else { +- spin_unlock_irqrestore(&port->lock, flags); ++ if (!port->has_sysrq) { ++ spin_unlock_irqrestore(&port->lock, irqflags); ++ return; + } ++ ++ sysrq_ch = port->sysrq_ch; ++ port->sysrq_ch = 0; ++ ++ spin_unlock_irqrestore(&port->lock, irqflags); ++ ++ if (sysrq_ch) ++ handle_sysrq(sysrq_ch); + } + EXPORT_SYMBOL_GPL(uart_unlock_and_check_sysrq); + +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -462,7 +462,8 @@ extern void uart_insert_char(struct uart + + extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch); + extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch); +-extern void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags); ++extern void uart_unlock_and_check_sysrq(struct uart_port *port, ++ unsigned long irqflags); + extern int uart_handle_break(struct uart_port *port); + + /* diff --git a/queue-5.7/revert-tty-xilinx_uartps-fix-missing-id-assignment-to-the-console.patch b/queue-5.7/revert-tty-xilinx_uartps-fix-missing-id-assignment-to-the-console.patch new file mode 100644 index 00000000000..d1ad4d5ccad --- /dev/null +++ b/queue-5.7/revert-tty-xilinx_uartps-fix-missing-id-assignment-to-the-console.patch @@ -0,0 +1,36 @@ +From 76ed2e105796710cf5b8a4ba43c81eceed948b70 Mon Sep 17 00:00:00 2001 +From: Jan Kiszka +Date: Thu, 18 Jun 2020 10:11:40 +0200 +Subject: Revert "tty: xilinx_uartps: Fix missing id assignment to the console" + +From: Jan Kiszka + +commit 76ed2e105796710cf5b8a4ba43c81eceed948b70 upstream. + +This reverts commit 2ae11c46d5fdc46cb396e35911c713d271056d35. + +It turned out to break the ultra96-rev1, e.g., which uses uart1 as +serial0 (and stdout-path = "serial0:115200n8"). + +Fixes: 2ae11c46d5fd ("tty: xilinx_uartps: Fix missing id assignment to the console") +Cc: stable +Signed-off-by: Jan Kiszka +Reviewed-by: Michal Simek +Tested-by: Michal Simek +Link: https://lore.kernel.org/r/f4092727-d8f5-5f91-2c9f-76643aace993@siemens.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/xilinx_uartps.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/tty/serial/xilinx_uartps.c ++++ b/drivers/tty/serial/xilinx_uartps.c +@@ -1459,7 +1459,6 @@ static int cdns_uart_probe(struct platfo + cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; + #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE + cdns_uart_uart_driver.cons = &cdns_uart_console; +- cdns_uart_console.index = id; + #endif + + rc = uart_register_driver(&cdns_uart_uart_driver); diff --git a/queue-5.7/serial-core-fix-sysrq-overhead-regression.patch b/queue-5.7/serial-core-fix-sysrq-overhead-regression.patch new file mode 100644 index 00000000000..b693e474ac9 --- /dev/null +++ b/queue-5.7/serial-core-fix-sysrq-overhead-regression.patch @@ -0,0 +1,269 @@ +From 08d5470308ac3598e7709d08b8979ce6e9de8da2 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 10 Jun 2020 17:22:31 +0200 +Subject: serial: core: fix sysrq overhead regression + +From: Johan Hovold + +commit 08d5470308ac3598e7709d08b8979ce6e9de8da2 upstream. + +Commit 8e20fc391711 ("serial_core: Move sysrq functions from header +file") converted the inline sysrq helpers to exported functions which +are now called for every received character, interrupt and break signal +also on systems without CONFIG_MAGIC_SYSRQ_SERIAL instead of being +optimised away by the compiler. + +Inlining these helpers again also avoids the function call overhead when +CONFIG_MAGIC_SYSRQ_SERIAL is enabled (e.g. when the port is not used as +a console). + +Fixes: 8e20fc391711 ("serial_core: Move sysrq functions from header file") +Cc: Dmitry Safonov <0x7f454c46@gmail.com> +Signed-off-by: Johan Hovold +Cc: stable +Reviewed-by: Andy Shevchenko +Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> +Link: https://lore.kernel.org/r/20200610152232.16925-3-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/serial_core.c | 99 ------------------------------------- + include/linux/serial_core.h | 103 +++++++++++++++++++++++++++++++++++++-- + 2 files changed, 100 insertions(+), 102 deletions(-) + +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -41,8 +41,6 @@ static struct lock_class_key port_lock_k + + #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) + +-#define SYSRQ_TIMEOUT (HZ * 5) +- + static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, + struct ktermios *old_termios); + static void uart_wait_until_sent(struct tty_struct *tty, int timeout); +@@ -3175,7 +3173,7 @@ static DECLARE_WORK(sysrq_enable_work, u + * Returns false if @ch is out of enabling sequence and should be + * handled some other way, true if @ch was consumed. + */ +-static bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) ++bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) + { + int sysrq_toggle_seq_len = strlen(sysrq_toggle_seq); + +@@ -3198,102 +3196,9 @@ static bool uart_try_toggle_sysrq(struct + port->sysrq = 0; + return true; + } +-#else +-static inline bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) +-{ +- return false; +-} ++EXPORT_SYMBOL_GPL(uart_try_toggle_sysrq); + #endif + +-int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) +-{ +- if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL)) +- return 0; +- +- if (!port->has_sysrq || !port->sysrq) +- return 0; +- +- if (ch && time_before(jiffies, port->sysrq)) { +- if (sysrq_mask()) { +- handle_sysrq(ch); +- port->sysrq = 0; +- return 1; +- } +- if (uart_try_toggle_sysrq(port, ch)) +- return 1; +- } +- port->sysrq = 0; +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(uart_handle_sysrq_char); +- +-int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) +-{ +- if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL)) +- return 0; +- +- if (!port->has_sysrq || !port->sysrq) +- return 0; +- +- if (ch && time_before(jiffies, port->sysrq)) { +- if (sysrq_mask()) { +- port->sysrq_ch = ch; +- port->sysrq = 0; +- return 1; +- } +- if (uart_try_toggle_sysrq(port, ch)) +- return 1; +- } +- port->sysrq = 0; +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(uart_prepare_sysrq_char); +- +-void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) +-{ +- int sysrq_ch; +- +- if (!port->has_sysrq) { +- spin_unlock_irqrestore(&port->lock, irqflags); +- return; +- } +- +- sysrq_ch = port->sysrq_ch; +- port->sysrq_ch = 0; +- +- spin_unlock_irqrestore(&port->lock, irqflags); +- +- if (sysrq_ch) +- handle_sysrq(sysrq_ch); +-} +-EXPORT_SYMBOL_GPL(uart_unlock_and_check_sysrq); +- +-/* +- * We do the SysRQ and SAK checking like this... +- */ +-int uart_handle_break(struct uart_port *port) +-{ +- struct uart_state *state = port->state; +- +- if (port->handle_break) +- port->handle_break(port); +- +- if (port->has_sysrq && uart_console(port)) { +- if (!port->sysrq) { +- port->sysrq = jiffies + SYSRQ_TIMEOUT; +- return 1; +- } +- port->sysrq = 0; +- } +- +- if (port->flags & UPF_SAK) +- do_SAK(state->port.tty); +- return 0; +-} +-EXPORT_SYMBOL_GPL(uart_handle_break); +- + EXPORT_SYMBOL(uart_write_wakeup); + EXPORT_SYMBOL(uart_register_driver); + EXPORT_SYMBOL(uart_unregister_driver); +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -460,11 +460,104 @@ extern void uart_handle_cts_change(struc + extern void uart_insert_char(struct uart_port *port, unsigned int status, + unsigned int overrun, unsigned int ch, unsigned int flag); + +-extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch); +-extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch); +-extern void uart_unlock_and_check_sysrq(struct uart_port *port, +- unsigned long irqflags); +-extern int uart_handle_break(struct uart_port *port); ++#ifdef CONFIG_MAGIC_SYSRQ_SERIAL ++#define SYSRQ_TIMEOUT (HZ * 5) ++ ++bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch); ++ ++static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) ++{ ++ if (!port->has_sysrq || !port->sysrq) ++ return 0; ++ ++ if (ch && time_before(jiffies, port->sysrq)) { ++ if (sysrq_mask()) { ++ handle_sysrq(ch); ++ port->sysrq = 0; ++ return 1; ++ } ++ if (uart_try_toggle_sysrq(port, ch)) ++ return 1; ++ } ++ port->sysrq = 0; ++ ++ return 0; ++} ++ ++static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) ++{ ++ if (!port->has_sysrq || !port->sysrq) ++ return 0; ++ ++ if (ch && time_before(jiffies, port->sysrq)) { ++ if (sysrq_mask()) { ++ port->sysrq_ch = ch; ++ port->sysrq = 0; ++ return 1; ++ } ++ if (uart_try_toggle_sysrq(port, ch)) ++ return 1; ++ } ++ port->sysrq = 0; ++ ++ return 0; ++} ++ ++static inline void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) ++{ ++ int sysrq_ch; ++ ++ if (!port->has_sysrq) { ++ spin_unlock_irqrestore(&port->lock, irqflags); ++ return; ++ } ++ ++ sysrq_ch = port->sysrq_ch; ++ port->sysrq_ch = 0; ++ ++ spin_unlock_irqrestore(&port->lock, irqflags); ++ ++ if (sysrq_ch) ++ handle_sysrq(sysrq_ch); ++} ++#else /* CONFIG_MAGIC_SYSRQ_SERIAL */ ++static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) ++{ ++ return 0; ++} ++static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) ++{ ++ return 0; ++} ++static inline void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) ++{ ++ spin_unlock_irqrestore(&port->lock, irqflags); ++} ++#endif /* CONFIG_MAGIC_SYSRQ_SERIAL */ ++ ++/* ++ * We do the SysRQ and SAK checking like this... ++ */ ++static inline int uart_handle_break(struct uart_port *port) ++{ ++ struct uart_state *state = port->state; ++ ++ if (port->handle_break) ++ port->handle_break(port); ++ ++#ifdef CONFIG_MAGIC_SYSRQ_SERIAL ++ if (port->has_sysrq && uart_console(port)) { ++ if (!port->sysrq) { ++ port->sysrq = jiffies + SYSRQ_TIMEOUT; ++ return 1; ++ } ++ port->sysrq = 0; ++ } ++#endif ++ if (port->flags & UPF_SAK) ++ do_SAK(state->port.tty); ++ return 0; ++} + + /* + * UART_ENABLE_MS - determine if port should enable modem status irqs diff --git a/queue-5.7/serial-mxs-auart-add-missed-iounmap-in-probe-failure-and-remove.patch b/queue-5.7/serial-mxs-auart-add-missed-iounmap-in-probe-failure-and-remove.patch new file mode 100644 index 00000000000..02ae3f8b4a5 --- /dev/null +++ b/queue-5.7/serial-mxs-auart-add-missed-iounmap-in-probe-failure-and-remove.patch @@ -0,0 +1,76 @@ +From d8edf8eb5f6e921fe6389f96d2cd05862730a6ff Mon Sep 17 00:00:00 2001 +From: Chuhong Yuan +Date: Thu, 9 Jul 2020 21:56:08 +0800 +Subject: serial: mxs-auart: add missed iounmap() in probe failure and remove + +From: Chuhong Yuan + +commit d8edf8eb5f6e921fe6389f96d2cd05862730a6ff upstream. + +This driver calls ioremap() in probe, but it misses calling iounmap() in +probe's error handler and remove. +Add the missed calls to fix it. + +Fixes: 47d37d6f94cc ("serial: Add auart driver for i.MX23/28") +Signed-off-by: Chuhong Yuan +Cc: stable +Link: https://lore.kernel.org/r/20200709135608.68290-1-hslester96@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/mxs-auart.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/tty/serial/mxs-auart.c ++++ b/drivers/tty/serial/mxs-auart.c +@@ -1698,21 +1698,21 @@ static int mxs_auart_probe(struct platfo + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + ret = irq; +- goto out_disable_clks; ++ goto out_iounmap; + } + + s->port.irq = irq; + ret = devm_request_irq(&pdev->dev, irq, mxs_auart_irq_handle, 0, + dev_name(&pdev->dev), s); + if (ret) +- goto out_disable_clks; ++ goto out_iounmap; + + platform_set_drvdata(pdev, s); + + ret = mxs_auart_init_gpios(s, &pdev->dev); + if (ret) { + dev_err(&pdev->dev, "Failed to initialize GPIOs.\n"); +- goto out_disable_clks; ++ goto out_iounmap; + } + + /* +@@ -1720,7 +1720,7 @@ static int mxs_auart_probe(struct platfo + */ + ret = mxs_auart_request_gpio_irq(s); + if (ret) +- goto out_disable_clks; ++ goto out_iounmap; + + auart_port[s->port.line] = s; + +@@ -1746,6 +1746,9 @@ out_free_qpio_irq: + mxs_auart_free_gpio_irq(s); + auart_port[pdev->id] = NULL; + ++out_iounmap: ++ iounmap(s->port.membase); ++ + out_disable_clks: + if (is_asm9260_auart(s)) { + clk_disable_unprepare(s->clk); +@@ -1761,6 +1764,7 @@ static int mxs_auart_remove(struct platf + uart_remove_one_port(&auart_driver, &s->port); + auart_port[pdev->id] = NULL; + mxs_auart_free_gpio_irq(s); ++ iounmap(s->port.membase); + if (is_asm9260_auart(s)) { + clk_disable_unprepare(s->clk); + clk_disable_unprepare(s->clk_ahb); diff --git a/queue-5.7/serial-sh-sci-initialize-spinlock-for-uart-console.patch b/queue-5.7/serial-sh-sci-initialize-spinlock-for-uart-console.patch new file mode 100644 index 00000000000..b0d8d1de244 --- /dev/null +++ b/queue-5.7/serial-sh-sci-initialize-spinlock-for-uart-console.patch @@ -0,0 +1,65 @@ +From f38278e9b810b06aff2981d505267be984423ba3 Mon Sep 17 00:00:00 2001 +From: Lad Prabhakar +Date: Wed, 1 Jul 2020 16:41:40 +0100 +Subject: serial: sh-sci: Initialize spinlock for uart console + +From: Lad Prabhakar + +commit f38278e9b810b06aff2981d505267be984423ba3 upstream. + +serial core expects the spinlock to be initialized by the controller +driver for serial console, this patch makes sure the spinlock is +initialized, fixing the below issue: + +[ 0.865928] BUG: spinlock bad magic on CPU#0, swapper/0/1 +[ 0.865945] lock: sci_ports+0x0/0x4c80, .magic: 00000000, .owner: /-1, .owner_cpu: 0 +[ 0.865955] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc1+ #112 +[ 0.865961] Hardware name: HopeRun HiHope RZ/G2H with sub board (DT) +[ 0.865968] Call trace: +[ 0.865979] dump_backtrace+0x0/0x1d8 +[ 0.865985] show_stack+0x14/0x20 +[ 0.865996] dump_stack+0xe8/0x130 +[ 0.866006] spin_dump+0x6c/0x88 +[ 0.866012] do_raw_spin_lock+0xb0/0xf8 +[ 0.866023] _raw_spin_lock_irqsave+0x80/0xa0 +[ 0.866032] uart_add_one_port+0x3a4/0x4e0 +[ 0.866039] sci_probe+0x504/0x7c8 +[ 0.866048] platform_drv_probe+0x50/0xa0 +[ 0.866059] really_probe+0xdc/0x330 +[ 0.866066] driver_probe_device+0x58/0xb8 +[ 0.866072] device_driver_attach+0x6c/0x90 +[ 0.866078] __driver_attach+0x88/0xd0 +[ 0.866085] bus_for_each_dev+0x74/0xc8 +[ 0.866091] driver_attach+0x20/0x28 +[ 0.866098] bus_add_driver+0x14c/0x1f8 +[ 0.866104] driver_register+0x60/0x110 +[ 0.866109] __platform_driver_register+0x40/0x48 +[ 0.866119] sci_init+0x2c/0x34 +[ 0.866127] do_one_initcall+0x88/0x428 +[ 0.866137] kernel_init_freeable+0x2c0/0x328 +[ 0.866143] kernel_init+0x10/0x108 +[ 0.866150] ret_from_fork+0x10/0x18 + +Signed-off-by: Lad Prabhakar +Reviewed-by: Biju Das +Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console") +Cc: stable +Link: https://lore.kernel.org/r/1593618100-2151-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/sh-sci.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/tty/serial/sh-sci.c ++++ b/drivers/tty/serial/sh-sci.c +@@ -3301,6 +3301,9 @@ static int sci_probe_single(struct platf + sciport->port.flags |= UPF_HARD_FLOW; + } + ++ if (sci_uart_driver.cons->index == sciport->port.line) ++ spin_lock_init(&sciport->port.lock); ++ + ret = uart_add_one_port(&sci_uart_driver, &sciport->port); + if (ret) { + sci_cleanup_single(sciport); diff --git a/queue-5.7/series b/queue-5.7/series index bf17d0985a4..55d2cb1def8 100644 --- a/queue-5.7/series +++ b/queue-5.7/series @@ -168,3 +168,11 @@ usb-serial-option-add-gosuncn-gm500-series.patch usb-serial-option-add-quectel-eg95-lte-modem.patch virt-vbox-fix-vbgl_ioctl_vmmdev_request_big-and-_log-req-numbers-to-match-upstream.patch virt-vbox-fix-guest-capabilities-mask-check.patch +revert-tty-xilinx_uartps-fix-missing-id-assignment-to-the-console.patch +tty-serial-cpm_uart-fix-behaviour-for-non-existing-gpios.patch +virtio-virtio_console-add-missing-module_device_table-for-rproc-serial.patch +serial-sh-sci-initialize-spinlock-for-uart-console.patch +serial-mxs-auart-add-missed-iounmap-in-probe-failure-and-remove.patch +revert-serial-core-refactor-uart_unlock_and_check_sysrq.patch +serial-core-fix-sysrq-overhead-regression.patch +ovl-fix-regression-with-re-formatted-lower-squashfs.patch diff --git a/queue-5.7/tty-serial-cpm_uart-fix-behaviour-for-non-existing-gpios.patch b/queue-5.7/tty-serial-cpm_uart-fix-behaviour-for-non-existing-gpios.patch new file mode 100644 index 00000000000..b4567a0165d --- /dev/null +++ b/queue-5.7/tty-serial-cpm_uart-fix-behaviour-for-non-existing-gpios.patch @@ -0,0 +1,63 @@ +From 311eab8d5900ea9088513d4c6b4570058958edb5 Mon Sep 17 00:00:00 2001 +From: Christophe Leroy +Date: Fri, 12 Jun 2020 18:26:07 +0000 +Subject: tty: serial: cpm_uart: Fix behaviour for non existing GPIOs + +From: Christophe Leroy + +commit 311eab8d5900ea9088513d4c6b4570058958edb5 upstream. + +devm_gpiod_get_index() doesn't return NULL but -ENOENT when the +requested GPIO doesn't exist, leading to the following messages: + +[ 2.742468] gpiod_direction_input: invalid GPIO (errorpointer) +[ 2.748147] can't set direction for gpio #2: -2 +[ 2.753081] gpiod_direction_input: invalid GPIO (errorpointer) +[ 2.758724] can't set direction for gpio #3: -2 +[ 2.763666] gpiod_direction_output: invalid GPIO (errorpointer) +[ 2.769394] can't set direction for gpio #4: -2 +[ 2.774341] gpiod_direction_input: invalid GPIO (errorpointer) +[ 2.779981] can't set direction for gpio #5: -2 +[ 2.784545] ff000a20.serial: ttyCPM1 at MMIO 0xfff00a20 (irq = 39, base_baud = 8250000) is a CPM UART + +Use devm_gpiod_get_index_optional() instead. + +At the same time, handle the error case and properly exit +with an error. + +Fixes: 97cbaf2c829b ("tty: serial: cpm_uart: Convert to use GPIO descriptors") +Cc: stable@vger.kernel.org +Cc: Linus Walleij +Signed-off-by: Christophe Leroy +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/694a25fdce548c5ee8b060ef6a4b02746b8f25c0.1591986307.git.christophe.leroy@csgroup.eu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/cpm_uart/cpm_uart_core.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c ++++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c +@@ -1215,7 +1215,12 @@ static int cpm_uart_init_port(struct dev + + pinfo->gpios[i] = NULL; + +- gpiod = devm_gpiod_get_index(dev, NULL, i, GPIOD_ASIS); ++ gpiod = devm_gpiod_get_index_optional(dev, NULL, i, GPIOD_ASIS); ++ ++ if (IS_ERR(gpiod)) { ++ ret = PTR_ERR(gpiod); ++ goto out_irq; ++ } + + if (gpiod) { + if (i == GPIO_RTS || i == GPIO_DTR) +@@ -1237,6 +1242,8 @@ static int cpm_uart_init_port(struct dev + + return cpm_uart_request_port(&pinfo->port); + ++out_irq: ++ irq_dispose_mapping(pinfo->port.irq); + out_pram: + cpm_uart_unmap_pram(pinfo, pram); + out_mem: diff --git a/queue-5.7/virtio-virtio_console-add-missing-module_device_table-for-rproc-serial.patch b/queue-5.7/virtio-virtio_console-add-missing-module_device_table-for-rproc-serial.patch new file mode 100644 index 00000000000..a3dadda90be --- /dev/null +++ b/queue-5.7/virtio-virtio_console-add-missing-module_device_table-for-rproc-serial.patch @@ -0,0 +1,51 @@ +From 897c44f0bae574c5fb318c759b060bebf9dd6013 Mon Sep 17 00:00:00 2001 +From: Alexander Lobakin +Date: Tue, 23 Jun 2020 11:09:33 +0000 +Subject: virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial + +From: Alexander Lobakin + +commit 897c44f0bae574c5fb318c759b060bebf9dd6013 upstream. + +rproc_serial_id_table lacks an exposure to module devicetable, so +when remoteproc firmware requests VIRTIO_ID_RPROC_SERIAL, no uevent +is generated and no module autoloading occurs. +Add missing MODULE_DEVICE_TABLE() annotation and move the existing +one for VIRTIO_ID_CONSOLE right to the table itself. + +Fixes: 1b6370463e88 ("virtio_console: Add support for remoteproc serial") +Cc: # v3.8+ +Signed-off-by: Alexander Lobakin +Reviewed-by: Amit Shah +Link: https://lore.kernel.org/r/x7C_CbeJtoGMy258nwAXASYz3xgFMFpyzmUvOyZzRnQrgWCREBjaqBOpAUS7ol4NnZYvSVwmTsCG0Ohyfvta-ygw6HMHcoeKK0C3QFiAO_Q=@pm.me +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/virtio_console.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/char/virtio_console.c ++++ b/drivers/char/virtio_console.c +@@ -2116,6 +2116,7 @@ static struct virtio_device_id id_table[ + { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, + { 0 }, + }; ++MODULE_DEVICE_TABLE(virtio, id_table); + + static unsigned int features[] = { + VIRTIO_CONSOLE_F_SIZE, +@@ -2128,6 +2129,7 @@ static struct virtio_device_id rproc_ser + #endif + { 0 }, + }; ++MODULE_DEVICE_TABLE(virtio, rproc_serial_id_table); + + static unsigned int rproc_serial_features[] = { + }; +@@ -2280,6 +2282,5 @@ static void __exit fini(void) + module_init(init); + module_exit(fini); + +-MODULE_DEVICE_TABLE(virtio, id_table); + MODULE_DESCRIPTION("Virtio console driver"); + MODULE_LICENSE("GPL"); -- 2.47.3