From patchwork Fri Apr 14 15:04:32 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: 9681365 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 AA54D60132 for ; Fri, 14 Apr 2017 15:04:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BDFB286AD for ; Fri, 14 Apr 2017 15:04:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9064E286B2; Fri, 14 Apr 2017 15:04:47 +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 A7128286AD for ; Fri, 14 Apr 2017 15:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbdDNPEp (ORCPT ); Fri, 14 Apr 2017 11:04:45 -0400 Received: from mail-co1nam03on0056.outbound.protection.outlook.com ([104.47.40.56]:61408 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751720AbdDNPEn (ORCPT ); Fri, 14 Apr 2017 11:04:43 -0400 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=wtaycqwhnZpVSavDDyai9E2JrUDez59IZBqkbYlm6JBv+LSJFptc7Lu62JhCUnX6qcl5X+tJuVeo1lsKrjAooRK1zh1PP2GonNHK5YOQwFobaN9vNAgquMabk0YCdJYDy5Dz7S+kyaxkRJetmayKIONfaGP8G7nBmamYQu/WqZ4= Received: from CY4PR02CA0035.namprd02.prod.outlook.com (10.175.57.149) by BLUPR02MB1188.namprd02.prod.outlook.com (10.163.80.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Fri, 14 Apr 2017 15:04:39 +0000 Received: from SN1NAM02FT057.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::206) by CY4PR02CA0035.outlook.office365.com (2603:10b6:903:117::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10 via Frontend Transport; Fri, 14 Apr 2017 15:04:39 +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 SN1NAM02FT057.mail.protection.outlook.com (10.152.73.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Fri, 14 Apr 2017 15:04:38 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:44325 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1cz2m6-0005U5-6S; Fri, 14 Apr 2017 08:04:38 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1cz2m6-00059J-1x; Fri, 14 Apr 2017 08:04:38 -0700 Received: from xsj-pvapsmtp01 (xsj-smtp1.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v3EF4arP007954; Fri, 14 Apr 2017 08:04:36 -0700 Received: from [172.23.64.217] (helo=xhd-lin64re105.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1cz2m3-00058M-V8; Fri, 14 Apr 2017 08:04:36 -0700 Received: by xhd-lin64re105.xilinx.com (Postfix, from userid 45489) id 0E072CA1E1A; Fri, 14 Apr 2017 20:34:34 +0530 (IST) From: Bharat Kumar Gogada To: , , , , , CC: , , , , , "Bharat Kumar Gogada" Subject: [PATCH v5] PCI: Xilinx NWL: Modifying irq chip for legacy interrupts Date: Fri, 14 Apr 2017 20:34:32 +0530 Message-ID: <1492182272-31132-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-23004.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)(39450400003)(39410400002)(39400400002)(39850400002)(39840400002)(2980300002)(438002)(199003)(189002)(9170700003)(189998001)(33646002)(8936002)(305945005)(54906002)(48376002)(50226002)(63266004)(103686004)(36756003)(50986999)(90966002)(45336002)(52956003)(2906002)(46386002)(8676002)(4326008)(38730400002)(47776003)(107886003)(2201001)(5660300001)(356003)(5003940100001)(6266002)(42186005)(50466002)(81166006)(36386004)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB1188; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT057; 1:kyJf/o+L59f+ajvvnzy7jdwFA4wqL9AAOIlsa5CdHwRhilKfjO6WMxunlO+zoBie1BgtDJFJmyThj34Gs52+/xyiRJCmCz7F38fUGuZNVXxBYHOVTHPRo38OhAbSjWFqCD37cYAyFAfcHF7TUQvLn04Nw2KV0wUrbnaKaK5jEAaSHa3XaLJMG9T0AcFsanqbV7L3+JgBllHn0KseUyHNJAIyGukiT3AHxfDCXxJ+z38LQB1DzIJvV+FKw7Se9yzs18DBbPfeKH2LccEJUb81smuvMagsQtcjJSSn9JYj84A34nwYDEZjv/PC8MCUDP8NOZNxB4AV1kk5gGY7a4A/tE1M9MEMAIG/ba9xHiJmAZUAQnIJvO1EuuWyWaegd8Ur3TXdwLwfJ1lcG32LT/qe9Hu7+rcMwHgEv2qIT20YcRpA9AUK9fJ4DnocsJtznDCEeIvFJL9zlrJSsTyb3ldMTlQPB0kHENWKjq4S0dfsWOQHxPJ69ujrjM8CqVg5TSm+hwhrWKzVZwY8wtxp6iSOBFLmIPUoAwRZUcOdXUDhybiLez3zGtNvuL81hF82ikb5gOJPjPKXQxpZLxNy0Ey9TLFcoSwamLc6i5rmaAKjHzDHmJ0yb9tAdMDNIMxESdxG MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b31c108e-f1bc-47b2-7499-08d4834792aa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BLUPR02MB1188; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1188; 3:Xc1LyOGku2hz0dLMiyjW+OgQqLjGYEh8cN1ABuCrVeRP8vXZYzkZ523R/VWjRCb0IyNs6a10yvpjn0WmRp+FZ8A8xKJqzUYZBgAZ4vs0zyywuarya2y5eWTx+0GXm+jsDz76jUrcHmVfLcQmX8KaSYUwVjPfu5zEgaHSTCDk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VH6bRhIUACb8/edINGpFSPbFT+bkpEmJTYInQdvLAb2Ezy/MMmMDTvqCCOh/yWAiN/KTCAww== X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1188; 20:9YVyMVK/nQwirQKXtXtXfO2Puy3UHdmiBoKT9rEJxZl7TAga+4McdZIa7ZQ5TK3dEzVEkP49RoUxEkYzDFXn1pfTkQQ09JS88KYUAHuGOr5esSc380ROMzlXPk7rumBpiMkYuemGtKT23TzaZKrqqL+c8Vq2bLXMc8Z1HdSxby69xLEGv7HMmyJj/fvQlamW1aHk3L8UD4wPdVMbZF6GzWudbfgOfKlgKI2uTk1D/bDEYOCytTkmTh+55TomPyTwkgzsnKrvTwxf0GdQtsQxxl+3/mW0qXb6nbXXNeTswk+AjnYeXzKiU7WaRqTD0HE/nHyp6tTGoNrCNZX5qQloy+hg/HjupPycC+f7qDj9hb5H8B777Phl8jgHGh6agZOfymkPd7qsXDmC01kywuSubdgDXOSMC0dzUh5t6ntvoEsesbh5zZBizukDrMCcfPaZ/AB/KVNkUSS96pw/yzWSOacXurBHx+hJgDBt9Zv4RJLCDfIVyhUrjiM6tNNWR8+L X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592)(154291594099940); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13023025)(13024025)(13015025)(13018025)(13017025)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93004095)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:BLUPR02MB1188; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB1188; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1188; 4:MHHoHwPjeqFMMS5X0i00LD2aKiWGPZruZ1wyMsiW/loI2ExlMi3k9EgQHl05sLoLtWH814j8f+8eMwCVWwrCu8KUuWBm5+EA7HV7+6QogKA1fo7inzaMZtjHHqFPOY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cqBjvIT5ar8EOjU9W/go1h?= =?us-ascii?Q?w34HF0=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1188; 6:uE4RHH+pCrNZRLCJUxhIsbYWQ8l+VZNLRYu14CPqWbAugKr8HiFymmDfu5F4o1RnXLVHYlz0zJka1V9VlR6nc6pnJGxxvDGr6YxRov9NCAvv3EmFJRCVmHl/EnjF3kZNp7MM7ejSNtNeC2q1zNTPFYOv/7oWr7nvYKFIaFf+TvVOU7tm37nOvRsFyK0JmDEiKwC9RUqTJ8Re6wNDOUGNKsAmMX8vqgPJ0TC7M9kU+N7lAWKDh+w9I1qgEPnz5ZXWimsyVTfgNOC7ttmLeq6TATc7Vw6V2Ceg58SuGS82jeYEGi4UbXrdX50x5tPlIyoU1yxJ1MykKBBZ7E+G6fX3ly8QeB24BSFBkPW7apToDjArBdV9EyuaUyGMvGiGOqhYSjhhEohzMVZDSlO+cDHAXFDDqumdflMt7+xfwextEz2lmGLffGLKuyEd7VLrUsFrxIoSDMYulEP/cPltf76zyz/HZH0hB99ORiT9XkLOjKM=; 5:m/phPFrr3rTqMCmXmDymSsPwfotmr+QaME8EnHnIIPHJVWXSGuenpjZi/CSRwRL9LxKZsXz8vbTmQhmRqsizfF+dpoodXR4tl7eFtCzV5qhhErKQZNhMa0UxQY4s/pAtywDyS4OdT2SKUStFGeX0ZbLTo1wNmYCLFn17eoLblDA=; 24:eNlCKDgpCvD+OGSi9Hk9lG2Oqw9YlzSjm7JEIe4FDNhVHTKMwO56Aq4/86gzgt2Sko4n9GKd4le8kkl723yf6klOov7ZxtKBSGnLJsO0XVA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1188; 7:6e33dpuVcuSIX0DBnZeO4A/Q83sG9C4lBxbfF/4LaLjDBJaIlheV7GfueA1P1nLQHVMVczlKHEa80pEMmdmOOkVw54akoeKM1FRM8h/wU1yajMRkokUD7KhHRt29DgM2vwsEL/ZczNMlqlWMQu0OwPgDklywef2G3x06SXok/QFLzNFCwLEqYx+TaQEBPyySSOHX6sJxG9GthRplpmzVmBCnpOgr4FyIAAXm86c2f/phnZU0kwbbxtcc6URLLJSLnREZpq7JTXeq8TkvnELaWvXhWRioSyN65Qx3oXo84hI3jO6KJOoXBnq8I//kFaTmwsWtiBQjxt2sQP7BqLLCgA== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2017 15:04:38.7487 (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: BLUPR02MB1188 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; }