Bug 1432101

Summary: Cannot create MIPS guest - 'XML error: No PCI buses available'
Product: [Community] Virtualization Tools Reporter: Ian Pilcher <ipilcher>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: andreas, hhan, jrace, libvirt-maint, smooney
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ian Pilcher 2017-03-14 14:17:04 UTC
Trying to create a MIPS guest via virt-manager and getting this error:

Unable to complete install: 'XML error: No PCI buses available'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 88, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 2288, in _do_async_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 461, in start_install
    doboot, transient)
  File "/usr/share/virt-manager/virtinst/guest.py", line 396, in _create_guest
    self.domain = self.conn.createXML(install_xml or final_xml, 0)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3782, in createXML
    if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirtError: XML error: No PCI buses available

Some discussion of this issue took place a while ago.

  https://www.redhat.com/archives/libvir-list/2016-May/msg00197.html

Comment 1 Han Han 2020-11-19 02:08:04 UTC
Hello Iran, could you reproduce it again?

Comment 2 chateaulav 2021-10-18 13:28:19 UTC
Issue still present when attempting to create MIPS guest via virt-manager, and adding additional environments with same issue (virt-install and openstack nova leveraging libvirt). Attempts were made across multiple paths still receiving same error message 'XML error: No PCI buses available' when trying to define a VM using mips64el architecture.

System Information:

Description: Ubuntu Focal Fossa
Release: 20.04.3 LTS
Linux version 5.4.0-88-generic (buildd@lgw01-amd64-008) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #99-Ubuntu SMP Thu Sep 23 17:29:00 UTC 2021 (Ubuntu 5.4.0-88.99-generic 5.4.140)

Binary Information:

/usr/sbin/libvirtd
libvirtd (libvirt) 6.0.0

XML and Trace Errors:

- virt-install attempt
### https://pastebin.com/nuPPieaw
Error Message: ERROR XML error: No PCI buses available

- virt-manager attempt
### https://pastebin.com/camUditW
Error Message: libvirt.libvirtError: XML error: No PCI buses available

- openstack attempt
### https://pastebin.com/3Tsj7Cxz
### https://pastebin.com/6VunTvpy
Error Message: libvirt.libvirtError: XML error: No PCI buses available

reference for original patch details: https://listman.redhat.com/archives/libvir-list/2016-May/msg00197.html
reference for original ubuntu bug details: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1561497

Comment 5 smooney 2022-02-01 17:05:40 UTC
i am not familar with the mips emulation but just in case its useful I suspect this is related to the machine type 
https://www.qemu.org/docs/master/system/target-mips.html
the default one i don't think support PCI devices so malta? might be required.

the Loongson-3 virtual platform might also be work trying
https://www.phoronix.com/scan.php?page=news_item&px=Loongson3-Linux-5.8-KVM-Virt
it sound like it a realitive recent platform.

https://listman.redhat.com/archives/libvir-list/2016-May/msg00197.html
which you reference before was related to the malta machine type.
so it seam to confirm it has a root PCIe controller so that is probably the best place to start.

Comment 6 chateaulav 2022-02-23 14:24:57 UTC
All associated mailing lists relating to this bug:

https://listman.redhat.com/archives/libvir-list/2016-May/msg00197.html
- associated code:

Signed-off-by: Aurelien Jarno <aurelien aurel32 net>
---
 src/qemu/qemu_domain.c | 15 ++++++++++++++-
 src/qemu/qemu_domain.h |  1 +
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 173f82c..75b0545 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 173f82c..75b0545 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1763,6 +1763,14 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
             addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX);
         break;
 
+    case VIR_ARCH_MIPS:
+    case VIR_ARCH_MIPSEL:
+    case VIR_ARCH_MIPS64:
+    case VIR_ARCH_MIPS64EL:
+        if (qemuDomainMachineIsMalta(def))
+            addPCIRoot = true;
+        break;
+
     case VIR_ARCH_PPC64:
     case VIR_ARCH_PPC64LE:
         addPCIRoot = true;
@@ -4654,6 +4662,11 @@ qemuDomainMachineIsVirt(const virDomainDef *def)
            STRPREFIX(def->os.machine, "virt-");
 }
 
+bool
+qemuDomainMachineIsMalta(const virDomainDef *def)
+{
+    return STRPREFIX(def->os.machine, "malta");
+}
 
 static bool
 qemuCheckMemoryDimmConflict(const virDomainDef *def,
@@ -4830,7 +4843,7 @@ bool
 qemuDomainMachineHasBuiltinIDE(const virDomainDef *def)
 {
     return qemuDomainMachineIsI440FX(def) ||
-        STREQ(def->os.machine, "malta") ||
+        qemuDomainMachineIsMalta(def) ||
         STREQ(def->os.machine, "sun4u") ||
         STREQ(def->os.machine, "g3beige");
 }
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 95f821c..adba5fa 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -585,6 +585,7 @@ bool qemuDomainMachineIsI440FX(const virDomainDef *def);
 bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
 bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
 bool qemuDomainMachineIsVirt(const virDomainDef *def);
+bool qemuDomainMachineIsMalta(const virDomainDef *def);
 bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
 
 int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
-- 



https://www.spinics.net/linux/fedora/libvir/msg227695.html
- references general libvirt pci bus error

https://www.spinics.net/linux/fedora/libvir/msg227696.html
- associated code:

Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
---
 src/util/virarch.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/util/virarch.h b/src/util/virarch.h
index 528f84f8a5..81b1b27a57 100644
--- a/src/util/virarch.h
+++ b/src/util/virarch.h
@@ -95,6 +95,11 @@ typedef enum {
 #define ARCH_IS_S390(arch) ((arch) == VIR_ARCH_S390 ||\
                             (arch) == VIR_ARCH_S390X)
 
+#define ARCH_IS_MIPS(arch) ((arch) == VIR_ARCH_MIPS ||\
+                            (arch) == VIR_ARCH_MIPSEL ||\
+                            (arch) == VIR_ARCH_MIPS64 ||\
+                            (arch) == VIR_ARCH_MIPS64EL)
+
 #define ARCH_IS_MIPS64(arch) ((arch) == VIR_ARCH_MIPS64 ||\
                               (arch) == VIR_ARCH_MIPS64EL)
 
-- 

https://www.spinics.net/linux/fedora/libvir/msg227697.html
- associated code:

Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
---
 src/qemu/qemu_domain.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0bae9b9202..b7aad65048 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3703,6 +3703,14 @@ qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
         addPCIRoot = true;
         break;
 
+    case VIR_ARCH_MIPS:
+    case VIR_ARCH_MIPSEL:
+    case VIR_ARCH_MIPS64:
+    case VIR_ARCH_MIPS64EL:
+        if (qemuDomainIsMipsMalta(def))
+            addPCIRoot = true;
+        break;
+
     case VIR_ARCH_ARMV7B:
     case VIR_ARCH_CRIS:
     case VIR_ARCH_ITANIUM:
@@ -3710,10 +3718,6 @@ qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
     case VIR_ARCH_M68K:
     case VIR_ARCH_MICROBLAZE:
     case VIR_ARCH_MICROBLAZEEL:
-    case VIR_ARCH_MIPS:
-    case VIR_ARCH_MIPSEL:
-    case VIR_ARCH_MIPS64:
-    case VIR_ARCH_MIPS64EL:
     case VIR_ARCH_OR32:
     case VIR_ARCH_PARISC:
     case VIR_ARCH_PARISC64:
--