[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/15] vhost-blk: set features before setting inflight feature
From: |
Michael S. Tsirkin |
Subject: |
[PULL 13/15] vhost-blk: set features before setting inflight feature |
Date: |
Fri, 30 Oct 2020 08:45:34 -0400 |
From: Jin Yu <jin.yu@intel.com>
Virtqueue has split and packed, so before setting inflight,
you need to inform the back-end virtqueue format.
Signed-off-by: Jin Yu <jin.yu@intel.com>
Message-Id: <20200910134851.7817-1-jin.yu@intel.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/vhost.h | 1 +
hw/block/vhost-user-blk.c | 6 ++++++
hw/virtio/vhost.c | 18 ++++++++++++++++++
3 files changed, 25 insertions(+)
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 94585067f7..839bfb153c 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -141,6 +141,7 @@ void vhost_dev_reset_inflight(struct vhost_inflight
*inflight);
void vhost_dev_free_inflight(struct vhost_inflight *inflight);
void vhost_dev_save_inflight(struct vhost_inflight *inflight, QEMUFile *f);
int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f);
+int vhost_dev_prepare_inflight(struct vhost_dev *hdev);
int vhost_dev_set_inflight(struct vhost_dev *dev,
struct vhost_inflight *inflight);
int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size,
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index a076b1e54d..f67b29bbf3 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -131,6 +131,12 @@ static int vhost_user_blk_start(VirtIODevice *vdev)
s->dev.acked_features = vdev->guest_features;
+ ret = vhost_dev_prepare_inflight(&s->dev);
+ if (ret < 0) {
+ error_report("Error set inflight format: %d", -ret);
+ goto err_guest_notifiers;
+ }
+
if (!s->inflight->addr) {
ret = vhost_dev_get_inflight(&s->dev, s->queue_size, s->inflight);
if (ret < 0) {
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 79b2be20df..f2482378c6 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1645,6 +1645,24 @@ int vhost_dev_load_inflight(struct vhost_inflight
*inflight, QEMUFile *f)
return 0;
}
+int vhost_dev_prepare_inflight(struct vhost_dev *hdev)
+{
+ int r;
+
+ if (hdev->vhost_ops->vhost_get_inflight_fd == NULL ||
+ hdev->vhost_ops->vhost_set_inflight_fd == NULL) {
+ return 0;
+ }
+
+ r = vhost_dev_set_features(hdev, hdev->log_enabled);
+ if (r < 0) {
+ VHOST_OPS_DEBUG("vhost_dev_prepare_inflight failed");
+ return r;
+ }
+
+ return 0;
+}
+
int vhost_dev_set_inflight(struct vhost_dev *dev,
struct vhost_inflight *inflight)
{
--
MST
- [PULL 03/15] acpi/crs: Prevent bad ranges for host bridges, (continued)
- [PULL 03/15] acpi/crs: Prevent bad ranges for host bridges, Michael S. Tsirkin, 2020/10/30
- [PULL 04/15] acpi/crs: Support ranges > 32b for hosts, Michael S. Tsirkin, 2020/10/30
- [PULL 05/15] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864, Michael S. Tsirkin, 2020/10/30
- [PULL 06/15] hw/pci: Extract pci_bus_change_irq_level() from pci_change_irq_level(), Michael S. Tsirkin, 2020/10/30
- [PULL 07/15] pci: Assert irqnum is between 0 and bus->nirqs in pci_bus_change_irq_level, Michael S. Tsirkin, 2020/10/30
- [PULL 08/15] vhost: Don't special case vq->used_phys in vhost_get_log_size(), Michael S. Tsirkin, 2020/10/30
- [PULL 09/15] pc: Implement -no-hpet as sugar for -machine hpet=on, Michael S. Tsirkin, 2020/10/30
- [PULL 10/15] pci: advertise a page aligned ATS, Michael S. Tsirkin, 2020/10/30
- [PULL 11/15] pci: Change error_report to assert(3), Michael S. Tsirkin, 2020/10/30
- [PULL 12/15] pci: Disallow improper BAR registration for type 1, Michael S. Tsirkin, 2020/10/30
- [PULL 13/15] vhost-blk: set features before setting inflight feature,
Michael S. Tsirkin <=
- [PULL 14/15] virtio: skip guest index check on device load, Michael S. Tsirkin, 2020/10/30
- [PULL 15/15] intel_iommu: Fix two misuse of "0x%u" prints, Michael S. Tsirkin, 2020/10/30
- [PULL 01/15] vhost-vdpa: negotiate VIRTIO_NET_F_STATUS with driver, Michael S. Tsirkin, 2020/10/30
- Re: [PULL 00/15] pc,pci,vhost,virtio: misc fixes, no-reply, 2020/10/30
- [PULL 00/15] pc,pci,vhost,virtio: misc fixes, Michael S. Tsirkin, 2020/10/30
- [PULL 01/15] vhost-vdpa: negotiate VIRTIO_NET_F_STATUS with driver, Michael S. Tsirkin, 2020/10/30
- [PULL 02/15] vhost-vsock: set vhostfd to non-blocking mode, Michael S. Tsirkin, 2020/10/30
- [PULL 03/15] acpi/crs: Prevent bad ranges for host bridges, Michael S. Tsirkin, 2020/10/30
- [PULL 06/15] hw/pci: Extract pci_bus_change_irq_level() from pci_change_irq_level(), Michael S. Tsirkin, 2020/10/30
- [PULL 04/15] acpi/crs: Support ranges > 32b for hosts, Michael S. Tsirkin, 2020/10/30