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 0489DA0C4E for ; Mon, 8 Nov 2021 18:21:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E294F41122; Mon, 8 Nov 2021 18:21:54 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2055.outbound.protection.outlook.com [40.107.92.55]) by mails.dpdk.org (Postfix) with ESMTP id C3FF8410FE; Mon, 8 Nov 2021 18:21:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NEd9tCbBOLE6y/qbnXev/kILLliT36l9N9UiwBFN7ThOHZrAiAj9qmJ+Yqpt1amWhC5t6Z5kinrxVvAGajWbe5Lz3/Kg+z0JgqE7SAKW/w6pTCNjg3Kcc4zP//d+ZK5U3woS6wPKz9wLg1qj1XHXRMiWAKOa61u/C/diTq1YY0BU1biYCFtl/FNR3wRx/GzayY8fh43+PWr1RkNhWggewyuYGwGcqho9rS7yi/6DmqjgdS1T6Y3uM3nO3nzL5apxSmMVPGTsq2qrCyAAkPYSt2KJJlNtBmQn/EIfmcrVkRJKk07/ir/CDx2HggG2WFtv5dD9JZSNHO7o2JNSgPwOOg== 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=G9uUqQq2VOE/9HNinc//JGh2+GIrem6wy6eY4br6hp0=; b=Jvkmql/Lm1l7wrvP/F3OgT/papk1hvO4DA7aKrnwVOo5YVkRsg44juSaSdilkGGELXABP1OC0f2ggxpy7WwuoCVixBHwJi5fMIuR50jpMrER0lB+SHcNiuFvxsnOIFdSLFkrBK6VxLf3ML88jozJ7XIrPmUDTVnlpgPH9nAPJByWyTFHHrSW8sMyN7ZiEOGhApI1nY+UHfo59XGkZn5LGIlPCxHBS5B3jAGSrTPAjHaAq6V9Kw75ORo/pUn+vFeEKC3aIPb27iK3KKTZYcaJwBtR/hL/klm9gQfDKN/MlE5cwGQYCh3afxpvrkGtzh9nxyD2h6akRqLnn5R+ZfLdJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=G9uUqQq2VOE/9HNinc//JGh2+GIrem6wy6eY4br6hp0=; b=qsQAORU6Nwky548GvIOAbBQuMn+8zntDgGB4Huxd5WITOGZ7XPEjgoYeHaPzNM/LVAFxdf64WoEP0DoBpHSSRSq1QkA6L30jiSh0QycrapjxoQqhSmlYzP6dlfJcNSJd38BWfaimdOtCkVyyJHXLNgA0e5RFqOAYSqkNvtu+VLjkUDpq9nyolxmQFqycthlpU11BQqggaPYrKB02x0LQsxJsTqt+u+TAqxWwOtqQQp22iouH8vARB9yQCqTm4n87M7uAmSfV6rHCWNnw/JWXJezviNqR9Oabhujy3Nw5bQPxHRLo0wkMiWR8oGGAIEAZiluHxEAvtlJRra4p2GxJQQ== Received: from BN9PR03CA0280.namprd03.prod.outlook.com (2603:10b6:408:f5::15) by DM6PR12MB4234.namprd12.prod.outlook.com (2603:10b6:5:213::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Mon, 8 Nov 2021 17:21:51 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::c) by BN9PR03CA0280.outlook.office365.com (2603:10b6:408:f5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Mon, 8 Nov 2021 17:21:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 17:21:50 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 8 Nov 2021 17:21:36 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , Michael Baum , Date: Mon, 8 Nov 2021 19:21:09 +0200 Message-ID: <20211108172113.2241853-2-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108172113.2241853-1-matan@nvidia.com> References: <20211107152919.2158802-1-matan@nvidia.com> <20211108172113.2241853-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3527e1b1-515a-4045-7240-08d9a2dc4078 X-MS-TrafficTypeDiagnostic: DM6PR12MB4234: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:348; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r7L2maAcB60ZyQNNQfqUTRnVI6OGqjIEouejONZcrJ4CcpnlJH2WtjhMc3C0XHdBAywMHIqQzr1fs54lAOj667xkORr0dqa+eCxwp7Hlgliw75wCNeb+mXrtg+SsCbj2g0FlPFGAJgFupUCt16aJ38BFLQNVBB2vmJ+QB1F5HVHDzcrqgpxQJWM24GjecVKtoQOODZcJ8VZmAK6+AAH9Hiu3AuVyhKA53hFTD8Ma5FpIt/G5ELwKkwAPAr07Pbt+p42lcp0FeLdBhg5sTB9hKOgDL4ELjQKWen6Vd9OIu5RQy0hWmP/rsDufoH/mFUr+sm8eZ6k0N5doo4aPd7XRwTmNDq5oQeYr0ZEpkHLbw4hj3vh48Kl6iXzfHlH8dmTsBy3c143GG/+H/kM9Muj2BGtyYwhG2ShBy+641cgjjMWv7xGcy0uoi83BtjeyzSsLza8MTRY5MWIVr/usS6rYOepUooA1GGuyL/0cmUeqeeX2KBVCdcxWzUrD0yqpPtyiQmdJZhqEb+BNRo1EIdYlN0K9x+p5+65rPWnC1QsEfUqdz/WezCDmESv8cg/+B+c7plK3dyqPwi8s3UmRhQV4l4AMeqYvOSECeDsMAD6UXW63tb7LXXS7/nJcZ4Tn7XCkLv6ibQpC6OySr4rIwgwLpXGbD+AiKCgzL3I383Da0M6KpGxhNbGZTuDadfNH9pFKj73MKDhjqgmQ0Y7UKAKIag== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6862004)(26005)(7696005)(55016002)(16526019)(186003)(508600001)(86362001)(7636003)(37006003)(2616005)(5660300002)(356005)(8676002)(316002)(36906005)(426003)(70586007)(4326008)(70206006)(82310400003)(8936002)(336012)(6666004)(36860700001)(36756003)(1076003)(54906003)(6636002)(6286002)(83380400001)(2906002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 17:21:50.6057 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3527e1b1-515a-4045-7240-08d9a2dc4078 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4234 Subject: [dpdk-stable] [PATCH v2 1/5] common/mlx5: glue MR registration with IOVA 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 Sender: "stable" From: Michael Baum Add support for rdma-core API to register IOVA MR. The API gets the process VA, size, and IOVA and returns a memory region with space pointed by a specific IOVA. So any access in this MR should come with an address that is relative to the IOVA specified in the API. Fixes: cc07a42da250 ("vdpa/mlx5: prepare memory regions") Cc: stable@dpdk.org Signed-off-by: Michael Baum Signed-off-by: Matan Azrad --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 18 ++++++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 2dcd27b778..7909f23e21 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -200,6 +200,8 @@ has_sym_args = [ 'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ], [ 'HAVE_MLX5_DR_ALLOW_DUPLICATE', 'infiniband/mlx5dv.h', 'mlx5dv_dr_domain_allow_duplicate_rules' ], + [ 'HAVE_MLX5_IBV_REG_MR_IOVA', 'infiniband/verbs.h', + 'ibv_reg_mr_iova' ], ] config = configuration_data() foreach arg:has_sym_args diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 037ca961a0..bc6622053f 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -224,6 +224,23 @@ mlx5_glue_reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) return ibv_reg_mr(pd, addr, length, access); } +static struct ibv_mr * +mlx5_glue_reg_mr_iova(struct ibv_pd *pd, void *addr, size_t length, + uint64_t iova, int access) +{ +#ifdef HAVE_MLX5_IBV_REG_MR_IOVA + return ibv_reg_mr_iova(pd, addr, length, iova, access); +#else + (void)pd; + (void)addr; + (void)length; + (void)iova; + (void)access; + errno = ENOTSUP; + return NULL; +#endif +} + static struct ibv_mr * mlx5_glue_alloc_null_mr(struct ibv_pd *pd) { @@ -1412,6 +1429,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .destroy_qp = mlx5_glue_destroy_qp, .modify_qp = mlx5_glue_modify_qp, .reg_mr = mlx5_glue_reg_mr, + .reg_mr_iova = mlx5_glue_reg_mr_iova, .alloc_null_mr = mlx5_glue_alloc_null_mr, .dereg_mr = mlx5_glue_dereg_mr, .create_counter_set = mlx5_glue_create_counter_set, diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index f39ef2dac7..4e6d31f263 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -197,6 +197,9 @@ struct mlx5_glue { int attr_mask); struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr, size_t length, int access); + struct ibv_mr *(*reg_mr_iova)(struct ibv_pd *pd, void *addr, + size_t length, uint64_t iova, + int access); struct ibv_mr *(*alloc_null_mr)(struct ibv_pd *pd); int (*dereg_mr)(struct ibv_mr *mr); struct ibv_counter_set *(*create_counter_set) -- 2.25.1