Re: Big Fix for 2.2.1

Linus Torvalds (torvalds@transmeta.com)
Tue, 26 Jan 1999 14:51:07 -0800 (PST)


On Tue, 26 Jan 1999, Alan Cox wrote:
>
> phys_to_virt has uses in some cases. Consider the situation where a driver
> posts you back the physical address of a kernel message buffer it has filled
> in. But in general yes you are right.

Even in that case you should actually use "bus_to_virt()". The driver
knows only the "bus address" that it used for the access (which _tends_ to
be the same as the physical address of the memory location in question,
but at least in theory it doesn't need to be, and there are some rather
strange PCI implementations where physical memory is mapped in the PCI
space to another location than zero - it makes sense when you think about
the ISA legacy region, and separating a bus transaction to 640k-1MB ISA
memory from the 640kB-1M RAM region on a chip where PCI and RAM are not
overlapped like they are on intel).

The ONLY valid use for "phys_to_virt()" and friends is inside the memory
management. Nowhere else is it really valid.

Linus

-
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/