Message ID | 20240925172214.1511114-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 4XDNpx4fjYz1xt7 for <incoming@patchwork.ozlabs.org>; Thu, 26 Sep 2024 03:23:05 +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 1stViw-0007HU-VX; Wed, 25 Sep 2024 17:22:46 +0000 Received: from mail-bn7nam10on2054.outbound.protection.outlook.com ([40.107.92.54] 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 1stVit-0007B9-S6 for kernel-team@lists.ubuntu.com; Wed, 25 Sep 2024 17:22:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IO0RfkuFkcNUT4Qdc/Snq79B1kBUp+GaJBd8K1ChmqyzR9PogPtCrv9+iOabm3dApEyrWfsp3cvkPC2HT1k0fkw09iPFGQMA2P/0Wqq+Ov3HROxIABV9VQx3DRSyhCGDY4oJsZSwfRTnBaOMmCvgX1yTTME8cY4OSwjUTu/+DwB8F7se/xMxbxAu87QbY0hZKEvAiye0JQNzzGNlfsZtR/jNFzuw7psyQHf44ps6B0192tLCGuOFN8rHQhq8/W8oDQ1rfb3bcrdg9QfZif0x3lLfVVppVNJmE53M38GVgFAzW5CEp7G8+WvvZuWy35QbB21aArRNY+Y9LSsng/7Qvg== 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=WvDO6GpLW0eu02mQAzoSEkjWWHN5aHKlexhfpmQsZ8D9zF8mEm6SOQfBy5pi3q+P7VTAvnfFNC+M7hAp31glnajsC8mRugn8Bt3SVVmBldbbBYzGRt+HyFgBLkpz4GmYWyb19cdz/WFRlOKp8vWTzO8JdNhZlSrRixkKmqCyWfqiugLzGp3Pq0wJ7oR+/ukZRwA2T5M40BNCVAwHowFDMmbdwfoAiO1A8eobwdzPPPPdk2ARck8VLGiB2zt1rma7dQwafRZeRK3lvCVbKYRy3EJhRyAxffJGkQCSVilvwn5ypaciVDjMn6Xq1Gc4m101oTsGKaimsKfizcJWVI6fQA== 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 CH0PR04CA0067.namprd04.prod.outlook.com (2603:10b6:610:74::12) by IA1PR12MB7495.namprd12.prod.outlook.com (2603:10b6:208:419::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Wed, 25 Sep 2024 17:22:32 +0000 Received: from CH3PEPF00000015.namprd21.prod.outlook.com (2603:10b6:610:74:cafe::df) by CH0PR04CA0067.outlook.office365.com (2603:10b6:610:74::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27 via Frontend Transport; Wed, 25 Sep 2024 17:22:32 +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 CH3PEPF00000015.mail.protection.outlook.com (10.167.244.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.0 via Frontend Transport; Wed, 25 Sep 2024 17:22:32 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) 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, 25 Sep 2024 10:22:20 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) 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; Wed, 25 Sep 2024 10:22:19 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 25 Sep 2024 10:22:18 -0700 From: William Tu <witu@nvidia.com> To: <kernel-team@lists.ubuntu.com> Subject: [SRU][J:linux-bluefield][PATCH v7 1/6] UBUNTU: SAUCE: dma-buf: Add dma_buf_try_get() Date: Wed, 25 Sep 2024 17:22:09 +0000 Message-ID: <20240925172214.1511114-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925172214.1511114-1-witu@nvidia.com> References: <20240925172214.1511114-1-witu@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000015:EE_|IA1PR12MB7495:EE_ X-MS-Office365-Filtering-Correlation-Id: c8c9f113-2888-4172-c14d-08dcdd86a3c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: z0+lQ2czO+QyvqfbBXYy1iAg1dVXjtOEgfxQZowLo5STfd68deYSzCr+9xGaOeoxhl0nrylGh4/N+nO6kk1h32Ow9GUzu61swcw2BptqtF3wtInFvhEDXe398iggcXpQ8k/ZN65oA9Sta6RqN3iW8ykJWSYqg5c5mL0Cb+E3eia08C2GE3WEbnsYu6XyErHm2hjcQo4qWAEHBHTf5C9fzDWQmKcs7CJTRbFeRQjvi/YfL1PKI40/zrmAhbncyKzJiQdPGWuUQh6x+0j7vZg5o2OLRTdvzOk/1ovCOEvtpNhwML18LeseEK4bN3AOQSGmFzbhsQORYqaCMrpbuqw8tp6TFf1Tf+cE+uSDrOtzzl3CHEE6Oc4vOQJOsdmyUBgXgvw/Lyyruds4ellKZFW4X7x+xearwogF2gBH83sdL/30HcE3afmkccphrpVx+1qOaT28vfG4uxCBDxLzlk6S/2MK8Hs7QfTYvAjx4/KqAnkX7p997noLA2hZbFOPRcYCMlPV2kgD3GSQkNSfIN0hNpjhwI7QdVlIR+UWR0j5n7l9Qayk6L6eFuKVzz7VP93kJz7tgTaUi5eCbPb1w2b169z4MGazqh+dC35VLv33BQaVfJZJJtmoZ1r9TOJAKo8vq0cGT6LuC08fN8lrWgqOUmGprB0DeFkFecOr5Q0/7iTOFWm3/e8F7LJ4OGeT4ieUdwY5x1/vP6N6pcP2pNYWbHEtsOJeoZJOLFwBhmL0Z0V7Cb+47kjrW8o8V6YcEGKKx34r6AybHB0SxNoLjkpO1FATJBGA1laX2RuWksyJBS199AVJmvbg0YxT5BMzbrm7rIj9V3rJ8KvZ7Z1P8mrM/mN+wQLTtHbqQxCoqsBazohV4hpN3ujOjz0+tQZD1ZJFci3AYKkd1P9F56YnPYiop+RC5DPbneQ0wAomqXn3qgC++xHf6ZNci7tISIoFyIsErBbZgdzTHHVmo+aiowsGnN/lzNve4ETOMWupOUqeYXADVlenPyUNylXdpBqbF9xTH2fasesNLOSQUS+UD1CLBrXQxhwA9i51DEeh+gcZ894yAzzLgHOQ2zknRqIO+7gBTT6Y43cEGKzzJmFjYFX/Ln+o5t3gVQXlgRI/1fFmQ8HjNm6lhOsk0h8AcY7aubYzBZsxJ39r1oK5DUbFSgMlfWImnYKsQpPC76yVMx2gXa4S1fPlh4iLY4p9dYBIFJtEX1ZX7VXjgdBFyt5waHkzpfypr6ssU8rvY/IiAofF2fhA668r4fwErNdUtt5yBlCohB8P3KH08/UZ1daHVxV7VKLC5O90eip3E55MCPY//vqEwM4ARCcQoV0PrWmufD/kbYUim4uHwXST03oNoIg4vi2WUFeKnx7ZtfXjkzGB8E6ntWoEPLJEWgMxr9c7CluKbu7gLm9iLTssgfGiVZ3VVM4tUsTuLqXC28FbMBiXiXFrhOaij7E7v3RZ0KKbFfOY 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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 17:22:32.1142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8c9f113-2888-4172-c14d-08dcdd86a3c4 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: CH3PEPF00000015.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7495 Received-SPF: softfail client-ip=40.107.92.54; 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, 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 *,