From patchwork Mon Jun 17 15:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700934 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2073.outbound.protection.outlook.com [40.107.223.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7DED146D5E; Mon, 17 Jun 2024 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636927; cv=fail; b=Wxy5ds3/kGASjfwmJhk6trUfjC2vJ9QcNnjRgKAt/OrJg8yx0HDH2vr4zW1Uno7wOzCBzhBYMn6Rjpab0Iyy2QSdpK5W8R4OZWdfPAV7CUNO5IdXPKOXJE2287umpJngRxFhucQz1NbPhh8mOSmKrT6DnGWN8pftQWb6FqrjxC4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636927; c=relaxed/simple; bh=iwGhZMh1OHw5bVe1fl0nsyatgiZFrD7PLgB6yeoDAug=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=c3DijDdRvuYh+MM0tW6RC+0yjy4125tg31HpPwBWcRqePEPR1KtiCSZn0kb+yRMUWTkG9C0x9yDVXrcywLH7mzIUyv8g6x+i3A6Vya+Q7pfqIPA82uUeX1wx+UqRWG4Xxl8+Ty1wtlFpKLwWf+huJcqfa10rIcKVQ5VCOaDVkhc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=m8Zc68mo; arc=fail smtp.client-ip=40.107.223.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="m8Zc68mo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gPJiaixbmbKPKtulQCics6MeVSf+M9FW87VuSD2YfxldEtb90nm+CLtPUuHM5+Ej5mtd76ckFw7SE36x6etQQWTWNnFmnuAFHuVTEnN/5Me6Kn2tD1cqlpzxm6zWfqY+bfk/puhH3f+WHJQ0IGKAKwwjJaSll2DA7phG3/9x9IYwhHgeJq+An0vGNSr6M33oAHHqi4Rme05AClOewfd9ctmkEUqpNpramYz1j1cF+fMZxlbd/gDOwRWSrEb9dkgOtCH9Bbbdwq/sQP/hT3R8BW3Z0VamNFjW82wFBu3nh12z/nLaGmatgi/nJc5BQlT2OPkxQDLzznDEC6b6UCqU5w== 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=vDs3rH07IlW17NOLbrgcs9vPd0t32D7YqSbTvJWyRnA=; b=e/zFmHbr8COaNB6CySOB1ZCY8/x1n9HNzovscbNNoid8CoXW87YhpRXXuB3BUwqT6ES+TrqilB1aYmkilf6goDEB2RXuHxw8gvTIvJEKrI2tvopS9mkcxXVC3Caf0BvKFy6Gmlf4dNqIBA4nCiR74+KyGH+U16ePNLmW4UjTrjRPy3LaCKA/tXWH1zMtJWwidC2FFmX+iGsul3TmmJyPWt2nkNtulPfdb6pYUcJsYzlg0nhejpDcwe6nat9Uvu27/wLFI4HXXDcBTByPo86WDCCFBBQJuR2C6fnHAvhKQO3X8XFKKzkazmt0rBywgXV+6NOhtGt/rNRSEaUTCDssFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=vDs3rH07IlW17NOLbrgcs9vPd0t32D7YqSbTvJWyRnA=; b=m8Zc68mo3AIqdWtns8tm6LWMP7DeKZ64xCBR8EBlpb3Egk1fh0KqZYpYP/nFK+FTWa0CPf17KNHjghlDxhuJkrrin+pgP+w3gEu9QQwQ5ArTpgFAmuLt0HS9ctd9+X3ICYhGZw4cy1ld6ikJjn6lK9ghbRuyOZ4Fwq8FUN/tNcDDr8MIfb79qOQ5TPe4nCcMJbJMYRBryenbpkQDF5sZVb0h3fuyo49NNNlHqp3wqzZfktGgbOuZTV+a5AYhJWNDO0muasLC0JgqXnoNWNTA43Hb6uvXheEl7E1ve74ab/IPZfQDD/a2cM0apQIa8t3SD4MfVuUrIy04M0v41bMLcw== Received: from SA1PR02CA0001.namprd02.prod.outlook.com (2603:10b6:806:2cf::7) by PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.28; Mon, 17 Jun 2024 15:08:41 +0000 Received: from SA2PEPF00003AE5.namprd02.prod.outlook.com (2603:10b6:806:2cf:cafe::a3) by SA1PR02CA0001.outlook.office365.com (2603:10b6:806:2cf::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE5.mail.protection.outlook.com (10.167.248.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:40 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:27 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:27 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:24 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:44 +0300 Subject: [PATCH vhost 10/23] vdpa/mlx5: Add support for modifying the VQ features field Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-10-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE5:EE_|PH7PR12MB5712:EE_ X-MS-Office365-Filtering-Correlation-Id: 344cd847-2a62-4020-0bb1-08dc8edf5f7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?xtG9H3rV+Wx7KVvZuzqNepGZLfRJI3n?= =?utf-8?q?2oakSzZvPTqMN3W2g2E1JlUmtyjYyFMgPZ618IilTMpQlFTvjkcOFjc42cSOkCkm4?= =?utf-8?q?ZDJntEJ8tDogArHPvkqnm46QjVdgdAyJ8v6b0n79kt9o+dbfzyV11O5O9KWyLcvWR?= =?utf-8?q?LSNaSgnxyxg43SLjJSh+M2fDdSUae6kQ5XXzNvhk2YRKNu8ES3iYcNEL7I09psIUR?= =?utf-8?q?njZ6N8E/tBnAeHmIItD5GBgbY3KDoT7D7ePfeQcDGv61/AGSLFCza/jCWxi56MD8m?= =?utf-8?q?SIYcGU3MTaz8QrJWzRYiKJ9FNZW1XIgQCE0wrhKaqxWn5o9ZfcPNHsFz7Q+YfpJec?= =?utf-8?q?1HVSXyWruYAH6ycoCCzuRhSmBnIWeZ428EdluYipZenxU/g8Av93hRyY+i9H5JSgM?= =?utf-8?q?cgPau3oTtemNB8rpgc0NLmrJKcVIJSRZsGFcUia2oFwWdVLBeAaV1neSUx26yOnxM?= =?utf-8?q?mHwh+bbSUs6tLWmn6P9HcszGxJdRNNrpLuUnbADRaXTd0C+YZ9BHgUY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-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(36860700010)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:40.9465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 344cd847-2a62-4020-0bb1-08dc8edf5f7e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5712 This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 +++++++++++- include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b60e8897717b..245b5dac98d3 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1287,6 +1287,15 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES) { + u16 mlx_features = get_features(ndev->mvdev.actual_features); + + MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3, + mlx_features >> 3); + MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_2_0, + mlx_features & 7); + } + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY) { vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; @@ -2734,7 +2743,8 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; mvq->modified_fields |= ( - MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION | + MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES ); } } diff --git a/include/linux/mlx5/mlx5_ifc_vdpa.h b/include/linux/mlx5/mlx5_ifc_vdpa.h index 34f27c01cec9..58dfa2ee7c83 100644 --- a/include/linux/mlx5/mlx5_ifc_vdpa.h +++ b/include/linux/mlx5/mlx5_ifc_vdpa.h @@ -150,6 +150,7 @@ enum { MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64)1 << 8, MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION = (u64)1 << 10, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64)1 << 11, + MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES = (u64)1 << 12, MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, };