Re: Graphics card pass-through working with two pass pci-initialization

Jan Kiszka
2011-05-27T11:09:54Z

On 2011-05-27 07:32, André Weidemann wrote:
> Hi Gerd,
> I managed to pass through a graphics card to a Windows7 VM using your
> kraxel.q35 seabios branch
> (http://www.kraxel.org/cgit/seabios/log/?h=kraxel.q35).
>
> Here is my setup:
> Intel DX58SO
> Core i7 920
> Radeon HD 6950
> Kernel 2.6.35.7
> qemu-kvm git pull from May 26th
>
> The gfx card is working well on the desktop even with Aero turned on.
> I tried various 3D Games which worked good (some were a bit choppy ;-)
> though).

Cool!

>
> There were 2 games that made Windows crash.
> What is the way to debug what went wrong here?

Likely that's very hard to analyze, specifically as pass-through may
also widen pre-existing race windows that may reveal real bugs in the
drivers. However, you could start with tracing the host kvm events
around the crash using ftrace / trace-cmd. With a lot of luck, the
traces may contain some suspicious access patterns.

>
> One thing that is not working is the pass-through of a second device, a
> sound card in my case. As soon as I pass 2 devices to the VM, Windows
> does not boot anymore.
> If I continue and remove the second device from the command line the VM
> does not boot anymore with the passed through gfx card. The graphics
> card drivers crashes Windows, with the error message of not being able
> to reset the graphics card. A reboot of the host cures this problem.

Does it make a difference when you preserve the function address by
specifying -device pci-assign,host=03:00.0,addr=XX.0 and -device
pci-assign,host=03:00.1,addr=XX.1 (where XX is some free slot number in
the guest)?

>
> These are the command lines I used to start the VM:
>
> echo "1002 6719" > /sys/bus/pci/drivers/pci-stub/new_id
> echo 0000:03:00.0 > /sys/bus/pci/devices/0000\:03\:00.0/driver/unbind
> echo 0000:03:00.0 > /sys/bus/pci/drivers/pci-stub/bind
> echo "1002 6719" > /sys/bus/pci/drivers/pci-stub/remove_id
>
> qemu-system-x86_64 \
> -boot order=cd -cpu host -vnc 192.168.3.1:0 -k de \
> -smp 2,cores=2,sockets=1 \
> -drive file=${IMAGE},if=ide,index=0,cache=writeback -m 4096 \
> -drive file=/dev/sda3,if=ide,index=1,cache=none \ -drive
> file=/dev/sdb3,if=ide,index=2,cache=none \
> -drive file=/dev/cdrom,if=ide,index=3,media=cdrom,cache=none \
> -device pci-assign,host=03:00.0 \
> -net nic,model=e1000,macaddr=DE:AD:BE:EF:42:42 \
> -net tap,script=/usr/local/bin/qemu-ifup \
> -usb -usbdevice host:045e:00f9 \
> -monitor telnet:192.168.3.1:11111,server,nowait,nodelay
>
> Thank you very much for your work.
>

I've started to create a wiki page to save success stories like this one
and collect the open issues, see
http://www.linux-kvm.org/wiki/index.php?title=VGA_device_assignment.
Everyone is welcome to fix, update, or otherwise enhance it.

Jan

--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux