Il 08/07/2014 16:06, Nikolay Nikolaev ha scritto:
@@ -216,6 +216,10 @@ 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;
+            if (!qemu_is_ram_block(reg->guest_phys_addr)) {
+                /* this is non-RAM region - skip it */
+                continue;
+            }
             fd = qemu_get_ram_fd(reg->guest_phys_addr);
             if (fd > 0) {
                 msg.memory.regions[fd_num].userspace_addr = 
reg->userspace_addr;

This is wrong. qemu_get_ram_fd doesn't accept a guest physical address. ram_addr_t are opaque values that are assigned in qemu_ram_alloc.

In fact, RAM regions are filtered by

static bool vhost_section(MemoryRegionSection *section)
{
    return memory_region_is_ram(section->mr);
}


You can 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.

Paolo

Reply via email to