Commit 7dca6c0e authored by Jason Wang's avatar Jason Wang Committed by Michael S. Tsirkin

virtio-pci library: switch to use vp_modern_map_vq_notify()

This patch switch to use vp_modern_map_notify() for virtio-pci
library.
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210415073147.19331-3-jasowang@redhat.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarEli Cohen <elic@nvidia.com>
parent 9e3bb9b7
......@@ -192,7 +192,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
struct virtio_pci_modern_device *mdev = &vp_dev->mdev;
struct virtqueue *vq;
u16 num, off;
u16 num;
int err;
if (index >= vp_modern_get_num_queues(mdev))
......@@ -208,9 +208,6 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
return ERR_PTR(-EINVAL);
}
/* get offset of notification word for this vq */
off = vp_modern_get_queue_notify_off(mdev, index);
info->msix_vector = msix_vec;
/* create the vring */
......@@ -227,27 +224,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
virtqueue_get_avail_addr(vq),
virtqueue_get_used_addr(vq));
if (mdev->notify_base) {
/* offset should not wrap */
if ((u64)off * mdev->notify_offset_multiplier + 2
> mdev->notify_len) {
dev_warn(&mdev->pci_dev->dev,
"bad notification offset %u (x %u) "
"for queue %u > %zd",
off, mdev->notify_offset_multiplier,
index, mdev->notify_len);
err = -EINVAL;
goto err_map_notify;
}
vq->priv = (void __force *)mdev->notify_base +
off * mdev->notify_offset_multiplier;
} else {
vq->priv = (void __force *)vp_modern_map_capability(mdev,
mdev->notify_map_cap, 2, 2,
off * mdev->notify_offset_multiplier, 2,
NULL);
}
vq->priv = vp_modern_map_vq_notify(mdev, index);
if (!vq->priv) {
err = -ENOMEM;
goto err_map_notify;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment