DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	Andy Pei <andy.pei@intel.com>, Chenbo Xia <chenbo.xia@intel.com>,
	Yuanhan Liu <yliu@fridaylinux.org>,
	Huawei Xie <huawei.xhw@alibaba-inc.com>,
	Tetsuya Mukawa <mtetsuyah@gmail.com>
Subject: [PATCH v2] net/virtio: remove address width limit for modern devices
Date: Tue, 14 Mar 2023 09:53:34 +0100	[thread overview]
Message-ID: <20230314085334.3656447-1-david.marchand@redhat.com> (raw)
In-Reply-To: <20230309143604.2354288-1-david.marchand@redhat.com>

Modern devices don't have the same limitation as legacy devices, because
vring addresses are not configured using a 32-bit register.

Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/virtio/virtio_pci.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 9cf4d760b4..29eb739b04 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -33,22 +33,6 @@
 
 struct virtio_pci_internal virtio_pci_internal[RTE_MAX_ETHPORTS];
 
-static inline int
-check_vq_phys_addr_ok(struct virtqueue *vq)
-{
-	/* Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
-	 * and only accepts 32 bit page frame number.
-	 * Check if the allocated physical memory exceeds 16TB.
-	 */
-	if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
-			(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
-		PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
-		return 0;
-	}
-
-	return 1;
-}
-
 #define PCI_MSIX_ENABLE 0x8000
 
 static enum virtio_msix_status
@@ -273,8 +257,15 @@ legacy_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 {
 	uint32_t src;
 
-	if (!check_vq_phys_addr_ok(vq))
+	/* Virtio PCI device VIRTIO_PCI_QUEUE_PFN register is 32bit,
+	 * and only accepts 32 bit page frame number.
+	 * Check if the allocated physical memory exceeds 16TB.
+	 */
+	if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
+			(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
+		PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
 		return -1;
+	}
 
 	rte_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
 		VIRTIO_PCI_QUEUE_SEL);
@@ -476,9 +467,6 @@ modern_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 	uint64_t desc_addr, avail_addr, used_addr;
 	uint16_t notify_off;
 
-	if (!check_vq_phys_addr_ok(vq))
-		return -1;
-
 	desc_addr = vq->vq_ring_mem;
 	avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc);
 	used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail,
-- 
2.39.2


  parent reply	other threads:[~2023-03-14  8:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 14:36 [PATCH] " David Marchand
2023-03-09 14:59 ` Maxime Coquelin
2023-03-09 15:08   ` David Marchand
2023-03-10  6:11     ` Pei, Andy
2023-03-10  6:10 ` Pei, Andy
2023-03-10  8:07 ` Xia, Chenbo
2023-03-14  8:53 ` David Marchand [this message]
2023-03-16 14:46   ` [PATCH v2] " Maxime Coquelin

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=20230314085334.3656447-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=andy.pei@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xhw@alibaba-inc.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mtetsuyah@gmail.com \
    --cc=stable@dpdk.org \
    --cc=yliu@fridaylinux.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).