]> git.ipfire.org Git - thirdparty/qemu.git/commit
vhost: adapt vhost_verify_ring_mappings() to virtio 1 ring layout
authorGreg Kurz <groug@kaod.org>
Fri, 4 Nov 2016 08:39:15 +0000 (09:39 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 8 Dec 2016 19:53:11 +0000 (13:53 -0600)
commit92230a5963d308f1ce0ba222bfb3a921f59e1446
tree8e2f71bab23162ab40810e161d64c5cbca8159a5
parent48b3aa20ae7246500920c6c2c896efb45217fa08
vhost: adapt vhost_verify_ring_mappings() to virtio 1 ring layout

With virtio 1, the vring layout is split in 3 separate regions of
contiguous memory for the descriptor table, the available ring and the
used ring, as opposed with legacy virtio which uses a single region.

In case of memory re-mapping, the code ensures it doesn't affect the
vring mapping. This is done in vhost_verify_ring_mappings() which assumes
the device is legacy.

This patch changes vhost_verify_ring_mappings() to check the mappings of
each part of the vring separately.

This works for legacy mappings as well.

Cc: qemu-stable@nongnu.org
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit f1f9e6c5961ffb36fd4a81cd7edcded7bfad2ab2)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/vhost.c
include/hw/virtio/vhost.h