From patchwork Thu Aug 24 20:37:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Pledge X-Patchwork-Id: 9920933 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 E9720603FA for ; Thu, 24 Aug 2017 20:41:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCF0228C62 for ; Thu, 24 Aug 2017 20:41:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D180D28C67; Thu, 24 Aug 2017 20:41:00 +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 F0F8128C62 for ; Thu, 24 Aug 2017 20:40:58 +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=lLhkpii0q8zhKnk1HbXsqZv6etVmwvgc4XA+ked1hSA=; b=qVYQcW/7YtcVIJ W5oTNW4MdcviAUl150WnfuUxfslDahSPQcdz9QUfcSafIYCKSjwR9THQ/BfaXGTVRKuFTdTT4QnM2 wmwZofVfo6WWoxESnJJUMtSMNiiyH2JCwHl6WFJZ/ZATejGgKJcjaC8VBYqIFG/dGjLf+A3FgkeyF BeMTKDmjLirZ9Rg3zelEjsSWFqVEFGl8wuZ5pwjFsdBe1/Ng58vbLy6otVcBTrpjVB9ddSnOfBRz0 bkZxeM94s7/gF26g8pbQs/uYHKAgApgjABU99Dal9xL1cGmptuvEBTFS6icdmw29mQcdseLMlG1Ek 39+Bkj+TvY23skQc98KQ==; 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 1dkyuw-00051n-If; Thu, 24 Aug 2017 20:39:54 +0000 Received: from mail-cys01nam02on0083.outbound.protection.outlook.com ([104.47.37.83] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dkytf-0003WN-6R for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2017 20:38:39 +0000 Received: from CY1PR03CA0021.namprd03.prod.outlook.com (2603:10b6:600::31) by SN2PR03MB2272.namprd03.prod.outlook.com (2603:10b6:804:d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Thu, 24 Aug 2017 20:38:00 +0000 Received: from BL2FFO11OLC011.protection.gbl (2a01:111:f400:7c09::107) by CY1PR03CA0021.outlook.office365.com (2603:10b6:600::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9 via Frontend Transport; Thu, 24 Aug 2017 20:38:00 +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 BL2FFO11OLC011.mail.protection.outlook.com (10.173.160.157) 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:00 +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 v7OKbv0i004767; Thu, 24 Aug 2017 13:37:58 -0700 From: Roy Pledge To: , , , 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> 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 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?/JGm2ivzW0q9lxmLulEtWLEUwAw8BvyvKK5DnymM9AJ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h2unlek7NDPZ7N8rd4Rawt2NwxapuYk6iirUhR0IkCL6DbHPyNw8CqKdOPUBRFPktq5SoPvK9fDl6ZmJfT6cq1K0yirwQxCSkb2KisciruA==; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170824_133835_409954_E55EB1DF X-CRM114-Status: GOOD ( 13.84 ) 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 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) */