[PATCH v1 04/10] qemu_domain.c: simplify qemuDomainGetMemoryModuleSizeAlignment()

Daniel Henrique Barboza danielhb413 at gmail.com
Wed Nov 11 22:07:19 UTC 2020


The function is no longer used for ppc64 alignment. This allow us
to exclude the 'def' argument and simplify its usage. Let's also
make it clearer in the comment that the function is now returning
x86 specific values.

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/qemu/qemu_domain.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 33a5765c57..e40c122311 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8043,16 +8043,10 @@ qemuDomainGetMemorySizeAlignment(const virDomainDef *def)
 
 
 static unsigned long long
-qemuDomainGetMemoryModuleSizeAlignment(const virDomainDef *def,
-                                       const virDomainMemoryDef *mem G_GNUC_UNUSED)
+qemuDomainGetMemoryModuleSizeAlignment(void)
 {
-    /* PPC requires the memory sizes to be rounded to 256MiB increments, so
-     * round them to the size always. */
-    if (ARCH_IS_PPC64(def->os.arch))
-        return 256 * 1024;
-
-    /* dimm memory modules require 2MiB alignment rather than the 1MiB we are
-     * using elsewhere. */
+    /* For x86, dimm memory modules require 2MiB alignment rather than
+     * the 1MiB we are using elsewhere. */
     return 2048;
 }
 
@@ -8089,7 +8083,7 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def)
     for (i = 0; i < def->nmems; i++) {
         /* ppc64 memory modules are aligned by virDomainMemoryDefPostParse(). */
         if (!ARCH_IS_PPC64(def->os.arch)) {
-            align = qemuDomainGetMemoryModuleSizeAlignment(def, def->mems[i]);
+            align = qemuDomainGetMemoryModuleSizeAlignment();
             def->mems[i]->size = VIR_ROUND_UP(def->mems[i]->size, align);
         }
 
-- 
2.26.2




More information about the libvir-list mailing list