[U-Boot] Please pull last-minute fixes for ARC

Alexey Brodkin Alexey.Brodkin at synopsys.com
Tue Mar 31 18:08:59 CEST 2020

Hi Tom,

The following changes since commit 93330d4ce416208fe202e304e5a18166c57ac569:

  Prepare v2020.04-rc4 (2020-03-30 19:29:27 -0400)

are available in the Git repository at:

  git at gitlab.denx.de:u-boot/custodians/u-boot-arc.git tags/arc-last-minute-fixes-for-2020.04

for you to fetch changes up to 45bd649511155b5b5a40851ca96036636cb95e23:

  ARC: IO: add MB for __raw_* memory accessors (2020-03-31 18:31:53 +0300)

This last minute pull-request is intended to fix some drivers
when used on ARC boards. The problem was introduced by

What happened while doing one pretty simple improvement to make
U-Boot port more flexible and portable (by switching accessors from
assembly-written to plain C version) we implicitly added 2 problems:

 1. Downgraded accessors from being volatile which signalled to
    the compiler that it's now possible to do all kinds of optimizations
    which may easily include merge of subsequent byte reads/writes into
    word operations. Which is OK for accessing mormal memory but
    breaks operation of peripherals if we access its memory-mapped regs
    in such a "creative" manner.
 2. As a part of assembly-written implementation we had compiler barriers
    in form of the following construction 'asm volatile("" : : : "memory")',
    and we dropped it in C implemntation. This in its turn enabled compiler
    to mess with instruction ordering. Guess what it gives us in the end :)

So with all that we had in some corner-cases veeery funny instruction flows
generated. And in particular it broke DW SPI functionality when we were
writing large amount of data. Funny enough our tests which were writing
small amount of data still worked and only by the chance we caught that
breakage and unrolled that quite interesting loop of unexpected

The road to hell is paved with good intentions. Amen :)

Eugeniy Paltsev (3):
      ARC: IO: add volatile to accessors
      ARC: IO: add compiler barriers to IO accessors
      ARC: IO: add MB for __raw_* memory accessors

 arch/arc/include/asm/io.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 59 insertions(+), 33 deletions(-)


More information about the U-Boot mailing list