Message ID | 20240906194908.1127733-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 4X0myv0JrJz1y1K for <incoming@patchwork.ozlabs.org>; Sat, 7 Sep 2024 05:49:42 +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 1smexb-0002M5-9z; Fri, 06 Sep 2024 19:49:35 +0000 Received: from mail-mw2nam10on2070.outbound.protection.outlook.com ([40.107.94.70] helo=NAM10-MW2-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 1smexX-0002Kq-SL for kernel-team@lists.ubuntu.com; Fri, 06 Sep 2024 19:49:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZBn+e7/G3RdOkyjWyMP6JTXXhkjo0kUIrAwdaOEU9qVH8hAM3JNMXGLtX9nVCugbnQhrvw3lXbPZm+CQLSzfStubA14ziPByI8YLP+eIwPIOzpYrfUp22idFCZ8x2AjzA9YR3nKArUJ/c4GnrPZUw1SWzDYAB7ocQOXd1P44tU48o8rrHFPseFWjN/GouqU2cg7qWdwIsygnWGUSfwAL29KkelkhxKFInvOEzg3/VzNExpVwMJaZuSvFsQUIwcuvTARp9jX4E7xt7rbZYrJFMsbfN9xacVlm9cQFcGgO0iFKNv9O7YeGtsGjTHXXX/NuY7XiNOgbJ8OVDRKNp4v9Gw== 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=ivrFrqOi0+nAjMHGcrv4SfzLHTd0J4OGeaVrN734Nb5PuU9ju1zT7WSgTKVUz4e4fR047RXAMBuqrlLwhDxkpCON8aPyQzccCBgrUyRMYVGMWnGHpNRyiD5ldRWsVQ6d71q+LqJtRmbr6vMPunGrwgnIs+P5DU5nZoMqLDkvI2QHJOTqwPqjV4xq3WzHOmNVxd8SB+T2ZPujnuXhz3b93wbzYCvl4VottO1nGRUSsJA40P/FehnCXabwtRPiYvW8hs4qqiAZhjjhqeyYq1mChtvA3O8lPL28iXeI18yyFY3/rPOOWxJYJ/ZELVv9gmjHTTBk3QgvckJaeY8hDfcSRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 SA0PR11CA0131.namprd11.prod.outlook.com (2603:10b6:806:131::16) by IA0PR12MB7601.namprd12.prod.outlook.com (2603:10b6:208:43b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Fri, 6 Sep 2024 19:49:25 +0000 Received: from SN1PEPF00026369.namprd02.prod.outlook.com (2603:10b6:806:131:cafe::4d) by SA0PR11CA0131.outlook.office365.com (2603:10b6:806:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.15 via Frontend Transport; Fri, 6 Sep 2024 19:49:25 +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 SN1PEPF00026369.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Fri, 6 Sep 2024 19:49:25 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Fri, 6 Sep 2024 12:49:14 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 6 Sep 2024 12:49:13 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 6 Sep 2024 12:49:12 -0700 From: William Tu <witu@nvidia.com> To: <kernel-team@lists.ubuntu.com> Subject: [SRU][J:linux-bluefield][PATCH v3 1/6] UBUNTU: SAUCE: dma-buf: Add dma_buf_try_get() Date: Fri, 6 Sep 2024 19:49:03 +0000 Message-ID: <20240906194908.1127733-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906194908.1127733-1-witu@nvidia.com> References: <20240906194908.1127733-1-witu@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026369:EE_|IA0PR12MB7601:EE_ X-MS-Office365-Filtering-Correlation-Id: 76306987-288f-4614-c7be-08dccead02ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: mxkpDtHXpe0UizuyKzyn7JlSPvDkekm8UgDFn5ihY1gUi+1kyZH1l7xM2rQsLvrJfTIGsu2gtiwExz3n/FX9q8vTtNuGXFepvePE48eskg54luG/Y6xwLyCyI+hd+XOIZyIOrwBkZpkrrcNvkJgFajt7zGwf55Dngz/Xb8v7QjJgka6pRVnrbyUUs7Zm+BsH3CeUuqy/YR8NdiMtekVHbtWWrbt+sw56ALFbBeHPH7oShConR+1YARiddlBAUjPwJiQKBWUC7jSpJVJ0zIvLvdYyEU81r92QpDgX9WWh34tT3OkvkXus0g0+H54tSX2W40YduFsnWUbeXYAOC19rpTuJmeoaDam0d7ewnWUd2yZUAcO/WBnUTFPzD1cCFhHtrzAuV2Ct/ZNsYCZ5kUT1odtKAUYrm5ItcyRLvuzcIunlIg6CR+X3cdZ19aNu1wZKFnndjHw+LMDicajzLjNh7CoAq444YASRjaK1vJnhcbZHMg9/IMiCwxBdaT6JH+7Y5mT0sMZZygQFY7LvV0qNdQq6aqNu47o5RsRxnxQjKK65Qzqr1AnqC2b8HpIfVeLbXPvSHUOUAdzzNJi9VtH87v7OTwjc+I3VFjUb7W3nJajdYu7+k+RHc8sKpx//bDxAphIE1oNXIWMWR5p+74yIEkmhcfafQXCiVReI0ujXmBTNznwyzPg1NLQL+wsE9JKa2m42gNNVQyFkvti8NezpG9Bz18XWtEgcEEsFYaNrC4ZgsRCBZUy/3PoLlT4mkA8E6jayj0cLPe4YPVe7tDTw59rGyoFk32GOr/6xV9lIydTynPY8dxd0jy3Bj0GAg/Tv7UJFj6tNXnal52DETsqw0tvVi0TCj6A2HoQGflEVlHLHsd9R37qoyuOnmFVVY9YFpbVrTCKCRBew6M5xT8ilEFempAj+LqZVU1IbgYdniV2GOGZowgEtEODPn1kWXJ9IU9R+F0/bHWUDn8/jMouXxaR0yPAJS2HmcDNSq6Ec0OddZhQIhgw+e2A3GhGQ52kGukvXOkCuBbggFEx5LPv0KFB3KyQ18XBQmjlbrPjELLaeULah6zXJEMAIlj8EFthG0UpPLUcVNY2Gr74btEurjLQHPyII+JJQb1e1CyphcDOo6o52ilppdGNx2JyXdSdqnOnpkJvY2Q81wI3ZHf9o6U0Jd2dno8yHomDuP/0fFouBXR1ThjIXHa/nJKwRNjPF9+KPkQ9KZA/KQgu2dLfoLzlYj+UdNw6miOoupBGF2ZFYUEkY6zIQjWaEa6QOL0MA0w7zxjefIsUW2uLZqOxZji2oq/QeERp++Wz6fReCY9IwxPtdyRL6X3aYIoxNquO3FW71x2JjUckyVMlUBRsvhZk4AuG5jwXkVwKYs25LxvHivfgzflJIxw9EfVZH++NFzitHA/BU2AbVENKh8O9WqKynJqW2yFpjmKK/DOGJksYVWPdabkI46IuYXfITITav 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:(13230040)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 19:49:25.2138 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76306987-288f-4614-c7be-08dccead02ef 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: SN1PEPF00026369.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7601 Received-SPF: softfail client-ip=40.107.94.70; envelope-from=witu@nvidia.com; helo=NAM10-MW2-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 *,