# [solved] Problems assigning HW to VMs with PCI-Passthrough

## tuner23

Hy,

i have some problems assigning two network-cards on to different VMs with kvm.

What i do:

1. Remapping the devices:

```
 #!/bin/bash

##

## 06:02.0 Ethernet controller: D-Link System Inc DGE-528T Gigabit Ethernet Adapter (rev 10)

## 06:02.0 0200: 1186:4300 (rev 10)

## 06:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

## 06:03.0 0200: 10ec:8139 (rev 10)

## External interface

echo "10ec 8139" > /sys/bus/pci/drivers/pci-stub/new_id

echo "0000:06:03.0" > /sys/bus/pci/devices/0000:06:03.0/driver/unbind

echo "0000:06:03.0" > /sys/bus/pci/drivers/pci-stub/bind

echo "10ec 8139" > /sys/bus/pci/drivers/pci-stub/remove_id

## Internal interface

echo "1186 4300" > /sys/bus/pci/drivers/pci-stub/new_id

echo "0000:06:02.0" > /sys/bus/pci/devices/0000:06:02.0/driver/unbind

echo "0000:06:02.0" > /sys/bus/pci/drivers/pci-stub/bind

echo "1186 4300" > /sys/bus/pci/drivers/pci-stub/remove_id

```

2. Starting the VMs

```
# qemu-kvm -enable-kvm -drive file=/vms/prod/fw/fw.iso,if=virtio,boot=on -m 512 -smp 1 -curses -kernel /data/kernels/vmlinuz-2.6.36-gentoo-r8 -append "root=/dev/vda" -net nic,model=virtio,macaddr=DE:AD:DE:EF:2D:AD -net tap,ifname=tapfw0,script=/etc/qemu/qemu-ifup -device pci-assign,host=06:03.0

# qemu-kvm -enable-kvm -drive file=/vms/prod/res/res.iso,if=virtio,boot=on -m 512 -smp 1 -curses -kernel /data/kernels/vmlinuz-2.6.36-gentoo-r8 -append "root=/dev/vda" -net nic,model=virtio,macaddr=DE:AD:DE:EF:2D:AE -net tap,ifname=tapres0,script=/etc/qemu/qemu-ifup -device pci-assign,host=06:02.0

```

When i boot only one of them every network card works.

Every time i boot both, one of them is disabled (the one i booted first).

What is the problem here? I don't think that i can only assign devices to one virtual machine..

When i do a ping on the machine where the network doesn't work anymore, i get the following output on the other:

```
                   res ~ # tcpdump -i eth0                                                                           

                  tcpdump: verbose output suppressed, use -v or -vv for full protocol decode                        

                  listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes                             

                  23:01:39.432173 00:00:00:00:00:00 (oui Ethernet) > 49:4e:81:a4:02:02 (oui Unknown) Null Information, send seq 0, rcv seq 0, Flags [Command], length 84                            

...

```

Some data:

```
         moffat bin # cat /proc/interrupts

           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7       

  0:     533162          0          0          0          0          0          0          0   IO-APIC-edge      timer

  1:         64          0          0          0          0          0          0          0   IO-APIC-edge      i8042

  4:         10          0          0          0          0          0          0          0   IO-APIC-edge      serial

  8:         79          0          0          0          0          0          0          0   IO-APIC-edge      rtc0

  9:          0          0          0          0          0          0          0          0   IO-APIC-fasteoi   acpi

 16:         26          0          0          0          0          0          0          0   IO-APIC-fasteoi   ehci_hcd:usb1

 21:       2783          0          0          0          0          0          0          0   IO-APIC-fasteoi   kvm:0000:06:02.0

 22:       5165          0          0          0          0          0          0          0   IO-APIC-fasteoi   kvm:0000:06:03.0

 23:        122          0          0          0          0          0          0          0   IO-APIC-fasteoi   ehci_hcd:usb2

```

```
   moffat bin # cat /proc/ioports

0000-0cf7 : PCI Bus 0000:00

...

        e000-efff : PCI Bus 0000:06

    e080-e0ff : 0000:06:05.0

    e400-e4ff : 0000:06:03.0

      e400-e4ff : kvm_assigned_device

    e800-e8ff : 0000:06:02.0

      e800-e8ff : kvm_assigned_device

```

```
moffat bin # cat /proc/dma

 4: cascade

```

Have someone an idea what i am doing wrong in this case?

Thx in advance,

Antonios.Last edited by tuner23 on Mon Jun 13, 2011 5:21 pm; edited 1 time in total

----------

## tuner23

Ok,

the problem is that i can not passthrough PCI-slots, to multiple virtual machines when i have not a Mainboard with PCI-express and the cards are not PCI-express.

It's defined in the specification of VT-d.

Now with (new) PCIe-cards it works.

greets.

----------

