From 2ce68e4cf5be9b5176a3c3c372948d6340724d2d Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Tue, 6 Oct 2015 10:37:27 +0200 Subject: vhost: add vhost_has_free_slot() interface it will allow for other parts of QEMU check if it's safe to map memory region during hotplug/runtime. That way hotplug path will have a chance to cancel hotplug operation instead of crashing in vhost_commit(). Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-backend.h | 2 ++ include/hw/virtio/vhost.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index 3a0f6e2dc2..7d4a8ad968 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -26,6 +26,7 @@ typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque); typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev); typedef int (*vhost_backend_get_vq_index)(struct vhost_dev *dev, int idx); typedef int (*vhost_backend_set_vring_enable)(struct vhost_dev *dev, int enable); +typedef int (*vhost_backend_memslots_limit)(struct vhost_dev *dev); typedef struct VhostOps { VhostBackendType backend_type; @@ -34,6 +35,7 @@ typedef struct VhostOps { vhost_backend_cleanup vhost_backend_cleanup; vhost_backend_get_vq_index vhost_backend_get_vq_index; vhost_backend_set_vring_enable vhost_backend_set_vring_enable; + vhost_backend_memslots_limit vhost_backend_memslots_limit; } VhostOps; extern const VhostOps user_ops; diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index c3758f3c78..080831ed67 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -59,6 +59,7 @@ struct vhost_dev { const VhostOps *vhost_ops; void *opaque; struct vhost_log *log; + QLIST_ENTRY(vhost_dev) entry; }; int vhost_dev_init(struct vhost_dev *hdev, void *opaque, @@ -83,4 +84,5 @@ uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits, uint64_t features); void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits, uint64_t features); +bool vhost_has_free_slot(void); #endif -- cgit v1.2.1