From: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
To: snabb-devel@googlegroups.com, qemu-devel@nongnu.org, mst@redhat.com
Cc: tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com
Subject: [Qemu-devel] [PATCH v2 1/2 for-2.1] vhost-user: Fix VHOST_SET_MEM_TABLE processing
Date: Sat, 12 Jul 2014 04:42:35 +0300 [thread overview]
Message-ID: <20140712014215.10636.60876.stgit@3820> (raw)
In-Reply-To: <20140712014119.10636.81503.stgit@3820>
qemu_get_ram_fd doesn't accept a guest physical address. ram_addr_t are
opaque values that are assigned in qemu_ram_alloc.
Find the ram_addr_t corresponding to the userspace_addr using qemu_ram_addr_from_host,
and then call qemu_get_ram_fd on it.
Thanks to Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
hw/virtio/vhost-user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 38e5806..d610aa4 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -216,7 +216,9 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
case VHOST_SET_MEM_TABLE:
for (i = 0; i < dev->mem->nregions; ++i) {
struct vhost_memory_region *reg = dev->mem->regions + i;
- fd = qemu_get_ram_fd(reg->guest_phys_addr);
+ ram_addr_t ram_addr;
+ qemu_ram_addr_from_host((void*)reg->userspace_addr, &ram_addr);
+ fd = qemu_get_ram_fd(ram_addr);
if (fd > 0) {
msg.memory.regions[fd_num].userspace_addr = reg->userspace_addr;
msg.memory.regions[fd_num].memory_size = reg->memory_size;
next prev parent reply other threads:[~2014-07-12 1:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-12 1:42 [Qemu-devel] [PATCH v2 0/2 for-2.1] vhost-user fixes Nikolay Nikolaev
2014-07-12 1:42 ` Nikolay Nikolaev [this message]
2014-07-12 5:07 ` [Qemu-devel] [PATCH v2 1/2 for-2.1] vhost-user: Fix VHOST_SET_MEM_TABLE processing Paolo Bonzini
2014-07-12 9:04 ` Nikolay Nikolaev
2014-07-12 1:43 ` [Qemu-devel] [PATCH v2 2/2 for-2.1] qtest: Adapt vhost-user-test to latehs vhost-user changes Nikolay Nikolaev
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=20140712014215.10636.60876.stgit@3820 \
--to=n.nikolaev@virtualopensystems.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=snabb-devel@googlegroups.com \
--cc=tech@virtualopensystems.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).