* RE: Linuxppc-embedded Digest, Vol 35, Issue 33 [not found] <mailman.1061.1184600645.8639.linuxppc-embedded@ozlabs.org> @ 2007-07-16 15:58 ` Siva Prasad 2007-07-16 16:09 ` Scott Wood 0 siblings, 1 reply; 6+ messages in thread From: Siva Prasad @ 2007-07-16 15:58 UTC (permalink / raw) To: linuxppc-embedded; +Cc: sureshtang It returns kernel virtual address. If you use this buffer space for DMA, please use appropriate flags. You may use __pa(address) or virt_to_phys() to convert virtual to physical. - Siva -----Original Message----- Message: 3 Date: Mon, 16 Jul 2007 19:29:59 +0530 From: "suresh suresh" <sureshtang@gmail.com> Subject: Kmalloc returns which address To: linuxppc-embedded@ozlabs.org Message-ID: <e5eb93010707160659m6a7d0b02p623542739d28ab29@mail.gmail.com> Content-Type: text/plain; charset=3D"iso-8859-1" Hi, I am porting MPC8280 driver from vxWorks to Linux. I want know the address return by kmalloc function? is it physical address or kernel virtual address. For Tx and Rx, hardware uses buffers, so I have to allocate buffers and pass the pointer to hardware. Can I pass the pointer returned kmalloc? or I should convert it into physical address? If it returns kernel virtual address, then how to convert into physical? Thanks & Regards- Suresh -------------- next part -------------- ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linuxppc-embedded Digest, Vol 35, Issue 33 2007-07-16 15:58 ` Linuxppc-embedded Digest, Vol 35, Issue 33 Siva Prasad @ 2007-07-16 16:09 ` Scott Wood 2007-07-17 5:59 ` suresh suresh 0 siblings, 1 reply; 6+ messages in thread From: Scott Wood @ 2007-07-16 16:09 UTC (permalink / raw) To: Siva Prasad; +Cc: sureshtang, linuxppc-embedded Siva Prasad wrote: > It returns kernel virtual address. If you use this buffer space for DMA, > please use appropriate flags. You may use __pa(address) or > virt_to_phys() to convert virtual to physical. No, you may not -- physical and DMA addresses are not always identical. Use the DMA mapping API. -Scott ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linuxppc-embedded Digest, Vol 35, Issue 33 2007-07-16 16:09 ` Scott Wood @ 2007-07-17 5:59 ` suresh suresh 2007-07-17 16:02 ` Scott Wood 2007-07-17 22:41 ` Siva Prasad 0 siblings, 2 replies; 6+ messages in thread From: suresh suresh @ 2007-07-17 5:59 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-embedded, Siva Prasad [-- Attachment #1: Type: text/plain, Size: 932 bytes --] Thanks.... MPC8280 has internal memory space which contains Dualport(Dp) RAM. In the DpRAM we allocate some tables and these has to store pointer of the buffers which are allocated in external memory. Core will use this pointer to access the buffers, basically these buffers are used for DMA. Using IMMR register we can get physical address of the internal memory. Now can I store the address return by the kmalloc() function? or I should convert it into physical? Please help me how to resove this address translation. Regards, Suresh On 7/16/07, Scott Wood <scottwood@freescale.com> wrote: > > Siva Prasad wrote: > > It returns kernel virtual address. If you use this buffer space for DMA, > > please use appropriate flags. You may use __pa(address) or > > virt_to_phys() to convert virtual to physical. > > No, you may not -- physical and DMA addresses are not always identical. > Use the DMA mapping API. > > -Scott > > [-- Attachment #2: Type: text/html, Size: 1281 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linuxppc-embedded Digest, Vol 35, Issue 33 2007-07-17 5:59 ` suresh suresh @ 2007-07-17 16:02 ` Scott Wood 2007-07-17 22:41 ` Siva Prasad 1 sibling, 0 replies; 6+ messages in thread From: Scott Wood @ 2007-07-17 16:02 UTC (permalink / raw) To: suresh suresh; +Cc: linuxppc-embedded, Siva Prasad suresh suresh wrote: > MPC8280 has internal memory space which contains Dualport(Dp) RAM. In the > DpRAM we allocate some tables and these has to store pointer of the buffers > which are allocated in external memory. Core will use this pointer to > access > the buffers, basically these buffers are used for DMA. > > Using IMMR register we can get physical address of the internal memory. Now > can I store the address return by the kmalloc() function? or I should > convert it into physical? Yes, you need to convert it to physical. As I said earlier, use the DMA mapping API (described in Documentation/DMA-mapping.txt) to do so. Specifically, look at the dma_map_single() function. -Scott ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Linuxppc-embedded Digest, Vol 35, Issue 33 2007-07-17 5:59 ` suresh suresh 2007-07-17 16:02 ` Scott Wood @ 2007-07-17 22:41 ` Siva Prasad 2007-07-17 22:51 ` Scott Wood 1 sibling, 1 reply; 6+ messages in thread From: Siva Prasad @ 2007-07-17 22:41 UTC (permalink / raw) To: suresh suresh, Scott Wood; +Cc: linuxppc-embedded [-- Attachment #1: Type: text/plain, Size: 1652 bytes --] Well!... you can manage any way you want. 1) You can store the virtual address in the DpRAM, and convert to physical (should I say DMA mapped address) and then pass it on to the device under consideration here. 2) Other way would be... store the physical address in DpRAM. Use that address for the device, and convert to virtual before you use it in the code. My preference is for first option. - Siva ________________________________ From: suresh suresh [mailto:sureshtang@gmail.com] Sent: Monday, July 16, 2007 10:59 PM To: Scott Wood Cc: Siva Prasad; linuxppc-embedded@ozlabs.org Subject: Re: Linuxppc-embedded Digest, Vol 35, Issue 33 Thanks.... MPC8280 has internal memory space which contains Dualport(Dp) RAM. In the DpRAM we allocate some tables and these has to store pointer of the buffers which are allocated in external memory. Core will use this pointer to access the buffers, basically these buffers are used for DMA. Using IMMR register we can get physical address of the internal memory. Now can I store the address return by the kmalloc() function? or I should convert it into physical? Please help me how to resove this address translation. Regards, Suresh On 7/16/07, Scott Wood <scottwood@freescale.com> wrote: Siva Prasad wrote: > It returns kernel virtual address. If you use this buffer space for DMA, > please use appropriate flags. You may use __pa(address) or > virt_to_phys() to convert virtual to physical. No, you may not -- physical and DMA addresses are not always identical. Use the DMA mapping API. -Scott [-- Attachment #2: Type: text/html, Size: 6080 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linuxppc-embedded Digest, Vol 35, Issue 33 2007-07-17 22:41 ` Siva Prasad @ 2007-07-17 22:51 ` Scott Wood 0 siblings, 0 replies; 6+ messages in thread From: Scott Wood @ 2007-07-17 22:51 UTC (permalink / raw) To: Siva Prasad; +Cc: suresh suresh, linuxppc-embedded Siva Prasad wrote: > Well!... you can manage any way you want. > > > > 1) You can store the virtual address in the DpRAM, and convert to > physical (should I say DMA mapped address) and then pass it on to the > device under consideration here. The DPRAM is read directly by the microcode (if it didn't, you'd just be using RAM). You don't want to put virtual addresses in there. -Scott ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-07-17 22:55 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.1061.1184600645.8639.linuxppc-embedded@ozlabs.org> 2007-07-16 15:58 ` Linuxppc-embedded Digest, Vol 35, Issue 33 Siva Prasad 2007-07-16 16:09 ` Scott Wood 2007-07-17 5:59 ` suresh suresh 2007-07-17 16:02 ` Scott Wood 2007-07-17 22:41 ` Siva Prasad 2007-07-17 22:51 ` Scott Wood
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).