From: Ian Campbell Subject: Re: RFC: Proposed libxl USB hot-plug interface Date: Wed, 10 Apr 2013 11:26:14 +0100 Message-ID: <1365589574.26448.4.camel@zakaz.uk.xensource.com> References: <515C46A4.8060506@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <515C46A4.8060506@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Roger Pau Monne , Ian Jackson , Marek Marczykowski , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2013-04-03 at 16:11 +0100, George Dunlap wrote: > OK, based on the feedback, what about an interface like the following? > > The idea would be that long-term, AUTO would always do PV for PV VMs, > and would somehow decide whether to do HVM or PV for HVM domains. > > The "type" and the "union" fields are designed to allow the interface to > be extended to include other types of devices, such as adding emulated > tablets, mice, keyboards, usb sticks, &c. > > "list" should return all available USB devices including the "handle" > that can be used to remove a device. > > Thoughts? > > -George > > #define LIBXL_DEVICE_HOST_USB_ANY (-1) > int libxl_usb_add(libxl_ctx *ctx, uint32_t domid, > libxl_device_usb *dev, > const libxl_asyncop_how *ao_how) > LIBXL_EXTERNAL_CALLERS_ONLY; > int libxl_usb_del(libxl_ctx *ctx, uint32_t domid, > uint64_t handle, > const libxl_asyncop_how *ao_how) > LIBXL_EXTERNAL_CALLERS_ONLY; > int libxl_usb_list(libxl_ctx *ctx, uint32_t domid, > libxl_device_usb **dev, > const libxl_asyncop_how *ao_how) > LIBXL_EXTERNAL_CALLERS_ONLY; > > struct libxl_device_usb { I assume you will actually do this via the libxl IDL when implementing? > uint16_t protocol; /* AUTO, PV, HVM */ Should be an enum I think. > uint16_t type; /* HOST; later can be emulated devices like tablet, > disk, &c */ And IIUC so should this. > uint32_t backend_domain_id; /* For PVUSB */ All other libxl_device_* use "backend_domid" > uint64_t handle; /* OUT: Unique (per domain) handle that must be > used to remove a device */ This seem analogous to other device's libxl_devid? > int Is this the key for the following union? If so then it should be an appropriate enum. > union { > struct { > int hostbus, hostaddr, vendorid, productid; > } host; > }; > }; >