Skip to content

Commit 7a47169

Browse files
lulu-github-namemstsirkin
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent f6c99c3 commit 7a47169

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hw/virtio/vhost.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,11 @@ static int vhost_dev_set_features(struct vhost_dev *dev,
810810
if (!vhost_dev_has_iommu(dev)) {
811811
features &= ~(0x1ULL << VIRTIO_F_IOMMU_PLATFORM);
812812
}
813+
if (dev->vhost_ops->vhost_force_iommu) {
814+
if (dev->vhost_ops->vhost_force_iommu(dev) == true) {
815+
features |= 0x1ULL << VIRTIO_F_IOMMU_PLATFORM;
816+
}
817+
}
813818
r = dev->vhost_ops->vhost_set_features(dev, features);
814819
if (r < 0) {
815820
VHOST_OPS_DEBUG("vhost_set_features failed");

0 commit comments

Comments
 (0)