Message ID | 20240911205737.85029-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 4X3tFp2wHWz1y1y for <incoming@patchwork.ozlabs.org>; Thu, 12 Sep 2024 06:58:22 +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 1soUPm-0001PD-Ar; Wed, 11 Sep 2024 20:58:14 +0000 Received: from mail-dm6nam04on2069.outbound.protection.outlook.com ([40.107.102.69] helo=NAM04-DM6-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 1soUPe-0001Ih-Ah for kernel-team@lists.ubuntu.com; Wed, 11 Sep 2024 20:58:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GD5KZtczdePgHpOB6nPYuONE+ecCLNPBVF1xCwyTBlqB0TJRTSsYr3FoD5LsyNUuP8pef7uIB/5COEaEEWcLxtFBO5bg3VE8JqFLljsICyAjgNqZL3An4P3DNNOP1CuEZG3hfE/0rJnKHe7hKizY8+xiSBxWnrlXyz6AISLTPFt8qsT17qble6o+DvN1s9nuR4scmhPD+eKhdpdUB/2gMDDDABO+MBklveRhAao+yxK+1zQqCfSjMAOm6yU7ni+QRDBRlWBEOmRcu5az9VzetEA/kKNSkScOS/ziyej30XajtTtxb7+KfYwrQD2Qwuxs90xeI4ZWHeFTG1nsTuUNig== 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=mIpLxDWzyLD+CEiWBxaKGGFG+jEj/EciaqGaePYqpjy9ikjlTCI5jkCkcwrrUaJbVRusc44fIqW4DiB4S9M3+ms8B/nD90Dw/ChbP6AOju/J1YdiANN37qjNAHcjLE6MXBA4NFOzvKtDix/B6gAnYeoBqughqDimRRzXA+t1RxZ1Nt0lFiZzSNFF9/eJa0DKkyUqfGmi0q9ywJ/K/U0QrlZ8Tb7PiUxRmd80ZwSRKLVGfGRUkryJwZy+bMoPfsgVX6rAVqK4iv2VzmvqBk0iibnqgalo0fcHi8MBMGMdoXT/BL794veM/+exGiKmUQdrD0stywFnFJA+SAWBfTefZw== 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 BN9PR03CA0068.namprd03.prod.outlook.com (2603:10b6:408:fc::13) by MW6PR12MB9017.namprd12.prod.outlook.com (2603:10b6:303:23b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.26; Wed, 11 Sep 2024 20:58:00 +0000 Received: from BN2PEPF000044A1.namprd02.prod.outlook.com (2603:10b6:408:fc:cafe::cb) by BN9PR03CA0068.outlook.office365.com (2603:10b6:408:fc::13) 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:58:00 +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 BN2PEPF000044A1.mail.protection.outlook.com (10.167.243.152) 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:58:00 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Wed, 11 Sep 2024 13:57:42 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail202.nvidia.com (10.129.68.7) 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:57:41 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 11 Sep 2024 13:57:40 -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: Wed, 11 Sep 2024 20:57:32 +0000 Message-ID: <20240911205737.85029-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240911205737.85029-1-witu@nvidia.com> References: <20240911205737.85029-1-witu@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A1:EE_|MW6PR12MB9017:EE_ X-MS-Office365-Filtering-Correlation-Id: 7893f606-ad3e-4ac3-ae95-08dcd2a46bd3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: JDrskzD+N1anLMR2xkVcmTmz59nMy0JyTRm6EEEgz4IdMVCFaFh9DdWqv8AC/YiZwFeY+9oA5AGqv3/lT1cw8gkRPwibBiTBGtEnftnQZvDQPQ6qi87BOXOaU8olqvRORte4RHuzQHa9ITA8H0Xsw+NlYf2R536vGTI4elaQCSVuNl/RsCzgIq0MSTfEWkf7G2err3IFEA0OkSPkR9VLmqcHYMXnCy2zfEJ8wZEJoX7VTui39N0mScFPR4yogqahXEDmqGZaeCZ/IIV3i0dnNtvLJMHDt460ZTrkoS6PIHmslYtSOIThOGg5RlXjKj8VY+epJ+MCzWW+Et1ezzqW4RKHkfGg2Wlah3884qM3VPfeEcSYKfzJhREas0S1Pk25rYYbr59FFwIPs6PNsq8dIsmIoh5uJlHRigMHack3a+Zd9DbxHYmgRxwUdN4s5o3euZcMdDnwc1mLsCALN+Xp8FBcehupmm1C8Vhg6//MMWPpA/eYaRm1Ui/6tmKhFS7iu2H+PhCJLZpnG5mCWHv5823lCru92ihWAtk6yoSr+vM+Lhf5GKrO/0AcAkNG0IwoWsTePPvw3d2FHI69ORGwMwuzF3SDxzNfZVibTT8z14FRizvTVKrwtgkjaTbYdIxPN/n9w2kL60/20yRQpBQjIsOWz43Vty5x/frfQAQCEe9bcUAZhBKp4YzKDDPmyptp/R1YNB8nmCDi9Vez+GbsXFAa3NihfiU/0dARB8up1CRgV6jlLSAciekB5VeoVpbcs6REEof4Ksrtb4YT7ftb/wK+64GXCQQv4kgQwfRBfXIss5QjEzGyf2V8pet3oZXjbmFWYJG6xhZ/fmbTPW+qb0Wly0DRf+iZBwb4s7kTlndzD/57dD1dcg30k2ZYDl5xw8Tus0Qbc+iBZONIUqpCNn+zCxG1zAcV+ar2MhtPR0iP/5OZnt/bFaCvfXqlt9SLKDzpGpf2LK+5TBy0wxsxb4wDOuaDGEqmnZMcAEvTOWAI4n+eb74FiuO2wvNt5EomxU4grbUDWjGZC+TT+UpHHKHA2u2w4JdoyYNF/5mWBH4x5wJpGLA65gafnU5UU5ybnzPOOfYr32NG9fHqCn/3FSWP0yi6PTXi3jZ4ecNngNbWW8RRQ8/e1M6OAJMEflh+1lrlJ6x1fzKu6ndzZG3jOq3Nbx95cUfwB2VFiSOdeOsglWjQhbteNa4Lhhxc7s/W693DTErXbMKFyLDEZ17JIcodW+h4r5sAuwVQ7fRGpt3fIToeDRAPbY9ebZnnC6f/IOiWaRSmlsE5+E8GiI3C7tN/O+ShkUIR4WUaH5XuiQmrN+51j4ZGmIpNVAPGbrBnsIfxnRmD8R1Kbzspygje+Qq8zycxInddsktNiU/MKgBOgjtRaqPVOVA0vauVmMVKk6TxXA/DXxMFUs88d61Ozs9vn7M5wC6XpdjPryHRCtKty1GK6gLkL/0K1RKQTk91 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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 20:58:00.3240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7893f606-ad3e-4ac3-ae95-08dcd2a46bd3 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: BN2PEPF000044A1.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB9017 Received-SPF: softfail client-ip=40.107.102.69; envelope-from=witu@nvidia.com; helo=NAM04-DM6-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 *,