[libvirt] [PATCH] qemu: Don't use legacy USB for aarch64 mach-virt guests

The '-usb' option doesn't have any effect for aarch64 mach-virt guests, so the fact that it's currently enabled by default is not really causing any issue. However, that might change in the future (although unlikely), and having it as part of the QEMU command line can cause confusion to someone looking through the process list. Avoid it completely, like it's already happening for q35. --- This requires https://www.redhat.com/archives/libvir-list/2016-June/msg01157.html to apply cleanly, but it's not really related. Applying it on top of master instead should just be a matter of fixing a few trivial merge conflicts in the test suite. CC:ing Drew for extra assurance that doing this is indeed completely safe :) src/qemu/qemu_command.c | 1 + tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args | 3 +-- tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args | 3 +-- tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args | 3 +-- tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args | 1 - .../qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args | 1 - .../qemuxml2argv-aarch64-virtio-pci-manual-addresses.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args | 1 - 14 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4a8def1..6944129 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2875,6 +2875,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, if (usbcontroller == 0 && !qemuDomainMachineIsQ35(def) && + !qemuDomainMachineIsVirt(def) && !ARCH_IS_S390(def->os.arch)) virCommandAddArg(cmd, "-usb"); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args index 3f05dfb..1de2ecf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args index 4ae3923..b394066 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args @@ -17,6 +17,5 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -boot c \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args index 61ee5af..a16b8b6 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args @@ -16,5 +16,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -no-acpi \ --boot c \ --usb +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args index d3ac955..031a31e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args @@ -16,5 +16,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -no-acpi \ --boot c \ --usb +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args index 27fa1f5..f078fd8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args @@ -16,5 +16,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -no-acpi \ --boot c \ --usb +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args index 23bb517..284aacf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args @@ -20,7 +20,6 @@ QEMU_AUDIO_DRV=none \ -kernel /arm.kernel \ -initrd /arm.initrd \ -append 'console=ttyAMA0,115200n8 rw root=/dev/vda rootwait physmap.enabled=0' \ --usb \ -drive file=/arm.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args index 3e6bee9..6c2a908 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args index 06a4733..ab45209 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args @@ -20,6 +20,5 @@ QEMU_AUDIO_DRV=none \ -kernel /aarch64.kernel \ -initrd /aarch64.initrd \ -append console=ttyAMA0 \ --usb \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ -net user,vlan=0,name=hostnet0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args index 566bee2..1ed5462 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args index 566bee2..1ed5462 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args index 4e5dbdb..8245854 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args @@ -25,7 +25,6 @@ QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \ -device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.1,addr=0x1 \ -device virtio-scsi-pci,id=scsi0,bus=pci.3,addr=0x1 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-scsi0-0-0-0 \ -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ id=scsi0-0-0-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args index c736f60..d3e8efc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args @@ -21,7 +21,6 @@ QEMU_AUDIO_DRV=none \ -append 'console=ttyAMA0,115200n8 rw root=/dev/vda rootwait physmap.enabled=0' \ -dtb /arm.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/arm.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args index 0fd9107..42709c5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args @@ -21,5 +21,4 @@ QEMU_AUDIO_DRV=none \ -initrd /aarch64.initrd \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ --usb \ -device virtio-balloon-device,id=balloon0,deflate-on-oom=on -- 2.5.5

On 06/17/2016 09:20 AM, Andrea Bolognani wrote:
The '-usb' option doesn't have any effect for aarch64 mach-virt guests,
Do you mean that having -usb on the commandline doesn't result in a usb controller? qemu should also be giving an error then...
so the fact that it's currently enabled by default is not really causing any issue.
However, that might change in the future (although unlikely), and having it as part of the QEMU command line can cause confusion to someone looking through the process list.
Avoid it completely, like it's already happening for q35.
I've forgotten if this was intended to solve some problem, or if it's just a side-effect of the fact that a libvirt Q35 config originally didn't add any usb controller by default. Everything around the "add a 'default' usb controller by default if none is specified" has always been so mixed up anyway. It's really too bad we have to keep all that cruft around just for backwards compatibility with something that we decided was a bad idea 5 or 6 years ago) At any rate, again (as with your earlier "eliminate the PCI controllers patch" which I'm reviewing now) you are using qemuDomainMachineIsVirt(), which doesn't check the arch, but only machinetype (and so would match on virt for any other arch). But in this case I think any arch modern enough to have a virt machinetype is also modern enough that we won't want "-usb" (personally I think that any USB controller added to any guest should always have the controller model fully specified, so we really should eliminate any possibility of "-usb" everywhere unless there is some odd arch that has no other way to add a USB controller. ACK from me.
--- This requires
https://www.redhat.com/archives/libvir-list/2016-June/msg01157.html
to apply cleanly, but it's not really related. Applying it on top of master instead should just be a matter of fixing a few trivial merge conflicts in the test suite.
CC:ing Drew for extra assurance that doing this is indeed completely safe :)
src/qemu/qemu_command.c | 1 + tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args | 3 +-- tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args | 3 +-- tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args | 3 +-- tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args | 1 - .../qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args | 1 - .../qemuxml2argv-aarch64-virtio-pci-manual-addresses.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args | 1 - tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args | 1 - 14 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4a8def1..6944129 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2875,6 +2875,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
if (usbcontroller == 0 && !qemuDomainMachineIsQ35(def) && + !qemuDomainMachineIsVirt(def) && !ARCH_IS_S390(def->os.arch)) virCommandAddArg(cmd, "-usb");
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args index 3f05dfb..1de2ecf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args index 4ae3923..b394066 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args @@ -17,6 +17,5 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -boot c \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args index 61ee5af..a16b8b6 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args @@ -16,5 +16,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -no-acpi \ --boot c \ --usb +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args index d3ac955..031a31e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args @@ -16,5 +16,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -no-acpi \ --boot c \ --usb +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args index 27fa1f5..f078fd8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args @@ -16,5 +16,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -no-acpi \ --boot c \ --usb +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args index 23bb517..284aacf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args @@ -20,7 +20,6 @@ QEMU_AUDIO_DRV=none \ -kernel /arm.kernel \ -initrd /arm.initrd \ -append 'console=ttyAMA0,115200n8 rw root=/dev/vda rootwait physmap.enabled=0' \ --usb \ -drive file=/arm.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args index 3e6bee9..6c2a908 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args index 06a4733..ab45209 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args @@ -20,6 +20,5 @@ QEMU_AUDIO_DRV=none \ -kernel /aarch64.kernel \ -initrd /aarch64.initrd \ -append console=ttyAMA0 \ --usb \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ -net user,vlan=0,name=hostnet0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args index 566bee2..1ed5462 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args index 566bee2..1ed5462 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args @@ -22,7 +22,6 @@ QEMU_AUDIO_DRV=none \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args index 4e5dbdb..8245854 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args @@ -25,7 +25,6 @@ QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \ -device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.1,addr=0x1 \ -device virtio-scsi-pci,id=scsi0,bus=pci.3,addr=0x1 \ --usb \ -drive file=/aarch64.raw,format=raw,if=none,id=drive-scsi0-0-0-0 \ -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ id=scsi0-0-0-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args index c736f60..d3e8efc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args @@ -21,7 +21,6 @@ QEMU_AUDIO_DRV=none \ -append 'console=ttyAMA0,115200n8 rw root=/dev/vda rootwait physmap.enabled=0' \ -dtb /arm.dtb \ -device virtio-serial-device,id=virtio-serial0 \ --usb \ -drive file=/arm.raw,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args index 0fd9107..42709c5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args @@ -21,5 +21,4 @@ QEMU_AUDIO_DRV=none \ -initrd /aarch64.initrd \ -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ -dtb /aarch64.dtb \ --usb \ -device virtio-balloon-device,id=balloon0,deflate-on-oom=on

On Fri, 2016-06-17 at 11:20 -0400, Laine Stump wrote:
On 06/17/2016 09:20 AM, Andrea Bolognani wrote:
The '-usb' option doesn't have any effect for aarch64 mach-virt guests, Do you mean that having -usb on the commandline doesn't result in a usb controller? qemu should also be giving an error then...
That's what it looks like to me. No USB controller is visible from the guest, and running 'info qtree' in the QEMU console doesn't yield anything that looks like a USB controller. Plus, if you try and add something like <input type='mouse' bus='usb'/> QEMU will complain loudly about the lack of a USB host controller and refuse to start the guest.
so the fact that it's currently enabled by default is not really causing any issue. However, that might change in the future (although unlikely), and having it as part of the QEMU command line can cause confusion to someone looking through the process list. Avoid it completely, like it's already happening for q35. I've forgotten if this was intended to solve some problem, or if it's just a side-effect of the fact that a libvirt Q35 config originally didn't add any usb controller by default. Everything around the "add a 'default' usb controller by default if none is specified" has always been so mixed up anyway. It's really too bad we have to keep all that cruft around just for backwards compatibility with something that we decided was a bad idea 5 or 6 years ago) At any rate, again (as with your earlier "eliminate the PCI controllers patch" which I'm reviewing now) you are using qemuDomainMachineIsVirt(), which doesn't check the arch, but only machinetype (and so would match on virt for any other arch). But in this case I think any arch modern enough to have a virt machinetype is also modern enough that we won't want "-usb" (personally I think that any USB controller added to any guest should always have the controller model fully specified, so we really should eliminate any possibility of "-usb" everywhere unless there is some odd arch that has no other way to add a USB controller.
I vehemently agree. The domain XML should be a *faithful* and *complete* representation of the guest hardware - if a certain machine type includes a USB controller that the user can't remove, then the domain XML should include an element representing that controller. If no such element is present, then the guest should have no USB controllers. Of course it's not as simple as that, because of the compatibility requirements you mentioned above :( But I plan to rewrite qemuBuildControllerDevCommandLine() so that it enables legacy USB on a /whitelist/ basis instead of a /blacklist/ basis. If I can get it to work, at leas we'll be sure no future machine type will end up enabling legacy USB just because we forgot to esplicitly blacklist it.
ACK from me.
Great, thanks! I'll wait for Drew's thumbs up before actually pushing this, though. -- Andrea Bolognani Software Engineer - Virtualization Team

On Fri, Jun 17, 2016 at 06:51:34PM +0200, Andrea Bolognani wrote:
On Fri, 2016-06-17 at 11:20 -0400, Laine Stump wrote:
On 06/17/2016 09:20 AM, Andrea Bolognani wrote:
The '-usb' option doesn't have any effect for aarch64 mach-virt guests, Do you mean that having -usb on the commandline doesn't result in a usb controller? qemu should also be giving an error then...
That's what it looks like to me. No USB controller is visible from the guest, and running 'info qtree' in the QEMU console doesn't yield anything that looks like a USB controller.
Plus, if you try and add something like
<input type='mouse' bus='usb'/>
QEMU will complain loudly about the lack of a USB host controller and refuse to start the guest.
so the fact that it's currently enabled by default is not really causing any issue. However, that might change in the future (although unlikely), and having it as part of the QEMU command line can cause confusion to someone looking through the process list. Avoid it completely, like it's already happening for q35. I've forgotten if this was intended to solve some problem, or if it's just a side-effect of the fact that a libvirt Q35 config originally didn't add any usb controller by default. Everything around the "add a 'default' usb controller by default if none is specified" has always been so mixed up anyway. It's really too bad we have to keep all that cruft around just for backwards compatibility with something that we decided was a bad idea 5 or 6 years ago) At any rate, again (as with your earlier "eliminate the PCI controllers patch" which I'm reviewing now) you are using qemuDomainMachineIsVirt(), which doesn't check the arch, but only machinetype (and so would match on virt for any other arch). But in this case I think any arch modern enough to have a virt machinetype is also modern enough that we won't want "-usb" (personally I think that any USB controller added to any guest should always have the controller model fully specified, so we really should eliminate any possibility of "-usb" everywhere unless there is some odd arch that has no other way to add a USB controller.
I vehemently agree. The domain XML should be a *faithful* and *complete* representation of the guest hardware - if a certain machine type includes a USB controller that the user can't remove, then the domain XML should include an element representing that controller. If no such element is present, then the guest should have no USB controllers.
Of course it's not as simple as that, because of the compatibility requirements you mentioned above :(
But I plan to rewrite qemuBuildControllerDevCommandLine() so that it enables legacy USB on a /whitelist/ basis instead of a /blacklist/ basis. If I can get it to work, at leas we'll be sure no future machine type will end up enabling legacy USB just because we forgot to esplicitly blacklist it.
ACK from me.
Great, thanks! I'll wait for Drew's thumbs up before actually pushing this, though.
Thumbs up. -usb should probably even be removed from QEMU. The help text says -usb enable the USB driver (will be the default soon) I got tired of trying to hunt down the commit that added the 'default soon' stuff since it's so old... drew
-- Andrea Bolognani Software Engineer - Virtualization Team

On Sat, 2016-06-18 at 10:12 +0200, Andrew Jones wrote:
ACK from me.
Great, thanks! I'll wait for Drew's thumbs up before actually pushing this, though.
Thumbs up.
-usb should probably even be removed from QEMU. The help text says
-usb enable the USB driver (will be the default soon)
I got tired of trying to hunt down the commit that added the 'default soon' stuff since it's so old...
Cool, I just pushed it. Thanks! -- Andrea Bolognani Software Engineer - Virtualization Team
participants (3)
-
Andrea Bolognani
-
Andrew Jones
-
Laine Stump