We implement the RamDiscardMgr interface and only require coordinated discarding of RAM to work.
Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com> Reviewed-by: Pankaj Gupta <pankaj.gu...@cloud.ionos.com> Acked-by: Michael S. Tsirkin <m...@redhat.com> Reviewed-by: Michael S. Tsirkin <m...@redhat.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: "Michael S. Tsirkin" <m...@redhat.com> Cc: Alex Williamson <alex.william...@redhat.com> Cc: Dr. David Alan Gilbert <dgilb...@redhat.com> Cc: Igor Mammedov <imamm...@redhat.com> Cc: Pankaj Gupta <pankaj.gupta.li...@gmail.com> Cc: Peter Xu <pet...@redhat.com> Cc: Auger Eric <eric.au...@redhat.com> Cc: Wei Yang <richard.weiy...@linux.alibaba.com> Cc: teawater <teawat...@linux.alibaba.com> Cc: Marek Kedzierski <mkedz...@redhat.com> Signed-off-by: David Hildenbrand <da...@redhat.com> --- hw/virtio/virtio-mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 194fb56a9a..9c36e7f96d 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -676,7 +676,7 @@ static void virtio_mem_device_realize(DeviceState *dev, Error **errp) return; } - if (ram_block_discard_require(true)) { + if (ram_block_coordinated_discard_require(true)) { error_setg(errp, "Discarding RAM is disabled"); return; } @@ -684,7 +684,7 @@ static void virtio_mem_device_realize(DeviceState *dev, Error **errp) ret = ram_block_discard_range(rb, 0, qemu_ram_get_used_length(rb)); if (ret) { error_setg_errno(errp, -ret, "Unexpected error discarding RAM"); - ram_block_discard_require(false); + ram_block_coordinated_discard_require(false); return; } @@ -727,7 +727,7 @@ static void virtio_mem_device_unrealize(DeviceState *dev) virtio_del_queue(vdev, 0); virtio_cleanup(vdev); g_free(vmem->bitmap); - ram_block_discard_require(false); + ram_block_coordinated_discard_require(false); } static int virtio_mem_discard_range_cb(const VirtIOMEM *vmem, void *arg, -- 2.29.2