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 04EAFA0C41 for ; Tue, 9 Nov 2021 13:36:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECADF41103; Tue, 9 Nov 2021 13:36:36 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by mails.dpdk.org (Postfix) with ESMTP id 3235A40E03; Tue, 9 Nov 2021 13:36:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lFmtPsWgENZoACYFY9Z6YdzqRgo0o406JUB0Z1FDC8F7u5Z4umT+FCkZ58dnsnKasDOWLH2YBUFINTlXkPas2UF9t3Y1Hm3yngZLu31AggYEtD8nujvQyBU6Lcqr2Uwcbq5x+nw7nCXhzT6ut+rGwBfCnub/VlbuOEZtxOBK4Kx51VH3kMBRkyY1MEE34qmaGeTrO//o6n0StHFOvrLGspJxm+dwKibHaPHQbfJUqf1twogjXcVjmN3lLxAEFe30XbWUVAWsoudGwraWgiFoIxHbYEhIPUHFvwLfIbaQIjMlVj95vZf5LW3rvZQi1L1V9SSbZ/Md7t81qPrtSZI1Sw== 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=qlnjB2VmaiYMHveBYRX/qHsID02pf1NwvzUMqqJTDTs=; b=dV5yFYiDuZH0wmpJUmUPT88YNy1jRFLGqzz8+lvG4g8syTVPNCbajLXpFPjdg64WNz+ECy8uxoEZFwKdDPn1SRfZFtauT42CWVQ8PFNwergNAkCsw7T9RmAx9dBXLvUH13mL2IqNClHW1optNj7kPVZeXYKdCjsnKcUb5wjNpcsZOdXscROIkjY4n7OkEQWvVRXxLSRF/nkC9TWR49O6WyoXE30pPIOQxQlrJOyBKWx38AA+xglHIaw211CTak4NuthDTLCGzvqUAplEkn4WWIVvcKy9YohmpkxnYqMDyfnpRSsa2he1uo3I/dzvzpihfcb/UuOKg9Iji4daeeIJxQ== 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=qlnjB2VmaiYMHveBYRX/qHsID02pf1NwvzUMqqJTDTs=; b=Z6idC3z+GcbBTIvNA+ajjUrTkV7MIk2naUqbQyoS2H28uJ3dR9OXurHlfnbMIyUWRCmDS1kRvcfW+H0ex9k/GeDbZ4ERVZYe1PDEWr5BKMhA9We/ThirRnR6yZr2EyEtzXq2LMDG3HO/LqW5Rc7z1zb77sY2PxBJugtFA4cIvuuuPXKozx52klXeH+d5bV61cVpVr9i6VyAlhSI+uMkLIb9MTlWeQmztLTvoDE93JNi1KcmEMKvsptup8IpWZ4FkUIe1ovezjbrR5iA3cCV0u3K1nwbvNewcZugW2RptoXphcftM3kMZQk/FdeGJskS0aG+x+GDVPglt/8TLgCI2Eg== Received: from MWHPR15CA0058.namprd15.prod.outlook.com (2603:10b6:301:4c::20) by CY4PR1201MB0263.namprd12.prod.outlook.com (2603:10b6:910:18::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Tue, 9 Nov 2021 12:36:32 +0000 Received: from CO1NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:301:4c:cafe::41) by MWHPR15CA0058.outlook.office365.com (2603:10b6:301:4c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Tue, 9 Nov 2021 12:36:32 +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 CO1NAM11FT065.mail.protection.outlook.com (10.13.174.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Tue, 9 Nov 2021 12:36:31 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 9 Nov 2021 12:36:29 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , Michael Baum , , Michael Baum Date: Tue, 9 Nov 2021 14:36:08 +0200 Message-ID: <20211109123612.2301442-2-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109123612.2301442-1-matan@nvidia.com> References: <20211108172113.2241853-1-matan@nvidia.com> <20211109123612.2301442-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] 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: 4ec0e973-81d4-4014-03ab-08d9a37d8f0a X-MS-TrafficTypeDiagnostic: CY4PR1201MB0263: 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: PvUDctVgNGCa9qX1uvYXuzJzeJ7uQWsEaBvimzurNs5lCLwj3kwdyV62ZcHrwCzWy7m9PD6PzWRoMo5G0dyjNW/70R14xclhiAJiKiDXsqAmjmA7S3qPhdInV66st+nW5vwOd3EXyteBSss6mpPhlXkw22udqOhTd4h/ShHaA8+PzCqAzXe54iZYH6qwvBL2g2rmxjujq6F0ZwAjEoiVSXrXZKIJfBKwklenOHinaXDaKBTBSLxuJFNLqt5E+4AFY5TwgbLpVJVQ4/VB6lr6q1GZfVIsS+whtp4MKFfYYBJGAirTIkkr89o7YxWtNERd4Noe9o7nCT5gh62CbO3lTFdCndJ1urK9H54x18k/NRAKIwP4ErXmMCInvRcmW8PV/SRceB7VCZPs7B363Vto1p9oBsJSO5BsXj1Fa26h2T+iel3YT3kagBC8vqLcyzbo+72f1vHH82rmga6AlGi++H/deIIYYpxC6bXEU8I5EWcYHkwJe272x6KFn8+nu9byBZuIJpfcfaJpJ/TVzheIo9trGvL9jr6iWLKWf1VSKMG7JJRq3lcP33wa1WTmYifX1iaTXFQ2moMyB/AOAja7V3E1vT5/7LV0hl7wnlOQSVhwJeKDpXNKIylzps4blwiZz/pmKNmIbjFbSyfAwnaF4JYujtxWM64rpfQi2T/Gs9V+aRz4QTkuT7hI3jFPciZn8twqSq86homMEKHACUKE5w== 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)(36906005)(26005)(336012)(70586007)(8676002)(6286002)(47076005)(356005)(6862004)(508600001)(2616005)(6666004)(107886003)(2906002)(1076003)(37006003)(426003)(54906003)(4326008)(5660300002)(7636003)(86362001)(316002)(16526019)(82310400003)(70206006)(6636002)(36860700001)(55016002)(83380400001)(186003)(8936002)(7696005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2021 12:36:31.4644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ec0e973-81d4-4014-03ab-08d9a37d8f0a 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: CO1NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0263 Subject: [dpdk-stable] [PATCH v3 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