]> git.ipfire.org Git - thirdparty/qemu.git/commit
s390x/s390-virtio-ccw: don't crash on weird RAM sizes
authorDavid Hildenbrand <david@redhat.com>
Thu, 19 Dec 2024 14:41:02 +0000 (15:41 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 24 Dec 2024 12:31:54 +0000 (15:31 +0300)
commit0c5ce2f91c180d1f9d2c44c9bc7403473bdef0e1
tree194377e40c7a5836adeeb084e04e37d9a6fe6e0b
parentf5ee58666d66e5f4c62c56a48909e46ed66af63d
s390x/s390-virtio-ccw: don't crash on weird RAM sizes

KVM is not happy when starting a VM with weird RAM sizes:

  # qemu-system-s390x --enable-kvm --nographic -m 1234K
  qemu-system-s390x: kvm_set_user_memory_region: KVM_SET_USER_MEMORY_REGION
    failed, slot=0, start=0x0, size=0x244000: Invalid argument
  kvm_set_phys_mem: error registering slot: Invalid argument
  Aborted (core dumped)

Let's handle that in a better way by rejecting such weird RAM sizes
right from the start:

  # qemu-system-s390x --enable-kvm --nographic -m 1234K
  qemu-system-s390x: ram size must be multiples of 1 MiB

Message-ID: <20241219144115.2820241-2-david@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
(cherry picked from commit 14e568ab4836347481af2e334009c385f456a734)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/s390x/s390-virtio-ccw.c