linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <oss@buserror.net>
To: roy.pledge@nxp.com, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, robin.murphy@arm.com
Cc: madalin.bucur@nxp.com
Subject: Re: [PATCH v2 02/11] soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Date: Sun, 23 Apr 2017 20:44:59 -0500	[thread overview]
Message-ID: <1492998299.25397.14.camel@buserror.net> (raw)
In-Reply-To: <1492634930-10765-3-git-send-email-roy.pledge@nxp.com>

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

  reply	other threads:[~2017-04-24  1:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 20:48 [PATCH v2 00/11] soc/fsl/qbman: Enable QBMan on ARM Platforms Roy Pledge
2017-04-19 20:48 ` [PATCH v2 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations Roy Pledge
2017-04-19 20:48 ` [PATCH v2 02/11] soc/fsl/qbman: Use shared-dma-pool for QMan " Roy Pledge
2017-04-24  1:44   ` Scott Wood [this message]
2017-04-19 20:48 ` [PATCH v2 03/11] dt-bindings: soc/fsl: Update reserved memory binding for QBMan Roy Pledge
2017-04-24  1:09   ` Scott Wood
2017-04-19 20:48 ` [PATCH v2 04/11] soc/fsl/qbman: Drop set/clear_bits usage Roy Pledge
2017-04-19 20:48 ` [PATCH v2 05/11] soc/fsl/qbman: Drop L1_CACHE_BYTES compile time check Roy Pledge
2017-04-19 20:48 ` [PATCH v2 06/11] soc/fsl/qbman: Fix ARM32 typo Roy Pledge
2017-04-19 20:48 ` [PATCH v2 07/11] soc/fsl/qbman: Rework ioremap() calls for ARM/PPC Roy Pledge
2017-04-24  1:47   ` Scott Wood
2017-05-01 19:00     ` Roy Pledge
2017-04-19 20:48 ` [PATCH v2 08/11] soc/fsl/qbman: add QMAN_REV32 Roy Pledge
2017-04-19 20:48 ` [PATCH v2 09/11] soc/fsl/qbman: different register offsets on ARM Roy Pledge
2017-04-19 20:48 ` [PATCH v2 10/11] soc/fsl/qbman: Add missing headers " Roy Pledge
2017-04-19 20:48 ` [PATCH v2 11/11] fsl/soc/qbman: Enable FSL_LAYERSCAPE config " Roy Pledge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492998299.25397.14.camel@buserror.net \
    --to=oss@buserror.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madalin.bucur@nxp.com \
    --cc=robin.murphy@arm.com \
    --cc=roy.pledge@nxp.com \
    --subject='Re: [PATCH v2 02/11] soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).