From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-block@nongnu.org, Jin Yu <jin.yu@intel.com>,
Max Reitz <mreitz@redhat.com>,
Raphael Norwitz <raphael.norwitz@nutanix.com>
Subject: [PULL v3 26/31] vhost-blk: set features before setting inflight feature
Date: Wed, 4 Nov 2020 13:42:30 -0500 [thread overview]
Message-ID: <20201104184040.285057-27-mst@redhat.com> (raw)
In-Reply-To: <20201104184040.285057-1-mst@redhat.com>
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>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20201103123617.28256-1-jin.yu@intel.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 | 20 ++++++++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 94585067f7..4a8bc75415 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, VirtIODevice *vdev);
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..2dd3d93ca0 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, vdev);
+ 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..614ccc2bcb 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1645,6 +1645,26 @@ int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f)
return 0;
}
+int vhost_dev_prepare_inflight(struct vhost_dev *hdev, VirtIODevice *vdev)
+{
+ int r;
+
+ if (hdev->vhost_ops->vhost_get_inflight_fd == NULL ||
+ hdev->vhost_ops->vhost_set_inflight_fd == NULL) {
+ return 0;
+ }
+
+ hdev->vdev = vdev;
+
+ 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
next prev parent reply other threads:[~2020-11-04 18:57 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 18:41 [PULL v3 00/31] pc,pci,vhost,virtio: fixes Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 01/31] pc: comment style fixup Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 02/31] virtio-mem: Make sure "addr" is always multiples of the block size Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 03/31] virtio-mem: Make sure "usable_region_size" " Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 04/31] virtio-mem: Probe THP size to determine default " Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 05/31] memory-device: Support big alignment requirements Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 06/31] memory-device: Add get_min_alignment() callback Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 07/31] virito-mem: Implement get_min_alignment() Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 08/31] hw/acpi : Don't use '#' flag of printf format Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 09/31] hw/acpi : add space before the open parenthesis '(' Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 10/31] hw/acpi : add spaces around operator Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 11/31] hw/virtio/vhost-backend: Fix Coverity CID 1432871 Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 12/31] hw/smbios: Fix leaked fd in save_opt_one() error path Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 13/31] virtio-iommu: Fix virtio_iommu_mr() Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 14/31] virtio-iommu: Store memory region in endpoint struct Michael S. Tsirkin
2020-11-04 18:41 ` [PULL v3 15/31] virtio-iommu: Add memory notifiers for map/unmap Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 16/31] virtio-iommu: Call memory notifiers in attach/detach Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 17/31] virtio-iommu: Add replay() memory region callback Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 18/31] virtio-iommu: Add notify_flag_changed() " Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 19/31] memory: Add interface to set iommu page size mask Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 20/31] vfio: Set IOMMU page size as per host supported page size Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 21/31] virtio-iommu: Set supported page size mask Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 22/31] vfio: Don't issue full 2^64 unmap Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 23/31] vhost-vdpa: Add qemu_close in vhost_vdpa_cleanup Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 24/31] net: Add vhost-vdpa in show_netdevs() Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 25/31] Revert "vhost-blk: set features before setting inflight feature" Michael S. Tsirkin
2020-11-04 18:42 ` Michael S. Tsirkin [this message]
2020-11-04 18:42 ` [PULL v3 27/31] libvhost-user: follow QEMU comment style Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 28/31] configure: introduce --enable-vhost-user-blk-server Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 29/31] block/export: make vhost-user-blk config space little-endian Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 30/31] block/export: fix vhost-user-blk get_config() information leak Michael S. Tsirkin
2020-11-04 18:42 ` [PULL v3 31/31] contrib/vhost-user-blk: fix " Michael S. Tsirkin
2020-11-05 16:14 ` [PULL v3 00/31] pc,pci,vhost,virtio: fixes Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201104184040.285057-27-mst@redhat.com \
--to=mst@redhat.com \
--cc=jin.yu@intel.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).