lca2008 — writing a PCI driver using qemu minitalk

Started off Tuesday at the kernel mini-conf. Unfortunately, due to a typo in the printed program, I missed a talk I was kinda interested in seeing (How not to invent kernel interfaces by Arnd Bergmann), and didn’t get there until hch’s talk on writing a PCI driver using qemu.

hch showed a lot of boilerplate code saying that much of it was “trivial, trivial”, and it certainly did seem like it, even to a PCI newbie such as YT. On the qemu side, it was some more “trivial boilerplate code” and again, it all seemed pretty straightforward. He mentioned that the RealTek 8139 would be a good example on the qemu side to try and learn from. He also pointed out that qemu was written by a former winner of the Obfuscated C contest, so the only way to really understand it is to get the swords out and start cutting your way through line after line of uncommented code. Good luck.

Unfortunately for me, I wasn’t smart enough to understand the implication of *why* one would want to use qemu to write a fake piece of hardware and then use it to write a device driver. hch pointed out that it was much easier to simulate hardware using C and qemu compared to writing out VHDL (which I certainly agree with), but I didn’t have any “ah ha” moments from a kernel guy perspective. Oh well, I’m certainly not as smart as hch, so maybe this is something useful for him, but I just didn’t get it.

On a side note, hch seems pretty personable to me; surprising, given his kinda bad guy reputation on lkml. Before his talk, we happened to be sitting outside the lecture hall, and he had no problems watching my bag whilst I got a coffee. Maybe the secret to making him like you is by not writing any SCSI code and certainly not showing it to him if you did.