虚拟机中的 KVM 直通超过 3 个 USB 设备

虚拟机中的 KVM 直通超过 3 个 USB 设备

我有一个问题,如何在虚拟机中透传超过 3 个 USB 设备?

我有一个 USB 集线器,但无法在虚拟机中直通超过 3 个 USB 设备。我的 USB 设备连接到 USB 集线器,但如果我将它们连接到主板,我会遇到相同的错误:

错误:没有可用的 USB 端口

但我有超过 4 个 USB 空闲端口。

我的系统:

1) 4.13.0-43-generic Ubuntu 17.10 qemu-kvm 版本:1:2.10+dfsg-0ubuntu3.8 libvirt 版本 3.6.0

2) 虚拟机 Windows 7x64 配置虚拟机:

<domain type='kvm'>
<name>A1</name>
<uuid>6ba27623-0f5c-41c9-bca9-6a51c5cdf4c2</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-artful'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
  <relaxed state='on'/>
  <vapic state='on'/>
  <spinlocks state='on' retries='8191'/>
</hyperv>
</features>
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Haswell-noTSX-IBRS</model>
</cpu>
<clock offset='localtime'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
<timer name='hypervclock' present='yes'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2' cache='none'/>
  <source file='/kvm/vhdd/A1.qcow2'/>
  <target dev='vda' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='usb' index='0' model='nec-xhci'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<interface type='bridge'>
  <mac address='52:54:00:86:70:01'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
  <target port='0'/>
</serial>
<console type='pty'>
  <target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'>
  <address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
  <listen type='address' address='0.0.0.0'/>
</graphics>
<video>
  <model type='vga' vram='16384' heads='1' primary='yes'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>

3) 我的 USB 设备编号为:6、5、4、7。设备编号 8 是读卡器。 lsusb -

Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 046d:c328 Logitech, Inc. 
Bus 003 Device 008: ID 05e3:0723 Genesys Logic, Inc. GL827L SD/MMC/MS Flash Card Reader
Bus 003 Device 009: ID 067b:2528 Prolific Technology, Inc. Storage device (8gB thumb drive)
Bus 003 Device 006: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
Bus 003 Device 005: ID 0951:1666 Kingston Technology DataTraveler G4
Bus 003 Device 004: ID 0951:1666 Kingston Technology DataTraveler G4
Bus 003 Device 002: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

4) lsusb -t

/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 5: Dev 2, If 0, Class=Hub, Driver=hub/7p, 480M
    |__ Port 4: Dev 9, If 0, Class=Mass Storage, Driver=usb-storage, 480M
    |__ Port 2: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
    |__ Port 5: Dev 8, If 0, Class=Mass Storage, Driver=usbfs, 480M
    |__ Port 3: Dev 6, If 0, Class=Mass Storage, Driver=usbfs, 480M
    |__ Port 1: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 6: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 6: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

那么,我该如何解决这个问题呢?

相关内容