Re: [Intel-gfx] [PATCH 00/15] Tidy up vfio_device life cycle

2022-08-27 Thread Tian, Kevin
lkp reported some warnings below. I'll got them fixed in the next version. Not sure why they are not captured in my builds though I did turn on treating warnings as error. drivers/vfio/fsl-mc/vfio_fsl_mc.c:570:6: warning: no previous prototype for 'vfio_fsl_mc_release_dev' [-Wmissing-prototypes]

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/vm_bind: Add VM_BIND functionality (rev2)

2022-08-27 Thread Patchwork
== Series Details == Series: drm/i915/vm_bind: Add VM_BIND functionality (rev2) URL : https://patchwork.freedesktop.org/series/105879/ State : failure == Summary == CI Bug Log - changes from CI_DRM_12035 -> Patchwork_105879v2 Summary

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/vm_bind: Add VM_BIND functionality (rev2)

2022-08-27 Thread Patchwork
== Series Details == Series: drm/i915/vm_bind: Add VM_BIND functionality (rev2) URL : https://patchwork.freedesktop.org/series/105879/ State : warning == Summary == Error: dim sparse failed Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately.

[Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/vm_bind: Add VM_BIND functionality (rev2)

2022-08-27 Thread Patchwork
== Series Details == Series: drm/i915/vm_bind: Add VM_BIND functionality (rev2) URL : https://patchwork.freedesktop.org/series/105879/ State : warning == Summary == Error: make htmldocs had i915 warnings ./include/uapi/drm/i915_drm.h:2655: warning: Function parameter or member 'flags' not

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/vm_bind: Add VM_BIND functionality (rev2)

2022-08-27 Thread Patchwork
== Series Details == Series: drm/i915/vm_bind: Add VM_BIND functionality (rev2) URL : https://patchwork.freedesktop.org/series/105879/ State : warning == Summary == Error: dim checkpatch failed 0189f6e65191 drm/i915: Expose vm_lookup in i915_gem_context.h d15754f0b129 drm/i915: Mark vm for

[Intel-gfx] [RFC PATCH v3 11/17] drm/i915: Add i915_vma_is_bind_complete()

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Add i915_vma_is_bind_complete() to check if the binding of a of the VM of a specific VMA is complete. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/i915_vma.c | 28

[Intel-gfx] [RFC PATCH v3 14/17] drm/i915/vm_bind: Skip vma_lookup for persistent vmas

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura vma_lookup is tied to segment of the object instead of section of VA space. Hence, it do not support aliasing (ie., multiple bindings to the same section of the object). Skip vma_lookup for persistent vmas as it supports aliasing. Signed-off-by: Niranjana

[Intel-gfx] [RFC PATCH v3 17/17] drm/i915: Enable execbuf3 ioctl for vm_bind

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Add the uapi for the implemented execbuf3 ioctl to present it for userspace. This ioctl can be used only for vm_bind mode and vm_binded batchbuffers can be submitted only through execbuf3 ioctl. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam

[Intel-gfx] [RFC PATCH v3 16/17] drm/i915/ioctl: Enable the vm_bind/unbind ioctls

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Add ioctls to enable the vm_bind and vm_unbind feature Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/i915_driver.c | 2 ++ include/uapi/drm/i915_drm.h| 4 2 files changed,

[Intel-gfx] [RFC PATCH v3 15/17] drm/i915: Extend getparm for VM_BIND capability

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Add getparam support for VM_BIND capability version support. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/i915_getparam.c | 3 +++ include/uapi/drm/i915_drm.h | 21

[Intel-gfx] [RFC PATCH v3 13/17] drm/i915/vm_bind: userptr dma-resv changes

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura For persistent (vm_bind) vmas of userptr BOs, handle the user page pinning by using the i915_gem_object_userptr_submit_init() /done() functions Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti ---

[Intel-gfx] [RFC PATCH v3 12/17] drm/i915/vm_bind: Handle persistent vmas in execbuf3

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Handle persistent (VM_BIND) mappings during the request submission in the execbuf3 path. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- .../gpu/drm/i915/gem/i915_gem_execbuffer3.c | 200 +-

[Intel-gfx] [RFC PATCH v3 10/17] drm/i915/vm_bind: Implement I915_GEM_EXECBUFFER3 ioctl

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Implement new execbuf3 ioctl (I915_GEM_EXECBUFFER3) which only works in vm_bind mode. The vm_bind mode only works with this new execbuf3 ioctl. The new execbuf3 ioctl will not have any list of objects to validate bind as all required objects binding would have

[Intel-gfx] [RFC PATCH v3 08/17] drm/i915/vm_bind: Add out fence support

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Add support for handling out fence of vm_bind call. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/gem/i915_gem_vm_bind.h | 3 + .../drm/i915/gem/i915_gem_vm_bind_object.c| 82

[Intel-gfx] [RFC PATCH v3 09/17] drm/i915: Do not support vm_bind mode in execbuf2

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Do not support the vm in vm_bind_mode in execbuf2 ioctl. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 5 + 1 file changed, 5 insertions(+) diff --git

[Intel-gfx] [RFC PATCH v3 01/17] drm/i915: Expose vm_lookup in i915_gem_context.h

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura To reuse i915_gem_vm_lookup in upcoming implementation, expose it in i915_gem_context.h Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 11 ++-

[Intel-gfx] [RFC PATCH v3 07/17] drm/i915/vm_bind: Handle persistent vmas

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Treat VM_BIND vmas as persistent across execbuf ioctl calls and handle them during the request submission in the execbuff path. Support eviction by maintaining a list of evicted persistent vmas for rebinding during next submission. Signed-off-by: Niranjana

[Intel-gfx] [RFC PATCH v3 06/17] drm/i915/dmabuf: Deny the dmabuf export for VM private BOs

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura VM private BOs can be only mapped on specified VM and cannot be dmabuf exported. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 6 ++ 1 file changed, 6

[Intel-gfx] [RFC PATCH v3 05/17] drm/i915: Support for VM private BOs

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Each VM creates a root_obj and shares it with all of its private objects to use it as dma_resv object. This has a performance advantage as it requires a single dma_resv object update for all private BOs vs list of dma_resv objects update for shared BOs, in the

[Intel-gfx] [RFC PATCH v3 04/17] drm/i915: Implement bind and unbind of object

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura Implement the bind and unbind of an object at the specified GPU virtual addresses. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Prathap Kumar Valsan Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/Makefile

[Intel-gfx] [RFC PATCH v3 03/17] drm/i915/gem: expose i915_gem_object_max_page_size() in i915_gem_object.h

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura To reuse i915_gem_object_max_page_size() in upcoming implementation, expose it in i915_gem_object.h Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/gem/i915_gem_create.c | 16

[Intel-gfx] [RFC PATCH v3 02/17] drm/i915: Mark vm for vm_bind usage at creation

2022-08-27 Thread Andi Shyti
From: Niranjana Vishwanathapura At vm creation time, add a flag to indicate that the new vm will use vm_bind only for object binding. Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Ramalingam C Signed-off-by: Andi Shyti --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 5 -

[Intel-gfx] [RFC PATCH v3 00/17] drm/i915/vm_bind: Add VM_BIND functionality

2022-08-27 Thread Andi Shyti
Hi, just sending the original Niranjana's patch as an RFC. It's v3 as the v2 has been reviewed offline with Ramalingam. I'm still keeping most of the structure even though some further discussion can be done starting from here. Copy pasting Niranjana's original cover letter message:

Re: [Intel-gfx] [PATCH 13/15] vfio/ccw: Use the new device life cycle helpers

2022-08-27 Thread Tian, Kevin
This missed a Suggested-by from Jason. Will add in next version. > From: Tian, Kevin > Sent: Sunday, August 28, 2022 1:11 AM > > ccw is the only exception which cannot use vfio_alloc_device() because > its private device structure is designed to serve both mdev and parent. > Life cycle of the

[Intel-gfx] ✓ Fi.CI.BAT: success for Tidy up vfio_device life cycle

2022-08-27 Thread Patchwork
== Series Details == Series: Tidy up vfio_device life cycle URL : https://patchwork.freedesktop.org/series/107838/ State : success == Summary == CI Bug Log - changes from CI_DRM_12035 -> Patchwork_107838v1 Summary --- **SUCCESS**

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Tidy up vfio_device life cycle

2022-08-27 Thread Patchwork
== Series Details == Series: Tidy up vfio_device life cycle URL : https://patchwork.freedesktop.org/series/107838/ State : warning == Summary == Error: dim checkpatch failed 8a1028a5948f vfio: Add helpers for unifying vfio_device life cycle -:69: CHECK:PARENTHESIS_ALIGNMENT: Alignment should

[Intel-gfx] [PATCH 15/15] vfio: Add struct device to vfio_device

2022-08-27 Thread Kevin Tian
From: Yi Liu and replace kref. With it a 'vfio-dev/vfioX' node is created under the sysfs path of the parent, indicating the device is bound to a vfio driver, e.g.: /sys/devices/pci\:6f/\:6f\:01.0/vfio-dev/vfio0 It is also a preparatory step toward adding cdev for supporting future

[Intel-gfx] [PATCH 14/15] vfio: Rename vfio_device_put() and vfio_device_try_get()

2022-08-27 Thread Kevin Tian
With the addition of vfio_put_device() now the names become confusing. vfio_put_device() is clear from object life cycle p.o.v given kref. vfio_device_put()/vfio_device_try_get() are helpers for tracking users on a registered device. Now rename them: - vfio_device_put() ->

[Intel-gfx] [PATCH 13/15] vfio/ccw: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
ccw is the only exception which cannot use vfio_alloc_device() because its private device structure is designed to serve both mdev and parent. Life cycle of the parent is managed by css_driver so vfio_ccw_private must be allocated/freed in css_driver probe/remove path instead of conforming to vfio

[Intel-gfx] [PATCH 12/15] vfio/amba: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
Implement amba's own vfio_device_ops. Remove vfio_platform_probe/remove_common() given no user now. Signed-off-by: Kevin Tian --- drivers/vfio/platform/vfio_amba.c | 72 ++- drivers/vfio/platform/vfio_platform_common.c | 50 -

[Intel-gfx] [PATCH 11/15] vfio/platform: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
Move vfio_device_ops from platform core to platform drivers so device specific init/cleanup can be added. Introduce two new helpers vfio_platform_init/release_common() for the use in driver @init/@release. vfio_platform_probe/remove_common() will be deprecated. Signed-off-by: Kevin Tian ---

[Intel-gfx] [PATCH 10/15] vfio/fsl-mc: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu Export symbol of vfio_release_device_set() so fsl-mc @init can handle the error path cleanly instead of assuming certain vfio core API can help release device_set afterwards. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 87

[Intel-gfx] [PATCH 09/15] vfio/ap: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu and manage available_instances inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- drivers/s390/crypto/vfio_ap_ops.c | 50 ++- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c

[Intel-gfx] [PATCH 08/15] drm/i915/gvt: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
Move vfio_device to the start of intel_vgpu as required by the new helpers. Change intel_gvt_create_vgpu() to use intel_vgpu as the first param as other vgpu helpers do. Signed-off-by: Kevin Tian --- drivers/gpu/drm/i915/gvt/gvt.h | 5 ++- drivers/gpu/drm/i915/gvt/kvmgt.c | 52

[Intel-gfx] [PATCH 07/15] vfio/mbochs: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu and manage avail_mbytes inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- samples/vfio-mdev/mbochs.c | 73 -- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c

[Intel-gfx] [PATCH 06/15] vfio/mtty: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu and manage available ports inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- samples/vfio-mdev/mtty.c | 67 +++- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/samples/vfio-mdev/mtty.c

[Intel-gfx] [PATCH 05/15] vfio/mdpy: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu and manage mdpy_count inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- samples/vfio-mdev/mdpy.c | 81 +++- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/samples/vfio-mdev/mdpy.c

[Intel-gfx] [PATCH 04/15] vfio/hisi_acc: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu Tidy up @probe so all migration specific initialization logic is moved to migration specific @init callback. Remove vfio_pci_core_{un}init_device() given no user now. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c| 80

[Intel-gfx] [PATCH 03/15] vfio/mlx5: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu mlx5 has its own @init/@release for handling migration cap. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- drivers/vfio/pci/mlx5/main.c | 49 ++-- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/drivers/vfio/pci/mlx5/main.c

[Intel-gfx] [PATCH 02/15] vfio/pci: Use the new device life cycle helpers

2022-08-27 Thread Kevin Tian
From: Yi Liu Also introduce two pci core helpers as @init/@release for pci drivers: - vfio_pci_core_init_dev() - vfio_pci_core_release_dev() Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- drivers/vfio/pci/vfio_pci.c | 20 +- drivers/vfio/pci/vfio_pci_core.c | 35

[Intel-gfx] [PATCH 01/15] vfio: Add helpers for unifying vfio_device life cycle

2022-08-27 Thread Kevin Tian
The idea is to let vfio core manage the vfio_device life cycle instead of duplicating the logic cross drivers. This is also a preparatory step for adding struct device into vfio_device. New pair of helpers together with a kref in vfio_device: - vfio_alloc_device() - vfio_put_device() Drivers

[Intel-gfx] [PATCH 00/15] Tidy up vfio_device life cycle

2022-08-27 Thread Kevin Tian
The idea is to let vfio core manage the vfio_device life cycle instead of duplicating the logic cross drivers. Besides cleaner code in driver side this also allows adding struct device to vfio_device as the first step toward adding cdev uAPI in the future. Another benefit is that user can now look