linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PCI MMIO flushing, write-combining etc
@ 2002-08-15 23:45 Krzysztof Halasa
  2002-08-16 11:12 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Halasa @ 2002-08-15 23:45 UTC (permalink / raw)
  To: linux-kernel

Hi,

Just a few simple questions for you PCI experts (please correct any wrong
assumptions):


Imagine we have a PCI card with 2 MMIO regions: prefetchable PR1 and
non-prefetchable NPR2 (and we are not limited to Pentium-class machines).

I understand writes to PR1 can be reordered, merged, and delayed.
What should I do to flush the write buffers? I understand reading from
PR1 would do. Would reading from NPR2 flush PR1 write buffers?
Would writing to NPR2 flush them?

Now NPR2, the non-prefetchable MMIO region.
Is it possible that the writes there are reordered, merged and/or
delayed (delayed = not making it to the PCI device when the writel()
completes)?


We have ioremap() and ioremap_nocache(). What is the exact difference
between them? Would the ioremap_nocache() disable all A) read- and
B) write-caching on a) prefetchable MMIO b) non-prefetchable MMIO ?

Would the ioremap() enable A) read- and A) write-caching on
a) prefetchable MMIO b) non-prefetchable MMIO ?


Thank you.
-- 
Krzysztof Halasa
Network Administrator

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PCI MMIO flushing, write-combining etc
  2002-08-15 23:45 PCI MMIO flushing, write-combining etc Krzysztof Halasa
@ 2002-08-16 11:12 ` Alan Cox
  2002-08-19 11:57   ` Krzysztof Halasa
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2002-08-16 11:12 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: linux-kernel

On Fri, 2002-08-16 at 00:45, Krzysztof Halasa wrote:
> I understand writes to PR1 can be reordered, merged, and delayed.
> What should I do to flush the write buffers? I understand reading from
> PR1 would do. Would reading from NPR2 flush PR1 write buffers?
> Would writing to NPR2 flush them?

That one I can't actually remember. 

> Now NPR2, the non-prefetchable MMIO region.
> Is it possible that the writes there are reordered, merged and/or
> delayed (delayed = not making it to the PCI device when the writel()
> completes)?

All PCI writes are posted. Think of PCI as messages otherwise you'll go
slowly insane debugging code. If you want to know your write completed
you need to read, when the read returns both have completed

> We have ioremap() and ioremap_nocache(). What is the exact difference
> between them? Would the ioremap_nocache() disable all A) read- and
> B) write-caching on a) prefetchable MMIO b) non-prefetchable MMIO ?

They make no difference


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PCI MMIO flushing, write-combining etc
  2002-08-16 11:12 ` Alan Cox
@ 2002-08-19 11:57   ` Krzysztof Halasa
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Halasa @ 2002-08-19 11:57 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

> > I understand writes to PR1 can be reordered, merged, and delayed.
> > What should I do to flush the write buffers? I understand reading from
> > PR1 would do. Would reading from NPR2 flush PR1 write buffers?
> > Would writing to NPR2 flush them?
> 
> That one I can't actually remember.

Ok. What PCI spec 2.1 says is, basically, that we don't need to worry about
such things. Writes can't be reordered - all the reads and writes are
in CPU (or any other PCI master) order, exactly as on ISA.
Writes can be merged on prefetchable region (so we don't necessarily want
to mark I/O MMIO as prefetchable, if the hardware doesn't like merging).

All writes can be posted, and they are flushed before a read initiated
by the same master (i.e. CPU) reaches the same PCI target (so it's enough
to readl() any region, either I/O or MMIO). Looks like we only need to
flush posted writes when there are specific timing requirements (something
like writel(reset); sleep 100 ns, writel(no_reset) - or when we want to be
sure that, say, card interrupts are off when we do something critical
elsewhere).
-- 
Krzysztof Halasa
Network Administrator

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-19 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-15 23:45 PCI MMIO flushing, write-combining etc Krzysztof Halasa
2002-08-16 11:12 ` Alan Cox
2002-08-19 11:57   ` Krzysztof Halasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).