提交 1072a086 编写于 作者: S Stefano Garzarella 提交者: Pengyuan Zhao

vdpa_sim: set vringh notify callback

mainline inclusion
from mainline-v5.11-rc1
commit b240491b
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b240491b7a48028fb67e5377ffd1be21e9260c4e

----------------------------------------------------------------------

Instead of calling the vq callback directly, we can leverage the
vringh_notify() function, adding vdpasim_vq_notify() and setting it
in the vringh notify callback.
Suggested-by: NJason Wang <jasowang@redhat.com>
Acked-by: NJason Wang <jasowang@redhat.com>
Signed-off-by: NStefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-15-sgarzare@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
上级 0a3d24b0
...@@ -52,6 +52,17 @@ static struct vdpasim *dev_to_sim(struct device *dev) ...@@ -52,6 +52,17 @@ static struct vdpasim *dev_to_sim(struct device *dev)
return vdpa_to_sim(vdpa); return vdpa_to_sim(vdpa);
} }
static void vdpasim_vq_notify(struct vringh *vring)
{
struct vdpasim_virtqueue *vq =
container_of(vring, struct vdpasim_virtqueue, vring);
if (!vq->cb)
return;
vq->cb(vq->private);
}
static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
{ {
struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
...@@ -63,6 +74,8 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) ...@@ -63,6 +74,8 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
(uintptr_t)vq->driver_addr, (uintptr_t)vq->driver_addr,
(struct vring_used *) (struct vring_used *)
(uintptr_t)vq->device_addr); (uintptr_t)vq->device_addr);
vq->vring.notify = vdpasim_vq_notify;
} }
static void vdpasim_vq_reset(struct vdpasim *vdpasim, static void vdpasim_vq_reset(struct vdpasim *vdpasim,
...@@ -76,6 +89,8 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim, ...@@ -76,6 +89,8 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim,
vq->private = NULL; vq->private = NULL;
vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features,
VDPASIM_QUEUE_MAX, false, NULL, NULL, NULL); VDPASIM_QUEUE_MAX, false, NULL, NULL, NULL);
vq->vring.notify = NULL;
} }
static void vdpasim_do_reset(struct vdpasim *vdpasim) static void vdpasim_do_reset(struct vdpasim *vdpasim)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册