[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1492998299.25397.14.camel@buserror.net>
Date: Sun, 23 Apr 2017 20:44:59 -0500
From: Scott Wood <oss@...error.net>
To: roy.pledge@....com, linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
robin.murphy@....com
Cc: madalin.bucur@....com
Subject: Re: [PATCH v2 02/11] soc/fsl/qbman: Use shared-dma-pool for QMan
private memory allocations
On Wed, 2017-04-19 at 16:48 -0400, Roy Pledge wrote:
> @@ -727,10 +730,81 @@ 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);
> +#endif
Should probably warn if you get here on non-PPC rather than silently accepting
it.
> + } 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
> + */
This should be explicitly specified in the binding rather than here.
> + 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 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
> initialized
> + * and only ever accessed by the QMan device from now on
> + */
> + of_reserved_mem_device_release(dev);
s/reseverd/reserved/
> + }
> + dev_info(dev, "Allocated FQD 0x%llx 0x%zx\n", fqd_a, fqd_sz);
dev_dbg()?
-Scott
Powered by blists - more mailing lists