From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UunAH-000600-Ta for qemu-devel@nongnu.org; Thu, 04 Jul 2013 13:17:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UunAE-0002pf-Rt for qemu-devel@nongnu.org; Thu, 04 Jul 2013 13:17:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54977 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UunAE-0002pN-Iv for qemu-devel@nongnu.org; Thu, 04 Jul 2013 13:17:50 -0400 Message-ID: <51D5AE39.2010606@suse.de> Date: Thu, 04 Jul 2013 19:17:45 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1372932359-4625-1-git-send-email-fabio.fantoni@m2r.biz> <20130704101203.GS7483@zion.uk.xensource.com> <51D54B8B.9010703@m2r.biz> <20130704103224.GT7483@zion.uk.xensource.com> <51D564CB.9090602@m2r.biz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Xen-devel] [PATCH] libxl: Spice usbredirection support for upstream qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: xen-devel@lists.xensource.com, Wei Liu , Ian.Campbell@citrix.com, Ian.Jackson@eu.citrix.com, qemu-devel@nongnu.org, Hans de Goede , Fabio Fantoni , spice-devel@lists.freedesktop.org Am 04.07.2013 14:46, schrieb Stefano Stabellini: > On Thu, 4 Jul 2013, Fabio Fantoni wrote: >> Il 04/07/2013 12:32, Wei Liu ha scritto: >> >> On Thu, Jul 04, 2013 at 12:16:43PM +0200, Fabio Fantoni wrote: >> >> Il 04/07/2013 12:12, Wei Liu ha scritto: >> >> On Thu, Jul 04, 2013 at 12:05:59PM +0200, Fabio Fantoni wrote: >> >> Usage: spiceusbredirection=3D1|0 (default=3D0) >> Enables spice usbredirection. The Spice usbredirection creates usb2 >> controller and 4 usbredirection channels for redirection of up to 4 >> usb devices from spice client to domU's qemu. >> >> Signed-off-by: Fabio Fantoni >> --- >> docs/man/xl.cfg.pod.5 | 8 ++++++++ >> tools/libxl/libxl_create.c | 1 + >> tools/libxl/libxl_dm.c | 18 ++++++++++++++++++ >> tools/libxl/libxl_types.idl | 1 + >> tools/libxl/xl_cmdimpl.c | 2 ++ >> 5 files changed, 30 insertions(+) >> >> diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 >> index 766862d..a450800 100644 >> --- a/docs/man/xl.cfg.pod.5 >> +++ b/docs/man/xl.cfg.pod.5 >> @@ -1134,6 +1134,14 @@ requires vdagent service installed on domU o.s.= to work. The default is 0. >> =3Dback >> +=3Ditem B >> + >> +Enables spice usbredirection. The Spice usbredirection creates usb2 >> +controller and 4 usbredirection channels for redirection of up to 4 u= sb >> +devices from spice client to domU's qemu. The default is 0. >> + >> +=3Dback >> + >> =3Dhead3 Miscellaneous Emulated Hardware >> =3Dover 4 >> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c >> index 8db5460..58df106 100644 >> --- a/tools/libxl/libxl_create.c >> +++ b/tools/libxl/libxl_create.c >> @@ -289,6 +289,7 @@ int libxl__domain_build_info_setdefault(libxl__gc = *gc, >> false); >> libxl_defbool_setdefault(&b_info->u.hvm.spice.agent_mouse= , true); >> libxl_defbool_setdefault(&b_info->u.hvm.spice.vdagent, fa= lse); >> + libxl_defbool_setdefault(&b_info->u.hvm.spice.usbredirect= ion, false); >> } >> libxl_defbool_setdefault(&b_info->u.hvm.nographic, false); >> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c >> index bc605e4..4f625e0 100644 >> --- a/tools/libxl/libxl_dm.c >> +++ b/tools/libxl/libxl_dm.c >> @@ -471,6 +471,24 @@ static char ** libxl__build_device_model_args_new= (libxl__gc *gc, >> "virtserialport,chardev=3Dvdagent,name=3Dcom.redh= at.spice.0", >> NULL); >> } >> + >> + if (libxl_defbool_val(b_info->u.hvm.spice.usbredirection)= ) { >> + flexarray_vappend(dm_args, "-device","ich9-usb-ehci1,= id=3Dusb," >> + "bus=3Dpci.0,addr=3D0x1d.0x7", "-device","ich9-us= b-uhci1," >> + "masterbus=3Dusb.0,firstport=3D0,bus=3Dpci.0,mult= ifunction=3Don," >> + "addr=3D0x1d.0x0", "-device","ich9-usb-uhci2,mast= erbus=3Dusb.0," >> + "firstport=3D2,bus=3Dpci.0,addr=3D0x1d.0x1", "-de= vice", >> + "ich9-usb-uhci3,masterbus=3Dusb.0,firstport=3D4,b= us=3Dpci.0," >> + "addr=3D0x1d.0x2", "-chardev","spicevmc,name=3Dus= bredir," >> + "id=3Dusbrc1","-device","usb-redir,chardev=3Dusbr= c1,id=3Dusbrc1," >> + "bus=3Dusb.0", "-chardev","spicevmc,name=3Dusbred= ir,id=3Dusbrc2", >> + "-device","usb-redir,chardev=3Dusbrc2,id=3Dusbrc2= ,bus=3Dusb.0", >> + "-chardev","spicevmc,name=3Dusbredir,id=3Dusbrc3"= ,"-device", >> + "usb-redir,chardev=3Dusbrc3,id=3Dusbrc3,bus=3Dusb= .0", "-chardev", >> + "spicevmc,name=3Dusbredir,id=3Dusbrc4","-device",= "usb-redir," >> + "chardev=3Dusbrc4,id=3Dusbrc4,bus=3Dusb.0", NULL)= ; >> >> Any reason for so many hardcoded options? >> >> I searched and requested for one year on spice-devel and qemu-devel >> about alternative methods but nothing found for now. >> Already tried usb=3D1 which creates usb1 controller that is not >> working with usb redirection. >> >> What if QEMU upstream changes and these options don't work any more? I= n >> that case this functionality is broken and users have no way to >> workaround it. IMHO unless they are clearly documented we should not >> consider adding in theses hardcoded options in libxl. >> >> >> Added to cc spice-devel and qemu-devel for ask again if there is a bet= ter solution to do this. >> >> @spice-devel and qemu-devel: >> Can someone help to improve qemu options above for enable usb redirect= ion please? >> Thanks for any reply. >=20 > It's not about "improving" qemu options for usb redirection (even thoug= h > they could use a simplification), it's whether they are guaranteed to b= e > stable. Are you sure that a future QEMU release is going to work with > these options? > For example, is libvirt using something similar to this? >=20 > Usually QEMU cmdline options are considered a stable interface, so I > wouldn't worry too much about it. I'm not sure if pci.0 bus name of i440fx should be considered stable? Also if at some point you try to use, e.g., q35 rather than i440fx machine, it might have EHCI by default and the snippet would be instantiating a duplicate one. I.e., the three levels of dependency could be separated more clearly: PCI, USB, redirection. Stating the obvious, a loop would be a more readable solution for adding 4 devices only differing in device/chardev id. ;) CC'ing Hans. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg