From patchwork Wed Feb 1 14:26:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13124455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63A26C63797 for ; Wed, 1 Feb 2023 14:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RIeAXECrJF1CceJCBGnEE/bA928QGEajR3L/UeY8Ijs=; b=nQCqyeVYkWxhjd XkBnrLTFW9yKcgknlthrtgTBYpNdyTk0u31l2zWVsze9asr0pLqD4WgllrA+lQjnGxyQkL9+yvYiS jPSLCyEso1T03cpewphKE1T2uGXf6zon/Sc6VT5Ls5929nDBz0jaiNsG7jAi3iHT50xRtg7icpK27 QN9PJoek7eIn/+XsNRDe7JQTXSCBT5O+1/0lC3SKHI/74u9esVcHE74I4O2agrn7Sbgtb+pqRjwHL e31wSumVDlRszETIwN1xLuAom73qt9g9TE0K/79bj+nBkAyv8My3MKaCK4SnFMYapfkyACuN+cJgP oA9lm4zvPCHfGEksmPfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNEFV-00CQID-3e; Wed, 01 Feb 2023 14:38:09 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNE5K-00CLkD-RN for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 14:27:44 +0000 Received: by mail-ed1-x52b.google.com with SMTP id q19so7920941edd.2 for ; Wed, 01 Feb 2023 06:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x7M/mJ7SCNh4ZJGAikXzxUOzNkw+apH6YFH5D003Vlk=; b=YCV9rjm9hwPGBjF/U6m6hl3htwsbU7UYhS2JNw9dMTznu4FRziIoesjJF+5OC4AzoM 2QGZyoAfUhBJkJhCMZXkng4q7dcZvg5mQC6t39Pi0CYtCRssb5YJPxPQiJcaHHKB4q7e R+vtxXJfwcl1/POy1Bz6W8t//ntc80M3DENyJ6jPbitZSX2NPkBDSi/b4O15VZS+lvUr Cf5a5qUpjykhGQuqRW/Qoet9YRiEwbH34eUXbJDIYP0quwt/vMOou5iS+UEHVl5rwigq J0r+VcNx6dSU+/TzqAPnJlk1owOdm5OnO+AyZ8FSr/QViJPnWLqwM9+sh8AcL0UzbTir TTjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x7M/mJ7SCNh4ZJGAikXzxUOzNkw+apH6YFH5D003Vlk=; b=ia9uxOSpig6TC85MjNgjR9ndp6GAuzUiArH0aqYnslDQX3aOxFyGDEOArqv7Php/96 neN/mXSOtig1sOc2mHwIIPLCrxRPi63cEEiOLr4G/lemGlWRMU8AKI660b7xFs8FvK5M 7/8NM3Sg5gGTWHnm3XiaYtUIGLA39I4GQ1c4ivZlYOUw/9Bb3zfKjuPD7KIMjPeIFjxW KDsxjJ85Uk9m9y+hdiOiOTI0SIDaAG5NluqP+xQXbtYBUggh2DUvHvyEcQqo7Vk9fQaL E96c0BlGQM0EgmlAMufqGuz1g4Fe8kxKP+m1UOrYpkObTonYFBKxVHPtQmJurI809SDb l8ug== X-Gm-Message-State: AO0yUKVBScm/0blQL+CLrBFOuNRuya+LrhHJnTq1R7e+BBwTB9lKdF6D JczMyPKB7FhjzqCVQyqQ0dY= X-Google-Smtp-Source: AK7set/kIaaIMRID/oW2tAkrVicv8XG1FLdewEBb0dVt5JtW47COnx/zMjBZxbdlj4jdV9pkrVK+tA== X-Received: by 2002:aa7:c48a:0:b0:4a2:4abc:29be with SMTP id m10-20020aa7c48a000000b004a24abc29bemr2268247edq.35.1675261657151; Wed, 01 Feb 2023 06:27:37 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id cf8-20020a0564020b8800b004a18f2ffb86sm8975564edb.79.2023.02.01.06.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 06:27:36 -0800 (PST) From: Sergey Organov To: Greg Kroah-Hartman Cc: linux-serial@vger.kernel.org, Fabio Estevam , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?utf-8?q?Tomasz_Mo=C5=84?= , =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= , Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sherry Sun , Stefan Wahren , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH v1 RESEND 0/7] serial: imx: work-around for hardware RX flood, and then isr improvements Date: Wed, 1 Feb 2023 17:26:53 +0300 Message-Id: <20230201142700.4346-1-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <87bko4e65y.fsf@osv.gnss.ru> References: <87bko4e65y.fsf@osv.gnss.ru> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_062738_946206_80F470E6 X-CRM114-Status: GOOD ( 13.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These series contain a work-around for hardware RX flood in first 2 commits, and then further cleanups and optimizations of the receive IRQ handler. WARNING: the flood fix is extensively tested with older version of the kernel with DMA turned off. The DMA path is tested only a bit, as DMA has receive problems on my kernel version. Changes in v1: * Missing braces fixed. * Withdrawn patch optimizing imx_uart_readl() -> readl(), on request of Uwe Kleine-König. Sergey Organov (7): serial: imx: factor-out common code to imx_uart_soft_reset() serial: imx: work-around for hardware RX flood serial: imx: do not sysrq broken chars serial: imx: do not break from FIFO reading loop prematurely serial: imx: remove redundant USR2 read from FIFO reading loop serial: imx: stop using USR2 in FIFO reading loop serial: imx: refine local variables in rxint() drivers/tty/serial/imx.c | 225 ++++++++++++++++++++++++--------------- 1 file changed, 140 insertions(+), 85 deletions(-) Interdiff against v0: +- 2.30.1 diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 45327ff6dd14..447b9060d9df 100644 --- b/drivers/tty/serial/imx.c +++ a/drivers/tty/serial/imx.c @@ -889,14 +889,15 @@ { struct imx_port *sport = dev_id; struct tty_port *port = &sport->port.state->port; + typeof(sport->port.membase) membase = sport->port.membase; u32 usr2, rx; /* If we received something, check for 0xff flood */ - usr2 = imx_uart_readl(sport, USR2); + usr2 = readl(membase + USR2); if (usr2 & USR2_RDR) imx_uart_check_flood(sport, usr2); - while ((rx = imx_uart_readl(sport, URXD0)) & URXD_CHARRDY) { + while ((rx = readl(membase + URXD0)) & URXD_CHARRDY) { unsigned int flg = TTY_NORMAL; sport->port.icount.rx++; @@ -928,9 +929,8 @@ flg = TTY_OVERRUN; sport->port.sysrq = 0; - } else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) { + } else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) continue; - } if (sport->port.ignore_status_mask & URXD_DUMMY_READ) continue;