====== Piotr Jaroszyński: Usermode debugging under Linux ====== ===== Week 9 [ Jul 19 - Jul 25 2010 ] ===== ==== drivers in userspace ==== I have just pushed my [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/drivers|drivers in userspace branch]]. It's still a bit rough but it gets the job done. See [[week10|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 [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/drivers|drivers branch]] * You should be able to build a generic gpxe.linux binary with all the drivers: <code> make bin-$ARCH-linux/gpxe.linux </code> * Checkout [[http://github.com/peper/uio-dma/tree/gpxe|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 <code> $ ./configure --with-kernel=... && make </code> * Load modules <code> # insmod kmod/uio-dma.ko # insmod kmod/uio-dma-pci.ko </code> * 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: <code> # echo -n "0000:00:04.0" > /sys/bus/pci/drivers/$driver/unbind </code> * Add the vendor and device number to the uio-dma-pci driver <code> # echo "8086 100e" > /sys/bus/pci/drivers/uio-dma-pci/new_id </code> * That should autobind the device, to do it manully <code> # echo -n "0000:00:04.0" > /sys/bus/pci/drivers/uio-dma-pci/bind </code> * Expected ''dmesg'' output <code> 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 </code> * Run gpxe with ''-net lpci,dev=$DEV'' <code> # ./gpxe.linux --net lpci,dev=00:04.0 </code> * 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. <code> # 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 </code>


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