Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-14 Thread Alan Cox
On Llu, 2005-03-14 at 00:13, Peter Chubb wrote: > Greg> see mmap(2) > > mmap maps a file's contents into your own virtual memory. > usr_pci_map maps part of your own virtual memory into pci bus space > for a particular device (using the IOMMU if your machine has one), and > returns a scatterlist

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-14 Thread Alan Cox
On Gwe, 2005-03-11 at 21:04, Albert Cahalan wrote: > > Still insufficient because the device might be hotplugged on you. You > > need a file handle that has the expected revocation effects on unplug > > and refcounts > > I was under the impression that a file handle would be returned. Then lets

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-14 Thread Alan Cox
On Gwe, 2005-03-11 at 21:04, Albert Cahalan wrote: Still insufficient because the device might be hotplugged on you. You need a file handle that has the expected revocation effects on unplug and refcounts I was under the impression that a file handle would be returned. Then lets use that

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-14 Thread Alan Cox
On Llu, 2005-03-14 at 00:13, Peter Chubb wrote: Greg see mmap(2) mmap maps a file's contents into your own virtual memory. usr_pci_map maps part of your own virtual memory into pci bus space for a particular device (using the IOMMU if your machine has one), and returns a scatterlist of bus

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-13 Thread Peter Chubb
> "Greg" == Greg KH <[EMAIL PROTECTED]> writes: Greg> On Fri, Mar 11, 2005 at 07:34:46PM +1100, Peter Chubb wrote: >> > "Greg" == Greg KH <[EMAIL PROTECTED]> writes: >> Greg> On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: >> >> +/* + * The PCI subsystem is implemented as

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-13 Thread Peter Chubb
Greg == Greg KH [EMAIL PROTECTED] writes: Greg On Fri, Mar 11, 2005 at 07:34:46PM +1100, Peter Chubb wrote: Greg == Greg KH [EMAIL PROTECTED] writes: Greg On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: +/* + * The PCI subsystem is implemented as yet-another pseudo

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-12 Thread Jon Smirl
Here's a two year old patch for doing the same thing inside of UML but it was never merged. The advantage to this scheme is that UML implements the kernel. The same driver source code can be used inside UML and the main kernel. I modified UML so that it implemented all of the common calls drivers

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-12 Thread Andrew Grover
On Fri, 11 Mar 2005 14:37:17 +1100, Peter Chubb <[EMAIL PROTECTED]> wrote: > + npages = get_user_pages(current, > + current->mm, > + (unsigned long)m.virtaddr, > + maxpages, > +

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-12 Thread Andrew Grover
On Fri, 11 Mar 2005 14:37:17 +1100, Peter Chubb [EMAIL PROTECTED] wrote: + npages = get_user_pages(current, + current-mm, + (unsigned long)m.virtaddr, + maxpages, +

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-12 Thread Jon Smirl
Here's a two year old patch for doing the same thing inside of UML but it was never merged. The advantage to this scheme is that UML implements the kernel. The same driver source code can be used inside UML and the main kernel. I modified UML so that it implemented all of the common calls drivers

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Albert Cahalan
On Fri, 2005-03-11 at 19:15 +, Alan Cox wrote: > > You forgot the PCI domain (a.k.a. hose, phb...) number. > > Also, you might encode bus,slot,function according to > > the PCI spec. So that gives: > > > > long usr_pci_open(unsigned pcidomain, unsigned devspec, __u64 dmamask); > > Still

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Alan Cox
On Gwe, 2005-03-11 at 08:34, Peter Chubb wrote: > Greg> If you make it a real, mountable filesystem, then you don't need > Greg> to have any of your new syscalls, right? Why not just do that > Greg> instead? > The only call that would go is usr_pci_open() -- you'd still need > usr_pci_map(),

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Alan Cox
> You forgot the PCI domain (a.k.a. hose, phb...) number. > Also, you might encode bus,slot,function according to > the PCI spec. So that gives: > > long usr_pci_open(unsigned pcidomain, unsigned devspec, __u64 dmamask); Still insufficient because the device might be hotplugged on you. You need

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Jesse Barnes
On Friday, March 11, 2005 7:21 am, Greg KH wrote: > > The only call that would go is usr_pci_open() -- you'd still need > > usr_pci_map() > > see mmap(2) > > > , usr_pci_unmap() > > see munmap(2) Aren't those different cases though? E.g. you might have a buffer in userland that you want to DMA

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Greg KH
On Fri, Mar 11, 2005 at 07:34:46PM +1100, Peter Chubb wrote: > > "Greg" == Greg KH <[EMAIL PROTECTED]> writes: > > Greg> On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: > >> +/* + * The PCI subsystem is implemented as yet-another pseudo > >> filesystem, + * albeit one that is

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Pavel Machek
Hi! > >> +/* + * The PCI subsystem is implemented as yet-another pseudo > >> filesystem, + * albeit one that is never mounted. + * This is its > >> magic number. + */ +#define USR_PCI_MAGIC (0x12345678) > > Greg> If you make it a real, mountable filesystem, then you don't need > Greg> to have

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Peter Chubb
> "Greg" == Greg KH <[EMAIL PROTECTED]> writes: Greg> On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: >> +/* + * The PCI subsystem is implemented as yet-another pseudo >> filesystem, + * albeit one that is never mounted. + * This is its >> magic number. + */ +#define

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Peter Chubb
Greg == Greg KH [EMAIL PROTECTED] writes: Greg On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: +/* + * The PCI subsystem is implemented as yet-another pseudo filesystem, + * albeit one that is never mounted. + * This is its magic number. + */ +#define USR_PCI_MAGIC (0x12345678)

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Pavel Machek
Hi! +/* + * The PCI subsystem is implemented as yet-another pseudo filesystem, + * albeit one that is never mounted. + * This is its magic number. + */ +#define USR_PCI_MAGIC (0x12345678) Greg If you make it a real, mountable filesystem, then you don't need Greg to have any of your

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Greg KH
On Fri, Mar 11, 2005 at 07:34:46PM +1100, Peter Chubb wrote: Greg == Greg KH [EMAIL PROTECTED] writes: Greg On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: +/* + * The PCI subsystem is implemented as yet-another pseudo filesystem, + * albeit one that is never mounted. + *

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Jesse Barnes
On Friday, March 11, 2005 7:21 am, Greg KH wrote: The only call that would go is usr_pci_open() -- you'd still need usr_pci_map() see mmap(2) , usr_pci_unmap() see munmap(2) Aren't those different cases though? E.g. you might have a buffer in userland that you want to DMA to a card,

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Alan Cox
You forgot the PCI domain (a.k.a. hose, phb...) number. Also, you might encode bus,slot,function according to the PCI spec. So that gives: long usr_pci_open(unsigned pcidomain, unsigned devspec, __u64 dmamask); Still insufficient because the device might be hotplugged on you. You need a

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Alan Cox
On Gwe, 2005-03-11 at 08:34, Peter Chubb wrote: Greg If you make it a real, mountable filesystem, then you don't need Greg to have any of your new syscalls, right? Why not just do that Greg instead? The only call that would go is usr_pci_open() -- you'd still need usr_pci_map(),

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-11 Thread Albert Cahalan
On Fri, 2005-03-11 at 19:15 +, Alan Cox wrote: You forgot the PCI domain (a.k.a. hose, phb...) number. Also, you might encode bus,slot,function according to the PCI spec. So that gives: long usr_pci_open(unsigned pcidomain, unsigned devspec, __u64 dmamask); Still insufficient

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-10 Thread Greg KH
On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: > +/* > + * The PCI subsystem is implemented as yet-another pseudo filesystem, > + * albeit one that is never mounted. > + * This is its magic number. > + */ > +#define USR_PCI_MAGIC (0x12345678) If you make it a real, mountable

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-10 Thread Albert Cahalan
Peter Chubb writes: > There are three new system calls: > > long usr_pci_open(int bus, int slot, int function, __u64 dma_mask); > Returns a filedescriptor for the PCI device described > by bus,slot,function. It also enables the device, and sets it > up as a

User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-10 Thread Peter Chubb
USER LEVEL DRIVERS: enable PCI device drivers at user space. This patch adds the capability for suitably privileged user-level processes to enable a PCI device, and set up DMA for it. A subsequent patch hooks up the actual system calls. There are three new system calls: long

User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-10 Thread Peter Chubb
USER LEVEL DRIVERS: enable PCI device drivers at user space. This patch adds the capability for suitably privileged user-level processes to enable a PCI device, and set up DMA for it. A subsequent patch hooks up the actual system calls. There are three new system calls: long

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-10 Thread Albert Cahalan
Peter Chubb writes: There are three new system calls: long usr_pci_open(int bus, int slot, int function, __u64 dma_mask); Returns a filedescriptor for the PCI device described by bus,slot,function. It also enables the device, and sets it up as a

Re: User mode drivers: part 2: PCI device handling (patch 1/2 for 2.6.11)

2005-03-10 Thread Greg KH
On Fri, Mar 11, 2005 at 02:37:17PM +1100, Peter Chubb wrote: +/* + * The PCI subsystem is implemented as yet-another pseudo filesystem, + * albeit one that is never mounted. + * This is its magic number. + */ +#define USR_PCI_MAGIC (0x12345678) If you make it a real, mountable filesystem,