From b430b51395650137a80e78ee7395165b80fe1752 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Mon, 16 Nov 2020 11:59:47 +0100 Subject: util/vfio-helpers.c: Use ram_block_discard_disable() in qemu_vfio_open_pci() Currently, when using "nvme://" for a block device, like -drive file=nvme://0000:01:00.0/1,if=none,id=drive0 \ -device virtio-blk,drive=drive0 \ VFIO may pin all guest memory, and discarding of RAM no longer works as expected. I was able to reproduce this easily with my 01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 Similar to common VFIO, we have to disable it, making sure that: a) virtio-balloon won't discard any memory ("silently disabled") b) virtio-mem and nvme:// run mutually exclusive Cc: Paolo Bonzini Cc: "Michael S. Tsirkin" Cc: Alex Williamson Cc: Wei Yang Cc: Dr. David Alan Gilbert Cc: Igor Mammedov Cc: Pankaj Gupta Cc: Peter Xu Signed-off-by: David Hildenbrand Message-Id: <20201116105947.9194-1-david@redhat.com> Signed-off-by: Paolo Bonzini --- stubs/ram-block.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'stubs') diff --git a/stubs/ram-block.c b/stubs/ram-block.c index 73c0a3ee08..108197683b 100644 --- a/stubs/ram-block.c +++ b/stubs/ram-block.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "exec/ramlist.h" #include "exec/cpu-common.h" +#include "exec/memory.h" void *qemu_ram_get_host_addr(RAMBlock *rb) { @@ -29,3 +30,8 @@ int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque) { return 0; } + +int ram_block_discard_disable(bool state) +{ + return 0; +} -- cgit v1.2.3-55-g7522