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

André Weidemann
2011-05-27T19:40:26Z

Hi,

On 27.05.2011 13:09, Jan Kiszka wrote:
> On 2011-05-27 07:32, André Weidemann wrote:

>> Here is my setup:
>> Intel DX58SO
>> Core i7 920
>> Radeon HD 6950
>> Kernel 2.6.35.7
>> qemu-kvm git pull from May 26th

>> 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)?

I did some further testing in assigning both the VGA and the sound card.
If I pass the devices to the VM like this:

-device pci-assign,host=03:00.0,addr=0x4 \ #VGA
-device pci-assign,host=00:1b.0,addr=0x5 \ #Sound

Windows boots up, but the sound card is not visible as a device inside
the VM.

Running "info pci" in the monitor shows this:
Bus 0, device 4, function 0:
VGA controller: PCI device 1002:6719
IRQ 11.
BAR0: 32 bit prefetchable memory at 0xe0000000 [0xefffffff].
BAR2: 32 bit memory at 0xfeba0000 [0xfebbffff].
BAR4: I/O at 0xc000 [0xc0ff].
BAR6: 32 bit memory at 0xffffffffffffffff [0x0001fffe].
id ""
Bus 0, device 5, function 0:
Audio controller: PCI device 8086:3a3e
IRQ 10.
BAR0: 32 bit memory at 0xffffffffffffffff [0x00003ffe].
id ""

If I switch the order of the two devices to this:

-device pci-assign,host=00:1b.0,addr=0x4 \ #Sound
-device pci-assign,host=03:00.0,addr=0x5 \ #VGA

I get the following error and kvm crashes:

http://pastebin.com/KmKEqhWK

It looks like the free PCI memory was not enough to assign the graphics
card after assigning the sound card.

If I only assign the sound card, then "info pci" in the monitor looks
like this:
Bus 0, device 4, function 0:
Audio controller: PCI device 8086:3a3e
IRQ 10.
BAR0: 32 bit memory at 0xfebf0000 [0xfebf3fff].
id ""

The device is then visible inside the VM and working.

If I am not mistaken then the graphics card needs 2 bars, one with 256MB
and one with 128K. The sound card then needs 1 bar with 16K of PCI memory.
How big is the PCI memory with seabios?
Is there really not enough space to "squeeze" in those extra 16K?

Regards
André