Re: addresses & kernel modules for PCI drivers

Michael Berg (mberg@nmt.edu)
Wed, 28 Jul 1999 11:45:35 -0600


Please CC any answers to this posting to mberg@nmt.edu

However, the __get_free_pages (and friends) suggested below all refuse
to allocate more than 128KB on Intels (I'd read this before, and tested
it anyway to make sure).

Will the following work though?

If I call "__get_dma_pages" twice to get two 128KB chunks, and then
check to make sure that the two chunks are contiguous to each other, can
I then treat them as one 256KB chunk for my dma buffer? Or will I run
into paging problems and/or read/write problems in the kernel memory if
I do this?

Benjamin LaHaise wrote:
>
> On Mon, 26 Jul 1999, Michael Berg wrote:
>
> > The problem is that any memory I allocate for this buffer in the module
> > is a 32-bit address well above the range of addresses that will fit into
> > the high 14 bits that I have available.
> >
> > Is there a way for the module to obtain a 256KByte chunk of memory that
> > can be addresses with only 14 bits?
>
> Yeap. __get_free_pages always returns objects aligned to their own size.
> So just do
>
> addr = __get_free_pages(GFP_KERNEL, 18 - PAGE_SHIFT); /*256KB*/
>
> to get the memory you need. One other thing to consider is that since it
> is a large contiguous chunk of memory, you should probably allocate it at
> load time in order to avoid things like open() failing sporadically.
>
> -ben

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