From patchwork Fri Apr 1 09:06:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 64838 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp615195lbc; Fri, 1 Apr 2016 02:04:22 -0700 (PDT) X-Received: by 10.98.89.22 with SMTP id n22mr29134064pfb.55.1459501462187; Fri, 01 Apr 2016 02:04:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lq6si4661555pab.140.2016.04.01.02.04.21; Fri, 01 Apr 2016 02:04:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753328AbcDAJEU (ORCPT + 2 others); Fri, 1 Apr 2016 05:04:20 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:18237 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbcDAJES (ORCPT ); Fri, 1 Apr 2016 05:04:18 -0400 Received: from 172.24.1.36 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.36]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DHZ75604; Fri, 01 Apr 2016 17:04:11 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Fri, 1 Apr 2016 17:04:02 +0800 From: Kefeng Wang To: Noam Camus , Greg Kroah-Hartman CC: Andy Shevchenko , Heikki Krogerus , , , , , Kefeng Wang Subject: [PATCH] serial: 8250_dw: fix wrong logic in dw8250_check_lcr() Date: Fri, 1 Apr 2016 17:06:58 +0800 Message-ID: <1459501618-21021-1-git-send-email-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.6.0.GIT MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.56FE398D.0001, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 549017c67b7ab1c91329f32fc197730c Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Commit cdcea058e510("serial: 8250_dw: Avoid serial_outx code duplicate with new dw8250_check_lcr()") introduce a wrong logic when write val to LCR reg. When CONFIG_64BIT enabled, __raw_writeq is used unconditionally. But for !PORT_OCTEON, we better to use coincident write func. Signed-off-by: Kefeng Wang --- We met following calltrace twice, if the change is not necessary, correct me, and any advice will be appreciated, thanks. 80300000.uart: ttyS0 at MMIO 0x80300000 (irq = 7, base_baud = 12500000) is a 16550A Unable to handle kernel paging request at virtual address ffffff8008e8000c pgd = ffffff8008c14000 [ffffff8008e8000c] *pgd=00000013ffffe003,*pud=00000013ffffe003, *pmd=00000013ee043003, *pte=00e8000080300707 Internal error: Oops: 96000061 [#1] PREEMPT SMP Modules linked in: CPU: 13 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc1+ #51 Hardware name: Huawei Technologies Co., Ltd. D02/D02, BIOS Bios Version 01/01/1900 task: ffffffd3ee358000 ti: ffffffd3ee360000 task.ti:ffffffd3ee360000 PC is at dw8250_check_lcr+0x54/0x98 LR is at dw8250_check_lcr+0x54/0x98 pc : [] lr : []pstate: 800000c5 sp : ffffffd3ee363740 x29: ffffffd3ee363740 x28: 0000000000000000 x27: ffffff800897d668 x26: ffffffd3ed434100 x25: ffffff80089e89b0 x24: 000000000000006d x23: 0000000000000093 x22: 0000000000000093 x21: ffffff8008e8000c x20: 00000000000003e8 x19: ffffff8008bfde28 x18: 0000000000000006 x17: 0000000000000000 x16: 0000000000000001 x15: 000000000001c200 x14: 0000000000000011 x13: 0000000000000c80 x12: 0000000000000011 x11: ffffff800881c050 x10: 000000000001cb00 x9 : 000000000001cb00 x8 : ffffff800881c050 x7 : 000000000001b900 x6 : 0000000000000020 x5 : ffffffd3ec8d9a18 x4 : ffffff8008e80000 x3 : ffffff8008bfde28 x2 : 000000000000000d x1 : 0000000000000000 x0 : 000000000000000d drivers/tty/serial/8250/8250_dw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index a3fb95d..47d1f3e 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -104,15 +104,16 @@ static void dw8250_check_lcr(struct uart_port *p, int value) dw8250_force_idle(p); #ifdef CONFIG_64BIT - __raw_writeq(value & 0xff, offset); -#else + if (p->type == PORT_OCTEON) + __raw_writeq(value & 0xff, offset); + else +#endif if (p->iotype == UPIO_MEM32) writel(value, offset); else if (p->iotype == UPIO_MEM32BE) iowrite32be(value, offset); else writeb(value, offset); -#endif } /* * FIXME: this deadlocks if port->lock is already held