From nobody Mon Feb 9 13:57:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 520ED274FCB; Sun, 2 Nov 2025 08:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762070493; cv=none; b=EmMSHq2F0TSJMblXOQoGZfwqxuf/Gazx9a5en/aBzZWWg4AgeKRrgm3bzJd4DjSHrFYpvck8qqkDnWCXRnKVXicdsYLW+J7NIO8or2SPVjzUEYs1ydSuZEEgvVcRvJfAa+SDLcVlMalgK7GcqjCz2YNRijn75L2otaY73iyV6LU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762070493; c=relaxed/simple; bh=3yq5E/X85v6vCVuKi2LScKzF5l88MwDsoXjHa+RbDfs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pavrO+cNw5T8nd/YzMTcw0kzSPGrixcHmTVQ28IlQLCr202Xiu8AGhUbQv+ZHs9Budd9Ws1+Tbije0yIbW0JYoqTsomOzngCYbVZrGB3I9E4J+VueMXbWptdhRKHpV4BrKRpCZOC8/rSR8BLFDCYu1hbLgSt+SripnqMT4/42LA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f1nef/TQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="f1nef/TQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 536E7C4CEFB; Sun, 2 Nov 2025 08:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762070493; bh=3yq5E/X85v6vCVuKi2LScKzF5l88MwDsoXjHa+RbDfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1nef/TQhZ+F796Xeu1Yv8RCAWkBxMLpT3WZzt+UV0WqEs2aEKIoMoAXLhagtCz8s mywFCKamPcczrS4bLwpwCcHhMdtrfWBFC6jlb82HEVH0+AFDzvVXT6C1AlcEoCX0aX RZ8Bwl9GU+prIw3xflUKR6oa001zcgX7rAXY9SOLkjkbLYKSQ+8e9Lh7KMy7RXiDhU CpLSLGZlYiIgc6xm345L+kqjhcUPsQd50DIClnoJZ+EjXTv37f/ih4nI89AN7g94Ob jZANa329yv6v/RlYvvDIqAGUX8K6hOy0OfddkLC7S8kyRL5bC6+yOlJFk5ekQHFr5e 5n79o/rg/EXnA== From: Leon Romanovsky To: Bjorn Helgaas , Logan Gunthorpe , Jens Axboe , Robin Murphy , Joerg Roedel , Will Deacon , Marek Szyprowski , Jason Gunthorpe , Leon Romanovsky , Andrew Morton , Jonathan Corbet , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Alex Williamson , Kees Cook , "Gustavo A. R. Silva" , Ankit Agrawal , Yishai Hadas , Shameer Kolothum , Kevin Tian Cc: Krishnakant Jaju , Matt Ochs , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, iommu@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, kvm@vger.kernel.org, linux-hardening@vger.kernel.org, Vivek Kasireddy , Jason Gunthorpe Subject: [PATCH v6 07/11] vfio: Export vfio device get and put registration helpers Date: Sun, 2 Nov 2025 10:00:55 +0200 Message-ID: <20251102-dmabuf-vfio-v6-7-d773cff0db9f@nvidia.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251102-dmabuf-vfio-v6-0-d773cff0db9f@nvidia.com> References: <20251102-dmabuf-vfio-v6-0-d773cff0db9f@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev Content-Transfer-Encoding: quoted-printable From: Vivek Kasireddy These helpers are useful for managing additional references taken on the device from other associated VFIO modules. Original-patch-by: Jason Gunthorpe Signed-off-by: Vivek Kasireddy Signed-off-by: Leon Romanovsky --- drivers/vfio/vfio_main.c | 2 ++ include/linux/vfio.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 38c8e9350a60..9aa4a5d081e8 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -172,11 +172,13 @@ void vfio_device_put_registration(struct vfio_device = *device) if (refcount_dec_and_test(&device->refcount)) complete(&device->comp); } +EXPORT_SYMBOL_GPL(vfio_device_put_registration); =20 bool vfio_device_try_get_registration(struct vfio_device *device) { return refcount_inc_not_zero(&device->refcount); } +EXPORT_SYMBOL_GPL(vfio_device_try_get_registration); =20 /* * VFIO driver API diff --git a/include/linux/vfio.h b/include/linux/vfio.h index eb563f538dee..217ba4ef1752 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -297,6 +297,8 @@ static inline void vfio_put_device(struct vfio_device *= device) int vfio_register_group_dev(struct vfio_device *device); int vfio_register_emulated_iommu_dev(struct vfio_device *device); void vfio_unregister_group_dev(struct vfio_device *device); +bool vfio_device_try_get_registration(struct vfio_device *device); +void vfio_device_put_registration(struct vfio_device *device); =20 int vfio_assign_device_set(struct vfio_device *device, void *set_id); unsigned int vfio_device_set_open_count(struct vfio_device_set *dev_set); --=20 2.51.0