

Linus Torvalds included patches into the mainline tree which implement a stable userspace driver API into the Linux kernel.



The stable driver API was already announced a year ago by Greg Kroah-Hartman. Now the last patches where uploaded and the API was included in Linus’ tree. The idea of the API is to make life easier for driver developers:

This interface allows the ability to write the majority of a driver in userspace with only a very small shell of a driver in the kernel itself. It uses a char device and sysfs to interact with a userspace process to process interrupts and control memory accesses.

Since future drivers using this API will run mainly in userspace there is no need to open up the source code for these parts. Also, drivers can be re-used even after kernel changes because the API will remain stable.

The background motivation for the inclusion of such a stable API comes form the embedded world: there embedded drivers are often closed source and just developed for a single kernel version and are not maintained over time. Using the new API these drivers could be used for a longer time.

And in fact such an API has already been developed by people from the embedded industry to make their life easier. But it was just developed for a single device and not as a generic interface. Such developments are now unnecessary.

However, DMA transfer between userspace and kernelspace is not yet implemented. This means essentially that drivers which involve high traffic are not an option yet. So graphic drivers as well as file system drivers and similar cannot use this API at the moment.

Some people might ask now why not simply allow closed source kernel drivers directly in the kernel, since they are allowed in userspace now anyway. But there is a huge difference between these two types of drivers – while userspace drivers can be controlled in a certain way and cannot trash the kernel kernelspace drivers could do that. A quite good explanation about the topic can be read at LWN.

The other way around one could ask if this will mean the end for Linux (for example according to the LWN article). But again, kernelspace and userspace is very different – an d with the new API the important part (the kernelaspace part) still has to be Open Source! Besides, this API does not introduce anything which was not possible before: as already mentioned such an API was already developed quite some time ago, and was actively used.

But I must also admit that while I see the need for such an API I still prefer hardware vendors who simply make the drivers Open Source and bring them upstream.

Thanks to German heise.de for a detailed article about the topic.