All of lore.kernel.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation
Date: Wed, 7 Oct 2015 18:33:17 +0100	[thread overview]
Message-ID: <20151007173317.GG2278@lukather> (raw)
In-Reply-To: <20151007135412.GB3320@vkoul-mobl.iind.intel.com>

Hi Vinod,

On Wed, Oct 07, 2015 at 02:54:13PM +0100, Vinod Koul wrote:
> On Thu, Oct 01, 2015 at 04:52:37PM +0200, Maxime Ripard wrote:
> 
> > +static struct at_desc *atc_create_memset_desc(struct dma_chan *chan,
> > +					      dma_addr_t psrc,
> > +					      dma_addr_t pdst,
> > +					      size_t len)
> > +{
> > +	struct at_dma_chan *atchan = to_at_dma_chan(chan);
> > +	struct at_desc *desc;
> > +	size_t xfer_count;
> > +
> > +	u32 ctrla = ATC_SRC_WIDTH(2) |
> > +		ATC_DST_WIDTH(2);
> 
> why is this over two lines :)
> 
> > +	u32 ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN |
> > +		ATC_SRC_ADDR_MODE_FIXED |
> > +		ATC_DST_ADDR_MODE_INCR |
> > +		ATC_FC_MEM2MEM;
> > +
> > +	xfer_count = len >> 2;
> > +	if (xfer_count > ATC_BTSIZE_MAX) {
> > +		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> > +			__func__);
> > +		return NULL;
> > +	}
> 
> This is fine, but this is driver limitation. We should really split the
> txn to multiple descriptors here..

Both these things are actually just copy from the previous code.

I can probably fix the first style issue in this patch, but splitting
the memset descriptors should go in a separate patch.

> 
> > @@ -914,46 +953,26 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
> >  		return NULL;
> >  	}
> >  
> > -	xfer_count = len >> 2;
> > -	if (xfer_count > ATC_BTSIZE_MAX) {
> > -		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> > +	vaddr = dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr);
> 
> Mostly people use _zalloc variant, any reason why you don't want that

Not necessarily, but I don't need zeroed memory either, since I
overwrite the content right after the allocation.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151007/77353878/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Vinod Koul <vinod.koul@intel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Ludovic Desroches <ludovic.desroches@atmel.com>,
	Cyrille Pitchen <cyrille.pitchen@atmel.com>
Subject: Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation
Date: Wed, 7 Oct 2015 18:33:17 +0100	[thread overview]
Message-ID: <20151007173317.GG2278@lukather> (raw)
In-Reply-To: <20151007135412.GB3320@vkoul-mobl.iind.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1851 bytes --]

Hi Vinod,

On Wed, Oct 07, 2015 at 02:54:13PM +0100, Vinod Koul wrote:
> On Thu, Oct 01, 2015 at 04:52:37PM +0200, Maxime Ripard wrote:
> 
> > +static struct at_desc *atc_create_memset_desc(struct dma_chan *chan,
> > +					      dma_addr_t psrc,
> > +					      dma_addr_t pdst,
> > +					      size_t len)
> > +{
> > +	struct at_dma_chan *atchan = to_at_dma_chan(chan);
> > +	struct at_desc *desc;
> > +	size_t xfer_count;
> > +
> > +	u32 ctrla = ATC_SRC_WIDTH(2) |
> > +		ATC_DST_WIDTH(2);
> 
> why is this over two lines :)
> 
> > +	u32 ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN |
> > +		ATC_SRC_ADDR_MODE_FIXED |
> > +		ATC_DST_ADDR_MODE_INCR |
> > +		ATC_FC_MEM2MEM;
> > +
> > +	xfer_count = len >> 2;
> > +	if (xfer_count > ATC_BTSIZE_MAX) {
> > +		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> > +			__func__);
> > +		return NULL;
> > +	}
> 
> This is fine, but this is driver limitation. We should really split the
> txn to multiple descriptors here..

Both these things are actually just copy from the previous code.

I can probably fix the first style issue in this patch, but splitting
the memset descriptors should go in a separate patch.

> 
> > @@ -914,46 +953,26 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
> >  		return NULL;
> >  	}
> >  
> > -	xfer_count = len >> 2;
> > -	if (xfer_count > ATC_BTSIZE_MAX) {
> > -		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> > +	vaddr = dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr);
> 
> Mostly people use _zalloc variant, any reason why you don't want that

Not necessarily, but I don't need zeroed memory either, since I
overwrite the content right after the allocation.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-10-07 17:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 14:52 [PATCH 0/2] dmaengine: hdmac: Add scatter-gathered memset support Maxime Ripard
2015-10-01 14:52 ` Maxime Ripard
2015-10-01 14:52 ` [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation Maxime Ripard
2015-10-01 14:52   ` Maxime Ripard
2015-10-07 13:54   ` Vinod Koul
2015-10-07 13:54     ` Vinod Koul
2015-10-07 17:33     ` Maxime Ripard [this message]
2015-10-07 17:33       ` Maxime Ripard
2015-10-09 15:29       ` Vinod Koul
2015-10-09 15:29         ` Vinod Koul
2015-10-01 14:52 ` [PATCH 2/2] dmaengine: hdmac: Add scatter-gathered memset support Maxime Ripard
2015-10-01 14:52   ` Maxime Ripard

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=20151007173317.GG2278@lukather \
    --to=maxime.ripard@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.