From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>, Olaf Hering <olaf@aepfle.de>,
Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Chun Yan Liu <cyliu@suse.com>,
Ian Jackson <ian.jackson@citrix.com>
Subject: Re: [PATCH RFC v1] libxl: Introduce a template for devices with a controller
Date: Thu, 21 May 2015 18:11:57 +0100 [thread overview]
Message-ID: <555E11DD.9020601@eu.citrix.com> (raw)
In-Reply-To: <1432228052-15667-1-git-send-email-george.dunlap@eu.citrix.com>
On 05/21/2015 06:07 PM, George Dunlap wrote:
> We have several outstanding patch series which add devices that have
> two levels: a controller and individual devices attached to that
> controller.
>
> In the interest of consistency, this patch introduces a section that
> sketches out a template for interfaces for such devices.
>
> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> CC: Ian Campbell <ian.campbell@citrix.com>
> CC: Ian Jackson <ian.jackson@citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Juergen Gross <jgross@suse.com>
> CC: Chun Yan Liu <cyliu@suse.com>
> CC: Olaf Hering <olaf@aepfle.de>
>
> So, this is definitely RFC -- I tried to spec things out in a way that
> made sense, but I often just chose something that I thought would be a
> sensible starting point for discussion.
>
> This spec looks a lot more like the PVUSB spec than the PVSCSI spec,
> in part because I think the PVUSB spec has already had a lot more
> thought that's gone into it.
>
> A couple of random points to discuss:
>
> * Calling things "controllers", using <type>ctrl for the device name,
> and using "ctrl" as the field name for the devid of the controller
> in the individual devices.
>
> * I've said that having an index (port, lun, whatever) is optional.
> Do we want to make that requred? Do we want it to have a consistent
> name? In the case of emulated USB, we can't really specify to qemu
> what port the device gets attached to, so I'm tempted to say it's
> not required; but even there we could always give it a port number
> just for name's sake.
>
> * Naming sub-devices. We need to have a way to uniquely name both
> controllers and subdevices. Here I've said that we will have both
> <type>ctrl and <type> devid namespaces, mainly because in the
> previous point I opted not to require an index. Another option
> would be not to have another devid namespace, but to use
> <ctrl,index> as the unique identifier. (This would mean requiring
> the index/port/lun specification above.)
>
> * libxl_device_<type>_list listing devices across all controllers. I
> think this is the most practical thing to do, but one could imagine
> wanting to query by controller ID instead.
>
> Feedback welcome.
> ---
> tools/libxl/libxl.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index 2ed7194..d757845 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -1234,6 +1234,52 @@ void libxl_vtpminfo_list_free(libxl_vtpminfo *, int nr_vtpms);
> *
> * This function does not interact with the guest and therefore
> * cannot block on the guest.
> + *
> + * Controllers
> + * -----------
> + *
> + * Most devices are treated individually. Some devices however, like
> + * USB or SCSI, inherently have the need to have "busses" or
> + * "controllers" to which individual devices can be attached.
> + *
> + * In that case, for each <type>, there will be two sets of the
> + * functions, types, and devid namespaces outlined above: one based on
> + * '<type>', and one based on '<type>ctrl'.
> + *
> + * In those cases, libxl_device_<type>ctrl_<function> will act more or
> + * less like top-level non-bus devices: they will either create or
> + * accept a libxl_devid which will be unique within the
> + * <type>ctrl libxl_devid namespace.
> + *
> + * Second-level devices which will be attached to a controller will
> + * include in their libxl_device_<type> a field called ctrl, which
> + * will be the libxl_devid of the corresponding controller. It may also
> + * include an index onto that bus, that represents (for example) a USB
> + * port or a SCSI LUN.
> + *
> + * These second-level devices will also have their own devid which
> + * will be unique within the <type> devid namespace, and will be used
> + * for queries or removals.
> + *
> + * In the case where there are multiple different ways to implement a
> + * given device -- for instance, one which is fully PV and one which
> + * uses an emulator -- the controller will contain a field which
> + * specifies what type of implementation is used. The implementations
> + * of individual devices will be known by the controller to which they are
> + * attached.
> + *
> + * If libxl_device_<type>_add receives an uninitialized ctrl devid, it
> + * may return an error. Or it may (but is not required to) choose to
> + * automatically choose a suitable controller to which to attach the
> + * new device. It may also (but is not required to) automatically
> + * create a new controller if no suitable controllers exist.
> + * Individual devices should document their behavior.
> + *
> + * libxl_device_<type>ctrl_list will list all controllers for the domain.
> + *
> + * libxl_device_<type>_list will list all devices for all controllers
> + * for the domain. The individual libxl_device_<type> will include
> + * the devid of the controller to which it is attached.
Hmm, I also meant to add:
---
For each type, the domain config file will contain a single list of
controllers, and a single list of devices. libxl will first iterate
through the list adding the controlllers, then iterate through the list
adding each device to the ctrl listed. If libxl_device_<type>_add
automatically creates controllers as necessary, then it is permissible
for the controller list to be empty and the device list to have devices
(with the ctrl field uninitialized).
---
-George
> */
>
> /* Disks */
>
next prev parent reply other threads:[~2015-05-21 17:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 17:07 [PATCH RFC v1] libxl: Introduce a template for devices with a controller George Dunlap
2015-05-21 17:11 ` George Dunlap [this message]
2015-05-21 17:28 ` George Dunlap
2015-05-22 4:21 ` Juergen Gross
2015-05-26 17:56 ` George Dunlap
2015-05-27 10:09 ` Juergen Gross
2015-05-27 13:57 ` George Dunlap
2015-06-17 11:33 ` Juergen Gross
2015-05-27 14:40 ` Ian Campbell
2015-06-17 11:06 ` Ian Campbell
2015-06-17 11:28 ` Juergen Gross
2015-06-17 13:14 ` Ian Campbell
2015-06-18 5:55 ` Olaf Hering
2015-06-18 5:18 ` 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=555E11DD.9020601@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=cyliu@suse.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=jgross@suse.com \
--cc=olaf@aepfle.de \
--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.