1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Assign addresses to USB devices

Automatically assign addresses to USB devices.

Just like reserving, this is only done for newly defined domains.

https://bugzilla.redhat.com/show_bug.cgi?id=1215968
This commit is contained in:
Ján Tomko 2015-08-12 16:52:18 +02:00
parent 69f5ce45ab
commit bf182078d9
31 changed files with 260 additions and 45 deletions

View File

@ -1489,7 +1489,7 @@ virDomainUSBAddressFindPort(virDomainUSBAddressSetPtr addrs,
#define VIR_DOMAIN_USB_HUB_PORTS 8 #define VIR_DOMAIN_USB_HUB_PORTS 8
static int int
virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs,
virDomainHubDefPtr hub) virDomainHubDefPtr hub)
{ {
@ -1564,6 +1564,119 @@ virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs,
} }
static int
virDomainUSBAddressFindFreePort(virDomainUSBAddressHubPtr hub,
unsigned int *portpath,
unsigned int level)
{
unsigned int port;
ssize_t portIdx;
size_t i;
/* Look for free ports on the current hub */
if ((portIdx = virBitmapNextClearBit(hub->portmap, -1)) >= 0) {
port = portIdx + 1;
VIR_DEBUG("Found a free port %u at level %u", port, level);
portpath[level] = port;
return 0;
}
VIR_DEBUG("No ports found on hub %p, trying the hubs on it", hub);
if (level >= VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH - 1)
return -1;
/* Recursively search through the ports that contain another hub */
for (i = 0; i < hub->nports; i++) {
if (!hub->ports[i])
continue;
port = i + 1;
VIR_DEBUG("Looking at USB hub at level: %u port: %u", level, port);
if (virDomainUSBAddressFindFreePort(hub->ports[i], portpath,
level + 1) < 0)
continue;
portpath[level] = port;
return 0;
}
return -1;
}
/* Try to find a free port on bus @bus.
*
* Returns 0 on success
* -1 on fatal error (OOM)
* -2 if there is no bus at @bus or no free port on this bus
*/
static int
virDomainUSBAddressAssignFromBus(virDomainUSBAddressSetPtr addrs,
virDomainDeviceInfoPtr info,
size_t bus)
{
unsigned int portpath[VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH] = { 0 };
virDomainUSBAddressHubPtr hub = addrs->buses[bus];
char *portStr = NULL;
int ret = -1;
if (!hub)
return -2;
if (virDomainUSBAddressFindFreePort(hub, portpath, 0) < 0)
return -2;
/* we found a free port */
if (!(portStr = virDomainUSBAddressPortFormat(portpath)))
goto cleanup;
info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB;
info->addr.usb.bus = bus;
memcpy(info->addr.usb.port, portpath, sizeof(portpath));
VIR_DEBUG("Assigning USB addr bus=%u port=%s",
info->addr.usb.bus, portStr);
if (virDomainUSBAddressReserve(info, addrs) < 0)
goto cleanup;
ret = 0;
cleanup:
VIR_FREE(portStr);
return ret;
}
int
virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs,
virDomainDeviceInfoPtr info)
{
size_t i;
int rc;
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
VIR_DEBUG("A USB port on bus %u was requested", info->addr.usb.bus);
if (!addrs->buses[info->addr.usb.bus]) {
virReportError(VIR_ERR_XML_ERROR,
_("USB bus %u requested but no controller "
"with that index is present"), info->addr.usb.bus);
return -1;
}
rc = virDomainUSBAddressAssignFromBus(addrs, info, info->addr.usb.bus);
if (rc >= -1)
return rc;
} else {
VIR_DEBUG("Looking for a free USB port on all the buses");
for (i = 0; i < addrs->nbuses; i++) {
rc = virDomainUSBAddressAssignFromBus(addrs, info, i);
if (rc >= -1)
return rc;
}
}
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No free USB ports"));
return -1;
}
int int
virDomainUSBAddressReserve(virDomainDeviceInfoPtr info, virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
void *data) void *data)
@ -1604,3 +1717,21 @@ virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
VIR_FREE(portStr); VIR_FREE(portStr);
return ret; return ret;
} }
int
virDomainUSBAddressEnsure(virDomainUSBAddressSetPtr addrs,
virDomainDeviceInfoPtr info)
{
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
(info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB &&
!virDomainUSBAddressPortIsValid(info->addr.usb.port))) {
if (virDomainUSBAddressAssign(addrs, info) < 0)
return -1;
} else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
if (virDomainUSBAddressReserve(info, addrs) < 0)
return -1;
}
return 0;
}

View File

@ -273,10 +273,24 @@ virDomainUSBAddressSetPtr virDomainUSBAddressSetCreate(void);
int virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs, int virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs,
virDomainDefPtr def) virDomainDefPtr def)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs,
virDomainHubDefPtr hub)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs); void virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs);
int int
virDomainUSBAddressReserve(virDomainDeviceInfoPtr info, virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
void *data) void *data)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs,
virDomainDeviceInfoPtr info)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
virDomainUSBAddressEnsure(virDomainUSBAddressSetPtr addrs,
virDomainDeviceInfoPtr info)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
#endif /* __DOMAIN_ADDR_H__ */ #endif /* __DOMAIN_ADDR_H__ */

View File

@ -107,11 +107,14 @@ virDomainPCIAddressSetGrow;
virDomainPCIAddressSlotInUse; virDomainPCIAddressSlotInUse;
virDomainPCIAddressValidate; virDomainPCIAddressValidate;
virDomainPCIControllerModelToConnectType; virDomainPCIControllerModelToConnectType;
virDomainUSBAddressAssign;
virDomainUSBAddressEnsure;
virDomainUSBAddressPortFormat; virDomainUSBAddressPortFormat;
virDomainUSBAddressPortFormatBuf; virDomainUSBAddressPortFormatBuf;
virDomainUSBAddressPortIsValid; virDomainUSBAddressPortIsValid;
virDomainUSBAddressReserve; virDomainUSBAddressReserve;
virDomainUSBAddressSetAddControllers; virDomainUSBAddressSetAddControllers;
virDomainUSBAddressSetAddHub;
virDomainUSBAddressSetCreate; virDomainUSBAddressSetCreate;
virDomainUSBAddressSetFree; virDomainUSBAddressSetFree;
virDomainVirtioSerialAddrAssign; virDomainVirtioSerialAddrAssign;

View File

@ -1622,6 +1622,63 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
} }
struct qemuAssignUSBIteratorInfo {
virDomainUSBAddressSetPtr addrs;
size_t count;
};
static int
qemuDomainAssignUSBPortsIterator(virDomainDeviceInfoPtr info,
void *opaque)
{
struct qemuAssignUSBIteratorInfo *data = opaque;
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
return 0;
return virDomainUSBAddressAssign(data->addrs, info);
}
static int
qemuDomainAssignUSBHubs(virDomainUSBAddressSetPtr addrs,
virDomainDefPtr def)
{
size_t i;
for (i = 0; i < def->nhubs; i++) {
virDomainHubDefPtr hub = def->hubs[i];
if (hub->type != VIR_DOMAIN_HUB_TYPE_USB)
continue;
if (hub->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB &&
virDomainUSBAddressPortIsValid(hub->info.addr.usb.port))
continue;
if (virDomainUSBAddressAssign(addrs, &hub->info) < 0)
return -1;
if (virDomainUSBAddressSetAddHub(addrs, hub) < 0)
return -1;
}
return 0;
}
static int
qemuDomainAssignUSBPorts(virDomainUSBAddressSetPtr addrs,
virDomainDefPtr def)
{
struct qemuAssignUSBIteratorInfo data = { .addrs = addrs };
return virDomainUSBDeviceDefForeach(def,
qemuDomainAssignUSBPortsIterator,
&data,
true);
}
static int static int
qemuDomainAssignUSBAddresses(virDomainDefPtr def, qemuDomainAssignUSBAddresses(virDomainDefPtr def,
virDomainObjPtr obj) virDomainObjPtr obj)
@ -1642,6 +1699,14 @@ qemuDomainAssignUSBAddresses(virDomainDefPtr def,
VIR_DEBUG("Existing USB addresses have been reserved"); VIR_DEBUG("Existing USB addresses have been reserved");
if (qemuDomainAssignUSBHubs(addrs, def) < 0)
goto cleanup;
if (qemuDomainAssignUSBPorts(addrs, def) < 0)
goto cleanup;
VIR_DEBUG("Finished assigning USB ports");
if (obj && obj->privateData) { if (obj && obj->privateData) {
priv = obj->privateData; priv = obj->privateData;
priv->usbaddrs = addrs; priv->usbaddrs = addrs;

View File

@ -22,5 +22,5 @@ readonly=on \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-serial pty \ -serial pty \
-device usb-tablet,id=input0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -22,5 +22,5 @@ QEMU_AUDIO_DRV=none \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-serial pty \ -serial pty \
-device usb-tablet,id=input0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -19,8 +19,8 @@ nowait \
-boot order=cna,menu=off \ -boot order=cna,menu=off \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 \
-device usb-ccid,id=ccid0 \ -device usb-ccid,id=ccid0,bus=usb.0,port=1.1 \
-device usb-hub,id=hub0 \ -device usb-hub,id=hub0,bus=usb.0,port=1 \
-drive file=/tmp/fdr.img,format=raw,if=none,id=drive-virtio-disk0,cache=none,\ -drive file=/tmp/fdr.img,format=raw,if=none,id=drive-virtio-disk0,cache=none,\
aio=native \ aio=native \
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,\ -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,\
@ -37,10 +37,10 @@ media=cdrom,id=drive-ide0-1-0,readonly=on \
-chardev spicevmc,id=charchannel0,name=vdagent \ -chardev spicevmc,id=charchannel0,name=vdagent \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\ -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\
id=channel0,name=com.redhat.spice.0 \ id=channel0,name=com.redhat.spice.0 \
-device usb-tablet,id=input0 \ -device usb-tablet,id=input0,bus=usb.0,port=1.2 \
-spice port=5901,tls-port=5902,addr=0.0.0.0,x509-dir=/etc/pki/libvirt-spice \ -spice port=5901,tls-port=5902,addr=0.0.0.0,x509-dir=/etc/pki/libvirt-spice \
-vga cirrus \ -vga cirrus \
-device intel-hda,id=sound0,bus=pci.0,addr=0x4 \ -device intel-hda,id=sound0,bus=pci.0,addr=0x4 \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \ -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
-device usb-host,hostbus=14,hostaddr=6,id=hostdev0 \ -device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bus=usb.0,port=2 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6

View File

@ -21,5 +21,6 @@ QEMU_AUDIO_DRV=none \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-drive file=/tmp/usbdisk.img,format=raw,if=none,id=drive-usb-disk0 \ -drive file=/tmp/usbdisk.img,format=raw,if=none,id=drive-usb-disk0 \
-device usb-storage,drive=drive-usb-disk0,id=usb-disk0,removable=on \ -device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0,\
removable=on \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -21,5 +21,5 @@ QEMU_AUDIO_DRV=none \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-drive file=/tmp/usbdisk.img,format=raw,if=none,id=drive-usb-disk0 \ -drive file=/tmp/usbdisk.img,format=raw,if=none,id=drive-usb-disk0 \
-device usb-storage,drive=drive-usb-disk0,id=usb-disk0 \ -device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -28,7 +28,7 @@ media=cdrom,id=drive-ide0-1-0,readonly=on \
-device rtl8139,vlan=0,id=net0,mac=52:54:00:71:70:89,bus=pci.0,addr=0x7 \ -device rtl8139,vlan=0,id=net0,mac=52:54:00:71:70:89,bus=pci.0,addr=0x7 \
-net tap,fd=3,vlan=0,name=hostnet0 \ -net tap,fd=3,vlan=0,name=hostnet0 \
-serial pty \ -serial pty \
-device usb-tablet,id=input0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \
-spice port=5900,addr=127.0.0.1 \ -spice port=5900,addr=127.0.0.1 \
-vga std \ -vga std \
-device AC97,id=sound0,bus=pci.0,addr=0x3 \ -device AC97,id=sound0,bus=pci.0,addr=0x3 \

View File

@ -30,7 +30,7 @@ zlib-glz-wan-compression=auto,playback-compression=on,streaming-video=filter,\
disable-copy-paste \ disable-copy-paste \
-vga cirrus \ -vga cirrus \
-chardev socket,id=charredir0,host=localhost,port=4000 \ -chardev socket,id=charredir0,host=localhost,port=4000 \
-device usb-redir,chardev=charredir0,id=redir0 \ -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 \
-chardev spicevmc,id=charredir1,name=usbredir \ -chardev spicevmc,id=charredir1,name=usbredir \
-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \ -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -19,5 +19,6 @@ QEMU_AUDIO_DRV=none \
-usb \ -usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bootindex=1 \ -device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bootindex=1,bus=usb.0,\
port=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -20,5 +20,5 @@ QEMU_AUDIO_DRV=none \
-usb \ -usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device usb-host,hostbus=14,hostaddr=6,id=hostdev0 \ -device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bus=usb.0,port=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -19,4 +19,4 @@ QEMU_AUDIO_DRV=none \
-usb \ -usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device usb-host,hostbus=14,hostaddr=6,id=hostdev0 -device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bus=usb.0,port=1

View File

@ -46,7 +46,7 @@ id=channel0,name=org.qemu.guest_agent.0 \
-chardev spicevmc,id=charchannel1,name=vdagent \ -chardev spicevmc,id=charchannel1,name=vdagent \
-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,\ -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,\
id=channel1,name=com.redhat.spice.0 \ id=channel1,name=com.redhat.spice.0 \
-device usb-tablet,id=input0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \
-spice port=5901,tls-port=5902,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \ -spice port=5901,tls-port=5902,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \
-vga qxl \ -vga qxl \
-global qxl-vga.ram_size=67108864 \ -global qxl-vga.ram_size=67108864 \
@ -54,7 +54,7 @@ id=channel1,name=com.redhat.spice.0 \
-device intel-hda,id=sound0,bus=pci.0,addr=0x4 \ -device intel-hda,id=sound0,bus=pci.0,addr=0x4 \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \ -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
-chardev spicevmc,id=charredir0,name=usbredir \ -chardev spicevmc,id=charredir0,name=usbredir \
-device usb-redir,chardev=charredir0,id=redir0 \ -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 \
-chardev spicevmc,id=charredir1,name=usbredir \ -chardev spicevmc,id=charredir1,name=usbredir \
-device usb-redir,chardev=charredir1,id=redir1 \ -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8

View File

@ -19,4 +19,4 @@ QEMU_AUDIO_DRV=none \
-usb \ -usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device usb-mouse,id=input0 -device usb-mouse,id=input0,bus=usb.0,port=1

View File

@ -19,4 +19,4 @@ QEMU_AUDIO_DRV=none \
-usb \ -usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device usb-tablet,id=input0 -device usb-tablet,id=input0,bus=usb.0,port=1

View File

@ -22,4 +22,4 @@ server,nowait \
-device pci-ohci,id=usb,bus=pci,addr=0x1 \ -device pci-ohci,id=usb,bus=pci,addr=0x1 \
-chardev pty,id=charserial0 \ -chardev pty,id=charserial0 \
-device spapr-vty,chardev=charserial0,reg=0x30000000 \ -device spapr-vty,chardev=charserial0,reg=0x30000000 \
-device usb-kbd,id=input0 -device usb-kbd,id=input0,bus=usb.0,port=1

View File

@ -23,7 +23,7 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev spiceport,id=charserial0,name=org.qemu.console.serial.0 \ -chardev spiceport,id=charserial0,name=org.qemu.console.serial.0 \
-device isa-serial,chardev=charserial0,id=serial0 \ -device isa-serial,chardev=charserial0,id=serial0 \
-device usb-tablet,id=input0 \ -device usb-tablet,id=input0,bus=usb.0,port=1 \
-spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \ -spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,\ -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,\
addr=0x2 \ addr=0x2 \

View File

@ -19,7 +19,7 @@ server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \ -mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-device usb-ccid,id=ccid0 \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \
-usb \ -usb \
-device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0 \ -device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -19,7 +19,7 @@ server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \ -mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-device usb-ccid,id=ccid0 \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \
-usb \ -usb \
-device ccid-card-emulated,backend=certificates,cert1=cert1,cert2=cert2,\ -device ccid-card-emulated,backend=certificates,cert1=cert1,cert2=cert2,\
cert3=cert3,db=/etc/pki/nssdb,id=smartcard0,bus=ccid0.0 \ cert3=cert3,db=/etc/pki/nssdb,id=smartcard0,bus=ccid0.0 \

View File

@ -19,7 +19,7 @@ server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \ -mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-device usb-ccid,id=ccid0 \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \
-usb \ -usb \
-device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0 \ -device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -19,7 +19,7 @@ server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \ -mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-device usb-ccid,id=ccid0 \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \
-usb \ -usb \
-chardev spicevmc,id=charsmartcard0,name=smartcard \ -chardev spicevmc,id=charsmartcard0,name=smartcard \
-device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \ -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \

View File

@ -19,7 +19,7 @@ server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \ -mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-device usb-ccid,id=ccid0 \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \
-usb \ -usb \
-chardev socket,id=charsmartcard0,host=127.0.0.1,port=2001,server,nowait \ -chardev socket,id=charsmartcard0,host=127.0.0.1,port=2001,server,nowait \
-device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \ -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \

View File

@ -34,5 +34,5 @@ QEMU_AUDIO_DRV=none \
-device ich9-intel-hda,id=sound7,bus=pci.0,addr=0x8 \ -device ich9-intel-hda,id=sound7,bus=pci.0,addr=0x8 \
-device hda-micro,id=sound7-codec0,bus=sound7.0,cad=0 \ -device hda-micro,id=sound7-codec0,bus=sound7.0,cad=0 \
-device hda-duplex,id=sound7-codec1,bus=sound7.0,cad=1 \ -device hda-duplex,id=sound7-codec1,bus=sound7.0,cad=1 \
-device usb-audio,id=sound8 \ -device usb-audio,id=sound8,bus=usb.0,port=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9

View File

@ -24,9 +24,9 @@ server,nowait \
addr=0x4 \ addr=0x4 \
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
-device usb-hub,id=hub0 \ -device usb-hub,id=hub0,bus=usb.0,port=1 \
-device usb-hub,id=hub1 \ -device usb-hub,id=hub1,bus=usb.0,port=2 \
-device usb-mouse,id=input0 \ -device usb-mouse,id=input0,bus=usb.0,port=3 \
-device usb-mouse,id=input1 \ -device usb-mouse,id=input1,bus=usb.0,port=4 \
-device usb-mouse,id=input2 \ -device usb-mouse,id=input2,bus=usb.0,port=5 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -21,8 +21,8 @@ server,nowait \
-boot c \ -boot c \
-usb \ -usb \
-device usb-hub,id=hub0,bus=usb.0,port=1 \ -device usb-hub,id=hub0,bus=usb.0,port=1 \
-device usb-hub,id=hub1 \ -device usb-hub,id=hub1,bus=usb.0,port=2 \
-device usb-mouse,id=input0 \ -device usb-mouse,id=input0,bus=usb.0,port=1.1 \
-device usb-mouse,id=input1 \ -device usb-mouse,id=input1,bus=usb.0,port=1.2 \
-device usb-mouse,id=input2 \ -device usb-mouse,id=input2,bus=usb.0,port=1.3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -20,7 +20,7 @@ server,nowait \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-usb \ -usb \
-device usb-hub,id=hub0,bus=usb.0 \ -device usb-hub,id=hub0,bus=usb.0,port=1 \
-device usb-hub,id=hub1,bus=usb.0 \ -device usb-hub,id=hub1,bus=usb.0,port=2 \
-device usb-mouse,id=input0,bus=usb.0 \ -device usb-mouse,id=input0,bus=usb.0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -24,7 +24,7 @@ addr=0x4 \
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
-chardev socket,id=charredir0,host=localhost,port=4000 \ -chardev socket,id=charredir0,host=localhost,port=4000 \
-device usb-redir,chardev=charredir0,id=redir0,bootindex=1 \ -device usb-redir,chardev=charredir0,id=redir0,bootindex=1,bus=usb.0,port=1 \
-chardev spicevmc,id=charredir1,name=usbredir \ -chardev spicevmc,id=charredir1,name=usbredir \
-device usb-redir,chardev=charredir1,id=redir1,bootindex=2,bus=usb.0,port=4 \ -device usb-redir,chardev=charredir1,id=redir1,bootindex=2,bus=usb.0,port=4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -25,7 +25,7 @@ addr=0x4 \
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
-chardev socket,id=charredir0,host=localhost,port=4000 \ -chardev socket,id=charredir0,host=localhost,port=4000 \
-device usb-redir,chardev=charredir0,id=redir0 \ -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 \
-chardev spicevmc,id=charredir1,name=usbredir \ -chardev spicevmc,id=charredir1,name=usbredir \
-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \ -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -20,8 +20,8 @@ server,nowait \
-no-acpi \ -no-acpi \
-boot c \ -boot c \
-device nec-usb-xhci,p2=8,p3=8,id=usb,bus=pci.0,addr=0x3 \ -device nec-usb-xhci,p2=8,p3=8,id=usb,bus=pci.0,addr=0x3 \
-device usb-hub,id=hub0 \ -device usb-hub,id=hub0,bus=usb.0,port=1 \
-device usb-hub,id=hub1 \ -device usb-hub,id=hub1,bus=usb.0,port=2 \
-device usb-mouse,id=input0 \ -device usb-mouse,id=input0,bus=usb.0,port=3 \
-device usb-mouse,id=input1 \ -device usb-mouse,id=input1,bus=usb.0,port=4 \
-device usb-mouse,id=input2 -device usb-mouse,id=input2,bus=usb.0,port=5