lkml.org 
[lkml]   [2014]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 00/17] Cross-architecture definitions of relaxed MMIO accessors
On Thu, Sep 25, 2014 at 09:17:19PM +0200, Arnd Bergmann wrote:
> On Thursday 25 September 2014, Daniel Thompson wrote:
> > > +
> > > +#ifndef readq_relaxed
> > > +#define readq_relaxed readq
> > > +#endif
> >
> > Not really sure if it matters but this gives a rather surprising
> > behaviour to #ifdef readq_relaxed given that readq may not be defined.
> >
>
> It was intentional. I could have written this as
>
> #if !defined(readq_relaxed) && defined(readq)
>
> but the effect would be almost the same, and the version I picked looks
> simpler. Note that 32-bit architectures could provide readq, it's just
> the generic code that doesn't, because most you typically don't get
> atomic 64-bit accesses from dereferencing a 64-bit pointer as the
> generic readq() function does.

32-bit architectures should *not* provide readq(). Remember, we are
talking about devices here, and reading registers on devices *may* have
side effects.

Side effects such as clearing the pending interrupt status.

How would a 32-bit architecture know whether it should read the least
significant 32-bit or the most significant 32-bit part of the 64-bit
register first. What would be right for one driver may not ben correct
for another. Hence, this decision should only be made by the driver
wanting the accessor, and not having the accessor symbol defined should
be the trigger for the driver to handle the problem themselves.

--
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.


\
 
 \ /
  Last update: 2014-09-26 11:21    [W:0.090 / U:1.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site