From patchwork Wed Aug 15 13:48:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Douglas X-Patchwork-Id: 10566627 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 41E041515 for ; Wed, 15 Aug 2018 13:49:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30A1F2A581 for ; Wed, 15 Aug 2018 13:49:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 249042A591; Wed, 15 Aug 2018 13:49:07 +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 AD5312A581 for ; Wed, 15 Aug 2018 13:49:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729293AbeHOQlU (ORCPT ); Wed, 15 Aug 2018 12:41:20 -0400 Received: from mail-sn1nam02on0074.outbound.protection.outlook.com ([104.47.36.74]:11931 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729125AbeHOQlU (ORCPT ); Wed, 15 Aug 2018 12:41:20 -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=RODBcRzswngvqg98dUkhex/I/RL/gWvNaWehFvMZFE8=; b=Dqu2hz2Y0Z1pe0HAx8FIK3s1FRDet7Nwim57LKA1ETC8fmZq0AgPUyZRK05hkPnuL8ttiuK8Lsa3fh4XAJP9Q7I2tmnhktgf+/k2fkcWhuLGjDIshlpjWCPcqRD1bySRxn2oJGn14R5BZxP+KNWGEHgEv750X9LPYh7MG7MkeF4= Received: from DM5PR07CA0062.namprd07.prod.outlook.com (2603:10b6:4:ad::27) by SN1PR07MB2304.namprd07.prod.outlook.com (2a01:111:e400:7a45::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.25; Wed, 15 Aug 2018 13:48:47 +0000 Received: from CO1NAM05FT058.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::204) by DM5PR07CA0062.outlook.office365.com (2603:10b6:4:ad::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1038.22 via Frontend Transport; Wed, 15 Aug 2018 13:48:46 +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 CO1NAM05FT058.mail.protection.outlook.com (10.152.96.176) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1080.6 via Frontend Transport; Wed, 15 Aug 2018 13:48:46 +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 w7FDmiei002927 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 15 Aug 2018 06:48:45 -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; Wed, 15 Aug 2018 15:48:57 +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; Wed, 15 Aug 2018 15:48:57 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDmhSM023140; Wed, 15 Aug 2018 14:48:43 +0100 Received: (from adouglas@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id w7FDmhIr023139; Wed, 15 Aug 2018 14:48:43 +0100 From: Alan Douglas To: CC: , , , , , , Alan Douglas Subject: [PATCH v2 4/5] PCI: cadence: Check link is up before sending IRQ from EP Date: Wed, 15 Aug 2018 14:48:41 +0100 Message-ID: <1534340921-23032-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)(39860400002)(376002)(136003)(346002)(396003)(2980300002)(3190300001)(36092001)(189003)(199004)(186003)(51416003)(2906002)(478600001)(26826003)(54906003)(47776003)(87636003)(316002)(86362001)(426003)(6916009)(42186006)(105596002)(106466001)(336012)(16586007)(2351001)(126002)(305945005)(486006)(107886003)(476003)(48376002)(5660300001)(7636002)(356003)(246002)(50226002)(2616005)(26005)(50466002)(36756003)(4326008)(8676002)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR07MB2304;H:sjmaillnx1.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT058;1:onWLITU4c/G90K3o+RWbU5gO5mopoI0AdZFzYrKiALSTTpolj7t3Em1NDpiYWc/MmK02orqUMTqnjRSwUKG3qEzvNbOMGdaZBQ5lnUO1qkTZfXAXc25fgPQnEwN5ZaJ6 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57e4f30d-359b-4493-dcfa-08d602b5d292 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:SN1PR07MB2304; X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2304;3:DvZP/0s41IH+Ydg+iSixHCcWFRLJ+8E2XEdLk5+Q7Y6KAu3cHwZ87m032L4qYZRvyZrxg9HUfmjcDEk3Q7QkozM8gpLUkT0MWxjFmI1opMgeg5A1lEtJg8h1FDgPT/nH3X0G+8V4NEqieBolLY+z9L0c+EjpY86gdPNPkFywlETZs94WEaB5FVQhbuuvLfbSrHGBG78ovsDb5AHsoejdjvYVQG6o0uPeMvylsqU+iZNPiKHHKcfRzTy4Qj7AMWsb210LK/t5HKE6bv1+UyUQbSTlm3W1IIPWo/l4meQitFxJ5muZmEU/whJs/wNXiT3ARZ/qYdLVxlSb57m0P6F75SYOPIS+24CEqoO7OodppG8=;25:qptIX85nNbndhkA0b1yzpPSavngyYyZmk23jKaR2Z9xLGdhLeYeZOkjbfNLdNrZ5U88N51RxbsIswrjfLFexh5t08NPe8oLP/2lS8FDi3jFJClMqeixqFpgDLh5a2rg9MUUbBkbFABm+uV4vHu6qt+einbTHV7+1hZxqF2YX5IuDRvdC53bQWaI1z0e4eZQll+5le6DI6KomrI3hOqjojXwsrF8pr87O9THQHWxme/WO2HQxliPOCFpzVKCh9t3aXXQ533euivkvktvQE5Io6/XAoR8uqdd6aIrCSNWxoLzLTUQ+KKS1Ac7HqobUxovH0VifUSCr9Sil1M7k0SY3zA== X-MS-TrafficTypeDiagnostic: SN1PR07MB2304: X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2304;31:GHnrV+TzwcD3YeTnpyivUZrNpjn0gKyBG5PlVmhUY56IKdm98K2j7yfqKes58WXRtAeiL6cYmz9cKzC5ofxazyPfedfetg9V3JICQq2aXt8D0SwbWg/GHqqc+7HQwj1VfKZyIBRhHVNP/Ih30HMs8NlsQQDOALGxE8TYfiNY1txZE7UMS4D8+ZB3lkbz5aguMPRzHbXnhBJRmXS9v8CXDOVtpNVMRCuk8ymBbzWPlSY=;20:SOv81hmOlGV6qIjBV6knd0OTd5tmaKxQ6I0JPKQsziYW3y1tvcH88IdTtlwk18W59SkRJ/tOOpvKxwwSal+zupEB52SUdkWbGuUS3KdfunCj1bLNM6tg8U7WwMeuguJZQFWRtCH5QPaMEbDr17c1qUwqCzdLhmGv5ldWQ+hSygW5wKBZuq8t296CBbSchZXrc1OuXgW/INdZ6OCowzqbeR5adqvCkGWNQs0TCHhjxGpdvtpABA6fM+J1oJ9BieVf2LzBznCu+AIPxmPaZobq1ymrTzyxipu+FMxMvd2okvZpLdGjtMi/5Nt46YQ6s3mb5l+IDTlzaPUg/mhpTOCDu/t9xO++D0tbu97294kfhHThlgJFXvXVqhrEtiKhRAIC4GurLSc6INiwcvOlyGnoKITIwqpFohqIZJ0/uBzPFrjfPwpDfymiyxfIR0oZxS531TKZsLVazpoiYrlq+AAaF5Ke0JgP9vhlqI7PuZJB/qGE+UK/9RB6W7kWwa/Ddd3G 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93003095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:SN1PR07MB2304;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07MB2304; X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2304;4:/4/eYWYf6GeOXne6Djhm7XQMvlj2Ul4mIxiQo+ZJ9Za1yvpPeqw4wSjhYOB4foFw8BW7tKRYEUgsPnotkuy0U4PDrqY91zfKu98cmuk4nuVRZFy81ZM9R6J0NBn2KzqcVKTfr+lICpmCYtGx3AZG5iKZcnamQbyz7jKmfIgBzygeOo7dJuWQefmvwk3Pn+K+26WbCkRlFyi0pfXFuyO9S7+mYvolHnlQMmJJ8Kfg8Wn055+EUUhgT8cmhbabKWWhem5+3VhvcjJigmCAZapP+EdwuZ8xM2X8fIMscaMnsqadWhgp7zcEJbGHAORERjCK X-Forefront-PRVS: 07658B8EA3 X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2304;23:6TQcmVWApCTRIy+B7BIMJ9zAgvM3OG5FRHNRLJp0i3TqpdRZp6gDWsEK4Wp5Bq+8FxzfCokjjqSIwqF3FimvEIqW6xTUEwARtPE1nnwC9oXAgRwLjVpHNiAqMQ7VOyO5t0zGjwrF9oV1ln/uQ0gfwPBG5hfPXfI7+aLRtQ3zCWUFHRP9YgcmETYkeH5PtSloVRVqhNargAIoi0WR8Uli6ilnRsP7J+4EPT1zhkUTXbo5rCHcjfHNW7w/SK/fhTnjWVADc5ZyEEtWa3QHpNAPDQ0dHvaojN1IVzei0GmFGbm2ENlWQ/GbTxeRM0agWMtlzEmwSlWydAiD79WSLDyxMwutYwY+BSsa7FJL7wm5RVmzsNOu8YnSYjd1iPqSTtuxw8rGmnvXtd2VI/LtBYg1ix3VYHlqyPEWW3UiPna+KNK0P8S8wWiSlJxP7v65T0AVERQ90ILxenR8I28MsjmmDACJMTs8M7k8BtQ1UGLz1IBhCtb39MpiDV9xWitVPlGLN9bUH1zizHXNaqRj2yDCcU7NLL3ij3QHMcVJT0fystDHc2MTEVuoqM0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+4r19gmVkSAQUHtL121PdWyu4GCHEx/6kFxhHXtvRvsQrgWD X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2018 13:48:46.2336 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57e4f30d-359b-4493-dcfa-08d602b5d292 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: SN1PR07MB2304 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 Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller") Signed-off-by: Alan Douglas --- drivers/pci/controller/pcie-cadence-ep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index 56f6b87..1248d75 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, enum pci_epc_irq_type type, u8 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: