On Fri, Jan 10, 2020 at 03:58:16AM +0000, Joseph Mayer wrote: > Maybe this topic is better suited for tech@, you tell: > > Is there some way I can implement PCI drivers in userland in OpenBSD? > > On a quick Internet search, see some discussion for Linux and NetBSD > e.g. [1] however nothing in OpenBSD. > > I may be interested in operating some PCI device manually from my own > program (run as root or user) in OpenBSD, and I can see this being of > interest to others also, asking therefore. >
If you're developing a new driver and you want to do quick edit->build->test cycles, you could expose in user-space the proper minimal interface and develop parts (all?) of your driver in user-space. This is useful especially if the device is poorly documented or complex and requires many prototyping. Once you understand the hardware and you're satisified with your design, you could turn it into a kernel driver. If you're talking about giving user programs direct access to the PCI bus, the necessary isolation mechanisms are missing. Furthermore, no matter if it's running in user-mode or in kernel-mode, the driver code will do the same thing, so in most cases there's no benefit of running it in user-space. my 2 cents