xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <George.Dunlap@eu.citrix.com>
To: Chunyan Liu <cyliu@suse.com>
Cc: "Jürgen Groß" <jgross@suse.com>, "Wei Liu" <wei.liu2@citrix.com>,
	"Ian Campbell" <ian.campbell@citrix.com>,
	"Ian Jackson" <Ian.Jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"Jim Fehlig" <jfehlig@suse.com>,
	"Simon Cao" <caobosimon@gmail.com>
Subject: Re: [PATCH V8 7/7] domcreate: support pvusb in configuration file
Date: Thu, 12 Nov 2015 16:10:52 +0000	[thread overview]
Message-ID: <CAFLBxZZ_KN0vMr77+dfRTgGEWW3LSbv8m__AWfvEeCH1WBRrYw@mail.gmail.com> (raw)
In-Reply-To: <1445418510-19614-8-git-send-email-cyliu@suse.com>

On Wed, Oct 21, 2015 at 10:08 AM, Chunyan Liu <cyliu@suse.com> wrote:
> Add code to support pvusb in domain config file. One could specify
> usbctrl and usb in domain's configuration file and create domain,
> then usb controllers will be created and usb device would be attached
> to guest automatically.
>
> One could specify usb controllers and usb devices in config file
> like this:
> usbctrl=['version=2,ports=4', 'version=1, ports=4', ]
> usbdev=['hostbus=2, hostaddr=1, controller=0,port=1', ]
>
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> Signed-off-by: Simon Cao <caobosimon@gmail.com>
>
> ---
> changes:
>   - change parse_usb_config and parse_usbctrl_config, following
>     parse_nic_config way, and move to previous patch
>   - update user interface to specify hostbus, hostaddr instead of
>     hostbus.hostaddr for future extension
>
>  docs/man/xl.cfg.pod.5        | 81 ++++++++++++++++++++++++++++++++++++++++++++
>  tools/libxl/libxl_create.c   | 73 +++++++++++++++++++++++++++++++++++++--
>  tools/libxl/libxl_device.c   |  4 +++
>  tools/libxl/libxl_internal.h |  8 +++++
>  tools/libxl/xl_cmdimpl.c     | 54 ++++++++++++++++++++++++++++-
>  5 files changed, 216 insertions(+), 4 deletions(-)
>
> diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
> index b63846a..f24c008 100644
> --- a/docs/man/xl.cfg.pod.5
> +++ b/docs/man/xl.cfg.pod.5
> @@ -722,6 +722,87 @@ Note this may be overridden by rdm_policy option in PCI device configuration.
>
>  =back
>
> +=item B<usbctrl=[ "USBCTRL_SPEC_STRING", "USBCTRL_SPEC_STRING", ... ]>
> +
> +Specifies the USB controllers created for this guest. Each
> +B<USB_SPEC_STRING> has the form C<KEY=VALUE,KEY=VALUE,...> where:
> +
> +=over 4
> +
> +=item B<KEY=VALUE>
> +
> +Possible B<KEY>s are:
> +
> +=over 4
> +
> +=item B<type=TYPE>
> +
> +Specifies the protocol to implement USB controller, could be "pv" (indicates
> +PVUSB) or "qemu" (indicates QEMU emulated). Currently only "pv" is supported.

I think most of these should basically be copied from the descriptions
of the arguments in patch 5.

> +=item B<version=VERSION>
> +
> +Specifies version of the USB controller, could be 1 (USB1.1) or 2 (USB2.0).
> +Default is 2 (USB2.0).
> +
> +=item B<ports=PORTS>
> +
> +Specifies port number of the USB controller. Default is 8.
> +
> +Each USB controller will have an index starting from 0. On the same
> +controller, each port will have an index starting from 1.

I'd say:

"USB controler ids start from 0.  In line with the USB spec, however,
ports on a controller start from 1."

> +
> +E.g.
> +usbctrl=["version=1,ports=4", "version=2,ports=8",]
> +The first controller has:
> +controller index = 0, and port 1,2,3,4.
> +The second controller has:
> +controller index = 1, and port 1,2,3,4,5,6,7,8.

The example is good, but I'd use "controller id" rather than "controller index".

> +=back
> +
> +=back
> +
> +=item B<usbdev=[ "USB_SPEC_STRING", "USB_SPEC_STRING", ... ]>
> +
> +Specifies the host USB devices to passthrough to this guest. Each
> +B<USB_SPEC_STRING> has the form C<KEY=VALUE,KEY=VALUE,...> where:

"Specifiec the USB devices to be attached to the guest at boot."
(i.e., don't assume all devices are hostdev.)

> +=over 4
> +
> +=item B<KEY=VALUE>
> +
> +Possible B<KEY>s are:
> +
> +=over 4
> +
> +=item B<devtype=hostdev>
> +
> +Specifies USB device type. Currently only support 'hostdev'.
> +
> +=item B<hostbus=busnum>
> +
> +Specifies busnum of the USB device from the host perspective.
> +
> +=item B<hostaddr=devnum>
> +
> +Specifies devnum of the USB device from the host perspective.
> +
> +=item B<controller=CONTROLLER>
> +
> +Specifies USB controller index, to which controller the USB device is attached.
> +
> +=item B<port=PORT>
> +
> +Specifies USB port index, to which port the USB device is attached. B<port=PORT>
> +is valid only when B<controller=CONTROLLER> is specified. Without
> +B<controller=CONTROLLER>, it will find the first available USB controller:port
> +and use it. If there is no controller at all, it will create one.

I think the last sentence should be a separate paragraph, probably
after the "=back".  And a more idiomatic way to write it might be:

"If no controller is specified, an available controller:port
combination will be used.  If there are no available controller:port
options, a new controller will be created."

Only one other minor comment from me:

> +    if (!xlu_cfg_get_list(config, "usbctrl", &usbctrls, 0, 0)) {
> +        d_config->num_usbctrls = 0;
> +        d_config->usbctrls = NULL;
> +        while ((buf = xlu_cfg_get_listitem(usbctrls, d_config->num_usbctrls))
> +               != NULL) {

I don't know what the other maintainers think, but particularly given
that this is spanning a line, I would personally take out the
comparison, and just make it

 while ((buf = ...)) {
 ...
}

Other than that, this one looks good to me.

 -George

  parent reply	other threads:[~2015-11-12 16:10 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  9:08 [PATCH V8 0/7] xen pvusb toolstack work Chunyan Liu
2015-10-21  9:08 ` [PATCH V8 1/7] libxl: export some functions for pvusb use Chunyan Liu
2015-10-27 11:08   ` Juergen Gross
2015-10-21  9:08 ` [PATCH V8 2/7] libxl_read_file_contents: add new entry to read sysfs file Chunyan Liu
2015-10-27 11:31   ` Juergen Gross
2015-11-16 14:03   ` Ian Campbell
2015-11-16 18:15     ` Ian Jackson
2015-10-21  9:08 ` [PATCH V8 3/7] libxl: add pvusb API Chunyan Liu
2015-10-27 11:31   ` Juergen Gross
2015-11-04  6:31   ` Chun Yan Liu
2015-11-05 15:54     ` George Dunlap
2015-11-09 18:11   ` Ian Jackson
2015-11-10  8:41     ` Chun Yan Liu
2015-11-10 17:57       ` George Dunlap
2015-11-10 18:11         ` Ian Jackson
2015-11-11  7:21           ` Chun Yan Liu
2015-11-11  2:37         ` Chun Yan Liu
2015-11-12 17:00       ` Ian Jackson
2015-11-13  2:30         ` Chun Yan Liu
2015-11-16 18:06           ` Ian Jackson
2015-11-17  5:47             ` Chun Yan Liu
2015-11-12 11:32   ` Olaf Hering
2015-11-13  2:32     ` Chun Yan Liu
2015-11-12 17:27   ` George Dunlap
2015-11-13  2:56     ` Chun Yan Liu
2015-11-13 11:19   ` Olaf Hering
2015-11-16 10:01     ` George Dunlap
2015-11-18  5:48       ` Chun Yan Liu
2015-11-18  9:44         ` Olaf Hering
2015-11-18 10:03           ` Ian Campbell
2015-11-18 10:42             ` Olaf Hering
2015-11-19  1:33           ` Chun Yan Liu
2015-11-19  6:24             ` Chun Yan Liu
2015-11-23 17:24               ` George Dunlap
2015-10-21  9:08 ` [PATCH V8 4/7] libxl: add libxl_device_usb_assignable_list API Chunyan Liu
2015-10-27 11:32   ` Juergen Gross
2015-11-11 16:07   ` George Dunlap
2015-10-21  9:08 ` [PATCH V8 5/7] xl: add pvusb commands Chunyan Liu
2015-10-27 11:37   ` Juergen Gross
2015-11-12 11:38   ` George Dunlap
2015-11-12 11:39     ` George Dunlap
2015-11-13  2:43     ` Chun Yan Liu
2015-11-16 10:05       ` George Dunlap
2015-11-12 14:42   ` Olaf Hering
2015-11-12 14:49     ` George Dunlap
2015-11-13  2:49     ` Chun Yan Liu
2015-10-21  9:08 ` [PATCH V8 6/7] xl: add usb-assignable-list command Chunyan Liu
2015-10-27 11:38   ` Juergen Gross
2015-11-12 11:44   ` George Dunlap
2015-10-21  9:08 ` [PATCH V8 7/7] domcreate: support pvusb in configuration file Chunyan Liu
2015-10-27 11:41   ` Juergen Gross
2015-11-12 16:10   ` George Dunlap [this message]
2015-11-13  2:54     ` Chun Yan 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=CAFLBxZZ_KN0vMr77+dfRTgGEWW3LSbv8m__AWfvEeCH1WBRrYw@mail.gmail.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=caobosimon@gmail.com \
    --cc=cyliu@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=jfehlig@suse.com \
    --cc=jgross@suse.com \
    --cc=wei.liu2@citrix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).