From: Wei Liu <wei.liu2@citrix.com>
To: "Juergen Groß" <jgross@suse.com>
Cc: George.Dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
Wei Liu <wei.liu2@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH 5/6] libxl: add HVM usb passthrough support
Date: Fri, 16 Sep 2016 12:28:13 +0100 [thread overview]
Message-ID: <20160916112813.GB21888@citrix.com> (raw)
In-Reply-To: <492e378a-e924-7da3-8ee4-3a1d140ca5ec@suse.com>
On Fri, Sep 16, 2016 at 10:51:18AM +0200, Juergen Groß wrote:
> On 09/15/2016 05:38 PM, Wei Liu wrote:
> >On Thu, Sep 08, 2016 at 09:20:25AM +0200, Juergen Gross wrote:
> >>Add HVM usb passthrough support to libxl by using qemu's capability
> >>to emulate standard USB controllers.
> >>
> >>A USB controller is added via qmp command to the emulated hardware
> >>when a usbctrl device of type DEVICEMODEL is requested. Depending on
> >>the requested speed the appropriate hardware type is selected. A host
> >>USB device can then be added to the emulated USB controller via qmp
> >>command.
> >>
> >>Removing of the devices is done via qmp commands, too.
> >
> >Overall the code looks plausible. But the code seems to do more than
> >what is stated in commit message. Some comments below.
>
> Thanks. I'm just travelling, so my answers are based on my memory what I
> did in the patch. I'll double check before sending out V2.
>
> >
> >>
> >>Signed-off-by: Juergen Gross <jgross@suse.com>
> >>---
> >> tools/libxl/libxl_device.c | 3 +-
> >> tools/libxl/libxl_usb.c | 417 +++++++++++++++++++++++++++++++++++----------
> >> tools/libxl/xl_cmdimpl.c | 4 +-
> >> 3 files changed, 331 insertions(+), 93 deletions(-)
> >>
> >>diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> >>index 5211f20..c6f15db 100644
> >>--- a/tools/libxl/libxl_device.c
> >>+++ b/tools/libxl/libxl_device.c
> >>@@ -782,8 +782,7 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs)
> >> aodev->action = LIBXL__DEVICE_ACTION_REMOVE;
> >> aodev->dev = dev;
> >> aodev->force = drs->force;
> >>- if (dev->backend_kind == LIBXL__DEVICE_KIND_VUSB ||
> >>- dev->backend_kind == LIBXL__DEVICE_KIND_QUSB)
> >>+ if (dev->kind == LIBXL__DEVICE_KIND_VUSB)
> >
> >This looks a bit suspicious to me. This could be rather obvious but I'm
> >not sure because I didn't follow closely on the overall design of PV /
> >HVM USB passthrough.
> >
> >AIUI:
> >
> >VUSB -> PV USB with in-kernel backend
> >QUSB -> PV USB with QEMU backend
> >
> >Why is QUSB deleted here?
>
> It isn't. :-)
>
> A USB passthrough device will always be of kind == VUSB. The backend
> kind may differ, though. This is to ensure a proper device numbering
> regardless of the backend type used.
I see. I missed that dev->backend_kind is changed to dev->kind in the
diff.
> >> {
> >> device->backend_devid = usbctrl->devid;
> >> device->backend_domid = usbctrl->backend_domid;
> >>- device->backend_kind = (usbctrl->type == LIBXL_USBCTRL_TYPE_PV)
> >>- ? LIBXL__DEVICE_KIND_VUSB
> >>- : LIBXL__DEVICE_KIND_QUSB;
> >>+ switch (usbctrl->type) {
> >>+ case LIBXL_USBCTRL_TYPE_PV:
> >>+ device->backend_kind = LIBXL__DEVICE_KIND_VUSB;
> >>+ break;
> >>+ case LIBXL_USBCTRL_TYPE_QUSB:
> >>+ device->backend_kind = LIBXL__DEVICE_KIND_QUSB;
> >>+ break;
> >>+ case LIBXL_USBCTRL_TYPE_DEVICEMODEL:
> >>+ device->backend_kind = LIBXL__DEVICE_KIND_NONE;
> >>+ break;
> >>+ default:
> >>+ break;
> >
> >Shouldn't we return some sort of error here?
>
> This case should not be possible.
> Are you okay with me adding an assert() here?
Yes (and the other place as well).
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-16 11:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 7:20 [PATCH 0/6] libxl: add HVM USB passthrough capability Juergen Gross
2016-09-08 7:20 ` [PATCH 1/6] libxl: rename libcl_pvusb.c to libxl_usb.c Juergen Gross
2016-09-09 10:00 ` Wei Liu
2016-09-08 7:20 ` [PATCH 2/6] libxl: add libxl__qmp_run_command_flexarray() function Juergen Gross
2016-09-09 10:00 ` Wei Liu
2016-09-08 7:20 ` [PATCH 3/6] libxl: dont pass array size to libxl__xs_kvs_of_flexarray() Juergen Gross
2016-09-09 10:00 ` Wei Liu
2016-09-12 9:18 ` Wei Liu
2016-09-08 7:20 ` [PATCH 4/6] libxl: add basic support for devices without backend Juergen Gross
2016-09-15 15:17 ` Wei Liu
2016-09-08 7:20 ` [PATCH 5/6] libxl: add HVM usb passthrough support Juergen Gross
2016-09-09 10:00 ` Wei Liu
2016-09-09 10:13 ` Juergen Gross
2016-09-15 14:22 ` Wei Liu
2016-09-12 8:51 ` George Dunlap
2016-09-15 15:38 ` Wei Liu
2016-09-16 8:51 ` Juergen Groß
2016-09-16 11:28 ` Wei Liu [this message]
2016-09-08 7:20 ` [PATCH 6/6] docs: add HVM USB passthrough documentation Juergen Gross
2016-09-15 15:38 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160916112813.GB21888@citrix.com \
--to=wei.liu2@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jgross@suse.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.