From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E683941E0B; Thu, 9 Mar 2023 15:59:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5ED6427F2; Thu, 9 Mar 2023 15:59:21 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id B3A0140ED7 for ; Thu, 9 Mar 2023 15:59:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678373959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uMqYUFe57YiQHDC3htqGpkqzbmWX301hPlbFX95lw2g=; b=dtGajjP7P4rDPcrT7bvUppO6ufZcoqrZciDs3SAwuwJFO27Lp2BXTybqNm5HAEKaYsIgup Lwx+grodkj+eGlodgChumGd7SrlREG5hp8SvRHRaY9WwvhL4CPReuSQMaf1PdGSJ3ktZyk LwVe/VQ7VIaCDNdweRZjzkbmHSVsrno= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-537-YcEUbs6CNOCqR_f8MjHEWg-1; Thu, 09 Mar 2023 09:59:14 -0500 X-MC-Unique: YcEUbs6CNOCqR_f8MjHEWg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B90E101A55E; Thu, 9 Mar 2023 14:59:12 +0000 (UTC) Received: from [10.39.208.18] (unknown [10.39.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB0D14024CA3; Thu, 9 Mar 2023 14:59:11 +0000 (UTC) Message-ID: <52cb8334-301e-5014-6598-861a5d0677ef@redhat.com> Date: Thu, 9 Mar 2023 15:59:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] net/virtio: remove address width limit for modern devices To: David Marchand , dev@dpdk.org Cc: andy.pei@intel.com, Chenbo Xia References: <20230309143604.2354288-1-david.marchand@redhat.com> From: Maxime Coquelin In-Reply-To: <20230309143604.2354288-1-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi David, On 3/9/23 15:36, David Marchand wrote: > Modern devices don't have the same limitation as legacy devices, because > vring addresses are not configured using a 32-bit register. > Do we want to backport it? This is a bug in my opinion. Reviewed-by: Maxime Coquelin Thanks! Maxime > Signed-off-by: David Marchand > --- > 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,