From patchwork Tue Jan 31 08:59:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Kumar Gogada X-Patchwork-Id: 9546745 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 4AD7560236 for ; Tue, 31 Jan 2017 09:17:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B472280B0 for ; Tue, 31 Jan 2017 09:17:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DE44281A7; Tue, 31 Jan 2017 09:17:06 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 70682280B0 for ; Tue, 31 Jan 2017 09:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751167AbdAaJRD (ORCPT ); Tue, 31 Jan 2017 04:17:03 -0500 Received: from mail-by2nam01on0054.outbound.protection.outlook.com ([104.47.34.54]:51264 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751027AbdAaJRB (ORCPT ); Tue, 31 Jan 2017 04:17:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jg8KLP02vYw8mGldpBJ9W1pYlmzhwrN+aJoxj89ibJw=; b=gfJxW5Vq2AxQE8ReeTqu9v5N/FX5cPGL6xYAzMV97A4ETZwWyoMjDcPKZ6B4TEZqop7CDvgLoAF8R7LHr8n0mEF2E/HrPFEnllEiXzEj5IdCYpaaNK9HAEfrolOgAGBpQFIm0V9Rr6H72nen8R1OfkBiPn2cA3v9d29dsgj8elU= Received: from DM5PR02CA0053.namprd02.prod.outlook.com (10.168.192.15) by DM2PR0201MB0718.namprd02.prod.outlook.com (10.160.94.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Tue, 31 Jan 2017 08:59:25 +0000 Received: from SN1NAM02FT002.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::204) by DM5PR02CA0053.outlook.office365.com (2603:10b6:3:39::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12 via Frontend Transport; Tue, 31 Jan 2017 08:59:25 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; windriver.com; dkim=none (message not signed) header.d=none;windriver.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT002.mail.protection.outlook.com (10.152.72.94) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.874.2 via Frontend Transport; Tue, 31 Jan 2017 08:59:24 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:36998 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1cYUHb-0005x5-Gr; Tue, 31 Jan 2017 00:59:23 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1cYUHb-0001lj-Ce; Tue, 31 Jan 2017 00:59:23 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v0V8xFr2015397; Tue, 31 Jan 2017 00:59:15 -0800 Received: from [172.23.64.217] (helo=xhd-lin64re105.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1cYUHS-0001l0-Uv; Tue, 31 Jan 2017 00:59:15 -0800 Received: by xhd-lin64re105.xilinx.com (Postfix, from userid 45489) id 17841CA1C37; Tue, 31 Jan 2017 14:29:14 +0530 (IST) From: Bharat Kumar Gogada To: , , , , , CC: , , , , , Bharat Kumar Gogada Subject: [PATCH v3] PCI: Xilinx NWL: Modifying irq chip for legacy interrupts Date: Tue, 31 Jan 2017 14:29:12 +0530 Message-ID: <1485853152-31819-1-git-send-email-bharatku@xilinx.com> X-Mailer: git-send-email 2.1.1 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22856.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39850400002)(39860400002)(39410400002)(39450400003)(39840400002)(2980300002)(438002)(199003)(189002)(36386004)(626004)(5660300001)(2201001)(52956003)(5001770100001)(356003)(305945005)(189998001)(33646002)(92566002)(107886002)(106466001)(54906002)(50466002)(47776003)(90966002)(38730400001)(48376002)(4001430100002)(103686003)(50986999)(42186005)(36756003)(50226002)(5003940100001)(8936002)(63266004)(4326007)(45336002)(2906002)(8676002)(46386002)(81156014)(81166006)(107986001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB0718; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT002; 1:YJ+gSwTwcvH0AXmKi6JGLO7FyEQoIkimHMN3A3QTkSy7nx3xO7YxxjcERIsCGGf9qbzfGSZpAWDZ5G5t1TniqxVsYBGrfdb8SrCkQbtt//pZ932NBn8mU9mcnuNMS9rK6gtcuwP5SBhUaEEnWuqBP/sAlZn80RJ3DVsnAc2TV6ouMgkGfNXvkTfNmQRAabiK07YD4y2BpFOh69SOJPFVmdpoqtoxhnQsH4lKeX0exYnvHS9FXab977snRm0TH7uQtp5aojfsnyy3FNRYm3a18rfeLL3dsgUyyR/Nrr1sz0ZkBRQe0rHpMZ9Hg+f+1hKqjrH8HuqbYTmaZp6vn0mVpTkggfg3qlXHWdsrqI5nwNZ3dn9Zkmq7jm9HXXmimfJuxsZUWLIbUyyRq8mMqmmVfAi3zcvv8hP92nTAPzUzbbvDz6sXdTOtHGl/HswCMbJ+akFOpniVm31X4eNP4mT9Yb9T2+3SukYK+ab5mU5S6ZQQBRb2A4jeAB0qMo3mM6Nky1YfMjf2VPSgyk44W3vYQYLk0EOYnJfG74xPAxIflfHuURp353V55pDENhGd3/Va0A3mCk2NQGoLt9ydZhqbEQyft2TSsr9oMIWffTvSpwE= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: eae47386-c330-49eb-0d01-08d449b7747b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:DM2PR0201MB0718; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0718; 3:lxaWUPVgbQCZGCWI7MUhK6L2pon7TJU0YqLrNWvJjHVk26OBUzsCaxZ8khEzhCrZeYEHe5nFNUkZbBDaj2AMtm1gjv+Mn8ugBjCx7633UsoMJ5Ok9V8Fjjd32a9FBPW95CC2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1vargDRG8thaoCula7muLOrQVoAQYBMXiGGyHBaXvs7vUhDhkM1uOHvQ7hiB0yZyHcsbaSNmC+wCzpZxyVOMZjVJSWTO9SwwHlav7Ghz5vuqul9iHiFJ4mhLVpO78b44TGEO/7JxSBuHapBtRfZUlQqMZRI5LjLs5vvwOxr7ak+/AN89Vki3Krx91Ohwsy6b4IG2ZWeuMuSGcIsJdX5os3VMRYKAz6HeEjLg7CZ5zt9BIuWeWn6dDpekfW6By/T8RkqE1cRx+8oW5QaMqeW6bWWiF4qDoH2hu0m/M14DK2J8pCgMjcKbK4T+TjPlcROozbOQBI8DySqE6af5XMESyvA2ftzUIg8FiECY7Vt8/Q2qxWBwshOS7J90c1V9nCxl+AKoYsBjcYdwxyx7niM08DLeCGdaD/jKq6MC5Bdpm5Qwf7bTd6YpRl8C0+JRqth3Tha7g5KZFsIfUFL7+yVS3RUE5bwmjUZEf6DFzIrOTH7NtK6Qhq+NW5w X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592)(154291594099940); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13017025)(13018025)(13015025)(13023025)(5005006)(13024025)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123558021)(20161123564025)(6072148); SRVR:DM2PR0201MB0718; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0201MB0718; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0718; 4:BVgMGuo3XN1dRhY9cCveytWsinqmeMPA9q4ch81bcgDRYp70LbpeiH36/DxqpLSTeGRkZg9r+7Ey6+6ghF9JwTMlPzBknB9MEc/eKKDXAxV5Ytz9ReJ3sGsZLQH48qxYjardCYFT9tl6eFpt1Uc3fGRv1/0OQOPsOFIrsQbmd+1jsgpe+4A33RtqnBPUN8NHEgBlSnZ89Nokqe05fthsiAi8yJw1W3e4Lai+DBQdMLrjn6DFBuh5uRTT/75Hh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Akzx0MAVe4sn59md9J2COIj26rBGgnCMdIy0Gh345sq9hIfeSkIe7ipMZVmaKngZfpBoEtreum1+nD2r62B5yhYm8lgdCDWsJ4TwTmCKSTpwPjRM7q3ewBCVnrNKYJWZ5d/La2q8AP1O3Vh+8Nqx60NLjie9DKgncjuIVSAHq5HwXUnsO+U2+0Wl+DHpSPlbL3Ut0Q7xLC9ZjT/mBBekAZ2PfkmG69FLCelbgcaciwFLRQd9AqTJCRk/RQ3Bbr74dMUPmt1cqSThDaBokohUyzrjIJgIdcQrONo X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2017 08:59:24.3927 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB0718 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 - Adding mutex lock for protecting legacy mask register - Few wifi end points which only support legacy interrupts, performs hardware reset functionalities after disabling interrupts by invoking disable_irq and then re-enable using enable_irq, they enable hardware interrupts first and then virtual irq line later. - The legacy irq line goes low only after DEASSERT_INTx is received.As the legacy irq line is high immediately after hardware interrupts are enabled but virq of EP is still in disabled state and EP handler is never executed resulting no DEASSERT_INTx.If dummy irq chip is used, interrutps are not masked and system is hanging with CPU stall. - Adding irq chip functions instead of dummy irq chip for legacy interrupts. - Legacy interrupts are level sensitive, so using handle_level_irq is more appropriate as it is masks interrupts until End point handles interrupts and unmasks interrutps after End point handler is executed. - Legacy interrupts are level triggered, virtual irq line of End Point shows as edge in /proc/interrupts. - Setting irq flags of virtual irq line of EP to level triggered at the time of mapping. Signed-off-by: Bharat Kumar Gogada --- drivers/pci/host/pcie-xilinx-nwl.c | 43 +++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c index 43eaa4a..76dd094 100644 --- a/drivers/pci/host/pcie-xilinx-nwl.c +++ b/drivers/pci/host/pcie-xilinx-nwl.c @@ -184,6 +184,7 @@ struct nwl_pcie { u8 root_busno; struct nwl_msi msi; struct irq_domain *legacy_irq_domain; + struct mutex leg_mask_lock; }; static inline u32 nwl_bridge_readl(struct nwl_pcie *pcie, u32 off) @@ -395,11 +396,50 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc) chained_irq_exit(chip, desc); } +static void nwl_mask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + mutex_lock(&pcie->leg_mask_lock); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val & (~mask)), MSGF_LEG_MASK); + mutex_unlock(&pcie->leg_mask_lock); +} + +static void nwl_unmask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + mutex_lock(&pcie->leg_mask_lock); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val | mask), MSGF_LEG_MASK); + mutex_unlock(&pcie->leg_mask_lock); +} + +static struct irq_chip nwl_leg_irq_chip = { + .name = "nwl_pcie:legacy", + .irq_enable = nwl_unmask_leg_irq, + .irq_disable = nwl_mask_leg_irq, + .irq_mask = nwl_mask_leg_irq, + .irq_unmask = nwl_unmask_leg_irq, +}; + static int nwl_legacy_map(struct irq_domain *domain, unsigned int irq, irq_hw_number_t hwirq) { - irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); + irq_set_chip_and_handler(irq, &nwl_leg_irq_chip, handle_level_irq); irq_set_chip_data(irq, domain->host_data); + irq_set_status_flags(irq, IRQ_LEVEL); return 0; } @@ -538,6 +578,7 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie) return -ENOMEM; } + mutex_init(&pcie->leg_mask_lock); nwl_pcie_init_msi_irq_domain(pcie); return 0; }