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 B2EFEA00C2 for ; Tue, 9 Aug 2022 16:57:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 928F440143; Tue, 9 Aug 2022 16:57:01 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by mails.dpdk.org (Postfix) with ESMTP id 21BB8400EF for ; Tue, 9 Aug 2022 16:57:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lBx4/CM4k+jbS1Havik6KLz49WdeIdXBbMHTJ5Js7i1p06lyuUePA6RtCgPc00cxEYI+E/7q9PojuZBWcaSb8qo/mvrz5tFSw97WX8lXp0Hix407BOozA4peYTysfO/9p2166o5kmnEI+Hhhu4BjNd/0AQ65h5C8FSsIwLvfCOAT4vpv0Wm+c7w3Bai+soUZi+oiWlrU/R3WU/qJ36aGFi1r0l0pIwhqZ6uWt/xOtGF9OV3NlOzKZDeBnl3aE9QejQxNPp1eGR9eSZwGtNoa7ar6yXUn9UWUVUjDA4ZlBtRuLjgg7CM46zYJZ6oL5gZOLOozww5b5ejspqrK2rJ/dw== 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=3pyW1uj/zYaQzaSi9uv2MfZ2PKyOTR0kRylk7tfcv/E=; b=XrCrgqYzEXCF6dO6yBt9jsD68nQFlzuqySloyuioUfqQILls+zZP7CjDJFFivRdYSVsCQMttlZrAmjzBpTmTwzy3aEZGluMvzdUomNI6bm9BhHelN2WowVZYlwiCvJy5+o/NtmRcQclBlFUSvICSiMwBj2Se4EgcjY3TBjUKAAi4Bl1EnXf8vbMivATz4x8Mqhe/QgMuMWTMIkYc3WkYWNkqTBd2T4H9sxex456hkfZ3T6UYVTUUOyVC2D81fJskBau1WO0E4cbbYOYtbwTQMQpVc4+TewGF/eweNSygNHZrdoXyny4zlpmgLOycDOEWAchWq7a9A3kmFP9GiFP0Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3pyW1uj/zYaQzaSi9uv2MfZ2PKyOTR0kRylk7tfcv/E=; b=PlIn4SM544PbO3ZqGVmVt32osFao6UcPjbJcJmzRjaiMWBQiLukVZ/nzkuPYoxhYwGbT5hesEbdhIsmIDCkKkAxsrP6sngKjfl3FfhbT9AhHqjqmqUKMipk5ay/osJSa08S+MwA8Yz+QzGF6kldLnzoeo+qlE/u4tl1AcBVElqFuhde31LuwaBP7/6Zc0pcVuGODXzAcze9eGnHMEGtjMZoviUW0Zau/MlfYj9rMjpZApYAJNzqWFkecdr1FdH19M0KDTdrhnXC4OFccTiZVEwwTuLS8CP3EKnHJtzAatjqQgsYW3ZsFKyxie93ORLxcX465zLnSdE+pAE0t5b48QA== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39d::14) by SN7PR12MB6886.namprd12.prod.outlook.com (2603:10b6:806:262::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Tue, 9 Aug 2022 14:56:58 +0000 Received: from DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::8f0:3589:7050:3d9]) by DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::8f0:3589:7050:3d9%5]) with mapi id 15.20.5504.020; Tue, 9 Aug 2022 14:56:58 +0000 From: "Xueming(Steven) Li" To: Yajun Wu , "stable@dpdk.org" CC: Matan Azrad , Maxime Coquelin Subject: RE: [PATCH 20.11] vdpa/mlx5: workaround var offset within page Thread-Topic: [PATCH 20.11] vdpa/mlx5: workaround var offset within page Thread-Index: AQHYnMTAuCIwdT+fLUa+0AzFO0vaK62mxvTg Date: Tue, 9 Aug 2022 14:56:58 +0000 Message-ID: References: <20220721054239.378884-1-yajunw@nvidia.com> In-Reply-To: <20220721054239.378884-1-yajunw@nvidia.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=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ecf280e9-35a0-4713-5c34-08da7a176888 x-ms-traffictypediagnostic: SN7PR12MB6886:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2OSl0xTfQEMJ8k8rMuNCtgnIaJ7Jwa9tFIiynrw0NCPIgOFuBz+lsDwl6FDi7eBayA/f+TEzlxb37fuYqDUQmP1G27OF5JMAjtX5LcUyg5UbcCksJH20JTA4QI1ZPJPpmPNlr+t8gJb3LR2mAnc6gPeDJLXdfie+5/3JKnKfdf12EYzPf/02i2965RenehPZLCT4raOpa/8Y1G2FFLsPu1cJr6a+T3SizgJY8Qb7G10ZymswsgG/64w+CakSlT4xotAe91w9Rtm3a8WH8pincqDTuVYd+jeF6ESnmg++NMUNdw5q7wNrs7MbklC89JwFvBqT9CKyC2rloQsgT8XL0tnxBA4GN+Xk3YqtuTz1CqPVN9+YPD+WivFN1J/PEL8oxTAfNlFrZtp9Xvpdpd5pJbYWagrAGUXCq1MCH/jFxcYt6FKdDvXDGuVB51m1TZmhbMjHT8+6qltqwRYlEazi134IQ4C3OdxWq1OVA9931uRyQZpF1mh7X5sl2cg6RCpfAuxCdOHX+L/bd2Dvewhq7EgYRICndyxfHEGeVyAOBl+UDvFHyIT3TrQ1DgL9xglH1IbUq7dAGr2sysFzKA0Kwa9pXiQW9nm+Z5zlqjr2QXla8jTXVDW1YEm5dvzK4qzMHfcl4lLxoWiUSCwzPE29puztCzLqEIP15CRufNIaKiiiwBfsstKsReO+7NZ4v05xxnswR06RMqWt0CgoCL8j6gE2rsBxC/dt4nChV8V3tJPyFwDopAb4FuJYMfTyriOIskM5EqxRc1WiwJP8GY1R8Rm41hk5gpK4fszuZeNe0JcHj7EoDZByFYRx0owoL7yS x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5373.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(396003)(346002)(366004)(136003)(376002)(316002)(4326008)(66476007)(76116006)(64756008)(66556008)(66946007)(66446008)(8676002)(7696005)(55016003)(2906002)(52536014)(38100700002)(122000001)(5660300002)(86362001)(38070700005)(8936002)(33656002)(478600001)(26005)(71200400001)(41300700001)(54906003)(110136005)(83380400001)(53546011)(6506007)(186003)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?FQ2zkiOn6oQkEMFNnjs0vK4qYRWiGuDKTGYm8ubYTGo8OEJ8I6SNuVjprzj4?= =?us-ascii?Q?Dzgm3EqrfKInrfw3FrjZYSEYrGHFUyuZ2VNzENiy3JfLsfGbRw+Iluds2+8+?= =?us-ascii?Q?DEnFTt4Wnvg9bypHicQYRqL+bBLDpxwy70RfsUoShKrWdb9r4VQS1A1B1MC0?= =?us-ascii?Q?NMCC5d1ZlkQKYL1CLYjBFrUWL+WRwwA8tmfLx6MP6ILGo5toJUW7t7DIBW6B?= =?us-ascii?Q?ahfozDkf9NSIx2yo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/MzIUz?= =?us-ascii?Q?cQVUsC4JUgQLI1cNd8dw32fr6blunEf+H6+NPLCI8mMWkaApgdhuK4ezoYiB?= =?us-ascii?Q?YuOS4MWcALErlQP9i+Veb8CPQe+GmT95ddGFWSrep8U6NVNukMTwTPPBvJNN?= =?us-ascii?Q?kbXmXCnliPClOz5NMM7BWvZukcK9ZKsb3aUb84xWSBo+fK/fZ9JnyHMC4UNp?= =?us-ascii?Q?BaCqfVX20O9g7lxHvTFBCfQUaKuNbcYE/SxrsLnNtI7VMw4gI8AoCZVzyvZg?= =?us-ascii?Q?CnWRddBgc/RlUbQuUE8dpXDrtBtWsAoWYD1klbvUPpgG/qi6YwXf143090SN?= =?us-ascii?Q?jqJt0q0/qMVrLMRvdxLJ7ZKXFH7XatkzVivjdZ2dWsIQ2pecaxG8st8kD9Bc?= =?us-ascii?Q?ZtZIgfu24TgTU3MUOpfCwoD5YrbUvpwFjUbZxX6YsUw16cTLGRX+JostJRuC?= =?us-ascii?Q?oVzAFWlTZivScjkaP6CI0sSFBOoxct7kpWyUhpiv?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ecf280e9-35a0-4713-5c34-08da7a176888 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2022 14:56:58.2481 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: j905fUmlXovp4OH5IxYs/NMhHAad+a4JbZ/dBgAn1BWtfffa4dmmresjjUXv5RyMcYeviMYwUDJb+S75/s0e9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6886 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Thanks, applied! > -----Original Message----- > From: Yajun Wu > Sent: Thursday, July 21, 2022 1:43 PM > To: stable@dpdk.org > Cc: Matan Azrad ; Maxime Coquelin > Subject: [PATCH 20.11] vdpa/mlx5: workaround var offset within page >=20 > [ upstream commit 95af59b7ad9f6a465de2ead9ef709429678e750d ] >=20 > vDPA driver first uses kernel driver to allocate doorbell(VAR) area for e= ach device. Then uses var->mmap_off and var->length to mmap > uverbs device file as doorbell userspace virtual address. >=20 > Current kernel driver provides var->mmap_off equal to page start of VAR. > It's fine with x86 4K page server, because VAR physical address is only 4= K aligned thus locate in 4K page start. >=20 > But with aarch64 64K page server, the actual VAR physical address has off= set within page(not locate in 64K page start). So vDPA driver need > add this within page offset(caps.doorbell_bar_offset) to get right VAR vi= rtual address. >=20 > Fixes: 62c813706e4 ("vdpa/mlx5: map doorbell") >=20 > Signed-off-by: Yajun Wu > Acked-by: Matan Azrad > Reviewed-by: Maxime Coquelin > --- > drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5= _vdpa_virtq.c > index 0ef7ed0e4a..952e641425 100644 > --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c > +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include >=20 > #include >=20 > @@ -122,7 +123,9 @@ mlx5_vdpa_virtqs_release(struct mlx5_vdpa_priv *priv) > priv->td =3D NULL; > } > if (priv->virtq_db_addr) { > - claim_zero(munmap(priv->virtq_db_addr, priv->var->length)); > + /* Mask out the within page offset for munmap. */ > + claim_zero(munmap((void *)((uintptr_t)priv->virtq_db_addr & > + ~(rte_mem_page_size() - 1)), priv->var->length)); > priv->virtq_db_addr =3D NULL; > } > priv->features =3D 0; > @@ -485,6 +488,10 @@ mlx5_vdpa_virtqs_prepare(struct mlx5_vdpa_priv *priv= ) > priv->virtq_db_addr =3D NULL; > goto error; > } else { > + /* Add within page offset for 64K page system. */ > + priv->virtq_db_addr =3D (char *)priv->virtq_db_addr + > + ((rte_mem_page_size() - 1) & > + priv->caps.doorbell_bar_offset); > DRV_LOG(DEBUG, "VAR address of doorbell mapping is %p.", > priv->virtq_db_addr); > } > -- > 2.27.0