@@ -88,6 +88,10 @@ struct vhost_dev {
bool log_enabled;
bool shadow_vqs_enabled;
uint64_t log_size;
+ struct {
+ hwaddr first;
+ hwaddr last;
+ } iova_range;
VhostShadowVirtqueue **shadow_vqs;
Error *migration_blocker;
const VhostOps *vhost_ops;
@@ -129,6 +133,7 @@ uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
uint64_t features);
bool vhost_has_free_slot(void);
+bool vhost_has_limited_iova_range(const struct vhost_dev *hdev);
int vhost_net_set_backend(struct vhost_dev *hdev,
struct vhost_vring_file *file);
@@ -1386,6 +1386,18 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
goto fail;
}
+ if (hdev->vhost_ops->vhost_get_iova_range) {
+ r = hdev->vhost_ops->vhost_get_iova_range(hdev,
+ &hdev->iova_range.first,
+ &hdev->iova_range.last);
+ if (unlikely(r != 0)) {
+ error_report("Can't request IOVA range");
+ goto fail;
+ }
+ } else {
+ hdev->iova_range.last = (hwaddr)-1;
+ }
+
for (i = 0; i < hdev->nvqs; ++i, ++n_initialized_vqs) {
r = vhost_virtqueue_init(hdev, hdev->vqs + i, hdev->vq_index + i);
if (r < 0) {
@@ -1622,6 +1634,11 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
}
}
+bool vhost_has_limited_iova_range(const struct vhost_dev *hdev)
+{
+ return hdev->iova_range.first || hdev->iova_range.last != HWADDR_MAX;
+}
+
uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
uint64_t features)
{
Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com> --- include/hw/virtio/vhost.h | 5 +++++ hw/virtio/vhost.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+)