From nobody Thu Oct 2 02:05:44 2025 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 743A1285C87; Thu, 25 Sep 2025 13:19:03 +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=1758806343; cv=none; b=sG1GXrR43WjCGl1zzgnKw5gioFvPTNfQg0SWV0AeVPqXY76aOgLAAVEvL5vVM0qZ7Xdw42PJRXmT1pT/sBVz7+SclyPo7Dpv9O1pF3BmR22N8S2a1rhb/Nv5L37o/ZHiCkpCp5dEQLmvZ9GsjcyMfnpauUM+Hq2utaCiUyLcNXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758806343; c=relaxed/simple; bh=XSq9qJYMvX5x9A0SGQeu7EMmnMC35VY7+EoC77mNcp8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WbB0m95rmz3YpTIKS/6/V+72dZ+qdHRO3F4Q5vQgEKBIUPJxK8J6EZuDCa04hZI+wsFjnLdLrMbMOGhTKWi1a1kvs7Bw9bV2voxbcqJwuNIeooa5Te16pcffIWLyeDvYbzxNhDpeOQbu2gM59ytfa1Z8UO5+8RezkngpreWFs4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sYD5NkY/; 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="sYD5NkY/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D723FC4CEF0; Thu, 25 Sep 2025 13:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758806343; bh=XSq9qJYMvX5x9A0SGQeu7EMmnMC35VY7+EoC77mNcp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sYD5NkY/gt6PJ9290ed0uQCf1pREgS8pIpgHC8i+dKrn31Vnb/TT+6MTBrwxDYuDe N+OmD7Vbe7zFg2ltYJPJHLB7n6ZRqSFnIlER9Pduq8ZdF924/6Gm9GYCiuEBoZmLTA BdyaUZ5sLxNEbSvDiuPsuIu6PK3tpo615K0i2bgIUHcAYTKZ9+QiXnl0x/ly2j2C4f iJwp+JVovB9uxnZalgMBG8t3Y86tYogcTQ4gg1ERwW1S8mGJIhYBNmnkGDfFII5IOE RSK2LjQxW1bymbGPb/UjVBjq7Qizrl0JKsnPhtMe1ys0+dXLDRTFIFAfdc8tQE4KEI iy5XvSaeafdNg== From: Leon Romanovsky To: Alex Williamson Cc: Vivek Kasireddy , Jason Gunthorpe , Andrew Morton , Bjorn Helgaas , =?UTF-8?q?Christian=20K=C3=B6nig?= , dri-devel@lists.freedesktop.org, iommu@lists.linux.dev, Jens Axboe , Joerg Roedel , kvm@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, Logan Gunthorpe , Marek Szyprowski , Robin Murphy , Sumit Semwal , Will Deacon Subject: [PATCH v3 06/10] vfio: Export vfio device get and put registration helpers Date: Thu, 25 Sep 2025 16:14:34 +0300 Message-ID: <4b6d97b645d7cfeee1f7435251ac87ec37edd681.1758804980.git.leon@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 5046cae052224..2f0dcec67ffe3 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -171,11 +171,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 eb563f538dee5..217ba4ef17522 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