Skip to contentSkip to conversation

xl/libxl support for PVUSB

RFC PATCH In review Bo Cao 6 participants 12 messages Aug 10, 2014 – Nov 19, 2014

lore
Share & tools
lore

Bo Cao

author
#0 lore raw

cover xl/libxl support for PVUSB

Finally I have a workable version xl/libxl support for PVUSB. Most of its commands work property now, but there are still some probelm to be solved. Please take a loot and give me some advices.

== What have been implemented ? ==
I have implemented libxl functions for PVUSB in libxl_usb.c. It mainly consists of two part:
usbctrl_add/remove/list and usb_add/remove/list in which usbctrl denote usb controller in which usd device can be plugged in. I don't use "ao_dev" in libxl_deivce_usbctrl_add since we don't need to execute hotplug script for usbctrl and without "ao_dev", adding default usbctrl for usb device would be easier.

For the cammands to manipulate usb device such as "xl usb-attach" and "xl usb-detach", this patch now only support to specify usb devices by their interface in sysfs. Using this interface, we can read usb device information through sysfs and bind/unbind usb device. (The support for mapping the "lsusb" bus:addr to the sysfs usb interface will come later).

== What needs to do next ? ==
There are two main problems to be solved.

1. PVUSB Options in VM Guest's Configuration File
The interface in VM Guest's configuration file to add usb device is: "usb=[interface="1-1"]".
But the problem is now is that after the default usbctrl is added, the state of usbctrl is "2", e,g, "XenbusStateInitWait", waiting for xen-usbfront to connect. The xen-usbfront in VM Guest isn't loaded. Therefore, "sysfs_intf_write" will report error. Does anyone have any clue how to solve this?

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing "1-1" to Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can be used by VM Guest. For exampele, for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind". But for some devices, they have two controllers, for example "1-1:1.0" and "1-1:1.1". I think this means it has two functions, such as usbhid and usb-storage. So in this case, we bind the two controller to usbback?

========
There maybe some errors or bugs in the codes. Feel free to tell me.

Cheers,

- Simon

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#1 lore raw

RFC PATCH 1/2 libxl: Introduce functions in libxl to add and remove USB devices for an PV guest

This patch exposes a generic interface which can be expanded in the future to implement USB for DEVICEMODEL.

In this patch, I have implemented fucntions in libxl to add and remove USB devices for an PV guest. Most of the fucntion are implemented in "tools/libxl/libxl_usb.c".

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

---
 tools/libxl/Makefile                 |    2 +-
 tools/libxl/libxl.c                  |    8 +-
 tools/libxl/libxl.h                  |   69 ++
 tools/libxl/libxl_create.c           |   41 +-
 tools/libxl/libxl_internal.h         |   26 +
 tools/libxl/libxl_types.idl          |   59 +-
 tools/libxl/libxl_types_internal.idl |    1 +
 tools/libxl/libxl_usb.c              | 1277 ++++++++++++++++++++++++++++++++++
 8 files changed, 1474 insertions(+), 9 deletions(-)
 create mode 100644 tools/libxl/libxl_usb.c
tools/libxl/Makefile +1 -1
index 4cfa275..a50e6cf 100644
@@ -76,7 +76,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o \
 			libxl_json.o libxl_aoutils.o libxl_numa.o \
 			libxl_save_callout.o _libxl_save_msgs_callout.o \
-			libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o libxl_fork.o libxl_usb.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 LIBXL_TESTS += timedereg
tools/libxl/libxl.c +5 -3
index 9054c3b..ec63831 100644
@@ -1434,6 +1434,8 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
 
     if (libxl__device_pci_destroy_all(gc, domid) < 0)
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "pci shutdown failed for domid %d", domid);
+    if (libxl__device_usb_destroy_all(gc, domid) < 0)
+         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "usb shutdown failed for domid %d", domid);
     rc = xc_domain_pause(ctx->xch, domid);
     if (rc < 0) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
@@ -1734,7 +1736,7 @@ out:
 /******************************************************************************/
 
 /* generic callback for devices that only need to set ao_complete */
-static void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev)
+void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev)
 {
     STATE_AO_GC(aodev->ao);
 
@@ -1757,7 +1759,7 @@ out:
 }
 
 /* common function to get next device id */
-static int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device)
+int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device)
 {
     char *dompath, **l;
     unsigned int nb;
@@ -1776,7 +1778,7 @@ static int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device)
     return nextid;
 }
 
-static int libxl__resolve_domid(libxl__gc *gc, const char *name,
+int libxl__resolve_domid(libxl__gc *gc, const char *name,
                                 uint32_t *domid)
 {
     if (!name)
tools/libxl/libxl.h +69 -0

87 lines not on this page · raw message

tools/libxl/libxl_create.c +38 -3

70 lines not on this page · raw message

tools/libxl/libxl_internal.h +26 -0
index a0d4f24..629a0c2 100644
@@ -1031,6 +1031,12 @@ _hidden int libxl__wait_for_backend(libxl__gc *gc, const char *be_path,
                                     const char *state);
 _hidden int libxl__nic_type(libxl__gc *gc, libxl__device *dev,
                             libxl_nic_type *nictype);
+_hidden int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device);
+_hidden int libxl__resolve_domid(libxl__gc *gc, const char *name, 
+                                 uint32_t *domid); 
+_hidden int libxl__domain_usb_init(libxl__gc *gc, xs_transaction_t t,
+                                   char *libxl_path, struct xs_permissions *perm,
+                                   int perm_size);
 
 /*
  * For each aggregate type which can be used as an input we provide:
@@ -1056,6 +1062,8 @@ _hidden int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm
 _hidden int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb);
 _hidden int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb);
 _hidden int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci);
+_hidden int libxl__device_usbctrl_setdefault(libxl__gc *gc, 
+                                    libxl_device_usbctrl *usbctrl, uint32_t domid);
 
 _hidden const char *libxl__device_nic_devname(libxl__gc *gc,
                                               uint32_t domid,
@@ -2147,6 +2155,8 @@ struct libxl__ao_device {
 
 /* Starts preparing to add/remove a bunch of devices. */
 _hidden void libxl__multidev_begin(libxl__ao *ao, libxl__multidev*);
+/* generic callback for devices that only need to set ao_complete */
+_hidden void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev);
 
 /* Prepares to add/remove one of many devices.  Returns a libxl__ao_device
  * which has had libxl__prepare_ao_device called, and which has also
@@ -2266,6 +2276,18 @@ _hidden void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid,
                                    libxl_device_vtpm *vtpm,
                                    libxl__ao_device *aodev);
 
+/* from libxl_usb */
+_hidden int libxl__device_usbctrl_add(libxl__gc *gc, uint32_t domid,
+                            libxl_device_usbctrl *usbctrl);
+_hidden int libxl__device_usb_add(libxl__gc *gc, uint32_t domid, 
+                            libxl_device_usb *usb);
+_hidden int libxl__device_usb_destroy_all(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__device_usb_assigned_list(libxl__gc *gc, libxl_device_usb **list, int *num);
+_hidden int libxl__device_usb_list(libxl__gc *gc, uint32_t domid, 
+                                libxl_device_usb **usbs, int usbctrl, int *num);
+_hidden libxl_device_usb *libxl_device_usb_list_all(libxl__gc *gc, uint32_t domid, int *num);
+_hidden int libxl__device_usb_setdefault(libxl__gc *gc, uint32_t domid, libxl_device_usb *usb);
+
 /* Internal function to connect a vkb device */
 _hidden int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
                                   libxl_device_vkb *vkb);
@@ -2707,6 +2729,10 @@ _hidden void libxl__add_vtpms(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
                              libxl_domain_config *d_config,
                              libxl__multidev *multidev);
 
+_hidden void libxl__add_usbs(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
+                             libxl_domain_config *d_config,
+                             libxl__multidev *multidev);
+
 /*----- device model creation -----*/
 
 /* First layer; wraps libxl__spawn_spawn. */
tools/libxl/libxl_types.idl +57 -2

92 lines not on this page · raw message

tools/libxl/libxl_types_internal.idl +1 -0
index a964851..c5c17e7 100644
@@ -20,6 +20,7 @@ libxl__device_kind = Enumeration("device_kind", [
     (6, "VKBD"),
     (7, "CONSOLE"),
     (8, "VTPM"),
+    (9, "VUSB"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
tools/libxl/libxl_usb.c new file +1277 -0

1,277 lines not on this page · raw message

Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#4 lore raw

RFC PATCH 2/2 xl: Add commands for usb hot-plug

In reply to Bo Cao

Add xl commands for USB hot-plug.

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

---
 tools/libxl/xl.h          |    7 +
 tools/libxl/xl_cmdimpl.c  |  320 ++++++++++++++++++++++++++++++++++++++++++++-
 tools/libxl/xl_cmdtable.c |   33 +++++
 3 files changed, 359 insertions(+), 1 deletion(-)
tools/libxl/xl.h +7 -0
index 10a2e66..6cde0fb 100644
@@ -84,6 +84,13 @@ int main_blockdetach(int argc, char **argv);
 int main_vtpmattach(int argc, char **argv);
 int main_vtpmlist(int argc, char **argv);
 int main_vtpmdetach(int argc, char **argv);
+int main_usbassignable_list(int argc, char **argv);
+int main_usbassigned_list(int argc, char **argv);
+int main_usbctrl_attach(int argc, char **argv);
+int main_usbctrl_detach(int argc, char **argv);
+int main_usbattach(int argc, char **argv);
+int main_usbdetach(int argc, char **argv);
+int main_usblist(int argc, char **argv);
 int main_uptime(int argc, char **argv);
 int main_claims(int argc, char **argv);
 int main_tmem_list(int argc, char **argv);
tools/libxl/xl_cmdimpl.c +319 -1

338 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +33 -0
index 4279b9f..d2da271 100644
@@ -194,6 +194,39 @@ struct cmd_spec cmd_table[] = {
       "Eject a cdrom from a guest's cd drive",
       "<Domain> <VirtualDevice>",
     },
+	{ "usb-assignable-list",
+	  &main_usbassignable_list, 0, 0,
+	  "List all the assignable USB devices",
+	},
+	{ "usb-assigned-list",
+	  &main_usbassigned_list, 0, 0,
+	  "List all the USB devices that have been assigned",
+	},
+	{ "usb-controller-attach",
+	  &main_usbctrl_attach, 1, 1,
+	  "Create a virtual USB controller for a domain",
+	  "<Domain> [version=<version>] [numberOfPorts=<number>] [type=<type>]",
+	},
+	{ "usb-controller-detach",
+	  &main_usbctrl_detach, 0, 1,
+	  "Destory the virtual USB controller specified by <ControllerName> for a domain",
+	  "<Domain> <DevId|ControllerName['pv0'|'hci0'|..]>",
+	},
+	{ "usb-attach",
+	  &main_usbattach, 1, 1,
+	  "Attach a USB device to a domain",
+	  "<Domain> <hostdev=<Hostbus.Hostdev>> [ControllerName['pv0'|'hci0']]",
+	},
+	{ "usb-detach",
+	  &main_usbdetach, 0, 1,
+	  "Detach a USB device from a domain",
+	  "<Domain> <DevId|<Hostbus.Hostdev>>",
+	},
+	{ "usb-list",
+	  &main_usblist, 0, 0,
+	  "List information about USB devices for a domain",
+	  "<Domain>",
+	},
     { "mem-max",
       &main_memmax, 0, 1,
       "Set the maximum amount reservation for a domain",
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v0 RFC 1/2] libxl: Introduce functions in libxl to add and remove USB devices for an PV guest

In reply to Bo Cao

Bo Cao writes ("[Xen-devel][PATCH v0 RFC 1/2] libxl: Introduce functions in libxl to add and remove USB devices for an PV guest"):

Quoted 2 lines

This patch exposes a generic interface which can be expanded in the future to implement USB for DEVICEMODEL.

Thanks. Can you arrange to wrap this code to 70-75 characters please ? It currently is very hard to read in my mailreader.

tools/libxl/libxl.c out: · line 1740

Quoted 4 lines

/* generic callback for devices that only need to set ao_complete */

tools/libxl/libxl.c +1 -1
-static void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev)
+void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev)
 {

Extern functions must have namespaced names. (libxl__...)

I noticed several C++-style // comments. We generally use /* */.

That's all I spotted right away. I'll take a proper look when it's less wrap-damaged.

Thanks,
Ian.

author
#3 lore raw

Re: [PATCH v0 RFC 1/2] libxl: Introduce functions in libxl to add and remove USB devices for an PV guest

Quoted 13 lines · Ian Jackson

Bo Cao writes ("[Xen-devel][PATCH v0 RFC 1/2] libxl: Introduce functions in libxl to add and remove USB devices for an PV guest"):

Quoted 2 lines

This patch exposes a generic interface which can be expanded in the future to implement USB for DEVICEMODEL.

Thanks. Can you arrange to wrap this code to 70-75 characters please ? It currently is very hard to read in my mailreader.

yes, I will wrap that in the next version.

Quoted 2 lines

/* generic callback for devices that only need to set ao_complete */
-static void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device

Quoted 7 lines

*aodev)

Quoted 2 lines

+void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev)
{

Extern functions must have namespaced names. (libxl__...)

I have forgotten to modify this back to its original version since I won't

need it any more in this patch.
I will modify this in the next version.

Quoted 12 lines

I noticed several C++-style // comments. We generally use /* */.

I will take care of this right away.

That's all I spotted right away. I'll take a proper look when it's less wrap-damaged.

Thanks,
Ian.

Thanks, I will send a renewed version as soon as possible.

Regards,
-Simon

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
In reply to Bo Cao
Quoted 6 lines · Bo Cao

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing "1-1" to Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can be used by VM Guest. For exampele, for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind". But for some devices, they have two controllers, for example "1-1:1.0" and "1-1:1.1". I think this means it has two functions, such as usbhid and usb-storage. So in this case, we bind the two controller to usbback?

So looking at tools/python/xen/util/vusb_util.c:bind_usb_device(), it looks like what xend did was take the "device" (which would be "1-1"), and search the sysfs usb node for all "interfaces" (which would be "1-1:.*"), and then unbind each of them and bind them to usbback.

(Obviously I needed to check out a 4.4 branch to look at the xend code, since it's been deleted in the development branch.)

-George

author
#6 lore raw

Yes, I reviewed the codes in tools/python/xen/util/vusb_ util.c:bind_usb_device()
and what Xend did was take the "device" (which would be "1-1"), and search the sysfs usb node for all "interfaces" (which would be "1-1:.*"), and then unbind each of them and bind them to usbback.

This helps a lot.

Thanks!
-Bo

On Thu, Aug 14, 2014 at 11:04 PM, George Dunlap <[email protected]

Quoted 20 lines

wrote:

Quoted 2 lines · Bo Cao

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing

"1-1" to Xenstore entry, we need to

Quoted 1 line

bind the controller of this usb device to usbback driver so that it can

be used by VM Guest. For exampele,

Quoted 1 line

for usb device "1-1", it's controller interface maybe "1-1:1.0", and we

write this value to "/sys/bus/usb/driver/usbback/bind".

Quoted 1 line

But for some devices, they have two controllers, for example "1-1:1.0"

and "1-1:1.1". I think this means it has two functions,

Quoted 1 line

such as usbhid and usb-storage. So in this case, we bind the two

controller to usbback?

So looking at tools/python/xen/util/vusb_util.c:bind_usb_device(), it looks like what xend did was take the "device" (which would be "1-1"), and search the sysfs usb node for all "interfaces" (which would be "1-1:.*"), and then unbind each of them and bind them to usbback.

Quoted 5 lines

(Obviously I needed to check out a 4.4 branch to look at the xend code, since it's been deleted in the development branch.)

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw
In reply to Bo Cao

Is there any progress on this work? I didn't see new version after this. Anyone knows the status?

Thanks,
Chunyan

Quoted 1 line
Quoted 1 line
Quoted 1 line

On 8/11/2014 at 04:23 AM, in message

<[email protected]>, Bo Cao

Quoted 64 lines · <[email protected]> wrote:

Finally I have a workable version xl/libxl support for PVUSB. Most of its commands work property now, but there are still some probelm to be solved.
Please take a loot and give me some advices.

== What have been implemented ? ==
I have implemented libxl functions for PVUSB in libxl_usb.c. It mainly consists of two part:
usbctrl_add/remove/list and usb_add/remove/list in which usbctrl denote usb controller in which
usd device can be plugged in. I don't use "ao_dev" in libxl_deivce_usbctrl_add since we don't need to
execute hotplug script for usbctrl and without "ao_dev", adding default usbctrl for usb device
would be easier.

For the cammands to manipulate usb device such as "xl usb-attach" and "xl usb-detach", this patch now only
support to specify usb devices by their interface in sysfs. Using this interface, we can read usb device
information through sysfs and bind/unbind usb device. (The support for mapping the "lsusb" bus:addr to the
sysfs usb interface will come later).

== What needs to do next ? ==
There are two main problems to be solved.

1. PVUSB Options in VM Guest's Configuration File
The interface in VM Guest's configuration file to add usb device is:
"usb=[interface="1-1"]".
But the problem is now is that after the default usbctrl is added, the state of usbctrl is "2", e,g, "XenbusStateInitWait",
waiting for xen-usbfront to connect. The xen-usbfront in VM Guest isn't loaded. Therefore, "sysfs_intf_write"
will report error. Does anyone have any clue how to solve this?

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing "1-1" to
Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can be used by VM Guest. For exampele,
for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind".
But for some devices, they have two controllers, for example "1-1:1.0" and "1-1:1.1". I think this means it has two functions,
such as usbhid and usb-storage. So in this case, we bind the two controller to usbback?

========
There maybe some errors or bugs in the codes. Feel free to tell me.

Cheers,

- Simon

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw
Quoted 2 lines · Chun Yan Liu

Is there any progress on this work? I didn't see new version after this. Anyone knows the status?

I believe Olaf and Juergen were looking at this for Xen 4.6?

CC-ing them.

Quoted 82 lines

Thanks,
Chunyan

Quoted 1 line
Quoted 1 line
Quoted 1 line

On 8/11/2014 at 04:23 AM, in message

<[email protected]>, Bo Cao

Quoted 64 lines · <[email protected]> wrote:

Finally I have a workable version xl/libxl support for PVUSB. Most of its commands work property now, but there are still some probelm to be solved.
Please take a loot and give me some advices.

== What have been implemented ? ==
I have implemented libxl functions for PVUSB in libxl_usb.c. It mainly consists of two part:
usbctrl_add/remove/list and usb_add/remove/list in which usbctrl denote usb controller in which
usd device can be plugged in. I don't use "ao_dev" in libxl_deivce_usbctrl_add since we don't need to
execute hotplug script for usbctrl and without "ao_dev", adding default usbctrl for usb device
would be easier.

For the cammands to manipulate usb device such as "xl usb-attach" and "xl usb-detach", this patch now only
support to specify usb devices by their interface in sysfs. Using this interface, we can read usb device
information through sysfs and bind/unbind usb device. (The support for mapping the "lsusb" bus:addr to the
sysfs usb interface will come later).

== What needs to do next ? ==
There are two main problems to be solved.

1. PVUSB Options in VM Guest's Configuration File
The interface in VM Guest's configuration file to add usb device is:
"usb=[interface="1-1"]".
But the problem is now is that after the default usbctrl is added, the state of usbctrl is "2", e,g, "XenbusStateInitWait",
waiting for xen-usbfront to connect. The xen-usbfront in VM Guest isn't loaded. Therefore, "sysfs_intf_write"
will report error. Does anyone have any clue how to solve this?

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing "1-1" to
Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can be used by VM Guest. For exampele,
for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind".
But for some devices, they have two controllers, for example "1-1:1.0" and "1-1:1.1". I think this means it has two functions,
such as usbhid and usb-storage. So in this case, we bind the two controller to usbback?

========
There maybe some errors or bugs in the codes. Feel free to tell me.

Cheers,

- Simon

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 2 lines · Chun Yan Liu

Is there any progress on this work? I didn't see new version after this. Anyone knows the status?

I believe Olaf and Juergen were looking at this for Xen 4.6?

I'm working on the kernel pvusb drivers.

Juergen

Quoted 85 lines

CC-ing them.

Quoted 82 lines

Thanks,
Chunyan

Quoted 1 line
Quoted 1 line
Quoted 1 line

On 8/11/2014 at 04:23 AM, in message

<[email protected]>, Bo Cao

Quoted 64 lines · <[email protected]> wrote:

Finally I have a workable version xl/libxl support for PVUSB. Most of its commands work property now, but there are still some probelm to be solved.
Please take a loot and give me some advices.

== What have been implemented ? ==
I have implemented libxl functions for PVUSB in libxl_usb.c. It mainly consists of two part:
usbctrl_add/remove/list and usb_add/remove/list in which usbctrl denote usb controller in which
usd device can be plugged in. I don't use "ao_dev" in libxl_deivce_usbctrl_add since we don't need to
execute hotplug script for usbctrl and without "ao_dev", adding default usbctrl for usb device
would be easier.

For the cammands to manipulate usb device such as "xl usb-attach" and "xl usb-detach", this patch now only
support to specify usb devices by their interface in sysfs. Using this interface, we can read usb device
information through sysfs and bind/unbind usb device. (The support for mapping the "lsusb" bus:addr to the
sysfs usb interface will come later).

== What needs to do next ? ==
There are two main problems to be solved.

1. PVUSB Options in VM Guest's Configuration File
The interface in VM Guest's configuration file to add usb device is:
"usb=[interface="1-1"]".
But the problem is now is that after the default usbctrl is added, the state of usbctrl is "2", e,g, "XenbusStateInitWait",
waiting for xen-usbfront to connect. The xen-usbfront in VM Guest isn't loaded. Therefore, "sysfs_intf_write"
will report error. Does anyone have any clue how to solve this?

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing "1-1" to
Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can be used by VM Guest. For exampele,
for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind".
But for some devices, they have two controllers, for example "1-1:1.0" and "1-1:1.1". I think this means it has two functions,
such as usbhid and usb-storage. So in this case, we bind the two controller to usbback?

========
There maybe some errors or bugs in the codes. Feel free to tell me.

Cheers,

- Simon

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#10 lore raw
In reply to Chun Yan Liu

Hi,

I was working on the work. But I was busing preparing some job interviews in the last three months, sorry for this long delay. I will update my progress in a few days.

Thanks!

Bo Cao

Quoted 53 lines · Chun Yan Liu

Is there any progress on this work? I didn't see new version after this. Anyone knows the status?

Thanks,
Chunyan

Quoted 1 line
Quoted 1 line
Quoted 1 line

On 8/11/2014 at 04:23 AM, in message

<[email protected]>, Bo Cao

Quoted 9 lines · <[email protected]> wrote:

Finally I have a workable version xl/libxl support for PVUSB. Most of its commands work property now, but there are still some probelm to be solved.
Please take a loot and give me some advices.

== What have been implemented ? ==
I have implemented libxl functions for PVUSB in libxl_usb.c. It mainly consists of two part:
usbctrl_add/remove/list and usb_add/remove/list in which usbctrl denote

usb

Quoted 15 lines

controller in which
usd device can be plugged in. I don't use "ao_dev" in libxl_deivce_usbctrl_add since we don't need to
execute hotplug script for usbctrl and without "ao_dev", adding default usbctrl for usb device
would be easier.

For the cammands to manipulate usb device such as "xl usb-attach" and "xl usb-detach", this patch now only
support to specify usb devices by their interface in sysfs. Using this interface, we can read usb device
information through sysfs and bind/unbind usb device. (The support for mapping the "lsusb" bus:addr to the
sysfs usb interface will come later).

Quoted 7 lines

== What needs to do next ? ==
There are two main problems to be solved.

1. PVUSB Options in VM Guest's Configuration File
The interface in VM Guest's configuration file to add usb device is:
"usb=[interface="1-1"]".
But the problem is now is that after the default usbctrl is added, the

state

Quoted 7 lines

of usbctrl is "2", e,g, "XenbusStateInitWait",
waiting for xen-usbfront to connect. The xen-usbfront in VM Guest isn't loaded. Therefore, "sysfs_intf_write"
will report error. Does anyone have any clue how to solve this?

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing

"1-1" to

Quoted 2 lines

Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can

be

Quoted 33 lines
Quoted 4 lines

used by VM Guest. For exampele,
for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind".
But for some devices, they have two controllers, for example "1-1:1.0"

and

Quoted 2 lines

"1-1:1.1". I think this means it has two functions, such as usbhid and usb-storage. So in this case, we bind the two

controller

Quoted 23 lines

to usbback?

========
There maybe some errors or bugs in the codes. Feel free to tell me.

Cheers,

- Simon

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#11 lore raw
Quoted 5 lines · Simon Cao

Hi,

I was working on the work. But I was busing preparing some job interviews in the last three months, sorry for this long delay. I will update my progress in a few days.

OK, I put your name for this to be in Xen 4.6.

Thanks!

Quoted 98 lines

Thanks!

Bo Cao

Quoted 53 lines · Chun Yan Liu

Is there any progress on this work? I didn't see new version after this. Anyone knows the status?

Thanks,
Chunyan

Quoted 1 line
Quoted 1 line
Quoted 1 line

On 8/11/2014 at 04:23 AM, in message

<[email protected]>, Bo Cao

Quoted 9 lines · <[email protected]> wrote:

Finally I have a workable version xl/libxl support for PVUSB. Most of its commands work property now, but there are still some probelm to be solved.
Please take a loot and give me some advices.

== What have been implemented ? ==
I have implemented libxl functions for PVUSB in libxl_usb.c. It mainly consists of two part:
usbctrl_add/remove/list and usb_add/remove/list in which usbctrl denote

usb

Quoted 15 lines

controller in which
usd device can be plugged in. I don't use "ao_dev" in libxl_deivce_usbctrl_add since we don't need to
execute hotplug script for usbctrl and without "ao_dev", adding default usbctrl for usb device
would be easier.

For the cammands to manipulate usb device such as "xl usb-attach" and "xl usb-detach", this patch now only
support to specify usb devices by their interface in sysfs. Using this interface, we can read usb device
information through sysfs and bind/unbind usb device. (The support for mapping the "lsusb" bus:addr to the
sysfs usb interface will come later).

Quoted 7 lines

== What needs to do next ? ==
There are two main problems to be solved.

1. PVUSB Options in VM Guest's Configuration File
The interface in VM Guest's configuration file to add usb device is:
"usb=[interface="1-1"]".
But the problem is now is that after the default usbctrl is added, the

state

Quoted 7 lines

of usbctrl is "2", e,g, "XenbusStateInitWait",
waiting for xen-usbfront to connect. The xen-usbfront in VM Guest isn't loaded. Therefore, "sysfs_intf_write"
will report error. Does anyone have any clue how to solve this?

2. sysfs_intf_write
In the process of "xl usb-attach domid intf=1-1", after writing

"1-1" to

Quoted 2 lines

Xenstore entry, we need to
bind the controller of this usb device to usbback driver so that it can

be

Quoted 33 lines
Quoted 4 lines

used by VM Guest. For exampele,
for usb device "1-1", it's controller interface maybe "1-1:1.0", and we write this value to "/sys/bus/usb/driver/usbback/bind".
But for some devices, they have two controllers, for example "1-1:1.0"

and

Quoted 2 lines

"1-1:1.1". I think this means it has two functions, such as usbhid and usb-storage. So in this case, we bind the two

controller

Quoted 23 lines

to usbback?

========
There maybe some errors or bugs in the codes. Feel free to tell me.

Cheers,

- Simon

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Pasi Kärkkäinen <[email protected]>
CC: Lars Kurth <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel