[pve-devel] [PATCH qemu-server 1/2] Add USB3 support to Spice USB redirection

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 2 13:57:11 CEST 2019


On 8/30/19 9:40 AM, Aaron Lauterer wrote:
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
>  PVE/QemuServer/USB.pm | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
> index a2097b9..05c78cf 100644
> --- a/PVE/QemuServer/USB.pm
> +++ b/PVE/QemuServer/USB.pm
> @@ -87,9 +87,12 @@ sub get_usb_devices {
>  	    my $hostdevice = parse_usb_device($d->{host});
>  	    $hostdevice->{usb3} = $d->{usb3};
>  	    if (defined($hostdevice->{spice}) && $hostdevice->{spice}) {
> -		# usb redir support for spice, currently no usb3
> +		# usb redir support for spice
> +		my $bus = 'ehci';
> +		$bus = 'xhci' if $hostdevice->{usb3};
> +
>  		push @$devices, '-chardev', "spicevmc,id=usbredirchardev$i,name=usbredir";
> -		push @$devices, '-device', "usb-redir,chardev=usbredirchardev$i,id=usbredirdev$i,bus=ehci.0";
> +		push @$devices, '-device', "usb-redir,chardev=usbredirchardev$i,id=usbredirdev$i,bus=$bus.0";
>  	    } else {
>  		push @$devices, '-device', print_usbdevice_full($conf, "usb$i", $hostdevice);
>  	    }
> 

what the commit message does not mentions:

One could have set an usb3 spice variant already, e.g., with:
# qm set 1000 --usb2 spice,usb3=1

and started it without issues, as we just ignored it.
Now, with your patch it will suddenly change the backing bus to
xhci, which (I assume) kills live migrations or restorations of
snapshot with RAM.

So this would need to be guarded somehow, e.g., with a qemu
machine version check.




More information about the pve-devel mailing list