access PCI card trouble from VM guest
Hello,
I want to access this PCI card from one VM :
10:00.0 Serial controller: Moxa Technologies Co Ltd CP-132EL (2-port RS-422/485 Smart PCI Express Serial Board)
This card is not handle by driver on the host kernel.
When I start the VM with this command (generated vy libvirt) :
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/
QEMU_AUDIO_DRV=none /usr/bin/kvm -name huahine -S -machine
pc-i440fx-1.5,accel=kvm,usb=off -cpu SandyBridge,+pdpe1gb,+osxsave,+dca,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme,hv_relaxed -m 4096 -smp 2,sockets=2,cores=1,threads=1 -uuid
efaa3133-eb5a-e9c3-5120-d6dd5e4551ca -no-user-config -nodefaults
-chardev
socket,id=charmonitor,path=/var/lib/libvirt/qemu/huahine.monitor,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime
-no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -drive file=/dev/drbd2,if=none,id=drive-scsi0-0-0-0,format=raw,cache=none
-device
scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1
-drive
file=/Iso/virtio-win.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev
tap,fd=23,id=hostnet0 -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:1f:ba:4e,bus=pci.0,addr=0x3
-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0
-vnc 127.0.0.1:2 -k fr -vga std -device
pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
I get this error message :
qemu-system-x86_64: -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6: No IOMMU found. Unable to assign device "hostdev0"
qemu-system-x86_64: -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6:
Device initialization failed.
qemu-system-x86_64: -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6:
Device 'kvm-pci-assign' could not be initialized
2013-06-11 16:01:15.131+0000: shutting down
I check in the BIOS and all virtualization technologie seems to
be enable.
If I grep IOMMU in the bootlog of the server (I don't know if
it's related or not), I see this :
messages.1:Jun 11 14:22:54 futuna kernel: [ 0.028041] IOMMU 0:reg_base_addr fbdfe000 ver 1:0 cap d2078c106f0462 ecap f020fe
messages.1:Jun 11 14:22:54 futuna kernel: [ 0.028049] IOMMU 1:reg_base_addr f4ffe000 ver 1:0 cap d2078c106f0462 ecap f020fe
Any idea to debug this ?
David.
Quoted 58 lines · David Cure
Hello,
I want to access this PCI card from one VM :
10:00.0 Serial controller: Moxa Technologies Co Ltd CP-132EL (2-port RS-422/485 Smart PCI Express Serial Board)
This card is not handle by driver on the host kernel.
When I start the VM with this command (generated vy libvirt) :
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/
QEMU_AUDIO_DRV=none/usr/bin/kvm-name huahine -S -machine
pc-i440fx-1.5,accel=kvm,usb=off -cpu SandyBridge,+pdpe1gb,+osxsave,+dca,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme,hv_relaxed -m 4096 -smp 2,sockets=2,cores=1,threads=1 -uuid
efaa3133-eb5a-e9c3-5120-d6dd5e4551ca -no-user-config -nodefaults
-chardev
socket,id=charmonitor,path=/var/lib/libvirt/qemu/huahine.monitor,server,nowait(quoted diff) +0
-3-mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -drivefile=/dev/drbd2,if=none,id=drive-scsi0-0-0-0,format=raw,cache=none
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive
file=/Iso/virtio-win.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=23,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:1f:ba:4e,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0
-vnc 127.0.0.1:2 -k fr -vga std -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5I get this error message :
qemu-system-x86_64: -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6: No IOMMU found. Unable to assign device "hostdev0"
qemu-system-x86_64: -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6:
Device initialization failed.
qemu-system-x86_64: -device pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6:
Device 'kvm-pci-assign' could not be initialized2013-06-11 16:01:15.131+0000: shutting downI check in the BIOS and all virtualization technologie seems to
be enable.If I grep IOMMU in the bootlog of the server (I don't know if
it's related or not), I see this :
Quoted 8 lines
messages.1:Jun 11 14:22:54 futuna kernel: [ 0.028041] IOMMU 0:
reg_base_addrfbdfe000ver 1:0 capd2078c106f0462ecap f020fe
messages.1:Jun 11 14:22:54 futuna kernel: [ 0.028049] IOMMU 1:reg_base_addrf4ffe000ver 1:0 capd2078c106f0462ecap f020feAny idea to debug this ?
Boot the host with intel_iommu=on, but if you want 10:00.0, why are you assigning 2a:00.3? Note that you can't/shouldn't assign bridges, assign the actual end device. Thanks,
Alex
Hello Alex,
Le Mon, Jun 17, 2013 at 07:24:54AM -0600, Alex Williamson ecrivait :
Quoted 2 lines
Boot the host with intel_iommu=on,
I add it, and now I can start the VM, thanks a lot. (will look
now if I can access it in the VM ;))
Quoted 2 lines
but if you want 10:00.0, why are you
assigning 2a:00.3?
just a copy/paste trouble : not the right log ;)
David.
Quoted 1 line
Quand tu veux enregister, tu as le trombone qui apparait
et qui te demande si tu ne veux pas sauver.
Non c'est pour un tennis co____d !!
-+- PD/TP in Guide du Finixien Pervers : Bien jouer au trombonne
Le Mon, Jun 17, 2013 at 12:00:10PM +0200, David Cure ecrivait :
Quoted 6 lines
10:00.0 Serial controller: Moxa Technologies Co Ltd CP-132EL (2-port RS-422/485 Smart PCI Express Serial Board)
pci-assign,configfd=24,host=2a:00.3,id=hostdev0,bus=pci.0,addr=0x6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
the pci id for the host is a mistake (I try to access network
card too to see if it's works ... and no), I have the right PCI id (10:00.0) for the card.
David.