Skip to contentSkip to conversation

Allocating non-contigious memory

DISCUSSION Olivier Galibert 3 participants 4 messages Jun 27, 2001

lore
Share & tools
lore
#0 lore raw

What is the Right Way[tm] as of 2.4.6 to allocate 16Mb as 4K pages and get the pci bus address for each page? Bonus points is they're virtually contiguous, but that's not necessary. IIRC, the old vmalloc-then-walk-the-pagetables trick is considered out-of-bounds nowadays.

OG.

#1 lore raw
Quoted 5 lines

What is the Right Way[tm] as of 2.4.6 to allocate 16Mb as 4K pages and get the pci bus address for each page? Bonus points is they're virtually contiguous, but that's not necessary. IIRC, the old vmalloc-then-walk-the-pagetables trick is considered out-of-bounds nowadays.

If you want it virtually contiguous then copy the code from bttv that out-of-bounds or otherwise is now found in about 8 drivers in the kernel.

If you don't need that then you can map user space and use kiovecs - which is nicer for many things

#2 lore raw

Hi Alan.

Quoted 9 lines
Quoted 5 lines

What is the Right Way[tm] as of 2.4.6 to allocate 16Mb as 4K pages and get the pci bus address for each page? Bonus points is they're virtually contiguous, but that's not necessary. IIRC, the old vmalloc-then-walk-the-pagetables trick is considered out-of-bounds nowadays.

If you want it virtually contiguous then copy the code from bttv that out-of-bounds or otherwise is now found in about 8 drivers in the kernel.

Would it be useful to turn that particular code into a subroutine that is called from each driver, or would that cause other problems?

Best wishes from Riley.

#3 lore raw
Quoted 2 lines

Would it be useful to turn that particular code into a subroutine that is called from each driver, or would that cause other problems?

It would but then I suspect Linus wouldnt want to take it as it might encourage people to use it 8)