vhost: switch to use IOTLB v2 format
commitb37556edec8372bef83959901fc142a272a7e1fa
authorJason Wang <jasowang@redhat.com>
Mon, 7 Sep 2020 10:49:02 +0000 (7 18:49 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 29 Sep 2020 06:14:29 +0000 (29 02:14 -0400)
treefe0fc6c5fccfeff5a2ede0bcc43f35cf2412f9ea
parente6546342a830e520d14ef03aa95677611de0d90c
vhost: switch to use IOTLB v2 format

This patch tries to switch to use new kernel IOTLB format V2. Previous
version may have inconsistent ABI between 32bit and 64bit machines
because of the hole after type field. Refer kernel commit
("429711aec282 vhost: switch to use new message format") for more
information.

To enable this feature, qemu need to use a new ioctl
VHOST_SET_BACKEND_FEATURE with VHOST_BACKEND_F_IOTLB_MSG_V2 bit. A new
vhost setting backend features ops was introduced. And when we try to
set features for vhost dev, we will examine the support of new IOTLB
format and enable it. This process is total transparent to guest,
which means we can have different IOTLB message type in src and dst
during migration.

The conversion of IOTLB message is straightforward, just check the
type and behave accordingly.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20200907104903.31551-3-jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost-backend.c
hw/virtio/vhost.c
include/hw/virtio/vhost-backend.h
include/hw/virtio/vhost.h