diff options
author | Cindy Lu <lulu@redhat.com> | 2020-07-01 22:55:35 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2020-07-03 07:57:04 -0400 |
commit | 7a471694a19d692bd68872d7d256d2086c9c72d4 (patch) | |
tree | 7821724ba7b2c4540235a53b8c460338127741d9 | |
parent | f6c99c3438c09706694f7bf1f3057c36d1bd0c21 (diff) | |
download | qemu-7a471694a19d692bd68872d7d256d2086c9c72d4.zip qemu-7a471694a19d692bd68872d7d256d2086c9c72d4.tar.gz qemu-7a471694a19d692bd68872d7d256d2086c9c72d4.tar.bz2 |
vhost: implement vhost_force_iommu method
use the vhost_force_iommu callback to force enable feature bit VIRTIO_F_IOMMU_PLATFORM
Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20200701145538.22333-12-lulu@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
-rw-r--r-- | hw/virtio/vhost.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1e083a8..1a1384e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -810,6 +810,11 @@ static int vhost_dev_set_features(struct vhost_dev *dev, if (!vhost_dev_has_iommu(dev)) { features &= ~(0x1ULL << VIRTIO_F_IOMMU_PLATFORM); } + if (dev->vhost_ops->vhost_force_iommu) { + if (dev->vhost_ops->vhost_force_iommu(dev) == true) { + features |= 0x1ULL << VIRTIO_F_IOMMU_PLATFORM; + } + } r = dev->vhost_ops->vhost_set_features(dev, features); if (r < 0) { VHOST_OPS_DEBUG("vhost_set_features failed"); |