From: Jason Wang <jasowang@redhat.com> To: mst@redhat.com, jasowang@redhat.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, elic@nvidia.com Subject: [PATCH 2/7] virtio-pci library: switch to use vp_modern_map_vq_notify() Date: Thu, 15 Apr 2021 03:31:42 -0400 [thread overview] Message-ID: <20210415073147.19331-3-jasowang@redhat.com> (raw) In-Reply-To: <20210415073147.19331-1-jasowang@redhat.com> This patch switch to use vp_modern_map_notify() for virtio-pci library. Signed-off-by: Jason Wang <jasowang@redhat.com> --- drivers/virtio/virtio_pci_modern.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index fbd4ebc00eb6..29607d9bd95c 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -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; -- 2.18.1
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com> To: mst@redhat.com, jasowang@redhat.com Cc: elic@nvidia.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 2/7] virtio-pci library: switch to use vp_modern_map_vq_notify() Date: Thu, 15 Apr 2021 03:31:42 -0400 [thread overview] Message-ID: <20210415073147.19331-3-jasowang@redhat.com> (raw) In-Reply-To: <20210415073147.19331-1-jasowang@redhat.com> This patch switch to use vp_modern_map_notify() for virtio-pci library. Signed-off-by: Jason Wang <jasowang@redhat.com> --- drivers/virtio/virtio_pci_modern.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index fbd4ebc00eb6..29607d9bd95c 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -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; -- 2.18.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-04-15 7:32 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-15 7:31 [PATCH 0/7] Doorbell mapping support for virito-pci vDPA Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-15 7:31 ` [PATCH 1/7] virtio_pci_modern: introduce helper to map vq notify area Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-21 7:44 ` Eli Cohen 2021-04-15 7:31 ` Jason Wang [this message] 2021-04-15 7:31 ` [PATCH 2/7] virtio-pci library: switch to use vp_modern_map_vq_notify() Jason Wang 2021-04-21 7:44 ` Eli Cohen 2021-04-15 7:31 ` [PATCH 3/7] vp_vdpa: " Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-21 7:45 ` Eli Cohen 2021-04-15 7:31 ` [PATCH 4/7] virtio_pci_modern: hide vp_modern_get_queue_notify_off() Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-21 7:45 ` Eli Cohen 2021-04-15 7:31 ` [PATCH 5/7] virito_pci libray: hide vp_modern_map_capability() Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-21 7:46 ` Eli Cohen 2021-04-15 7:31 ` [PATCH 6/7] virtio-pci library: report resource address Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-15 7:31 ` [PATCH 7/7] vp_vdpa: report doorbell address Jason Wang 2021-04-15 7:31 ` Jason Wang 2021-04-21 7:46 ` Eli Cohen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210415073147.19331-3-jasowang@redhat.com \ --to=jasowang@redhat.com \ --cc=elic@nvidia.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=virtualization@lists.linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.