linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: virtualization@lists.linux-foundation.org
Cc: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
	eperezma@redhat.com, netdev@vger.kernel.org, stefanha@redhat.com,
	linux-kernel@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	kvm@vger.kernel.org, Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH v2 1/8] vdpa: add bind_mm/unbind_mm callbacks
Date: Thu,  2 Mar 2023 12:34:14 +0100	[thread overview]
Message-ID: <20230302113421.174582-2-sgarzare@redhat.com> (raw)
In-Reply-To: <20230302113421.174582-1-sgarzare@redhat.com>

These new optional callbacks is used to bind/unbind the device to
a specific address space so the vDPA framework can use VA when
these callbacks are implemented.

Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---

Notes:
    v2:
    - removed `struct task_struct *owner` param (unused for now, maybe
      useful to support cgroups) [Jason]
    - add unbind_mm callback [Jason]

 include/linux/vdpa.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index 43f59ef10cc9..369c21394284 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -290,6 +290,14 @@ struct vdpa_map_file {
  *				@vdev: vdpa device
  *				@idx: virtqueue index
  *				Returns pointer to structure device or error (NULL)
+ * @bind_mm:			Bind the device to a specific address space
+ *				so the vDPA framework can use VA when this
+ *				callback is implemented. (optional)
+ *				@vdev: vdpa device
+ *				@mm: address space to bind
+ * @unbind_mm:			Unbind the device from the address space
+ *				bound using the bind_mm callback. (optional)
+ *				@vdev: vdpa device
  * @free:			Free resources that belongs to vDPA (optional)
  *				@vdev: vdpa device
  */
@@ -351,6 +359,8 @@ struct vdpa_config_ops {
 	int (*set_group_asid)(struct vdpa_device *vdev, unsigned int group,
 			      unsigned int asid);
 	struct device *(*get_vq_dma_dev)(struct vdpa_device *vdev, u16 idx);
+	int (*bind_mm)(struct vdpa_device *vdev, struct mm_struct *mm);
+	void (*unbind_mm)(struct vdpa_device *vdev);
 
 	/* Free device resources */
 	void (*free)(struct vdpa_device *vdev);
-- 
2.39.2


  reply	other threads:[~2023-03-02 11:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 11:34 [PATCH v2 0/8] vdpa_sim: add support for user VA Stefano Garzarella
2023-03-02 11:34 ` Stefano Garzarella [this message]
2023-03-14  3:39   ` [PATCH v2 1/8] vdpa: add bind_mm/unbind_mm callbacks Jason Wang
2023-03-16  8:17     ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 2/8] vhost-vdpa: use bind_mm/unbind_mm device callbacks Stefano Garzarella
2023-03-14  3:48   ` Jason Wang
2023-03-16  8:31     ` Stefano Garzarella
2023-03-16 10:11       ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 3/8] vringh: replace kmap_atomic() with kmap_local_page() Stefano Garzarella
2023-03-14  3:56   ` Jason Wang
2023-03-15 21:12     ` Fabio M. De Francesco
2023-03-16  2:53       ` Jason Wang
2023-03-16  8:09       ` Stefano Garzarella
2023-03-16  9:25         ` Fabio M. De Francesco
2023-03-16  9:13   ` Fabio M. De Francesco
2023-03-16  9:17     ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 4/8] vringh: support VA with iotlb Stefano Garzarella
2023-03-03 14:38   ` Eugenio Perez Martin
2023-03-07  9:31     ` Stefano Garzarella
2023-03-16 16:07     ` Stefano Garzarella
2023-03-17  2:53       ` Jason Wang
2023-03-17  9:49       ` Eugenio Perez Martin
2023-03-17 11:25         ` Stefano Garzarella
2023-03-14  4:53   ` Jason Wang
2023-03-16  8:38     ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 5/8] vdpa_sim: make devices agnostic for work management Stefano Garzarella
2023-03-03 14:40   ` Eugenio Perez Martin
2023-03-14  5:27   ` Jason Wang
2023-03-02 11:34 ` [PATCH v2 6/8] vdpa_sim: use kthread worker Stefano Garzarella
2023-03-02 15:30   ` Simon Horman
2023-03-02 15:48     ` Stefano Garzarella
2023-03-05 11:21   ` kernel test robot
2023-03-14  5:31   ` Jason Wang
2023-03-02 11:34 ` [PATCH v2 7/8] vdpa_sim: replace the spinlock with a mutex to protect the state Stefano Garzarella
2023-03-14  5:29   ` Jason Wang
2023-03-14  5:31     ` Jason Wang
2023-03-16  8:42       ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 8/8] vdpa_sim: add support for user VA Stefano Garzarella
2023-03-14  5:36   ` Jason Wang
2023-03-16  9:11     ` Stefano Garzarella

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=20230302113421.174582-2-sgarzare@redhat.com \
    --to=sgarzare@redhat.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).