Message ID | 20240911205939.85317-2-witu@nvidia.com |
---|---|
State | New |
Headers | show
Return-Path: <kernel-team-bounces@lists.ubuntu.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X3tHt1sYKz1y1y for <incoming@patchwork.ozlabs.org>; Thu, 12 Sep 2024 07:00:10 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from <kernel-team-bounces@lists.ubuntu.com>) id 1soURV-0002iS-9C; Wed, 11 Sep 2024 21:00:01 +0000 Received: from mail-co1nam11on2070.outbound.protection.outlook.com ([40.107.220.70] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from <witu@nvidia.com>) id 1soURS-0002hy-LW for kernel-team@lists.ubuntu.com; Wed, 11 Sep 2024 20:59:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DiYHLRUuXjQtAtSS4NqAI4dDWMqjwS9jneYxOH+wJBEWOTgN8BzBz2E9OLVH/KBJfvBzB5GDkuMEO34bzhu9yxsLdREAOyS6OA4v/xh92Zz1Jb98c9YXIrwrb4LkaQQWrucQB1+F/QAZfYD5719wMSytTlF06LHQv5Ik69jzW+R5J+1M5NK8380a4bH+R9Imcj4Hi+X+Hcb4goX5dv7x4vzOe654PvhA0P5fYXJPvv8zFwVtzoF+wO5/F1WCEnSS2dZvBMRdEyg/dge0g0eCB6bCjd4ZjwPpXRxX/DxZMYHfDYYqPrdd4ZKPr2GpMq6l/2x97STOi7pnjRK/yNe4bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=23STIrtpTrBBp//iP2u04AaBgq1/lAD+tvhQ9GGrU1s=; b=xoxNw68rBUpPzhBPHObPnomD/WDWAUq8vZzGY9sdpt91UCnf7UoJtoFIys+On4mUBzO9qjXu5jbrP4R9L7j12JJ9gZcBr1u3ZA1ROh7COXihZtOF4fzV5ZWgjxYm9sKG9bx1EDHXPyAaGptOj4l+N+XVRMwLi5CU8lnEnhfAuzboh7H/AYckWEtBvM5ioFhP4AQfErsUNMJ+pbfJyB4vOTdV7LaWbyIpyAWC7VsafIi5TXHx4szrV4I8FKiZEIgUPiM5XoQIsBEjKU4G0PsEYCcloO/RL/5tWMMgc9Zi+OMMrvEakl3/GS7sCqRcb38zdsmESpvp/TY0qt2twi9uVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=lists.ubuntu.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) Received: from BN9PR03CA0803.namprd03.prod.outlook.com (2603:10b6:408:13f::28) by SJ1PR12MB6172.namprd12.prod.outlook.com (2603:10b6:a03:459::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.18; Wed, 11 Sep 2024 20:59:53 +0000 Received: from BL02EPF0002992E.namprd02.prod.outlook.com (2603:10b6:408:13f:cafe::89) by BN9PR03CA0803.outlook.office365.com (2603:10b6:408:13f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24 via Frontend Transport; Wed, 11 Sep 2024 20:59:52 +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 BL02EPF0002992E.mail.protection.outlook.com (10.167.249.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 11 Sep 2024 20:59:52 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) 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; Wed, 11 Sep 2024 13:59:45 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 11 Sep 2024 13:59:44 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 11 Sep 2024 13:59:44 -0700 From: William Tu <witu@nvidia.com> To: <kernel-team@lists.ubuntu.com> Subject: [SRU][J:linux-bluefield][PATCH v4 1/6] UBUNTU: SAUCE: dma-buf: Add dma_buf_try_get() Date: Wed, 11 Sep 2024 20:59:34 +0000 Message-ID: <20240911205939.85317-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240911205939.85317-1-witu@nvidia.com> References: <20240911205939.85317-1-witu@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992E:EE_|SJ1PR12MB6172:EE_ X-MS-Office365-Filtering-Correlation-Id: 373f062d-94b3-460b-af00-08dcd2a4ae81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: 4oXDJ6Legj/xQ/XZB8r/602yg6E97RmoQ5xKFTavZgcrAmFIs80MkUHf3HQPM8ySlkrISNnDFsccA5uUGPHKD9MtlEm+W3Ts1Pz4qpE0PrbxLu2CS3Ny+LFvSBTL7OaRCAAdOV82iWBHQ3zqes5OeypDM4RbTHt15/dELj48I4Rw2vIwx3ee+NFrgj0FUft/AvqsLNA/MwuYeB/UQak8wAH+RPgxdI7b2VbPqxmBmF4iuq7K/J0aCADY3RHcRdQWW8rQu0l25d+NbyzhpIAkEqRVB1mR4DIJkp1paILmHJ2zxjz8zZauABnxAV5CEk8mpBtjrBCGEzGGUn6TA1pEJHFcIox0XC76Fp9oOyWEFrmHitfYG27avejndZO88o3Gk6UejkEV4knIJDMekWOWXq1iEfQtIrDtnaeBOIh5yh7h/Mb7JDuZzBGGM4ZXQMq4KO+x5BrahEokJhs8NiO0ez/WUz4tLi6UKrNjdaCwIeMa4oXkAwBQu31gTE+ZQ9IF1d5wAAvRSQ2/GfdrOU3/P15FPicn7nQe/l4V4SwWWC0E5WY0jHKUCyRvf0XuiNgZR6jrozgjnhPO10q2rIQKZHSQrVx9+gIe8ZeIXuQVuL6gg7MSj7W5Mq/IFBBXE7/JY/1V8lrNKQKDW783ezETsSDDLx4LqsJO4SnCvZXPJyoKWHH5tObXK1yKmtZeVFy1ss179CuCmaxSrfRsituzQ1Cu2vOd3U29SLV9cF8RZklhOSR9CMGNDntBJ77t4x9RtBU7aXvka6OXNLZMQ2jbju4w4w4dwZBCqjSQYD1dn0aIggSyR0E/nuAobBPoXAcrlGZgQMzbJPx9jlqNQipaTd9NwBdx9TSdDh65ef4PvF70ZInjERwhnSrOBmp9t12JDZH+2Pp40fs7f4iB8rJ0VsFBNGPOzO5MwMd2RvKLrohfsqD9dWdtV7h7KNyG+s+G86y7Jqhx9ukmI+62Ccl59IS2xJUCMEOdfSUDLpi6WUopyWwkqzR+Nf3TL/yeIOlI2I63TH0JD7B2oQQ0QgtWL6zToliSfeOgasqpyARPHTtZvXrmDpz4TyYzq/YqNvWg3iZ7MsCbU17IX2YTCP9ya1iNKJhxk2QnCM7kCk0n1v126r31CE0OKBOAtnkLpScJx4VWNXbs9PjrTLyTbQAOGenaSZ2cff6ZGeO2mGTuWJYWFu2NvsZm4qgBoTcet0umImo4OVQ+cbI/b6cwGXzUZEkw5q4UflE1KI9eeos38PNqDd38AhybQPMiSr3gYDYoaNUGTIj30NvMCUB4b6ZNv/29pEdj5lwSl4FIrcKTjxvBpHqsJ/eXxGZZVIs6/YsBnGq9zEhp/7SbVd6Di4Xf0wdQk5AlJkr6bHqTKPT4aihHEimybf+IiYwsVnZG9EfkJ9Gu+9EHOdsqXVWbORgvCDLlf8XwnqgjBKt34utLRW/X7YbtrdTWRK9iI9wGMtYC X-Forefront-Antispam-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:(13230040)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 20:59:52.2253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 373f062d-94b3-460b-af00-08dcd2a4ae81 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: BL02EPF0002992E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6172 Received-SPF: softfail client-ip=40.107.220.70; envelope-from=witu@nvidia.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions <kernel-team.lists.ubuntu.com> List-Unsubscribe: <https://lists.ubuntu.com/mailman/options/kernel-team>, <mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe> List-Archive: <https://lists.ubuntu.com/archives/kernel-team> List-Post: <mailto:kernel-team@lists.ubuntu.com> List-Help: <mailto:kernel-team-request@lists.ubuntu.com?subject=help> List-Subscribe: <https://lists.ubuntu.com/mailman/listinfo/kernel-team>, <mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe> Cc: vlad@nvidia.com, bodong@nvidia.com, sergeygo@nvidia.com, jgg@nvidia.com, zwaksman@nvidia.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" <kernel-team-bounces@lists.ubuntu.com> |
Series |
Add VFIO P2P support
|
expand
|
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 3ad636a13b8e..68a4326833d6 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -609,6 +609,19 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags); struct dma_buf *dma_buf_get(int fd); void dma_buf_put(struct dma_buf *dmabuf); +/** + * dma_buf_try_get - try to get a reference on a dmabuf + * @dmabuf - the dmabuf to get + * + * Returns true if a reference was successfully obtained. The caller must + * interlock with the dmabuf's release function in some way, such as RCU, to + * ensure that this is not called on freed memory. + */ +static inline bool dma_buf_try_get(struct dma_buf *dmabuf) +{ + return get_file_rcu(dmabuf->file); +} + struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, enum dma_data_direction); void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *,