All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Lin Guay <wguay@fb.com>
To: <alex.williamson@redhat.com>, <dri-devel@lists.freedesktop.org>,
	<kvm@vger.kernel.org>, <linux-rdma@vger.kernel.org>
Cc: <jgg@nvidia.com>, <vivek.kasireddy@intel.com>,
	<dagmoxnes@meta.com>, <kbusch@kernel.org>, <nviljoen@meta.com>,
	Wei Lin Guay <wguay@meta.com>
Subject: [PATCH 1/4] vfio: Add vfio_device_get()
Date: Mon, 16 Dec 2024 01:54:15 -0800	[thread overview]
Message-ID: <20241216095429.210792-2-wguay@fb.com> (raw)
In-Reply-To: <20241216095429.210792-1-wguay@fb.com>

From: Jason Gunthorpe <jgg@nvidia.com>

Summary:
To increment a reference the caller already holds. Export
vfio_device_put() to pair with it.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Wei Lin Guay <wguay@meta.com>
Reviewed-by: Dag Moxnes <dagmoxnes@meta.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Nic Viljoen <nviljoen@meta.com>
---
 drivers/vfio/vfio_main.c | 1 +
 include/linux/vfio.h     | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index a5a62d9d963f..7e318e15abd5 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -171,6 +171,7 @@ 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);

 bool vfio_device_try_get_registration(struct vfio_device *device)
 {
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 000a6cab2d31..d7c790be4bbc 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -279,6 +279,12 @@ 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);
+void vfio_device_put_registration(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);
 unsigned int vfio_device_set_open_count(struct vfio_device_set *dev_set);
--
2.43.5

  reply	other threads:[~2024-12-16  9:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16  9:54 [PATCH 0/4] cover-letter: Allow MMIO regions to be exported through dmabuf Wei Lin Guay
2024-12-16  9:54 ` Wei Lin Guay [this message]
2024-12-16  9:54 ` [PATCH 2/4] dma-buf: Add dma_buf_try_get() Wei Lin Guay
2024-12-16  9:54 ` [PATCH 3/4] vfio/pci: Allow MMIO regions to be exported through dma-buf Wei Lin Guay
2024-12-16  9:54 ` [PATCH 4/4] vfio/pci: Allow export dmabuf without move_notify from importer Wei Lin Guay
2024-12-16 10:21 ` [PATCH 0/4] cover-letter: Allow MMIO regions to be exported through dmabuf Christian König
2024-12-16 16:54   ` Keith Busch
2024-12-17  9:53     ` Christian König
2024-12-17 11:06       ` Wei Lin Guay
2024-12-17 12:47         ` Christian König
2024-12-18  6:16           ` Kasireddy, Vivek
2024-12-18 10:01             ` Christian König
2024-12-19  7:02               ` Kasireddy, Vivek
2024-12-19 10:04                 ` Christian König
2025-01-02 13:39                   ` Jason Gunthorpe
2025-01-06 12:05                     ` Simona Vetter
2025-01-06 16:27                       ` Jason Gunthorpe
2025-01-08 16:48                         ` Simona Vetter
2024-12-18 10:44       ` Simona Vetter
  -- strict thread matches above, loose matches on Subject: below --
2024-12-16  9:59 Wei Lin Guay
2024-12-16  9:59 ` [PATCH 1/4] vfio: Add vfio_device_get() Wei Lin Guay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241216095429.210792-2-wguay@fb.com \
    --to=wguay@fb.com \
    --cc=alex.williamson@redhat.com \
    --cc=dagmoxnes@meta.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=kbusch@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nviljoen@meta.com \
    --cc=vivek.kasireddy@intel.com \
    --cc=wguay@meta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.