[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v3 27/29] vhost-vdpa: Implement vhost_vdpa_vring_pause operation
From: |
Eugenio Pérez |
Subject: |
[RFC v3 27/29] vhost-vdpa: Implement vhost_vdpa_vring_pause operation |
Date: |
Wed, 19 May 2021 18:29:01 +0200 |
This uses the status bit DEVICE_STOPPED, that is currently discussed in
VirtIO, and is implemented in qemu VirtIO-net devices in previous
commits.
Removal of _S_DEVICE_STOPPED can be done in the future if an use case
arises.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-vdpa.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index c742e6944e..dfb465be96 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -618,6 +618,19 @@ static int vhost_vdpa_get_iova_range(struct vhost_dev *dev,
return ret;
}
+static int vhost_vdpa_vring_pause(struct vhost_dev *dev)
+{
+ int r;
+ uint8_t status;
+
+ vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DEVICE_STOPPED);
+ do {
+ r = vhost_vdpa_call(dev, VHOST_VDPA_GET_STATUS, &status);
+ } while (r == 0 && !(status & VIRTIO_CONFIG_S_DEVICE_STOPPED));
+
+ return 0;
+}
+
const VhostOps vdpa_ops = {
.backend_type = VHOST_BACKEND_TYPE_VDPA,
.vhost_backend_init = vhost_vdpa_init,
@@ -650,6 +663,7 @@ const VhostOps vdpa_ops = {
.vhost_get_device_id = vhost_vdpa_get_device_id,
.vhost_vq_get_addr = vhost_vdpa_vq_get_addr,
.vhost_force_iommu = vhost_vdpa_force_iommu,
+ .vhost_vring_pause = vhost_vdpa_vring_pause,
.vhost_enable_custom_iommu = vhost_vdpa_enable_custom_iommu,
.vhost_get_iova_range = vhost_vdpa_get_iova_range,
};
--
2.27.0
- [RFC v3 17/29] vhost: Shadow virtqueue buffers forwarding, (continued)
- [RFC v3 17/29] vhost: Shadow virtqueue buffers forwarding, Eugenio Pérez, 2021/05/19
- [RFC v3 18/29] vhost: Use vhost_enable_custom_iommu to unmap everything if available, Eugenio Pérez, 2021/05/19
- [RFC v3 19/29] vhost: Check for device VRING_USED_F_NO_NOTIFY at shadow virtqueue kick, Eugenio Pérez, 2021/05/19
- [RFC v3 20/29] vhost: Use VRING_AVAIL_F_NO_INTERRUPT at device call on shadow virtqueue, Eugenio Pérez, 2021/05/19
- [RFC v3 21/29] vhost: Add VhostIOVATree, Eugenio Pérez, 2021/05/19
- [RFC v3 22/29] vhost: Add iova_rev_maps_find_iova to IOVAReverseMaps, Eugenio Pérez, 2021/05/19
- [RFC v3 23/29] vhost: Use a tree to store memory mappings, Eugenio Pérez, 2021/05/19
- [RFC v3 24/29] vhost: Add iova_rev_maps_alloc, Eugenio Pérez, 2021/05/19
- [RFC v3 25/29] vhost: Add custom IOTLB translations to SVQ, Eugenio Pérez, 2021/05/19
- [RFC v3 26/29] vhost: Map in vdpa-dev, Eugenio Pérez, 2021/05/19
- [RFC v3 27/29] vhost-vdpa: Implement vhost_vdpa_vring_pause operation,
Eugenio Pérez <=
- [RFC v3 28/29] vhost-vdpa: never map with vDPA listener, Eugenio Pérez, 2021/05/19
- [RFC v3 29/29] vhost: Start vhost-vdpa SVQ directly, Eugenio Pérez, 2021/05/19
- Re: [RFC v3 00/29] vDPA software assisted live migration, Michael S. Tsirkin, 2021/05/24