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;