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 D1FEA41E29; Fri, 10 Mar 2023 07:10:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C29F5410D0; Fri, 10 Mar 2023 07:10:13 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 1058E40150 for ; Fri, 10 Mar 2023 07:10:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678428612; x=1709964612; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=G+y1YMsq5xy8ZOP2NQiTKyFB0IeNycTS9On0GVpkKfM=; b=FrfNmLQESD080efmVcdyWle5yG+vG6n2BD8E4CXsV65XweZhTgrif27t uZR5gQtRHRKliUm9ZeyoLCCdPXDMXulYqopFAmig/IhnU9vDjuI/lvewh ZsFQGCDjoTpEPYBnRNZPlvOB/dOkwO5hNlyH1tIwh+LRloL92tfFQ2xoD 0GHZ5SvJZKLqQxQHIkMDtcpIFkXhyKj8+lkJ4SaqMt0HpdLQuMV0sBqd9 YEfPvPw4V/+97RE1/lfXYW9Fr8PnR22HBdHJ8G3vAJ73QDYz5qX3elnna J37+jZcrBU6G1bJodiSqoqQYFtSFZ4+bcUDC4cVG4uhKorQxdhpXEIFBn w==; X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="325009162" X-IronPort-AV: E=Sophos;i="5.98,248,1673942400"; d="scan'208";a="325009162" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 22:10:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="677689222" X-IronPort-AV: E=Sophos;i="5.98,248,1673942400"; d="scan'208";a="677689222" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga002.jf.intel.com with ESMTP; 09 Mar 2023 22:10:11 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 9 Mar 2023 22:10:10 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 9 Mar 2023 22:10:10 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Thu, 9 Mar 2023 22:10:10 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Thu, 9 Mar 2023 22:10:09 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YzzgWKWIrQtIwdxlpk+d4ZE09ftEbELmPOp9EM2ijqP9jNuYoOKgvco4A0Sko9CYJSNgvHHJrySSbYXgkv+MCVTu2mGSQxS3+zxv23OAG1lEGAtVmIzkQlarblMYb0t7Mkgb4xgot49ItJAKuvmR0qjgBSNAxissfaMNPwXX2dHZ7Dg+b/rZW8QlGJiWLCzCWMz/glps+mlXYGv2DLsnJr62JKiT11uuWSIKHLM7a+2lcaPImqK1hlv+Hbz8yESB7h4HpgIzEmGRC9nXD408XEVlUES7fLjEVXTb9vsJZPF+DXWRp5yZ8jYEkEApUjRqEttxCYGFbKBzIyasm6egMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4QRJ8k6kqGw9c2WcY9QCoWxc5ZaSvLsyqgv6GfLOOpc=; b=axMBuBUql6lIftgGI5tcdvK8yL5p6dWqT624nhH9OG+jl9dY5ag7ZbjZeyX+PzKCzYjUI3Lyvu+ViGDVtUYCFhQvIevc7YoowIAYXSd3gGE7kjXSWrWN2/ZqBfFA87KqwCs84QcYrgYPys/HIg8+LwyI/3wCTEuJB1i5LbIr+bXQ2HV3iuTuVTSjQrTXinibzcywVFruM8g3S/Qex48liR4CRlayXngMFAysOsBWDkXgrHfE8grLjfgz0YgZmp19AWDEkVUquQLHgaKgHmTmOUSczHDoPvkijtsQq5QU/PG3Qs52nBEvn4OzIUeWEVUBCztOGDYCNJASqFoxh0FERQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM5PR11MB1739.namprd11.prod.outlook.com (2603:10b6:3:111::22) by IA1PR11MB6513.namprd11.prod.outlook.com (2603:10b6:208:3a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Fri, 10 Mar 2023 06:10:08 +0000 Received: from DM5PR11MB1739.namprd11.prod.outlook.com ([fe80::8bf1:c091:e399:87bd]) by DM5PR11MB1739.namprd11.prod.outlook.com ([fe80::8bf1:c091:e399:87bd%7]) with mapi id 15.20.6178.019; Fri, 10 Mar 2023 06:10:08 +0000 From: "Pei, Andy" To: David Marchand , "dev@dpdk.org" CC: Maxime Coquelin , "Xia, Chenbo" Subject: RE: [PATCH] net/virtio: remove address width limit for modern devices Thread-Topic: [PATCH] net/virtio: remove address width limit for modern devices Thread-Index: AQHZUpR6Mn8mIOYnfkmNLI43aU+eP67ziJdQ Date: Fri, 10 Mar 2023 06:10:07 +0000 Message-ID: References: <20230309143604.2354288-1-david.marchand@redhat.com> In-Reply-To: <20230309143604.2354288-1-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM5PR11MB1739:EE_|IA1PR11MB6513:EE_ x-ms-office365-filtering-correlation-id: 5ed30a12-a585-4352-16a3-08db212e190e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4G6VR+sZI9VJLSad7Yx4RuO1E7ONao4fPTRMypWf5urvOfgbN4aT1lK7/S1gx4cLLCwDPpYpP+mAfntAGDkVe5L7rVfzjfhuNDeriQEEmanfOZ4LvdR6xAKy4ye28TDWoRA8LtvCFJy/JOsQLbTmmfA6zM15s5EnjulFwAEnCBeG4A467IJvy7w46TnNgFtWtJkL+w+6RqJw1ytRSIuEvelfz5HFmPUbC/tIgoGTld0IIZpoIUrtn8AWJNiC9RchIIMSR/mZtU8SDiZCJUjRWWPJR5JW4Dnt5DeNzYa+nhZ1bCAnAf3n+QuQ/7OH8fmhdiOiDn61r4dZ6XjsTKedBataadNtwqOqvUTULjowRZqFVlvsCXOgbUK8Qmmm2eEKIOmlc87Z1zU8uSV4JPcOOU5SFil6lbnOaDhjJciLinyop60cHOqgRkJMru1i7gUQqlHiiSGcBfpuPdUBwvSMu13dhnve80vn/Ogxt3NyDRpPvdpK/7/DghIs6wlmpVDauk9ehn0NBb5WS7moapy7zUIX0BGzTHvcOmxixVznFRVTmVISqdPL2ijJLbapi4i7F/Co/ZUBDOiGwlQEpfrK008l6QdfEzExkxL2w4IRMBNChMSk4Dc7S46dvJggfF9AJstF3vWlO6O+FpTNu47ALZSbu/lgJ25gv1FZC1B7p3b/dgwQxgMH9kyXkEdWFIiC3KdMVHJQ8JK/9mTtR5Z6SA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR11MB1739.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(376002)(396003)(366004)(136003)(39860400002)(346002)(451199018)(82960400001)(122000001)(2906002)(83380400001)(5660300002)(55016003)(33656002)(52536014)(66556008)(66446008)(66946007)(41300700001)(64756008)(66476007)(8936002)(76116006)(8676002)(4326008)(38070700005)(316002)(478600001)(38100700002)(110136005)(86362001)(54906003)(7696005)(107886003)(186003)(9686003)(53546011)(71200400001)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?OXo0ojv+kInXyZmum/OFtMpRaI+ynQN5Nmp9LMYp035PrwIESL63qbvMfVeO?= =?us-ascii?Q?EmwB1jxfo7bsF1nougGCe37W1xmY8dU9u9+4x1t+fOj+GIAf37v7a5a192bm?= =?us-ascii?Q?Q+f2xzuaw4+5ncyj4Jx/pxxEFjxOUHsQYG9PmAQEfybtaRICTbDkIVwXnFfC?= =?us-ascii?Q?SR51GvWLliLTds0hvpK4VcqQ6pQH84bDd9pwwlsMk5O5VIhEt2HCn/0FoqlF?= =?us-ascii?Q?ddQGk46b4t9LQ7txSJgRyHISL73HeO9t0mhwNs1ZqYFJUIO6VkhSbjFzYzCj?= =?us-ascii?Q?/6XS21o1Svahv47X0FyamxUBTSIiOF1/4AZNbQ1QnqDRdG4BYqJJMaebbeUW?= =?us-ascii?Q?TJcdILMgpDHvHL6p7QW6K/OOaMqcBoo9duN3rcHpTJq6yLaXXu3NwSC1RRcY?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L/Vg0dRlGwXOeNFw0y40Pyb5q?= =?us-ascii?Q?exHkeGQ/aueKusO8dtbwRxjNx1rAGpm91NydQJ96chDJGSewlEswMr3uFSiH?= =?us-ascii?Q?DG77swvXeTkRJQ8ANExC7r2T401ig8deBm6HvPILHwkoGEX6iKZxY1HlXB0O?= =?us-ascii?Q?kP87G+Q2qGZs2mynp2HuO1jlYc9Izhu6GKI9S8v7AmPAJOxAwRMBJI+coDz9?= =?us-ascii?Q?wEmyjhor6sKWnMtjOJxvvrPB97YsUbBgUxT/LQgFu7u9jCnH0CoRro6tcKId?= =?us-ascii?Q?4guXP7pnSK6V5fV+ayreTqexqgs/4Ki5ylh+JMzQKAxPGYcjF+52la+KKdeT?= =?us-ascii?Q?Zl/dAWftjGUCFUvYsVdS4JWS8Rii4GSs0ikwwtawU32F?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1739.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ed30a12-a585-4352-16a3-08db212e190e X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Mar 2023 06:10:07.5466 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vDTo7IYOn0bTKlcpPy7Yf5s4mgfyotbuJae0AWwNeHmWUBXmx6U3NydbyJ2dzRwsv+o+vVb8Lm1MN2AytCyn4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB6513 X-OriginatorOrg: intel.com 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=20 > -----Original Message----- > From: David Marchand > Sent: Thursday, March 9, 2023 10:36 PM > To: dev@dpdk.org > Cc: Pei, Andy ; Maxime Coquelin > ; Xia, Chenbo > Subject: [PATCH] net/virtio: remove address width limit for modern device= s >=20 > Modern devices don't have the same limitation as legacy devices, because > vring addresses are not configured using a 32-bit register. >=20 > Signed-off-by: David Marchand > --- > drivers/net/virtio/virtio_pci.c | 28 ++++++++-------------------- > 1 file changed, 8 insertions(+), 20 deletions(-) >=20 > 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 @@ >=20 > struct virtio_pci_internal virtio_pci_internal[RTE_MAX_ETHPORTS]; >=20 > -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 >=20 > static enum virtio_msix_status > @@ -273,8 +257,15 @@ legacy_setup_queue(struct virtio_hw *hw, struct > virtqueue *vq) { > uint32_t src; >=20 > - 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; > + } >=20 > 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; >=20 > - if (!check_vq_phys_addr_ok(vq)) > - return -1; > - > desc_addr =3D vq->vq_ring_mem; > avail_addr =3D desc_addr + vq->vq_nentries * sizeof(struct vring_desc); > used_addr =3D RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail, > -- > 2.39.2 Acked-by: Andy Pei