[libvirt] [PATCH 0/2] Get rid of default USB controller on S390

QEMU for S390 has presently no USB controllers nor a PCI bus. Both are created by the default in the libvirt domain definition. Although this can be suppressed by explicitly specifying an USB controller with model='none', it's a real bad default. With Jan's recent patch we can reliably suppress the USB controller (including it's bogus PCI address) if the source XML has no usb controller element. Explicitly set addresses are still honored. Viktor Mihajlovski (2): S390: Mention changed USB behavior S390: Do not generate a default USB controller docs/formatdomain.html.in | 5 +++-- src/qemu/qemu_domain.c | 8 ++++++++ .../qemuxml2argv-console-sclp.args | 2 +- .../qemuxml2argv-console-virtio-ccw.args | 2 +- .../qemuxml2argv-console-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-ccw-many.args | 2 +- .../qemuxml2argv-disk-virtio-ccw.args | 2 +- .../qemuxml2argv-disk-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-scsi-ccw.args | 2 +- .../qemuxml2argv-net-virtio-ccw.args | 2 +- .../qemuxml2argv-net-virtio-s390.args | 2 +- .../qemuxml2argv-virtio-rng-ccw.args | 2 +- 12 files changed, 21 insertions(+), 12 deletions(-) -- 1.7.9.5

Add a line saying that no USB controllers are generated by default on s390. --- docs/formatdomain.html.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f325c3c..8870e46 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2141,8 +2141,9 @@ "pci-ohci" or "nec-xhci". 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. The PowerPC64 "spapr-vio" addresses do not have an associated - controller. + used. <span class="since">Since 1.0.5</span>, no default USB controller + will be built on s390. The PowerPC64 "spapr-vio" addresses do not have an + associated controller. </p> <p> -- 1.7.9.5

For s390 we don't want to have a default USB device generated even if QEMU is silently tolerating -usb on the command line. This may change in the future. Another reason to avoid the USB controller is that it implies a PCI bus which might cause a regression at some later point in time. The following change will set the USB controller model to 'none' unless a model or address has been specified, which can be the case if a legacy definition is loaded or the XML writer knows what she/he's doing. Requiring the user to explicitly disable USB on systems not supporting it seems cumbersome. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_domain.c | 8 ++++++++ .../qemuxml2argv-console-sclp.args | 2 +- .../qemuxml2argv-console-virtio-ccw.args | 2 +- .../qemuxml2argv-console-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-ccw-many.args | 2 +- .../qemuxml2argv-disk-virtio-ccw.args | 2 +- .../qemuxml2argv-disk-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-scsi-ccw.args | 2 +- .../qemuxml2argv-net-virtio-ccw.args | 2 +- .../qemuxml2argv-net-virtio-s390.args | 2 +- .../qemuxml2argv-virtio-rng-ccw.args | 2 +- 11 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d927716..62c3382 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -784,6 +784,14 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X)) dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; + /* set the default USB model to none for s390 unless an address is found */ + if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER && + dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + dev->data.controller->model == -1 && + dev->data.controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X)) + dev->data.controller->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE; + ret = 0; cleanup: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args b/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args index 7dc1c49..86bd82d 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args @@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 -device \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 -device \ virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 \ -chardev pty,id=charconsole0 \ -device sclpconsole,chardev=charconsole0,id=console0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args index 6660a30..3e6f9f1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args @@ -3,7 +3,7 @@ s390-ccw -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi \ -device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0001 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -chardev pty,id=charconsole0 \ -device virtconsole,chardev=charconsole0,id=console0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args index bf7b180..7b7f8f3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args @@ -3,7 +3,7 @@ s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi \ -device virtio-serial-s390,id=virtio-serial0 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -chardev pty,id=charconsole0 \ -device virtconsole,chardev=charconsole0,id=console0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args index ca0c157..92fa433 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args @@ -1,7 +1,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=0.0.0007,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest4,if=none,id=drive-virtio-disk1 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk1,id=virtio-disk1 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args index ec901bb..a682bb3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args @@ -1,7 +1,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-virtio-disk1 \ -device virtio-blk-ccw,devno=0.0.0007,drive=drive-virtio-disk1,id=virtio-disk1 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args index 2ac1810..725f4a5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args @@ -1,5 +1,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ --monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args index 1b2603e..9ef68de 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args @@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -device virtio-scsi-ccw,id=scsi0,devno=fe.0.0001 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-scsi0-0-4-0 \ -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,drive=drive-scsi0-0-4-0,id=scsi0-0-4-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args index f874afe..4a98280 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args @@ -1,7 +1,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ --usb -device virtio-net-ccw,vlan=0,id=net0,mac=00:11:22:33:44:55,devno=fe.0.0001 \ +-device virtio-net-ccw,vlan=0,id=net0,mac=00:11:22:33:44:55,devno=fe.0.0001 \ -net user,vlan=0,name=hostnet0 \ -device virtio-net-ccw,vlan=1,id=net1,mac=00:11:22:33:44:54,devno=fe.0.0000 \ -net user,vlan=1,name=hostnet1 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args index a69596d..59c53e6 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args @@ -1,5 +1,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ --monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -device virtio-net-s390,vlan=0,id=net0,mac=00:11:22:33:44:55 \ -net user,vlan=0,name=hostnet0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args index 5f9cef5..bf88b2c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args @@ -3,7 +3,7 @@ s390-ccw -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi \ -device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0001 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -chardev pty,id=charconsole0 \ -device virtconsole,chardev=charconsole0,id=console0 \ -- 1.7.9.5

On 04/29/2013 10:11 AM, Viktor Mihajlovski wrote:
QEMU for S390 has presently no USB controllers nor a PCI bus. Both are created by the default in the libvirt domain definition. Although this can be suppressed by explicitly specifying an USB controller with model='none', it's a real bad default.
With Jan's recent patch we can reliably suppress the USB controller (including it's bogus PCI address) if the source XML has no usb controller element. Explicitly set addresses are still honored.
The change in defaults only affects S390, so I think it is low enough risk to apply even after freeze. Changing any default interpretation of XML is risky, but in the case of S390, overall libvirt support is relatively new, so getting it right as soon as possible still makes sense, rather than burdening ourselves with bad defaults forever. Series ACK and will push soon.
Viktor Mihajlovski (2): S390: Mention changed USB behavior S390: Do not generate a default USB controller
docs/formatdomain.html.in | 5 +++-- src/qemu/qemu_domain.c | 8 ++++++++ .../qemuxml2argv-console-sclp.args | 2 +- .../qemuxml2argv-console-virtio-ccw.args | 2 +- .../qemuxml2argv-console-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-ccw-many.args | 2 +- .../qemuxml2argv-disk-virtio-ccw.args | 2 +- .../qemuxml2argv-disk-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-scsi-ccw.args | 2 +- .../qemuxml2argv-net-virtio-ccw.args | 2 +- .../qemuxml2argv-net-virtio-s390.args | 2 +- .../qemuxml2argv-virtio-rng-ccw.args | 2 +- 12 files changed, 21 insertions(+), 12 deletions(-)
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Viktor Mihajlovski