From patchwork Thu Aug 24 20:37:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Pledge X-Patchwork-Id: 9920925 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 BDA89603FA for ; Thu, 24 Aug 2017 20:39:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0A9528BFE for ; Thu, 24 Aug 2017 20:39:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A556928C62; Thu, 24 Aug 2017 20:39: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=-2.6 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B5DD28C6F for ; Thu, 24 Aug 2017 20:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gVd9R5CcPEdqmL3zZU/QjHBIHnKkz92SGzD7UtZs8Dw=; b=oy7hNvo8d5EWom NCDiX+vEYM0yvGSETmlHBfdL/6YJ4dc1Zs6fZ1G0VddvICV/mjlw5HroPBErZNJ8ywFOl1yHiTgO0 LfiMh1He5YQc1aJj7bWugJxm8R4d6OXgHjmXdWygw+HJYtqOzqDV66Tk1Q/XBoF9jXILU6VuMNyqt QFG7T96wqa7tYoxevOlu1r1TGyKB+GTIerED0HZPNFtMneUmrfRVC/LaYRNBdBM3TuQ3NEq5JEYmW c3ykSzMzhiqGMclgUwZxBMrciQAcUR7AjuYRaKkILKJr0PdN75kDvs7HM5Jwp+DK+h2WYPF94piuV ZWAAJSVEkED+QWmyzmYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dkyu8-0004Ap-51; Thu, 24 Aug 2017 20:39:04 +0000 Received: from mail-by2nam01on060b.outbound.protection.outlook.com ([2a01:111:f400:fe42::60b] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dkytZ-0003WX-6L for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2017 20:38:32 +0000 Received: from CY4PR03CA0107.namprd03.prod.outlook.com (10.171.242.176) by CY4PR03MB3320.namprd03.prod.outlook.com (10.171.247.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18; Thu, 24 Aug 2017 20:38:06 +0000 Received: from BN1AFFO11FD023.protection.gbl (2a01:111:f400:7c10::115) by CY4PR03CA0107.outlook.office365.com (2603:10b6:910:4d::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18 via Frontend Transport; Thu, 24 Aug 2017 20:38:05 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD023.mail.protection.outlook.com (10.58.52.83) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Thu, 24 Aug 2017 20:38:05 +0000 Received: from otc-sw1.am.freescale.net (otc-sw1.am.freescale.net [10.29.200.182]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v7OKbv0o004767; Thu, 24 Aug 2017 13:38:04 -0700 From: Roy Pledge To: , , , Subject: [v4 07/11] soc/fsl/qbman: Rework portal mapping calls for ARM/PPC Date: Thu, 24 Aug 2017 16:37:51 -0400 Message-ID: <1503607075-28970-8-git-send-email-roy.pledge@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503607075-28970-1-git-send-email-roy.pledge@nxp.com> References: <1503607075-28970-1-git-send-email-roy.pledge@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131480806856641382; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(86362001)(85426001)(305945005)(626005)(4326008)(8936002)(43066003)(189998001)(2950100002)(36756003)(81166006)(8676002)(54906002)(6666003)(97736004)(53936002)(77096006)(2201001)(50986999)(76176999)(498600001)(5660300001)(47776003)(48376002)(8656003)(50466002)(104016004)(3450700001)(106466001)(33646002)(68736007)(5003940100001)(7416002)(356003)(2906002)(105606002)(81156014)(50226002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB3320; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD023; 1:jszqKA2S4sYOs9rBvjxQDigEWOp20TaZV+a1ea2Y1LNah0L5cq4BUBgnAW83fwv8qhi4z8POdhBET8/EO2Uyz/CWfrlcxTE83yppaDwbDhsh1NwMcEFlPbFGNtNH+hfQ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: adfbf65f-27ad-4929-6a05-08d4eb3005ed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR03MB3320; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB3320; 3:ktQSQnsJv9Uo4u+z8kOMR5G8zhnN7cBQ5i9CSxVefwTTzGbSXKPf4gtwI/FaLeTQez7wMZ6XDPUZgKYE6xVsFUIEZNk87dFVTZRjOm701v+wu2VLmKSBBpLhs5h1uE0NCxa2Di2I2LSBG37gqfOITtJkftyOA7ymdMG7n4BzzkKLjxPTHdaC0wqeXwWfuBjXhiyn0bkUvBwLFa6Saruz42RUJgdl5Y0wbtllApV5pi8QdBcnQWiu9zQ36vTstEGHDpG08cxH3NnA0Bw52CYDl7/kmdn0B6CWmY4OIQu97RxZG9jHoaU3fzKO6+FvMxUaFh8KkKu5V3BESVPgYb3/muoC1CnSRzzVECC6qKJfiuI=; 25:NWkXG7aba2FzwrFSBlc5mQyEuQw4NFWfWpnn8PXjwPmPpjPlVjXHEr8U0CtnxH/wbsRlHMTWTDbf5EekIsoTJRRuDUsEU3o17SnvJRaVICqBZeCe+Tp329I4YaEnFqa8lUxZMig/8VykOfBnYOvIW/vFD7KyT2fb54OjPfSmdYdZ5h2bncILKlx8a1qJxcRdlYoM8EiRaJHSw4+t1d7K9hA7TRDurAl99Xt9+xX8gmeI8Jr7OeUbp8WDK9ddAnqOvfDqPu7s5qN8xZBeuoHUsX+QreZyyg34B3oiJIq4xYkfaa6QINiq+2l61xGKfbK1q32DbLkStgZJKkVwHpBFkA== X-MS-TrafficTypeDiagnostic: CY4PR03MB3320: X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB3320; 31:L4m5yVcaLoB0ZmAHRqLmYTwOeIV7rWPay0MTBGTFgaJXD1h0yXxsVqXsAqaqyuY65PgWVCRTugs+DkEpXBA2yJLENw+qlInspQo8x9ACPlbVKh0CWvnqu60RdW4TJsE492u+KM/RR8jrAWI3jU0tVP6ioQ7pMCgSSmz7zIMh5jooLRWh2Fk6MoDjaIcBwSe9NBnOe7m0spcvme+crAAlWP716LJ1PA75V+FTl30UtWA=; 4:FL2O6usxYD12oFVi3WLi9WPBXBMhvZhQo+CplSN2EHKE/FKby7O/NgKabQbFB1YR+vnel3HDtCOyfM2RswdWPtr/+yitjSxF26aRGYYAN1RA0um8gC7GqRW8g9KiXjSgZ+cL2jhOhk+8TSi7zbwi+PpGpXrs77SUx4ZJD6juR/iD49uHuqbycjf5Mq1Tr83p7OJYeot69Imnjx6zgkdb6UUVBHsHNLIkaYpOdpZKNhoAdds5/nHMa9++tlIoqqOGC/yPqZ+yXkjBX773eyaFA0V+YctnXOq3LXCdU2yDWe+0ZaM+siks9/jg+geflL6JlLEG47T6XeQ4vYmhSf6rxg== X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13016025)(8121501046)(5005006)(13018025)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6096035)(20161123559100)(20161123561025)(20161123565025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB3320; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB3320; X-Forefront-PRVS: 04097B7F7F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB3320; 23:rN8NfHpeV2rFaSU4CASlqO7lCyjtjadQncXwybLPQ?= =?us-ascii?Q?UQIcbuWLM0G+P5udmgratA2pjvcTNA9fbF9FV2FCg8u+0UZZ6xOPGWJr+Cv+?= =?us-ascii?Q?sNQ3k9AFJkCFB7NPusZ2/rZXKlEBD2ZKtCoAUzkha8CBs7eP05a8MYHL5Kpf?= =?us-ascii?Q?5u083X9MIyic7Hw5wT9IioAXfTuF2dDyn7vhBIxgifWNeCOZCPKRLpVaY7N0?= =?us-ascii?Q?CqZzUgSSeE6LZBx8hzKnRcIupOeFJT106LFkjrwveMUMA9MuFtS+OJxakK/V?= =?us-ascii?Q?NhhAK1C9zf1daY/gKwLwIu4fbCSgdLaQbzR5OlO6UcpFxaXDJtXO8TyWkLgN?= =?us-ascii?Q?AI8CgGU9MqUiGPzaTiD76gW6L8VevXfJ9q38aF6+8fI2+wCIFWIrNnFMyaFd?= =?us-ascii?Q?dy10TYfHirwMAnqQ2wy35g1gdBrSssqR7pO/hkTyic+aN6U+iR5Rly33ypmn?= =?us-ascii?Q?PYhMVXRGM9SLE3lRGEqmmF07SCXcJRFrHGr6PZ0v6B/Q5zb7W0kNdRblI1ib?= =?us-ascii?Q?ggQNltj+X4UeyQ2jL1s91aiW28aOUWU26CW3Fh0g6D8YU0YR26OOJcWhRrxO?= =?us-ascii?Q?NVBBLHrfQAJfm8sPm+pXNAshJ2dIRftNUWbc6EZq3niQ3/8O6Brv/fDgk0tc?= =?us-ascii?Q?li3PMyGS90svWEyYBNk2ZWW6Z5U2xkWAWAsG/qxbCZP/5ysSqm7ZO6L946zW?= =?us-ascii?Q?v2XExMFYbeu/RF68MxQNmkgJX9HPW67mezr3z1ZPVOb3h4Y8rFENaxlVUqDk?= =?us-ascii?Q?xnkOujaexEuEYVhpP1XBUtysRpFOSyy0Y3v+Oa2G3mXcS5qz9BzUZ4PhBT+7?= =?us-ascii?Q?+en+PPSjYu4gtrH4t/xDtfio7v98bKwcOSk/BqbBjlL/v0y1fHtlLwLTTabg?= =?us-ascii?Q?uPEmSCVVQpT4+EVaepwEAItnN21urSI6KuS3KysX2GfgZxPIzv0X6S+vjcp/?= =?us-ascii?Q?z+KVfrEkaAS9I4Yuh9P6Bo3j51mBHnaZYan3e0tNKJWXYSTCMI5Ly3DiBQ4u?= =?us-ascii?Q?pPYZ9yUAJ1PVaYYzzLT7FRYJtjJaojA/NK18yIodb3ARAwz3f5DRgT1uxGpH?= =?us-ascii?Q?3/ucETYBgPgTHf1joagitnWNBEycDsuKxG1npWxXhE3NDKNA8yLWTyMI186a?= =?us-ascii?Q?y9J9fXo8JZ8MZT7XTn1rV/He4Yas+Btr35Xs84FUJpA5HAh7C1+o3iT2s4Mn?= =?us-ascii?Q?5ut8lM9Iyjp9TQ=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB3320; 6:o1NvQIurYiJSnLsNYmxEQiK40uaCYJpeWZlwtidM0UlNooq4sRV17nVUnOs1cOKALOrIxXT3ppb/RH556n+VF7G1AxURZOQe5fA0volZ+8HPdW9V4q3JIW81fa4qXMLnJlHwOnMNjEI8VJRuoAt8y3ra9hZAH67WLicJRGfICZLHu94WvIl6jYNom/QaFDMYVjdTrzKQXnBf93OgFAGfiHQrVfCLF8GT41dE+itoypfywA7S9173ebT5pXKrpSp4IlHo5GBw2PFzVHAmUkMCHz8ps8D1HKfnElwCXcE7GeUpdRVlmqrdCPnU1uWr818jNA1NYcnwixgeaGpvYIl6lw==; 5:W/Bjopf3RIo1yLQuGEh8ltHyV+26VXwsD4gMDJ3n2Z2fuJ09MTvDc1RoF91NE/cUurXbJ0P2h4JQTjncihzzDw9TLWXxo+I9MLjTeohZ6UlnInj5vFRIa3pb3EZUlFHDY3X2gqaZp7RlksICWpt5wg==; 24:gCIPVCi+amWgnEhKmf9RFCuEU/6Cf/3DuKmjuX9K+a5bhkBOW3yjOkfigjQLNFAjSdY9qGAK/GdcGXtflvXQ5u99eMplsEmeZ/8IrLct1Xs=; 7:oeDg342yygpP93gLQZfpeZK7JyVsT2BFAmjyr6Rkf+GBJC9u6D3zng1cde5ZpJDnqOIu2bQNqI2HazBftu9yFem5LZ1pmsh3/EeCUjh5X1czGxtkbgx2CFs7rtDU3hqqNsqm1kKeWo5H65Cmx1ww460FImyT1X++vDD8C4V5zCT4YYdyxfK3bCczGK1VG3t4fDAdNW3Meulvf7tyUsWGdcHEFLJ7srA1Wali8zJIG+w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2017 20:38:05.4613 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB3320 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170824_133829_384097_A586C99A X-CRM114-Status: GOOD ( 18.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: roy.pledge@nxp.com Cc: mark.rutland@arm.com, arnd@arndb.de, madalin.bucur@nxp.com, catalin.marinas@arm.com, Roy Pledge , linux@armlinux.org.uk, oss@buserror.net Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Rework portal mapping for PPC and ARM. The PPC devices require a cacheable coherent mapping while ARM will work with a non-cachable/write combine mapping. This also eliminates the need for manual cache flushes on ARM Signed-off-by: Roy Pledge --- drivers/soc/fsl/qbman/bman.c | 6 +++--- drivers/soc/fsl/qbman/bman_portal.c | 36 +++++++++++++++++++++++------------- drivers/soc/fsl/qbman/bman_priv.h | 8 +++----- drivers/soc/fsl/qbman/dpaa_sys.h | 8 ++++---- drivers/soc/fsl/qbman/qman.c | 6 +++--- drivers/soc/fsl/qbman/qman_portal.c | 36 +++++++++++++++++++++++------------- drivers/soc/fsl/qbman/qman_priv.h | 8 +++----- 7 files changed, 62 insertions(+), 46 deletions(-) diff --git a/drivers/soc/fsl/qbman/bman.c b/drivers/soc/fsl/qbman/bman.c index ff8998f..e31c843 100644 --- a/drivers/soc/fsl/qbman/bman.c +++ b/drivers/soc/fsl/qbman/bman.c @@ -154,7 +154,7 @@ struct bm_mc { }; struct bm_addr { - void __iomem *ce; /* cache-enabled */ + void *ce; /* cache-enabled */ void __iomem *ci; /* cache-inhibited */ }; @@ -512,8 +512,8 @@ static int bman_create_portal(struct bman_portal *portal, * config, everything that follows depends on it and "config" is more * for (de)reference... */ - p->addr.ce = c->addr_virt[DPAA_PORTAL_CE]; - p->addr.ci = c->addr_virt[DPAA_PORTAL_CI]; + p->addr.ce = c->addr_virt_ce; + p->addr.ci = c->addr_virt_ci; if (bm_rcr_init(p, bm_rcr_pvb, bm_rcr_cce)) { dev_err(c->dev, "RCR initialisation failed\n"); goto fail_rcr; diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c index 39b39c8..bb03503 100644 --- a/drivers/soc/fsl/qbman/bman_portal.c +++ b/drivers/soc/fsl/qbman/bman_portal.c @@ -91,7 +91,6 @@ static int bman_portal_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; struct bm_portal_config *pcfg; struct resource *addr_phys[2]; - void __iomem *va; int irq, cpu; pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL); @@ -123,23 +122,34 @@ static int bman_portal_probe(struct platform_device *pdev) } pcfg->irq = irq; - va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0); - if (!va) { - dev_err(dev, "ioremap::CE failed\n"); + /* + * TODO: Ultimately we would like to use a cacheable/non-shareable + * (coherent) mapping for the portal on both architectures but that + * isn't currently available in the kernel. Because of HW differences + * PPC needs to be mapped cacheable while ARM SoCs will work with non + * cacheable mappings + */ +#ifdef CONFIG_PPC + /* PPC requires a cacheable/non-coherent mapping of the portal */ + pcfg->addr_virt_ce = memremap(addr_phys[0]->start, + resource_size(addr_phys[0]), MEMREMAP_WB); +#else + /* ARM can use a write combine mapping. */ + pcfg->addr_virt_ce = memremap(addr_phys[0]->start, + resource_size(addr_phys[0]), MEMREMAP_WC); +#endif + if (!pcfg->addr_virt_ce) { + dev_err(dev, "memremap::CE failed\n"); goto err_ioremap1; } - pcfg->addr_virt[DPAA_PORTAL_CE] = va; - - va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]), - _PAGE_GUARDED | _PAGE_NO_CACHE); - if (!va) { + pcfg->addr_virt_ci = ioremap(addr_phys[1]->start, + resource_size(addr_phys[1])); + if (!pcfg->addr_virt_ci) { dev_err(dev, "ioremap::CI failed\n"); goto err_ioremap2; } - pcfg->addr_virt[DPAA_PORTAL_CI] = va; - spin_lock(&bman_lock); cpu = cpumask_next_zero(-1, &portal_cpus); if (cpu >= nr_cpu_ids) { @@ -164,9 +174,9 @@ static int bman_portal_probe(struct platform_device *pdev) return 0; err_portal_init: - iounmap(pcfg->addr_virt[DPAA_PORTAL_CI]); + iounmap(pcfg->addr_virt_ci); err_ioremap2: - iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]); + memunmap(pcfg->addr_virt_ce); err_ioremap1: return -ENXIO; } diff --git a/drivers/soc/fsl/qbman/bman_priv.h b/drivers/soc/fsl/qbman/bman_priv.h index 765a4bf..c48e6eb 100644 --- a/drivers/soc/fsl/qbman/bman_priv.h +++ b/drivers/soc/fsl/qbman/bman_priv.h @@ -49,11 +49,9 @@ extern u16 bman_ip_rev; /* 0 if uninitialised, otherwise BMAN_REVx */ extern struct gen_pool *bm_bpalloc; struct bm_portal_config { - /* - * Corenet portal addresses; - * [0]==cache-enabled, [1]==cache-inhibited. - */ - void __iomem *addr_virt[2]; + /* Portal addresses */ + void *addr_virt_ce; + void __iomem *addr_virt_ci; /* Allow these to be joined in lists */ struct list_head list; struct device *dev; diff --git a/drivers/soc/fsl/qbman/dpaa_sys.h b/drivers/soc/fsl/qbman/dpaa_sys.h index 81a9a5e..0a1d573 100644 --- a/drivers/soc/fsl/qbman/dpaa_sys.h +++ b/drivers/soc/fsl/qbman/dpaa_sys.h @@ -51,12 +51,12 @@ static inline void dpaa_flush(void *p) { + /* + * Only PPC needs to flush the cache currently - on ARM the mapping + * is non cacheable + */ #ifdef CONFIG_PPC flush_dcache_range((unsigned long)p, (unsigned long)p+64); -#elif defined(CONFIG_ARM) - __cpuc_flush_dcache_area(p, 64); -#elif defined(CONFIG_ARM64) - __flush_dcache_area(p, 64); #endif } diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 25419e1..668fab1 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -300,7 +300,7 @@ struct qm_mc { }; struct qm_addr { - void __iomem *ce; /* cache-enabled */ + void *ce; /* cache-enabled */ void __iomem *ci; /* cache-inhibited */ }; @@ -1123,8 +1123,8 @@ static int qman_create_portal(struct qman_portal *portal, * config, everything that follows depends on it and "config" is more * for (de)reference */ - p->addr.ce = c->addr_virt[DPAA_PORTAL_CE]; - p->addr.ci = c->addr_virt[DPAA_PORTAL_CI]; + p->addr.ce = c->addr_virt_ce; + p->addr.ci = c->addr_virt_ci; /* * If CI-stashing is used, the current defaults use a threshold of 3, * and stash with high-than-DQRR priority. diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index cbacdf4..41fe33a 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -224,7 +224,6 @@ static int qman_portal_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; struct qm_portal_config *pcfg; struct resource *addr_phys[2]; - void __iomem *va; int irq, cpu, err; u32 val; @@ -262,23 +261,34 @@ static int qman_portal_probe(struct platform_device *pdev) } pcfg->irq = irq; - va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0); - if (!va) { - dev_err(dev, "ioremap::CE failed\n"); + /* + * TODO: Ultimately we would like to use a cacheable/non-shareable + * (coherent) mapping for the portal on both architectures but that + * isn't currently available in the kernel. Because of HW differences + * PPC needs to be mapped cacheable while ARM SoCs will work with non + * cacheable mappings + */ +#ifdef CONFIG_PPC + /* PPC requires a cacheable mapping of the portal */ + pcfg->addr_virt_ce = memremap(addr_phys[0]->start, + resource_size(addr_phys[0]), MEMREMAP_WB); +#else + /* ARM can use write combine mapping for the cacheable area */ + pcfg->addr_virt_ce = memremap(addr_phys[0]->start, + resource_size(addr_phys[0]), MEMREMAP_WT); +#endif + if (!pcfg->addr_virt_ce) { + dev_err(dev, "memremap::CE failed\n"); goto err_ioremap1; } - pcfg->addr_virt[DPAA_PORTAL_CE] = va; - - va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]), - _PAGE_GUARDED | _PAGE_NO_CACHE); - if (!va) { + pcfg->addr_virt_ci = ioremap(addr_phys[1]->start, + resource_size(addr_phys[1])); + if (!pcfg->addr_virt_ci) { dev_err(dev, "ioremap::CI failed\n"); goto err_ioremap2; } - pcfg->addr_virt[DPAA_PORTAL_CI] = va; - pcfg->pools = qm_get_pools_sdqcr(); spin_lock(&qman_lock); @@ -310,9 +320,9 @@ static int qman_portal_probe(struct platform_device *pdev) return 0; err_portal_init: - iounmap(pcfg->addr_virt[DPAA_PORTAL_CI]); + iounmap(pcfg->addr_virt_ci); err_ioremap2: - iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]); + memunmap(pcfg->addr_virt_ce); err_ioremap1: return -ENXIO; } diff --git a/drivers/soc/fsl/qbman/qman_priv.h b/drivers/soc/fsl/qbman/qman_priv.h index 957ef54..bab7f15 100644 --- a/drivers/soc/fsl/qbman/qman_priv.h +++ b/drivers/soc/fsl/qbman/qman_priv.h @@ -155,11 +155,9 @@ static inline void qman_cgrs_xor(struct qman_cgrs *dest, void qman_init_cgr_all(void); struct qm_portal_config { - /* - * Corenet portal addresses; - * [0]==cache-enabled, [1]==cache-inhibited. - */ - void __iomem *addr_virt[2]; + /* Portal addresses */ + void *addr_virt_ce; + void __iomem *addr_virt_ci; struct device *dev; struct iommu_domain *iommu_domain; /* Allow these to be joined in lists */