[PATCH 02/33] qemu_domain.c: add PowerNV machine helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h |  4 ++++
 2 files changed, 45 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a8401bac30..2accd4f766 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8727,6 +8727,47 @@ qemuDomainIsPSeries(const virDomainDef *def)
 }
 
 
+/*
+ * The PowerNV machine does not support KVM acceleration in Power
+ * hosts. We can skip the usual ARCH_IS_PPC64() since this machine
+ * is usable with TCG in all host archs.
+ */
+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
 qemuDomainHasPCIRoot(const virDomainDef *def)
 {
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index e5046367e3..d07a279a1b 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -761,6 +761,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);
 
@@ -770,6 +772,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 qemuDomainHasPCIRoot(const virDomainDef *def);
 bool qemuDomainHasPCIeRoot(const virDomainDef *def);
 bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux