From patchwork Fri Feb 3 11:08:30 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: 9553885 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 B918F60424 for ; Fri, 3 Feb 2017 11:08:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8562280FC for ; Fri, 3 Feb 2017 11:08:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99ADC28427; Fri, 3 Feb 2017 11:08:46 +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 C8EDF280FC for ; Fri, 3 Feb 2017 11:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752238AbdBCLIo (ORCPT ); Fri, 3 Feb 2017 06:08:44 -0500 Received: from mail-dm3nam03on0084.outbound.protection.outlook.com ([104.47.41.84]:52732 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752002AbdBCLIm (ORCPT ); Fri, 3 Feb 2017 06:08:42 -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=04TnH7I4Xfw82+mNiwPfQtRwfTEPkIvmlrVO5WVIa3Y=; b=ZLg209k7KFLy/fuIy5XmGMIYem8Q3JU/8jRD+JsZcwQSRhxy6fcu3HH84A4MTFW/dyI5+U+zfY7i2Ua/nZfceuco1F4mmSo8Wt40rp48Dj4kzdIfPEql80xkGpvsMjhfK3CFSqLTP9L4b7E8cFu1JLjvxidpP19PTf4zv16MR/Q= Received: from BLUPR02CA024.namprd02.prod.outlook.com (10.160.23.142) by SN1PR02MB1391.namprd02.prod.outlook.com (10.162.0.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Fri, 3 Feb 2017 11:08:37 +0000 Received: from BL2NAM02FT014.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::207) by BLUPR02CA024.outlook.office365.com (2a01:111:e400:8ad::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Fri, 3 Feb 2017 11:08:37 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) 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.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT014.mail.protection.outlook.com (10.152.76.154) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.888.7 via Frontend Transport; Fri, 3 Feb 2017 11:08:36 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1cZbjH-0001HI-PP; Fri, 03 Feb 2017 03:08:35 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1cZbjH-0007DD-Kp; Fri, 03 Feb 2017 03:08:35 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v13B8XB8003428; Fri, 3 Feb 2017 03:08:33 -0800 Received: from [172.23.64.217] (helo=xhd-lin64re105.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1cZbjF-0007CX-1c; Fri, 03 Feb 2017 03:08:33 -0800 Received: by xhd-lin64re105.xilinx.com (Postfix, from userid 45489) id 2CE58CA1DAA; Fri, 3 Feb 2017 16:38:32 +0530 (IST) From: Bharat Kumar Gogada To: , , , , , CC: , , , , , "Bharat Kumar Gogada" Subject: [PATCH v4] PCI: Xilinx NWL: Modifying irq chip for legacy interrupts Date: Fri, 3 Feb 2017 16:38:30 +0530 Message-ID: <1486120110-15205-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-22862.006 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.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39850400002)(39840400002)(39410400002)(39450400003)(2980300002)(438002)(199003)(189002)(63266004)(33646002)(107886002)(103686003)(38730400001)(106466001)(42186005)(46386002)(8676002)(54906002)(189998001)(48376002)(5001770100001)(305945005)(50466002)(81156014)(92566002)(6266002)(50986999)(81166006)(5660300001)(36386004)(36756003)(45336002)(47776003)(4326007)(2906002)(356003)(8936002)(626004)(5003940100001)(2201001)(4001430100002)(50226002)(90966002)(52956003)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR02MB1391; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT014; 1:zM9/BK94G1E4625KISDzDcWKiLRqfqe8AOJGScts5g+n5lzLlvL/Yz0ZU0R/749TlC6uFVgt/uNUp0QSTpDcdeejwtVoQdc95lHBMyrbiA6p0su7kJx2tRIqedM92Mez0+dI+FOpFMYpkdXah+usHgjYXjcVgQfJ/gzIpW6z5NCr9hxpZ0kuppsDkiZuDYKHVrkgErmaIqdnFyy7AekOmA3u1bx/p357DskiQC5ouyegFXe959Pm4UWxi/IIOxgNPlvh6sCqotArJZK0xVHbkYbkiky9y/CJQgK/nnCDBdMgE1ttG1FMD7TNtGtEmATCT4ghP5lcEhFi4spY0XDutzQjFApnu4Y1kVDuw1kiNatwRluap0ChUu2K4BkpPB9L+XGlijY4Km6mFslIVFMRQFg/f5fqHdPmKjJjsA0NVPZxR19mULpOLU6cTnS8nMx9D+KFYbbthIgdvp/XH0cu5sSmz+I7lqpEtD71vgy+hIGErYWabSaC3DZ2FbgHksOyW4LawWkDLbAr4h6CTKRRKyn45uVxsqBBT7ihXignEnS+1zEWHsEP4DmfqyIAkBjRGsSAzS/VkHjhkzVfQ0JAhEhy1G6JO0WwyXDiWh+Wl8U= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 5f6a1841-f6f9-41b8-e1df-08d44c250039 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:SN1PR02MB1391; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1391; 3:FUoIEKfIMhpcYprd+k31BsH6P5R4460nNwr+fTvqJAatMvboYQow5I6gnudPJhpDbThGzJ7WgdzNmFmhoYNOLVhcUM5QdqQ9uesD/AKI4mehWisuSK51Hh0qGtCwHWidQKJ0ro7cq09xvB/xCQiXCD67olZzoKP4qxPbC7k4GfAonqMLsmR+CFtf/GWVABngV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Sg69TsubRHqx+sWmUS5wbwwB44WWVDNCB3gFsU8paMb3bvRCOsFtk76DteOLGH532+sSzZJ37CAXf/XmxkqkWqgMNRTAxXdz83JE8Ax7LeUsmJU7K2P/P7/ZWI/ZW+IWwR73wnXhUt2rSNCQXtJqTKkOZG4hoWQycSqfl89cjmawEsAl7G1PhzQunNmWKCYfMs7OIuHwfNxnTLBcOpviIrC2ACin+OUCb+sC81q84nDdCnjZroqTsARkoMJKwgMdhW9g6yJDMXN54FGYbMY9MIgUb90wkDfkCUhFuxRB/0OTdPkrRtclKJrhh3L9XyZfqmIvO0UmZsO667A1n5Rmr42imT826aTqvHLNSJKVMAHBMps5Lk+kUUP/OJp8YidForDN2kr/kisjrm4GwFxxP1LTVpPzBzxi1ipKssYRh9Llc6i/Oafb 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)(5005006)(8121501046)(13018025)(13017025)(13015025)(13024025)(13023025)(10201501046)(3002001)(6055026)(6041248)(20161123558025)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:SN1PR02MB1391; BCL:0; PCL:0; RULEID:; SRVR:SN1PR02MB1391; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1391; 4:atUegbYsMtWdj5Q6Iz6OO4u85OdQnETy4atAFQ00P/Schsdmfrnor3LyA4DxdU9NwUxLBBYqQ9LXwGRzdd82sIxvAFDBf5YRWL8VgbQx73XFby2WDVafgfmOFxFD7Sv/UuRz8ssN+Q4jfF3ju2Ng6dONcoa1N+c3wu0F6gy9kbzO94sAk4Z9G+AZC83kAijY6O9CPQ+WGWpM7kMouLmDmTYi4QcWJfeIvhbJV9Ee8EDeuWQqR1E3BQ3dxm3qz+i7VT6CKXhezjVCtLIlvn5xbJaJDALW3LtHPQg/Qx0WFxcPo3/J2K+HEBnd2vN67EN2b3NqFdABtXk+fj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cplGYMpxehVUf98NE/lOTBApqclE+V3MBnB/N4JdLyjrBH/7hzflCjnsWsFU4NXuGVmtNatqQCJROMkeBnPT6vhtTimE45m9eeqrA== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2017 11:08:36.4720 (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.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR02MB1391 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 | 45 +++++++++++++++++++++++++++++++++++- 1 files changed, 44 insertions(+), 1 deletions(-) diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c index 43eaa4a..e4605f9 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; + spinlock_t leg_mask_lock; }; static inline u32 nwl_bridge_readl(struct nwl_pcie *pcie, u32 off) @@ -395,11 +396,52 @@ 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; + unsigned long flags; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + spin_lock_irqsave(&pcie->leg_mask_lock, flags); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val & (~mask)), MSGF_LEG_MASK); + spin_unlock_irqrestore(&pcie->leg_mask_lock, flags); +} + +static void nwl_unmask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + unsigned long flags; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + spin_lock_irqsave(&pcie->leg_mask_lock, flags); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val | mask), MSGF_LEG_MASK); + spin_unlock_irqrestore(&pcie->leg_mask_lock, flags); +} + +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 +580,7 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie) return -ENOMEM; } + spin_lock_init(&pcie->leg_mask_lock); nwl_pcie_init_msi_irq_domain(pcie); return 0; }