public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "José Fonseca" <j_r_fonseca@yahoo.co.uk>
To: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to write portable MMIO code?
Date: Tue, 30 Apr 2002 20:01:10 +0100	[thread overview]
Message-ID: <20020430190110.GA20294@localhost> (raw)
In-Reply-To: <Pine.LNX.4.44.0204301112520.32217-100000@chaos.physics.uiowa.edu>

Kai,

On 2002.04.30 17:19 Kai Germaschewski wrote:
> On Tue, 30 Apr 2002, José Fonseca wrote:
> >   - should one in general (i.e., assuming the worst case) do wmb() on
> > writes, and mb() on reads?
> 
> I don't think mb() will help you. You're probably experiencing PCI
> posting
> problems - when a writel() has executed, that doesn't necessarily mean
> that the transaction has actually happened it may (and will) be buffered
> for a potentially long time.
> 
> However, PCI won't reorder reads vs. writes, so you when you want to be
> sure that a write() actually reached the hardware, do a dummy read()
> afterwards, that'll flush the write buffer.

Unfortunately one of the problems occurs in a idle wait loop, when a 
register is being sucessively read.

And if so, how the wmb() example in "Linux Device Drivers" 
(http://www.xml.com/ldd/chapter/book/ch08.html#t1) can be explained? The 
"Bus-Independent Device Accesses" 
(http://www.kernelnewbies.org/documents/kdoc/deviceiobook/x44.html) also 
refers what you suggested, but it also mentions the use of memory 
barriers. So how and when should they be used?

Regards,

José Fonseca

  reply	other threads:[~2002-04-30 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-30 14:22 How to write portable MMIO code? José Fonseca
2002-04-30 16:19 ` Kai Germaschewski
2002-04-30 19:01   ` José Fonseca [this message]
2002-04-30 19:41     ` Kai Germaschewski
2002-04-30 20:01       ` Jesse Barnes
2002-04-30 19:56   ` arjan

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=20020430190110.GA20294@localhost \
    --to=j_r_fonseca@yahoo.co.uk \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox