s390x/kvm: indicate alignment in legacy_s390_alloc()
authorDavid Hildenbrand <david@redhat.com>
Thu, 28 Jun 2018 11:38:17 +0000 (13:38 +0200)
committerCornelia Huck <cohuck@redhat.com>
Mon, 2 Jul 2018 08:37:38 +0000 (10:37 +0200)
Let's do this for completeness reason, although we don't support e.g.
PCDIMM/NVDIMM, which would use the alignment for placing the memory
region in guest physical memory. But maybe someday we would want to
support something like this - then we don't forget about this if
allowing multiple allocations in legacy_s390_alloc().

Use the same alignment as we would set in qemu_anon_ram_alloc(). Our
fixed address satisfies this alignment (1MB). This implicitly sets the
alignment of the underlying memory region.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180628113817.30814-3-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
target/s390x/kvm.c

index a9d6d606df5ec7e5e0991ce8a5f535a2d432a78d..d923cf4240a92e6ba6f9096844da1ec2f5da9bcf 100644 (file)
@@ -765,6 +765,9 @@ static void *legacy_s390_alloc(size_t size, uint64_t *align, bool shared)
     if (mem == MAP_FAILED) {
         mem = NULL;
     }
+    if (mem && align) {
+        *align = QEMU_VMALLOC_ALIGN;
+    }
     return mem;
 }