[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pte_pagenr/MAP_NR deleted in pre6



> 
> Hi,
> 
> On Wed, Aug 16, 2000 at 10:13:21AM -0700, Kanoj Sarcar wrote:
> > 
> > FWIW, Linus was mildly suggesting I implement page_to_phys, to complement
> > virt_to_page.
> 
> It's part of what is necessary if we want to push kiobufs into the
> driver layers.  page_to_pfn is needed to for PAE36 support so that
> PCI64 or dual-address-cycle drivers can handle physical addresses
> longer than 32 bits long.
> 
> > BTW, I am not sure I understand when you say "some drivers need a virtual 
> > address, some need the physical address for dma and some of them might need
> > bounce buffers". I believe, the goal should be to pass in either a. struct
> > page or b. physical address
> 
> Yes, but different drivers have different requirements on those struct
> page *s.  Drivers which do programmed IO need to be able to turn the
> page into a kernel virtual address.  Drivers which can access >32-bit
> addresses need to turn the page into an index which fits inside 32
> bits.  Drivers which do DMA but only to <4GB addresses need bounce
> buffers.
> 
> That is irrelevant as far as the kiobuf data structure is concerned,
> but it is very important for the internals of the drivers, so this
> sort of functionality must be made available for drivers to use
> internally as needed.
> 
> Cheers, 
>  Stephen
> 

It might be easier all around if we could all agree to what drivers
need to do. As David Miller points out, whether a driver can dma into
>32-bit addresses etc is also a function of the architecture, so this
is best hidden under per architecture PCI-DMA layer. So, if the driver 
writer codes according to this, he will transparently get the best 
performance for any architecure ...

I guess finally, drivers will either get one or a list of

1. struct page or
2. pfn or
3. paddr_t (unsigned long long on PAE36, unsigned long on other platforms)

The PCI-DMA layer should be able to handle this type of input. The driver
must not attempt to convert this to PCI bus addresses. The driver must call
an arcitecture hook, like kmap(), to get a kernel virtual address for
the underlying page. It should be able to do without needing the physical
address of the page, the PCI-DMA routines will know how to do that.

kiobufs might need to get some hooks into PCI-DMA, but shouldn't this
suffice, mostly? Or is this being too restrictive for some drivers?

Kanoj
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/