From patchwork Thu Oct 12 07:54:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 10001207 X-Patchwork-Delegate: bhelgaas@google.com 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 3281860325 for ; Thu, 12 Oct 2017 07:54:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26FE428BF8 for ; Thu, 12 Oct 2017 07:54:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B94028C13; Thu, 12 Oct 2017 07:54:44 +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,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 3B83828BF8 for ; Thu, 12 Oct 2017 07:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751937AbdJLHym (ORCPT ); Thu, 12 Oct 2017 03:54:42 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:56130 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632AbdJLHyl (ORCPT ); Thu, 12 Oct 2017 03:54:41 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20171012075438epoutp018d18124c3a544115fb7ee43ef6a897e7~sw3QeSfoh2564925649epoutp01V; Thu, 12 Oct 2017 07:54:38 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20171012075438epcas2p25049e7b1f03df30c63b32dd1c475cbd6~sw3QUqrWL1722617226epcas2p2z; Thu, 12 Oct 2017 07:54:38 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id D3.77.04372.EBF1FD95; Thu, 12 Oct 2017 16:54:38 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20171012075438epcas2p32599c2db4ed1512c81d1039bb1ed5607~sw3QJN4Qc3190131901epcas2p3W; Thu, 12 Oct 2017 07:54:38 +0000 (GMT) X-AuditID: b6c32a47-4b1ff70000001114-2b-59df1fbebe2d Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 1C.92.06856.EBF1FD95; Thu, 12 Oct 2017 16:54:38 +0900 (KST) Received: from ubuntu.sisodomain.com ([107.108.83.125]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OXP00GY99YV3G60@mmp2.samsung.com>; Thu, 12 Oct 2017 16:54:38 +0900 (KST) From: Pankaj Dubey To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kishon Vijay Abraham I , Bjorn Helgaas , Jingoo Han , Joao Pinto , Pankaj Dubey Subject: [PATCH] PCI: dwc: designware: don't sleep in atomic context Date: Thu, 12 Oct 2017 13:24:49 +0530 Message-id: <1507794889-11148-1-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRmVeSWpSXmKPExsWy7bCmhe4++fuRBh3HlSyWNGVYrPgyk93i x6OjzBYXnvawWVzeNYfN4uy842wWi7Z+YXdg99g56y67x4JNpR59W1YxemzZ/5nR4/iN7Uwe nzfJBbBFcdm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JjFwLGBlWMUqmFhTnpucWGxUY 5aWW6xUn5haX5qXrJefnbmIEBsa2w1r9OxgfL4k/xCjAwajEwztB416kEGtiWXFl7iFGCQ5m JRFe/11AId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rz8+ccihQTSE0tSs1NTC1KLYLJMHJxSDYz9 Czu/NiRKbzjgrmAeda5Y5tYeoZO13yKnz9Od/WH1vz0aR2NX/7x1ec5pvYCp7HOEDheoc+bz 7OZSM3y1teywdEp8z9UX3W8s9mzbd/3jM0fFGCmjlv/9Xy5qtl6pWfZVWuiuN5/8ioN8Pzdp Xv9sEOe9aI9A6geGtW+ffXtmJrLtGvu/tEchSizFGYmGWsxFxYkAiAe66QgCAAA= X-CMS-MailID: 20171012075438epcas2p32599c2db4ed1512c81d1039bb1ed5607 X-Msg-Generator: CA X-Sender-IP: 182.195.42.143 X-Local-Sender: =?UTF-8?B?7YyQ7Lm07KaIG1NTSVItRkRTIFNXG+yCvOyEseyghOyekBsu?= =?UTF-8?B?L1NlbmlvciBDaGllZiBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?UEFOS0FKIEtVTUFSIERVQkVZG1NTSVItRkRTIFNXG1NhbXN1?= =?UTF-8?B?bmcgRWxlY3Ryb25pY3MbLi9TZW5pb3IgQ2hpZWYgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMDk5Nw==?= CMS-TYPE: 102P X-CMS-RootMailID: 20171012075438epcas2p32599c2db4ed1512c81d1039bb1ed5607 X-RootMTR: 20171012075438epcas2p32599c2db4ed1512c81d1039bb1ed5607 References: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In pcie-designware.c many places we are calling "usleep_range" which are in atomic context. This patch fixes these potential BUGs and replaces "usleep_range" with mdelay calls. Signed-off-by: Pankaj Dubey Acked-by: Jingoo Han --- drivers/pci/dwc/pcie-designware.c | 8 ++++---- drivers/pci/dwc/pcie-designware.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/pci/dwc/pcie-designware.c b/drivers/pci/dwc/pcie-designware.c index 88abddd..35d19b9 100644 --- a/drivers/pci/dwc/pcie-designware.c +++ b/drivers/pci/dwc/pcie-designware.c @@ -138,7 +138,7 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, int index, if (val & PCIE_ATU_ENABLE) return; - usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); + mdelay(LINK_WAIT_IATU_MIN); } dev_err(pci->dev, "outbound iATU is not being enabled\n"); } @@ -181,7 +181,7 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, if (val & PCIE_ATU_ENABLE) return; - usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); + mdelay(LINK_WAIT_IATU_MIN); } dev_err(pci->dev, "outbound iATU is not being enabled\n"); } @@ -239,7 +239,7 @@ static int dw_pcie_prog_inbound_atu_unroll(struct dw_pcie *pci, int index, if (val & PCIE_ATU_ENABLE) return 0; - usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); + mdelay(LINK_WAIT_IATU_MIN); } dev_err(pci->dev, "inbound iATU is not being enabled\n"); @@ -285,7 +285,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int bar, if (val & PCIE_ATU_ENABLE) return 0; - usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); + mdelay(LINK_WAIT_IATU_MIN); } dev_err(pci->dev, "inbound iATU is not being enabled\n"); diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h index e5d9d77..13c17c9 100644 --- a/drivers/pci/dwc/pcie-designware.h +++ b/drivers/pci/dwc/pcie-designware.h @@ -28,8 +28,7 @@ /* Parameters for the waiting for iATU enabled routine */ #define LINK_WAIT_MAX_IATU_RETRIES 5 -#define LINK_WAIT_IATU_MIN 9000 -#define LINK_WAIT_IATU_MAX 10000 +#define LINK_WAIT_IATU_MIN 9 /* Synopsys-specific PCIe configuration registers */ #define PCIE_PORT_LINK_CONTROL 0x710