aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Nikolaev <n.nikolaev@virtualopensystems.com>2014-07-12 04:42:35 +0300
committerMichael S. Tsirkin <mst@redhat.com>2014-07-18 02:14:15 +0300
commitf69a28051f856e906bd9c2f9f27b3106a47e18f6 (patch)
treeb6818245d7e770ae59de26ff9e8537117df944f0
parent0e3cd8334aa800b947e2511720a8dcb792f68871 (diff)
downloadqemu-f69a28051f856e906bd9c2f9f27b3106a47e18f6.zip
qemu-f69a28051f856e906bd9c2f9f27b3106a47e18f6.tar.gz
qemu-f69a28051f856e906bd9c2f9f27b3106a47e18f6.tar.bz2
vhost-user: Fix VHOST_SET_MEM_TABLE processing
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> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/virtio/vhost-user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 38e5806..3d23218 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;