All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: fec: Avoid MX28 bus sync issue
Date: Mon, 15 Jul 2013 22:20:43 +0200	[thread overview]
Message-ID: <20130715222043.0e81e9f3@lilith> (raw)
In-Reply-To: <51E433EA.1070309@boundarydevices.com>

Hi Troy,

On Mon, 15 Jul 2013 10:39:54 -0700, Troy Kisky
<troy.kisky@boundarydevices.com> wrote:

> > Besides, Marek and I had in fact investigated barriers, adding some as
> > I did in times past in mvgbe.c, and fiddling with the one already in
> > dcache_flush_range(). None of this had any effect.
> 
> You tried adding a  dsb()  to dcache_flush_range()?
> That should have fixed the problem as well.

There already was a memory barrier -- the only one kind known bu
ARM926J-S, which is a write buffer(s) drain -- and no, it should not
have fixed the problem (and did not), because the issue is not about
pushing the transactions out of the CPU soon enough; it is about having
the EMI perform them before it passes our 'go' command to the ENET DMA.

> > However, if our barriers are lacking, then they may fail us somehow on
> > other occasions, so best is if we analyze the failings. Can you clarify
> > in what respect exactly they are lacking? For instance, are all our
> > barriers lacking, or only some, and which ones?
> >
> > Amicalement,
> 
> Linux has
> 
> Kconfig:config ARM_DMA_MEM_BUFFERABLE
> Kconfig-        bool "Use non-cacheable memory for DMA" if (CPU_V6 || 
> CPU_V6K) && !CPU_V7
> Kconfig-        depends on !(MACH_REALVIEW_PB1176 || REALVIEW_EB_ARM11MP 
> || \
> Kconfig-                     MACH_REALVIEW_PB11MP)
> Kconfig-        default y if CPU_V6 || CPU_V6K || CPU_V7
> Kconfig-        help
> 
> 
> So, if this symbol is y then all writel/readl will be preceded by a 
> dsb() as shown above.

While I do understand what is done there, I do not see the interest
since 1) in our issue, the problem was not in any writel() or readl(),
and 2) U-Boot uses readl() and writel() for device memory ranges, which
are not cached at all and thus do not need any flush, invalidate or
barrier.

> However, u-boot probably uses cacheable memory for dma, so maybe u-boot 
> is also correct with

Actually, in the driver where the issue occurred, U-boot does use
cacheable memory for DMA; that's why the driver contains calls to
flush_dcache_range() and invalidate_dcache_range() on the descriptors...

> asm/io.h-#define dmb()          __asm__ __volatile__ ("" : : : "memory")
> asm/io.h-#define __iormb()    dmb()
> asm/io.h:#define __iowmb()    dmb()
> 
> and no dsb(), but perhaps flush_dcache still needs one at the end.

... but that's for descriptors, which are not accessed uwing writel()
or readl(); for device registers, such as ENET, we use writel() and
readl() but no cache.

So far we never had to use any data memory barrier on peripheral
accesses. The worst that happened AFAIK is when we needed instruction
barriers to prevent the compiler from mis-ordering device writes wrt
their source code order; and at that time, our readl() and writel()
implementations were not volatile. Today, I am pretty sure that these
instruction barriers are uneeded.

> Troy

Amicalement,
-- 
Albert.

  parent reply	other threads:[~2013-07-15 20:20 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 23:03 [U-Boot] [PATCH] net: fec: Avoid MX28 bus sync issue Marek Vasut
2013-07-11 23:18 ` Fabio Estevam
2013-07-12  3:41   ` Alexandre Pereira da Silva
2013-07-12  3:51     ` Marek Vasut
2013-07-12 11:37       ` Hector Palacios
2013-07-12 11:39         ` Fabio Estevam
2013-07-12 12:01         ` Marek Vasut
2013-07-12 15:08           ` Hector Palacios
2013-07-12 15:50             ` Albert ARIBAUD
2013-07-12 16:48             ` Marek Vasut
2013-07-15  8:58               ` Hector Palacios
2013-07-15 12:30                 ` Marek Vasut
2013-07-15 15:09                   ` Hector Palacios
2013-07-15 15:12                     ` Marek Vasut
2013-07-15 15:24                       ` Hector Palacios
2013-07-16  3:51                     ` Fabio Estevam
2013-07-16  4:18                       ` Fabio Estevam
2013-07-16  4:44                         ` Marek Vasut
2013-07-17 15:55                           ` Hector Palacios
2013-07-18  4:12                             ` Marek Vasut
2013-09-12 10:22                             ` Hector Palacios
2013-09-12 10:50                               ` Marek Vasut
     [not found]                                 ` <52319DE8.5080607@digi.com>
2013-09-12 11:00                                   ` Marek Vasut
2013-09-12 11:02                                 ` Robert Hodaszi
2013-09-12 14:05                                   ` Marek Vasut
2013-09-12 14:15                                     ` Robert Hodaszi
2013-09-12 14:31                                       ` Marek Vasut
2013-09-12 14:32                                         ` Robert Hodaszi
2013-09-12 15:06                                           ` Marek Vasut
2013-09-12 18:17                                     ` Wolfgang Denk
2013-09-12 18:39                                       ` Fabio Estevam
2013-09-12 18:53                                         ` Wolfgang Denk
2013-09-12 19:37                                           ` Fabio Estevam
2013-09-13 11:11                                             ` Robert Hodaszi
2013-09-13 11:13                                               ` Robert Hodaszi
2013-09-13 14:01                                                 ` Marek Vasut
2013-09-13 14:24                                                   ` Robert Hodaszi
2013-09-13 16:06                                               ` Wolfgang Denk
2013-09-13 16:24                                                 ` Marek Vasut
2013-09-13 17:46                                                   ` Wolfgang Denk
2013-09-14 22:05                                                     ` Fabio Estevam
2013-09-12 11:08                                 ` Robert Hodaszi
2013-09-12 18:12                                   ` Wolfgang Denk
2013-09-12 17:50                               ` Wolfgang Denk
2013-07-13  2:43   ` Troy Kisky
2013-07-15 13:41     ` Albert ARIBAUD
2013-07-15 17:39       ` Troy Kisky
2013-07-15 19:59         ` Troy Kisky
2013-07-15 20:20           ` Albert ARIBAUD
2013-07-15 20:20         ` Albert ARIBAUD [this message]
2013-07-15 21:18           ` Troy Kisky
2013-07-12  5:57 ` Albert ARIBAUD
2013-07-12  6:39   ` Albert ARIBAUD
2013-07-12 11:51     ` Marek Vasut
2013-07-12  6:56   ` Stefano Babic
2013-07-12  7:30 ` Stefano Babic
2013-09-15 18:12 Oliver Metz
2013-09-15 18:16 ` Fabio Estevam

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=20130715222043.0e81e9f3@lilith \
    --to=albert.u.boot@aribaud.net \
    --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.