qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wang Xin <wangxinxin.wang@huawei.com>
To: <qemu-devel@nongnu.org>
Cc: Wang Xin <wangxinxin.wang@huawei.com>,
	jianjay.zhou@huawei.com, weidong.huang@huawei.com,
	dgilbert@redhat.com, mst@redhat.com
Subject: [PATCH 2/2] misc/ivshmem: Mark shared memory regions as no vhost
Date: Fri, 28 Aug 2020 17:59:53 +0800	[thread overview]
Message-ID: <20200828095953.2276-3-wangxinxin.wang@huawei.com> (raw)
In-Reply-To: <20200828095953.2276-1-wangxinxin.wang@huawei.com>

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 --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);
-- 
2.26.0.windows.1




  parent reply	other threads:[~2020-08-28 10:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28  9:59 [PATCH 0/2][RFC] exclude ivshmem mr from vhost sections Wang Xin
2020-08-28  9:59 ` [PATCH 1/2] memory: Allow a MemoryRegion to be marked no_vhost Wang Xin
2020-08-28  9:59 ` Wang Xin [this message]
2020-09-04  4:36 ` [PATCH 0/2][RFC] exclude ivshmem mr from vhost sections Wangxin (Alexander)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200828095953.2276-3-wangxinxin.wang@huawei.com \
    --to=wangxinxin.wang@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weidong.huang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).