[RFC,6/7] vdpa_sim :Add support for iommufd

Message ID 20230923170540.1447301-7-lulu@redhat.com
State New
Headers
Series vdpa: Add support for iommufd |

Commit Message

Cindy Lu Sept. 23, 2023, 5:05 p.m. UTC
  Add new vdpa_config_ops to support iommufd

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 drivers/vdpa/vdpa_sim/vdpa_sim.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Jason Gunthorpe Sept. 25, 2023, 1:46 p.m. UTC | #1
On Sun, Sep 24, 2023 at 01:05:39AM +0800, Cindy Lu wrote:
> Add new vdpa_config_ops to support iommufd
> 
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
>  drivers/vdpa/vdpa_sim/vdpa_sim.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index cb88891b44a8..55e6f45bb274 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -727,6 +727,10 @@ static const struct vdpa_config_ops vdpasim_config_ops = {
>  	.dma_map                = vdpasim_dma_map,
>  	.dma_unmap              = vdpasim_dma_unmap,
>  	.free                   = vdpasim_free,
> +	.bind_iommufd			= vdpa_iommufd_emulated_bind,
> +	.unbind_iommufd			= vdpa_iommufd_emulated_unbind,
> +	.attach_ioas			= vdpa_iommufd_emulated_attach_ioas,
> +	.detach_ioas			= vdpa_iommufd_emulated_detach_ioas,
>  };

Er, this series never calls iommufd_access_pin_pages() or
iommufd_access_rw(), so something pretty big is missing

Jason
  

Patch

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index cb88891b44a8..55e6f45bb274 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -727,6 +727,10 @@  static const struct vdpa_config_ops vdpasim_config_ops = {
 	.dma_map                = vdpasim_dma_map,
 	.dma_unmap              = vdpasim_dma_unmap,
 	.free                   = vdpasim_free,
+	.bind_iommufd			= vdpa_iommufd_emulated_bind,
+	.unbind_iommufd			= vdpa_iommufd_emulated_unbind,
+	.attach_ioas			= vdpa_iommufd_emulated_attach_ioas,
+	.detach_ioas			= vdpa_iommufd_emulated_detach_ioas,
 };
 
 static const struct vdpa_config_ops vdpasim_batch_config_ops = {
@@ -759,6 +763,10 @@  static const struct vdpa_config_ops vdpasim_batch_config_ops = {
 	.set_group_asid         = vdpasim_set_group_asid,
 	.set_map                = vdpasim_set_map,
 	.free                   = vdpasim_free,
+	.bind_iommufd		= vdpa_iommufd_emulated_bind,
+	.unbind_iommufd		= vdpa_iommufd_emulated_unbind,
+	.attach_ioas		= vdpa_iommufd_emulated_attach_ioas,
+	.detach_ioas		= vdpa_iommufd_emulated_detach_ioas,
 };
 
 MODULE_VERSION(DRV_VERSION);