* __pa giving strange phys address on PPC
@ 2009-01-07 20:59 dibacco
2009-01-07 22:27 ` Benjamin Herrenschmidt
2009-01-08 21:03 ` Josh Boyer
0 siblings, 2 replies; 5+ messages in thread
From: dibacco @ 2009-01-07 20:59 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
I'm using a linux 2.6.19 (from Denx ELDK) on a PPC MPC880. In a driver (t=
hat uses TDM channels) I have some calls to __pa to get the physical addr=
ess corresponding to a virtual address. The physical address returned by =
__pa is higher than the maximum physical memory I have on the board. This=
result make my driver hang. The driver I'm trying to use was written for=
a 2.4 kernel and I'm wondering if I have to replace the calls to __pa wi=
th some other API/MACRO.
Thank you in advance.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __pa giving strange phys address on PPC
@ 2009-01-07 21:11 dibacco
2009-01-08 0:25 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: dibacco @ 2009-01-07 21:11 UTC (permalink / raw)
To: jwboyer; +Cc: linuxppc-dev
I used __pa on the result of an uncached_mem_alloc.
Furthermore __pa should work on the return of a kmalloc?
Thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __pa giving strange phys address on PPC
2009-01-07 20:59 dibacco
@ 2009-01-07 22:27 ` Benjamin Herrenschmidt
2009-01-08 21:03 ` Josh Boyer
1 sibling, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2009-01-07 22:27 UTC (permalink / raw)
To: dibacco@libero.it; +Cc: linuxppc-dev
On Wed, 2009-01-07 at 21:59 +0100, dibacco@libero.it wrote:
> Hi all,
>
> I'm using a linux 2.6.19 (from Denx ELDK) on a PPC MPC880. In a driver
> (that uses TDM channels) I have some calls to __pa to get the physical
> address corresponding to a virtual address. The physical address
> returned by __pa is higher than the maximum physical memory I have on
> the board. This result make my driver hang. The driver I'm trying to
> use was written for a 2.4 kernel and I'm wondering if I have to
> replace the calls to __pa with some other API/MACRO.
__pa can only be used on memory coming from the kernel linear mapping.
You probably need to change your driver to use the proper DMA mapping
APIs instead
Cheers,
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __pa giving strange phys address on PPC
2009-01-07 21:11 __pa giving strange phys address on PPC dibacco
@ 2009-01-08 0:25 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2009-01-08 0:25 UTC (permalink / raw)
To: dibacco@libero.it; +Cc: linuxppc-dev
On Wed, 2009-01-07 at 22:11 +0100, dibacco@libero.it wrote:
> I used __pa on the result of an uncached_mem_alloc.
No idea what uncached_mem_alloc() is but if that uses the consistent
memory stuff it won't work with __pa.
> Furthermore __pa should work on the return of a kmalloc?
Yes. But don't use that, just use the dma allocation/mapping functions
instead, they return to you both the pa and the dma_addr_t. This is
better for -many- reasons.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __pa giving strange phys address on PPC
2009-01-07 20:59 dibacco
2009-01-07 22:27 ` Benjamin Herrenschmidt
@ 2009-01-08 21:03 ` Josh Boyer
1 sibling, 0 replies; 5+ messages in thread
From: Josh Boyer @ 2009-01-08 21:03 UTC (permalink / raw)
To: dibacco@libero.it; +Cc: linuxppc-dev
On Wed, Jan 07, 2009 at 09:59:36PM +0100, dibacco@libero.it wrote:
>Hi all,
>
>I'm using a linux 2.6.19 (from Denx ELDK) on a PPC MPC880. In a driver (that uses TDM channels) I have some calls to __pa to get the physical address corresponding to a virtual address. The physical address returned by __pa is higher than the maximum physical memory I have on the board. This result make my driver hang. The driver I'm trying to use was written for a 2.4 kernel and I'm wondering if I have to replace the calls to __pa with some other API/MACRO.
>
>Thank you in advance.
If you're calling it on an ioremapped address, that won't work.
Those come out of vmalloc space.
Just store the physical address somewhere if you really need it.
josh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-08 0:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 21:11 __pa giving strange phys address on PPC dibacco
2009-01-08 0:25 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2009-01-07 20:59 dibacco
2009-01-07 22:27 ` Benjamin Herrenschmidt
2009-01-08 21:03 ` Josh Boyer
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).