Message ID | 20240923223522.1203691-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 4XCHrw1tzwz1xst for <incoming@patchwork.ozlabs.org>; Tue, 24 Sep 2024 08:36:00 +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 1ssreq-00070P-EN; Mon, 23 Sep 2024 22:35:52 +0000 Received: from mail-bn8nam11on2074.outbound.protection.outlook.com ([40.107.236.74] helo=NAM11-BN8-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 1ssren-0006x3-W8 for kernel-team@lists.ubuntu.com; Mon, 23 Sep 2024 22:35:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l8UCetBXVEJY2Rtr2ElUhTzd9HBVW2rqTwahrZuzkd4ZidOxGg6xvnD/lxUqoDLRHUDJ6uyx12H1m+HUppd5+O/pH6RikjSDG0ImNMK7sTJ1H8YQ4Vtc3Apzl+ceTZag32v0YFNC3X3SNhAslNC3L5DaP6ZrWS8pNHSFZIxJHXZKCRFsZ6ubKkufUiUx0tbCXYOZApIarIIHCZP9tVaqrr/k0N6DN2b1QrxmBwGau9VUqUIDX7cnHJeoRf3f8t8tLNZL0/b3MaR4aRzuDYYYrwu3KIgPwAbc6urPQGucwgAVnsOZcpswgsz1vINEHcsLMkyPhcxUv8hp1/QmZQZmHA== 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=j6mvGrImWA04C/TkKwThKJyNQgOun67A2pVZ0vQsaU9fDry4FcmBxDfOSXtHbyZQekzwCk7dzKUKWvkQkIGWTEtXbsKDEElA5wvzJET3xAOgrEguZb26LP3drSp5yCagm/RfbkJ1t3JXaHy2rgZb4GqBF5YP83IvTrNLWB5bpcuKK8GViOamJ7MbK5Dys8NhTsUWi3D7xIgbdQDLHKY8sF/D7QbaTDBGokEi0gfy4WkaWhrUuRp9UJWZMrDqL8Q9brcBqrSCN4ucXYoig6PiqWY70uEarbFK4qnl4ZmZlaCv8Y3ojYadI+W6PHPycWnktPwYr7d2qLfuFoE03NTUmQ== 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 BN9PR03CA0794.namprd03.prod.outlook.com (2603:10b6:408:13f::19) by SA1PR12MB8741.namprd12.prod.outlook.com (2603:10b6:806:378::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Mon, 23 Sep 2024 22:35:44 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:408:13f:cafe::b) by BN9PR03CA0794.outlook.office365.com (2603:10b6:408:13f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.26 via Frontend Transport; Mon, 23 Sep 2024 22:35:43 +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 BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) 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, 23 Sep 2024 22:35:43 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) 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; Mon, 23 Sep 2024 15:35:28 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 23 Sep 2024 15:35:27 -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; Mon, 23 Sep 2024 15:35:27 -0700 From: William Tu <witu@nvidia.com> To: <kernel-team@lists.ubuntu.com> Subject: [SRU][J:linux-bluefield][PATCH v6 1/6] UBUNTU: SAUCE: dma-buf: Add dma_buf_try_get() Date: Mon, 23 Sep 2024 22:35:17 +0000 Message-ID: <20240923223522.1203691-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923223522.1203691-1-witu@nvidia.com> References: <20240923223522.1203691-1-witu@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|SA1PR12MB8741:EE_ X-MS-Office365-Filtering-Correlation-Id: c9d6eb2b-6eeb-4487-e67e-08dcdc200f9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: lzUrEz6nYAlfjujca3qMJwC6hmE3HQKw6TfF5Gqg85d4g1OfE777slB9BML1p26JsjVgfQWF4Ht3GHyehrihIM3bK9STohs4YiosV7b/dB9+ctDM6vNIWcjZQUi3JtYvKr6yxr6g+ET83bVPeSrZ+wdEtwOoAQp25l3Kw0Elox3HLLaFhSraQ49RHtJytjgZgPh45Wxh7tvLw/0JAcLO6a5fYtZdStIadBUEF7Onr8vLvqekbqX4UbvSb2314H8XVzK0CWumAVH0/d7/SGf2Ydlb5/pMoBxyoZ3hDwDChdXIgsdWaj1jZ6Je+pxWUPQJHdLxjm4tRXC73J9TfTVRPOy/2GzXQmSbHADpnRnX/wVvTcahqJNgIn15V0CbXUux3Icw2PUtU90Gzi9QIL1bGL0nawiOxeCpQz+C+MiAuM2MqrYJO+wMWsz9SHosZgnRewyy3i/gowK3RFAvxqmEVW09O8phgyTT0d8uLU4UEBrM13XlTgFHIBZ1qacbn1CB8GvLSIIZ1ujJVQkIiiKMbj0fzxXs4dS3dPM9GuIK/fNuh1FtDkW2uVbKrZd/4pq3ojRoQtQYKFPDs1GCloS/wys9GnDaIZdvVt/jSJTs92TZ++tSctAJsERrEW9xL9SqY2SaGJZA1+R+Efuwny42gqdxTVZZGVnDEDcybm9yD6gCKWwyJnkDNyuRquPXsznYZyJxgnGiw5iIBkmXZWDW38h2x2iHtW88g814LpKA95ojVKt5CEKHgO3Tihp6edVC9XNagMn+PIVQoMnzHslALOh7kwtcZShYbx3TffU6lCs7UwIFAIZrvXLv0nB59De0nMXWrahoMiyT140Fb3FX4w2U3kHgi5aNvG2mQFOnSjKBBhWhclfTdfgr+KEKy9ateJ7C7sq8EbC1aVWrg+xJDzwHlTUi/S/YBxbqkI4+hIqrZM2VzVpsZlahEQgYTvnehu8zZzo5tOeCeuHxi95wRa9Bs46kylahJH9BaYcV/HkAiHd+GMsBj7AwGu299kAcNqRo+dbLW1tQVNr+8NvpSraTAePfL9lyj/UID7U0RAtxybUQwGbM33BKmpTqJoR94UfWCr+M3nNhwk9U7pCC4DfWD34moTLq9NWba8OsbSnBowh3sE1Y9PDLxwtuTdUDJNmpyc6ine99SJedVPULMNkaNeosrSVwM/2G47BXV49/Oy/53G9GtDSwIYuUJLYBySs9TA0VgcPDsXKwZw683AZPTjTuvsRD0gtvSK7IbiRliNJmbCSiw3b9P8b337ZZnhE7iu+TxjUtFgru4DphNAz2CIh6A57ODjUfNuEfa+zz/uJj7hsP9pXq/cS3PepAf9WKbs6CPCpgf8h21S7Ls80JIQbcxxi49ufyorkrfQ2pVDT6/6I1yfo+NxzNCeIE 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)(36860700013)(82310400026)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2024 22:35:43.6897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9d6eb2b-6eeb-4487-e67e-08dcdc200f9c 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: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8741 Received-SPF: softfail client-ip=40.107.236.74; envelope-from=witu@nvidia.com; helo=NAM11-BN8-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 *,