* Allocating uncached memory in 2.6.25(powerpc/440)
@ 2008-09-19 21:47 vb
2008-09-19 21:56 ` vb
0 siblings, 1 reply; 3+ messages in thread
From: vb @ 2008-09-19 21:47 UTC (permalink / raw)
To: linuxppc-embedded
I wonder if anyone can help with some hints in this situation:
here is a code fragment to illustrate my question:
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);
while(szw) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Allocating uncached memory in 2.6.25(powerpc/440)
2008-09-19 21:47 Allocating uncached memory in 2.6.25(powerpc/440) vb
@ 2008-09-19 21:56 ` vb
2008-09-19 22:09 ` Roland Dreier
0 siblings, 1 reply; 3+ messages in thread
From: vb @ 2008-09-19 21:56 UTC (permalink / raw)
To: linuxppc-embedded
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Allocating uncached memory in 2.6.25(powerpc/440)
2008-09-19 21:56 ` vb
@ 2008-09-19 22:09 ` Roland Dreier
0 siblings, 0 replies; 3+ messages in thread
From: Roland Dreier @ 2008-09-19 22:09 UTC (permalink / raw)
To: vb; +Cc: linuxppc-embedded
> 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.
No, GFP_DMA doesn't have that meaning. To allocate uncached memory, use
dma_alloc_coherent().
- R.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-19 22:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-19 21:47 Allocating uncached memory in 2.6.25(powerpc/440) vb
2008-09-19 21:56 ` vb
2008-09-19 22:09 ` Roland Dreier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).