LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 12-21-2012, 10:05 PM   #1
chrismathew
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Rep: Reputation: Disabled
pci_map_page()/dma_map_page() question


When I tried to set up DMA in a device driver for 24GB RAM x86-64 platform, because sometimes the dma_addr returned from pci_map_page() is an out-of-range large value way beyond 24GB,
I added some extra range checking, but find the address returned
is not really between 0 and 24GB, but somewhere between 4GB and
~28GB. I thought bus_address and physical address on x86 are the same. The last entry at /proc/iomem does show something like:

0x100000000 - 0x62fffffff system RAM

Wonder how to programmatically find out this range? Any help would appreciated.
 
Old 12-29-2012, 04:36 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
On x86, the memory space is not contigous. The memory space does not just mean the memory, there are also memory-mapped devices, and in the case of x86 - all the legacy. On your place, I would rather trust pci_map_page(). However, make sure that your device supports such addresses for DMA. If not, you may need to use the DMA32 allocations.
 
Old 12-30-2012, 01:24 AM   #3
chrismathew
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
pci_map_page()

OK. But how would the result returned from pci_map_page() correspond to which memory location, assuming the device
does support this address?
Thanks,

Quote:
Originally Posted by Mara View Post
On x86, the memory space is not contigous. The memory space does not just mean the memory, there are also memory-mapped devices, and in the case of x86 - all the legacy. On your place, I would rather trust pci_map_page(). However, make sure that your device supports such addresses for DMA. If not, you may need to use the DMA32 allocations.
 
Old 12-30-2012, 06:35 AM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
It will be the DMA address space (physical address, quite likely, as you do not mention iommu).
 
Old 12-31-2012, 08:55 PM   #5
chrismathew
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
That's what I thought. So the return address would be some physical address less than 24G, but some addresses
returned is out of the range, which is my original question. Thanks again.

Quote:
Originally Posted by Mara View Post
It will be the DMA address space (physical address, quite likely, as you do not mention iommu).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] GPL question (Version 2, June 1991) - physical media availability question LicenseQuestions Linux - Newbie 1 12-01-2012 06:34 PM
basic html question - download link to files on my webpage question Davno Linux - Server 5 12-25-2009 07:24 AM
linux distro question & mysql install question natalie.aloi Linux - Newbie 5 07-19-2009 08:28 PM
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 01:51 PM


All times are GMT -5. The time now is 02:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration