lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 Nov 2023 16:52:25 +0800
From: Yi Liu <yi.l.liu@...el.com>
To: Cindy Lu <lulu@...hat.com>, <jasowang@...hat.com>, <mst@...hat.com>,
	<jgg@...dia.com>, <linux-kernel@...r.kernel.org>,
	<virtualization@...ts.linux-foundation.org>, <netdev@...r.kernel.org>
Subject: Re: [RFC v1 4/8] vdpa: Add new vdpa_config_ops to support iommufd

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@...hat.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ