]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Simplify size check for ppc64 NVDIMMs
authorAndrea Bolognani <abologna@redhat.com>
Wed, 2 Dec 2020 18:08:45 +0000 (19:08 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 9 Dec 2020 10:51:50 +0000 (11:51 +0100)
We already calculated the guest area, which is what is subject
to minimum size requirements, a few lines earlier.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_domain.c

index d6fded9dd1b2d929b3e55d541afb61eded7f83e5..6781fb6cf0e25cd83f5342306fd50d4e32907556 100644 (file)
@@ -5360,10 +5360,9 @@ qemuDomainNVDimmAlignSizePseries(virDomainMemoryDefPtr mem)
     unsigned long long ppc64AlignSize =  256 * 1024;
     unsigned long long guestArea = mem->size - mem->labelsize;
 
-    /* Align down guest_area. 256MiB is the minimum size. Error
-     * out if target_size is smaller than 256MiB + label_size,
-     * since aligning it up will cause QEMU errors. */
-    if (mem->size < (ppc64AlignSize + mem->labelsize)) {
+    /* Align down guestArea. We can't align down if guestArea is
+     * smaller than the 256MiB alignment. */
+    if (guestArea < ppc64AlignSize) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("minimum target size for the NVDIMM "
                          "must be 256MB plus the label size"));