[libvirt] [PATCH V2 1/7] extend usb controller model to support xen pvusb

Cedric Bosdonnat cbosdonnat at suse.com
Tue Aug 2 12:08:54 UTC 2016


On Wed, 2016-06-15 at 14:00 +0800, Chunyan Liu wrote:
> According to libxl implementation, it supports pvusb
> controller of version 1.1 and version 2.0, and it
> supports two types of backend, 'pvusb' (dom0 backend)
> and 'qusb' (qemu backend). But currently pvusb backend
> is not checked in yet.
> 
> To match libxl support, extend usb controller schema
> to support two more models: qusb1 (qusb, version 1.1)
> and 'qusb2' (qusb version 2.0).
> 
> Signed-off-by: Chunyan Liu <cyliu at suse.com>
> ---
> Changes:
>   drop pvusb1 and pvusb2 definition
> 
>  docs/formatdomain.html.in     | 4 +++-
>  docs/schemas/domaincommon.rng | 2 ++
>  src/conf/domain_conf.c        | 2 ++
>  src/conf/domain_conf.h        | 2 ++
>  src/qemu/qemu_command.c       | 2 ++
>  5 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 82b6aae..b778705 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -3075,7 +3075,9 @@
>          <dd>A <code>usb</code> controller has an optional attribute
>          <code>model</code>, which is one of "piix3-uhci", "piix4-uhci",
>          "ehci", "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3",
> -        "vt82c686b-uhci", "pci-ohci" or "nec-xhci".  Additionally,
> +        "vt82c686b-uhci", "pci-ohci", "nec-xhci", "qusb1" (xen pvusb
> +        with qemu backend, version 1.1) or "qusb2" (xen pvusb with qemu
> +        backend, version 2.0). Additionally,
>           <span class="since">since 0.10.0</span>, if the USB bus needs to
>           be explicitly disabled for the guest, <code>model='none'</code>
>           may be used.  <span class="since">Since 1.0.5</span>, no default
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 2e07505..311c1bf 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -1780,6 +1780,8 @@
>                    <value>pci-ohci</value>
>                    <value>nec-xhci</value>
>                    <value>none</value>
> +                  <value>qusb1</value>
> +                  <value>qusb2</value>
>                  </choice>
>                </attribute>
>              </optional>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 9504e5f..5fb18cc 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -356,6 +356,8 @@ VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
>                "vt82c686b-uhci",
>                "pci-ohci",
>                "nec-xhci",
> +              "qusb1",
> +              "qusb2",
>                "none")
>  
>  VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 15f9c80..4c9e1e3 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -685,6 +685,8 @@ typedef enum {
>      VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI,
>      VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI,
>      VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
> +    VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1,
> +    VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2,
>      VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
>  
>      VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 48be399..1998384 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -133,6 +133,8 @@ VIR_ENUM_IMPL(qemuControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
>                "vt82c686b-usb-uhci",
>                "pci-ohci",
>                "nec-usb-xhci",
> +              "qusb1",
> +              "qusb2",
>                "none");
>  
>  VIR_ENUM_DECL(qemuDomainFSDriver)

Got a build failure in virDomainUSBAddressControllerModelToPorts. This function will
need to handle the new values. Other than that, ACK.

I'll push the patch with this more hunk:

--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1393,6 +1393,12 @@ virDomainUSBAddressControllerModelToPorts(virDomainControllerDefPtr cont)
             return cont->opts.usbopts.ports;
         return 4;
 
+    case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1:
+    case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2:
+        if (cont->opts.usbopts.ports != -1)
+            return cont->opts.usbopts.ports;
+        return 8;
+
     case VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE:
     case VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST:
         break;

--
Cedric




More information about the libvir-list mailing list