The PowerNV (Power Non-Virtualized) QEMU ppc64 machine is the emulation of a bare-metal IBM Power host. It follows the OPAL (OpenPower Abstration Layer) API/ABI, most specifically Skiboot [1]. For now, libvirt has support for the pSeries QEMU machine, which is the emulation of a logical partition (guest) that would run on top of a bare-metal system. This patch introduces the helpers that are going to be used to add a basic support for PowerNV domains in libvirt. Given that there are quite a few similarities in how pSeries and PowerNVv should be handled, we're also adding a 'qemuDomainIsPowerPC' helper that will be used in those instances. [1] https://open-power.github.io/skiboot/doc/overview.html Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx> Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/qemu/qemu_domain.c | 36 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index acc76c1cd6..bacde142f8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8759,6 +8759,42 @@ qemuDomainIsPSeries(const virDomainDef *def) } +bool +qemuDomainIsPowerNV(const virDomainDef *def) +{ + if (STRPREFIX(def->os.machine, "powernv")) + return true; + + return false; +} + + +/* + * PowerNV and pSeries domains shares a lot of common traits. This + * helper avoids repeating "if (pseries || powernv)" everywhere this + * is applicable. + */ +bool +qemuDomainIsPowerPC(const virDomainDef *def) +{ + return qemuDomainIsPSeries(def) || qemuDomainIsPowerNV(def); +} + + +/* + * Similar to qemuDomainIsPowerPC(). Usable when the caller doesn't + * have access to a virDomainDef pointer. + */ +bool +qemuDomainMachineIsPowerPC(const char *machine, const virArch arch) +{ + if (STRPREFIX(machine, "powernv")) + return true; + + return qemuDomainMachineIsPSeries(machine, arch); +} + + bool qemuDomainIsMipsMalta(const virDomainDef *def) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index be56b5dbb3..f64608660c 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -764,6 +764,8 @@ bool qemuDomainMachineIsARMVirt(const char *machine, const virArch arch); bool qemuDomainMachineIsPSeries(const char *machine, const virArch arch); +bool qemuDomainMachineIsPowerPC(const char *machine, + const virArch arch); bool qemuDomainMachineHasBuiltinIDE(const char *machine, const virArch arch); @@ -773,6 +775,8 @@ bool qemuDomainIsS390CCW(const virDomainDef *def); bool qemuDomainIsARMVirt(const virDomainDef *def); bool qemuDomainIsRISCVVirt(const virDomainDef *def); bool qemuDomainIsPSeries(const virDomainDef *def); +bool qemuDomainIsPowerNV(const virDomainDef *def); +bool qemuDomainIsPowerPC(const virDomainDef *def); bool qemuDomainIsMipsMalta(const virDomainDef *def); bool qemuDomainHasPCIRoot(const virDomainDef *def); bool qemuDomainHasPCIeRoot(const virDomainDef *def); -- 2.35.1