From patchwork Mon Feb 27 06:56:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 9592753 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 734C7601D7 for ; Mon, 27 Feb 2017 06:58:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64F7928388 for ; Mon, 27 Feb 2017 06:58:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 593BA2838E; Mon, 27 Feb 2017 06:58:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B360C28388 for ; Mon, 27 Feb 2017 06:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751656AbdB0G6u (ORCPT ); Mon, 27 Feb 2017 01:58:50 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:34431 "EHLO relmlie4.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751649AbdB0G6s (ORCPT ); Mon, 27 Feb 2017 01:58:48 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie4.idc.renesas.com with ESMTP; 27 Feb 2017 15:58:42 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 2C63950E1E; Mon, 27 Feb 2017 15:58:42 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 05E1228076; Mon, 27 Feb 2017 15:58:42 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 0532528088; Mon, 27 Feb 2017 15:58:42 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id RAE23231; Mon, 27 Feb 2017 15:58:41 +0900 X-IronPort-AV: E=Sophos;i="5.35,212,1483974000"; d="scan'208";a="235903014" Received: from mail-pu1apc01lp0024.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.24]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 27 Feb 2017 15:58:41 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=g2QIHRS9nijsUpz28VmrTDa/MabsmKhRsfEdImcqe/0=; b=ZYLyaf6+GsZe2MQv0w6XPSo13Om1T+7F4EnUhTTHvivzUWLzHsf9QVOLCsHqIzIq3Rl4NIay2jGEvDlsgKPqbtlL4ME+NmFbMncdCSxKjkNEV1cRKz1UCJ73r4ty+WfIh5BOq5AMFDyVez/vpNshIiaBOCvzNnOWENHkAHMdwl4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.144) by HKXPR06MB0551.apcprd06.prod.outlook.com (10.161.177.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Mon, 27 Feb 2017 06:58:39 +0000 From: Yoshihiro Shimoda To: , , , CC: , Takatoshi Akiyama , Yoshihiro Shimoda Subject: [PATCH] serial: sh-sci: Fix panic when serial console and DMA are enabled Date: Mon, 27 Feb 2017 15:56:31 +0900 Message-ID: <1488178591-20408-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TYXPR0101CA0042.jpnprd01.prod.outlook.com (10.168.40.180) To HKXPR06MB0551.apcprd06.prod.outlook.com (10.161.177.141) X-MS-Office365-Filtering-Correlation-Id: 19c49fa5-ca6e-49a6-7ac5-08d45ede0f94 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:HKXPR06MB0551; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0551; 3:4bRikOaa+cUSF/agD91gYqwTWWnm9v8IdgLoJfAHkn+ZEVdEXq7qFCR+FPcd23og5eII7/IJvyVdrzrhPm2KYFHh9LZ+H8QrbxeDd8kyaTg0ZYpeATBoRpVsqgoFoOu9fON2itkfaDfIAHXOWNafS85BJs5/atkGR1LqDWNnqc5+q2EWJ4JGuz7GXb7ejZZLLG81lKv3Hd7PSIE+FUajhuLub9r43tnC07zhRcDWau65R2MyuupliwFoKl6NiawfqBEHuoIn7EqoCCkjGyyKvtFHZA8q2BIWZ0xuskjoNTs=; 25:4HGxwe0l0wQB1PM8gQERVvvB56OsrR+ruXkciNWVJwSG9TVC3S9xXfI88JCVKi7pnAlbjVkIfhRu6Ljqaq6wbYWpYkuQW51CLsuCAkz2Mctbddnqm2orxEJRTvN9+qSep7/ZvDFOnYMV/cmq3IOLNRH41Te/nlZMOoxB8KNkI1/cilZ41hwwJM9f7Qe8J/BGKjXjP99EnBLs5b4nRijAeKyPiMv9DoDVk29Mor7U8MXV3RG64MKli240fGamRzPblR4uVNPD5U4tXJQkS7G/tERDwO/uZ1/acdEgzwjUgYmcLu9Gk0gUV5SrzB5GFntBHriBWSbIDN53oBg9nCqMcvUeoarAG565FglghdoYyLebTZa1/lwlj9ruA6qLEKjomGZA+L7Dr4DUoF03DeDz+43DGVaHkvIkeffytzUP1o/9qgCdBw6BAtEJraN5TIHrQGMtvvXgFqsFVIG9KTerOw== X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0551; 31:SDCk77CGm6VtZvJBPXIv2u4yYFIEkyuq2g82B4NdZy7Wt39rv2rGoc/s5MRce/W+H0IHx9rqDeWanNJW23mWf1tE905i4KZF44S28eu33Q5vaWaqNcT2aKTqiOg7nyASDpAXABJp+LJiK8hpEm34jc48wiIxWvZeCu+jG8era7vV8k4KvxTDLtvx/U8JliVD8s2rHrWrFM/TLlvyeU37iUaejfei9/dRFvgT8B/tQR9zic+UggoEHo8DyoRQtW1P1LzuFMu0B3YokRif+tuphw==; 20:37vecqZ6AQouStapR7oajKiTgLloxv/wF1tmgkA6iAMvg6rTmV//r6Hg1cZZ2j2UZ5JqXTLcrsJHTL4ZW86tXMS1cgFqDoVasxYtu84PevU+4rWygCJgeeh203oqNkrnN4bYwi4SX/agDbcyOP7RKmf3Ci14tT/TA0ARhqzfjYM0PmC8YyLu4fFUZIpb1bZXakuIi5GA+3tNX4/f9b0oEjcuvX7VvHXnMtQr+mtp9cHSws3fLymkiLFVh1HI9m6u+azo/uahnau2/KX6U41OLc+YTE7l8p1O6NV89Sm3xJT/ILXq4AqZBGqL912kvm1wc4Fa0NZv0zOW6JDi6F/1VnrnkbPrGwZJWVqJdOCAe9W19fanljkaXgCVXgunTgEUmn9EuIzeCSPv4nKtlNJhZAJa909u74XD/L2A3tkUPjQSJ2BcD3JxCA2B19NBTomKeblvQY71Eof1lrZA/pnpl1GcNn7+BzLgWua2vI83ZT/YvdvG3bpN74hWCC8BArDi X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123558025)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:HKXPR06MB0551; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB0551; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0551; 4:JCC1S3KojbQJ1RPhi3DyRYRqMj8OV0shiePlLqAtPqMYxAFLq0EmCtW5/dh94hKtzehGE0kpHf9sl7EQse88BbotFSmM95VpCukXmTKFxTnvQKxuzeiOyhNxUW1HnNhxIIqY7EnSKXQ2F+ZImHJEkx2vT/5r23SeFytaMDA6ELxAVyUb6VEHXeOZad+xgWMsH305g7pCdc6W4UENxJb+2bZlZCY0ohemrBpSYqcKOHbDwNoXRnzGWFXk5Fs9mbnhhl6chjbCKBMytXs2gbb90t2RY3M7Z2FC2tw5/2KPBkfj5BnKQr2BRxe/DGKLV6G46bXO6hR23oWvYfDooFisMh/OhKG6itkPJa5vL/CAoDv7x8WiCiepWbodsC8HbU2QWGweyFRvuIC9Lreql8wSgSLNqUXUpYcMf4KZIZqVpO3T7+Xz++N/ei3oDet9up6+8a0I8oEG94kyz0fkkB/tW1voGQr53mJwMbm7cDYtMxvA4Tc7sJQrwY6LvALZVJ/3RoMRdfqQKU/WwdefwHj3Nvw7DyCxaj8Kjl+C+6QhuN57PcfoXyErgyAHQ50vnRaNrNa9VFJdDmzRI8PrQJmh6n7g6Xs/cr5AHZsNwzffavsF1tBHg69mwkegqskUPDvy X-Forefront-PRVS: 02318D10FB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(979002)(6069001)(6009001)(7916002)(39840400002)(39850400002)(39860400002)(39410400002)(39450400003)(199003)(189002)(305945005)(7736002)(106356001)(50986999)(42186005)(6512007)(25786008)(54906002)(2201001)(38730400002)(92566002)(6486002)(105586002)(66066001)(97736004)(107886003)(189998001)(101416001)(53936002)(6506006)(36756003)(6116002)(5660300001)(50226002)(3846002)(42882006)(6666003)(8676002)(68736007)(50466002)(5003940100001)(48376002)(4326007)(47776003)(33646002)(81166006)(81156014)(78352004)(2906002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB0551; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:en; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HKXPR06MB0551; 23:jVAl01Al3lxwY05eHKpSCMRAH1w4Ob+7pf857t4KW?= =?us-ascii?Q?Idh8nqfCd+DsR2ui6CyYhjlj7MVBIzvA3EzsIpd6uUnD0f0Qhuv0/f8uXdWP?= =?us-ascii?Q?VrB9gRuTBHqJ0YP/vsTawzsTtitV1RT9wuUYDtgH4rT1/PqUT2QVVuQkgRfH?= =?us-ascii?Q?7h4zLRWYgSytK7Nj+xENScHFJDEvi6/S/4TCiKL8WY41MKzU7jkbVIdbsOVZ?= =?us-ascii?Q?WauPFJd0GaBubz5OFUJRABQ9L1yADAhozcU4CIhTcWYsPn8cqhP75fPomfgP?= =?us-ascii?Q?XdTpVqz3E3LXx0l+gM7OoYMa+mEPrPZm8uHYAn7NKWHznWoLeLkAGhcC/R7z?= =?us-ascii?Q?hVEL46FfPJD2IsUA9kuIoD1mvZvzmX8hkm+JGdL1pphsOjafUrQETc512G6u?= =?us-ascii?Q?98+W4suuC5NMmXWM3lj9J0j6MX2QAhMlfr8cMFlqmpXhXCTu5Gc/qhZZX6hJ?= =?us-ascii?Q?OAW9w5kR+Zwi7DJroX1TrniX8TtNnfMw6lThTiTtiL734nZaAw4sEoEXpyGJ?= =?us-ascii?Q?cPpsR/iInekS940zAz6rLy2q2s6tAqXwOkHr020mLX0ZRbXr2nsF+bLQZ/uk?= =?us-ascii?Q?zaPYV/8V8ZHrH6UxMY0p+XDmjqHc685/JXjq8izDmyzM/tB5/l6b+KsHrL5o?= =?us-ascii?Q?Z0Nx8dO/+I4ZWiJtdkqKn8vr1dYHLnpHlq9aobXwIma5GgRjR03sG8hxLZOF?= =?us-ascii?Q?Qpe7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O+XGlahFXWSK9sdyFsjqAYz8aj6hYRA7Yrqq4P2KY0IO5NS3J3UGheJ3htBXxSo5kShPyFtIUg9X0w6petknTxSNXRsV7DYz/mYARFgXpaxWOgYlfjqDcVVl+46ZkLspGrWesdMMbvG+w=; 5:67s7VVICmwqOXcT7iTWXliHX6EbXXs10ANDoITn6A7dhZqidMhaplIUk+cnZnZGbB4FpdO15s5qQkhY6e76kQ8DBdeMdQ0VkqcnSmiHLr2eVmYsA+uQqmQG8AAdAt7o/Sy4g5ylcuOUmw3gl2tvRsA==; 24:DbyHXwJhSABIyD6iHML0FyLHxePp6I+q/YM5nrrRfDUHU09kBKwMmEaiyJq7CQH8jiKLg1FBHUFPO2I1bufjvCvQgHRg2Zhs9eF4u1eVjm0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0551; 7:5+sSOzkiVPa6peHH7XKU27UtPyhbiDIsmGzso+WbNfmfsEJdddMKFMKIXw7+lKqUGWzkc3ng8bCrEt1RQQ13yXLSvqNZ9CPo2DZGJvBza08SJQ/ZGKVVrl2Eo5gndfswcC9t7HazL4A0KDawupMp910NP2WMBFd6jsXFTi/NbXPazmOJrH5S+SxrSpcrQTGuDyKI0BjAs7a991kMPlh+bmvCQ7ZNmk38tew3id47QBUitzpIVS386VQbEJNKFwGgVIYWjWhAAjuNp6aGQ1e8WtYJ3sNZpTqcHH2OutQ8cbXvhv9D38lS591/IwzFqpwOVCGDuvZkSwZBgqGrpIJk1Q==; 20:rNPhqzR28B/puDiSPDKkjUH9CVXODuIUBfY2/J9CbE+wu6uYmTUwADaqFsTF9aSmMwR27bB5ZXjdWZ2abyXYPglYJdvM862GJXDcJKf5crCW8SARrZsuDmbT2bQCvRGSqH0y5tzDGwsp8joyYmVpMgmrfrUI28X7d4b5IDlKNb8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2017 06:58:39.7753 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB0551 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Takatoshi Akiyama This patch fixes an issue that kernel panic happens when DMA is enabled and we press enter key while the kernel booting on the serial console. * An interrupt may occur after sci_request_irq(). * DMA transfer area is initialized by setup_timer() in sci_request_dma() and used in interrupt. If an interrupt occurred between sci_request_irq() and setup_timer() in sci_request_dma(), DMA transfer area has not been initialized yet. So, this patch changes the order of sci_request_irq() and sci_request_dma(). Fixes: 73a19e4c0301 ("serial: sh-sci: Add DMA support.") Signed-off-by: Takatoshi Akiyama [Shimoda changes the commit log] Signed-off-by: Yoshihiro Shimoda --- This patch is based on the following repo and tag: - renesas-drivers.git / renesas-drivers-2017-02-21-v4.10 tag drivers/tty/serial/sh-sci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 1d6f953..681e469 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1985,11 +1985,13 @@ static int sci_startup(struct uart_port *port) dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); + sci_request_dma(port); + ret = sci_request_irq(s); - if (unlikely(ret < 0)) + if (unlikely(ret < 0)) { + sci_free_dma(port); return ret; - - sci_request_dma(port); + } return 0; } @@ -2021,8 +2023,8 @@ static void sci_shutdown(struct uart_port *port) } #endif - sci_free_dma(port); sci_free_irq(s); + sci_free_dma(port); } static int sci_sck_calc(struct sci_port *s, unsigned int bps,