mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ioremap() vs. ioremap_nocache()
@ 2001-10-04  0:29 David Mosberger
  2001-10-04 20:47 ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: David Mosberger @ 2001-10-04  0:29 UTC (permalink / raw)
  To: linux-kernel

Jes Sorensen was kind enough to point out a longstanding
mis-conception that I had about ioremap(): I thought that ioremap()
was being deprecated in favor of ioremap_nocache() because the former
does not clearly define what kind of memory attribute will be used to
access the mapped memory (cached, write-through cached,
write-coalescing, etc).  But I seem to have been wrong about that.
Now, as far as I know, on x86, ioremap() will give write-through
cached mappings (in the absence of mtrr games).  If this is true, how
can this work?  There are many drivers out there that use ioremap() on
memory mapped I/O regions that do NOT have the "Prefetchable" bit set
in the PCI BAR.  For example, the eepro100 driver does this and it has
a routine called wait_for_cmd_done(), which spins on an ioremapped
read.  On an x86, what prevents these reads from being cached?

Thanks,

	--david

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

* Re: ioremap() vs. ioremap_nocache()
  2001-10-04  0:29 ioremap() vs. ioremap_nocache() David Mosberger
@ 2001-10-04 20:47 ` Alan Cox
  2001-10-05 14:12   ` Jes Sorensen
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2001-10-04 20:47 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel

> Now, as far as I know, on x86, ioremap() will give write-through
> cached mappings (in the absence of mtrr games).  If this is true, how

On x86 ioremap will give mappings appropriate to the object you map - which
means by default it wil give uncached mappings. The PCI hardware will do
intelligent things in certain cases such as write merging

Alan

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

* Re: ioremap() vs. ioremap_nocache()
  2001-10-04 20:47 ` Alan Cox
@ 2001-10-05 14:12   ` Jes Sorensen
  2001-10-05 14:39     ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Jes Sorensen @ 2001-10-05 14:12 UTC (permalink / raw)
  To: Alan Cox; +Cc: davidm, linux-kernel

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

>> Now, as far as I know, on x86, ioremap() will give write-through
>> cached mappings (in the absence of mtrr games).  If this is true,
>> how

Alan> On x86 ioremap will give mappings appropriate to the object you
Alan> map - which means by default it wil give uncached mappings. The
Alan> PCI hardware will do intelligent things in certain cases such as
Alan> write merging

Are you thereby saying that ioremap() and ioremap_nocache() are
identical on the x86?

Cheers,
Jes

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

* Re: ioremap() vs. ioremap_nocache()
  2001-10-05 14:12   ` Jes Sorensen
@ 2001-10-05 14:39     ` Alan Cox
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2001-10-05 14:39 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Alan Cox, davidm, linux-kernel

> Alan> On x86 ioremap will give mappings appropriate to the object you
> Alan> map - which means by default it wil give uncached mappings. The
> Alan> PCI hardware will do intelligent things in certain cases such as
> Alan> write merging
> 
> Are you thereby saying that ioremap() and ioremap_nocache() are
> identical on the x86?

In certain peculiar cases - no. Think about an ioremap of an object mapped
onto the system bus as RAM.

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

* Re: ioremap() vs. ioremap_nocache()
       [not found] ` <15293.54409.884529.251159@napali.hpl.hp.com>
@ 2001-10-05 16:08   ` David Mosberger
  0 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2001-10-05 16:08 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, davidm

>>>>> On Fri, 5 Oct 2001 16:51:45 +0100 (BST), Alan Cox <alan@lxorguk.ukuu.org.uk> said:

  >> >>>>> On Fri, 5 Oct 2001 12:18:07 +0100 (BST), Alan Cox
  >> <alan@lxorguk.ukuu.org.uk> said:
  >> 
  >> Can you tell me what the answer is to this question?

  >> When is a programmer supposed to use ioremap()
  >> vs. ioremap_nocache().

  Alan> You should never need ioremap_nocache for anything
  Alan> non-ultraweird.

Then who added it and why?

	--david

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

end of thread, other threads:[~2001-10-05 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-04  0:29 ioremap() vs. ioremap_nocache() David Mosberger
2001-10-04 20:47 ` Alan Cox
2001-10-05 14:12   ` Jes Sorensen
2001-10-05 14:39     ` Alan Cox
     [not found] <E15pXGL-0006n6-00@the-village.bc.nu>
     [not found] ` <15293.54409.884529.251159@napali.hpl.hp.com>
2001-10-05 16:08   ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®