From patchwork Mon Jul 30 17:23:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Douglas X-Patchwork-Id: 10549525 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-2.web.codeaurora.org (Postfix) with ESMTP id 2051B157D for ; Mon, 30 Jul 2018 17:27:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7D1629674 for ; Mon, 30 Jul 2018 17:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB502297AA; Mon, 30 Jul 2018 17:27:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 42DCC29674 for ; Mon, 30 Jul 2018 17:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbeG3TDx (ORCPT ); Mon, 30 Jul 2018 15:03:53 -0400 Received: from mail-co1nam03on0042.outbound.protection.outlook.com ([104.47.40.42]:55299 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726782AbeG3TDx (ORCPT ); Mon, 30 Jul 2018 15:03:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GghrOiUZiuqXS4swEdhya5Ka7tfAgl0ROEXtb/l/3Rw=; b=KKghf+j136dGmgB/uj9/FTNJO88omGK7mLVkcD5Pyg2R1eN1zwuh1+U8zf4vMJcB3Ix+MMmYw5MHHmLaZ+2HQm1DgYgS3Q/x80zNr1AJAGrgBKZvIRrsUfnpWqOWUqYNuisF0uCGC+BoEaLDf3ZtgdY/8P4dpsu98Q0X46MB/Qo= Received: from SN4PR0701CA0024.namprd07.prod.outlook.com (2603:10b6:803:28::34) by BL2PR07MB2291.namprd07.prod.outlook.com (2a01:111:e400:c752::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Mon, 30 Jul 2018 17:23:57 +0000 Received: from BY2NAM05FT043.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by SN4PR0701CA0024.outlook.office365.com (2603:10b6:803:28::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.17 via Frontend Transport; Mon, 30 Jul 2018 17:23:56 +0000 Authentication-Results: spf=softfail (sender IP is 158.140.1.28) smtp.mailfrom=cadence.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=fail action=none header.from=cadence.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning cadence.com discourages use of 158.140.1.28 as permitted sender) Received: from sjmaillnx1.cadence.com (158.140.1.28) by BY2NAM05FT043.mail.protection.outlook.com (10.152.100.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1038.3 via Frontend Transport; Mon, 30 Jul 2018 17:23:54 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by sjmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id w6UHNpuw017614 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 30 Jul 2018 10:23:52 -0700 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 30 Jul 2018 19:23:44 +0200 Received: from lvloginb.cadence.com (10.165.177.11) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 30 Jul 2018 19:23:44 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id w6UHNT5J009590; Mon, 30 Jul 2018 18:23:29 +0100 Received: (from adouglas@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id w6UHNTMD009589; Mon, 30 Jul 2018 18:23:29 +0100 From: Alan Douglas To: CC: , , , , , , Alan Douglas Subject: [PATCH 4/5] PCI: cadence: Check link is up before sending IRQ from EP Date: Mon, 30 Jul 2018 18:23:24 +0100 Message-ID: <1532971404-9444-1-git-send-email-adouglas@cadence.com> X-Mailer: git-send-email 2.2.2 MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:158.140.1.28;IPV:CAL;SCL:-1;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(39860400002)(136003)(376002)(346002)(2980300002)(3190300001)(199004)(189003)(36092001)(6916009)(87636003)(6666003)(26826003)(50226002)(5660300001)(51416003)(305945005)(476003)(106466001)(126002)(2616005)(486006)(26005)(478600001)(16586007)(42186006)(316002)(54906003)(246002)(4326008)(36756003)(8936002)(47776003)(7636002)(48376002)(105596002)(8676002)(50466002)(107886003)(2906002)(86362001)(186003)(336012)(356003)(426003)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR07MB2291;H:sjmaillnx1.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM05FT043;1:wrWS5cxATw2ex0dCVvY+BM5p1gwEbFV1IBI8PXNlC0eERdqbRzLjdLrqr+nfR1rsGiw6dxN1WW7sk9mQtZ+kpG/7wbD6+R5KVCx7qmR/IqBjZNsAOPFUHMqjhwy5t+qe X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a27dc5cb-a296-4122-9b43-08d5f6413abd X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:BL2PR07MB2291; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2291;3:gnmzzyucvzqIKR+zFbvl5+5v37gSJSfcD/F34ejbB56nhLwy5lAB2qBPyPrtWwDrYXTfW6GeW+mawS8yazaZZjf5+XOYZ8qU18fYHpgzmqlvgeiWbiMoHkuVb6ui3PQRacd8McsiPx4vnmpSQ8KJPZkIKWVqxofBw9ti95xpkwLRnGWPtYEn/XX1EI7zTzYcZgE/J8Bvy3U6bmGMxfVDIqJE3evmbHtuU02FU/ddbD7OFFeZkF7oawYJAQGruOBfu+w4PWY1QUY54FgRQJHYR4OGYfOWjgY1HDni6Ldd5oioL8DljC+bzjwRTvZ1AEuwy8enOlFPwhRQDGBHfNU97ZvlxVx27IdcFnNswFRguyg=;25:bWbwtN251aJOEODTIa5H4+OlJcCuGleCi4EWTfxP+YSkqkHYhRw/bYXqHp/4Dm/F/N2ONOPR1dYd4yCMzwJWS0X1FswyfGiqQXXDrav/9qAPczflcMGLxPzRyA8G7gE4h7bngKNjLS6j1u2qF/WleWZgzSJR9xXUq01RIGqi674ph71Rt+lnNcDiJDNuglZ2zDvzHBTu/dHCIIY5nctXRpC3IxtcvEkdL8BnZ+ay3PeXgJDog/b30Q458rys4U33rpRTV5ZXsedh1LAetTXqVGWXGT+kDoiVN08IUS3LMA8gIwQ1Ph3102XvpF3kAIgubrEH0hHCVAWsvhvCuwFfrg== X-MS-TrafficTypeDiagnostic: BL2PR07MB2291: X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2291;31:rMwS+L0vTcoi5901dOlJ/xQUmopm07fmwBDErLJw8Jk53f6srBjNzpWkKwLjPxveq3Y+4pmMCCWXqnTtSn2XA4O8atqSsrQgBAB8t4A0iqopQvcEkbMuu50ClShwicTsEL94x7yNoBxFvXTHoYFt1BeHLzU3wpEqGWIKryMgcWh9LWIdILOWNv04gAJ8NBqbd2/q13EZzZDJaUnoVZvq5OJovDZRrdrPOKZJjum7uWg=;20:/FkQtydDkVIA/uJi874I5UQStpPMjcNLR75IRPuR6c46FfeRPPbg2D5Rj2wVgcgxkqkpx+wjvXYh5kX3HBIPwIwgbyVU3UK7bKL1ma5CvV96yy02QOjwt7EwQ05yoKowny4tid2voTn/sdkqsPW9lG5KCjMkcWYVFwe0lQpIfZ2SJzXaQa0ed8bEk3ySLb8cP1I2IeHg0nUXtXV5As6D8SxHxMj+6P0Gn99RdhrU4kBsBW7PVF7LLScke8NjFoHZnxTdLHm3fZTSeondPnuHn4ABIWvLvZzJlfhqmZQhb5kpXGQqkREWONWWyCUsFgfD6kvJN2aYRRGgCtaPipYWDFFC3pxvKRj6wYpDk+iE7R81Zy9+LRRfcUy/Ik5PkhzjVKVRYQehEvY7KAPD16OTKSYWSo0sA9f3aUqstTgHmHan42QDUb9IsbeQo23UDGWJetJdwrnxW6px7Hrh08tMEEx84CQyU1/kGayghdgsrnk0KoXkw0lqXjtpkNgwv5cf X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72806322054110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93003095)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:BL2PR07MB2291;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2291; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2291;4:ZnKhTsue0Myp6M/Dh3jT5zSY2sjUuLfee6De58GF2aL+/6El9Z38C4Tieh3Ul6I7rEJkPaOTUTqZh1s8nENCBl2We4EcD5wbCiUDpQ9I73cyoTvGf8n5WkKbIBhCMqtkOMcHNiAqewXanarEz8eXi8C0wbg8jmDGA/nvLzGxw+T9acT0OxKZKpPgHmHpq5R/6qOyZbaqVUxQJ8WDWdTj1y9sjbZ5IUrpCd/MJ+QK5jAFGONBBiN/ioM3ojMXu/v5Ey7Qm0g0I8+8hnnUoNGYY7JOQdmmQ9lN1qcv47N0zYzyFFJSwd6RofNJnScjsOZU X-Forefront-PRVS: 0749DC2CE6 X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2291;23:ENGShmVfaK0xn+0TvagvVMT6f68YXV2ERBm5o2qfDOr/M7Z7z6Cr5UJ0JZKjcEJLosiYhWtkV9tkPQBoL82yMYpU/p3HDfN+AVyDV1bMVQWS727hHNN6yzZ2b4aONFoVDkavpXg1Lz/CCY3HieOdVIKqcKUN1HeIsEwWjcb8211Z9ENgqCDu0eBWbTXQcax7nkPEsZDDOV/w48Gk9xe02ZNSKnI6ZQOmxHlILTttBKFGS70jwfwUzmy/xA+XeGG3It0VkHnid0Oo8LePqvKk4ty1IGoE2KKhHWYcXxAtbUaYYCkiJfnkrMGxadM8gFAUOaNESd82QQ9iDlKmXu1UEfnEQbYHED23hCXWVYjEctQD1XspYWux9ERcKb91gM7wiRkkzLqK1+BERw6qmPOm2mFNsVUC0pkjFDoSawYooikm1bXIp2jjaxXTtrdamZF8rWFUR9N7X++xmn3qUILtpWJqrN3ZQfNV7P/aRGfKk/+fvmLF+Lfc2sS8eA5bUSdaQBx02By7fvEkYXtQdSvIBY+xT8coCrAxMGffnazfsfW0vl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XB5e1ZbfB75o9IK8nPLyjUX9blWgCmI31VCYiPTyInOXgH//nxAiZaJ4zyL0e X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 17:23:54.0041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a27dc5cb-a296-4122-9b43-08d5f6413abd X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9;Ip=[158.140.1.28];Helo=[sjmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2291 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 If EP attempts to send an IRQ (legacy, MSI or MSI-X) while the link is not up, return -EINVAL Signed-off-by: Alan Douglas --- drivers/pci/controller/pcie-cadence-ep.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index db75280..33e30dd 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c @@ -370,6 +370,12 @@ static int cdns_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u16 interrupt_num) { struct cdns_pcie_ep *ep = epc_get_drvdata(epc); + u32 link_status; + + /* Can't send an IRQ if the link is down. */ + link_status = cdns_pcie_readl(&ep->pcie, CDNS_PCIE_LM_BASE); + if (!(link_status & 0x1)) + return -EINVAL; switch (type) { case PCI_EPC_IRQ_LEGACY: