All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karl Beldan <kbeldan@baylibre.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] net: davinci_emac: Round up top buffer boundaries for dcache ops
Date: Mon, 15 Aug 2016 16:47:40 +0000	[thread overview]
Message-ID: <20160815164740.GA4949@gobelin> (raw)
In-Reply-To: <20160814194356.GA17632@gobelin>

On Sun, Aug 14, 2016 at 07:43:56PM +0000, Karl Beldan wrote:
> On Sun, Aug 14, 2016 at 11:47:25AM -0400, Tom Rini wrote:
> > On Sun, Aug 14, 2016 at 03:03:16PM +0000, Karl Beldan wrote:
> > 
> > > check_cache_range() warns that the top boundaries are not properly
> > > aligned while flushing and invalidating the buffers and make these
> > > operations to fail.
> > > ATM the RX bottom boundaries are aligned by design with EMAC_RXBUF_SIZE,
> > > properly aligned with ARCH_DMA_MINALIGN, however the top ones are not.
> > > 
> > > This gets rid of the warnings:
> > > CACHE: Misaligned operation at range
> > > 
> > > Signed-off-by: Karl Beldan <karl.beldan+oss@gmail.com>
> > > ---
> > >  drivers/net/davinci_emac.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
> > > index 947bfab..55461b0 100644
> > > --- a/drivers/net/davinci_emac.c
> > > +++ b/drivers/net/davinci_emac.c
> > > @@ -632,7 +632,8 @@ static int davinci_eth_send_packet (struct eth_device *dev,
> > >  				      EMAC_CPPI_EOP_BIT);
> > >  
> > >  	flush_dcache_range((unsigned long)packet,
> > > -			(unsigned long)packet + length);
> > > +			   round_up((unsigned long)packet + length,
> > > +				    ARCH_DMA_MINALIGN));
> > 
> > It's preferred to use:
> >                         (unsigned long)packet + ALIGN(length, PKTALIGN)); 
> > here instead of ARCH_DMA_MINALIGN.
> > 
> 
> Hmm, I think your suggestion is buggy.
> The cache primitives act on [laddr, haddr[, i.e. haddr is excluded, IOW
> you are missing the tail of the packet (that's why I rounded up).
> 

Just checked, your ALIGN macro also rounds up so your suggestion is not
buggy, my bad.

> Conceptually I still prefer ARCH_DMA_MINALIGN, also all other code in
> the base does so.
> 

Your suggestion is seconded by Joe, I'll send v2.

Rgds, 
Karl

  parent reply	other threads:[~2016-08-15 16:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14 15:03 [U-Boot] [PATCH 1/3] net: davinci_emac: Remove useless dcache ops on descriptors Karl Beldan
2016-08-14 15:03 ` [U-Boot] [PATCH 2/3] net: davinci_emac: Round up top buffer boundaries for dcache ops Karl Beldan
2016-08-14 15:47   ` Tom Rini
2016-08-14 19:43     ` Karl Beldan
2016-08-14 21:36       ` Tom Rini
2016-08-15 16:47       ` Karl Beldan [this message]
2016-08-15 16:06     ` Joe Hershberger
2016-08-14 15:03 ` [U-Boot] [PATCH 3/3] net: davinci_emac: Invalidate only the received portion of a buffer Karl Beldan
2016-08-15 16:09   ` Joe Hershberger
2016-08-14 15:47 ` [U-Boot] [PATCH 1/3] net: davinci_emac: Remove useless dcache ops on descriptors Tom Rini
2016-08-15 16:05 ` Joe Hershberger
2016-08-23  2:28 ` [U-Boot] " Joe Hershberger

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=20160815164740.GA4949@gobelin \
    --to=kbeldan@baylibre.com \
    --cc=u-boot@lists.denx.de \
    /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.