Only the -eb variants of the realview board support PCI devices, so those are the only ones that should automatically get a USB controller (addDefaultUSB). libvirt will currently add one for the other realview variants too, but that will result in QEMU reporting an error due to lack of PCI support as soon as the domain is started.
Additionally, they should get a PCI controller added automatically (addPCIRoot) too, same as versatilepb. Finally, qemuDomainSupportsPCI() should correctly report the fact that these machine types support PCI. As a consequence of these fixes, the USB controllers now correctly get assigned PCI addresses across the board. Signed-off-by: Andrea Bolognani <abolo...@redhat.com> Reviewed-by: Michal Privoznik <mpriv...@redhat.com> Reviewed-by: Peter Krempa <pkre...@redhat.com> --- src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_postparse.c | 10 ++++------ ...h64-realview-minimal.aarch64-latest.abi-update.args | 2 +- ...ch64-realview-minimal.aarch64-latest.abi-update.xml | 5 ++++- .../aarch64-realview-minimal.aarch64-latest.args | 2 +- .../aarch64-realview-minimal.aarch64-latest.xml | 5 ++++- ...b-controller-automatic-realview.aarch64-latest.args | 2 +- ...sb-controller-automatic-realview.aarch64-latest.xml | 5 ++++- ...r-automatic-unavailable-realview.aarch64-latest.xml | 5 ++++- ...oller-default-fallback-realview.aarch64-latest.args | 2 +- ...roller-default-fallback-realview.aarch64-latest.xml | 5 ++++- ...usb-controller-default-realview.aarch64-latest.args | 2 +- .../usb-controller-default-realview.aarch64-latest.xml | 5 ++++- ...ler-default-unavailable-realview.aarch64-latest.xml | 5 ++++- 14 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e45757ccd5..81a8ca906d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7688,7 +7688,8 @@ qemuDomainSupportsPCI(const virDomainDef *def) * machine types support PCI */ if (ARCH_IS_ARM(def->os.arch)) { if (qemuDomainIsARMVirt(def) || - STREQ(def->os.machine, "versatilepb")) { + STREQ(def->os.machine, "versatilepb") || + STRPREFIX(def->os.machine, "realview-eb")) { return true; } return false; diff --git a/src/qemu/qemu_postparse.c b/src/qemu/qemu_postparse.c index 5f59b79d56..3c481ead5e 100644 --- a/src/qemu/qemu_postparse.c +++ b/src/qemu/qemu_postparse.c @@ -1291,13 +1291,11 @@ qemuDomainDefAddDefaultDevices(virQEMUDriver *driver, case VIR_ARCH_ARMV7L: case VIR_ARCH_ARMV7B: case VIR_ARCH_AARCH64: - if (STREQ(def->os.machine, "versatilepb")) - addPCIRoot = true; - - /* Add default USB for the two machine types which historically - * supported -usb */ + /* Add default PCI and USB for the two machine types which + * historically supported -usb */ if (STREQ(def->os.machine, "versatilepb") || - STRPREFIX(def->os.machine, "realview")) { + STRPREFIX(def->os.machine, "realview-eb")) { + addPCIRoot = true; addDefaultUSB = true; if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args index fc88d9cf6b..0d956241fc 100644 --- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args +++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args @@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device '{"driver":"pci-ohci","id":"usb"}' \ +-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml index b16454b94c..c31c7b2bbc 100644 --- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml +++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0' model='pci-ohci'/> + <controller type='usb' index='0' model='pci-ohci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> </devices> </domain> diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args index fc88d9cf6b..0d956241fc 100644 --- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args +++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args @@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device '{"driver":"pci-ohci","id":"usb"}' \ +-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml index b16454b94c..c31c7b2bbc 100644 --- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0' model='pci-ohci'/> + <controller type='usb' index='0' model='pci-ohci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> </devices> </domain> diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args index fc88d9cf6b..0d956241fc 100644 --- a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args +++ b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args @@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device '{"driver":"pci-ohci","id":"usb"}' \ +-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml index dc32fd50cd..250da1b5e0 100644 --- a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0' model='pci-ohci'/> + <controller type='usb' index='0' model='pci-ohci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> <memballoon model='none'/> </devices> diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml index 9da9abaa88..128a7d420e 100644 --- a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> <memballoon model='none'/> </devices> diff --git a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args index 604c5ec473..ccbff79f35 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args +++ b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args @@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device '{"driver":"qemu-xhci","id":"usb"}' \ +-device '{"driver":"qemu-xhci","id":"usb","bus":"pci","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml index f61322ddb5..8bb25de20a 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0' model='qemu-xhci'/> + <controller type='usb' index='0' model='qemu-xhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> <memballoon model='none'/> </devices> diff --git a/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.args index 604c5ec473..ccbff79f35 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.args +++ b/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.args @@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device '{"driver":"qemu-xhci","id":"usb"}' \ +-device '{"driver":"qemu-xhci","id":"usb","bus":"pci","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.xml index f61322ddb5..8bb25de20a 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/usb-controller-default-realview.aarch64-latest.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0' model='qemu-xhci'/> + <controller type='usb' index='0' model='qemu-xhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> <memballoon model='none'/> </devices> diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml index 9da9abaa88..128a7d420e 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml @@ -15,7 +15,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> <audio id='1' type='none'/> <memballoon model='none'/> </devices> -- 2.51.0