mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yi Liu <yi.l.liu@intel.com>
To: Cindy Lu <lulu@redhat.com>, <jasowang@redhat.com>,
	<mst@redhat.com>, <jgg@nvidia.com>,
	<linux-kernel@vger.kernel.org>,
	<virtualization@lists.linux-foundation.org>,
	<netdev@vger.kernel.org>
Subject: Re: [RFC v1 4/8] vdpa: Add new vdpa_config_ops to support iommufd
Date: Mon, 6 Nov 2023 16:52:25 +0800	[thread overview]
Message-ID: <c6e7a2b1-1c5f-42cb-8b2b-49118ea0aa0c@intel.com> (raw)
In-Reply-To: <20231103171641.1703146-5-lulu@redhat.com>

On 2023/11/4 01:16, Cindy Lu wrote:
> Add 4 new vdpa_config_ops function to support iommufd
> 
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
>   include/linux/vdpa.h | 38 +++++++++++++++++++++++++++++++++++++-
>   1 file changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> index 0e652026b776..233d80f9d910 100644
> --- a/include/linux/vdpa.h
> +++ b/include/linux/vdpa.h
> @@ -5,6 +5,7 @@
>   #include <linux/kernel.h>
>   #include <linux/device.h>
>   #include <linux/interrupt.h>
> +#include <linux/iommufd.h>
>   #include <linux/vhost_iotlb.h>
>   #include <linux/virtio_net.h>
>   #include <linux/if_ether.h>
> @@ -97,6 +98,12 @@ struct vdpa_device {
>   	struct vdpa_mgmt_dev *mdev;
>   	unsigned int ngroups;
>   	unsigned int nas;
> +	struct iommufd_access *iommufd_access;
> +	struct iommufd_device *iommufd_device;
> +	struct iommufd_ctx *iommufd_ictx;
> +	unsigned long *vq_bitmap;
> +	atomic_t iommufd_users;
> +	bool iommufd_attached;
>   };
>   
>   /**
> @@ -332,6 +339,17 @@ struct vdpa_map_file {
>    *				@vdev: vdpa device
>    * @free:			Free resources that belongs to vDPA (optional)
>    *				@vdev: vdpa device
> + * @bind_iommufd:              use vdpa_iommufd_physical_bind for an IOMMU
> + *                             backed device.
> + *                             otherwise use vdpa_iommufd_emulated_bind
> + * @unbind_iommufd:            use vdpa_iommufd_physical_unbind for an IOMMU
> + *                             backed device.
> + *                             otherwise, use vdpa_iommufd_emulated_unbind
> + * @attach_ioas:               use vdpa_iommufd_physical_attach_ioas for an
> + *                             IOMMU backed device.
> + * @detach_ioas:               Opposite of attach_ioas
> + * @free:			Free resources that belongs to vDPA (optional)
> + *				@vdev: vdpa device

duplicated kdoc.

>    */
>   struct vdpa_config_ops {
>   	/* Virtqueue ops */
> @@ -402,6 +420,13 @@ struct vdpa_config_ops {
>   
>   	/* Free device resources */
>   	void (*free)(struct vdpa_device *vdev);
> +	/* IOMMUFD ops */
> +	int (*bind_iommufd)(struct vdpa_device *vdev, struct iommufd_ctx *ictx,
> +			    u32 *out_device_id);
> +	void (*unbind_iommufd)(struct vdpa_device *vdev);
> +	int (*attach_ioas)(struct vdpa_device *vdev, u32 *pt_id);
> +	int (*detach_ioas)(struct vdpa_device *vdev);
> +
>   };
>   
>   struct vdpa_device *__vdpa_alloc_device(struct device *parent,
> @@ -570,4 +595,15 @@ struct vdpa_mgmt_dev {
>   int vdpa_mgmtdev_register(struct vdpa_mgmt_dev *mdev);
>   void vdpa_mgmtdev_unregister(struct vdpa_mgmt_dev *mdev);
>   
> -#endif /* _LINUX_VDPA_H */
> +int vdpa_iommufd_physical_bind(struct vdpa_device *vdpa,
> +			       struct iommufd_ctx *ictx, u32 *out_device_id);
> +void vdpa_iommufd_physical_unbind(struct vdpa_device *vdpa);
> +int vdpa_iommufd_physical_attach_ioas(struct vdpa_device *vdpa, u32 *pt_id);
> +int vdpa_iommufd_physical_detach_ioas(struct vdpa_device *vdpa);
> +int vdpa_iommufd_emulated_bind(struct vdpa_device *vdpa,
> +			       struct iommufd_ctx *ictx, u32 *out_device_id);
> +void vdpa_iommufd_emulated_unbind(struct vdpa_device *vdpa);
> +int vdpa_iommufd_emulated_attach_ioas(struct vdpa_device *vdpa, u32 *pt_id);
> +int vdpa_iommufd_emulated_detach_ioas(struct vdpa_device *vdpa);
> +
> +#endif

-- 
Regards,
Yi Liu

  reply	other threads:[~2023-11-06  8:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 17:16 [RFC v1 0/8] vhost-vdpa: add support for iommufd Cindy Lu
2023-11-03 17:16 ` [RFC v1 1/8] vhost/iommufd: Add the functions support iommufd Cindy Lu
2023-11-03 17:16 ` [RFC v1 2/8] Kconfig: Add the new file vhost/iommufd Cindy Lu
2023-11-06  8:53   ` Yi Liu
2023-11-07  6:15     ` Cindy Lu
2023-11-03 17:16 ` [RFC v1 3/8] vhost: Add 3 new uapi to support iommufd Cindy Lu
2023-11-06  7:27   ` Jason Wang
2023-11-06  7:30   ` Jason Wang
2023-11-07  6:57     ` Cindy Lu
2023-11-08  3:03       ` Jason Wang
2023-11-08  6:38         ` Cindy Lu
2023-11-08  7:09           ` Jason Wang
2023-11-10  2:31             ` Jason Wang
2023-11-10  6:49               ` Cindy Lu
2023-11-03 17:16 ` [RFC v1 4/8] vdpa: Add new vdpa_config_ops " Cindy Lu
2023-11-06  8:52   ` Yi Liu [this message]
2023-11-03 17:16 ` [RFC v1 5/8] vdpa_sim :Add support for iommufd Cindy Lu
2023-11-03 17:16 ` [RFC v1 6/8] vdpa: change the map/unmap process to support iommufd Cindy Lu
2023-11-06  8:54   ` Yi Liu
2023-11-07  6:14     ` Cindy Lu
2023-11-03 17:16 ` [RFC v1 7/8] vp_vdpa::Add support for iommufd Cindy Lu
2023-11-06  7:25   ` Jason Wang
2023-11-03 17:16 ` [RFC v1 8/8] iommu: expose the function iommu_device_use_default_domain Cindy Lu
2023-11-03 17:37   ` Jason Gunthorpe
2023-11-06  7:26   ` Jason Wang
2023-11-07  6:10     ` Cindy Lu
2023-11-08  3:03       ` Jason Wang
2023-11-08  7:05         ` Cindy Lu
2023-11-06  4:11 ` [RFC v1 0/8] vhost-vdpa: add support for iommufd Jason Wang
2023-11-06  8:05   ` Yi Liu
2023-11-07  7:30 ` Michael S. Tsirkin
2023-11-07 12:49   ` Jason Gunthorpe
2023-11-07 13:28     ` Michael S. Tsirkin
2023-11-07 14:12       ` Jason Gunthorpe
2023-11-07 14:30         ` Michael S. Tsirkin
2023-11-07 15:52           ` Jason Gunthorpe
2023-11-09 23:48             ` Michael S. Tsirkin
2023-11-10 14:00               ` Jason Gunthorpe
2023-11-07 17:02       ` Jakub Kicinski
2023-11-07 14:55     ` Michael S. Tsirkin
2023-11-07 15:48       ` Jason Gunthorpe
2023-11-07 16:11         ` Michael S. Tsirkin
2023-11-07 13:23 ` Michael S. Tsirkin
2024-01-10 22:25 ` Michael S. Tsirkin
2024-01-11  9:02   ` Cindy Lu

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=c6e7a2b1-1c5f-42cb-8b2b-49118ea0aa0c@intel.com \
    --to=yi.l.liu@intel.com \
    --cc=jasowang@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®