[PATCH 0/3] Unbreak MIPS Malta

My day started like this: # virt-install --connect qemu:///system --arch mips --machine malta --memory 256 --disk none --import Using default --name vm-mips Starting install... ERROR XML error: No PCI buses available Needless to say, it ended up completely ruined. Chained to this message are the patches I've created in an attempt to remedy the highly unfortunate situation, with hope that they'll be treated with warmth, understanding and perhaps even applied to the libvirt tree. Yours, Lubo

Identifies all of various MIPS sub-architectures: 32-bit or 64-bit, little-endian or big-endian. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> --- 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) -- 2.34.1

This identifies various MIPS Malta machines, be it 32-bit or 64-bit, little-endian or big-endian. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> --- src/qemu/qemu_domain.c | 21 +++++++++++++++++++++ src/qemu/qemu_domain.h | 1 + 2 files changed, 22 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6b915d7535..0bae9b9202 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8647,6 +8647,20 @@ qemuDomainMachineIsPSeries(const char *machine, } +static bool +qemuDomainMachineIsMipsMalta(const char *machine, + const virArch arch) +{ + if (!ARCH_IS_MIPS(arch)) + return false; + + if (STREQ(machine, "malta")) + return true; + + return false; +} + + /* You should normally avoid this function and use * qemuDomainHasBuiltinIDE() instead. */ bool @@ -8719,6 +8733,13 @@ qemuDomainIsPSeries(const virDomainDef *def) } +bool +qemuDomainIsMipsMalta(const virDomainDef *def) +{ + return qemuDomainMachineIsMipsMalta(def->os.machine, def->os.arch); +} + + bool qemuDomainHasPCIRoot(const virDomainDef *def) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index e5046367e3..78474b3f73 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -770,6 +770,7 @@ bool qemuDomainIsS390CCW(const virDomainDef *def); bool qemuDomainIsARMVirt(const virDomainDef *def); bool qemuDomainIsRISCVVirt(const virDomainDef *def); bool qemuDomainIsPSeries(const virDomainDef *def); +bool qemuDomainIsMipsMalta(const virDomainDef *def); bool qemuDomainHasPCIRoot(const virDomainDef *def); bool qemuDomainHasPCIeRoot(const virDomainDef *def); bool qemuDomainHasBuiltinIDE(const virDomainDef *def); -- 2.34.1

MIPS Malta (and no other supported MIPS machine) has a PCI bus. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> --- 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: -- 2.34.1

On 2/1/22 15:33, Lubomir Rintel wrote:
My day started like this:
# virt-install --connect qemu:///system --arch mips --machine malta --memory 256 --disk none --import Using default --name vm-mips
Starting install... ERROR XML error: No PCI buses available
Needless to say, it ended up completely ruined.
Chained to this message are the patches I've created in an attempt to remedy the highly unfortunate situation, with hope that they'll be treated with warmth, understanding and perhaps even applied to the libvirt tree.
Yours, Lubo
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal

On 2/2/22 4:09 AM, Michal Prívozník wrote:
On 2/1/22 15:33, Lubomir Rintel wrote:
My day started like this:
# virt-install --connect qemu:///system --arch mips --machine malta --memory 256 --disk none --import Using default --name vm-mips
Starting install... ERROR XML error: No PCI buses available
Needless to say, it ended up completely ruined.
Chained to this message are the patches I've created in an attempt to remedy the highly unfortunate situation, with hope that they'll be treated with warmth, understanding and perhaps even applied to the libvirt tree.
Hi Lubo, after these patches was the VM usefully usable, did this simply start up? There is effectively no qemu-system-mips* mips coverage in virt-install or libvirt unit test suites, we should add some if we don't want this to regress. If the XML virt-install generates for you is useful, we could drop it into libvirt's qemuxml2argvtest Thanks, Cole
participants (3)
-
Cole Robinson
-
Lubomir Rintel
-
Michal Prívozník