Allocating uncached memory in 2.6.25(powerpc/440)

vb vb at vsbe.com
Sat Sep 20 07:56:11 EST 2008


Oh man, sorry, those damn keyboard shortcuts, let me try again :-)


I wonder if anyone can help with some hints in this situation:

here is a code fragment to illustrate the questions:

 if ((ai = kmalloc(sizeof(alloc_info_t) + 4 * szw, GFP_ATOMIC |
GFP_DMA)) != NULL) {
        ai->src = FROM_KMALLOC;
       printk("\n%s:%d %p\n", __FUNCTION__, __LINE__, ai);

basically, a block of contiguous memory is allocated. This block is
needed to set up some DMA descriptors, so it needs to be uncached, and
I thought this is what GFP_DMA flag is for.

I stop execution using a JTAG probe right after the printk above, and
examine the TLB matching the allocated address.

This is what printk reports:
sal_alloc:163 eee76000

And the TLB record for this memory is the default kernel 256M page:

61 : 00 e0000000 256MB V0 -> 0_20000000 U:0000 ---G- ---XWR

Which is obviously cached (missing the I bit set).

How is this supposed to work?

Is this right to expect the address returned by kmalloc() to be mapped
to uncached TLB in case GFP_DMA flag is passed in?

What are the proper ways of setting up shared memory in this kernel?


Any hints will be highly appreciated,

TIA,
Vadim


More information about the Linuxppc-embedded mailing list