[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5] libxl: usb2 and usb3 controller support for upstream qemu



On Fri, Sep 13, 2013 at 04:25:37PM +0200, Fabio Fantoni wrote:
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 43c3bec..e0123b7 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -511,7 +511,30 @@ static char ** 
> libxl__build_device_model_args_new(libxl__gc *gc,
>                      __func__);
>                  return NULL;
>              }
> -            flexarray_append(dm_args, "-usb");
> +
> +            switch (b_info->u.hvm.usbversion) {
> +            case 1:
> +                flexarray_vappend(dm_args,
> +                    "-device", "piix3-usb-uhci,id=usb", NULL);
> +                break;
> +            case 2:
> +                flexarray_append_pair(dm_args, "-device",
> +                    "ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x1d.0x7");
> +                for (i = 1; i < 4; i++)
> +                    flexarray_append_pair(dm_args, "-device",
> +                        GCSPRINTF("ich9-usb-uhci%d,masterbus=usb.0,"
> +                        "firstport=%d,bus=pci.0%s,addr=0x1d.%#x", i,
> +                        2*(i-1), i == 1 ?",multifunction=on" : "", i-1));
> +                break;
> +            case 3:
> +                flexarray_vappend(dm_args,
> +                    "-device", "nec-usb-xhci,id=usb", NULL);
> +                break;
> +            default:
> +                LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
> +                    "usbversion parameter is invalid must be between 1 and 
> 3");
> +                return NULL;
> +            }
>              if (b_info->u.hvm.usbdevice) {
>                  flexarray_vappend(dm_args,
>                                    "-usbdevice", b_info->u.hvm.usbdevice, 
> NULL);

I've took a look at the QEMU command line, and especially the usb2 case.
I think the bus=pci.0 is not needed, QEMU does not complain and the usb
controller is visible in the guest.

About the id, I think it would be better to name the different version
with different ids, they could be uhci, ehci and xhci as I saw in few
example, or it could be usb1, usb2, usb3. So when those id are used
later, they will carry which usb version there are providing, without
the need to know how the guest have been configured.

About the multifunction=on, do you know why it's only on applied to one
of the ich9-usb-uhci devices (in the for loop)? Would it change
something to applied to all of them?

Otherwise, there is some docs in the qemu.git tree to make sense of
this, and especially docs/usb2.txt.

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.