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: Jason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210415073147.19331-3-jasowang@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eli Cohen <elic@nvidia.com>
This commit is contained in:
parent
9e3bb9b79a
commit
7dca6c0ea9
1 changed files with 2 additions and 25 deletions
|
@ -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 virtio_pci_modern_device *mdev = &vp_dev->mdev;
|
||||||
struct virtqueue *vq;
|
struct virtqueue *vq;
|
||||||
u16 num, off;
|
u16 num;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (index >= vp_modern_get_num_queues(mdev))
|
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);
|
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;
|
info->msix_vector = msix_vec;
|
||||||
|
|
||||||
/* create the vring */
|
/* 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_avail_addr(vq),
|
||||||
virtqueue_get_used_addr(vq));
|
virtqueue_get_used_addr(vq));
|
||||||
|
|
||||||
if (mdev->notify_base) {
|
vq->priv = vp_modern_map_vq_notify(mdev, index);
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vq->priv) {
|
if (!vq->priv) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_map_notify;
|
goto err_map_notify;
|
||||||
|
|
Loading…
Add table
Reference in a new issue