Until now, we were aligning just ppc64 NVDIMM modules in post parse
time. Let's extend the treatment to all ppc64 memory models. This
is possible because the alignment restrictions for the architecture
are imposed by the platform specification, being hypervisor-agnostic.
This will remove the need for mem module alignment for pSeries in
the QEMU driver, simplifying the code a bit.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/conf/domain_conf.c | 1 -
src/qemu/qemu_domain.c | 13 +++----------
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c98e760aa2..e4aecc9a4d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5360,7 +5360,6 @@ virDomainMemoryDefPostParse(virDomainMemoryDefPtr mem,
* will have the same restriction.
*/
if (ARCH_IS_PPC64(def->os.arch) &&
- mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
virDomainMemoryDeviceAlignSizePseries(mem) < 0)
return -1;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5a17887fa1..33a5765c57 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8087,11 +8087,8 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def)
* calculation because virDomainDefGetMemoryInitial() uses the size
* of the modules in the math. */
for (i = 0; i < def->nmems; i++) {
- if (def->mems[i]->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
- ARCH_IS_PPC64(def->os.arch)) {
- if (virDomainMemoryDeviceAlignSizePseries(def->mems[i]) < 0)
- return -1;
- } else {
+ /* ppc64 memory modules are aligned by virDomainMemoryDefPostParse(). */
+ if (!ARCH_IS_PPC64(def->os.arch)) {
align = qemuDomainGetMemoryModuleSizeAlignment(def, def->mems[i]);
def->mems[i]->size = VIR_ROUND_UP(def->mems[i]->size, align);
}
@@ -8144,13 +8141,9 @@ int
qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
virDomainMemoryDefPtr mem)
{
- if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
- ARCH_IS_PPC64(def->os.arch)) {
- return virDomainMemoryDeviceAlignSizePseries(mem);
- } else {
+ if (!ARCH_IS_PPC64(def->os.arch))
mem->size = VIR_ROUND_UP(mem->size,
qemuDomainGetMemorySizeAlignment(def));
- }
return 0;
}
--
2.26.2