Discussion:
How to present the vusb device entry in the xenstore
Bei Guan
12 years ago
Permalink
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.

In my VM's config, the usb option is
usb=1
usbdevice="host:0ea0:2168"

Here, "0ea0:2168"is the ID of a 128M usb disk and got using the lsusb
command.
So, how to config the pvusb and make the VM to use the pvusb device?
Thanks you every much.
--
Best Regards,
Bei Guan
Ian Campbell
12 years ago
Permalink
Post by Bei Guan
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".

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.

I have a vague feeling there is also conceptually a third type of USB
passthrough, but I can't quite remember what it consists of.
Post by Bei Guan
Here, "0ea0:2168"is the ID of a 128M usb disk and got using the lsusb
command.
In this case you could presumably instead export the corresponding
dom0 /dev/sdX node to the guest as a disk device.

Ian.
Bei Guan
12 years ago
Permalink
Hi,

Thank you very much for your reply. I will reply inline.
Post by Ian Campbell
Post by Bei Guan
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 device.
Post by Ian Campbell
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?


Thanks,
Post by Ian Campbell
I have a vague feeling there is also conceptually a third type of USB
passthrough, but I can't quite remember what it consists of.
Post by Bei Guan
Here, "0ea0:2168"is the ID of a 128M usb disk and got using the lsusb
command.
In this case you could presumably instead export the corresponding
dom0 /dev/sdX node to the guest as a disk device.
Ian.
--
Best Regards,
Bei Guan
Ian Campbell
12 years ago
Permalink
...
As far as I know neither of these have PV USB (either Front or Back)
support.

The Linux versions of these drivers were never upstreamed. I don't know
if they even existed at all for FreeBSD.
Post by Bei Guan
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?
I don't think so, I can't see why an emulated USB controller and a PV
USB controller shouldn't be able to coexist.
Post by Bei Guan
It seem that I have never seen the usb device in DomU's XenStore
entries, even for PV and HVM.
If you are using qemu based passthrough then there won't be any nodes in
xenstore since it is not PV based.
Post by Bei Guan
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
device.
That's right, because the dom0 kernel and toolstack you are using both
don't support PVUSB.

I think your only option at this point is the Qemu provided passthrough.
Post by Bei Guan
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?
Front and backend drivers come from your kernels not from Xen. Remember
than Xen doesn't ship any kernels these days.

My comment about 4.4 related to the provision of toolstack support for
PV USB, which as I say is contingent on someone also upstreaming the
front and backend drivers.

Ian.
Bei Guan
12 years ago
Permalink
...
Does the following kernel support USB front driver and USB backend now?
http://xenbits.xensource.com/linux-2.6.18-xen.hg
I see that there are /drivers/xen/usbback and /drivers/xen/usbfront in the
code tree.

If it doesn't support or its USB PV drivers don't work well, how can I
write the USB front driver for a PVHVM guest, such as FreeBSD?

Thank you very much.
...
--
Best Regards,
Bei Guan
George Dunlap
12 years ago
Permalink
...
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).

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.)

-George
Bei Guan
12 years ago
Permalink
...
Thank you for your reply.

I just tried the Xen-4.1.2 (use the xm tools) + Dom0 2.6.18.8-xen, which
has the USB frontend and backend drivers as modules in driver/xen/usbfront
and /driver/xen/usbback. The DomU is PV 2.6.18.8-xen. 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:*
[***@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

[***@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:*
[***@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
Post by George Dunlap
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.)
-George
--
Best Regards,
Bei Guan
Bei Guan
12 years ago
Permalink
...
Yes, I‘m trying to add a USB front driver and a SCSI device driver for
FreeBSD. So, I think the first step is to make the PV USB backend dirver
and PV SCSI backend driver to work well. And now, I focus on the USB front
driver.

Thanks,
...
--
Best Regards,
Bei Guan
Loading...