LinuxQuestions.org
Visit Jeremy's Blog.
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-03-2011, 10:37 PM   #1
unifoxz
LQ Newbie
 
Registered: Dec 2011
Posts: 19

Rep: Reputation: Disabled
Separating amba-pl011 device driver from linux kernel


Is it possible to separate amba-pl011 device driver from linux kernel and move the driver to run on a separate standalone system/processor?
How should I do that in a clean way?
 
Old 12-04-2011, 01:01 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
This code is very Linux-specific. Moving it out is possible, but requires nearly the same time than writing the thing from scratch in user space.
 
Old 12-04-2011, 08:02 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Basically: "you can't. Don't try."
 
Old 12-04-2011, 08:37 PM   #4
unifoxz
LQ Newbie
 
Registered: Dec 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Mara View Post
Moving it out is possible, but requires nearly the same time than writing the thing from scratch in user space.
Thanks, Mara.
May I know why you say it takes the same time to writing from scratch in user space. Is that the 2nd option I can try out?

Do you have any idea how to move the driver out from kernel? I found the code are referencing each other heavily and I don't know from where I should start with it.
Can you please give me some idea by using amba-pl011 as an example?

Thanks a lot.
 
Old 12-04-2011, 08:38 PM   #5
unifoxz
LQ Newbie
 
Registered: Dec 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
Basically: "you can't. Don't try."
Sundialsvcs, may I know why you say so?
 
Old 12-05-2011, 02:09 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
First, take all functions that use writew() and readw(). They talk to the hardware. If you're moving the code to userspace, you need something that will allow you to read/write to device memory space. You can make a small driver for that. Then change all the calls to writew/readw to the right calls to that driver. Already that will take much time. Then you need to remove all the other things that do not compile: write your own handling of scatter-gather buffers (sg_* functions), handle interrupts, start and stop the device.

I really do not understand why you want it in userspace. Could you explain?
 
Old 12-05-2011, 06:25 PM   #7
unifoxz
LQ Newbie
 
Registered: Dec 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Thanks a lot, Mara.
Actually I don't plan to move it to user space, but it could be an option for me if my initial idea cannot work out.

I am thinking to move a certain driver, such as uart(amba-pl011) to run on another cpu, separated from the cpu that runs the Linux kernel.
Currently we have the monolithic kernel running on a cpu. I would like to dedicate another cpu to take care of a certain device, but the kernel that runs on the separated cpu is still the master to that device (driver). In order to achieve this, I need to take out the uart driver from kernel and make it a standalone code running on the second cpu. There will be some communication methods applied to the inter-cpu and user still sees the uart device under the Linux system.
I have no idea how should I separate the uart driver to make it an independent code, while still preserve its compatible with Linux kernel.

Last edited by unifoxz; 12-05-2011 at 06:26 PM.
 
Old 12-10-2011, 09:53 AM   #8
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Thanks for explanation. When you move the driver to other OS (have you looked into the licensing issues?), it will stop beeing compatible with Linux. You'll have to use another interrupt, DMA and memory management subsystems. It may be functionally fine, however, if you have all the functions you need in that other OS.
 
  


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
device driver for zigbee for the linux kernel 2.6.20 or 2.6.24??? alsexy Linux - Newbie 4 01-24-2013 08:43 AM
AMBA device registering drasko Linux - Kernel 0 08-14-2006 10:28 AM
How to compile device driver code for linux kernel 2.4.21 shrikantpwr245 Programming 1 06-04-2006 06:51 AM

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

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