First cut at large page support on 40x
Dan Malek
dan at embeddededge.com
Wed Jun 12 16:15:30 EST 2002
David Gibson wrote:
> So what happened to the idea?
Never got implemented, I guess. Lots of things are discussed that
people just don't have time to do.
> That isn't of itself an argument. I haven't yet seen a case where
> extending virt_to_phys() to non-lowmem addresses is useful. In any
> case I've so far thought of there are other considerations which make
> the benefits of having a common interface illusory.
Let's just say it's nice to have designs that have common functional
interfaces. The Linux VM is one old hack on top of another, and inserting
something like iopa() under virt_to_* is just the same. As systems and
memory sizes grew, the functions to support them didn't for a variety of
reasons. These problems have all been nicely solved long ago, and some
of us were around back then to appreciate the nice solutions :-)
> Not only is that wrong, it's bloody obviously wrong. How could we
> create a new virtual mapping without knowing the physical addresses
> first.
Oh, cool down and just think about this for a moment. All of this was
done to support noncoherent caches where we allocate some VM space to
remap pages with different cache attributes. Everything that does
DMA expects to use virt_to_* functions to find the physical address.
Of course we know the physical address, but functions using the standard
pci_consistent_* don't know them. To support PCI on noncoherent cache
processors you have to be able to find the physical address from the
virtual one, and just an arithmetic operation on the virtual address
won't work on these processors. It's just the way these functions are
designed to work in Linux. It's obviously the only way to make it work
with the way the higher level functions are designed.
> ..... We
> can't use vmalloc()ed memory anyway, because it wouldn't be physically
> contiguous.
Ummmm....we do use vmalloc()'ed (sort of) memory anyway. We grab a set
of physical pages and then map them to a new vm_area. Just what vmalloc()
does, except we do it so it is contiguous.
> And it isn't needed in consistent_*(), so where is it needed at all?
It's needed at the higher level of PCI and DMA functions that are simply
given virtual addresses and need to find the physical page(s) associated.
-- Dan
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-embedded
mailing list