LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-21-2015, 12:21 AM   #1
mod_dev_123
LQ Newbie
 
Registered: Aug 2015
Posts: 16

Rep: Reputation: Disabled
32 bit PCI DMA


On my Linux system with over 16 GB of RAM, I would like to allocate about 100 MB of space, which:

- is physically contiguous. Ideally, all the 100MB would be physically contiguous, but I'm also OK with using HUGEPAGEs so that each 2MB is physically contiguous.
- can be used as a DMA target, with the 32 bit PCI space, not the 64 bit.This will allow us to use the shorter header for the PCIe transactions which saves a bit of bandwidth.
- is accessible from userspace programs (not just from kernel drivers).

I think the use of HUGEPAGEs and mmap can achieve the 1st (partial contiguity up to 2 MB at a time) and 3rd constraints (user space access through mmap), but I'm not sure how to ensure that the 2nd constraint (32 bit DMA) is guaranteed.

Thanks in advance for your help.
 
Old 09-22-2015, 10:59 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
If you are running a 64 bit kernel then just use 64 bit dma. Otherwise plan on some late nights and hair loss.
 
Old 09-23-2015, 07:42 AM   #3
mod_dev_123
LQ Newbie
 
Registered: Aug 2015
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanks. I don't have much hair left, so it's good advice to keep in mind.

All the same, I would have thought that pci_set_dma_mask(gDev, DMA_BIT_MASK(32)) would allow me to use only 32-bit DMA.
What am I missing?
 
Old 09-26-2015, 02:25 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
I don't argue with people on the internet, so let me just ask a question. If the device doing the DMA handles 64 bit addresses, what are you planning on putting in the top 32?
 
Old 09-29-2015, 01:24 AM   #5
mod_dev_123
LQ Newbie
 
Registered: Aug 2015
Posts: 16

Original Poster
Rep: Reputation: Disabled
The upper 32 bits will contain 0. The device (an FPGA) will pick the appropriate addressing cycle, based on the value of the upper 32 bits.
 
Old 09-29-2015, 01:26 AM   #6
mod_dev_123
LQ Newbie
 
Registered: Aug 2015
Posts: 16

Original Poster
Rep: Reputation: Disabled
When I try using pci_set_dma_mask(32), and then pci_map_sg() on a page, it returns a failure, even for small sizes. So, it doesn't sound like this scheme will work, although I can't explain why.
 
  


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
[SOLVED] pci device with DMA mukiwa Linux - Kernel 3 09-12-2013 09:21 AM
32 bit Linux Kernel not recognising PCI I/O port unlike 64 bit counter part jdamon Linux - Hardware 1 01-12-2013 11:35 PM
Example of PCI + DMA + Interruptdriver. Sink0 Linux - Kernel 1 12-17-2010 06:58 PM
PCI IDE adapter and DMA Dee-ehn Linux - Software 0 12-28-2004 10:09 AM
DMA over PCI ashutoshsharma Programming 0 03-07-2004 10:13 PM

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

All times are GMT -5. The time now is 01:27 PM.

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