LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-07-2011, 02:48 PM   #1
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 184

Rep: Reputation: 28
Is it possible to map PCI memory to a page?


Is there a way to either create a page table and/or map PCI memory to pages?

Also what does ioremap_page and ioremap_page_range do?
 
Old 12-08-2011, 03:06 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,853

Rep: Reputation: 161Reputation: 161
After ioremap is called, the PCI BAR memory is inserted into page table.
 
Old 12-09-2011, 01:32 PM   #3
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 184

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by nini09 View Post
After ioremap is called, the PCI BAR memory is inserted into page table.
So I've tried doing a virt_to_page on the address returned from ioremap but it looks like it is returning a page for physical address that does not match the physical address I originally passed into ioremap. For example I pass ioremap 0x3C000000 and it returns 0x78400000. Then if I do a virt_to_page on 0x78400000 it returns a page for 0x38400000 not 0x3C000000. Should I not use virt_to_page for an ioremap virtual address? Is there some other function I should be using, i.e. ioremap_to_page, or something like that?

This is all on a PowerPC system.
 
Old 12-09-2011, 02:44 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,853

Rep: Reputation: 161Reputation: 161
virt_to_page return a pointer to page structure, not physical address.
 
Old 12-09-2011, 02:48 PM   #5
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 184

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by nini09 View Post
virt_to_page return a pointer to page structure, not physical address.
Yes I under stand that, but that page is mapped to a physical address, i.e. page_to_phys, and the page that is returned is mapped to the physical address 0x38400000 not 0x3C000000. Also is I do a virt_to_phys on the virtual address from ioremap that also returns 0x38400000 and not 0x3C000000.

Last edited by dbrazeau; 12-09-2011 at 02:49 PM.
 
Old 12-11-2011, 12:23 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Do you have a machine with IOMMU? If so, it is possible because you have bus addresses that may be different than physical ones.
 
Old 12-12-2011, 12:18 PM   #7
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 184

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by Mara View Post
Do you have a machine with IOMMU? If so, it is possible because you have bus addresses that may be different than physical ones.
It looks like all IOMMU stuff is disabled in the kernel.
 
Old 12-12-2011, 02:23 PM   #8
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,853

Rep: Reputation: 161Reputation: 161
You can try pci_map_page after doing virt_to_page.
 
  


Reply



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
BUG: Bad page map in process granth Slackware 2 06-09-2010 01:48 PM
Linux Virtual memory mapping to Board memory map !rajkums! Linux - Kernel 4 10-19-2008 12:27 PM
Kernel virtual memory map TO Board memory map -----> Mapping !rajkums! Linux - Embedded & Single-board computer 0 10-18-2008 09:21 AM
PCI Memory Map rajtendulkar Linux - Hardware 0 03-20-2006 10:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:57 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration