From patchwork Wed Jun 26 10:26:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13712576 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2082.outbound.protection.outlook.com [40.107.92.82]) (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 B40B717A922; Wed, 26 Jun 2024 10:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719397672; cv=fail; b=RGnDk30p2/u3iIpOv4UmVT7yLSj/WDNZDP+wN6jSdzPnFO5y7YR8B2bKr4su7GU39pbt4rAmtkDwR4KotS4NyM8fVmlU0awOPnkSKIeLWRdR//nz+a/AXMhmSWbex4e/aieT2jrOdelwfP5SKKgihfU+9uYatuNCiByfdKi4b4k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719397672; c=relaxed/simple; bh=Junoj/eHIKvapg6Wl8A4l8G6C2hqJZH79AFaHdqxkvo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nC/TR1QcfEmcTMaxDo3ZVXH/2OlnpuD7F/Z97mkXeBQxp4qOdV1HfqIRxhu3xzRa3oLEk3t3XN8Hbp5rjsuiCbDn5R9DRlCHMTOlnXzmkxofRX710umqD1aL0NN07Ir/T788ChWuS+6hFNf4yvPXbVhw8VpsEpXfYmmCOhBE/48= 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=aoTM0wy4; arc=fail smtp.client-ip=40.107.92.82 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="aoTM0wy4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O2yvOW6kijSadhA5tdXXCszHbxgzz8LSomPSx6vFNiFlC4nlfabe7rkY178PXlFerNeO+1pXoTPZLVjgnWp5edHPIHB3coQl2EohJtywbkp629Bco9qEvIZwT28RamchLxo/DmE5SYog/nvYg/uhkVHIirVWnPpk21wvS/NUGfvoXXY9DIvIX48BP4NVclBYjJulae/BHy2a9+o30tQzEH3lF67h0R1yPEGopcPlhvjYBsx5qHiHfYyfSHH5yd9ACEJWujpL4Gx3FezBVICe/cfPmrbQPEcEmd8qg14tIpxrN6RSq8iMyHDxMsYF0Gp6qCUMRm96oeg93aeaAS0OHQ== 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=UaydSwgc0k9jXa1Ih1usqRxk9t9E5YQR+NHM4Xk+R5U=; b=dQIpxAAZN7JH695PIlo2HL53BmdEfCFbp5sO6SoBxnlWWLc7TFQyTltFBAg1TLaVHmhAj0pi6YyAELPq96ZdQ9+3aqDcPhaH2/Ozr/pYRu2jxp2w93kuV3Q3ZvMH3Bx3Tz4LUugMduf1UKA4g8CY+2UiTam5wsPwHQ3WWTj8pncwcGATKa0zGAggJbAtLoWJhPI658DpTvBqPfVNq1XYPbbwE+qeZQr4fVmCgoKX5zYG3kczm8J8o7cLDfM8fDjus4T9q6joVLoe9PZJPt0yVVOaEr+YLEWVrUQw06aF9bM9uyvd1g7EedYZjj8QNXeWfwTOwizsguLwH99RQHPCIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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=UaydSwgc0k9jXa1Ih1usqRxk9t9E5YQR+NHM4Xk+R5U=; b=aoTM0wy4LmV/I+XNc1p7ednNV7X0tMZpTvcWlSwa4+u1miwqsKLjcBNOE72KiLz3l5pPMaYHZZ1pUBHeTMVrUMRcOmPaXcI6UvArlqaELsTg33pJ6nymrudYhaAuQdsSIxwqmzYuqQQVQVuQr+Qg995+iMPyK9Vb04TCz1ogAsOrpe+d8efKpBgQNwfGI1+jx4UfSi4QtY0a9/Sj+RRM0S8RTVpi/G3rJnwzo8tOSF+L47YklRz70tyKAmNCFpBmqmu5AU4gYUPYq8jljzsO/I1+RI/9jKKFx1HEPvTBZafoMVYMQMyWf8FUYTdaUoAYhoomsuZ54bFfpzpAlLqxaw== Received: from SJ0PR13CA0099.namprd13.prod.outlook.com (2603:10b6:a03:2c5::14) by LV8PR12MB9263.namprd12.prod.outlook.com (2603:10b6:408:1e6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Wed, 26 Jun 2024 10:27:47 +0000 Received: from SJ5PEPF000001CA.namprd05.prod.outlook.com (2603:10b6:a03:2c5:cafe::45) by SJ0PR13CA0099.outlook.office365.com (2603:10b6:a03:2c5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.19 via Frontend Transport; Wed, 26 Jun 2024 10:27:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SJ5PEPF000001CA.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Wed, 26 Jun 2024 10:27:47 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 26 Jun 2024 03:27:32 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 26 Jun 2024 03:27:31 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 26 Jun 2024 03:27:28 -0700 From: Dragos Tatulea Date: Wed, 26 Jun 2024 13:26:47 +0300 Subject: [PATCH vhost v2 11/24] vdpa/mlx5: Add support for modifying the VQ features field Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240626-stage-vdpa-vq-precreate-v2-11-560c491078df@nvidia.com> References: <20240626-stage-vdpa-vq-precreate-v2-0-560c491078df@nvidia.com> In-Reply-To: <20240626-stage-vdpa-vq-precreate-v2-0-560c491078df@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: SJ5PEPF000001CA:EE_|LV8PR12MB9263:EE_ X-MS-Office365-Filtering-Correlation-Id: 81bdc33a-989b-4787-f46a-08dc95ca9fab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|36860700011|376012|7416012|1800799022|82310400024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?97uaTpTsUwFZySpYLgVBFcVtBDyMyEZ?= =?utf-8?q?Qoi1Hy//WIrsE4CJOtr9HaU5ZF5DJSuph45NAKfIJZUkzaIJaUHMTuz1eXibINCOS?= =?utf-8?q?U/Zp0ddQzpMz3OPkG22gg61vWulUI9Wt9zBzYBr/CmYBDPZMdUwcE8wrXQA8vhY/h?= =?utf-8?q?okaOWon08UPLjTiLA97UPXgvB44y2EOE4O4rZ+P2zzJhCkCH9/7eFhAgB1PIR88zK?= =?utf-8?q?ew8PAImd/ShuketPnhi06d7qdF5u99iU71w/DDNHOZc8Mzxr/2fA52Pqxfc7Fu98z?= =?utf-8?q?4igPN94gAISCCZkR1yT4tXuPPbiLFIWqoZob6iABbNPcaY3TkmnqJfL/RSTtbtG/I?= =?utf-8?q?scYHOC590Ny3Lne0QFgMBbEjuSx6C4+HMKw1DjsJDeqm8FPAjAgrnwfqjQ4wL4a8G?= =?utf-8?q?jzma2dsPuK+EmnzGMH4JJVljvjy2ZbUX8mAhJt7jVOCyZUhYTcrqZo6LxV9U6CU5F?= =?utf-8?q?zXrwtHyWtbskGstCY/0I1kh2WXEGYEgUjWfMx+16mLTJO8YPpbR3YpJg7g9q7bQ9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-8?q?UeoBnrS+bOH?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230038)(36860700011)(376012)(7416012)(1800799022)(82310400024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 10:27:47.3453 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81bdc33a-989b-4787-f46a-08dc95ca9fab X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001CA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9263 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 b104849f8477..db86e541b788 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, };