guest: Enable USB for RISC-V virt guests

Unlike other features we have enabled earlier, this one requires
version checks because RISC-V guests have only started using PCI
by default very recently, and we can't have USB without PCI.

More specifically, we need QEMU commit d6c1bd4a2237 (included
in 4.0.0) and libvirt commit 7c48fb08e0cd (included in 5.3.0).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-04-04 12:49:49 +02:00 committed by Cole Robinson
parent 1e3de807a6
commit 9bec57723e
5 changed files with 13 additions and 2 deletions

View File

@ -21,6 +21,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>

View File

@ -21,6 +21,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>

View File

@ -812,7 +812,7 @@ c.add_compare("--connect %(URI-KVM-AARCH64)s --disk size=1 --os-variant fedora22
c = vinst.add_category("kvm-headless", "--os-variant fedora29 --import --disk %(EXISTIMG1)s --network default --graphics none")
c.add_compare("--connect %(URI-KVM-AARCH64)s --arch aarch64", "aarch64-headless")
c.add_compare("--connect %(URI-KVM-PPC64LE)s --arch ppc64le", "ppc64-headless")
c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-headless")
c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-headless", check_version="5.3.0")
c.add_compare("--connect %(URI-KVM-S390X)s --arch s390x", "s390x-headless")
c.add_compare("--connect %(URI-KVM)s --arch x86_64", "x86_64-headless")
@ -821,7 +821,7 @@ c.add_compare("--connect %(URI-KVM)s --arch x86_64", "x86_64-headless")
c = vinst.add_category("kvm-graphics", "--os-variant fedora29 --import --disk %(EXISTIMG1)s --network default --graphics vnc")
c.add_compare("--connect %(URI-KVM-AARCH64)s --arch aarch64", "aarch64-graphics")
c.add_compare("--connect %(URI-KVM-PPC64LE)s --arch ppc64le", "ppc64-graphics")
c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-graphics")
c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-graphics", check_version="5.3.0")
c.add_compare("--connect %(URI-KVM-S390X)s --arch s390x", "s390x-graphics")
c.add_compare("--connect %(URI-KVM)s --arch x86_64", "x86_64-graphics")

View File

@ -784,6 +784,14 @@ class Guest(XMLBuilder):
self.conn.check_support(
self.conn.SUPPORT_CONN_MACHVIRT_PCI_DEFAULT)):
usb3 = True
elif self.os.is_riscv_virt():
# For RISC-V we can assume the guest OS supports USB3, but we
# have to make sure libvirt and QEMU are new enough to be using
# PCI by default
if (qemu_usb3 and
self.conn.check_support(
self.conn.SUPPORT_CONN_RISCV_VIRT_PCI_DEFAULT)):
usb3 = True
elif self.os.is_pseries():
# For pseries, we always assume OS supports usb3
if qemu_usb3:

View File

@ -265,6 +265,7 @@ SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _make(version="3.0.0")
SUPPORT_CONN_QEMU_XHCI = _make(version="3.3.0", hv_version={"qemu": "2.9.0"})
SUPPORT_CONN_VNC_NONE_AUTH = _make(hv_version={"qemu": "2.9.0"})
SUPPORT_CONN_DEVICE_BOOT_ORDER = _make(hv_version={"qemu": 0, "test": 0})
SUPPORT_CONN_RISCV_VIRT_PCI_DEFAULT = _make(version="5.3.0", hv_version={"qemu": "4.0.0"})
# We choose qemu 2.11.0 as the first version to target for q35 default.
# That's not really based on anything except reasonably modern at the