[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] How to present the vusb device entry in the xenstore

2013/6/18 George Dunlap <george.dunlap@xxxxxxxxxxxxx>
On 06/18/2013 12:20 PM, Bei Guan wrote:

Thank you very much for your reply. I will reply inline.

2013/6/18 Ian Campbell <Ian.Campbell@xxxxxxxxxx

    On Tue, 2013-06-18 at 08:51 +0800, Bei Guan wrote:
     > Hi,
     > I'd like to use the pvusb device in xen-4.3 unstable. However, when I
     > use the command "xenstore-ls /local/domain/domId/device" in my VM,
     > there's no "vusb" device presented.

    Which toolstack are you using?

    Which kind of guest (PV or HVM or PVHVM) is it? Which kernels are you
    using in dom0 and domU?

    I'm not sure which (emulated USB device passthrough or full PV USB) you
    are referring to as "vusb".

I use the xl tools and the guest is FreeBSD (It's PVHVM). I think other
PVHVM DomUs are also the same. The dom0 is linux 2.6.32-5-xen-amd64 or
linux 3.9.1 x86_64 (both the same for me).
I just want to know how to make the USB frontend and backend drivers to
work correctly for a PVHVM DomU.
If the DomU uses the emulated USB devices presented by xen-qemu, the USB
frontend and backend drivers will not work. And, the usb devices for
DomU cannot be seen in the XenStore. Is it right?
It seem that I have never seen the usb device in DomU's XenStore
entries, even for PV and HVM.

I'd like to add a PVUSB front driver for FreeBSD, so I need to make sure
that the PVUSB device is added by DomU's XenBus driver and the PVUSB
backed driver in Dom0 works well.
However, it seems that the PVHVM DomU always uses the USB hardware
emulated by xen-qemu. So my PVUSB front driver cannot probe the PVUSB

    AFAIK for xl in 4.3 only USB passthrough to HVM domains via device model
    emulation of the host controller is supported.

    Support for PVUSB is on the cards for 4.4 I think, although AIUI it is
    somewhat blocked on someone stepping up and taking responsibility for
    the PVUSB driver side of things.

Do you mean that before the Xen 4.4, there are no xen versions
supporting the the PVUSB frontend and backend dirvers?
If I want to use the PVUSB, I need to move on to Xen 4.4?

To use PVUSB you need:
1. A backend dom0 (or other driver domain) with usbback
2. A domU with usbfront
3. A toolstack that can connect them together.

It sounds like you're trying to implement #2 for FreeBSD -- that's great, but not strictly necessary if you're running in PVHVM mode.

Unfortunately the only kernels that satisfy #1 at the moment, as far as we know, are the "classic Xen" kernels being forward-ported by SuSE. You should be able to "lsmod" and grep for "usbback" (or "xen" and see if there's anything with "usb" in it) to check if your kernel supports it or not.

Regarding #3, xend/xm can do it, but xl cannot yet.  (This is planned for 4.4).
Thank you for your reply.

I just tried the Xen-4.1.2 (use the xm tools) + Dom0, which has the USB frontend and backend drivers as modules in driver/xen/usbfront and /driver/xen/usbback. The DomU is PV The usb option in config file for DomU is as before: usb=1  and usbdevice='host:0ea0:2168'
I insmod the usbbk.ko and then use xm to create DomU. Some information is provide as the following. It seems the USB backend driver doesn't work.

In Dom0:
[root@localhost ~]# lsmod | grep usb
usbbk                  28308  0
usb_storage            75328  1
libusual               20240  1 usb_storage
usbhid                 55520  0
scsi_mod              138888  6 usb_storage,sg,sr_mod,ahci,libata,sd_mod
usbcore               132228  8 usbbk,usb_storage,libusual,usbhid,uhci_hcd,ohci_hcd,ehci_hcd

[root@localhost ~]# xenstore-ls /local/domain/5/device
vkbd = ""
 0 = ""
  protocol = "x86_32-abi"
  state = "4"
  backend-id = "0"
  backend = "/local/domain/0/backend/vkbd/5/0"
  request-abs-pointer = "1"
  page-ref = "22125"
  event-channel = "9"
vfb = ""
 0 = ""
  protocol = "x86_32-abi"
  state = "4"
  backend-id = "0"
  backend = "/local/domain/0/backend/vfb/5/0"
  page-ref = "21941"
  event-channel = "8"
  feature-update = "1"
vbd = ""
 2049 = ""
  virtual-device = "2049"
  device-type = "disk"
  protocol = "x86_32-abi"
  backend-id = "0"
  state = "4"
  backend = "/local/domain/0/backend/vbd/5/2049"
  ring-ref = "8"
  event-channel = "7"
vif = ""
 0 = ""
  mac = "00:16:3e:0a:c7:22"
  handle = "0"
  protocol = "x86_32-abi"
  backend-id = "0"
  state = "4"
  backend = "/local/domain/0/backend/vif/5/0"
  tx-ring-ref = "768"
  rx-ring-ref = "769"
  event-channel = "10"
  request-rx-copy = "1"
  feature-rx-notify = "1"
  feature-no-csum-offload = "0"
  feature-sg = "1"
  feature-gso-tcpv4 = "1"
console = ""
 0 = ""
  protocol = "x86_32-abi"
  state = "1"
  backend-id = "0"
  backend = "/local/domain/0/backend/console/5/0"
suspend = ""
 event-channel = "6"

In DomU:
[root@gavin-pv ~]# dmesg | grep -i usb
Floppy drive(s): fd0 is unknown type 15 (usb?), fd1 is unknown type 15 (usb?)
usbcore: no version for "struct_module" found: kernel tainted.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
USB Universal Host Controller Interface driver v3.0


I think the "third kind of pass-through" Ian may be talking about is hot-plug.  At the moment, xl does not support USB hot-plug for HVM guests; you have to specify all USB devices in the config file before booting.  (xm will support hot-plug for qemu-traditional I think, but not for qemu-xen, AFAIK.)


Best Regards,
Bei Guan
Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.