From: Juergen Gross <jgross@suse.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com,
George.Dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
cyliu@suse.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 2/3] libxl: add new pvusb backend "qusb" provided by qemu
Date: Tue, 29 Mar 2016 06:53:06 +0200 [thread overview]
Message-ID: <56FA0A32.8080807@suse.com> (raw)
In-Reply-To: <20160328145510.GD17944@char.us.oracle.com>
On 28/03/16 16:55, Konrad Rzeszutek Wilk wrote:
> On Tue, Mar 22, 2016 at 08:29:22AM +0100, Juergen Gross wrote:
>> Add a new pvusb backend type "qusb" which is provided by qemu. It can
>> be selected either by specifying the type directly in the configuration
>> or it is selected automatically by libxl in case there is no "usbback"
>> driver loaded.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>> docs/man/xl.cfg.pod.5 | 11 +++-
>> tools/libxl/libxl_device.c | 3 +-
>> tools/libxl/libxl_dm.c | 8 +++
>> tools/libxl/libxl_internal.h | 1 +
>> tools/libxl/libxl_pvusb.c | 102 +++++++++++++++++++++++++++--------
>> tools/libxl/libxl_types.idl | 1 +
>> tools/libxl/libxl_types_internal.idl | 1 +
>> 7 files changed, 101 insertions(+), 26 deletions(-)
>>
>> diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
>> index ec739cc..a4cc1b3 100644
>> --- a/docs/man/xl.cfg.pod.5
>> +++ b/docs/man/xl.cfg.pod.5
>> @@ -737,8 +737,15 @@ Possible B<KEY>s are:
>>
>> =item B<type=TYPE>
>>
>> -Specifies the usb controller type. Currently only 'pv' and 'auto'
>> -are supported.
>> +Specifies the usb controller type.
>> +
>> +"pv" denotes a kernel based pvusb backend.
>> +
>> +"qusb" specifies a qemu base backend for pvusb.
>> +
>> +"auto" (the default) determines whether a kernel based backend is installed.
>> +If this is the case, "pv" is selected, "qusb" will be selected if no kernel
>> +backend is currently available.
>>
>> =item B<version=VERSION>
>>
>> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
>> index 4ced9b6..eba3087 100644
>> --- a/tools/libxl/libxl_device.c
>> +++ b/tools/libxl/libxl_device.c
>> @@ -680,7 +680,8 @@ 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)
>> + if (dev->backend_kind == LIBXL__DEVICE_KIND_VUSB ||
>> + dev->backend_kind == LIBXL__DEVICE_KIND_QUSB)
>> libxl__initiate_device_usbctrl_remove(egc, aodev);
>> else
>> libxl__initiate_device_generic_remove(egc, aodev);
>> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
>> index 897f3f9..361e584 100644
>> --- a/tools/libxl/libxl_dm.c
>> +++ b/tools/libxl/libxl_dm.c
>> @@ -2138,6 +2138,14 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config)
>> }
>> }
>>
>> + for (i = 0; i < d_config->num_usbctrls; i++) {
>> + if (d_config->usbctrls[i].type == LIBXL_USBCTRL_TYPE_QUSB &&
>> + d_config->usbctrls[i].backend_domid == domid) {
>> + ret = 1;
>> + goto out;
>> + }
>> + }
>> +
>> out:
>> return ret;
>> }
>> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
>> index fc7bdab..2db8b1b 100644
>> --- a/tools/libxl/libxl_internal.h
>> +++ b/tools/libxl/libxl_internal.h
>> @@ -487,6 +487,7 @@ typedef struct {
>> #define QEMU_BACKEND(dev) (\
>> (dev)->backend_kind == LIBXL__DEVICE_KIND_QDISK || \
>> (dev)->backend_kind == LIBXL__DEVICE_KIND_VFB || \
>> + (dev)->backend_kind == LIBXL__DEVICE_KIND_QUSB || \
>> (dev)->backend_kind == LIBXL__DEVICE_KIND_VKBD)
>>
>> #define XC_PCI_BDF "0x%x, 0x%x, 0x%x, 0x%x"
>> diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
>> index 5f92628..7200ead 100644
>> --- a/tools/libxl/libxl_pvusb.c
>> +++ b/tools/libxl/libxl_pvusb.c
>> @@ -22,6 +22,21 @@
>>
>> #define USBHUB_CLASS_CODE 9
>>
>> +static int usbback_is_loaded(libxl__gc *gc)
>> +{
>> + int r;
>> + struct stat st;
>> +
>> + r = lstat(SYSFS_USBBACK_DRIVER, &st);
>> +
>> + if (r == 0)
>> + return 1;
>> + if (r < 0 && errno == ENOENT)
>> + return 0;
>
> I believe the CODING STYLE in libxl asks for you to use { } for these
> ones.
No, it doesn't:
Quote from tools/libxl/CODING_STYLE:
5. Block structure
Every indented statement is braced apart from blocks that contain just
one statement.
>
>> + LOGE(ERROR, "Accessing %s", SYSFS_USBBACK_DRIVER);
>
> Why is this an error?
What else? We can't determine whether the driver is loaded or not.
ENOENT is tested above, so it must be something weird.
>
>> + return -1;
>> +}
>> +
>
> Otherwise looks OK to me.
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-29 4:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 7:29 [PATCH v2 0/3] libxl: add support for qemu base pvusb backend Juergen Gross
2016-03-22 7:29 ` [PATCH v2 1/3] libxl: make libxl__need_xenpv_qemu() operate on domain config Juergen Gross
2016-03-22 7:29 ` [PATCH v2 2/3] libxl: add new pvusb backend "qusb" provided by qemu Juergen Gross
2016-03-28 14:55 ` Konrad Rzeszutek Wilk
2016-03-29 4:53 ` Juergen Gross [this message]
2016-03-29 14:24 ` Konrad Rzeszutek Wilk
2016-03-29 14:28 ` Juergen Gross
2016-03-22 7:29 ` [PATCH v2 3/3] libxl: add domain config parameter to force start of qemu Juergen Gross
2016-03-28 14:50 ` Konrad Rzeszutek Wilk
2016-03-29 4:44 ` Juergen Gross
2016-03-29 14:27 ` Konrad Rzeszutek Wilk
2016-03-29 14:32 ` Juergen Gross
2016-03-22 15:31 ` [PATCH v2 0/3] libxl: add support for qemu base pvusb backend Juergen Gross
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=56FA0A32.8080807@suse.com \
--to=jgross@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=cyliu@suse.com \
--cc=ian.jackson@eu.citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=stefano.stabellini@eu.citrix.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 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.