Skip to contentSkip to conversation

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

DISCUSSION Albert Cahalan 2 participants 4 messages Mar 11, 2005 – Mar 14, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · Peter Chubb

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 bus-mastering DMA device, with the specified dma mask.

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);

(with the user library returning an int instead of long)

#1 lore raw
Quoted 6 lines

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 file handle that has the expected revocation effects on unplug and refcounts

Alan

#2 lore raw
Quoted 9 lines · Alan Cox
Quoted 5 lines

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 file handle that has the expected revocation effects on unplug and refcounts

I was under the impression that a file handle would be returned.

I'm not so sure that is a sane way to handle hot-plug though. First of all, in general, it's going to be like this:

Fan, meet shit.
Shit, meet fan.

Those who care might best be served by SIGBUS with si_code and si_info set appropriately. Perhaps a revoke() syscall that handled mmap() would work the same way.

#3 lore raw
Quoted 5 lines · Albert Cahalan
Quoted 3 lines

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 popular "open" system call