Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969484AbdDSUvs (ORCPT ); Wed, 19 Apr 2017 16:51:48 -0400 Received: from mail-bl2nam02on0076.outbound.protection.outlook.com ([104.47.38.76]:63079 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S969372AbdDSUtF (ORCPT ); Wed, 19 Apr 2017 16:49:05 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Roy Pledge To: , , , , CC: , Roy Pledge Subject: [PATCH v2 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations Date: Wed, 19 Apr 2017 16:48:40 -0400 Message-ID: <1492634930-10765-2-git-send-email-roy.pledge@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492634930-10765-1-git-send-email-roy.pledge@nxp.com> References: <1492634930-10765-1-git-send-email-roy.pledge@nxp.com> Reply-To: X-EOPAttributedMessage: 0 X-Matching-Connectors: 131371085370294264;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.158.2;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39450400003)(39860400002)(39380400002)(39840400002)(39400400002)(39410400002)(39850400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(54906002)(8656002)(5003940100001)(76176999)(230783001)(305945005)(77096006)(43066003)(4326008)(86362001)(50986999)(356003)(47776003)(2201001)(5660300001)(50466002)(50226002)(6666003)(53936002)(3450700001)(2950100002)(8936002)(104016004)(33646002)(48376002)(85426001)(106466001)(36756003)(8676002)(2906002)(189998001)(81166006)(38730400002)(105606002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR03MB2284;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD035;1:lDEtBuvW/nudE8LXHqCTw+sXZ2pRDE/fKhe4Z76I3KU3CzSlN/PayGkLEwFIDFN56keKawQNK92Jca/vtncy3wKdBF3tXlc5Dneq+r9fR36ZPeJdQPOvaAz8feUtOPbeJjbYPnd8XmpsNt81P+nv2lK9nSGdcXIW2y0CSPkQ+Vh/qELZXwCCb/as7NvKLPZmMikuzyOIR8mXW4pe0x6hY9H+3LVFdAbw6l0eJlU+833Sx/CV7pY+uMTjZ0OdRKK8EoMrr4x4OA9P1OoclFaV+nddlsdyV9uKjF2bO/KIShL5HTQSwxVpErRNFwiLBef76NN+OfVVPHhIyJSpZMPQOppK51BlQmqRcep9Bg47gOe+tgbZzCM2D8YcE+6Np2lcroOx7F/VRz3iiutQJVil1VTSEptZprz466BsIiMJ2Ng1YBGw/G3mahy18pSj7Y9eDu4GKABXneGZ6+hOkyytBWYDO6NW7/OprwccKHflTKxV9NE5pZg18Iaew2LMZITL4VPSWjyYglAPHKmLfsz+G5cdHju6p79y293PBZFrXnNIw4MR8wnZWB6W0/+tnAt/3INf3upnrf4bSAtfQ0p1mgEYoerjkvOEbnl8MM7UOzfhnCgMmFIk8zRQG5fsep6Ct/WQMXVPwB4uRceIQ3jHkbklRTAKJ9a7/7py3AlrADxGKo6wlgZ5PqR1ZfTpZqgdTs/ZwA4uXe2opZsRQMENMk+eDdgfTX9yHELJGBrz4yQY1p0A+mqRiib8AFDjvDMo MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64dc1930-7966-4793-938f-08d487657fa2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131430075)(201703131517081);SRVR:CY1PR03MB2284; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2284;3:9/kcATFIxHj6l3VucbZCSsiAJLk/8rglEHG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fhlGwOBNFz8OZAT7Y3cT+tYnBQPfJZAPeLb4V0hrvHkgnl/lsSwS3hEnmJ1nsv/FusQteERSws/XcFC9bwxYg16t5wHeNObaIju33Q3/m48WfgtBuXiWUoGlna+H1XNulHXuO6m9lxsrJ08= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(601004)(2401047)(13024025)(13023025)(13015025)(13018025)(13017025)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123561025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123556025)(20161123565025)(20161123563025);SRVR:CY1PR03MB2284;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR03MB2284; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR03MB2284;4:GzrUaHEiAUxaeNAeWnjVf1Oso9F2Mg+Q137Bpsxy6z?= =?us-ascii?Q?Yo6erQTup4++QgBq41Yo8bsGjtRrMcI5NGVBr7VcUyJYFEZt+JlcF8M1yiBq?= =?us-ascii?Q?mKZjVGegPMKOovBequXP6VbNXuIblmyFDzExm/OHyNVwLFazU64so2g2vsJK?= =?us-ascii?Q?rB0Ks+RPtdLVK3t33I7KYIbZy9a4RUSdLVgmP6bbKfn7dj3xiHnnkMPQ4/cX?= =?us-ascii?Q?8zqRU0J+qlNJ+A+veVZPsZbmdk5iAKUZTrfQVuhyQOu6M0WZCcRgQUpqXkxm?= =?us-ascii?Q?g8xC9VtWmV6cMwSx4VhH+x9+kILhyFgYdOAihbgxqYgFkF2WawqJBDgOenN9?= =?us-ascii?Q?WdIQ4rr6w+Zcqu9K095eiSXf1dZjlJj4XExhsTFNvAkMh3gr5Lf0Jnfd2Cv4?= =?us-ascii?Q?y1Eqa/xs6BahIHwS/tLjnAg7Puc9ZcrPrzg9seTMH97T96cfQt1SfpRWCZU/?= =?us-ascii?Q?wuEAsViRxzoIlpi7rKk0U8m0G9YUNLVcVWrtHdBN/XfcO7sxKf+UgsbGTq9g?= =?us-ascii?Q?YQIa0kzZPQC1/wcytWqRZftG03Mqrnal/WheiuZQnJfIV5hIctUTBrrXFr/D?= =?us-ascii?Q?toiP5O+QzH7RhxYkySS9utWGMrpkcw+WJ7oRV/sRJlCFEBJocl3TbdRiX7kl?= =?us-ascii?Q?ZQ51M9ZVNiprsZ9v/Adc+P3fWQpD1bWhsJF+tjRSPJTefHEzNoBZElXKZYzL?= =?us-ascii?Q?yF8boyILk0N3brTGkhbDpVAcWLFqEmUwT5Bjtw9rIU0cb921cQMuxl+C7CBp?= =?us-ascii?Q?WNwc60IfRDod0EMX/tQ6AFLZ8QJ276RNHfavEzVTky/z6lyQAEddG3497pQU?= =?us-ascii?Q?VtPm5BnBZ5Rm0RJtRBOAQsMBOVuSR+rFf58b+79BBF0Q6JfABFrw/pJvqflJ?= =?us-ascii?Q?Q7lkcEd53KOyF9zBtBz55Jnum22xULrDF7o0rIvxv5L2ZR2+eSHaCrF6ChbG?= =?us-ascii?Q?leKHFPwRGoqlZI/r4ocyJxtWtixtSFB+48/UfVXg=3D=3D?= X-Forefront-PRVS: 028256169F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR03MB2284;23:mE/uLiUinyy6JEDVL5yiOmccYSUTXskSpLJWriPCQ?= =?us-ascii?Q?6/dVFCK6USCnaCYB4UNstf8Vk7k2zQykyxUE9WVrbVTrUYJ6wuAom61CrOA/?= =?us-ascii?Q?Hl+4XnCYUnytBqMC9ybk+s68O+2cz9Xiic2frQ3v4L3tPHgeipwBemEu47O5?= =?us-ascii?Q?lIv5NxmlqTgMYRv7Ss4dIIdviLIBsnlDjgA8aVHiL94PPA8PF08u8vhOlyp9?= =?us-ascii?Q?3zR7b0E4YyDW4y36TzZiCXVt1S7i/peUGJWfHPBzhLfU9PaFwvn66HAKtyZN?= =?us-ascii?Q?IaeJ/RU6qb0P7aYUXvv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Q?pE4Z8rTCy2sj+cqznRFluG1pPvO6tIb+QFhGrAOILpCauWXsvTbsp48PosSn?= =?us-ascii?Q?2lDd/5I6bpwks2n5oIEu9gZ3FNXQSIuHEGjjwRj?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2284;6:TLtQ17DUL4ScC+juYh/iEX+JJPETdOUTM0A40hDftzZbm13rCa4d0i0o7X1vJzcMew5MBPf7Y0p/afv2vn8+rP9EY33UEIEuq6I4bHczBJyntBejUIS3j7f+WwI1wDWFeVaR3uvzLvfvP+ONks7MbZuq4eqZW5+zhKMgzvXjfW2lcHfKFJ5ARTokmbjXpdd8Drkz3DIdQeeOnsiCjHzr42HpPwzkfKKtgQZOxSzWpzbt2/qjrmAm2MaPZgTdslfCBndHTZG9kI/4+sBjvQzRYXytCQ93WxI00NCpEJkwzf7mKTsFKRO/4/kWQoBgfSGEdMBM7EBJ+hLAUf5NFFFWh4MkYPZ6DgNDAStkyM5glfaVknCvAGGNf9IYR92SLgSlWFV8YsdTGwoT4MVdESTyHNQqWnpMujztv9LgXy16eFBjPGV7KhBRomDzbRTYY499s4nQnUXKgjL731UzNEy+ka+uJoQhLiDXcSzqlWenQk0lpn3kfis68xJq8E5yUEUM;5:ovRHpbk688pXLG1tc+XZfl6qGWxC7iMrRlh4ik9bo00XHd3k5WP8IhV2L3uwVQQiWmcjjQN8pkYXwAi0ceuQEgDAVQZwHTaNF1X1WDKWxJGqZwmwaet6br+NJs1YHlDwFX1GyWKvZ+RWrfAkaJGIRfl6Wxe84q8qpNH09TVRAdNgy2fJfyZEYWrWkKhdZuT1;24:fM+gKcQCLULqcy0vZI8GUWtzTZoCD5dxtlN2QUsk/ZC85amogMfh3X23gwfH5aXATIA6q+FIp23ISZ41HaQhxg03t/It8DpMuTraqcsno5I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2284;7:mf8U1bBvnwhVNE2uAbeWfB0Ov1+aSjfhjeXllwLkJNSR0UR0m6juXp9Og2wDGdp/U0Eipm+RZz+X5xQc2GF3qOBjU5ujAi/xi4FEWcvloQe6mV+qLHI31k0kCQ3x6ki9OSPRPYYWXGCNr4/nbswMHyEA2JbSk0X59xdLpgaetTLHgsMr54/se+qAf9AWuDV8VXmN/JZGavO0FJjEtEC5sPAD9109lpgJ4fdRcxV+fNu/VyU5lExPf7b97Pro7z+cCcPUEQJ2LFPDcAHclhnOugDyrw8a3yFn2x5nC9MGVT7RLnHhtc+o52jdqkMHylsO5Rbo1wzaw0Dnxuk7pdwZmA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2017 20:48:56.7798 (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.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2284 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2423 Lines: 81 Use the shared-memory-pool mechanism for free buffer proxy record area allocation. Signed-off-by: Roy Pledge --- drivers/soc/fsl/qbman/bman_ccsr.c | 35 ++++++++++++++++++++++++++++++++++- drivers/soc/fsl/qbman/bman_priv.h | 3 +++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c b/drivers/soc/fsl/qbman/bman_ccsr.c index a8e8389..4d2392d 100644 --- a/drivers/soc/fsl/qbman/bman_ccsr.c +++ b/drivers/soc/fsl/qbman/bman_ccsr.c @@ -170,10 +170,11 @@ static int fsl_bman_probe(struct platform_device *pdev) { int ret, err_irq; struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *mem_node, *node = dev->of_node; struct resource *res; u16 id, bm_pool_cnt; u8 major, minor; + u64 size; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -201,6 +202,38 @@ static int fsl_bman_probe(struct platform_device *pdev) return -ENODEV; } + /* + * If FBPR memory wasn't defined using the qbman compatiable string + * try using the of_reserved_mem_device method + */ + if (!fbpr_a) { + ret = of_reserved_mem_device_init(dev); + if (ret) { + dev_err(dev, "of_reserved_mem_device_init() failed 0x%x\n", + ret); + return -ENODEV; + } + mem_node = of_parse_phandle(dev->of_node, "memory-region", 0); + if (mem_node) { + ret = of_property_read_u64(mem_node, "size", &size); + if (ret) { + dev_err(dev, "FBPR: of_address_to_resource fails 0x%x\n", + ret); + return -ENODEV; + } + fbpr_sz = size; + } else { + dev_err(dev, "No memory-region found for FBPR\n"); + return -ENODEV; + } + if (!dma_zalloc_coherent(dev, fbpr_sz, &fbpr_a, 0)) { + dev_err(dev, "Alloc FBPR memory failed\n"); + return -ENODEV; + } + } + + dev_info(dev, "Allocated FBPR 0x%llx 0x%zx\n", fbpr_a, fbpr_sz); + bm_set_memory(fbpr_a, fbpr_sz); err_irq = platform_get_irq(pdev, 0); diff --git a/drivers/soc/fsl/qbman/bman_priv.h b/drivers/soc/fsl/qbman/bman_priv.h index f6896a2..765a4bf 100644 --- a/drivers/soc/fsl/qbman/bman_priv.h +++ b/drivers/soc/fsl/qbman/bman_priv.h @@ -33,6 +33,9 @@ #include "dpaa_sys.h" #include +#include +#include +#include /* Portal processing (interrupt) sources */ #define BM_PIRQ_RCRI 0x00000002 /* RCR Ring (below threshold) */ -- 2.7.4