Skip to contentSkip to conversation

virtio: fixes

GIT PULL Applied Michael S. Tsirkin 2 participants 14 messages Jun 28, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#1 lore raw

[PULL 04/12] vhost: setup error eventfd and dump errors

In reply to Michael S. Tsirkin

From: Konstantin Khlebnikov <[email protected]>

Vhost has error notifications, let's log them like other errors. For each virt-queue setup eventfd for vring error notifications.

[vsementsov: rename patch, change commit message and dump error like
other errors in the file]

Message-Id: <[email protected]>

---
 include/hw/virtio/vhost.h |  1 +
 hw/virtio/vhost.c         | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
include/hw/virtio/vhost.h +1 -0
index b291fe4e24..1e7cbd9a10 100644
@@ -29,6 +29,7 @@ struct vhost_virtqueue {
     unsigned long long used_phys;
     unsigned used_size;
     EventNotifier masked_notifier;
+    EventNotifier error_notifier;
     struct vhost_dev *dev;
 };
 
hw/virtio/vhost.c +37 -0
index 6c41fa13e3..0827d631c0 100644
@@ -1278,6 +1278,19 @@ static int vhost_virtqueue_set_busyloop_timeout(struct vhost_dev *dev,
     return 0;
 }
 
+static void vhost_virtqueue_error_notifier(EventNotifier *n)
+{
+    struct vhost_virtqueue *vq = container_of(n, struct vhost_virtqueue,
+                                              error_notifier);
+    struct vhost_dev *dev = vq->dev;
+    int index = vq - dev->vqs;
+
+    if (event_notifier_test_and_clear(n) && dev->vdev) {
+        VHOST_OPS_DEBUG(-EINVAL,  "vhost vring error in virtqueue %d",
+                        dev->vq_index + index);
+    }
+}
+
 static int vhost_virtqueue_init(struct vhost_dev *dev,
                                 struct vhost_virtqueue *vq, int n)
 {
@@ -1299,7 +1312,27 @@ static int vhost_virtqueue_init(struct vhost_dev *dev,
 
     vq->dev = dev;
 
+    if (dev->vhost_ops->vhost_set_vring_err) {
+        r = event_notifier_init(&vq->error_notifier, 0);
+        if (r < 0) {
+            goto fail_call;
+        }
+
+        file.fd = event_notifier_get_fd(&vq->error_notifier);
+        r = dev->vhost_ops->vhost_set_vring_err(dev, &file);
+        if (r) {
+            VHOST_OPS_DEBUG(r, "vhost_set_vring_err failed");
+            goto fail_err;
+        }
+
+        event_notifier_set_handler(&vq->error_notifier,
+                                   vhost_virtqueue_error_notifier);
+    }
+
     return 0;
+
+fail_err:
+    event_notifier_cleanup(&vq->error_notifier);
 fail_call:
     event_notifier_cleanup(&vq->masked_notifier);
     return r;
@@ -1308,6 +1341,10 @@ fail_call:
 static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
 {
     event_notifier_cleanup(&vq->masked_notifier);
+    if (vq->dev->vhost_ops->vhost_set_vring_err) {
+        event_notifier_set_handler(&vq->error_notifier, NULL);
+        event_notifier_cleanup(&vq->error_notifier);
+    }
 }
 
 int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
Signature · 1 line
MST
#2 lore raw

[PULL 01/12] virtio-iommu: Fix the partial copy of probe request

In reply to Michael S. Tsirkin

From: Zhenzhong Duan <[email protected]>

The structure of probe request doesn't include the tail, this leads to a few field missed to be copied. Currently this isn't an issue as those missed field belong to reserved field, just in case reserved field will be used in the future.

Changed 4th parameter of virtio_iommu_iov_to_req() to receive size of device-readable part.

Fixes 1733eebb9e75b ("virtio-iommu: Implement RESV_MEM probe request")

Message-Id: <[email protected]>

---
 hw/virtio/virtio-iommu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/virtio/virtio-iommu.c +4 -4
index 7c122ab957..08b227e828 100644
@@ -675,11 +675,10 @@ static int virtio_iommu_probe(VirtIOIOMMU *s,
 
 static int virtio_iommu_iov_to_req(struct iovec *iov,
                                    unsigned int iov_cnt,
-                                   void *req, size_t req_sz)
+                                   void *req, size_t payload_sz)
 {
-    size_t sz, payload_sz = req_sz - sizeof(struct virtio_iommu_req_tail);
+    size_t sz = iov_to_buf(iov, iov_cnt, 0, req, payload_sz);
 
-    sz = iov_to_buf(iov, iov_cnt, 0, req, payload_sz);
     if (unlikely(sz != payload_sz)) {
         return VIRTIO_IOMMU_S_INVAL;
     }
@@ -692,7 +691,8 @@ static int virtio_iommu_handle_ ## __req(VirtIOIOMMU *s,                \
                                          unsigned int iov_cnt)          \
 {                                                                       \
     struct virtio_iommu_req_ ## __req req;                              \
-    int ret = virtio_iommu_iov_to_req(iov, iov_cnt, &req, sizeof(req)); \
+    int ret = virtio_iommu_iov_to_req(iov, iov_cnt, &req,               \
+                    sizeof(req) - sizeof(struct virtio_iommu_req_tail));\
                                                                         \
     return ret ? ret : virtio_iommu_ ## __req(s, &req);                 \
 }
Signature · 1 line
MST
#3 lore raw

[PULL 07/12] libvhost-user: Fix VHOST_USER_GET_MAX_MEM_SLOTS reply

In reply to Michael S. Tsirkin

From: Kevin Wolf <[email protected]>

With REPLY_NEEDED, libvhost-user sends both the acutal result and an additional ACK reply for VHOST_USER_GET_MAX_MEM_SLOTS. This is incorrect, the spec mandates that it behave the same with and without REPLY_NEEDED because it always sends a reply.

Fixes 6fb2e173d20c9bbb5466183d33a3ad7dcd0375fa

Message-Id: <[email protected]>

---
 subprojects/libvhost-user/libvhost-user.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
subprojects/libvhost-user/libvhost-user.c +2 -9
index b4cc3c2d68..cfa1bcc334 100644
@@ -1827,18 +1827,11 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg)
 
 static bool vu_handle_get_max_memslots(VuDev *dev, VhostUserMsg *vmsg)
 {
-    vmsg->flags = VHOST_USER_REPLY_MASK | VHOST_USER_VERSION;
-    vmsg->size  = sizeof(vmsg->payload.u64);
-    vmsg->payload.u64 = VHOST_USER_MAX_RAM_SLOTS;
-    vmsg->fd_num = 0;
-
-    if (!vu_message_write(dev, dev->sock, vmsg)) {
-        vu_panic(dev, "Failed to send max ram slots: %s\n", strerror(errno));
-    }
+    vmsg_set_reply_u64(vmsg, VHOST_USER_MAX_RAM_SLOTS);
 
     DPRINT("u64: 0x%016"PRIx64"\n", (uint64_t) VHOST_USER_MAX_RAM_SLOTS);
 
-    return false;
+    return true;
 }
 
 static bool
Signature · 1 line
MST
#4 lore raw

[PULL 09/12] MAINTAINERS: Collect memory device files in "Memory devices"

In reply to Michael S. Tsirkin

From: David Hildenbrand <[email protected]>

Xiao Guangrong doesn't have enough time to actively review or contribute to our NVDIMM implementation. Let's dissolve the "NVDIMM" section, moving relevant ACPI parts to "ACPI/SMBIOS" and moving memory device stuff into a new "Memory devices" section. Make that new section cover other memory device stuff as well.

We can now drop the "hw/mem/*" rule from "ACPI/SMBIOS". Note that hw/acpi/nvdimm.c is already covered by "ACPI/SMBIOS".

The following files in hw/mem don't fall into the TYPE_MEMPORY_DEVICE category:
* hw/mem/cxl_type3.c is CXL specific and belongs to "Compute Express Link"
* hw/mem/sparse-mem.c is already covered by "Device Fuzzing"
* hw/mem/npcm7xx_mc.c is already covered by "Nuvoton NPCM7xx"

Thanks Xiao for your work on NVDIMM!

Cc Ben Widawsky <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Ani Sinha <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc "Philippe Mathieu-Daudé" <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Julia Suvorova <[email protected]>

Message-Id: <[email protected]>

---
 MAINTAINERS | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
MAINTAINERS +15 -10
index 1cbd6b72fa..05cf84b58c 100644
@@ -1840,7 +1840,6 @@ R: Ani Sinha <[email protected]>
 S: Supported
 F: include/hw/acpi/*
 F: include/hw/firmware/smbios.h
-F: hw/mem/*
 F: hw/acpi/*
 F: hw/smbios/*
 F: hw/i386/acpi-build.[hc]
@@ -1851,6 +1850,7 @@ F: tests/qtest/acpi-utils.[hc]
 F: tests/data/acpi/
 F: docs/specs/acpi_cpu_hotplug.rst
 F: docs/specs/acpi_mem_hotplug.rst
+F: docs/specs/acpi_nvdimm.rst
 F: docs/specs/acpi_pci_hotplug.rst
 F: docs/specs/acpi_hw_reduced_hotplug.rst
 
@@ -2158,15 +2158,6 @@ F: qapi/rocker.json
 F: tests/rocker/
 F: docs/specs/rocker.txt
 
-NVDIMM
-M: Xiao Guangrong <[email protected]>
-S: Maintained
-F: hw/acpi/nvdimm.c
-F: hw/mem/nvdimm.c
-F: include/hw/mem/nvdimm.h
-F: docs/nvdimm.txt
-F: docs/specs/acpi_nvdimm.rst
-
 e1000x
 M: Dmitry Fleytman <[email protected]>
 S: Maintained
@@ -2588,6 +2579,7 @@ M: Ben Widawsky <[email protected]>
 M: Jonathan Cameron <[email protected]>
 S: Supported
 F: hw/cxl/
+F: hw/mem/cxl_type3.c
 F: include/hw/cxl/
 
 Dirty Bitmaps
@@ -2704,6 +2696,19 @@ F: softmmu/physmem.c
 F: include/exec/memory-internal.h
 F: scripts/coccinelle/memory-region-housekeeping.cocci
 
+Memory devices
+M: David Hildenbrand <[email protected]>
+M: Igor Mammedov <[email protected]>
+R: Xiao Guangrong <[email protected]>
+S: Supported
+F: hw/mem/memory-device.c
+F: hw/mem/nvdimm.c
+F: hw/mem/pc-dimm.c
+F: include/hw/mem/memory-device.h
+F: include/hw/mem/nvdimm.h
+F: include/hw/mem/pc-dimm.h
+F: docs/nvdimm.txt
+
 SPICE
 M: Gerd Hoffmann <[email protected]>
 S: Odd Fixes
Signature · 1 line
MST
#0 lore raw

The following changes since commit 097ccbbbaf2681df1e65542e5b7d2b2d0c66e2bc:

Merge tag 'qemu-sparc-20220626' of https://github.com/mcayland/qemu into staging (2022-06-27 05:21:05 +0530)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 81cf38f3ff3c7db8fcd2f46df9a294fdf6f4a910:

include/hw/virtio: document vhost_ack_features (2022-06-27 18:53:18 -0400)

----------------------------------------------------------------
virtio: fixes

fixes all over the place

----------------------------------------------------------------
Alex Bennée (3):
contrib/vhost-user-blk: fix 32 bit build and enable include/hw/virtio: document vhost_get_features include/hw/virtio: document vhost_ack_features

David Hildenbrand (1):
MAINTAINERS: Collect memory device files in "Memory devices"

Jagannathan Raman (1):
msi: fix MSI vector limit check in msi_set_mask()

Kevin Wolf (3):
docs/vhost-user: Fix mismerge
libvhost-user: Fix VHOST_USER_GET_MAX_MEM_SLOTS reply
libvhost-user: Fix VHOST_USER_ADD_MEM_REG reply

Konstantin Khlebnikov (2):
vhost: add method vhost_set_vring_err
vhost: setup error eventfd and dump errors

Zhenzhong Duan (2):
virtio-iommu: Fix the partial copy of probe request
virtio-iommu: Fix migration regression

 include/hw/virtio/vhost-backend.h         |  3 +++
 include/hw/virtio/vhost.h                 | 22 ++++++++++++++++++
 contrib/vhost-user-blk/vhost-user-blk.c   |  6 ++---
 hw/pci/msi.c                              |  4 ++--
 hw/virtio/vhost-backend.c                 |  7 ++++++
 hw/virtio/vhost-user.c                    |  6 +++++
 hw/virtio/vhost.c                         | 37 +++++++++++++++++++++++++++++++
 hw/virtio/virtio-iommu.c                  | 16 +++++++++----
 subprojects/libvhost-user/libvhost-user.c | 19 +++-------------
 MAINTAINERS                               | 25 ++++++++++++---------
 contrib/vhost-user-blk/meson.build        |  3 +--
 docs/interop/vhost-user.rst               | 16 -------------
 meson.build                               |  2 +-
 13 files changed, 112 insertions(+), 54 deletions(-)
#5 lore raw

[PULL 10/12] contrib/vhost-user-blk: fix 32 bit build and enable

From: Alex Bennée <[email protected]>

We were not building the vhost-user-blk server due to 32 bit compilation problems. The problem was due to format string types so fix that and then enable the build. Tweak the rule to follow the same rules as other vhost-user daemons.

Message-Id: <[email protected]>
Message-Id: <[email protected]>

---
 contrib/vhost-user-blk/vhost-user-blk.c | 6 +++---
 contrib/vhost-user-blk/meson.build      | 3 +--
 meson.build                             | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
contrib/vhost-user-blk/vhost-user-blk.c +3 -3
index cd4a5d7335..9cb78ca1d0 100644
@@ -146,7 +146,7 @@ vub_readv(VubReq *req, struct iovec *iov, uint32_t iovcnt)
     req->size = vub_iov_size(iov, iovcnt);
     rc = preadv(vdev_blk->blk_fd, iov, iovcnt, req->sector_num * 512);
     if (rc < 0) {
-        fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n",
+        fprintf(stderr, "%s, Sector %"PRIu64", Size %zu failed with %s\n",
                 vdev_blk->blk_name, req->sector_num, req->size,
                 strerror(errno));
         return -1;
@@ -169,7 +169,7 @@ vub_writev(VubReq *req, struct iovec *iov, uint32_t iovcnt)
     req->size = vub_iov_size(iov, iovcnt);
     rc = pwritev(vdev_blk->blk_fd, iov, iovcnt, req->sector_num * 512);
     if (rc < 0) {
-        fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n",
+        fprintf(stderr, "%s, Sector %"PRIu64", Size %zu failed with %s\n",
                 vdev_blk->blk_name, req->sector_num, req->size,
                 strerror(errno));
         return -1;
@@ -188,7 +188,7 @@ vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t iovcnt,
 
     size = vub_iov_size(iov, iovcnt);
     if (size != sizeof(*desc)) {
-        fprintf(stderr, "Invalid size %ld, expect %ld\n", size, sizeof(*desc));
+        fprintf(stderr, "Invalid size %zd, expect %zd\n", size, sizeof(*desc));
         return -1;
     }
     buf = g_new0(char, size);
contrib/vhost-user-blk/meson.build +1 -2
index 601ea15ef5..dcb9e2ffcd 100644
@@ -1,5 +1,4 @@
-# FIXME: broken on 32-bit architectures
 executable('vhost-user-blk', files('vhost-user-blk.c'),
            dependencies: [qemuutil, vhost_user],
-           build_by_default: false,
+           build_by_default: targetos == 'linux',
            install: false)
meson.build +1 -1
index a113078f1a..65a885ea69 100644
@@ -1516,7 +1516,7 @@ have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
            error_message: 'vhost_user_blk_server requires linux') \
   .require(have_vhost_user,
            error_message: 'vhost_user_blk_server requires vhost-user support') \
-  .disable_auto_if(not have_system) \
+  .disable_auto_if(not have_tools and not have_system) \
   .allowed()
 
 if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
Signature · 1 line
MST
#6 lore raw

[PULL 11/12] include/hw/virtio: document vhost_get_features

In reply to Michael S. Tsirkin

From: Alex Bennée <[email protected]>

Message-Id: <[email protected]>

---
 include/hw/virtio/vhost.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
include/hw/virtio/vhost.h +11 -0
index 1e7cbd9a10..bfc71b7c50 100644
@@ -247,6 +247,17 @@ bool vhost_virtqueue_pending(struct vhost_dev *hdev, int n);
  */
 void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
                           bool mask);
+
+/**
+ * vhost_get_features() - return a sanitised set of feature bits
+ * @hdev: common vhost_dev structure
+ * @feature_bits: pointer to terminated table of feature bits
+ * @features: original feature set
+ *
+ * This returns a set of features bits that is an intersection of what
+ * is supported by the vhost backend (hdev->features), the supported
+ * feature_bits and the requested feature set.
+ */
 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,
Signature · 1 line
MST
#7 lore raw

[PULL 05/12] virtio-iommu: Fix migration regression

In reply to Michael S. Tsirkin

From: Zhenzhong Duan <[email protected]>

We also need to switch to the right address space on dest side after loading the device status. DMA to wrong address space is destructive.

Fixes 3facd774962fd ("virtio-iommu: Add bypass mode support to assigned device")

Message-Id: <[email protected]>

---
 hw/virtio/virtio-iommu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/virtio/virtio-iommu.c +8 -0
index 08b227e828..281152d338 100644
@@ -1322,6 +1322,14 @@ static int iommu_post_load(void *opaque, int version_id)
     VirtIOIOMMU *s = opaque;
 
     g_tree_foreach(s->domains, reconstruct_endpoints, s);
+
+    /*
+     * Memory regions are dynamically turned on/off depending on
+     * 'config.bypass' and attached domain type if there is. After
+     * migration, we need to make sure the memory regions are
+     * still correct.
+     */
+    virtio_iommu_switch_address_space_all(s);
     return 0;
 }
 
Signature · 1 line
MST
#8 lore raw

[PULL 12/12] include/hw/virtio: document vhost_ack_features

In reply to Michael S. Tsirkin

From: Alex Bennée <[email protected]>

Message-Id: <[email protected]>

---
 include/hw/virtio/vhost.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/hw/virtio/vhost.h +10 -0
index bfc71b7c50..a346f23d13 100644
@@ -260,6 +260,16 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
  */
 uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
                             uint64_t features);
+
+/**
+ * vhost_ack_features() - set vhost acked_features
+ * @hdev: common vhost_dev structure
+ * @feature_bits: pointer to terminated table of feature bits
+ * @features: requested feature set
+ *
+ * This sets the internal hdev->acked_features to the intersection of
+ * the backends advertised features and the supported feature_bits.
+ */
 void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
                         uint64_t features);
 bool vhost_has_free_slot(void);
Signature · 1 line
MST
#9 lore raw

[PULL 08/12] libvhost-user: Fix VHOST_USER_ADD_MEM_REG reply

In reply to Michael S. Tsirkin

From: Kevin Wolf <[email protected]>

With REPLY_NEEDED, libvhost-user sends both the acutal result and an additional ACK reply for VHOST_USER_ADD_MEM_REG. This is incorrect, the spec mandates that it behave the same with and without REPLY_NEEDED because it always sends a reply.

Fixes ec94c8e621de96c50c2d381c8c9ec94f5beec7c1

Message-Id: <[email protected]>

---
 subprojects/libvhost-user/libvhost-user.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
subprojects/libvhost-user/libvhost-user.c +1 -7
index cfa1bcc334..ffed4729a3 100644
@@ -779,15 +779,9 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
 
         /* Send the message back to qemu with the addresses filled in. */
         vmsg->fd_num = 0;
-        if (!vu_send_reply(dev, dev->sock, vmsg)) {
-            vu_panic(dev, "failed to respond to add-mem-region for postcopy");
-            return false;
-        }
-
         DPRINT("Successfully added new region in postcopy\n");
         dev->nregions++;
-        return false;
-
+        return true;
     } else {
         for (i = 0; i < dev->max_queues; i++) {
             if (dev->vq[i].vring.desc) {
Signature · 1 line
MST
#10 lore raw

[PULL 02/12] msi: fix MSI vector limit check in msi_set_mask()

In reply to Michael S. Tsirkin

From: Jagannathan Raman <[email protected]>

MSI supports a maximum of PCI_MSI_VECTORS_MAX vectors - from 0 to PCI_MSI_VECTORS_MAX - 1.

msi_set_mask() was previously using PCI_MSI_VECTORS_MAX as the upper limit for MSI vectors. Fix the upper limit to PCI_MSI_VECTORS_MAX - 1.

Fixes Coverity CID 1490141
Fixes 08cf3dc61199 vfio-user: handle device interrupts

Message-Id: <[email protected]>

---
 hw/pci/msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci/msi.c +2 -2
index 5c471b9616..058d1d1ef1 100644
@@ -322,9 +322,9 @@ void msi_set_mask(PCIDevice *dev, int vector, bool mask, Error **errp)
     bool msi64bit = flags & PCI_MSI_FLAGS_64BIT;
     uint32_t irq_state, vector_mask, pending;
 
-    if (vector > PCI_MSI_VECTORS_MAX) {
+    if (vector >= PCI_MSI_VECTORS_MAX) {
         error_setg(errp, "msi: vector %d not allocated. max vector is %d",
-                   vector, PCI_MSI_VECTORS_MAX);
+                   vector, (PCI_MSI_VECTORS_MAX - 1));
         return;
     }
 
Signature · 1 line
MST
#11 lore raw

[PULL 03/12] vhost: add method vhost_set_vring_err

In reply to Michael S. Tsirkin

From: Konstantin Khlebnikov <[email protected]>

Kernel and user vhost may report virtqueue errors via eventfd. This is only reliable way to get notification about protocol error.

Message-Id: <[email protected]>

---
 include/hw/virtio/vhost-backend.h | 3 +++
 hw/virtio/vhost-backend.c         | 7 +++++++
 hw/virtio/vhost-user.c            | 6 ++++++
 3 files changed, 16 insertions(+)
include/hw/virtio/vhost-backend.h +3 -0
index 81bf3109f8..eab46d7f0b 100644
@@ -69,6 +69,8 @@ typedef int (*vhost_set_vring_kick_op)(struct vhost_dev *dev,
                                        struct vhost_vring_file *file);
 typedef int (*vhost_set_vring_call_op)(struct vhost_dev *dev,
                                        struct vhost_vring_file *file);
+typedef int (*vhost_set_vring_err_op)(struct vhost_dev *dev,
+                                      struct vhost_vring_file *file);
 typedef int (*vhost_set_vring_busyloop_timeout_op)(struct vhost_dev *dev,
                                                    struct vhost_vring_state *r);
 typedef int (*vhost_set_features_op)(struct vhost_dev *dev,
@@ -145,6 +147,7 @@ typedef struct VhostOps {
     vhost_get_vring_base_op vhost_get_vring_base;
     vhost_set_vring_kick_op vhost_set_vring_kick;
     vhost_set_vring_call_op vhost_set_vring_call;
+    vhost_set_vring_err_op vhost_set_vring_err;
     vhost_set_vring_busyloop_timeout_op vhost_set_vring_busyloop_timeout;
     vhost_set_features_op vhost_set_features;
     vhost_get_features_op vhost_get_features;
hw/virtio/vhost-backend.c +7 -0
index 4de8b6b3b0..8e581575c9 100644
@@ -146,6 +146,12 @@ static int vhost_kernel_set_vring_call(struct vhost_dev *dev,
     return vhost_kernel_call(dev, VHOST_SET_VRING_CALL, file);
 }
 
+static int vhost_kernel_set_vring_err(struct vhost_dev *dev,
+                                      struct vhost_vring_file *file)
+{
+    return vhost_kernel_call(dev, VHOST_SET_VRING_ERR, file);
+}
+
 static int vhost_kernel_set_vring_busyloop_timeout(struct vhost_dev *dev,
                                                    struct vhost_vring_state *s)
 {
@@ -309,6 +315,7 @@ const VhostOps kernel_ops = {
         .vhost_get_vring_base = vhost_kernel_get_vring_base,
         .vhost_set_vring_kick = vhost_kernel_set_vring_kick,
         .vhost_set_vring_call = vhost_kernel_set_vring_call,
+        .vhost_set_vring_err = vhost_kernel_set_vring_err,
         .vhost_set_vring_busyloop_timeout =
                                 vhost_kernel_set_vring_busyloop_timeout,
         .vhost_set_features = vhost_kernel_set_features,
hw/virtio/vhost-user.c +6 -0
index 4b9be26e84..75b8df21a4 100644
@@ -1313,6 +1313,11 @@ static int vhost_user_set_vring_call(struct vhost_dev *dev,
     return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_CALL, file);
 }
 
+static int vhost_user_set_vring_err(struct vhost_dev *dev,
+                                    struct vhost_vring_file *file)
+{
+    return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_ERR, file);
+}
 
 static int vhost_user_get_u64(struct vhost_dev *dev, int request, uint64_t *u64)
 {
@@ -2616,6 +2621,7 @@ const VhostOps user_ops = {
         .vhost_get_vring_base = vhost_user_get_vring_base,
         .vhost_set_vring_kick = vhost_user_set_vring_kick,
         .vhost_set_vring_call = vhost_user_set_vring_call,
+        .vhost_set_vring_err = vhost_user_set_vring_err,
         .vhost_set_features = vhost_user_set_features,
         .vhost_get_features = vhost_user_get_features,
         .vhost_set_owner = vhost_user_set_owner,
Signature · 1 line
MST
#12 lore raw

[PULL 06/12] docs/vhost-user: Fix mismerge

In reply to Michael S. Tsirkin

From: Kevin Wolf <[email protected]>

This reverts commit 76b1b64370007234279ea4cc8b09c98cbd2523de.

The commit only duplicated some text that had already been merged in commit 31009d13cc5.

Message-Id: <[email protected]>

---
 docs/interop/vhost-user.rst | 16 ----------------
 1 file changed, 16 deletions(-)
docs/interop/vhost-user.rst +0 -16
index d7cf904f7f..3f18ab424e 100644
@@ -1376,14 +1376,6 @@ Front-end message types
   For further details on postcopy, see ``VHOST_USER_SET_MEM_TABLE``.
   They apply to ``VHOST_USER_ADD_MEM_REG`` accordingly.
 
-  Exactly one file descriptor from which the memory is mapped is
-  passed in the ancillary data.
-
-  In postcopy mode (see ``VHOST_USER_POSTCOPY_LISTEN``), the back-end
-  replies with the bases of the memory mapped region to the front-end.
-  For further details on postcopy, see ``VHOST_USER_SET_MEM_TABLE``.
-  They apply to ``VHOST_USER_ADD_MEM_REG`` accordingly.
-
 ``VHOST_USER_REM_MEM_REG``
   :id: 38
   :equivalent ioctl: N/A
@@ -1408,14 +1400,6 @@ Front-end message types
   accept messages with one file descriptor. If a file descriptor is
   passed, the back-end MUST close it without using it otherwise.
 
-  The memory region to be removed is identified by its guest address,
-  user address and size. The mmap offset is ignored.
-
-  No file descriptors SHOULD be passed in the ancillary data. For
-  compatibility with existing incorrect implementations, the back-end MAY
-  accept messages with one file descriptor. If a file descriptor is
-  passed, the back-end MUST close it without using it otherwise.
-
 ``VHOST_USER_SET_STATUS``
   :id: 39
   :equivalent ioctl: VHOST_VDPA_SET_STATUS
Signature · 1 line
MST
#13 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

The following changes since commit 097ccbbbaf2681df1e65542e5b7d2b2d0c66e2bc:

   Merge tag 'qemu-sparc-20220626' of https://github.com/mcayland/qemu into staging (2022-06-27 05:21:05 +0530)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 81cf38f3ff3c7db8fcd2f46df9a294fdf6f4a910:

Quoted 8 lines
   include/hw/virtio: document vhost_ack_features (2022-06-27 18:53:18 -0400)

----------------------------------------------------------------
virtio: fixes

fixes all over the place

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.

r~

Quoted 42 lines

----------------------------------------------------------------
Alex Bennée (3):
contrib/vhost-user-blk: fix 32 bit build and enable include/hw/virtio: document vhost_get_features include/hw/virtio: document vhost_ack_features

David Hildenbrand (1):
MAINTAINERS: Collect memory device files in "Memory devices"

Jagannathan Raman (1):
msi: fix MSI vector limit check in msi_set_mask()

Kevin Wolf (3):
docs/vhost-user: Fix mismerge
libvhost-user: Fix VHOST_USER_GET_MAX_MEM_SLOTS reply
libvhost-user: Fix VHOST_USER_ADD_MEM_REG reply

Konstantin Khlebnikov (2):
vhost: add method vhost_set_vring_err
vhost: setup error eventfd and dump errors

Zhenzhong Duan (2):
virtio-iommu: Fix the partial copy of probe request
virtio-iommu: Fix migration regression

  include/hw/virtio/vhost-backend.h         |  3 +++
  include/hw/virtio/vhost.h                 | 22 ++++++++++++++++++
  contrib/vhost-user-blk/vhost-user-blk.c   |  6 ++---
  hw/pci/msi.c                              |  4 ++--
  hw/virtio/vhost-backend.c                 |  7 ++++++
  hw/virtio/vhost-user.c                    |  6 +++++
  hw/virtio/vhost.c                         | 37 +++++++++++++++++++++++++++++++
  hw/virtio/virtio-iommu.c                  | 16 +++++++++----
  subprojects/libvhost-user/libvhost-user.c | 19 +++-------------
  MAINTAINERS                               | 25 ++++++++++++---------
  contrib/vhost-user-blk/meson.build        |  3 +--
  docs/interop/vhost-user.rst               | 16 -------------
  meson.build                               |  2 +-
  13 files changed, 112 insertions(+), 54 deletions(-)