PCI pass through

about addr , this can be different in guest and host.


for the command line , copy/paste problem ...pff...damn, remove space.

proper command line :

Code:
/usr/bin/kvm -id 105 -chardev socket,id=monitor,path=/var/run/qemu-server/105.mon,server,nowait -mon chardev=monitor,mode=readline -vnc unix:/var/run/qemu-server/105.vnc,x509,password -pidfile /var/run/qemu-server/105.pid -daemonize -readconfig /usr/share/qemu-server/pve-usb.cfg -device usb-tablet,bus=ehci.0,port=6 -device pci-assign,host=04:05.0,id=hostpci0,bus=pci.0,addr=0x10 -name bluecherry -smp sockets=1,cores=4 -nodefaults -boot menu=on,order=cdn -vga cirrus -tdf -k en-us -drive file=/var/lib/vz/iso/ubuntu-10.04-alternate-amd64.iso,if=none,id=drive-ide2,media=cdrom,aio=native -device ide-drive,bus=ide.1,unit=0,drive=drive-ide2,id=device-ide2 -drive file=/dev/vg1/vm-105-disk-1,if=none,id=drive-ide0,aio=native,boot=on -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0,id=device-ide0 -m 2048 -netdev type=tap,id=net0,ifname=tap105i0,script=/var/lib/qemu-server/pve-bridge -device rtl8139,romfile=,mac=E2:C5:87:8D:4B:BF,netdev=net0,bus=pci.0,addr=0x12 -cpuunits 1000
 
Ok it appears that command was closer thanks now i get this error

Code:
*** EHCI support is under development ***
No IOMMU found.  Unable to assign device "hostpci0"
kvm: -device pci-assign,host=04:05.0,id=hostpci0,bus=pci.0,addr=0x10: Device 'pci-assign' could not be initialized
 
ok, so, when proxmox start the vm with hostpci, before launching command line "qemu ...", proxmox do some actions to unbind device from host

could you make a
#lspci -n



... 04:05.0 0200: 8086:10b9 ...
and now make : (replace values by your result)

echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:04:05.0 > /sys/bus/pci/devices/0000:04:05.0/driver/unbind
echo 0000:04:05.0 > /sys/bus/pci/drivers/pci-stub/bind



can you send the result ?
 
Those commands seem to run without error i am guessing that is a good sign.

Code:
root@sun:/home/c0mputerking# lspci -n
00:00.0 0600: 8086:0108 (rev 09)
00:1a.0 0c03: 8086:1c2d (rev 04)
00:1c.0 0604: 8086:1c10 (rev b4)
00:1c.4 0604: 8086:1c18 (rev b4)
00:1c.5 0604: 8086:1c1a (rev b4)
00:1d.0 0c03: 8086:1c26 (rev 04)
00:1e.0 0604: 8086:244e (rev a4)
00:1f.0 0601: 8086:1c52 (rev 04)
00:1f.2 0106: 8086:1c02 (rev 04)
00:1f.3 0c05: 8086:1c22 (rev 04)
02:00.0 0200: 14e4:165a
03:00.0 0604: 10e3:8113
04:05.0 0400: 1bb3:5310
05:03.0 0300: 102b:0532 (rev 0a)
root@sun:/home/c0mputerking# echo "1bb3 5310" > /sys/bus/pci/drivers/pci-stub/new_id
root@sun:/home/c0mputerking# echo 0000:04:05.0 > /sys/bus/pci/devices/0000:04:05.0/driver/unbind
root@sun:/home/c0mputerking# echo 0000:04:05.0 > /sys/bus/pci/drivers/pci-stub/bind
root@sun:/home/c0mputerking#

PS thanks again all, for all the help I have participated in another post somewhere on the proxmox forums, running these exact commands and the is where the post seemed to end, as i stopped getting email notifications regarding it.

As I, and I am sure many others here would be really happy/lucky to have PCI passthough working on proxmox.
 
This functionality is absolutely necessary for me, as well as other using proxmox, think we are getting close now. Please can we get this feature going??
 
mmm, sound like iommu not working...


"No IOMMU found. "


maybe could you try to pass


intel_iommu=on

in kernel parameters ?

/boot/grub/grub.conf

> linux /vmlinuz-2.6.32-6-pve root=/dev/mapper/pve-root ro intel_iommu=on


and reboot
 
ok i have added the ioumm stuff to grub and it does get me more output regarding iommu. However i still get an error below when trying to run the vm command.

Code:
dmesg | grep -e DMAR -e IOMMU
ACPI: DMAR 00000000bf7e8000 000B0 (v01 INTEL      SNB  00000001 INTL 00000001)
Intel-IOMMU: enabled
DMAR: Host address width 36
DMAR: DRHD base: 0x000000fed91000 flags: 0x1
IOMMU fed91000: ver 1:0 cap c9008020660262 ecap f010da
DMAR: RMRR base: 0x000000bf65a000 end: 0x000000bf65bfff
DMAR: No ATSR found
IOMMU 0xfed91000: using Queued invalidation
IOMMU: Setting RMRR:
IOMMU: Setting identity map for device 0000:00:1d.0 [0xbf65a000 - 0xbf65c000]
IOMMU: Setting identity map for device 0000:00:1a.0 [0xbf65a000 - 0xbf65c000]
IOMMU: Prepare 0-16MiB unity mapping for LPC
IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0x1000000]

Code:
 /usr/bin/kvm -id 105 -chardev socket,id=monitor,path=/var/run/qemu-server/105.mon,server,nowait -mon chardev=monitor,mode=readline -vnc unix:/var/run/qemu-server/105.vnc,x509,password -pidfile /var/run/qemu-server/105.pid -daemonize -readconfig /usr/share/qemu-server/pve-usb.cfg -device usb-tablet,bus=ehci.0,port=6 -device pci-assign,host=04:05.0,id=hostpci0,bus=pci.0,addr=0x10 -name bluecherry -smp sockets=1,cores=4 -nodefaults -boot menu=on,order=cdn -vga cirrus -tdf -k en-us -drive file=/var/lib/vz/iso/ubuntu-10.04-alternate-amd64.iso,if=none,id=drive-ide2,media=cdrom,aio=native -device ide-drive,bus=ide.1,unit=0,drive=drive-ide2,id=device-ide2 -drive file=/dev/vg1/vm-105-disk-1,if=none,id=drive-ide0,aio=native,boot=on -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0,id=device-ide0 -m 2048 -netdev type=tap,id=net0,ifname=tap105i0,script=/var/lib/qemu-server/pve-bridge -device rtl8139,romfile=,mac=E2:C5:87:8D:4B:BF,netdev=net0 ,bus=pci.0,addr=0x12 -cpuunits 1000
kvm: -device rtl8139,romfile=,mac=E2:C5:87:8D:4B:BF,netdev=net0: could not open disk image ,bus=pci.0,addr=0x12: No such file or directory
 
PCI passthough is the only reason I use VMware for napp-it (which is brilliant)

I'm dying to switch it over to Proxmox.
 
in your vm config file, try:

hostpci0: 04:05.0


(now we have hostpci0 , hostpci1 , 1 line by passthrough device)

Hi, I have successfully used "hostpci0: XX:XX.X" and "hostpci1: XX:XX.X" options in the VM config file, but I needed a 3rd device and added "hostpci2: XX:XX.X"

Unfortunately, the system didn't like "hostpci2:" is that really the case that only 2 pci devices can be passed to the VM using this configuration option?

What alternatives do I have to get this accomplished in the conf file?

Any help is much appreciated.

(before someone asks why in earth I need 3 pci devices passed to a VM, this is to assign SR-IOV network virtual functions to a firewall appliance that, in my case, needs 3 NICs)
 
we have limited promox2 to 2 hostpci devices.

we have fixed pci slots for each type of devices (virtio, nic,hostpci,usb,...) .

Can't you use virtio nic ? (I have benched 5gbit/s)

Thanks for your reply.

If I wish to increase the limit to 3 hostpci devices, is this something I could achieve by changing a few config files (which ones?) or would I have to get my hands a lot dirtier?

In your bench did you only measure throughtput or did you set up an environment with a lot of traffic between VMs?
Because throughput is not my main concern, what I really want is to avoid the softswitch logic taxing the CPU too much when I could just offload that to the 82756-based card.

However, I must say that coming from Xen world I am not familiar with virtio. Will do some research now.
 
virtio nic is really fast, as they use the new vhost-net infrastucture. (very low cpu) (I have benched 5git/s with http requests)


but if you want really more than 2 hostpci , you can try 2 methods:

1)
don't know if it's work, but you can try:

args: -device pci-assign,host=XX:XX:XX

(not sure if it's work, because when vm start, we unbind the device from the host)



2)
hack the code

edit
/usr/share/perl5/PVE/QemuServer.pm

change

<code>
my $MAX_HOSTPCI_DEVICES = 2
</code>
to
<code>
my $MAX_HOSTPCI_DEVICES = 3
</code>
and
<code>
hostpci0 => { bus => 0, addr => 16 },
hostpci1 => { bus => 0, addr => 17 },
net0 => { bus => 0, addr => 18 },

to

hostpci0 => { bus => 0, addr => 16 },
hostpci1 => { bus => 0, addr => 17 },
hostpci2 => { bus => 0, addr => 19 },


</code>

then restart apache
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!