Re: Big Fix for 2.2.1

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Tue, 26 Jan 1999 21:51:07 +0000


Leonard N. Zubkoff wrote:
> (1) The identity phys_to_virt(virt_to_phys(x)) == x is violated.

That identity makes no sense anyway. Not every "phys" address has a
corresponding "virt" address. In my opinion, phys_to_virt should be
removed, and the few drivers that use it changed to work properly.

> (2) The readb/writeb/readw/writew/readl/writel macros are completely incorrect
> since they are supposed to be applied to memory mapped I/O regions
> allocated with ioremap, but ioremap returns a kernel virtual address
> and hence no further mapping is appropriate.

No, this is wrong. ioremap() does _not_ return a "virt" address, though
it does return a virtual address. Calling virt_to_phys() on the return
value of ioremap() does _not_ get you the physical address.

Read the examples in `documentation/IO-mapping.txt'. Logically,
ioremap() and "phys" addresses share the same space: the space of
addresses that can be passed to readb/writeb et al.

"virt" addresses refer to virtual addresses in the direct-mapped kernel
image, but not vmalloc() or ioremap() addresses. Beware.

These concepts need some serious cleaning up, and it's a 2.3 thing.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/