]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
vdpa: Add eventfd for the vdpa callback
authorXie Yongji <xieyongji@bytedance.com>
Thu, 23 Mar 2023 05:30:40 +0000 (13:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:06 +0000 (15:11 +0200)
[ Upstream commit 5e68470f4e80a4120e9ecec408f6ab4ad386bd4a ]

Add eventfd for the vdpa callback so that user
can signal it directly instead of triggering the
callback. It will be used for vhost-vdpa case.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Message-Id: <20230323053043.35-9-xieyongji@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Stable-dep-of: 02e9e9366fef ("vhost_vdpa: assign irq bypass producer token correctly")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vhost/vdpa.c
drivers/virtio/virtio_vdpa.c
include/linux/vdpa.h

index 019e8c9bedffbfb25768204c87bf9d95463b3902..1dc11ba0922d2b0724f17252961bebc9f926bb75 100644 (file)
@@ -432,9 +432,11 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
                if (vq->call_ctx.ctx) {
                        cb.callback = vhost_vdpa_virtqueue_cb;
                        cb.private = vq;
+                       cb.trigger = vq->call_ctx.ctx;
                } else {
                        cb.callback = NULL;
                        cb.private = NULL;
+                       cb.trigger = NULL;
                }
                ops->set_vq_cb(vdpa, idx, &cb);
                vhost_vdpa_setup_vq_irq(v, idx);
index 72eaef2caeb14e7e6e254b979ef37a5c71e03693..1c29446aafb441cb1c30fa53c8b00b3ff5c0d38b 100644 (file)
@@ -182,6 +182,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
        /* Setup virtqueue callback */
        cb.callback = virtio_vdpa_virtqueue_cb;
        cb.private = info;
+       cb.trigger = NULL;
        ops->set_vq_cb(vdpa, index, &cb);
        ops->set_vq_num(vdpa, index, virtqueue_get_vring_size(vq));
 
index 3972ab765de18c7f40ecb8f89877dce86aed6876..4fb198c8dbf6156e092cfea31cf1c99b52885559 100644 (file)
  * struct vdpa_calllback - vDPA callback definition.
  * @callback: interrupt callback function
  * @private: the data passed to the callback function
+ * @trigger: the eventfd for the callback (Optional).
+ *           When it is set, the vDPA driver must guarantee that
+ *           signaling it is functional equivalent to triggering
+ *           the callback. Then vDPA parent can signal it directly
+ *           instead of triggering the callback.
  */
 struct vdpa_callback {
        irqreturn_t (*callback)(void *data);
        void *private;
+       struct eventfd_ctx *trigger;
 };
 
 /**