From: Greg Kroah-Hartman Date: Sun, 25 Sep 2022 07:40:57 +0000 (+0200) Subject: 5.19-stable patches X-Git-Tag: v4.9.330~54 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=039e7a7997f84481e6df49ee15fb44b0a84e35b7;p=thirdparty%2Fkernel%2Fstable-queue.git 5.19-stable patches added patches: cgroup-cgroup_get_from_id-must-check-the-looked-up-kn-is-a-directory.patch io_uring-ensure-that-cached-task-references-are-always-put-on-exit.patch phy-marvell-phy-mvebu-a3700-comphy-remove-broken-reset-support.patch s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch serial-create-uart_xmit_advance.patch serial-fsl_lpuart-reset-prior-to-registration.patch serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch --- diff --git a/queue-5.19/cgroup-cgroup_get_from_id-must-check-the-looked-up-kn-is-a-directory.patch b/queue-5.19/cgroup-cgroup_get_from_id-must-check-the-looked-up-kn-is-a-directory.patch new file mode 100644 index 00000000000..59f78139bc1 --- /dev/null +++ b/queue-5.19/cgroup-cgroup_get_from_id-must-check-the-looked-up-kn-is-a-directory.patch @@ -0,0 +1,45 @@ +From df02452f3df069a59bc9e69c84435bf115cb6e37 Mon Sep 17 00:00:00 2001 +From: Ming Lei +Date: Fri, 23 Sep 2022 19:51:19 +0800 +Subject: cgroup: cgroup_get_from_id() must check the looked-up kn is a directory + +From: Ming Lei + +commit df02452f3df069a59bc9e69c84435bf115cb6e37 upstream. + +cgroup has to be one kernfs dir, otherwise kernel panic is caused, +especially cgroup id is provide from userspace. + +Reported-by: Marco Patalano +Fixes: 6b658c4863c1 ("scsi: cgroup: Add cgroup_get_from_id()") +Cc: Muneendra +Signed-off-by: Ming Lei +Acked-by: Mukesh Ojha +Cc: stable@vger.kernel.org # v5.14+ +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +--- + kernel/cgroup/cgroup.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -6026,6 +6026,9 @@ struct cgroup *cgroup_get_from_id(u64 id + if (!kn) + goto out; + ++ if (kernfs_type(kn) != KERNFS_DIR) ++ goto put; ++ + rcu_read_lock(); + + cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); +@@ -6033,7 +6036,7 @@ struct cgroup *cgroup_get_from_id(u64 id + cgrp = NULL; + + rcu_read_unlock(); +- ++put: + kernfs_put(kn); + out: + return cgrp; diff --git a/queue-5.19/io_uring-ensure-that-cached-task-references-are-always-put-on-exit.patch b/queue-5.19/io_uring-ensure-that-cached-task-references-are-always-put-on-exit.patch new file mode 100644 index 00000000000..c1b42cdc7c0 --- /dev/null +++ b/queue-5.19/io_uring-ensure-that-cached-task-references-are-always-put-on-exit.patch @@ -0,0 +1,49 @@ +From e775f93f2ab976a2cdb4a7b53063cbe890904f73 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Fri, 23 Sep 2022 13:44:56 -0600 +Subject: io_uring: ensure that cached task references are always put on exit + +From: Jens Axboe + +commit e775f93f2ab976a2cdb4a7b53063cbe890904f73 upstream. + +io_uring caches task references to avoid doing atomics for each of them +per request. If a request is put from the same task that allocated it, +then we can maintain a per-ctx cache of them. This obviously relies +on io_uring always pruning caches in a reliable way, and there's +currently a case off io_uring fd release where we can miss that. + +One example is a ring setup with IOPOLL, which relies on the task +polling for completions, which will free them. However, if such a task +submits a request and then exits or closes the ring without reaping +the completion, then ring release will reap and put. If release happens +from that very same task, the completed request task refs will get +put back into the cache pool. This is problematic, as we're now beyond +the point of pruning caches. + +Manually drop these caches after doing an IOPOLL reap. This releases +references from the current task, which is enough. If another task +happens to be doing the release, then the caching will not be +triggered and there's no issue. + +Cc: stable@vger.kernel.org +Fixes: e98e49b2bbf7 ("io_uring: extend task put optimisations") +Reported-by: Homin Rhee +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + io_uring/io_uring.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/io_uring/io_uring.c ++++ b/io_uring/io_uring.c +@@ -10951,6 +10951,9 @@ static __cold void io_ring_ctx_wait_and_ + io_poll_remove_all(ctx, NULL, true); + /* if we failed setting up the ctx, we might not have any rings */ + io_iopoll_try_reap_events(ctx); ++ /* drop cached put refs after potentially doing completions */ ++ if (current->io_uring) ++ io_uring_drop_tctx_refs(current); + } + + INIT_WORK(&ctx->exit_work, io_ring_exit_work); diff --git a/queue-5.19/phy-marvell-phy-mvebu-a3700-comphy-remove-broken-reset-support.patch b/queue-5.19/phy-marvell-phy-mvebu-a3700-comphy-remove-broken-reset-support.patch new file mode 100644 index 00000000000..bf4f6fcf559 --- /dev/null +++ b/queue-5.19/phy-marvell-phy-mvebu-a3700-comphy-remove-broken-reset-support.patch @@ -0,0 +1,203 @@ +From 0a6fc70d76bddf98278af2ac000379c82aec8f11 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Mon, 29 Aug 2022 10:30:46 +0200 +Subject: phy: marvell: phy-mvebu-a3700-comphy: Remove broken reset support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +commit 0a6fc70d76bddf98278af2ac000379c82aec8f11 upstream. + +Reset support for SATA PHY is somehow broken and after calling it, kernel +is not able to detect and initialize SATA disk Samsung SSD 850 EMT0 [1]. + +Reset support was introduced in commit 934337080c6c ("phy: marvell: +phy-mvebu-a3700-comphy: Add native kernel implementation") as part of +complete rewrite of this driver. v1 patch series of that commit [2] did +not contain reset support and was tested that is working fine with +Ethernet, SATA and USB PHYs without issues too. + +So for now remove broken reset support and change implementation of +power_off callback to power off all functions on specified lane (and not +only selected function) because during startup kernel does not know which +function was selected and configured by bootloader. Same logic was used +also in v1 patch series of that commit. + +This change fixes issues with initialization of SATA disk Samsung SSD 850 +and disk is working again, like before mentioned commit. + +Once problem with PHY reset callback is solved its functionality could be +re-introduced. But for now it is unknown why it does not work. + +[1] - https://lore.kernel.org/r/20220531124159.3e4lgn2v462irbtz@shindev/ +[2] - https://lore.kernel.org/r/20211028184242.22105-1-kabel@kernel.org/ + +Reported-by: Shinichiro Kawasaki +Fixes: 934337080c6c ("phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation") +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: Pali Rohár +Tested-by: Shinichiro Kawasaki +Link: https://lore.kernel.org/r/20220829083046.15082-1-pali@kernel.org +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman +--- + drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 87 ++++---------------- + 1 file changed, 17 insertions(+), 70 deletions(-) + +diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +index a4d7d9bd100d..67712c77d806 100644 +--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c ++++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +@@ -274,7 +274,6 @@ struct mvebu_a3700_comphy_lane { + int submode; + bool invert_tx; + bool invert_rx; +- bool needs_reset; + }; + + struct gbe_phy_init_data_fix { +@@ -1097,40 +1096,12 @@ mvebu_a3700_comphy_pcie_power_off(struct mvebu_a3700_comphy_lane *lane) + 0x0, PU_PLL_BIT | PU_RX_BIT | PU_TX_BIT); + } + +-static int mvebu_a3700_comphy_reset(struct phy *phy) ++static void mvebu_a3700_comphy_usb3_power_off(struct mvebu_a3700_comphy_lane *lane) + { +- struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); +- u16 mask, data; +- +- dev_dbg(lane->dev, "resetting lane %d\n", lane->id); +- +- /* COMPHY reset for internal logic */ +- comphy_lane_reg_set(lane, COMPHY_SFT_RESET, +- SFT_RST_NO_REG, SFT_RST_NO_REG); +- +- /* COMPHY register reset (cleared automatically) */ +- comphy_lane_reg_set(lane, COMPHY_SFT_RESET, SFT_RST, SFT_RST); +- +- /* PIPE soft and register reset */ +- data = PIPE_SOFT_RESET | PIPE_REG_RESET; +- mask = data; +- comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, data, mask); +- +- /* Release PIPE register reset */ +- comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, +- 0x0, PIPE_REG_RESET); +- +- /* Reset SB configuration register (only for lanes 0 and 1) */ +- if (lane->id == 0 || lane->id == 1) { +- u32 mask, data; +- +- data = PIN_RESET_CORE_BIT | PIN_RESET_COMPHY_BIT | +- PIN_PU_PLL_BIT | PIN_PU_RX_BIT | PIN_PU_TX_BIT; +- mask = data | PIN_PU_IVREF_BIT | PIN_TX_IDLE_BIT; +- comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask); +- } +- +- return 0; ++ /* ++ * The USB3 MAC sets the USB3 PHY to low state, so we do not ++ * need to power off USB3 PHY again. ++ */ + } + + static bool mvebu_a3700_comphy_check_mode(int lane, +@@ -1171,10 +1142,6 @@ static int mvebu_a3700_comphy_set_mode(struct phy *phy, enum phy_mode mode, + (lane->mode != mode || lane->submode != submode)) + return -EBUSY; + +- /* If changing mode, ensure reset is called */ +- if (lane->mode != PHY_MODE_INVALID && lane->mode != mode) +- lane->needs_reset = true; +- + /* Just remember the mode, ->power_on() will do the real setup */ + lane->mode = mode; + lane->submode = submode; +@@ -1185,7 +1152,6 @@ static int mvebu_a3700_comphy_set_mode(struct phy *phy, enum phy_mode mode, + static int mvebu_a3700_comphy_power_on(struct phy *phy) + { + struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); +- int ret; + + if (!mvebu_a3700_comphy_check_mode(lane->id, lane->mode, + lane->submode)) { +@@ -1193,14 +1159,6 @@ static int mvebu_a3700_comphy_power_on(struct phy *phy) + return -EINVAL; + } + +- if (lane->needs_reset) { +- ret = mvebu_a3700_comphy_reset(phy); +- if (ret) +- return ret; +- +- lane->needs_reset = false; +- } +- + switch (lane->mode) { + case PHY_MODE_USB_HOST_SS: + dev_dbg(lane->dev, "set lane %d to USB3 host mode\n", lane->id); +@@ -1224,38 +1182,28 @@ static int mvebu_a3700_comphy_power_off(struct phy *phy) + { + struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); + +- switch (lane->mode) { +- case PHY_MODE_USB_HOST_SS: +- /* +- * The USB3 MAC sets the USB3 PHY to low state, so we do not +- * need to power off USB3 PHY again. +- */ +- break; +- +- case PHY_MODE_SATA: +- mvebu_a3700_comphy_sata_power_off(lane); +- break; +- +- case PHY_MODE_ETHERNET: ++ switch (lane->id) { ++ case 0: ++ mvebu_a3700_comphy_usb3_power_off(lane); + mvebu_a3700_comphy_ethernet_power_off(lane); +- break; +- +- case PHY_MODE_PCIE: ++ return 0; ++ case 1: + mvebu_a3700_comphy_pcie_power_off(lane); +- break; +- ++ mvebu_a3700_comphy_ethernet_power_off(lane); ++ return 0; ++ case 2: ++ mvebu_a3700_comphy_usb3_power_off(lane); ++ mvebu_a3700_comphy_sata_power_off(lane); ++ return 0; + default: + dev_err(lane->dev, "invalid COMPHY mode\n"); + return -EINVAL; + } +- +- return 0; + } + + static const struct phy_ops mvebu_a3700_comphy_ops = { + .power_on = mvebu_a3700_comphy_power_on, + .power_off = mvebu_a3700_comphy_power_off, +- .reset = mvebu_a3700_comphy_reset, + .set_mode = mvebu_a3700_comphy_set_mode, + .owner = THIS_MODULE, + }; +@@ -1393,8 +1341,7 @@ static int mvebu_a3700_comphy_probe(struct platform_device *pdev) + * To avoid relying on the bootloader/firmware configuration, + * power off all comphys. + */ +- mvebu_a3700_comphy_reset(phy); +- lane->needs_reset = false; ++ mvebu_a3700_comphy_power_off(phy); + } + + provider = devm_of_phy_provider_register(&pdev->dev, +-- +2.37.3 + diff --git a/queue-5.19/s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch b/queue-5.19/s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch new file mode 100644 index 00000000000..750f0976079 --- /dev/null +++ b/queue-5.19/s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch @@ -0,0 +1,59 @@ +From db7ba07108a48c0f95b74fabbfd5d63e924f992d Mon Sep 17 00:00:00 2001 +From: Stefan Haberland +Date: Mon, 19 Sep 2022 17:49:31 +0200 +Subject: s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup + +From: Stefan Haberland + +commit db7ba07108a48c0f95b74fabbfd5d63e924f992d upstream. + +Fix Oops in dasd_alias_get_start_dev() function caused by the pavgroup +pointer being NULL. + +The pavgroup pointer is checked on the entrance of the function but +without the lcu->lock being held. Therefore there is a race window +between dasd_alias_get_start_dev() and _lcu_update() which sets +pavgroup to NULL with the lcu->lock held. + +Fix by checking the pavgroup pointer with lcu->lock held. + +Cc: # 2.6.25+ +Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") +Signed-off-by: Stefan Haberland +Reviewed-by: Jan Hoeppner +Link: https://lore.kernel.org/r/20220919154931.4123002-2-sth@linux.ibm.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/block/dasd_alias.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/s390/block/dasd_alias.c ++++ b/drivers/s390/block/dasd_alias.c +@@ -675,12 +675,12 @@ int dasd_alias_remove_device(struct dasd + struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device) + { + struct dasd_eckd_private *alias_priv, *private = base_device->private; +- struct alias_pav_group *group = private->pavgroup; + struct alias_lcu *lcu = private->lcu; + struct dasd_device *alias_device; ++ struct alias_pav_group *group; + unsigned long flags; + +- if (!group || !lcu) ++ if (!lcu) + return NULL; + if (lcu->pav == NO_PAV || + lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) +@@ -697,6 +697,11 @@ struct dasd_device *dasd_alias_get_start + } + + spin_lock_irqsave(&lcu->lock, flags); ++ group = private->pavgroup; ++ if (!group) { ++ spin_unlock_irqrestore(&lcu->lock, flags); ++ return NULL; ++ } + alias_device = group->next; + if (!alias_device) { + if (list_empty(&group->aliaslist)) { diff --git a/queue-5.19/serial-create-uart_xmit_advance.patch b/queue-5.19/serial-create-uart_xmit_advance.patch new file mode 100644 index 00000000000..cb570efb078 --- /dev/null +++ b/queue-5.19/serial-create-uart_xmit_advance.patch @@ -0,0 +1,51 @@ +From e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= +Date: Thu, 1 Sep 2022 17:39:32 +0300 +Subject: serial: Create uart_xmit_advance() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +commit e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d upstream. + +A very common pattern in the drivers is to advance xmit tail +index and do bookkeeping of Tx'ed characters. Create +uart_xmit_advance() to handle it. + +Reviewed-by: Andy Shevchenko +Cc: stable +Signed-off-by: Ilpo Järvinen +Link: https://lore.kernel.org/r/20220901143934.8850-2-ilpo.jarvinen@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/serial_core.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -302,6 +302,23 @@ struct uart_state { + /* number of characters left in xmit buffer before we ask for more */ + #define WAKEUP_CHARS 256 + ++/** ++ * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars ++ * @up: uart_port structure describing the port ++ * @chars: number of characters sent ++ * ++ * This function advances the tail of circular xmit buffer by the number of ++ * @chars transmitted and handles accounting of transmitted bytes (into ++ * @up's icount.tx). ++ */ ++static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars) ++{ ++ struct circ_buf *xmit = &up->state->xmit; ++ ++ xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1); ++ up->icount.tx += chars; ++} ++ + struct module; + struct tty_driver; + diff --git a/queue-5.19/serial-fsl_lpuart-reset-prior-to-registration.patch b/queue-5.19/serial-fsl_lpuart-reset-prior-to-registration.patch new file mode 100644 index 00000000000..9b556f4201d --- /dev/null +++ b/queue-5.19/serial-fsl_lpuart-reset-prior-to-registration.patch @@ -0,0 +1,63 @@ +From 60f361722ad2ae5ee667d0b0545d40c42f754daf Mon Sep 17 00:00:00 2001 +From: Lukas Wunner +Date: Sun, 11 Sep 2022 10:22:01 +0200 +Subject: serial: fsl_lpuart: Reset prior to registration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lukas Wunner + +commit 60f361722ad2ae5ee667d0b0545d40c42f754daf upstream. + +Since commit bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset +for imx7ulp and imx8qxp"), certain i.MX UARTs are reset after they've +already been registered. Register state may thus be clobbered after +user space has begun to open and access the UART. + +Avoid by performing the reset prior to registration. + +Fixes: bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp") +Cc: stable@vger.kernel.org # v5.15+ +Cc: Fugang Duan +Cc: Sherry Sun +Reviewed-by: Ilpo Järvinen +Signed-off-by: Lukas Wunner +Link: https://lore.kernel.org/r/72fb646c1b0b11c989850c55f52f9ff343d1b2fa.1662884345.git.lukas@wunner.de +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/fsl_lpuart.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/tty/serial/fsl_lpuart.c ++++ b/drivers/tty/serial/fsl_lpuart.c +@@ -2706,14 +2706,15 @@ static int lpuart_probe(struct platform_ + lpuart_reg.cons = LPUART_CONSOLE; + handler = lpuart_int; + } +- ret = uart_add_one_port(&lpuart_reg, &sport->port); +- if (ret) +- goto failed_attach_port; + + ret = lpuart_global_reset(sport); + if (ret) + goto failed_reset; + ++ ret = uart_add_one_port(&lpuart_reg, &sport->port); ++ if (ret) ++ goto failed_attach_port; ++ + ret = uart_get_rs485_mode(&sport->port); + if (ret) + goto failed_get_rs485; +@@ -2736,9 +2737,9 @@ static int lpuart_probe(struct platform_ + + failed_irq_request: + failed_get_rs485: +-failed_reset: + uart_remove_one_port(&lpuart_reg, &sport->port); + failed_attach_port: ++failed_reset: + lpuart_disable_clks(sport); + return ret; + } diff --git a/queue-5.19/serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch b/queue-5.19/serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch new file mode 100644 index 00000000000..877d7e7fe8a --- /dev/null +++ b/queue-5.19/serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch @@ -0,0 +1,36 @@ +From 1d10cd4da593bc0196a239dcc54dac24b6b0a74e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= +Date: Thu, 1 Sep 2022 17:39:34 +0300 +Subject: serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +commit 1d10cd4da593bc0196a239dcc54dac24b6b0a74e upstream. + +Tx'ing does not correctly account Tx'ed characters into icount.tx. +Using uart_xmit_advance() fixes the problem. + +Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver") +Cc: # serial: Create uart_xmit_advance() +Reviewed-by: Andy Shevchenko +Signed-off-by: Ilpo Järvinen +Link: https://lore.kernel.org/r/20220901143934.8850-4-ilpo.jarvinen@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/tegra-tcu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/tegra-tcu.c ++++ b/drivers/tty/serial/tegra-tcu.c +@@ -101,7 +101,7 @@ static void tegra_tcu_uart_start_tx(stru + break; + + tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); +- xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); ++ uart_xmit_advance(port, count); + } + + uart_write_wakeup(port); diff --git a/queue-5.19/serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch b/queue-5.19/serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch new file mode 100644 index 00000000000..5df060eddd4 --- /dev/null +++ b/queue-5.19/serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch @@ -0,0 +1,53 @@ +From 754f68044c7dd6c52534ba3e0f664830285c4b15 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= +Date: Thu, 1 Sep 2022 17:39:33 +0300 +Subject: serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +commit 754f68044c7dd6c52534ba3e0f664830285c4b15 upstream. + +DMA complete & stop paths did not correctly account Tx'ed characters +into icount.tx. Using uart_xmit_advance() fixes the problem. + +Fixes: e9ea096dd225 ("serial: tegra: add serial driver") +Cc: # serial: Create uart_xmit_advance() +Reviewed-by: Andy Shevchenko +Signed-off-by: Ilpo Järvinen +Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/serial-tegra.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/drivers/tty/serial/serial-tegra.c ++++ b/drivers/tty/serial/serial-tegra.c +@@ -525,7 +525,7 @@ static void tegra_uart_tx_dma_complete(v + count = tup->tx_bytes_requested - state.residue; + async_tx_ack(tup->tx_dma_desc); + spin_lock_irqsave(&tup->uport.lock, flags); +- xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); ++ uart_xmit_advance(&tup->uport, count); + tup->tx_in_progress = 0; + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) + uart_write_wakeup(&tup->uport); +@@ -613,7 +613,6 @@ static unsigned int tegra_uart_tx_empty( + static void tegra_uart_stop_tx(struct uart_port *u) + { + struct tegra_uart_port *tup = to_tegra_uport(u); +- struct circ_buf *xmit = &tup->uport.state->xmit; + struct dma_tx_state state; + unsigned int count; + +@@ -624,7 +623,7 @@ static void tegra_uart_stop_tx(struct ua + dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); + count = tup->tx_bytes_requested - state.residue; + async_tx_ack(tup->tx_dma_desc); +- xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); ++ uart_xmit_advance(&tup->uport, count); + tup->tx_in_progress = 0; + } + diff --git a/queue-5.19/series b/queue-5.19/series index e60c202889c..2f6b9a475fa 100644 --- a/queue-5.19/series +++ b/queue-5.19/series @@ -156,3 +156,11 @@ net-sunhme-fix-packet-reception-for-len-rx_copy_thre.patch net-sched-fix-possible-refcount-leak-in-tc_new_tfilt.patch bnxt-prevent-skb-uaf-after-handing-over-to-ptp-worke.patch selftests-forwarding-add-shebang-for-sch_red.sh.patch +io_uring-ensure-that-cached-task-references-are-always-put-on-exit.patch +serial-fsl_lpuart-reset-prior-to-registration.patch +serial-create-uart_xmit_advance.patch +serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch +serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch +cgroup-cgroup_get_from_id-must-check-the-looked-up-kn-is-a-directory.patch +phy-marvell-phy-mvebu-a3700-comphy-remove-broken-reset-support.patch +s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch