Pass through USB device to DomU

posted in Hypervisor
Wednesday, August 06 2014, 12:11 AM
Franz
Franz
Offline
1
Hi,

I have recently started working with a Xen Hypervisor (4.3.2). My host is Fedora 20 x64, the guest is Windows 7 x86 (hvm).

I am trying to achieve hotplugging a connected USB flash drive in C++. For now I would be happy to just to get it working on bash.

The only way I kinda got it to work so far was using "xl block-attach". After installing the drivers, the device shows up in Windows, but it seems it is only a snapshot and any changes made there are not saved to the actual device. Also only one of my two test thumb drives seem to work with the GPCPV drivers.

I have tried "xm usb-attach" in the following way but ended up with an error:
~ xm usb-hc-create windows 2 2

~ xm usb-list windows
Idx BE  state usb-ver  BE-path                       
0   0   1     USB2.0  /local/domain/0/backend/vusb/7/0  
port 1: 
port 2:

~ xm usb-list-assignable-devices
1-1.1        : ID 138a:003d Validity Sensors, Inc. VFS491
1-1.2        : ID 03f0:3d07 HP v115w
1-1.3        : ID 04f2:b270 Chicony HP HD Webcam [Fixed]
1-1.6        : ID 04ca:003a Lite-On Technology Corp. USB Multimedia Keyboard
2-1.6        : ID 0a5c:21e1 Broadcom Corp BCM20702A0

HP v115w is the USB flash drive I want to insert.
~ xm usb-attach windows 0 1 1-1.2
Traceback (most recent call last):
  File "/usr/sbin/xm", line 7, in 
    main.main(sys.argv)
  File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3946, in main
    _, rc = _run_cmd(cmd, cmd_name, args)
  File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3970, in _run_cmd
    return True, cmd(args)
  File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3011, in xm_usb_attach
    if vusb_util.bus_is_assigned(bus):
  File "/usr/lib64/python2.7/site-packages/xen/util/vusb_util.py", line 275, in bus_is_assigned
    raise UsbDeviceParseError("Can't get assignment status: (%s)." % bus)
xen.util.vusb_util.UsbDeviceParseError: vusb: Error parsing USB device info: Can't get assignment status: (1-1.2).


Using "xm usb-attach" is probably not the best way to proceed anyways as I have read it is deprecated.

PCI-passthrough is not really an option because if I understand correctly that after the PCI controller has been passed through, another USB that was plugged in will be automatically passed through.

What else can I do or try to get hotplugging working correctly?

I appreciate your help
Franz
Responses (4)
  • Accepted Answer

    Wednesday, August 06 2014, 01:07 AM - #permalink
    0
    Franz,

    The definitive USB Wiki document is here:

    http://wiki.xenproject.org/wiki/Xen_USB_Passthrough

    The doc outlines a few options. I haven't worked your scenario exactly as described, so I don't know which one will give you the best result.

    I don't know the current state of the PVUSB drivers which are mentioned (which are usable in HVM situations with proper drivers as outlined in the document), but if you inquire on the xen-users mailing list, you should be able to get a reading on the state of the drivers in 4.3.2.

    Russ
    The reply is currently minimized Show
  • Accepted Answer

    Franz
    Franz
    Offline
    Wednesday, August 06 2014, 06:05 PM - #permalink
    0
    Thanks Russell,

    this was the only relevent recent (April 2014) discussion I could find:
    http://tinyurl.com/pydurbv
    (Sorry about the tinyurl, but the symbols in the original url broke the link)

    Unfortunately it doesn't really help me with my problem.

    In the changelog of 4.3, nothing is said about PVUSB which seems to contradict this mail http://lists.xen.org/archives/html/xen-devel/2013-03/msg00574.html. Correct me if I'm wrong here, but that looks to me like PVUSB is not implemented yet.

    I still don't know how to proceed. Do you have any other ideas or know where else I can look / ask?

    Cheers
    Franz
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, August 06 2014, 06:47 PM - #permalink
    1
    Franz,

    I'd suggest posting your question to the xen-users mailing list. There is a much bigger crowd there, with some developers participating. They should be able to tell you what's available in 4.3.1 to do what you need. If xen-users fails, then xen-devel is an option. That's developer central. But I'd recommend xen-users first.

    Also, note the text at the end of George's email:

    "If for some reason PVUSB doesn't make it into 4.3, another option you
    can explore is running your VMs in PVHVM mode; xl will definitely
    support USB pass-through for HVM domains in 4.3."

    That may be an option for you. It sounds like using PVHVM (which is HVM employing PV drivers for greater throughput) could be a viable alternative in 4.3.

    Russ
    The reply is currently minimized Show
  • Accepted Answer

    Franz
    Franz
    Offline
    Wednesday, August 06 2014, 08:17 PM - #permalink
    0
    Thanks Russ,

    I posted to the xen-users mailing list as you suggested.

    Cheers
    Franz
    The reply is currently minimized Show
Your Reply