From patchwork Mon Aug 26 18:29:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1976968 Return-Path: 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 4Wszk80gx5z1yXg for ; Tue, 27 Aug 2024 04:30:08 +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 ) id 1sieTY-0001Et-CO; Mon, 26 Aug 2024 18:30:00 +0000 Received: from mail-dm6nam10on2063.outbound.protection.outlook.com ([40.107.93.63] helo=NAM10-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 ) id 1sieTU-0001Cc-RJ for kernel-team@lists.ubuntu.com; Mon, 26 Aug 2024 18:29:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UjQqvFGUMJICf0dVWDsQzg7o+QKwBzkoP+BgeM569bjZmINiGqoR5oy7zLsclq828lNRrzzqm+Kn9oi6pLgdlG0C0qEtMWFaW89/SAdTHVaGJGLRPIa2dddLRJPJycIIJPzokPBTDRgzgYMkKmNpPPGfyOKDcaG3O4KuanM68TjLWtr6GFRuEAps0WJNR+CpGhUaHceLoaTIDBPgOY5m2yTKNIiuSg2b+v9Q7iQ9CbOn+QB9gkBAcIRDEjUERycXD3Aq5sllQYjV2AqNUR+coAgIzcQ8OGODiCAf5L330N1bfwcm3DWLfMGDPs5YA8ol+3AZZrE9WqMRXppss9yBAw== 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=/+7ietNGkQpJ/+qv+kMqUKaUn+JbRevpgh6l90Kz4AI=; b=uXi3Yokls6lHQ6X1R5MtUstiznpker9i88NlVqgheo8FGU9NF++7lm/4ioqtSbkoGpuUyaJyesLBNrgZ1QlC01D0CqdkAvBBNX1JLURX4tblGBKfIdxvxtajCr5m8SLerKid8pCPjhv1+Imi9OukxV50J11Z8nJZseKu8U6mggyvpTtoV7C0goIgwjpzbuV28m7ddUJW6D62ULunaNAwunkdI8//hayvfw23Q2SMvysrWhtZDR2g9FTn46dqgVtlFXOCvqe17rNOVch523qRB1QYK8tGCW0H/GqSihy8Joy+WrhKH80xJOFe6vmp828GtJpowfGW0cpr/wX3x569JQ== 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 SJ0PR13CA0145.namprd13.prod.outlook.com (2603:10b6:a03:2c6::30) by DS7PR12MB6142.namprd12.prod.outlook.com (2603:10b6:8:9a::11) 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:51 +0000 Received: from CY4PEPF0000E9D7.namprd05.prod.outlook.com (2603:10b6:a03:2c6:cafe::27) by SJ0PR13CA0145.outlook.office365.com (2603:10b6:a03:2c6::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.14 via Frontend Transport; Mon, 26 Aug 2024 18:29:50 +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 CY4PEPF0000E9D7.mail.protection.outlook.com (10.167.241.70) 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:50 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) 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, 26 Aug 2024 11:29:45 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) 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:45 -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:44 -0700 From: William Tu To: Subject: [SRU][J:linux-bluefield][PATCH v1 2/6] UBUNTU: SAUCE: vfio: Add vfio_device_get() Date: Mon, 26 Aug 2024 18:29:34 +0000 Message-ID: <20240826182938.1945684-3-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: CY4PEPF0000E9D7:EE_|DS7PR12MB6142:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bea1653-911a-400a-b146-08dcc5fd1264 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: X16CSzqQqpxxmFpXWRhThTv28M5UIMJ4JKI3INzXM63cZvUSHgd83+R9KQBZTlzNZ6d+8SOOfdecZyIqGujpHh8Vtr9LPJvottkFUYVnusRHp7HB+ntxB/EtgQy8Gg5oxe2QMs2AOVy1HXngl/Tr6vwhBjXyiypRXYlrfiJ+U4g8ZWDs+AOZJPpTPpERx5SP1afCO8Svt0k78XdXTyYnw55jEuRdv7arJvO+NHLaf39yfRmDuqeTv2VM254OnNj3A6sqeU7LHtn4foEy8mK42EMkECibfvUBw7K4W1uY5SNtywhLe7++W3+/FRKn+F60SMv6bhoxmzrmtYTTew7QnUZOVDkVI9LN/rlDUygZtJYWSkB1K+BpwMQrgPXr2bzBpFV8uwH+HmjcuJ8c4/FX+2c5hAnWK2hoUR+Dg+6iO/v1k/SpZE1Um0OBN71Lh7uuTTmm9cAS5Qer/z2UhXjNATMEZXPGOEpFsqrOM5vo8AlnoS/JrtsEWIBVPKIgttgpG4Ho6LR4H4Swt/5X0ZvCXGv6YoM0GOT+68AZQIyUypvhwpWZcD5SuEcRKJAxlDOQLPlaibrwln/fBg1LPWJNJBKH+aRPPnylMTlv+oUX31b2VruPUpYp6e+uNj4S6PrFs1e5yNzrS26OdvjO24B51VGrFoswoD4wvN1izfAfwDzV0m+b2PlpztY30fp9aVbnTbCsnmGf1ChP88vRvIZw4Ij9TscduNyfpzY3tIslTnjzOeKwhxlsfQptjT45O4CU9rv9CGm+QhGEXr6sC1gmgAahzfOOCkpjaTt/nqWhWWSACqvVYdHjfrqJNdeOC7EmkT/9fAS3dYEQVhMDg8ToAhdeshjtYhRIhBM4zdMKVRuh5NVZcpxOl9SYAqDDY7z/se7pVrklXNA/rY4r1EaN7jZ1m8lOQZlhl3JI3tQuWt7xlXhxPJn+fFEw6DjTSyYqryD9IMgeT4TJC7h6skkli7hurE/CNJNAHu+5RhAeR+PRaCGruqiJf19e2m5Jo4/QJclhjFMpzC43qMSRGN79PUInuC2+O0BLR6zY75EPgSMzvO1Try5mrz42ui+kY9eChCmL5KwnJy54FJlXyV6JAKv2zaJEzxqGefBcGL98OjCcmlJvzT2PRFjN9Fj+b+fX93cydSkRhd4b4d1si0cwT66Au8NxR6qP0kl8PWG1hAdaq11seQm9Irgcb/8xsZ0EWylgbwR9cSmKdr6HYIPn+cM5XIjIDC4WOPMVdS5yieALA68T06IMBAc5So5SchUphNbOou/6VjiBNvs0/KD1w4lhSCLP1gy8KhqPr2rcaQGcauXyBf23AAhkIH3nzy1VHvlE7XsVrqc/f7VxyQTG8drqpWa1cPxmXWaXF31oAIq7XGpPcitCQeorLAiP6ctP0a4jLSjd/V4oCN8Wyl9Zo85TmP93nF0MXzvOmJoTZYCI8CKkjqYeL74DuwMeKr96 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)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 18:29:50.5286 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bea1653-911a-400a-b146-08dcc5fd1264 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: CY4PEPF0000E9D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6142 Received-SPF: softfail client-ip=40.107.93.63; envelope-from=witu@nvidia.com; helo=NAM10-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vlad@nvidia.com, bodong@nvidia.com, sergeygo@nvidia.com, jgg@nvidia.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jason Gunthorpe BugLink: https://bugs.launchpad.net/bugs/2077887 To increment a reference the caller already holds. Export vfio_device_put() to pair with it. Signed-off-by: Jason Gunthorpe Signed-off-by: William Tu --- include/linux/vfio.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/vfio.h b/include/linux/vfio.h index b7275ed44e4c..071cea3871c9 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -82,6 +82,11 @@ void vfio_unregister_group_dev(struct vfio_device *device); extern struct vfio_device *vfio_device_get_from_dev(struct device *dev); extern void vfio_device_put(struct vfio_device *device); +static inline void vfio_device_get(struct vfio_device *device) +{ + refcount_inc(&device->refcount); +} + int vfio_assign_device_set(struct vfio_device *device, void *set_id); /* events for the backend driver notify callback */