Message ID | 20240826182938.1945684-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 4Wszk66Jzmz1yfF for <incoming@patchwork.ozlabs.org>; Tue, 27 Aug 2024 04:30:06 +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 1sieTV-0001Cr-2F; Mon, 26 Aug 2024 18:29:57 +0000 Received: from mail-bn7nam10on2075.outbound.protection.outlook.com ([40.107.92.75] helo=NAM10-BN7-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 1sieTT-0001CG-Fv for kernel-team@lists.ubuntu.com; Mon, 26 Aug 2024 18:29:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OoFPBQR9X4nskW7BsGKNhZ+OIpWWLOkzQBfKPkTUq+1hZGAG1GXJ3feWJB81lCjwswbjhVoCEq6RFNQO+Jivn6AYJkJgL6ZRV1zNTehmG03gzRbQeIQHZz0L5vnJZj/lDXGWECTJI4MZVncGQW/YbMqc736b2/SmPeDW6vTLasejw4Utx8TOZpyLgFiSguOTOG6TDDqBAbZ8o5/JMIFgO2sPCTbsNdX8heZ3DoKrRJzGvC9DgfwR+6Ddyq3XM/SJWhnI8UM2yQjvhO+5wFq8Yc9/O5NbRXQoOGDeAk39EtCh0ZlPzS1DwnhiTYlHyy2Pmpww1SYgswp5NNLdCE0OLQ== 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=yxpyD1ehWLjfMfC9dz6l9UJ8TNHfs/1d4za/5NNoxun3bYXAuGFQ+3IU2ThcvRkjrYdcQ3UCWxZ7hB75plOEzgal8WuSzkZmWe5vAUPUGk6IJ1m3n24Rhoo89EhVLsKFtdxzM9gtXT5Dl34itxSNlUMkcgmZnRIiE2RiJW9cDbIlWAUeFY5K1nWVaBMdFXjZxynPeYdC49r+xoQXSTsWNFSl+e40uQc7qUSIHGpzt6km0dfDXEM+cyvziRiga/L9jPqiN+PbldCXhG+7SEFSy09QJ+JRUZUyeRkQM7HFRq8xpUaQooiGri23KyWuQa0Qrv++m+j8344iPtuWYQUXig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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 DM6PR03CA0017.namprd03.prod.outlook.com (2603:10b6:5:40::30) by DS7PR12MB6144.namprd12.prod.outlook.com (2603:10b6:8:98::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.23; Mon, 26 Aug 2024 18:29:48 +0000 Received: from DS1PEPF00017098.namprd05.prod.outlook.com (2603:10b6:5:40:cafe::a) by DM6PR03CA0017.outlook.office365.com (2603:10b6:5:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25 via Frontend Transport; Mon, 26 Aug 2024 18:29:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS1PEPF00017098.mail.protection.outlook.com (10.167.18.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Mon, 26 Aug 2024 18:29:48 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 26 Aug 2024 11:29:44 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 26 Aug 2024 11:29:44 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 26 Aug 2024 11:29:43 -0700 From: William Tu <witu@nvidia.com> To: <kernel-team@lists.ubuntu.com> Subject: [SRU][J:linux-bluefield][PATCH v1 1/6] UBUNTU: SAUCE: dma-buf: Add dma_buf_try_get() Date: Mon, 26 Aug 2024 18:29:33 +0000 Message-ID: <20240826182938.1945684-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826182938.1945684-1-witu@nvidia.com> References: <20240826182938.1945684-1-witu@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017098:EE_|DS7PR12MB6144:EE_ X-MS-Office365-Filtering-Correlation-Id: caf90e4f-c2e6-4883-2c7a-08dcc5fd1164 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: PRFU+mcOr6rGHJ3ZmsBGTc+OYMCV4spu/Rfdb4jRxT+lvR6tUsCpqH7hp7L9I6QH9Ex3frkwJu8PnL7HkDuxqF62eJbRwnJxzJO7BUyVG/wsB8/ltfpsJi1jeI6Xyl+/6S5tMxKvbV0d0cR8fnDGtNqDJj+eSyv/mCwKqWJvRPFzrucNNiBevjAsVVFHgHY+TRfr4Fxg2zHvk4DK00kyoCv7PpXFvmLleXOH7O/7S34Mph0pFNFF3qVFlWEZslKvVf0T11SJl2McHEF7og/7f/rRZisTnNMjYIyALeTQyXVnqMDYnZqVRtmqB7Kat9cuV1wK/61n5XjyGJcNKu/QzVHgWrrZSLokQwmUzjA2ngEoKDKHjGm2YeUBRJFygOgFbP9AgQHaHAxJzDcAngOCnwvgSAiQfXHFEXes1Ijb8k5dPeLOAZsfHHnK549FCYKAL4t1owsBHYlBRb+Yse2eX6ZrxUkVM/kk9Frdh+SuvZ4g+JtD3j+6E3tOrarbSPg8noliuFl9dy159T6JdZrC3Ybz31oU/Je7gpjHntKtT+9vW8DkrZpxqq/8D74d3JrfxTOdME37VRtjAgzgaR7P5awb3BrC6RXcVw8GWPw3tmvzvn41EMg28jRQHQskDiAIDwI260WgR50v8FCcFbxPjeRV6zuZYMAiLBhe+vGTkqNrwHdkSHii5IXpDqyqHwGoHirpYpK9gFBkNdzeBE3cJHj8CK7axzeivigKSAsB1NS2xymmkywRuSTEx7QaXsfT2jCAUdnP2Ftp32Pus5J4FxMAWbTKmW0+Puj0RQ1If/Mply4hSpJpErbZ6sBujPgKW8gWV2V8YSmADhQWw1az6+XheVtuZ+bZoE4p6W9jG471zMYYtvgsqpt8mTDZiUwqkwA3FxK244Lr8/aqTOfURG9YjU7jiYQT/ckhNovwGfSDYhLM2HtI+TOEcta2S73v0inKrWUmVfJ/biIUgB7iOS46+dqAyFKhBB2kZPFy1oC42FZcloKtERbynEF1yj9Q+6Zn6upHMHWJUqXAfOMDBWP694voeriNJa/9KKoEfc65M9rD1cBEgpluw2vRZ1qtS0kYOwYI4/EgZkweE7WhLoyYOprRBCQR4vqfmGORjiBig++8Oyw6a44IM92xZ43Q1xiqlmL4klV2kWUJ56egCPyu5qJMVFf/Lfoi2MbqSGv2ugN+lKdn+d/mOcpYGKyz/qRBC87r78EjBS/4BauyQzfakhYe1jx63nmUAr8vPzZgglNsq3TJtEKsghsFqm9qyUjbS2z3nF5XdsqMlh0bfYH4mIZVietIVg4MGmKh9hfU+N3DQ5ZODVDY8LU3jmUKG42QJ9bKxUDuk1ResExUI+VIc6ogzpqlVEbr6GqRVOyCcuhZvEFxP936wAc3VyfrkRdEeAHUSVJGfTRjMQS9l2YKyN+EXc0KVM6CbAjV8afl3xp/mPVcV+814LV7CW4I X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 18:29:48.7693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caf90e4f-c2e6-4883-2c7a-08dcc5fd1164 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.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017098.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6144 Received-SPF: softfail client-ip=40.107.92.75; envelope-from=witu@nvidia.com; helo=NAM10-BN7-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 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 *,