LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-02-2004, 03:03 AM   #1
basu_arani
LQ Newbie
 
Registered: Sep 2003
Location: Bangalore, India
Distribution: Red Hat
Posts: 19

Rep: Reputation: 0
User Space - Kernel Space


Hi There,

I am developing a driver for a communication card in linux. The working of the driver is as follows:

The data has to be transferred from user space memory to some memory on a particular PCI card. This card is having the PLX PCI 9054 with a DMA controller.

If I have to pass the data from the user program to the PCI Memory, the data has to be first passed from user space to the kernel space and then from there to the PCI Memory. This is resulting in a lot of bandwidth wastage.

Is it possible for a kernel module to access the user space memory directly, so that I can transfer the data directly from the userspace to the PCI memory.

Thank You.
 
Old 05-02-2004, 03:18 AM   #2
chris78
LQ Newbie
 
Registered: Mar 2004
Location: germany
Distribution: Slackware & RedHat
Posts: 28

Rep: Reputation: 15
I think it was that a module like the video frame buffer uses a piece of memory into which the userspace can write and which will not be copied but rather used directly for the transfer to the video device.
 
Old 05-02-2004, 12:54 PM   #3
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
isn't that what DMA is for?? i haven't reached that chapter in 'linux device drivers' yet, but i think that's what it does. or maybe u can mmap() it?
 
Old 05-25-2004, 11:46 AM   #4
Mick37
LQ Newbie
 
Registered: May 2004
Location: Berlin
Distribution: several
Posts: 1

Rep: Reputation: 0
Not sure how far you got meanwhile but here some comments:
What you want is a common problem and there are solutiuons.
In order to do DMA to or from user space several problems must be solved:
first: DMA is done on physical addresses, while user (and actually even kernel) memory is looked at through virtual addresses. The next issue is that virtual memory is organized in pages of physical memory that are not necessary consecutive. This means you need to break down the DMA in chunks or use hardware that can do this for you, such as the PLX 9054 (scatter gather DMA ) Finally, the physical pages may be moved around by the system. To prevent this from occuring during a DMA, the pages must be locked in physical memory. For all the issues there are kernel routines but it is not so easy to do. Moreover, it can be unsafe if you don't take great care. This is why the classic approach is done with all the memory copying. Nevertheless, I also would like to get a 9054 driver going. If you are serious, give it a try and I help where I can.

Mick
 
  


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
notify user space application from the kernel space lordofring Linux - Software 2 06-22-2009 12:32 PM
callback or notification from kernel to user space yhus Programming 5 09-18-2005 09:41 PM
Calling User-space program functions from Kernel modules shivanu Programming 1 03-05-2005 02:11 PM
user space daemons, kernel patches, modules ajitkth Linux - General 0 02-21-2005 08:01 AM
User/Kernel Space Comms under Redhat 9.0 snigglyfox Programming 3 09-07-2004 05:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:59 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