From patchwork Wed Aug 15 13:47:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Douglas X-Patchwork-Id: 10566621 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 4EB011390 for ; Wed, 15 Aug 2018 13:47:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F48328E45 for ; Wed, 15 Aug 2018 13:47:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3161B29D7B; Wed, 15 Aug 2018 13:47:33 +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 1527528E45 for ; Wed, 15 Aug 2018 13:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729377AbeHOQjp (ORCPT ); Wed, 15 Aug 2018 12:39:45 -0400 Received: from mail-sn1nam02on0054.outbound.protection.outlook.com ([104.47.36.54]:52838 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729363AbeHOQjp (ORCPT ); Wed, 15 Aug 2018 12:39:45 -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=D3w7YG2gBY0bseWBvgaRYE4kdaYSkAQQ6wTAp0tpd2o=; b=D15v53NVdjFWA4tef+DN8mli18h4ZN5Rt1odcWAJxIjnj4rROCpzVGcfI84nZ+QMcznV2OmNG7qfSbmgidPCSegsW38DRt8AIcJr1AZi+EFMe9tet+mQ7Degn3NiWwqkks5jj3YFDBs3tA+xYDyGMitF/9/2wvzfPc+lreQwXj8= Received: from DM5PR07CA0027.namprd07.prod.outlook.com (2603:10b6:3:16::13) by CY1PR0701MB1339.namprd07.prod.outlook.com (2a01:111:e400:4c1b::14) 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:47:24 +0000 Received: from BY2NAM05FT007.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::206) by DM5PR07CA0027.outlook.office365.com (2603:10b6:3:16::13) 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:47:23 +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 BY2NAM05FT007.mail.protection.outlook.com (10.152.100.144) 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:47:23 +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 w7FDlEHZ002786 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 15 Aug 2018 06:47:15 -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:47:27 +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:47:26 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDlDMl020741; Wed, 15 Aug 2018 14:47:13 +0100 Received: (from adouglas@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id w7FDlDot020730; Wed, 15 Aug 2018 14:47:13 +0100 From: Alan Douglas To: CC: , , , , , , Alan Douglas Subject: [PATCH v2 1/5] PCI: cadence: Use AXI region 0 to signal interrupts from EP Date: Wed, 15 Aug 2018 14:47:11 +0100 Message-ID: <1534340831-20634-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)(376002)(39860400002)(396003)(136003)(346002)(2980300002)(3190300001)(36092001)(189003)(199004)(186003)(476003)(14444005)(486006)(336012)(36756003)(2616005)(126002)(105596002)(2906002)(106466001)(2351001)(107886003)(26005)(47776003)(478600001)(87636003)(26826003)(5660300001)(16586007)(316002)(42186006)(6916009)(48376002)(305945005)(7636002)(426003)(51416003)(54906003)(86362001)(8676002)(246002)(356003)(8936002)(50226002)(4326008)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB1339;H:sjmaillnx1.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM05FT007;1:sAIfjzpUIDVLvet9puwLeF9/A1Gn0HBV/6/Lwyf8mA08sOv1UN5dNerwU3Dw7MjWuyH7Bpe6LtJRatEMLb7SrksuNLyjCVzgZQleaPo3CzqDwVDhCFpewgoUap/0txYx X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb05f0f8-c3af-441a-b59a-08d602b5a11d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060);SRVR:CY1PR0701MB1339; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1339;3:bpGL+ZoYL4t66qdeSSumuN0zpziCGwFpgxr3VipgbrMGHbm4MPw0QXx7EXqPzcWd01bTW3rAdTdhft98+K0uMvaloO8bnmMBETp2ML599FT1jjXdEekwPdijlGieibp9aC6uVw5PKOSSiPnpO9UwnGPVIoGii/GPDwevLdnfDi7iJvxhfOGPY2o76WQm4c9RP2ucNBOaIqHiMFPQd0m0x27hrb9XltTYot8GKwJLi3YS+xSTvq4pHCfiBhrZ/BiKqPMjmVvKC+vyjueWJ+3qSF1k2/3naY4k4e+sWK0XNRD7t3MGgSYQLbcCDogj3Ckfagc5toPaYftrC1HkxUWr8524xbW61GOrmns8ehQnXJQ=;25:X9SA9b7MX/BkvovLr2d9SzV/m+oJ7nd5GJDEsb4T48V85GQ/NTGAMFNDouRi6iWbX4QplfsHm8ttQLRwvIo0WONS4+nJeaUJ5MebRM0QL7myzBqnboyM7XGJtB6rKgswdmjeoPmudm6tGAjeVYc+wjgja3dg2JXIGQux+WV2tFiZsvXgq7BNsbs5QgquFT1V872/43+y0Z48YF7gomw7crwMLIWk2k0ntnQQhxdxZKBBbTkNUu5TS8JJCKeaXs7qkcWdCmBofZHI3/drIUxWEQjdUfUxc71PIQcfATqgWfVz+Qj4NtO3tWMunK1m1A7vA/jlwYpQQ9GcgKj2SBjaIw== X-MS-TrafficTypeDiagnostic: CY1PR0701MB1339: X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1339;31:pRPU9+X6nNvAkQmbVFn4QC7wY31FI2DsofAY+zZq/QknXPRv3mNNA2+DCCzcRSMr8QP6qMeAONxxU0WqfO1vTep5DEuf47RKptTx0JH20QADwjpyxWvEdSdl6W85zQLe8a+Ru4p0ABSwA5CdvlxTFniVFTtZClG5OZZ0RNz9BxEDT8tzElkOQGks35Y+i3PVH4yWDprxYSGBHUZeSugPPUdwZRC3zsjisMdbatsN6g0=;20:v6pmiOA0hDHwpfX3uolQQaYEyxfef0F8XqfHS2NF1TGwvtrnWfN647sZgq/vVAm1eF3qfyQQ403ckhcenwLs1KGBherYL1i5VLaJ5r/eY1JKzZ1siNw653Nl4t3U7LCaJBQrLDWMTQvbVAmsdfxiDzzurv+pCwzvhsC0/t55knbqhAWS7YcvuUMT0EC88XesKMzoog2bgr97dI3qHA40JrYckbRVJICsVutteIo4D/IerqY3U0epgP7XqNPX7Pa4R57IXoSARVkAoEXuGNxQl5nzWdfAVb2ORi+70PMDcjA+oeVD/1OOjY4GQv4JVNa2aCBK9mLK1owOe5A7/O0MeDIf+vBkgJlYK4WBdI4irOPel26NF3GMibCF8FgsQcn6pE/uP3ES/1Z6HN9vaD2y6engHvOt2Z748cU9h4nmmB5CDEht5K3eSNflOsaX3Urm4Y176FVVNdPazWZIH4hljp5MkNhoahpiVW55tpYcsSFIy5sjsIeGXtJmOGgylM4I 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)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93003095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:CY1PR0701MB1339;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB1339; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1339;4:7XTiiAJN//lYnuHnN/o3QsVdZenT/urFTBBCNrZyf55TOyCaiZtCAFmhatDs5iuI4CWVNGHro+ORLTmwZfc+KaZflORRsz/k0xPNhLCyoykoNQsHuDTr18ULkj/ZvZEcqhhBci+j2pqaASJV/PlUgVOWrd+hFBpvRIGdcecyfgFWpMOrRU3UcPdf02nJmo2z6QZHmhR4yM81QYGKmnxxfYvwKQ0AauVmKFW/+YsJbDN0ukz4Z2XGK6lv/OHajmXUAeGOYTi1f71HzcTJ/0VLRNAGtAUv7Wo4UqN74CellM3A3hxxX2nwPpDnUdlcvAVB X-Forefront-PRVS: 07658B8EA3 X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1339;23:fRcs8UbHcA5sLleLvX9a326J1X5wkkqSNvkx4JNUvUnznGqWIQ8dN//6QptbS+E0voeUfGgZkH/PddswKyYkoaFEmFb78GLgvBSLye7HC2tbVqAYULkzqrQc6DqTRHDKGhEREU2EUKrm1TeOs9pi1cthRjJ54ktpYzEurXEBggLuHXE3TUkytOo9saKJHQt9Y4ek+KMT8cJAE/hgELZJ6fkcYVMuNkuPqzQ0atUf/GRcZ0Rt6rMf12QYm583R+H95pwi0ts8XtTAcgwj5o088HD9N1+TTAfyUs2JaVMpdz4eUibuiv8kW2ENgNlwupjHTUco8YQI7OMHWjpbud40McRKnLr6jy3TOeNWIuwA+N53jVyCbOCtJ9FrWqMvFXMqrNQKPDuL70VvynT2v9Rhfgy5fc80KdfcgcNGUkf1SskNMPQ+SdnymIPZE8JVz7i8RrFn4QiDfKCmkNIPgNOE8cF8dWFhZJWztJCLwRZQEAsbBFOIckYFPBVW8gP4VbhP1a+IghukyzRvUSWMeKSnvdeeb5oKPNOpUQ1ozway9dC0v4rTtvI4pZ0byBLlZCl21iBelmahjx79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CvrYBToB6QfFVJKt82Repoh4bxyyWSjzM7t5KVeSoEZ1q/iEoz X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2018 13:47:23.4420 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb05f0f8-c3af-441a-b59a-08d602b5a11d 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: CY1PR0701MB1339 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 The IRQ physical address is allocated from region 0, rather than the highest region. Update the driver to reserve this region in the bitmap, and to use region 0 for all types of interrupt. This corrects a problem which prevents the interrupt being signalled correctly if using the first address in the AXI region, since an offset of zero will always be mapped to region 0. Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller") Signed-off-by: Alan Douglas --- drivers/pci/controller/pcie-cadence-ep.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index e3fe412..a67dc91 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c @@ -259,7 +259,6 @@ static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn, u8 intx, bool is_asserted) { struct cdns_pcie *pcie = &ep->pcie; - u32 r = ep->max_regions - 1; u32 offset; u16 status; u8 msg_code; @@ -269,8 +268,8 @@ static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn, /* Set the outbound region if needed. */ if (unlikely(ep->irq_pci_addr != CDNS_PCIE_EP_IRQ_PCI_ADDR_LEGACY || ep->irq_pci_fn != fn)) { - /* Last region was reserved for IRQ writes. */ - cdns_pcie_set_outbound_region_for_normal_msg(pcie, fn, r, + /* First region was reserved for IRQ writes. */ + cdns_pcie_set_outbound_region_for_normal_msg(pcie, fn, 0, ep->irq_phys_addr); ep->irq_pci_addr = CDNS_PCIE_EP_IRQ_PCI_ADDR_LEGACY; ep->irq_pci_fn = fn; @@ -348,8 +347,8 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn, /* Set the outbound region if needed. */ if (unlikely(ep->irq_pci_addr != (pci_addr & ~pci_addr_mask) || ep->irq_pci_fn != fn)) { - /* Last region was reserved for IRQ writes. */ - cdns_pcie_set_outbound_region(pcie, fn, ep->max_regions - 1, + /* First region was reserved for IRQ writes. */ + cdns_pcie_set_outbound_region(pcie, fn, 0, false, ep->irq_phys_addr, pci_addr & ~pci_addr_mask, @@ -510,6 +509,8 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev) goto free_epc_mem; } ep->irq_pci_addr = CDNS_PCIE_EP_IRQ_PCI_ADDR_NONE; + /* Reserve region 0 for IRQs */ + set_bit(0, &ep->ob_region_map); return 0; From patchwork Wed Aug 15 13:47:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Douglas X-Patchwork-Id: 10566623 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 788211390 for ; Wed, 15 Aug 2018 13:47:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 679A528E45 for ; Wed, 15 Aug 2018 13:47:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BDD729D7B; Wed, 15 Aug 2018 13:47:44 +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 F218028E45 for ; Wed, 15 Aug 2018 13:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729381AbeHOQj5 (ORCPT ); Wed, 15 Aug 2018 12:39:57 -0400 Received: from mail-bn3nam01on0060.outbound.protection.outlook.com ([104.47.33.60]:14400 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729363AbeHOQj5 (ORCPT ); Wed, 15 Aug 2018 12:39:57 -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=kcWCffm62qcV9t78gr7YinoBmsqYOWmSzIJTeCfC1Ms=; b=jt6E8w/9nUUoeHGRx9e79J2marbS9Ke1j/vsa88h1loyf/SO13qFPMwGJo4Of+X+3/eKg4KVainflV1Z+E+Zj2WEO9QzE6zMTkmIHgP0wc3Sqp4fHYBbR6UfCkuFJh43xgvvMoZ3DD3vBXh+eNn56nNDonfHUcn0bw/4BAV3dmA= Received: from DM5PR07CA0072.namprd07.prod.outlook.com (2603:10b6:4:ad::37) by BN3PR0701MB1330.namprd07.prod.outlook.com (2a01:111:e400:4019::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.22; Wed, 15 Aug 2018 13:47:39 +0000 Received: from CO1NAM05FT057.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::206) by DM5PR07CA0072.outlook.office365.com (2603:10b6:4:ad::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1059.19 via Frontend Transport; Wed, 15 Aug 2018 13:47:39 +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 sjmaillnx2.cadence.com (158.140.1.28) by CO1NAM05FT057.mail.protection.outlook.com (10.152.96.174) 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:47:39 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by sjmaillnx2.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDlYVT021118 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 15 Aug 2018 06:47:36 -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:47:46 +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:47:46 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDlXDK021186; Wed, 15 Aug 2018 14:47:33 +0100 Received: (from adouglas@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id w7FDlWpq021182; Wed, 15 Aug 2018 14:47:32 +0100 From: Alan Douglas To: CC: , , , , , , Alan Douglas Subject: [PATCH v2 2/5] PCI: cadence: Write MSI data with 32bits Date: Wed, 15 Aug 2018 14:47:31 +0100 Message-ID: <1534340851-21091-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)(979002)(136003)(346002)(376002)(39860400002)(396003)(2980300002)(3190300001)(189003)(199004)(36092001)(356003)(186003)(336012)(4326008)(6916009)(5660300001)(2906002)(486006)(26005)(476003)(2616005)(426003)(126002)(50466002)(246002)(305945005)(107886003)(7636002)(48376002)(8676002)(47776003)(105596002)(2351001)(106466001)(51416003)(86362001)(87636003)(26826003)(50226002)(42186006)(8936002)(316002)(54906003)(478600001)(14444005)(16586007)(36756003)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR0701MB1330;H:sjmaillnx2.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT057;1:1Zs2EFJ0851+kbISQzxe5HnGguW1dApk2HSOvIUl3TAadDiOryY6TalIP7Q9cK41z9uhO1kFP77VMsC1y0/5TO6D84CDy+cd3QltADnurxVIGRepC1Uv4BX+yLO8M8GS X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0237cb99-6b59-4484-4b1b-08d602b5aa96 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060);SRVR:BN3PR0701MB1330; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1330;3:6R5g6nh0g5NxVuugqhWBtHzRN0pjd0zKqeIsKfhAoJoZAMCWETVIFdcg2Ed+KdQatCS3H2rqCLnEZwcmH5L78DwPsF/25qEE96U5UL4B6zJ6m9DIUpc0udJ63ySPdI3urPrZzzEK1fXGWSFsH7j+wDdfc4vGu10Geb4MkAItWhNOSA6teFu90YGOv+GckPnpcYbbplK8MV6y2qkcftiIG5xkwMi2RErY5ntyeck9SkbxS48fu035dPwlsWH2aIHV8HmCiFOZBTDE6irSTL03htDIDJ/AJiJS0o49wGSPsLG19+AJXFbZPnIUOBP+h7bkGD3TTRu4UCxlqSdDcO4cVnpjPkyxP/cjD9QCjVp6Sdc=;25:jw8m46TssTWQ5vkYeCH9LPoneYCQukG+WPVPWKK1+R/jtovTQpuP0DCyP/mo5ncD/pI7vRPoXYqo/Qfj1nmbqlIG8cxqCOTQM/8fXILMTgmFYaTtISHGp5zlc1NaRRRuZekXMlYbs4awNcTQfIOTFrRoGKYLkRvu3m5/z8mv5y1GvjLIeBH8AEwjEOgIb6DbWXJIb86a4w3NO2j8frTrak6zN6i8d0Pssjg6NxObssPSWKpAwiyNEweYVJba1NZMkKSB0Nq6YRuGFyx43ncScE61Yi8/sXUzou1F9sLjE6BfKnh0qJRHNUaE1wl+jxqIqTsyA6ptOIR3jVks0y3lEQ== X-MS-TrafficTypeDiagnostic: BN3PR0701MB1330: X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1330;31:FxMFsRwNZLgeueEGGy/XM19lSVRYyo5O8syf+nqHWTV1aleSkKY/YAHBctivjHEpYeMin4CZutEhn714wibUOdqwd5H4agbxQcT/0VH6LGm38/Xr8V5WAUAzwt5dM8DKuAXx+nnI87Dy+bncE0dWM41L5LvO/uw951fpBU+sXDeXjNqz0Xk0asVMVWFhNqx4mkPlQEx5pAgLUfZk28nDOTg/3v6Y7VRR/etOAu9hxgU=;20:xyPOJZwVTnvocozxcNRmRM9EXL/Ge3ixjuo5zHwXRzYYrJ3jUdx70b+aQJDVJt3E/c5KkpyTQMtsjRgeGDeygwidB+YInVi3hN3Kis05/7D6sIdvq5qNVx0VEnIOjx8W4W/f4Znn2mg7plIBI2d5vY0/a0Jjl85KCc2KcpAYFsSMKtfWfU1KnXPyd4Y8sWpfc/fSWss7ChwmO4ibz1Ttal4/ji+X+SmakF9rwk2pNZZkK8ebfyWtP8GBRYM9/yee8nLPe99LWHPN8ujLKnc1n9qfHWA3lgGwSWOXcWiYHMhXUN7I7iyyUwLNDY4rpYhVW4s6Ehc+eUzfGQMNCLmOYYYlpjU5LPiIYAEVREEZFffOeO3X/knBtT1g1zXW3Wlk4AEgBRW6cpvRva7ns6cIQv9vlH/9Y6HWs8y8jB5l///cAWP8oK7x5xvDCjMmMgcshgdvZfpuoDas+1hI7sN873q9C7kD+JDvtPDoRenYAQZl4XLcV2szV5yVnsU2QgwR 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)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:BN3PR0701MB1330;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1330; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1330;4:eCIb7lCBjE+ShVGyzfUIB9bUnLDRqYtWeLipXYckLyRgZJzBDhPQAzJfNGKb/UTvlf6gZBdc51FwMt8+lNVEd1NwxUXL/USZW+rCN7+GW5Lh4Lwokgc5cR17XvZwCeMnFs27SXKWRDWa6F9/J2yWeVy+/5AdEk5ZqY5h0VxUn9k/1SbwnKJ6DExdz4sCibL7A7qVbpBd3D4mA6xAYYmbANV8t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YSeHnLO0NR6Swa0tInV9B3sXS92BlehQqte55MshF7an+fmzzjqIHlIyiwF9vJX4ScAAECYiAs4EVrVTEEdjeK9CqeHCzQ4jJ0qbt6NRGDIFXh0vp32QNWNDjG5aVJi05zJyTAInQ==;5:vtiBFhIwBt5rRKAgtV2ETQipXZu9K/uzecDjx9wzj7aKNW3NcqDseRgSmp01Pvmqb1iffldo1zMZBX+dGQlUM+Uuo6WIleeUurpXOqMwM2S4ovRhtPKFhghVol0cxJK4STqCT755CRop+n/O0WfG85KgrM4xpSs6lKy38GpMAoI=;7:NtRT3JjSZppbJOwZPdN0c+E4x1oQjcswIpNXVCSbSwPDVv+jF84UHyz00PcqzaxMUr0MkINdDeViXi6+o2QRGZpLjoAV+fZ8x2qwRhqzziHTmz17r/70sXkWqCpjRQl0UWAYUVUQruV/4UFVgDW2VfrXFNt94I6OM3R88zb/MraUtwDuQ3DjsGIRfuM/NIHUjaZTV/dXrc7JZiW9A7B+sFel8bxm0nxwAWgMTw7A3Eyug6MbJoqYzu+LNwM5qMlA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1330;20:0FvZOajxf+VOGe3luodhVbgODWZBfkxIXZhF4d/yemlAt+ItDL53OesTBHeJZLWzLIKxNABjR5jpEQwhNldDzhJRjRX0AHb8nvpJI86/XNkm4+im6Tib4bwhle6deJbRoWK6X7qb9thVzRv6af7M5lJgUAexFlobG8lf5Em+b95/nN68gCJqckeLKoA67EW3Hw73VVoxH9+orSZrbubUKtZhFuQkazSK+uu8A8VF1hrSMzX3BW2SgZ/YR+cHhH1R X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2018 13:47:39.1785 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0237cb99-6b59-4484-4b1b-08d602b5aa96 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=[sjmaillnx2.cadence.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1330 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 According to the PCIe specification, although the MSI data is only 16bits, the upper 16bits should be written as 0. Use writel instead of writew when writing the MSI data to the host. Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller") Signed-off-by: Alan Douglas --- drivers/pci/controller/pcie-cadence-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index a67dc91..970d934 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c @@ -356,7 +356,7 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn, ep->irq_pci_addr = (pci_addr & ~pci_addr_mask); ep->irq_pci_fn = fn; } - writew(data, ep->irq_cpu_addr + (pci_addr & pci_addr_mask)); + writel(data, ep->irq_cpu_addr + (pci_addr & pci_addr_mask)); return 0; } From patchwork Wed Aug 15 13:47:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Douglas X-Patchwork-Id: 10566631 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 2512D1515 for ; Wed, 15 Aug 2018 13:50:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 100022A6EF for ; Wed, 15 Aug 2018 13:50:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DA622A740; Wed, 15 Aug 2018 13:50:56 +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 700902A727 for ; Wed, 15 Aug 2018 13:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729300AbeHOQnJ (ORCPT ); Wed, 15 Aug 2018 12:43:09 -0400 Received: from mail-sn1nam01on0087.outbound.protection.outlook.com ([104.47.32.87]:12480 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729312AbeHOQnJ (ORCPT ); Wed, 15 Aug 2018 12:43:09 -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=1VA97M2tW+9R4wPxaeZH8P9Czi5y3nXH9PL03NLb4Qc=; b=SI9rpbuUi1ZHcbFMAGLcn1Ipbof6KRhQXo08nr+uKMbWdjTWoq6aomSprUfDXsYTnLUIcfMoiDuMUdaji5aqgQwreXqb0Zwd9A9emEgr6ME2WYQgilGXlbC4pQHYZ6TrOZDBoDtO0PNZpMQZMuWhZjxaBO1xpPUjbbsBQRhf5z4= Received: from BYAPR07CA0043.namprd07.prod.outlook.com (2603:10b6:a03:60::20) by BN7PR07MB4705.namprd07.prod.outlook.com (2603:10b6:406:f1::32) 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:47:57 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::202) by BYAPR07CA0043.outlook.office365.com (2603:10b6:a03:60::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1059.19 via Frontend Transport; Wed, 15 Aug 2018 13:47:57 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) 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:47:56 +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 w7FDlslc002845 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 15 Aug 2018 06:47:55 -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:07 +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:06 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDlrQP021670; Wed, 15 Aug 2018 14:47:53 +0100 Received: (from adouglas@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id w7FDlrLS021656; Wed, 15 Aug 2018 14:47:53 +0100 From: Alan Douglas To: CC: , , , , , , Alan Douglas Subject: [PATCH v2 3/5] PCI: cadence: Check whether MSI is masked before sending it Date: Wed, 15 Aug 2018 14:47:47 +0100 Message-ID: <1534340867-21491-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)(136003)(346002)(376002)(396003)(2980300002)(3190300001)(189003)(199004)(36092001)(107886003)(4326008)(42186006)(16586007)(246002)(316002)(54906003)(356003)(486006)(7636002)(51416003)(48376002)(50466002)(36756003)(305945005)(426003)(2616005)(476003)(126002)(86362001)(2351001)(8936002)(478600001)(26005)(5660300001)(47776003)(186003)(106466001)(2906002)(6666003)(105596002)(50226002)(26826003)(8676002)(87636003)(6916009)(336012);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4705;H:sjmaillnx1.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM05FT017;1:cI1tJo+MMlF/VVehxZiesSKMeWtrFPY7XkRlFR5cF9h1mcIDoNrPyEjdKJlHalnX2efqUPIqO3Udq7tc8pRMi4QodnTQ1YNSI5A8WSpoTBwwacwBM9KGnVuhkEHMg8Sm X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 919d5b11-28a9-40a4-b107-08d602b5b545 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060);SRVR:BN7PR07MB4705; X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4705;3:lM2o1tRqrC442jwLNOM1lakq/EST48F295fHwURul5NxXXWiFnhX6DNmwO6zDBZu25zKJIKg76aDKkAKaIzoti1/d1mXVXuOgAApCIl4sy+72DqZJ21FkyMzFBGdN7RFp6l5tq+DJ1ANE5yeFlgmgHjJJ2gp5nQSVtoGnVvYeHspb+h2Zf1NTpDDHDAr4AP5Lx9Y3LS2YQitCLms/j3YVXV9C8ko356CuR0/mHNgRbG0HZoOZEjbxkfPZopj5sCeufzwtcZng9aOkF6FZ0z+PpfK33nQJ0aoMtU2MjSmZDfV+94UUhfzY6NtPnFTbEWu5adeEETYnNrw3i7U6jUlTgVLkXdmfC2jou/mvpQBn3M=;25:GBULeSpuIaul9L02lwvmz67xmk9zzdXGNtYA2XfEdu3WnbCtxKT9/51z/BtU7nIpD0SCdQ85WNk9KtUROPWxT+jKqsztHTHgleshmf0HgXjA6/iksswM6pzBKKDLYo4kl98lJYtERLP2DQd3VA+/u/VbINTWxFCftOV3prsMcioQ9Pib66U40nzWSfv/lR6gF6LeU/J6lbCyXxwoteC1ZdlegCU9F4inUy92z4jh96bh48H6P5XpeuS0HTRa4+tdMB84fg+3THjGRHbYQnzO9dt7hRIV2Bhs7JzpiyMmoUIbO+bMvTR6tUOjPbTWsJ3myEYC9LT4ExVnWndzdKrTrA== X-MS-TrafficTypeDiagnostic: BN7PR07MB4705: X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4705;31:CEPaBjpbbgNA2UwjnuK7JpiSBYr5boVdn0KUSWOTLW4HEq5OkZmerpKbM5/+9TcKyFJqgKFXu32bgBqo0AmJb5gI0QC6blH2BK/NQZWjU5ZKt5q54cj3wbEwK3ee79DZ7MpJYEEyx/IsWhjRphYiYEQp2FuB3TQf68QJUReAg1D4NzqXr4B2+DrSz1it0Vzas/t+y8v4L9ct62LKBxNOiN1SjXiJOXsqFDmBe+S9KHI=;20:YFAue85AZEwLTosWqf+vvNuktEvnmILJ1gNnyFG1TL1o6lLVYqDGgfSwHwUImRm7i4LCYdTr/L9PDsCqDR0TXAct5v+rnAmsZs8HM8G7KOI/bvgwM8bIqdJ4fxf0p7tXuEW2nqflLmTj4r/sWwisgtyfRaA7QG/3QT9s2rs/jk6yz4178+Ns6JIPH2h/T5Qj+8DgiW4hIUCfv/Dx0hs0A8tHbD/SzTcFXfvjSPIIbUl7amXPSEoTFrKOYPqJImzbDZUEgiKF6FVqqGg+bZqsU2josFwWNj+sv+8LDzG6Q3PuwzAldD+XL1gtowed2roEwIjOnrgIfH6tVsPlH9ToSvT07bd3KGDU0GNaFe3Lp0UtKIFaA3iIGgSV3pu/rnp59ORWL2x1JHmW0feZQwsR6ZMe4oMm0/FN42QQwoco3353WxUXgdZ2mHMRF4G7n7UbDTOGSuJlr5O+oKZpdVBxbHUqkJKiHDFuzInVpqOpghtYRvZnkIaXzrDfLdIMq4/n 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:BN7PR07MB4705;BCL:0;PCL:0;RULEID:;SRVR:BN7PR07MB4705; X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4705;4:v7/Ack0bGAL2GFALRsNMIflnHejhkI8VkgpRaOz/eNDFyQhejfmHJin93dMiU27kmXprFdX2axlP/OrDITxq+XGpm/PDmnaeVJ4qrHDVG04MH6GCg1qm9fSExsfpyGBMG9t7D9QQ37QZoihmZ1Im8rlA4g9ir56YFBjm/d9reQX/nMIxVvV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Fjs7AjacRNjGf65vpbCOP60ugqFl23CjqoseQw01PBMdRHeCrEA==;5:ZgQynHJMZL5QrQ3zk2945lOr+OVVOVwEM1VoK8STp67qw5TjR/QPAkunGkgJLq0N+oNSvHI14R2PJf3YzHHIqAfDGgvlq4ju0RZnLAkan2QPHZKRwzL1x1rRO4ZRNEaJ9d2zlWs5h/SzfighLu+FBo4h6O8F+jeQGtHCucXvKrY=;7:onCrHicekJbY0/ejR7KjLByoF1KU9lN4yhzLRdepAGm2I0qBJSm9DSjf7I4bNaDGcF95aSy2y3L0XQ/8mVYne/dJXZO82FXhK/Dkjbqp39nJ90TiDmLgaQIKwm5Hm80ReXPD293jEbN9SvnCQFoxHA5PkI4DWMXBufx9t7DNQ706BLuk7mGxIW0Np+gqglf0n7TQXc91bGPh0mf05ORGItgQDkZOo6GBcFdrIw0J+MagqlLr3A9GWPpI0GqYPV+g SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4705;20:XcoYdifVT/0GPsCadiH82vkTHrpFkpAMWzKQgICWn1EIE3exmSES25ZMXWV7U5HjGDdn7YtyLPeaW8p1s2dDA+8dm1AChpv5A/caTrUBu5Tx0TATfijA0A6faGsBH4Xik8YGqD7FdJal+/p6yRlCZm5KhB0RaFj0cASV/TVfh9zbPdNRaDvWblPlIrqzLLCxJcKT5Krf1o7cZhpr/tZ6iRrJJ7y8iSkmDnHrDOI22YHRU5aVODJCW8JIn1hC+MFm X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2018 13:47:56.9645 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 919d5b11-28a9-40a4-b107-08d602b5b545 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: BN7PR07MB4705 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 The EP driver did not check the mask bit for each MSI before sending it in raise_irq. This is now checked, and -EINVAL is returned if masked. Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller") Signed-off-by: Alan Douglas --- drivers/pci/controller/pcie-cadence-ep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index 970d934..56f6b87 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c @@ -333,6 +333,11 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn, if (!interrupt_num || interrupt_num > msi_count) return -EINVAL; + /* Check whether MSI is masked */ + data = cdns_pcie_ep_fn_readw(pcie, fn, cap + PCI_MSI_MASK_64); + if (data & (1 << (interrupt_num - 1))) + return -EINVAL; + /* Compute the data value to be written. */ data_mask = msi_count - 1; data = cdns_pcie_ep_fn_readw(pcie, fn, cap + PCI_MSI_DATA_64); 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+mYv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aHlAqooj0iKxg==;5:Zl9t6bQdF/mMnfIUv41fjtBk5muoTRzby4u9Z5MVaLSHBvl+kDdUObn+391TTpzuZ8P0xGkkUc8xlwrXpPDuzGuhSRWBAvF+PY6hN9QINjbMLw6sfeDpAjiPQv9qa1S2u0vhwcqLhpwUWn5s7pB072fiBxDrJ1Omiuax1BbF/c4=;7:DKLebYHalYfkKFh7xa+UQ2W1AhR6TeihovCY/E5+N/misKOEqbHQIrvQadn1zk1Rft0Rnghu+h5a+TjrTDx3NcdwpmkXzDaxD1m8sDIVw2Yv2Whl6QJgUCpX7nU7q9rpehlBQsaDy+eCl1SO+GKvOCkqZZZW0LNS7j1uaU7WUSyUZN1UE5SzReiCcDz8SMb6CLXGna7iVfNoFKkNo2p1tAgtohDtmzz+5QoZc8B/gWODJE9x7n81GmmBze8zmOf0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2304;20:TmWRMx9yACStu97XS5atj5zt1w3uth4jDw7zXSnWQLLx0Zte3UQlgC7Kv0fi1VDKv1PlEJ3CgC07qNo3MFvKGumUW68R3NbDolzpM4rzGRLRR4O5CqU7WyYEyu2J6uMXb+HHclFTJkiqPkDd9rZZ0TV/ONBYhAMnS5PIXQY6MKa8sn6expTQgKBY9ygLNQ/9GCP9bQ0W3zjwrZpC+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: From patchwork Wed Aug 15 13:49:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Douglas X-Patchwork-Id: 10566645 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 24B7C13B6 for ; Wed, 15 Aug 2018 14:07:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13C441FFFE for ; Wed, 15 Aug 2018 14:07:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 077C3285D6; Wed, 15 Aug 2018 14:07:25 +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 54E2B1FFFE for ; Wed, 15 Aug 2018 14:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729047AbeHOQ7l (ORCPT ); Wed, 15 Aug 2018 12:59:41 -0400 Received: from mail-eopbgr700059.outbound.protection.outlook.com ([40.107.70.59]:27264 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729125AbeHOQ7l (ORCPT ); Wed, 15 Aug 2018 12:59:41 -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=w59MpjsJcq4pQZylcUgEew4rfizrfxmgd/j3zX/PezU=; b=BR4KKF+T4uvdsKs7lOPzfqhUPLptmE4yeIV19WGVILHHcLpwqExSj+AZIe9IQ95LTFv8CW7joGUNgVSeYYvwIFARkbGsQFsGr+LgWJKcyx5BipbF6cVEhO2wRK2Msgv0mBsJDTzvyRKbDyWcvE+DzQMTO87FWrHWYtwj6NBfVWo= Received: from CO2PR07CA0055.namprd07.prod.outlook.com (2603:10b6:100::23) by BL2PR07MB2289.namprd07.prod.outlook.com (2a01:111:e400:c752::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Wed, 15 Aug 2018 13:49:14 +0000 Received: from BY2NAM05FT026.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by CO2PR07CA0055.outlook.office365.com (2603:10b6:100::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1059.19 via Frontend Transport; Wed, 15 Aug 2018 13:49:13 +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 sjmaillnx2.cadence.com (158.140.1.28) by BY2NAM05FT026.mail.protection.outlook.com (10.152.100.163) 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:49:13 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by sjmaillnx2.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDnBLf021269 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 15 Aug 2018 06:49:12 -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:49:24 +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:49:23 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id w7FDnAgP024205; Wed, 15 Aug 2018 14:49:10 +0100 Received: (from adouglas@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id w7FDnAWA024193; Wed, 15 Aug 2018 14:49:10 +0100 From: Alan Douglas To: CC: , , , , , , Alan Douglas Subject: [PATCH v2 5/5] PCI: cadence: Add MSI-X capability to EP driver Date: Wed, 15 Aug 2018 14:49:08 +0100 Message-ID: <1534340948-24093-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)(376002)(346002)(396003)(136003)(39860400002)(2980300002)(3190300001)(36092001)(189003)(199004)(16586007)(5660300001)(8676002)(305945005)(426003)(36756003)(14444005)(42186006)(316002)(8936002)(476003)(2616005)(54906003)(107886003)(47776003)(7636002)(50226002)(86362001)(246002)(106466001)(478600001)(50466002)(126002)(356003)(2351001)(4326008)(51416003)(26826003)(486006)(186003)(26005)(87636003)(2906002)(336012)(6916009)(105596002)(48376002);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR07MB2289;H:sjmaillnx2.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM05FT026;1:RIZovJmmPfD26QNVqHHx7UmX2Jx05dHBlpVjQ9C2bnwtjy03Yr0ALhdZrVyYcTQeK8wtCb06wR4OYUYNQyxoo9NBZC0lxnsuaPqFNqtxpxwVhvPeE6zDToNh7lULOiTT X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57b75223-5b67-4816-5122-08d602b5e2ab X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060);SRVR:BL2PR07MB2289; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2289;3:g6SDC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W8Itv+PiwRDRqUzQ7JZOg8CGwZzj47gbCTT2Iap4EpVJhNC7gN2mBNG5cRxQ/s7JJrrWu5HI/y/gqNnvhUSzUcU4H+PrMncHDJmf0ZmeCCwSj/yhyceoa2QqqjMSWPgJ0HX9XRXEXFxKcMqHuO/JLmb7bsJlWN1bG9UMID9tTOSd33tYiAYfvdryUSl950bo8KLTa2WJE+qQGZr53r+U0wbD/ucu1T7m0EJ8YKSyXdP6dphsJKMSN4fi48+ucziyrqz2nTL7x5D1txZtOIaS3IVSIoN9ZLdj7QN9iJW9SzXt9jnbs+SdQjiHdL3+DEeFI246lACJqRB15iXPPiBVqf1lySQ64Bx7NK86w1eFxfjd6cKvY+FidnM6CKUJZdbZP93oiNRB/VP8LHY/dQXFptMH0q4GY919SnwbTgD5RIz2Jc6DMjEaGE4UX4FcnKyEDaXeZ 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)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:BL2PR07MB2289;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2289; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2289;4:Q3SUl5swyv7PuMHTW14UTlr043FlJVPtsRwjmMSrJJ97H98UZ+oyFgL+YlwVP8x9fY1X0cYk+K5JVtxqcc5OqPEJCu1pjwKCc7WZyE7qxedUBbmgHY77UZy6Pq96Nf8Ul33jp21I1U9M+3YHwUEdJjrOIRPg2dFtB8cECcV26YmPlC3EjXQl9sjyqeJor/TanZdJWgLm/1NLNx5zExz0dnnQKZyVyow6yL6EtBlGCK4WJiJ9w22yOVB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jNaBEN9M5r3l3ny/xLdUeQtdE/87R1fIZpFqrAB0edzsh0zebFLASn4A2Us0WRzYT2U5jgrhyY5vTk8bEfMmTmR/y/Ugakit6eCF2RRP2up+ZAlJZnlUW1nmfZtHWA4IytPrkfPc4cB5wIP+gAlVqr0Im7nFU=;7:cMUu+s6xidW6i+9a7cq25OvIK7oVndblB4+wM5pmXoMRgD3GR02zqY1azFGT+DYhV5ffaQSPU4e5O+Q+CTAB/486I+nTJ/3vUfuuN6KWnVSGk1aBgpByh/BwAJ3QZlz5w+kP+5jlErYfZYbfIGP7g0I8o+JIUqA6RG5koMvbfuMv4jC5a3AqygC7xjdW7P0eNqMjU9y2T/co6MwrEIdJ0w6cx0mSC7JlLhsIamN6IjIQvrmyr+HSMHamAewvmSvB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2289;20:Me2xeb9GMIIx3pD+J1L0VkvRz3mt/SygJEQg5jFshM5n+VeHZaqh91NHkerNG2eIaOTcX2bCyLtqRXJJUX4t8Ia9alG2TLiwBU9q4sPLqUHF8cnWNQ4gEjsozua7uJdmXkweM7BbeS//hH9fbe2DNbPVDpoGoA/XZxt/Dlnlx0XCLYQUvIe/ro1L2ZZq6VudXJAMmhrJ73bwpZFtlx92958hNOVDG5wRx880Cjl57qzk+w1pG6acd39ROT9JyKvk X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2018 13:49:13.4093 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57b75223-5b67-4816-5122-08d602b5e2ab 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=[sjmaillnx2.cadence.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2289 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 Add set_msix and get_msix functions to driver, and handle PCI_EPC_IRQ_MSIX request in raise_irq. BAR5 is used for the MSI-X vectors. Signed-off-by: Alan Douglas --- drivers/pci/controller/pcie-cadence-ep.c | 107 ++++++++++++++++++++++++++++++- drivers/pci/controller/pcie-cadence.h | 1 + 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index 1248d75..259b9a6 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c @@ -16,6 +16,7 @@ #define CDNS_PCIE_EP_MIN_APERTURE 128 /* 128 bytes */ #define CDNS_PCIE_EP_IRQ_PCI_ADDR_NONE 0x1 #define CDNS_PCIE_EP_IRQ_PCI_ADDR_LEGACY 0x3 +#define CDNS_PCIE_EP_MSIX_BAR 0x5 /** * struct cdns_pcie_ep - private data for this PCIe endpoint controller driver @@ -255,6 +256,43 @@ static int cdns_pcie_ep_get_msi(struct pci_epc *epc, u8 fn) return mme; } +static int cdns_pcie_ep_get_msix(struct pci_epc *epc, u8 func_no) +{ + struct cdns_pcie_ep *ep = epc_get_drvdata(epc); + struct cdns_pcie *pcie = &ep->pcie; + u32 cap = CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET; + u32 val, reg; + + reg = cap + PCI_MSIX_FLAGS; + val = cdns_pcie_ep_fn_readw(pcie, func_no, reg); + if (!(val & PCI_MSIX_FLAGS_ENABLE)) + return -EINVAL; + + val &= PCI_MSIX_FLAGS_QSIZE; + + return val; +} + +static int cdns_pcie_ep_set_msix(struct pci_epc *epc, u8 fn, u16 interrupts) +{ + struct cdns_pcie_ep *ep = epc_get_drvdata(epc); + struct cdns_pcie *pcie = &ep->pcie; + u32 cap = CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET; + u32 val, reg; + + reg = cap + PCI_MSIX_FLAGS; + val = cdns_pcie_ep_fn_readw(pcie, fn, reg); + val &= ~PCI_MSIX_FLAGS_QSIZE; + val |= interrupts; + cdns_pcie_ep_fn_writew(pcie, fn, reg, val); + /* Set MSIX BAR and offset */ + cdns_pcie_ep_fn_writel(pcie, fn, 0xb4, CDNS_PCIE_EP_MSIX_BAR); + /* Set PBA BAR and offset. BAR must match MSIX BAR */ + cdns_pcie_ep_fn_writel(pcie, fn, 0xb8, 0x10000 | CDNS_PCIE_EP_MSIX_BAR); + + return 0; +} + static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn, u8 intx, bool is_asserted) { @@ -366,8 +404,69 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn, return 0; } +static int cdns_pcie_ep_send_msix_irq(struct cdns_pcie_ep *ep, u8 fn, + u16 interrupt_num) +{ + struct cdns_pcie *pcie = &ep->pcie; + u32 cap = CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET; + u16 flags; + u64 pci_addr_mask = 0xff; + u16 tbl_offset = 0; + u32 bar_addr_upper, bar_addr_lower; + u32 msg_addr_upper, msg_addr_lower; + u32 msg_data; + u64 tbl_addr, msg_addr; + void __iomem *msix_tbl; + + /* Check whether the MSI-X feature has been enabled by the PCI host. */ + flags = cdns_pcie_ep_fn_readw(pcie, fn, cap + PCI_MSIX_FLAGS); + if (!(flags & PCI_MSIX_FLAGS_ENABLE)) + return -EINVAL; + /* We want local address, not address on host. Table is at offset 0 */ + bar_addr_lower = cdns_pcie_readl(pcie, + CDNS_PCIE_AT_IB_EP_FUNC_BAR_ADDR0(fn, CDNS_PCIE_EP_MSIX_BAR)); + bar_addr_upper = cdns_pcie_readl(pcie, + CDNS_PCIE_AT_IB_EP_FUNC_BAR_ADDR1(fn, CDNS_PCIE_EP_MSIX_BAR)); + + tbl_addr = ((u64)bar_addr_upper) << 32 | bar_addr_lower; + tbl_addr += (tbl_offset + ((interrupt_num - 1) * PCI_MSIX_ENTRY_SIZE)); + tbl_addr &= PCI_BASE_ADDRESS_MEM_MASK; + msix_tbl = phys_to_virt(tbl_addr); + if (!msix_tbl) + return -EINVAL; + + msg_addr_lower = readl(msix_tbl + PCI_MSIX_ENTRY_LOWER_ADDR); + msg_addr_upper = readl(msix_tbl + PCI_MSIX_ENTRY_UPPER_ADDR); + msg_addr = ((u64)msg_addr_upper) << 32 | msg_addr_lower; + + msg_data = readl(msix_tbl + PCI_MSIX_ENTRY_VECTOR_CTRL); + if (msg_data & 0x1) + return -EINVAL; + + msg_data = readl(msix_tbl + PCI_MSIX_ENTRY_DATA); + + iounmap(msix_tbl); + + /* Set the outbound region if needed. */ + if (unlikely(ep->irq_pci_addr != (msg_addr & ~pci_addr_mask) || + ep->irq_pci_fn != fn)) { + /* First region was reserved for IRQ writes. */ + cdns_pcie_set_outbound_region(pcie, fn, 0, + false, + ep->irq_phys_addr, + msg_addr & ~pci_addr_mask, + pci_addr_mask + 1); + ep->irq_pci_addr = (msg_addr & ~pci_addr_mask); + ep->irq_pci_fn = fn; + } + writel(msg_data, ep->irq_cpu_addr + (msg_addr & pci_addr_mask)); + + return 0; +} + static int cdns_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, - enum pci_epc_irq_type type, u8 interrupt_num) + enum pci_epc_irq_type type, + u16 interrupt_num) { struct cdns_pcie_ep *ep = epc_get_drvdata(epc); u32 link_status; @@ -384,6 +483,9 @@ static int cdns_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, case PCI_EPC_IRQ_MSI: return cdns_pcie_ep_send_msi_irq(ep, fn, interrupt_num); + case PCI_EPC_IRQ_MSIX: + return cdns_pcie_ep_send_msix_irq(ep, fn, interrupt_num); + default: break; } @@ -430,6 +532,8 @@ static int cdns_pcie_ep_start(struct pci_epc *epc) .unmap_addr = cdns_pcie_ep_unmap_addr, .set_msi = cdns_pcie_ep_set_msi, .get_msi = cdns_pcie_ep_get_msi, + .set_msix = cdns_pcie_ep_set_msix, + .get_msix = cdns_pcie_ep_get_msix, .raise_irq = cdns_pcie_ep_raise_irq, .start = cdns_pcie_ep_start, }; @@ -501,6 +605,7 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev) } epc_set_drvdata(epc, ep); + epc->features |= EPC_FEATURE_MSIX_AVAILABLE; if (of_property_read_u8(np, "max-functions", &epc->max_functions) < 0) epc->max_functions = 1; diff --git a/drivers/pci/controller/pcie-cadence.h b/drivers/pci/controller/pcie-cadence.h index 4bb2733..bd83b5b 100644 --- a/drivers/pci/controller/pcie-cadence.h +++ b/drivers/pci/controller/pcie-cadence.h @@ -93,6 +93,7 @@ #define CDNS_PCIE_EP_FUNC_BASE(fn) (((fn) << 12) & GENMASK(19, 12)) #define CDNS_PCIE_EP_FUNC_MSI_CAP_OFFSET 0x90 +#define CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET 0xb0 /* * Root Port Registers (PCI configuration space for the root port function)