mbox series

[iommufd,0/2] Make mdev driver dma_unmap callback tolerant to unmaps come before device open

Message ID 20221123134832.429589-1-yi.l.liu@intel.com (mailing list archive)
Headers show
Series Make mdev driver dma_unmap callback tolerant to unmaps come before device open | expand

Message

Yi Liu Nov. 23, 2022, 1:48 p.m. UTC
Jason's "Connect VFIO to IOMMUFD" introduces vfio iommufd compat mode. Under
this mode, vfio_iommufd_bind() creates an access which has an unmap callback,
which can be called immediately. This means mdev drivers may receive unmap
requests before the mdev is opened. For now, most dma_unmap() callbacks are
tolerant with such unmap requests, except for gvt-g and vfio-ap. This series
tries to enhance the two drivers.

This series is based on Jason's below branch.

https://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git/log/?h=for-next
(commit: 57f62422b6f0477afaddd2fc77a4bb9b94275f42)

Cc: Tony Krowiak <akrowiak@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Jason Herne <jjherne@linux.ibm.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>

Regards,
	Yi Liu

Matthew Rosato (1):
  vfio/ap: validate iova during dma_unmap and trigger irq disable

Yi Liu (1):
  i915/gvt: Move kvmgt_protect_table_init() and gvt_cache_init() into
    init

 drivers/gpu/drm/i915/gvt/gvt.h    |  2 ++
 drivers/gpu/drm/i915/gvt/kvmgt.c  |  7 ++-----
 drivers/gpu/drm/i915/gvt/vgpu.c   |  2 ++
 drivers/s390/crypto/vfio_ap_ops.c | 24 +++++++++++++++++++++++-
 4 files changed, 29 insertions(+), 6 deletions(-)

Comments

Tian, Kevin Nov. 24, 2022, 6:50 a.m. UTC | #1
> From: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Wednesday, November 23, 2022 9:49 PM
> 
> Jason's "Connect VFIO to IOMMUFD" introduces vfio iommufd compat mode.
> Under
> this mode, vfio_iommufd_bind() creates an access which has an unmap
> callback,
> which can be called immediately. This means mdev drivers may receive
> unmap
> requests before the mdev is opened. For now, most dma_unmap() callbacks
> are
> tolerant with such unmap requests, except for gvt-g and vfio-ap. This series
> tries to enhance the two drivers.
> 

there are only three drivers (gvt, vfio-ap and vfio-ccw) providing
dma_unmap(). 

I'd not call the situation where only one driver is OK as "most
dma_unmap() callbacks are tolerant".
Yi Liu Nov. 24, 2022, 9:44 a.m. UTC | #2
On 2022/11/24 14:50, Tian, Kevin wrote:
>> From: Liu, Yi L <yi.l.liu@intel.com>
>> Sent: Wednesday, November 23, 2022 9:49 PM
>>
>> Jason's "Connect VFIO to IOMMUFD" introduces vfio iommufd compat mode.
>> Under
>> this mode, vfio_iommufd_bind() creates an access which has an unmap
>> callback,
>> which can be called immediately. This means mdev drivers may receive
>> unmap
>> requests before the mdev is opened. For now, most dma_unmap() callbacks
>> are
>> tolerant with such unmap requests, except for gvt-g and vfio-ap. This series
>> tries to enhance the two drivers.
>>
> 
> there are only three drivers (gvt, vfio-ap and vfio-ccw) providing
> dma_unmap().
> 
> I'd not call the situation where only one driver is OK as "most
> dma_unmap() callbacks are tolerant".

oh, yes. will refine it.
Zhenyu Wang Nov. 25, 2022, 6:06 a.m. UTC | #3
On 2022.11.23 05:48:30 -0800, Yi Liu wrote:
> Jason's "Connect VFIO to IOMMUFD" introduces vfio iommufd compat mode. Under
> this mode, vfio_iommufd_bind() creates an access which has an unmap callback,
> which can be called immediately. This means mdev drivers may receive unmap
> requests before the mdev is opened. For now, most dma_unmap() callbacks are
> tolerant with such unmap requests, except for gvt-g and vfio-ap. This series
> tries to enhance the two drivers.
> 
> This series is based on Jason's below branch.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git/log/?h=for-next
> (commit: 57f62422b6f0477afaddd2fc77a4bb9b94275f42)
> 
> Cc: Tony Krowiak <akrowiak@linux.ibm.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Jason Herne <jjherne@linux.ibm.com>
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> Cc: Kevin Tian <kevin.tian@intel.com>
> 
> Regards,
> 	Yi Liu
> 
> Matthew Rosato (1):
>   vfio/ap: validate iova during dma_unmap and trigger irq disable
> 
> Yi Liu (1):
>   i915/gvt: Move kvmgt_protect_table_init() and gvt_cache_init() into
>     init

btw, for gvt change, pls at least add intel-gvt-dev@lists.freedesktop.org in cc.

thanks

> 
>  drivers/gpu/drm/i915/gvt/gvt.h    |  2 ++
>  drivers/gpu/drm/i915/gvt/kvmgt.c  |  7 ++-----
>  drivers/gpu/drm/i915/gvt/vgpu.c   |  2 ++
>  drivers/s390/crypto/vfio_ap_ops.c | 24 +++++++++++++++++++++++-
>  4 files changed, 29 insertions(+), 6 deletions(-)
> 
> -- 
> 2.34.1
>
Yi Liu Nov. 25, 2022, 8:58 a.m. UTC | #4
On 2022/11/25 14:06, Zhenyu Wang wrote:
> On 2022.11.23 05:48:30 -0800, Yi Liu wrote:
>> Jason's "Connect VFIO to IOMMUFD" introduces vfio iommufd compat mode. Under
>> this mode, vfio_iommufd_bind() creates an access which has an unmap callback,
>> which can be called immediately. This means mdev drivers may receive unmap
>> requests before the mdev is opened. For now, most dma_unmap() callbacks are
>> tolerant with such unmap requests, except for gvt-g and vfio-ap. This series
>> tries to enhance the two drivers.
>>
>> This series is based on Jason's below branch.
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git/log/?h=for-next
>> (commit: 57f62422b6f0477afaddd2fc77a4bb9b94275f42)
>>
>> Cc: Tony Krowiak <akrowiak@linux.ibm.com>
>> Cc: Halil Pasic <pasic@linux.ibm.com>
>> Cc: Jason Herne <jjherne@linux.ibm.com>
>> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
>> Cc: Zhi Wang <zhi.a.wang@intel.com>
>> Cc: Kevin Tian <kevin.tian@intel.com>
>>
>> Regards,
>> 	Yi Liu
>>
>> Matthew Rosato (1):
>>    vfio/ap: validate iova during dma_unmap and trigger irq disable
>>
>> Yi Liu (1):
>>    i915/gvt: Move kvmgt_protect_table_init() and gvt_cache_init() into
>>      init
> 
> btw, for gvt change, pls at least add intel-gvt-dev@lists.freedesktop.org in cc.

sure. :-)