Piotr Jaroszyński: Usermode debugging under Linux

Week 9 [ Jul 19 - Jul 25 2010 ]

drivers in userspace

I have just pushed my drivers in userspace branch. It's still a bit rough but it gets the job done. See next week's report for an issue that particularly bugs me. Before getting into details of the implementation let's see a quick HOWTO first:

  • Checkout my drivers branch
  • You should be able to build a generic gpxe.linux binary with all the drivers:
make bin-$ARCH-linux/gpxe.linux
  • Checkout the gpxe branch of my clone of the UIO-DMA repo
  • Build it. If you are building against kernel <2.6.33 revert 98b95f6 [build] Update the location of utsrelease.h
$ ./configure --with-kernel=... && make
  • Load modules
# insmod kmod/uio-dma.ko
# insmod kmod/uio-dma-pci.ko
  • Get a spare nic or run under kvm with multiple nics
  • If the device is bound to a driver (lspci -k shows that) unbind it first:
# echo -n "0000:00:04.0" > /sys/bus/pci/drivers/$driver/unbind
  • Add the vendor and device number to the uio-dma-pci driver
# echo "8086 100e" > /sys/bus/pci/drivers/uio-dma-pci/new_id
  • That should autobind the device, to do it manully
# echo -n "0000:00:04.0" > /sys/bus/pci/drivers/uio-dma-pci/bind
  • Expected dmesg output
UIO DMA kernel backend - version 2.0
Copyright (c) 2009 Qualcomm Inc. Written by Max Krasnyansky <maxk@qualcomm.com>
Driver enabling UIO-DMA for a device version: 0.0.0
ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10
uio-dma-pci 0000:00:04.0: PCI INT A -> Link[LNKD] -> GSI 10 (level, high) -> IRQ 10
uio-dma: added device. id 0 0000:00:04.0
  • Run gpxe with -net lpci,dev=$DEV
# ./gpxe.linux --net lpci,dev=00:04.0
  • Expected results on a linux guest run in quemu-kvm with the e1000 nic emulated. And gpxe with a simple embedded script that just fetches a 100mb file.
# lspci -nn | grep 04
00:04.0 Ethernet controller [0200]: Intel Corporation 82540EM Gigabit Ethernet Controller [8086:100e] (rev 03)
# ./gpxe.linux --net lpci,dev=00:04.0
gPXE initialising devices...ok



gPXE 1.0.1+ -- Open Source Boot Firmware -- http://etherboot.org
Features: HTTP DNS TFTP
DHCP (net0 52:54:00:12:34:58).... ok
net0: 52:54:00:12:34:58 on PCI00:04.0 (open)
  [Link:up, TX:3 TXE:0 RX:10 RXE:0]
http://root.piotrj.org/files/gpxe/100mb................ ok
time: 15s

QR Code
QR Code soc:2010:peper:journal:week9 (generated for current page)