• Alexander Graf's avatar
    kvm: Fix memory slot page alignment logic · f2a64032
    Alexander Graf authored
    Memory slots have to be page aligned to get entered into KVM. There
    is existing logic that tries to ensure that we pad memory slots that
    are not page aligned to the biggest region that would still fit in the
    alignment requirements.
    Unfortunately, that logic is broken. It tries to calculate the start
    offset based on the region size.
    Fix up the logic to do the thing it was intended to do and document it
    properly in the comment above it.
    With this patch applied, I can successfully run an e500 guest with more
    than 3GB RAM (at which point RAM starts overlapping subpage memory regions).
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarAlexander Graf <agraf@suse.de>