Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
qemu-kvm usb passthrought problem.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Thu Aug 16, 2012 5:40 pm    Post subject: qemu-kvm usb passthrought problem. Reply with quote

Good day.
First, I am not 100% sure this is where it should go, so moderators, feel free to scold me and move this to the appropriate forum if needed.

I have a bit of a usb problem with qemu-kvm.

I'm trying to get my arduino board to speak with a gentoo x86 virtual machine, but it's proving to be rather stuborn.

Connecting the board via USB and doing lsusb on the host.

Code:

host local.d # lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 005 Device 007: ID 2341:0042


Bus 005 Device 007: ID 2341:0042 this gives me the ID to use to give qemu-kvm.

I start the virtual machine.

Code:
qemu-kvm -smp 2 -name "dragonball1",process="dragonball1" -vnc 192.168.X.XX:5 -net nic,macaddr=00:00:00:00:00:06 -net vde -hda PATH_TO_DISK_IMAGE -m 512 -daemonize -usb -usbdevice host:2341:0042 


In the virtual machine, it shows up as /dev/ttyACM0 as it should and lsusb shows it properly, but I can't talk to it. Communication does not go from the VM to the board (it doesn't react to commands I send) and does not flow back (I get no output).

I've done this in virtualbox on my windows machine and it worked flawlessly, but I don't want virtualbox on my server. (Oracle ...)
I know the firmware on the board is good and should both take input and send output, so something isn't talking.

Any help would be appreciated.
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Fri Aug 17, 2012 5:26 am    Post subject: Reply with quote

Hi,

I've had similar problems with some usb modems that wouldn't work properly....
What worked for me is the pci paththrough of the whole usb port (via intel VT-D).

This is what I use to map the usb port:
Code:

echo 8086 3a36 >/sys/bus/pci/drivers/pci-stub/new_id
echo 0000:00:1d.2 >/sys/bus/pci/devices/0000\:00\:1d.2/driver/unbind
echo 0000:00:1d.2 >/sys/bus/pci/drivers/pci-stub/bind

qemu-kvm -device pci-assign,host=00:1d.2 $all_other_kvm_options


See lspci -n for the numbers...
http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM

HTH, cheers
_________________
Power to the people!
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Fri Aug 17, 2012 2:22 pm    Post subject: Reply with quote

Sounds interesting. I'm not on intel, unfortunatly. I'm on AMD. I'm guessing there is a similar procedure?
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Fri Aug 17, 2012 2:30 pm    Post subject: Reply with quote

I had a look at the page and I'm not convinced this will work for me. It requires hardware support I most likely do not have, not according to the wiki for AMD boards anyway.

I could use a litle more help making sure.

Motherboard is an Asus M4A87TD
CPU is a Phenom II x6 1090T
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.


Last edited by madchaz on Sat Aug 18, 2012 4:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Fri Aug 17, 2012 4:32 pm    Post subject: Reply with quote

You'll probably see an option to enable iommu (maybe it is called something else about virtualization) within the bios.
Code:

dmesg | grep AMD-Vi

should tell you if it is enabled... or grep for IOMMU

HTH
_________________
Power to the people!
Back to top
View user's profile Send private message
Circuitsoft
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jul 2004
Posts: 112

PostPosted: Fri Aug 17, 2012 10:26 pm    Post subject: Reply with quote

madchaz wrote:
Motherboard is an Asus A8N-E.
CPU is a Phenom II x6 1090T
How did you fit a Phenom II into a socket 939 motherboard?
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Sat Aug 18, 2012 4:36 pm    Post subject: Reply with quote

Edit: Because I fail at IT 101 and checked the wrong box. Dur. Corrected above
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Sat Aug 18, 2012 4:52 pm    Post subject: Reply with quote

nativemad wrote:
You'll probably see an option to enable iommu (maybe it is called something else about virtualization) within the bios.
Code:

dmesg | grep AMD-Vi

should tell you if it is enabled... or grep for IOMMU

HTH


Code:
dmesg | grep IOMMU
[    0.000000] Please enable the IOMMU option in the BIOS setup
[    0.602420] PCI-DMA: using GART IOMMU.
[    0.602496] PCI-DMA: Reserving 64MB of IOMMU area in the AGP aperture


Option isn't there in the bios, so going to have to check if I can find an update with the option.
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Sat Aug 18, 2012 5:17 pm    Post subject: Reply with quote

Updated to the latest bios from asus. Still don't have the option in the BIOS. Only option I have is "Secure Virtual Machine Mode" and that is turned on right now.
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Mon Aug 20, 2012 1:20 pm    Post subject: Reply with quote

Did some more digging. Doesn't look like I'll be able to use direct PCI mapping with this board. Any other idea?
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 995
Location: Quebec, Canada

PostPosted: Mon Aug 20, 2012 2:24 pm    Post subject: Reply with quote

Tried using virt-manager to connect the device to the VM. Everything works fine, just like before and I still can't talk to the board.

Starting to think I'll give up for now and install virtual-box for the one machine ...
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Tue Aug 21, 2012 2:23 pm    Post subject: Reply with quote

yeah, virtualbox might be better in regard of usb devices, as kvm seems to be refactoring these things and has some problems with it right now... https://bugs.gentoo.org/show_bug.cgi?id=428476
_________________
Power to the people!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum