RE: [PATCH v2] locking/memory-barriers.txt: Improve documentation for writel() example

From: Parav Pandit
Date: Wed Oct 05 2022 - 22:40:32 EST



> From: Bagas Sanjaya <bagasdotme@xxxxxxxxx>
> Sent: Thursday, October 6, 2022 7:31 AM
>
> On 10/5/22 17:47, Parav Pandit wrote:
> > @@ -1927,10 +1927,12 @@ There are some more advanced barrier
> functions:
> > before we read the data from the descriptor, and the dma_wmb()
> allows
> > us to guarantee the data is written to the descriptor before the device
> > can see it now has ownership. The dma_mb() implies both a
> dma_rmb() and
> > - a dma_wmb(). Note that, when using writel(), a prior wmb() is not
> needed
> > - to guarantee that the cache coherent memory writes have completed
> before
> > - writing to the MMIO region. The cheaper writel_relaxed() does not
> provide
> > - this guarantee and must not be used here.
> > + a dma_wmb(). Note that, when using writel(), a prior barrier is not
> > + needed to guarantee that the cache coherent memory writes have
> completed
> > + before writing to the MMIO region. The cheaper writel_relaxed() does
> not
> > + provide this guarantee and must not be used here. Hence, writeX() is
> always
> > + preferred which inserts needed platform specific barrier before writing
> to
> > + the specified MMIO region.
> >
>
> Did you mean that writeX() is write() function family?
Yes.