diff mbox series

[2/2] misc/ivshmem: Mark shared memory regions as no vhost

Message ID 20200828095953.2276-3-wangxinxin.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Wang Xin Aug. 28, 2020, 9:59 a.m. UTC
Since ivshmem_bar2 not normal RAM in Guest, and it shouldn't have
vhost DMAing into them, exclude it from the vhost sections, mark the
shared memory regions as novhost.

Signed-off-by: Wang Xin <wangxinxin.wang@huawei.com>
---
 hw/misc/ivshmem.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 2b6882face..1f3a7a1dfc 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -499,6 +499,7 @@  static void process_msg_shmem(IVShmemState *s, int fd, Error **errp)
     }
 
     s->ivshmem_bar2 = &s->server_bar2;
+    memory_region_set_no_vhost(s->ivshmem_bar2, true);
 }
 
 static void process_msg_disconnect(IVShmemState *s, uint16_t posn,
@@ -855,6 +856,7 @@  static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
 
         s->ivshmem_bar2 = host_memory_backend_get_memory(s->hostmem);
         host_memory_backend_set_mapped(s->hostmem, true);
+        memory_region_set_no_vhost(s->ivshmem_bar2, true);
     } else {
         Chardev *chr = qemu_chr_fe_get_driver(&s->server_chr);
         assert(chr);