RE: [RFT 00/13] iomap: Constify ioreadX() iomem argument

From
David Laight <hidden>
Date
2020-01-09 17:51:47
Also in
dri-devel, linux-alpha, linux-arch, nouveau, virtualization
Reply to
Christophe Leroy, 2020-01-08
From: Christophe Leroy
Sent: 08 January 2020 08:49
...
And as pointed by Arnd, the volatile is really only necessary for the
dereference itself, should the arch use dereferencing.
I've had trouble with some versions of gcc and reading of 'volatile unsigned char *'.
It tended to follow the memory read with an extra mask with 0xff.
(I suspect that internally the value landed into a temporary 'int' variable.)

I got better code using memory barriers.
So putting an asm barrier for the exact location of the memory read
either side of the read should have the desired effect without adding
extra instructions.
(You might think 'volatile' would mean that - but it doesn't.)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Thread (31 messages) 31 messages, 5 authors, last reply 2020-01-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help