Skip to contentSkip to conversation

ioremap_nocache() in setup_port() ok?

PATCH Grant Grundler 2 participants 3 messages Mar 30, 2006 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

Hi Russell,
This patch fixes a warning in the parisc-linux.org developement tree. Helge Deller has done substantial work to enable proper ioremap() functionality in parisc port and exposed some problems with ioremap() vs ioremap_nocache() usage.

Most device drivers really want ioremap_nocache(). But we've been really sloppy since most implementations treat MMIO space as uncached.

Am I correct that serial also wants _nocache() for MMIO space?

thanks,
grant

drivers/serial/8250_pci.c +1 -1
@@ -87,7 +87,7 @@ setup_port(struct serial_private *priv, 
 		len =  pci_resource_len(dev, bar);
 
 		if (!priv->remapped_bar[bar])
-			priv->remapped_bar[bar] = ioremap(base, len);
+			priv->remapped_bar[bar] = ioremap_nocache(base, len);
 		if (!priv->remapped_bar[bar])
 			return -ENOMEM;
 
#1 lore raw
Quoted 1 line · Grant Grundler

Am I correct that serial also wants _nocache() for MMIO space?

Don't know - I've always taken ioremap_nocache() as a mis-understanding of what ioremap() itself is supposed to do. Indeed, if you look at IO-mapping.txt, ioremap_nocache() is not mentioned, and it's pretty clear that ioremap() is what is intended to be used to map MMIO.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 7 lines · Russell King
Quoted 1 line · Grant Grundler

Am I correct that serial also wants _nocache() for MMIO space?

Don't know - I've always taken ioremap_nocache() as a mis-understanding of what ioremap() itself is supposed to do. Indeed, if you look at IO-mapping.txt, ioremap_nocache() is not mentioned, and it's pretty clear that ioremap() is what is intended to be used to map MMIO.

I think IO-mapping.txt is stale and whoever added ioremap_nocache failed to update it.

It would be reasonable to ignore my patch (unless you wanted to document the expected behavior of serial) if what willy proposed an hour ago is accepted:

	http://lkml.org/lkml/2006/3/30/251

I'll update the IO-mapping.txt based on the outcome of willy's patch.

thanks,
grant