From patchwork Wed Oct 9 14:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828556 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 556E319CC3E; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=mQp2sXzzUlWwTpxmcb4Df3gj+ugo4myUNSeWI+sulv0DhLLZ8IWFMlqJYUrpmt2kIdlEQdaz9s6pYaRsv7sOM3xwqO4oLfcAQhKUyHgyXKX6QOS7APJqvxonLP4liLSv1YjNh+arbGJ5yXMtpTUBe2yVSwGBjN2SSup37ttEd/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=hA1GeyxbnSLCBiHHg6Bb4ny0jlhc5XDjypu7jIcha+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H6eiq0sE5yLvCqzi3FZIJvflOkZAm6NDUwX4yQsB6gsCYcJWz+IEoEU/fkWWIfM0zM9+2MLplhk3c0GdSDiDejhXZuNqVKC+4LgiLrpmZ+Xmih82GozLeKrQ68EJfo2t1ZsZ5R1+k6aQD1/UOALUxpdmsq8tH/0pjtqMotnf1LU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e87dP9Nx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e87dP9Nx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB5CC4CEC5; Wed, 9 Oct 2024 14:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485488; bh=hA1GeyxbnSLCBiHHg6Bb4ny0jlhc5XDjypu7jIcha+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e87dP9NxhuCIAVm+bDqyl3Df/MlwyA8gX2yAL8GU4nsYaekseywIuHXlfOWlwFxBs 9tV0XbfXzlSYb6Whc7dp/uC0lOvC1963vce7OYAFmo4J9zot5fxk3XLb0jexaZ2oRz o9MPRZMhykKcX8xIVW5/ZtVV4me7ng7dmrUQzhykEB8POWSwGMOJuC/I+4sPk2PmkO umEMN7ZFfKXGGeptCL7HxXhOA5l/RSGwG88CaMbIzoIZYL+S8nZCH/runyCnqhYhiL IEG16X/vthfa+ZYX2yIHhlK3eFQ4IF1cEFNswHXJSxqc+p37UuvjjHxCzBaJ+CjfDn vF5v33OUAn3bA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2G-000000004OV-2dfF; Wed, 09 Oct 2024 16:51:32 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH v3 1/9] serial: qcom-geni: fix polled console initialisation Date: Wed, 9 Oct 2024 16:51:02 +0200 Message-ID: <20241009145110.16847-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The polled console (KGDB/KDB) implementation must not call port setup unconditionally as the port may already be in use by the console or a getty. Only make sure that the receiver is enabled, but do not enable any device interrupts. Fixes: d8851a96ba25 ("tty: serial: qcom-geni-serial: Add a poll_init() function") Cc: stable@vger.kernel.org # 6.4 Cc: Douglas Anderson Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 6f0db310cf69..c237c9d107cd 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -147,6 +147,7 @@ static struct uart_driver qcom_geni_uart_driver; static void __qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport); static void qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport); +static int qcom_geni_serial_port_setup(struct uart_port *uport); static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport) { @@ -395,6 +396,23 @@ static void qcom_geni_serial_poll_put_char(struct uart_port *uport, writel(c, uport->membase + SE_GENI_TX_FIFOn); qcom_geni_serial_poll_tx_done(uport); } + +static int qcom_geni_serial_poll_init(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + int ret; + + if (!port->setup) { + ret = qcom_geni_serial_port_setup(uport); + if (ret) + return ret; + } + + if (!qcom_geni_serial_secondary_active(uport)) + geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); + + return 0; +} #endif #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE @@ -1582,7 +1600,7 @@ static const struct uart_ops qcom_geni_console_pops = { #ifdef CONFIG_CONSOLE_POLL .poll_get_char = qcom_geni_serial_get_char, .poll_put_char = qcom_geni_serial_poll_put_char, - .poll_init = qcom_geni_serial_port_setup, + .poll_init = qcom_geni_serial_poll_init, #endif .pm = qcom_geni_serial_pm, }; From patchwork Wed Oct 9 14:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828564 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7414F1A4F0C; Wed, 9 Oct 2024 14:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485490; cv=none; b=roTM2bg2GyfeySKZmaDjZbFBKKjjj9BfBGHvYmpUg1YzgLXN3OAGh1ZGLfB/qAIqjY5KKs+hwGgqbVDbARIkmzo5G3v1MjWimbEFuXTkLg0/n4bgd1v5FOyyT8chqFHkQtPG453yx7htGzQqy8z82d8NUaJsDlX1ww+t8IhJliQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485490; c=relaxed/simple; bh=5X379KfhJLHXk+Rf6uIayisvi5RGJbFHeIw5cV9JW6A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VWIup4NuIdYklimMHXX+iIZhsetGtysUYssoD9Dc+1ra9OG4oENk8vgEGWJeEwR3fANxOgsZvkwv0ay6RE4/dcK0t57rEI6Sb0+gvLcxFk+owPsW17fFOIxkfstJcjMwUq0/UBd5AUAnv3splxhRWgHqFXZ1u+ynps+HKJpuxl8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nEuKbpyT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nEuKbpyT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEC69C4CECD; Wed, 9 Oct 2024 14:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485490; bh=5X379KfhJLHXk+Rf6uIayisvi5RGJbFHeIw5cV9JW6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEuKbpyT5LQP7PES7W35eK5pZYm8yUjsKC0ph6dxnJuNEUG9BezUGwuzBUsVXoWVP K41HrXiFXOdW7ZIYQGTYXGLpZ1RBWCwEPF6XnXasuyceF6O6Gqasv1B1tx1gjies1z T3TNpsSjF/eaprvlBrIzjLiDSZCeEbPQPsDpPB/BOIMXVuR7r4JUOpgBSWKqXbFZD0 KZd9kDKC2XraOZYV8XZYFcZ7eq46LnwILZ1eMgo5PLR4zN0hUw7wOBz3QU1i9Sv/dS vaAbtlbuMwUSYQDThl8ZolIJHa1CAyQqKD4pQOK/P6aOYpFe7B+FYUnwninwf8zNG0 +xN1+NG26Fm2g== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2G-000000004OX-2ypK; Wed, 09 Oct 2024 16:51:32 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Aniket Randive Subject: [PATCH v3 2/9] serial: qcom-geni: revert broken hibernation support Date: Wed, 9 Oct 2024 16:51:03 +0200 Message-ID: <20241009145110.16847-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This reverts commit 35781d8356a2eecaa6074ceeb80ee22e252fcdae. Hibernation is not supported on Qualcomm platforms with mainline kernels yet a broken vendor implementation for the GENI serial driver made it upstream. This is effectively dead code that cannot be tested and should just be removed, but if these paths were ever hit for an open non-console port they would crash the machine as the driver would fail to enable clocks during restore() (i.e. all ports would have to be closed by drivers and user space before hibernating the system to avoid this as a comment in the code hinted at). The broken implementation also added a random call to enable the receiver in the port setup code where it does not belong and which enables the receiver prematurely for console ports. Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature") Cc: stable@vger.kernel.org # 6.2 Cc: Aniket Randive Signed-off-by: Johan Hovold --- drivers/tty/serial/qcom_geni_serial.c | 41 ++------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index c237c9d107cd..2e4a5361f137 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1170,7 +1170,6 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) false, true, true); geni_se_init(&port->se, UART_RX_WM, port->rx_fifo_depth - 2); geni_se_select_mode(&port->se, port->dev_data->mode); - qcom_geni_serial_start_rx(uport); port->setup = true; return 0; @@ -1799,38 +1798,6 @@ static int qcom_geni_serial_sys_resume(struct device *dev) return ret; } -static int qcom_geni_serial_sys_hib_resume(struct device *dev) -{ - int ret = 0; - struct uart_port *uport; - struct qcom_geni_private_data *private_data; - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); - - uport = &port->uport; - private_data = uport->private_data; - - if (uart_console(uport)) { - geni_icc_set_tag(&port->se, QCOM_ICC_TAG_ALWAYS); - geni_icc_set_bw(&port->se); - ret = uart_resume_port(private_data->drv, uport); - /* - * For hibernation usecase clients for - * console UART won't call port setup during restore, - * hence call port setup for console uart. - */ - qcom_geni_serial_port_setup(uport); - } else { - /* - * Peripheral register settings are lost during hibernation. - * Update setup flag such that port setup happens again - * during next session. Clients of HS-UART will close and - * open the port during hibernation. - */ - port->setup = false; - } - return ret; -} - static const struct qcom_geni_device_data qcom_geni_console_data = { .console = true, .mode = GENI_SE_FIFO, @@ -1842,12 +1809,8 @@ static const struct qcom_geni_device_data qcom_geni_uart_data = { }; static const struct dev_pm_ops qcom_geni_serial_pm_ops = { - .suspend = pm_sleep_ptr(qcom_geni_serial_sys_suspend), - .resume = pm_sleep_ptr(qcom_geni_serial_sys_resume), - .freeze = pm_sleep_ptr(qcom_geni_serial_sys_suspend), - .poweroff = pm_sleep_ptr(qcom_geni_serial_sys_suspend), - .restore = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume), - .thaw = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume), + SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, + qcom_geni_serial_sys_resume) }; static const struct of_device_id qcom_geni_serial_match_table[] = { From patchwork Wed Oct 9 14:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828557 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5568E19A298; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=mZ9Bh172rTOZ6vxdaQrebWb88fjoqrHv3vqY2CGrZQwGpovXQmpeMJZBD7xOmHZtrPjeCnNfdoLDbv64WOFVUbjWfHSTShEIPV9yAN+fNLUBc4Vll8An6ODz6ZXEAXx9wdZtCsXxOlE63+2J1CEKaQvpeJCqatxNsOVxQ1u6rKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=pg65wunbRaHs0FC1sH4Zw3j8qL0zORmfJsIvyL4owZc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ud0V/6JBou9pDEb7zBczxFTtJ3Rik/hBgSE7tbhNEiBH0TiysK7SVnB0gua7KLpe+ONYzO4W7Kb4kND1UEuf0fRXw5GPfdNCuZ9lwadpZtc1TOl+Tw0/O0idCkm7QR3k9sEEosInxpNd+p6CzpoaUDL2RlTaG9iVbMM6UuN1kPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m0hOxmkk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m0hOxmkk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE4BAC4CECD; Wed, 9 Oct 2024 14:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=pg65wunbRaHs0FC1sH4Zw3j8qL0zORmfJsIvyL4owZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m0hOxmkka1cObw053hpuU66cW+Vfr1s1K1zMr2aA7RhfYfzAmipN18PyA1QREIoSo 7Ea5yXf80fFvXOoDbEMAxFuif+AQTYtDl4DfjAmgNysPcHJQgvJThujN65yjFPnSIu ZXpkdL0uaA8FBXTDj7LHXBZzwod3Bzq+ZfGv1PkUEoIUqFSaA2aQG0l2qa03YKgsJw 6Jwve5Olma+azkSuVfJsuUIYFSdUE3Id4AIsp1GW9VBzKTN9Qru55+H34DPRDM3+eW yzfAXWGrsGOiYe9mCB7pMJQuvAtLOtIG1QSF5NIIGajo6bfaL6iJGEdwTwKv9cqKsH PagdXEMEig45A== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2G-000000004OZ-3Owf; Wed, 09 Oct 2024 16:51:32 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 3/9] serial: qcom-geni: fix shutdown race Date: Wed, 9 Oct 2024 16:51:04 +0200 Message-ID: <20241009145110.16847-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A commit adding back the stopping of tx on port shutdown failed to add back the locking which had also been removed by commit e83766334f96 ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown"). Holding the port lock is needed to serialise against the console code, which may update the interrupt enable register and access the port state. Fixes: d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown") Fixes: 947cc4ecc06c ("serial: qcom-geni: fix soft lockup on sw flow control and suspend") Cc: stable@vger.kernel.org # 6.3 Reviewed-by: Bartosz Golaszewski Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 2e4a5361f137..87cd974b76bf 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1114,10 +1114,12 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport) { disable_irq(uport->irq); + uart_port_lock_irq(uport); qcom_geni_serial_stop_tx(uport); qcom_geni_serial_stop_rx(uport); qcom_geni_serial_cancel_tx_cmd(uport); + uart_port_unlock_irq(uport); } static void qcom_geni_serial_flush_buffer(struct uart_port *uport) From patchwork Wed Oct 9 14:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828559 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 631BB19DF64; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=e3kMb+qv+jc7SbrMvHEfdfrY/4bR8MKcSgyxVLublLnpAvU+W5t/GiV4wXROjweVx2NYTcyzQCHB/sk2Q33m8oKQaIsIo3akTnWGgGj3Mjt42NYIPh1gJVMJczbMX1E5FlH+n48bXgYbYESMqVlifCbOvYeTQ5+UHz8bhk1Vil8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=vkgrwqXtD8jHs1HvPnaoOlMxPl4TCLbLFcFeGyGrTxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pr24SMEcBxRMxsrKI03DMjYZQ/ntqyvhZkPr0Y3PmP12uw9CTHBCO9gb92MrlCF4q9wjpTfa5gp9i1bGGdFRtF/3l9LD3TSJnaZJk+dxZ6SII27AV11HuRznxbOhmYCmxJQg3ndNQ32QF/sH5w4nC1/MQ6jlahlGNfnSdWb9+SM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qa+rwKEz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qa+rwKEz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F157CC4CECF; Wed, 9 Oct 2024 14:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=vkgrwqXtD8jHs1HvPnaoOlMxPl4TCLbLFcFeGyGrTxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qa+rwKEzqiuQ3gOaG8J4ezvUwTiL86WA63Zu0B7O2UKw/QatnqdQ3wwf/rlnhgJDy zAbnyPQyIQ4im77xUC2eXa+e0olt0/wiyA3mvIHGU9D+sbOKT7aEGh880EgnrLo4FR d6b45tptEQ7bX0g6Lgs4Ne1Cz1uY4selvU4Ux/Xn8aghSLJCgHvLfIMaOvRrvAG4QI OC2QRzJuJhLaMC+1B0S++OfeXwN7KtrKiRgfUm1j2dCZQ2eSuyaZVwcq4Acst7bnZA u6WaxmDOJIZ0ot59MjVT8Xoth7NkWNr9+zJ0PDnzTJ8sh9T8s2QZYTB3TDFYdHRqbr 22qxWN5kafJDQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2G-000000004Ob-3ja9; Wed, 09 Oct 2024 16:51:32 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 4/9] serial: qcom-geni: fix dma rx cancellation Date: Wed, 9 Oct 2024 16:51:05 +0200 Message-ID: <20241009145110.16847-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make sure to wait for the DMA transfer to complete when cancelling the rx command on stop_rx(). This specifically prevents the DMA completion interrupt from firing after rx has been restarted, something which can lead to an IOMMU fault and hosed rx when the interrupt handler unmaps the DMA buffer for the new command: qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in! arm-smmu 15000000.iommu: FSR = 00000402 [Format=2 TF], SID=0x563 arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3] Bluetooth: hci0: command 0xfc00 tx timeout Bluetooth: hci0: Reading QCA version information failed (-110) Also add the missing state machine reset which is needed in case cancellation fails. Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA") Cc: stable@vger.kernel.org # 6.3 Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold --- drivers/tty/serial/qcom_geni_serial.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 87cd974b76bf..aaf24bd037a7 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -805,17 +805,27 @@ static void qcom_geni_serial_start_rx_fifo(struct uart_port *uport) static void qcom_geni_serial_stop_rx_dma(struct uart_port *uport) { struct qcom_geni_serial_port *port = to_dev_port(uport); + bool done; if (!qcom_geni_serial_secondary_active(uport)) return; geni_se_cancel_s_cmd(&port->se); - qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS, - S_CMD_CANCEL_EN, true); - - if (qcom_geni_serial_secondary_active(uport)) + done = qcom_geni_serial_poll_bit(uport, SE_DMA_RX_IRQ_STAT, + RX_EOT, true); + if (done) { + writel(RX_EOT | RX_DMA_DONE, + uport->membase + SE_DMA_RX_IRQ_CLR); + } else { qcom_geni_serial_abort_rx(uport); + writel(1, uport->membase + SE_DMA_RX_FSM_RST); + qcom_geni_serial_poll_bit(uport, SE_DMA_RX_IRQ_STAT, + RX_RESET_DONE, true); + writel(RX_RESET_DONE | RX_DMA_DONE, + uport->membase + SE_DMA_RX_IRQ_CLR); + } + if (port->rx_dma_addr) { geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr, DMA_RX_BUF_SIZE); From patchwork Wed Oct 9 14:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828560 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F40719DFA5; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=sdqjIMVssqJfg7kOOwvs+7a7O/b4LYfiFP/AAPMvp1FOw8xt/q+ojzLNlulsbpC8N2t4UNy8vCKL5QT9aaFUantacSzqQyjUghDGtWGvubI4ZAdanhPA/5820rFhElZ5d3NpcXwHY6XFo8KoNw3cefS1Z/hiD4bMRMB4hVR+pUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=6EScB7CZdFUvFKjORGCL1uixj3+Bszuc7l9Y6WimbDk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ps4peLX73nBA2e9kWQQwnWGKZt8ZhHiMZfLGAiiWbgx4zfZ19+XIrSyEUcJjmgkz+2zWyH6w2CkIAe2GOOghi9vRkgXmAn4e0g0LlPz/A8feyNJZhG3gm7Zks/OJZhYE4eiKrZLqupSFyN5c5N69WReddwSQ653fdNQ98vLhpQ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s7NZj/yu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s7NZj/yu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 055B0C4CED1; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=6EScB7CZdFUvFKjORGCL1uixj3+Bszuc7l9Y6WimbDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7NZj/yuj3uoKBubxOzc3meVMP3ZlU+idCD2gO2TGNoMsI6g1aRzzENPajcZXwAPe G1aaMoAGLk9wZY98m+S8E+L0d7905mrIaDbiImfepdYelrISQ+ZuZEbuBZejPAdwqs vcD/ARd6mtaxJBkjjXI3hPOeKniHuRczsNFLUAQWeARcfngf3r0wnkrUuo7gEgMbzI OSJKsHJDY6wxn6IHb5bRq/ZcF9JoLaN1XaoFYnc7rtMUViEp7G3Bv/sQxqAFriWRUs Tcca2qCh0rVn5MlI0E/rZlioTs1w40K6DjtGzvOpC9n/vqJ28lf7kcG8aqa5H4eMzZ NquSGIprWghAA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2G-000000004Od-49jE; Wed, 09 Oct 2024 16:51:33 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 5/9] serial: qcom-geni: fix receiver enable Date: Wed, 9 Oct 2024 16:51:06 +0200 Message-ID: <20241009145110.16847-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The receiver is supposed to be enabled in the startup() callback and not in set_termios() which is called also during console setup. This specifically avoids accepting input before the port has been opened (and interrupts enabled), something which can also break the GENI firmware (cancel fails and after abort, the "stale" counter handling appears to be broken so that later input is not processed until twelve chars have been received). There also does not appear to be any need to keep the receiver disabled while updating the port settings. Since commit 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes") the calls to manipulate the secondary interrupts, which were done without holding the port lock, can also lead to the receiver being left disabled when set_termios() races with the console code (e.g. when init opens the tty during boot). This can manifest itself as a serial getty not accepting input. The calls to stop and start rx in set_termios() can similarly race with DMA completion and, for example, cause the DMA buffer to be unmapped twice or the mapping to be leaked. Fix this by only enabling the receiver during startup and while holding the port lock to avoid racing with the console code. Fixes: 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes") Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA") Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP") Cc: stable@vger.kernel.org # 6.3 Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index aaf24bd037a7..6c4349ea5720 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1197,6 +1197,11 @@ static int qcom_geni_serial_startup(struct uart_port *uport) if (ret) return ret; } + + uart_port_lock_irq(uport); + qcom_geni_serial_start_rx(uport); + uart_port_unlock_irq(uport); + enable_irq(uport->irq); return 0; @@ -1282,7 +1287,6 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, unsigned int avg_bw_core; unsigned long timeout; - qcom_geni_serial_stop_rx(uport); /* baud rate */ baud = uart_get_baud_rate(uport, termios, old, 300, 4000000); @@ -1298,7 +1302,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, dev_err(port->se.dev, "Couldn't find suitable clock rate for %u\n", baud * sampling_rate); - goto out_restart_rx; + return; } dev_dbg(port->se.dev, "desired_rate = %u, clk_rate = %lu, clk_div = %u\n", @@ -1389,8 +1393,6 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, writel(stop_bit_len, uport->membase + SE_UART_TX_STOP_BIT_LEN); writel(ser_clk_cfg, uport->membase + GENI_SER_M_CLK_CFG); writel(ser_clk_cfg, uport->membase + GENI_SER_S_CLK_CFG); -out_restart_rx: - qcom_geni_serial_start_rx(uport); } #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE From patchwork Wed Oct 9 14:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828558 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6320719DF66; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=Xm6itTZE9mub5xFfN54MMd1kgHZYkBsWdviOz4sMXvTIpj4317NYM0UXTctW5OmtNDT2OPc+cudfZtaZnFPl0Q6oWZT9sahhOpXXnIbrBiXkSbplrwrJquuyqL1Ts2H/00DuMQJB6xKO8Xz+5K1T+BGjUAt2uOZOKEvdALpnefU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=8X8bYgJ/bLzXHmg7ansb2AVdDbQ7EA4mcg+m5MbuV7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q3/sfC+h5bn6rplZcDFNrKW5DTquriZGEhcVlbEIU18ewFaNK4eb5WDaV+cdOBQl7A5wHgEvd2FtdgyQ6xOXtYCQwrkniHGgbfp0f6iLde46QoaL4XC6jfukDbun7Fowyjeblip/00LeWTmBySwmwNdNvyJz8vZnUXcOtAi8o98= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DoryG9Rx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DoryG9Rx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3CDAC4CED2; Wed, 9 Oct 2024 14:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=8X8bYgJ/bLzXHmg7ansb2AVdDbQ7EA4mcg+m5MbuV7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DoryG9RxInL94A5z7rXV1h7bntGYE5nUkl1AUvYrgBSRWz5TCCsoernFQHUvNYgzb xYFVzr0Tft5VTdop3DvhbHd/My3Zy5S3bFgGsN4zsxt7TY0dWDXxE6vNRN7lMCUuwZ VgtLAqEBI5G9ltX3+cYaFa2oHAJeiCTAYN28nVu0ycGyATodnx5N9vqg5rasUxji1H zgkxSTfxNzHKQ1OUqgDfKfxC7/VWinbX19lz/dKvuphMwVmYWgOAaet8UrynlV04T0 Gl+8ZzGwHRVmeYsYPaZ6clQrnEH7vb0cVvxmVDE/tmAvBWXFsIH3jyTl2z+FaLim5z x0Vi4cLJyI1dA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2H-000000004Oh-0NSf; Wed, 09 Oct 2024 16:51:33 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold Subject: [PATCH v3 6/9] serial: qcom-geni: fix rx cancel dma status bit Date: Wed, 9 Oct 2024 16:51:07 +0200 Message-ID: <20241009145110.16847-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Cancelling an rx command is signalled using bit 14 of the rx DMA status register and not bit 11. This bit is currently unused, but this error becomes apparent, for example, when tracing the status register when closing the port. Fixes: eddac5af0654 ("soc: qcom: Add GENI based QUP Wrapper driver") Reviewed-by: Douglas Anderson Signed-off-by: Johan Hovold --- include/linux/soc/qcom/geni-se.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/soc/qcom/geni-se.h b/include/linux/soc/qcom/geni-se.h index c3bca9c0bf2c..2996a3c28ef3 100644 --- a/include/linux/soc/qcom/geni-se.h +++ b/include/linux/soc/qcom/geni-se.h @@ -258,8 +258,8 @@ struct geni_se { #define RX_DMA_PARITY_ERR BIT(5) #define RX_DMA_BREAK GENMASK(8, 7) #define RX_GENI_GP_IRQ GENMASK(10, 5) -#define RX_GENI_CANCEL_IRQ BIT(11) #define RX_GENI_GP_IRQ_EXT GENMASK(13, 12) +#define RX_GENI_CANCEL_IRQ BIT(14) /* SE_HW_PARAM_0 fields */ #define TX_FIFO_WIDTH_MSK GENMASK(29, 24) From patchwork Wed Oct 9 14:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828563 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A498A1A0B12; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=SzVhgkzxi4rRJ9VZGTRIDApWi+KnZ4Z4YjWlERvpe5UHvf2e1j68vNludWTzSoOaZO2/33CnoTTQe1/uS/V4xJLlJ60afjBBoSVVXnpEdH+nRZF9AS6xLT/48xjggXN7rYUu4Cf6swSA4XslqVZ52LthAjsKDvaCYTq+RP3UHmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=ni/7C49v00kREPSkEliowLoAY5fhHWk11WGWdQQ6Z4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fwX534l+UXtx9T4uQSrKIcOsCvRFhCpYmiYzwyQhCOscdE7LGINXoSTsruInRXe9cp7RZv36w+BCq7Y21uRywqVzq/LdvavVwpvpk3LVUd6WEGGmNcG5x6VMfLOSD5LCsDu3oTCsHVeKD46VVIvFaB3KZoPv9P/P+dEasJFXiI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tW47HgAC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tW47HgAC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 304A5C4AF17; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=ni/7C49v00kREPSkEliowLoAY5fhHWk11WGWdQQ6Z4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tW47HgACfs2/jocBVh9roIJ0sdeyocFqd8DLw3q59IoiGe2dqJhnf1VLSNV+qxUuD N3l6As0Gi7k4kKOf4f1AbL5TJxKK171fIpcTAffVgIetVWgHdXVBtVyKNMTcPn6glJ eelwp7Xql6/7H4R2KwRhPaS4NsnCF89uSeyg7yZF7F3ubDW5SkutcFlKgwaV8wqdyp nOB2Te5FtfGnjtC92vuIE8FR9sHNdjtFRKVzwbGduI6WrzXpY4D0mLcVJraAN5ztRI RRvU6MwLKrFi/bqqKDFHIlHMEDDikOYnQsgtWgREVa32ZAHRVMGMhcbZf6fWZ+lyNw wPewGOYqV4JHg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2H-000000004Oj-0hk1; Wed, 09 Oct 2024 16:51:33 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold Subject: [PATCH v3 7/9] serial: qcom-geni: drop flip buffer WARN() Date: Wed, 9 Oct 2024 16:51:08 +0200 Message-ID: <20241009145110.16847-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop the unnecessary WARN() in case the TTY buffers are ever full in favour of a rate limited dev_err() which doesn't kill the machine when panic_on_warn is set. Reviewed-by: Douglas Anderson Signed-off-by: Johan Hovold --- drivers/tty/serial/qcom_geni_serial.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 6c4349ea5720..22e468065666 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -588,9 +588,8 @@ static void handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) ret = tty_insert_flip_string(tport, port->rx_buf, bytes); if (ret != bytes) { - dev_err(uport->dev, "%s:Unable to push data ret %d_bytes %d\n", - __func__, ret, bytes); - WARN_ON_ONCE(1); + dev_err_ratelimited(uport->dev, "failed to push data (%d < %u)\n", + ret, bytes); } uport->icount.rx += ret; tty_flip_buffer_push(tport); From patchwork Wed Oct 9 14:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828562 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A322D1A0B0E; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=qr+tyuzuPEWOK5FE0ZkDtJhvYvb9JtvPtLfUEFVJZmVRZPGCUatq09fC44hyWaQ7rX2GH+pmrcVzhie3cMns2VbZTrqRzc+Xrfd/QktKNJLzLN1Se1/v57oAEo3G957d5pPoFPDLoGW73R/T4hc8LCh9xGePEfNpvWurHDjhQo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=zTNuSmS2bXWBPJ54yuFv6Uyyngn/rp4ZjYaJOdvz+Ik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jbL+XV5zcim+4j2llgrkw+B7nezi6pEe7wlhixxT4KOvtlrtJlg/S3IFiG/p1rjA/5N9Kxq2J22RsUteW0RKCBvbGCyK4kxDClNfx/FfPUNQgibwMZY5A4CiWGcsPdHa/5gtDforohxszkEnvKzmg3Ua4BnZZX7lFL1cBC6YW6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XYVTBUtm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XYVTBUtm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C8C7C4CEDF; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=zTNuSmS2bXWBPJ54yuFv6Uyyngn/rp4ZjYaJOdvz+Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XYVTBUtmyXRqXmJ6f69XAeTNSgHwKLEofFYvHNj7+8RkTuF0wY501ONV447mpOvMV Z4l3AxSpiWVFqitfxI/6GLw96q8Uabu7gzYGrMmlDIxU5vAQrAEV/ukVnmRfOwOIEZ Qn9OV2/s2o4bw5dk7mBUjWMqX8xKesuYyO8xiW5NL6c12HCDbZYOZqDqBpEdPGMbpV QBSqsJCtmB9bvHEySQolfGUrIzCkCz+rb+cGt/TrgXEZH9fqT9Y2S2Fj1+nbcQ3ZVr YrFbtEPSWyAt/Q2VmofUFARZkvzstPnE9nylQoSO+Owjgsk13F1JvhLlIHS7NAzPLl ztBHemp315rZw== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2H-000000004Ol-11L7; Wed, 09 Oct 2024 16:51:33 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold Subject: [PATCH v3 8/9] serial: qcom-geni: drop unused receive parameter Date: Wed, 9 Oct 2024 16:51:09 +0200 Message-ID: <20241009145110.16847-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Serial drivers should not be dropping characters themselves, but at least drop the unused 'drop' parameter from the receive handler for now. Reviewed-by: Douglas Anderson Signed-off-by: Johan Hovold --- drivers/tty/serial/qcom_geni_serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 22e468065666..9dd304cdcd86 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -580,7 +580,7 @@ static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) } #endif /* CONFIG_SERIAL_QCOM_GENI_CONSOLE */ -static void handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_uart(struct uart_port *uport, u32 bytes) { struct qcom_geni_serial_port *port = to_dev_port(uport); struct tty_port *tport = &uport->state->port; @@ -873,7 +873,7 @@ static void qcom_geni_serial_handle_rx_dma(struct uart_port *uport, bool drop) } if (!drop) - handle_rx_uart(uport, rx_in, drop); + handle_rx_uart(uport, rx_in); ret = geni_se_rx_dma_prep(&port->se, port->rx_buf, DMA_RX_BUF_SIZE, From patchwork Wed Oct 9 14:51:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13828561 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 801D419E966; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; cv=none; b=jjEpfzt0+qVCTDvbZBPmbCzk7gtziHNisbuMujQd0NCN+ZGbR18Kehj+h5wfGNmt3O6AGwuUo7xNBsukfJFmGJm0QlE6zVWptcobE5nPGrNXw0pCY3AufgZ6ayJ9NQkDF4AGhtqFvy7eRNl4Xous72AyAouNo6jpq3d7QnDF1yc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485489; c=relaxed/simple; bh=vXreO2sxHHJ6/5mcfDxH5Wpkqxv0IieD0btUKD95pYU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oeMLDe/RxI43AxUJoPUDdSpK4k4JtMp7D2limXo/cO9ynIyxnp442wEeINgnVZOyW3rVnbKPzJIvD75I8zw9SxsWvJHRzFbJvt3VlObdEDaFCpJ3i3PaUlvdvsnEWPEVjVv8yVC3RDaOmqxoOnWR4L3PEm5dZrQKZOKWXUSH6/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=axuq5KSp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="axuq5KSp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E084C4CEE0; Wed, 9 Oct 2024 14:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728485489; bh=vXreO2sxHHJ6/5mcfDxH5Wpkqxv0IieD0btUKD95pYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=axuq5KSp1XA5xR4rHJvI8FXFKqXX7SSdI+xBfMsT9QGuZHKnbA19ngRVM8v8PVjuO n0tOo10go6zeZoHu0Pi6HsJIhGy+EsBCO8jOswhJgcgPxufhCJt/P6wszKaNdZSmVS wDaGwodyOvRLqO+OD8PbJLV8M2Q4f7YxshMGWQRexu0DMLJ1snUq7oILuaYP6kkXNS vlt14HCILbWoR6SzeBxrglM+BRoAdGplUCNyHO6DmeMyhrTZLq1nID49QVF2EgKL5F 1t+gqlAzn9uFugC/WQcvHHpS52JoUQbiU1KUl52iM2o4+r764ma51YgZ6kkjaV1jIJ fp2+KJ1osmI6w== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1syY2H-000000004Op-1PO8; Wed, 09 Oct 2024 16:51:33 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , Mukesh Kumar Savaliya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold Subject: [PATCH v3 9/9] serial: qcom-geni: rename suspend functions Date: Wed, 9 Oct 2024 16:51:10 +0200 Message-ID: <20241009145110.16847-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241009145110.16847-1-johan+linaro@kernel.org> References: <20241009145110.16847-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop the unnecessary "_sys" infix from the suspend PM ops. Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 9dd304cdcd86..5dfe4e599ad6 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1779,7 +1779,7 @@ static void qcom_geni_serial_remove(struct platform_device *pdev) uart_remove_one_port(drv, &port->uport); } -static int qcom_geni_serial_sys_suspend(struct device *dev) +static int qcom_geni_serial_suspend(struct device *dev) { struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct uart_port *uport = &port->uport; @@ -1796,7 +1796,7 @@ static int qcom_geni_serial_sys_suspend(struct device *dev) return uart_suspend_port(private_data->drv, uport); } -static int qcom_geni_serial_sys_resume(struct device *dev) +static int qcom_geni_serial_resume(struct device *dev) { int ret; struct qcom_geni_serial_port *port = dev_get_drvdata(dev); @@ -1822,8 +1822,7 @@ static const struct qcom_geni_device_data qcom_geni_uart_data = { }; static const struct dev_pm_ops qcom_geni_serial_pm_ops = { - SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, - qcom_geni_serial_sys_resume) + SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_suspend, qcom_geni_serial_resume) }; static const struct of_device_id qcom_geni_serial_match_table[] = {