Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754104AbdHXUlA (ORCPT ); Thu, 24 Aug 2017 16:41:00 -0400 Received: from mail-cys01nam02on0076.outbound.protection.outlook.com ([104.47.37.76]:26496 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753314AbdHXUiC (ORCPT ); Thu, 24 Aug 2017 16:38:02 -0400 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; From: Roy Pledge To: , , , CC: , , , , , , Roy Pledge Subject: [v4 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations Date: Thu, 24 Aug 2017 16:37:45 -0400 Message-ID: <1503607075-28970-2-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> Reply-To: X-EOPAttributedMessage: 0 X-Matching-Connectors: 131480806808254299;(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)(1110001)(1109001)(339900001)(199003)(189002)(2201001)(7416002)(5660300001)(3450700001)(6666003)(48376002)(68736007)(2950100002)(4326008)(85426001)(8656003)(2906002)(86362001)(36756003)(104016004)(189998001)(5003940100001)(498600001)(81166006)(230783001)(305945005)(50986999)(8936002)(76176999)(81156014)(8676002)(356003)(50226002)(47776003)(626005)(53936002)(105606002)(97736004)(43066003)(106466001)(50466002)(77096006)(54906002)(33646002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR03MB2272;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC011;1:Xv45VITsA/NwdYfvFd4y1tKPLjzRb2YKQVE6vSduAeeegINsFPhzd0hGXDwgaHdAif2pzc4L1nTKZY/yPO+u6HmA5j1gPKcxy/TKzzbsf02H6OUszzRDHAJuVI9a3rwD MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9969646f-0ea5-4d8a-15fd-08d4eb30030b 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:SN2PR03MB2272; X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2272;3:Mu+CtRWXZBV02wSvfjo4nSlFj4QZO4lyXStiGNks/RGt2RhnT8pxFWDdzBbOz+s7+d2zk7yF6lGMb9BsrKXd04aix4jMuz2eb2GtLgm+vneQb2o/KOszIyIK569m/MwR7+GYgyjFtID7NTMhVmq29AnVesP9f1bHWAK9Mo6jlXG5mdJpPptihtn+3Y5WwMPTfkDcrlxmRy+aWwW3azp1PM8OglMwLhXV2VcdL1sIabQWUc0p65eSfFvAbIhyw1N9IYjZtEZdoHPNgOroL4Vdx48CJmb3ygUjhFOxp2/Rj0cRtbopvEvqayY46B2fgHQOqaahRNmQfLe2luaOkmfVC6WmQ6aQ8DYkrOeSaPrd1rQ=;25:Z6erV7WfLuwQfUtXQjdGM5FOMW3Obvif4/AfOyipt+FfX7wakmo+Lu7vAuL5qvYExQ+lpwnnYcQB2B0mIxhSTkDmt5qAFEWOC3NCUim2pHmHOYZf53B9ZR+wzCbbcifJjoaxs/saLtq0NbWCaIVW7zd1/sM2UyR6WQJL6ZnEmLfRN/cwRGYYCwevhLKcQWEKUH3ds8L36GshxAt1buMBsaiQSFkuX9rjvhqEqf/7BNfIXF6WFhAi3yH9RufZmqePRALgTnI7VU3K7Bb5ZX9jgF1AWvMs9aSi8cc0VxYBQiGLpFMgIq0ojVoA5YU+z3gcNg/431HucR0VX2VZUIaTJA== X-MS-TrafficTypeDiagnostic: SN2PR03MB2272: X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2272;31:TlugnoJFqU04CvtkPexwszeHe3uoMiXyz+JLYQ5N3NuF9yiVZTfr9GSqbCfXFvaJ2hHnLRtKVwpAl4GQ1vaVvGO0aFkEelteYQhYnsiJa4hzxTx+5XdNe0HEuuCVCYCmlX/WXgDzTl4ZojgLoPGw8fs9EBtGkLCQjgnw3RplO//5okAl1Luv4i3iIHhuL4nTDNJ6OZxPRuUrrLlatV7nVC+M11Ff2hKOOW49qUXbyp4=;4:Ug8qwNdeUwcaHHP/rBx6oJnTxI0K/vCW8bPw8jP7JoUGwyyqLUuiVeeE0g0FmhChCF2I4qVSAngecg3vUy46iKZlIdeNIzzJJUFsUvR1L70H7vfjC6BK3TqYfHS1ZR5dElu/rvU/++FCIGbaN4oWhY7XXurI5Czi0diu3jg65sBT7P3sQ3VqBeURLnhJtRprJ0eh0wP6ySphsZCKR37fCItX9Ui6m7l7hHMSN1vHG2nDpPawpQLUMj5K4UpGhelZ/GYIhuOT1MMZbHJrSgT+4ScHzEXApdMrSzqEEBGrq3MvS6TMsW1OYyXSGRG5mNUMaL6lNH0NRSs++9q7WlbrpA== 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)(8121501046)(5005006)(13016025)(13018025)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123561025)(20161123563025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN2PR03MB2272;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN2PR03MB2272; X-Forefront-PRVS: 04097B7F7F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR03MB2272;23:6pKNzG3D8Ug97+lyhxFnhdu7UUduiAv+ldbFV4jv4?= =?us-ascii?Q?mKHfY85B5MDQNECzr2eQIz5xperQoPiI3iqJPyc2IOfj1RGeLelqH0HgOJxA?= =?us-ascii?Q?gfV2Z6y5WqMzE4RU0Bm8ZC/yGRYO3V4ZGjuAUF7bkT69bTgsGmgGVBnGj5DN?= =?us-ascii?Q?QROi6SHEDTDEgIbK8vn+azoyaPyimnJcHlE42R35lqcVnsISZaH6NuvZrXEi?= =?us-ascii?Q?av9N2kG6aBViWtIezvWn4juV9ik9oZzkUtKjy+vwLKVHEShnnAiUG5eBVx0L?= =?us-ascii?Q?CwRS3piT5sI635S5eAvoNYseHXncctFiwJ5dx+dLt5gPc2T/D3QprvyPXV8a?= =?us-ascii?Q?cr89sfTQIcPlyEiFEZ7ZCBDY+7WcznT1pLTzEzQexWvdHF2WC+BHOPDNzVZe?= =?us-ascii?Q?yIjNR8TCAjMMOF6Yu3pkozOHXtKSfPDv+1dcyFhKnTWUyVCZ6uOhwcZb9B93?= =?us-ascii?Q?k1RA1eMeQAIFNu24FlULhorcp8Se/9zGiE0i/WEj5gKfVYVybGpcncHxOQER?= =?us-ascii?Q?+Vrgd0F9+GUeh4PXVfVi4JLFyjwMZK1MnVfAClPtVQTbhxYTjtvCkVI5HKhZ?= =?us-ascii?Q?STN6Po3twoVP7E/nKiLAz5DE1SZA3KmQhhryiHdSwEH+te8WQ4Tz04hDEEKY?= =?us-ascii?Q?/JGm2ivzW0q9lxmLulEtWLEUwAw8BvyvKK5DnymM9AJAJUur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NDPZ7N8rd4Rawt2NwxapuYk6iirUhR0IkCL6DbHPyNw8CqKdOPUBRFPktq5SoPvK9fDl6ZmJfT6cq1K0yirwQxCSkb2KisciruA==;24:eLeXTaV1YKJZ/pCK0xvg6lMxnqeQBpSB4XtYbH6lVANmZWvYUY62AsoDTGeAzpsVTx8mHbDKzQVI96n0NoX8KuRpgVUOMFfSpOMf2ziRymE=;7:hkf0ir3zPT+EoCPQLau10Jk6Qfezd7jTgZ6nz428RG/OyaKH+crNgQXC6ZvBf6lRvzJW6ZATSlc/hXeWp3yCDDq0Q3oYDFIwVHNjvb/fK2cUN6ryAqw50FKvStrrSdUooL0e4jAw/cM0jVmL5zpSWUwfol0F4P02T0cM0yNo4/b70hleOa2YLUMKhkfMbskF2YPUKya00XgzDC4FSHfXxfZzLERtIxRL4puaJeTZFzE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2017 20:38:00.6226 (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: SN2PR03MB2272 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2421 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 eaa9585..2182236 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 compatible 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_dbg(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