From patchwork Mon May 1 21:30:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Pledge X-Patchwork-Id: 9707027 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 106D4602B5 for ; Mon, 1 May 2017 21:40:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F30F42815E for ; Mon, 1 May 2017 21:40:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7AEB28174; Mon, 1 May 2017 21:40:33 +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 467CD2815E for ; Mon, 1 May 2017 21:40:33 +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=aBEP+HHbnza9hbNC87PPBE7BIWb4WffXwr9hraDj698=; b=BJiOP8yTwt9Jdj IJepzNVCEma84G+JGnsak65vRC+GIkBSz1j1I+nceKv6CmuwB+UkKZs2fh/jLEV+hoy1KUX2F6ij1 EkTQCH6LXWVqJdfHo8jHUDHYN++n+rEFZdkaaExT0dRLvxAEDE5nI8+Xi/q4Uth08ki7nJQO2ZHQj 4dwfpv4uK3qbNTsQ7daJvC3gSXdJt32nQopqUGtRLd91BKtZQlSnuLynFy10aea2rI+Ozl9Fk6chZ nnD0y1gYwEruzQ13kCKapAt5ipbqNMEhfF7dbcsIjYZiOIuJ4wspUoPsS5+RFgto7uodSvVoXHQCa G8pawka8/Fgm0slserhw==; 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 1d5J3W-0007Yn-DB; Mon, 01 May 2017 21:40:30 +0000 Received: from mail-co1nam03on0070.outbound.protection.outlook.com ([104.47.40.70] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5Iu4-0001X9-7b for linux-arm-kernel@lists.infradead.org; Mon, 01 May 2017 21:30:46 +0000 Received: from CY1PR03CA0002.namprd03.prod.outlook.com (10.174.128.12) by BY1PR0301MB0904.namprd03.prod.outlook.com (10.160.195.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Mon, 1 May 2017 21:30:20 +0000 Received: from BL2FFO11FD032.protection.gbl (2a01:111:f400:7c09::194) by CY1PR03CA0002.outlook.office365.com (2603:10b6:600::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12 via Frontend Transport; Mon, 1 May 2017 21:30:20 +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 BL2FFO11FD032.mail.protection.outlook.com (10.173.160.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1047.9 via Frontend Transport; Mon, 1 May 2017 21:30:19 +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 v41LUGrY009537; Mon, 1 May 2017 14:30:18 -0700 From: Roy Pledge To: , , , , Subject: [PATCH v3 02/11] soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations Date: Mon, 1 May 2017 17:30:04 -0400 Message-ID: <1493674213-963-3-git-send-email-roy.pledge@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493674213-963-1-git-send-email-roy.pledge@nxp.com> References: <1493674213-963-1-git-send-email-roy.pledge@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131381478197350079; (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)(39400400002)(39380400002)(39410400002)(39850400002)(39860400002)(39840400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(81156014)(8936002)(81166006)(106466001)(33646002)(50226002)(105606002)(85426001)(8656002)(8676002)(38730400002)(2950100002)(6666003)(36756003)(356003)(230783001)(47776003)(5003940100001)(54906002)(3450700001)(50466002)(76176999)(48376002)(5660300001)(498600001)(189998001)(50986999)(2906002)(43066003)(53936002)(4326008)(86362001)(77096006)(2201001)(104016004)(305945005)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB0904; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD032; 1:MLfVdoPDKZcyz8vmacbymVWv4Wrmoj8zHNB5QtovuPkDLy7rIwjtQJv5sLE1F7n70KRJpGYHAhcEL/Fjq9SdUmr7mr4aJ9ovEbZVLoH9z3rtg+B4kJZIUDocPkqQMxYcZstQyyrcOVVA7Fg1dqpamII/2YwLQGCtJB0WcsYnyFRuNeUjcPVGkyBOQUODdD3ZTOtd2ii4L/vlPCXwr3HgqYi1ndbuVxPuka9sFhR8PnTXlrzC3GLdYrBWfCYEMcVkBPU4PWXn16d0plkT6/Ywz9XIRpy2Y2DGjLpQnstwztKT02n2e5HlXzP1xTGTY4HHyOTFTwC7YMafZfI6DmoQvM9q2kZMW6dva+HBIG6HBlqQmtH4aHTgdQaFSTr9IcBJwxVmvv1wuK4E0QjBWvkxLSdJ67pEV9sxPp+cQXcMuKoP+cTdOK6eOrNcPeyDXdP4XPR62w0cl6XVaICC7bTXS7gIb0v2RL+oHjC4BpCdnirGelujF+GKyVk11DpwBBgiWYY42YUNeqEUoP1sZcYmstAkeQbR7zDWVnPhi9lXo8wFftcB+2IrlN0Qv/Uz9EzPVaGf9zzVwr03o9t7XQhXy33hho2IMdt5/65Uuooq1neH+AQc+CB5hKcO3i2OfhD0Awp/68aeAbd5aCpcqJLJwYcwcvl+DOEXfSjCm+MgaYiSutr8Qyo2mOzIzFkwTTFfW/nn5ut6WK1J/SPqpqjOX3lXTFrVG8v/hSNaLoQt46uJsQnA9aKJDrEugL7tXDXI MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 91de37e2-ff00-4216-6d5f-08d490d94479 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BY1PR0301MB0904; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0904; 3:4KI5J8vFZ7GrLsEGFV27br2iOI1j32piXuKnv2ICnCli700wB23kGXrPys//V+XC+vnK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9qPMzFNws4v5gYUGrKLHp29Fy4027vRVIwH19/CWuwc9oWgWuRLjtbgUdVnQRxRXRV85wF3n6Sd1tPp0b2y2HvHXutjTotLupxfXLTpMrGXsNjPOJCzxL2ITah94+b0/6WE40SW9U= 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)(13023025)(13024025)(13018025)(13015025)(13017025)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(20161123565025)(20161123561025)(20161123556025); SRVR:BY1PR0301MB0904; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR0301MB0904; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0904; 4:npC73PFRgiNbKmn3lBKfQk9yIFDr+REEjiUSa2mMEHULHoODko1Gn0Ib7hKHm5UswpAYxF5ctyX27bJbAawOCgWXGzlkz4FPjr+efMF51aKoeRHXuoupxbEONghMk60BrVZ9zUGhyLLgjXQO8jQrhJqk4jkwvOhJwUUCHdGlulhKyj0ZvEYsHHt/TWVB7tFYQwbtlitutNNq5u45T09c628GcePghzzbv7pV8j1nK9Mw1j8hpQq1AE5WtGjCT2NojCj8vZ5wDU84IYI57O35llvAR7FMZHh1RthFEaJEO6ohUkSMcpXRtYrDx4X0RtLeqqjlKvZYjeyKgZx+0270BGYFbvYG6/yAUHSWE7U4Wg33dK8d/K422MI8ScFKwTrM8M6hps/SaZ+RUk6ugyyrbuoj6EnnyvlFg7vSMyKEOlcTK88ywGKHLuMVTRV333I7txrmAtaWcJu8N97DrFhCxSqeohYS+hgwrYz0Qq34XSZJyYkNEcY95wuBaW3dDCxDG5XpEFYe79n3unb0m997VexFLUoUMg2Eap3ujjvbPoJaP1sv68BSMT82YkTP2RkoUDbgM4mvCSqylVhxSai0qQfxbJrYGjkpTfV6sYVKjRfEwSV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q8fw1gEOQ9jDK6CJWy4OWAmrmcyphT2SoaxEIMbqTU11UREzoojRyBTY9Oo+74XyeQnyHeY8TttS8A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2017 21:30:19.5010 (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: BY1PR0301MB0904 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170501_143044_486093_828E12F7 X-CRM114-Status: GOOD ( 19.23 ) 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@nxp.com, 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 | 138 +++++++++++++++++++++++++++++--------- drivers/soc/fsl/qbman/qman_priv.h | 4 +- drivers/soc/fsl/qbman/qman_test.h | 2 - 3 files changed, 109 insertions(+), 35 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c index 90bc40c..17a4aaa 100644 --- a/drivers/soc/fsl/qbman/qman_ccsr.c +++ b/drivers/soc/fsl/qbman/qman_ccsr.c @@ -401,21 +401,42 @@ static int qm_init_pfdr(struct device *dev, u32 pfdr_start, u32 num) } /* - * 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; +#ifdef CONFIG_PPC +/* + * Support for PPC Device Tree backward compatibility when compatiable + * string is set to fsl-qman-fqd and fsl-qman-pfdr + */ +static int zero_priv_mem(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 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); @@ -431,32 +452,13 @@ static int qman_pfdr(struct reserved_mem *rmem) } RESERVEDMEM_OF_DECLARE(qman_pfdr, "fsl,qman-pfdr", qman_pfdr); +#endif + 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 +689,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 +730,83 @@ 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) - return -ENODEV; + if (fqd_a) { +#ifdef CONFIG_PPC + /* + * For PPC backward DT compatibility + * FQD memory MUST be zero'd by software + */ + zero_priv_mem(fqd_a, fqd_sz); +#else + WARN(1, "Unexpected archiceture using non shared-dma-mem reservations"); +#endif + } else { + /* + * 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; + } + + /* + * Disassociate the FQD reserved 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 initialized + * and only ever accessed by the QMan device from now on + */ + of_reserved_mem_device_release(dev); + } + dev_dbg(dev, "Allocated FQD 0x%llx 0x%zx\n", fqd_a, fqd_sz); + + if (!pfdr_a) { + /* 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);