From patchwork Mon Feb 6 07:03:16 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: 9557185 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 0710C602B1 for ; Mon, 6 Feb 2017 07:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1306228C9 for ; Mon, 6 Feb 2017 07:03:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5B752723E; Mon, 6 Feb 2017 07:03:50 +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=unavailable 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 70F6F228C9 for ; Mon, 6 Feb 2017 07:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751189AbdBFHDn (ORCPT ); Mon, 6 Feb 2017 02:03:43 -0500 Received: from mail-co1nam03on0064.outbound.protection.outlook.com ([104.47.40.64]:8290 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750924AbdBFHDl (ORCPT ); Mon, 6 Feb 2017 02:03:41 -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=sKZhlemp5R7p8T0SFxOnEaHV6RLens/IKHqq1nSL+bE=; b=BKfdNdGHrv49625gmNNMbYz/1ojyoDxLc50QtvcxpJsdH9KIVVnUps0XrNSneVFjMpGeMeYbJb3uiGDwlF2QTfgrbi7hHbA0it/EppLuUlItm54sXEq0eBasdWAcIPSmXQnu8tHWiEqebVBmQPg3rdYQWU9nBHsOBkJW/VJlrO4= Received: from DM5PR02CA0067.namprd02.prod.outlook.com (10.168.192.29) by BY2PR0201MB0711.namprd02.prod.outlook.com (10.160.124.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Mon, 6 Feb 2017 07:03:34 +0000 Received: from BL2NAM02FT014.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::205) by DM5PR02CA0067.outlook.office365.com (2603:10b6:3:39::29) 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; Mon, 6 Feb 2017 07:03:34 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; arm.com; dkim=none (message not signed) header.d=none; 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 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; Mon, 6 Feb 2017 07:03:34 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:50097 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1cadKn-0006m5-4q; Sun, 05 Feb 2017 23:03:33 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1cadKn-0005RP-1J; Sun, 05 Feb 2017 23:03:33 -0800 Received: from [172.23.64.217] (helo=xhd-lin64re105.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1cadKd-0005QN-0b; Sun, 05 Feb 2017 23:03:23 -0800 Received: by xhd-lin64re105.xilinx.com (Postfix, from userid 45489) id 23647CA1C38; Mon, 6 Feb 2017 12:33:22 +0530 (IST) From: Bharat Kumar Gogada To: , , , , , CC: , , , , , "Bharat Kumar Gogada" Subject: [PATCH v5] PCI: Xilinx NWL: Modifying irq chip for legacy interrupts Date: Mon, 6 Feb 2017 12:33:16 +0530 Message-ID: <1486364596-19699-1-git-send-email-bharatku@xilinx.com> X-Mailer: git-send-email 2.1.1 X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22866.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.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(39840400002)(39850400002)(39410400002)(39860400002)(2980300002)(438002)(3190300001)(199003)(189002)(2201001)(305945005)(54906002)(50226002)(6266002)(36756003)(8676002)(38730400001)(8936002)(52956003)(47776003)(6666003)(81166006)(50986999)(81156014)(107886002)(5001770100001)(92566002)(45336002)(36386004)(46386002)(63266004)(90966002)(42186005)(50466002)(48376002)(4001430100002)(189998001)(103686003)(106466001)(2906002)(33646002)(4326007)(626004)(5660300001)(5003940100001)(356003)(107986001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB0711; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT014; 1:U0qewKrqSvXIw7stf49iLnyYq75L9kGidBves2Rs/qM1FH3lfiUzo/lILSz8IuvSn1ic1BQbWJv4dKN682TQuJRaf4n11SD6lF//IISXcugHy5DB7ghez2yEpZSJWlCgSkA3OfKPSZuBruNJ7RvWm+tranEWS64oU1szr+Db9VY1ikndtVGZfvz1WSdZBM56iG6vbILdgg2upV4palD7bqE4KqmhvHm4CT29iHeM8/D+d5aggfuVhZ2iZvryHeNqADchtSeViO1g0Hn8Nc3DPVGZAvLfh1gygxICyma17guHitlsc2toc4pUhuVvWW6al12I3aVtllq2mCY0dNXhZQSxsjXlfABhjfO3l+MxVWmFc0qYBBO01gtA3kHHE0qQYBmcXG6nUUA9waTzEmv777JFKNczn51CHjiEKfMdK5+W1kbOHvs2/bhywUens3Cf72ZcUAC1eBlN7LPbPD2ymxqxpajTT4dUsAlIzsAyVCmU2Q+PlrBsABEBb+qD8y3HyyfmE73ZsNziAIvurKp+d27DX/jvPDCM/97fmbrbwKcOvSKxKpTkijVxDhmFZcFeIaHiAFhiaIvGcJtPndnpAr2bSNGu88HUzmaqcNnvN0YTyIfd7+SkTNEAJQ4/tvTT5oMCJ2GngJ1w9lLBZyYRDg== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 4eebeef0-3530-422d-1f49-08d44e5e4426 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:BY2PR0201MB0711; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0711; 3:S2cJhK4eXpCwaIMipEWhq7p63ZPW0WE8K2FMXqcjAbV0V9QhAxthgv1e56MlUZIksAkVTn0+h8h+KcbaBOPta+ZkSWHeYAtgLhrd6IcXukkXmswWhA/FlYqkqhDoQ/i+mBVR4sdCxHaM6HvZJgpbd0n3M5DwSBa1/3gOnHDDHpKfB3omHRw31G9v5ddYsF4bMLLyaOLfsIKagHi4hFAGt2pQip2T+YqF9DsOOgWltOqo78l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xr7MBRSXg8bnwiZoy1UosrteycmUqpxvNemKyGPG8lu03+9ORdyw7geHlnza9a1Hhydfm3SOSiRZGSrpl5GcB2ndfvLZr1b6UXe04JZqZi5eLNnPBzv1pY/aAH41CSDNaF/wNo2tP8XufG1OEPXXc8Qjzm1M1nH+EPhln5uUb6lTWcNXkUDQD82Pgvxuc59dOS59iJ+E32vAJwfFL55+laiU47nR8iSVmV9VrrXQpa8DE19UrAKYYEb1dt1NoPHmv+MyV1rQ456MIMvaj/+XYJFeQ02yJlfb80nNiZ26m+x2kbqYTFk48DRhJ1neG+oBeJ8YO+vpEQTMCO/HTdCL7SRlXf7SZaLrpNpnhMbbiBDjkKVzbd7i2tzHQeqc37EO4m7tYCnjtKkVNL+3/56n+BK 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)(20170203043)(13017025)(5005006)(13015025)(13024025)(8121501046)(13023025)(13018025)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123558025)(20161123562025)(20161123555025)(20161123564025)(6072148); SRVR:BY2PR0201MB0711; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB0711; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0711; 4:6+jPjIypiD1ALaAt61vdMKAGJjaJxhR4CSeu24SZsZ/+rFUwc6Y607mkUfC/c0hF23GAEgB1mgEOneUc4oNvn/N6aI9wdkpqUd2mTK4t0TtyMeTt9KZ6LV99s8m0KhX8BVSeLnyhX7kzkERBuP4IeJXlwm6rmclG38N5f7QLfthFQ6bQ8QFhMtULHHIKx66tqRCU/BUQyLjR3leEcF1bXM8urAizAqiUCfY2bn7f/BcOHA/iJxsdBzxcCzNWTVjOZEofUk80GoAwU81f9gll/umGFImGa6YNYC0oymsTYPsbekdNgX0bswoViPP8sEWjxitC4nCnAmjkE+PF9tyA8zbLRdNsvloiiG6eVb6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6nA/DjzDdKOAp23lZMdCGqFh7VOsFLQ0gQxh9eNQttyeGc?= =?us-ascii?Q?aLS78YE4VL63ex6kALVerFjneO0zr8jiD3uYcwvZT+oVBQoCi7Sv9gavXBlv?= =?us-ascii?Q?gTVSGn+tGeSWRDRPOWQegup74Xc7NmVvlpZB641PbALXspK8aRxKsTo/zguG?= =?us-ascii?Q?je4W1mMgBead143pcy5VSLPMEg4JH2VCRraeOjkznfuwpr5VFxGo/+VTKtJx?= =?us-ascii?Q?DNhmP5FsTzZntm2eBI1/AB72J8Pl06whc+0E4GGMTv0KFVlRmGg6dgPSYFZc?= =?us-ascii?Q?Z7SXjxZNetn+5bpsLlKUQvhGwlkdit+UWpO7/ln5ssN0FrwEFRLXhC6VeHnc?= =?us-ascii?Q?9T5epxBcEJ4DpHjJgdmT7k0xpXC2ivgsgLBQADIWgq7xJyLwqj8OPJhpMvoJ?= =?us-ascii?Q?BVq4E/l2HXPIQWkbde6uWmxs9nv/brzdW22NiWpoznBZ4em/Q2AXK4Hn0ezd?= =?us-ascii?Q?kl3A4Q8tb97UkyZAMmccZPL3QTMPeWVcvFXG6kaQUX1SIVWGH+32mD8WmvQn?= =?us-ascii?Q?wl5CGPEhNii5r1qRL72fNd9OGFIdjC/TuxGeHGHjy+NiMQWeFz7Eb+Dy9ZjJ?= =?us-ascii?Q?7UVs4J3unFA4ziqU7od+eFffECu4m4KpKqOwKj6r66FWZ+9c9LkypUaLoh5W?= =?us-ascii?Q?1GSAE2N6sDMUFOoMz2HopGk8UQ25h9mfwa6mUIO8VaDjHAPOkR5Q/SPXrYLV?= =?us-ascii?Q?cYAr8+adl8idMVrWDO011M642XyuI8t+qaCnihACD85K2C+APLHBeCNguBX0?= =?us-ascii?Q?1KzP5SUSOhIVdhIdIFDO7hmAdBLakAdT9sGJqL0/fH6yNW7SPvAsJfiteBgW?= =?us-ascii?Q?NWgKAhdgLyxL63HVe/a7l9t12gP+omc8RYQBuo69j?= X-Microsoft-Exchange-Diagnostics: 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0PeBtNWaV+nWUMxAjeZg2QCX11Eii5SviVAeKzdj/QCV/hTtgvIvvRk/vR0bWRBguLyN0rXhNaDspMUh8yhDaTuuEyu1DLot3rQvR14fdmK4Xo/62I16sm+DJN005iHvX6pIPQ0ZoJmhWevswyStJsm2yLC4eyrTjv3Gq7dNbrD54Afme6ysvxxtUPlRieBUhQNUux0T37LT679xoVfnyAEwcV21LGFvOUmBBziDVYhYnrAIoKZZ9boiE3tukCbdLi3zSYVRHtg== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2017 07:03:34.0823 (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: BY2PR0201MB0711 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 spinlock 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 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c index 43eaa4a..36f4fb4 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; + raw_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); + raw_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); + raw_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); + raw_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); + raw_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; } + raw_spin_lock_init(&pcie->leg_mask_lock); nwl_pcie_init_msi_irq_domain(pcie); return 0; }