From patchwork Wed Mar 29 21:13:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Pledge X-Patchwork-Id: 9652617 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 BEA6F602C8 for ; Wed, 29 Mar 2017 21:15:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFFE02855E for ; Wed, 29 Mar 2017 21:15:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A494328567; Wed, 29 Mar 2017 21:15:18 +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=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID 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 EB4E12855E for ; Wed, 29 Mar 2017 21:15:17 +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=QlOQMM5KxRoaCKR3/fxBQqYxC9QVlhqqHv+2mFPNWBc=; b=hkXfFGxkjsnKjY sg5yrTqzUE8Xyz/JR8wrxWKlmQQclE0uWn8DTSuTaCrOthdzWKpHfwo6o9+vaWE++t7+fAIkoW1mr zw9bOQe/dv1lH+tcGHv0XO4F3LIVpJzcTd7511qCncjhppLnhM1k9djQK4+BV7mMbJXp9637fUGWk fi7SDEvaYPXp+CkQ76B4Bd9BijENSwIM7o+nRw76ZbV0zxDVOlsG3iWHfVYTrBOndIMJEidrUpuHn 7SeIYcu5ZJcGBhwVEf5qT93/x0PuV4D3sA1yoF0VbDnGgIwD3s/JSAbG4kY7lKnVVyvTykIG+fplO oE8aOsd8XkwlRjAHT+lQ==; 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 1ctKw1-0005Vz-D4; Wed, 29 Mar 2017 21:15:17 +0000 Received: from mail-co1nam03on0043.outbound.protection.outlook.com ([104.47.40.43] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctKvC-0003Kq-1J for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2017 21:14:27 +0000 Received: from BY2PR03CA071.namprd03.prod.outlook.com (10.141.249.44) by BN3PR03MB2355.namprd03.prod.outlook.com (10.166.74.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.2; Wed, 29 Mar 2017 21:14:03 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::141) by BY2PR03CA071.outlook.office365.com (2a01:111:e400:2c5d::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10 via Frontend Transport; Wed, 29 Mar 2017 21:14:02 +0000 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; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Wed, 29 Mar 2017 21:14:02 +0000 Received: from otc-sw1.am.freescale.net (otc-sw1.am.freescale.net [10.29.200.182]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v2TLDwW4032154; Wed, 29 Mar 2017 14:14:00 -0700 From: Roy Pledge To: , , , , Subject: [RFC PATCH 2/5] soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations Date: Wed, 29 Mar 2017 17:13:54 -0400 Message-ID: <1490822037-6752-3-git-send-email-roy.pledge@nxp.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1490822037-6752-1-git-send-email-roy.pledge@nxp.com> References: <1490822037-6752-1-git-send-email-roy.pledge@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131352956427482955; (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)(39410400002)(39860400002)(39840400002)(39450400003)(39400400002)(39380400002)(39850400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(43066003)(54906002)(8656002)(77096006)(53936002)(305945005)(104016004)(5003940100001)(356003)(6666003)(2950100002)(36756003)(4720700003)(47776003)(86362001)(2201001)(85426001)(230783001)(189998001)(2906002)(105606002)(4326008)(106466001)(33646002)(8936002)(50226002)(38730400002)(8676002)(48376002)(50986999)(5660300001)(81156014)(81166006)(50466002)(76176999)(3450700001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2355; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD048; 1:K0zxo0OD/ev1yp3IakF5i09zVJnQgZU6A2VXihn0kz8KTzD0C4xYKwAwTyyArmwbArilGxEgHkfp1v+A3cohsBBoZTzq7hPA0vxedZno94vu0GBL6MgeXOPny33pCzEpvI5dpagW+LMhD1bcwXTvcP2+5w/Lk/yMGZ3FZ9KJYo6OksQ9u/GSWYzO+GZv/CD1l+omO4EZ8juAYoRBTx8q2psG6WX59Ih9hbe/cZdmvwL5tDIuWoU65XxImlLo6O9oxLx6tzIBFn2odfXo7C/lkuauohQ+bYX1iere0c1XmXGDSmT8HmnEPZpzKyDbQAjO7U8Nm4CIQg+uyEA0RpWCGU+64rnun2G5IKx01E1aLbhOS7o5fJqy/evLNrGzJU1ny/j5fUO55wMgSyDdW4dqSfWasCFMsxXZi8ZAZFhE1G3Px85xiY5VUIs6FW//os6r1Ut1YpcylZjcvh7+tx+3P3d++Q/jg6FtOfX0jnoH8f8nF2yiha6fWJ2AIg7iN8hLNrL+WT6IMiRv6u0vMWUJUGqF4z46QovVZkoHth/eKKdrIbtkqWLEPjtp4Rn20Sxu17Yue1WTqfeXm5pB6bUNpU9v0hJf1sUbzpXP6I7cYCVjIhx6Hceubt5oNLBkYpVvP7brNNyodwyvZslccq+05AB/apgju01aGsadqXmMR2Y6NbXW9JHc2EdfDNLjwNxqZWiqMEvqY+E5aXVRWoXn9ir7limjoA0bFKkQ11CjjcE= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 8988cad2-cdd8-4a29-55ec-08d476e88683 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030255075)(201703131430075)(201703131517081); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 3:YA/ehrLXfi+l6qV5nzZ2Flq0NfEwoN21L2cO8/qnrcUBe/+BCF4qzzCDX8y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1hIoyaHULmAoWiBgdYSB2IauDLSb/Y0iTq1lq+ZoTue/9J9XmrTO9E1peAllmRF8Ux8wVzJgSAMKnGTrSWCpPfUc+NXOzxYzs10afP89byGoh6BH4wWndpPjBERU5icTn0Fduj34tt8Bp4eo9Dc5eo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13024025)(13018025)(13023025)(13015025)(5005006)(13017025)(8121501046)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(201703151042075)(20161123565025); SRVR:BN3PR03MB2355; BCL:0; PCL:0; RULEID:(400006); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 4:LXzA2zSyXYr2RU6rXyW5wgXAbDX1T/Lr6HgEL+DoeueEFTy6qcUvV8E0sJRMEHu7nNDLhj3DRRxlWVa9qLIsldOHv0P34QVJuTgXNoOmUmPE0Sqwz0B8DdiJkdWMZm1uCk2WxKkMbLctHlV7f9jM8Zf4MHS+8GGUM+BqqA+1E+oWPWULjmD7iIhOCaDNcbyXXVMY0Iy6QRjV9uff+Zg15ln8B3fbR3zHVgwsKyk78cZ/viM9ghf3QGydj8VUpkL0TxpPUvtj+t8IqaOJdXhXkFZLvonMcKx/4mDnqCJpfwvLj44Z4ZtknfsXrXxksPIXlWHv2P2HePXyJJZ9Wg6Wv2B9fy+rG4PWToRySCQzTHKNgOj5Mqz/7XHJ8vZIDEkKlPp9y+l8ZvOrHsUa8/7/nW7tkoliYgeGXAp4PciG2gAl1VWw6OmrGn+/VDxw8/sv1T8HO0VBaJZhGNV1F/h/Lg2qeOGswFlbyS5xWvqi5qWhiDHkEsqJTMyS4zbhr2pF70c7oh3L7xthxZDPJhzgVWqP35HbW7GhdpId/+OFwoRnpQ9MgUrldAz4NBuZ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Qu5129jDe7BBoCkOu/Nj0fAAn8BL6Fkw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2017 21:14:02.5142 (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: BN3PR03MB2355 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170329_141426_226014_2EBFC08C X-CRM114-Status: GOOD ( 16.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: Roy Pledge , madalin.bucur@nxp.com 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 frame queue descriptor and packed frame descriptor record area allocations. Signed-off-by: Roy Pledge --- drivers/soc/fsl/qbman/qman_ccsr.c | 119 +++++++++++++++++++++----------------- drivers/soc/fsl/qbman/qman_priv.h | 4 +- drivers/soc/fsl/qbman/qman_test.h | 2 - 3 files changed, 68 insertions(+), 57 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c index 90bc40c..35c59ca 100644 --- a/drivers/soc/fsl/qbman/qman_ccsr.c +++ b/drivers/soc/fsl/qbman/qman_ccsr.c @@ -400,63 +400,19 @@ static int qm_init_pfdr(struct device *dev, u32 pfdr_start, u32 num) return -ENODEV; } -/* - * Ideally we would use the DMA API to turn rmem->base into a DMA address - * (especially if iommu translations ever get involved). Unfortunately, the - * DMA API currently does not allow mapping anything that is not backed with - * a struct page. - */ +/* QMan needs two global memory areas initialized at boot time: + 1) FQD: Frame Queue Descriptors used to manage frame queues + 2) PFDR: Packed Frame Queue Descriptor Records used to store frames + Both areas are reserved using the device tree reserved memory framework + and the addresses and sizes are initialized when the QMan device is probed */ static dma_addr_t fqd_a, pfdr_a; static size_t fqd_sz, pfdr_sz; -static int qman_fqd(struct reserved_mem *rmem) -{ - fqd_a = rmem->base; - fqd_sz = rmem->size; - - WARN_ON(!(fqd_a && fqd_sz)); - - return 0; -} -RESERVEDMEM_OF_DECLARE(qman_fqd, "fsl,qman-fqd", qman_fqd); - -static int qman_pfdr(struct reserved_mem *rmem) -{ - pfdr_a = rmem->base; - pfdr_sz = rmem->size; - - WARN_ON(!(pfdr_a && pfdr_sz)); - - return 0; -} -RESERVEDMEM_OF_DECLARE(qman_pfdr, "fsl,qman-pfdr", qman_pfdr); - static unsigned int qm_get_fqid_maxcnt(void) { return fqd_sz / 64; } -/* - * Flush this memory range from data cache so that QMAN originated - * transactions for this memory region could be marked non-coherent. - */ -static int zero_priv_mem(struct device *dev, struct device_node *node, - phys_addr_t addr, size_t sz) -{ - /* map as cacheable, non-guarded */ - void __iomem *tmpp = ioremap_prot(addr, sz, 0); - - if (!tmpp) - return -ENOMEM; - - memset_io(tmpp, 0, sz); - flush_dcache_range((unsigned long)tmpp, - (unsigned long)tmpp + sz); - iounmap(tmpp); - - return 0; -} - static void log_edata_bits(struct device *dev, u32 bit_count) { u32 i, j, mask = 0xffffffff; @@ -687,11 +643,12 @@ static int qman_resource_init(struct device *dev) static int fsl_qman_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *mem_node, *node = dev->of_node; struct resource *res; int ret, err_irq; u16 id; u8 major, minor; + u64 size; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -727,10 +684,66 @@ static int fsl_qman_probe(struct platform_device *pdev) qm_channel_caam = QMAN_CHANNEL_CAAM_REV3; } - ret = zero_priv_mem(dev, node, fqd_a, fqd_sz); - WARN_ON(ret); - if (ret) + /* Order of memory regions is assumed as FQD followed by PFDR + in order to ensure allocations from the correct regions the + driver initializes then allocates each piece in order */ + + ret = of_reserved_mem_device_init_by_idx(dev, dev->of_node, 0); + if (ret) { + dev_err(dev, "of_reserved_mem_device_init_by_idx(0) 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, "FQD: of_address_to_resource fails 0x%x\n", ret); + return -ENODEV; + } + fqd_sz = size; + } else { + dev_err(dev, "No memory-region found for FQD\n"); + return -ENODEV; + } + if (!dma_zalloc_coherent(dev, fqd_sz, &fqd_a, 0)) { + dev_err(dev, "Alloc FQD memory failed\n"); + return -ENODEV; + } + + dev_info(dev, "Allocated FQD 0x%llx 0x%zx\n", fqd_a, fqd_sz); + + /* Disassociate the FQD reseverd memory area from the device because + a device can only have one DMA memory area. This should be fine + since the memory is allocated and initalized and only ever accessed + by the QMan device from now on */ + of_reserved_mem_device_release(dev); + + /* Setup PFDR memory */ + ret = of_reserved_mem_device_init_by_idx(dev, dev->of_node, 1); + if (ret) { + dev_err(dev, "of_reserved_mem_device_init(1) failed 0x%x\n", + ret); + return -ENODEV; + } + mem_node = of_parse_phandle(dev->of_node, "memory-region", 1); + if (mem_node) { + ret = of_property_read_u64(mem_node, "size", &size); + if (ret) { + dev_err(dev, "PFDR: of_address_to_resource fails 0x%x\n", ret); + return -ENODEV; + } + pfdr_sz = size; + } else { + dev_err(dev, "No memory-region found for PFDR\n"); + return -ENODEV; + } + if (!dma_zalloc_coherent(dev, pfdr_sz, &pfdr_a, 0)) { + dev_err(dev, "Alloc PFDR Failed size 0x%zx\n", pfdr_sz); return -ENODEV; + } + + dev_info(dev, "Allocated PFDR 0x%llx 0x%zx\n", pfdr_a, pfdr_sz); ret = qman_init_ccsr(dev); if (ret) { diff --git a/drivers/soc/fsl/qbman/qman_priv.h b/drivers/soc/fsl/qbman/qman_priv.h index 22725bd..1e998ea5 100644 --- a/drivers/soc/fsl/qbman/qman_priv.h +++ b/drivers/soc/fsl/qbman/qman_priv.h @@ -28,12 +28,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - #include "dpaa_sys.h" #include #include +#include +#include #if defined(CONFIG_FSL_PAMU) #include diff --git a/drivers/soc/fsl/qbman/qman_test.h b/drivers/soc/fsl/qbman/qman_test.h index d5f8cb2..41bdbc48 100644 --- a/drivers/soc/fsl/qbman/qman_test.h +++ b/drivers/soc/fsl/qbman/qman_test.h @@ -30,7 +30,5 @@ #include "qman_priv.h" -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - int qman_test_stash(void); int qman_test_api(void);