[PATCH v4 15/15] vfio: Add struct device to vfio_device

2022-09-20 Thread Kevin Tian
ing future device-oriented uAPI. Add Documentation/ABI/testing/sysfs-devices-vfio-dev. Suggested-by: Jason Gunthorpe Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe --- .../ABI/testing/sysfs-devices-vfio-dev| 8 +++ MAINTAINERS

[PATCH v4 14/15] vfio: Rename vfio_device_put() and vfio_device_try_get()

2022-09-20 Thread Kevin Tian
() -> vfio_device_put_registration() - vfio_device_try_get() -> vfio_device_try_get_registration() Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Auger --- drivers/vfio/vfio_main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/vfio_ma

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

2022-09-20 Thread Kevin Tian
The right fix is to introduce separate structures for mdev and parent, but this won't happen in short term per prior discussions. Remove vfio_init/uninit_group_dev() as no user now. Suggested-by: Jason Gunthorpe Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe Reviewed-by: E

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

2022-09-20 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Auger --- drivers/vfio/platform/vfio_amba.c | 72 ++- drivers/vfio/pla

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

2022-09-20 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

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

2022-09-20 Thread Kevin Tian
From: Yi Liu Also add a comment to mark that vfio core releases device_set if @init fails. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 85 ++- 1 file changed, 49 insertions(+), 36 deletions

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

2022-09-20 Thread Kevin Tian
From: Yi Liu and manage available_instances inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Tony Krowiak Reviewed-by: Jason Gunthorpe --- drivers/s390/crypto/vfio_ap_ops.c | 50 ++- 1 file changed, 29 insertions(+), 21

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

2022-09-20 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Zhenyu Wang --- drivers/gpu/drm/i915/gvt/gvt.h | 5

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

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

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

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

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

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

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

2022-09-20 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Shameer Kolothum

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

2022-09-20 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/mlx5/main.c | 50 ++-- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a

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

2022-09-20 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 20 +- drivers

[PATCH v4 01/15] vfio: Add helpers for unifying vfio_device life cycle

2022-09-20 Thread Kevin Tian
ated after all existing usages are converted to the new model. Suggested-by: Jason Gunthorpe Co-developed-by: Yi Liu Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Tony Krowiak Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Auger --- drivers/vfio/vfio_m

[PATCH v4 00/15] Tidy up vfio_device life cycle

2022-09-20 Thread Kevin Tian
ased by vfio core (Jason) - patch13: add Suggested-by - patch15: add ABI file sysfs-devices-vfio-dev (Alex) - patch15: rename 'vfio' to 'vfio_group' in procfs (Jason) v1: https://lore.kernel.org/lkml/20220827171037.30297-1-kevin.t...@intel.com/ Kevin Tian (6): vfio: Add helpers fo

[PATCH v3 14/15] vfio: Rename vfio_device_put() and vfio_device_try_get()

2022-09-08 Thread Kevin Tian
() -> vfio_device_put_registration() - vfio_device_try_get() -> vfio_device_try_get_registration() Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Auger --- drivers/vfio/vfio_main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/vfio_ma

[PATCH v3 15/15] vfio: Add struct device to vfio_device

2022-09-08 Thread Kevin Tian
ing future device-oriented uAPI. Add Documentation/ABI/testing/sysfs-devices-vfio-dev. Also take this chance to rename chardev 'vfio' to 'vfio-group' in /proc/devices. Suggested-by: Jason Gunthorpe Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthor

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

2022-09-08 Thread Kevin Tian
The right fix is to introduce separate structures for mdev and parent, but this won't happen in short term per prior discussions. Remove vfio_init/uninit_group_dev() as no user now. Suggested-by: Jason Gunthorpe Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe Reviewed-by: E

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

2022-09-08 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Auger --- drivers/vfio/platform/vfio_amba.c | 72 ++- drivers/vfio/pla

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

2022-09-08 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Zhenyu Wang --- drivers/gpu/drm/i915/gvt/gvt.h | 5

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

2022-09-08 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

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

2022-09-08 Thread Kevin Tian
From: Yi Liu Also add a comment to mark that vfio core releases device_set if @init fails. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 85 ++- 1 file changed, 49 insertions(+), 36 deletions

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

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

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

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

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

2022-09-08 Thread Kevin Tian
From: Yi Liu and manage available_instances inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Tony Krowiak Reviewed-by: Jason Gunthorpe --- drivers/s390/crypto/vfio_ap_ops.c | 50 ++- 1 file changed, 29 insertions(+), 21

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

2022-09-08 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/mlx5/main.c | 50 ++-- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a

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

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

[PATCH v3 01/15] vfio: Add helpers for unifying vfio_device life cycle

2022-09-08 Thread Kevin Tian
ated after all existing usages are converted to the new model. Suggested-by: Jason Gunthorpe Co-developed-by: Yi Liu Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Tony Krowiak Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Auger --- drivers/vfio/vfio_m

[PATCH v3 00/15] Tidy up vfio_device life cycle

2022-09-08 Thread Kevin Tian
re (Jason) - patch13: add Suggested-by - patch15: add ABI file sysfs-devices-vfio-dev (Alex) - patch15: rename 'vfio' to 'vfio_group' in procfs (Jason) v1: https://lore.kernel.org/lkml/20220827171037.30297-1-kevin.t...@intel.com/ Kevin Tian (6): vfio: Add helpers for unify

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

2022-09-08 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Shameer Kolothum

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

2022-09-08 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 20 +- drivers

[PATCH v2 15/15] vfio: Add struct device to vfio_device

2022-09-01 Thread Kevin Tian
ing future device-oriented uAPI. Add Documentation/ABI/testing/sysfs-devices-vfio-dev. Also take this chance to rename chardev 'vfio' to 'vfio-group' in /proc/devices. Suggested-by: Jason Gunthorpe Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthor

[PATCH v2 14/15] vfio: Rename vfio_device_put() and vfio_device_try_get()

2022-09-01 Thread Kevin Tian
() -> vfio_device_put_registration() - vfio_device_try_get() -> vfio_device_try_get_registration() Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe --- drivers/vfio/vfio_main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_

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

2022-09-01 Thread Kevin Tian
The right fix is to introduce separate structures for mdev and parent, but this won't happen in short term per prior discussions. Remove vfio_init/uninit_group_dev() as no user now. Suggested-by: Jason Gunthorpe Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe --- drivers/s390/cio/vfio

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

2022-09-01 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

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

2022-09-01 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/platform/vfio_amba.c | 72 ++- drivers/vfio/platform/vfio_platform_common.c

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

2022-09-01 Thread Kevin Tian
From: Yi Liu Also add a comment to mark that vfio core releases device_set if @init fails. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Jason Gunthorpe --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 85 ++- 1 file changed, 49 insertions(+), 36 deletions

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

2022-09-01 Thread Kevin Tian
From: Yi Liu and manage available_instances inside @init/@release. Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Tony Krowiak Reviewed-by: Jason Gunthorpe --- drivers/s390/crypto/vfio_ap_ops.c | 50 ++- 1 file changed, 29 insertions(+), 21

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

2022-09-01 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 Reviewed-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/gvt.h | 5 ++- drivers/gpu/drm/i915

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

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

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

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

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

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

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

2022-09-01 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 Reviewed-by: Jason Gunthorpe Reviewed-by: Shameer Kolothum

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

2022-09-01 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/mlx5/main.c | 49 ++-- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a

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

2022-09-01 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 Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 20 +- drivers

[PATCH v2 01/15] vfio: Add helpers for unifying vfio_device life cycle

2022-09-01 Thread Kevin Tian
usages are converted to the new model. Suggested-by: Jason Gunthorpe Co-developed-by: Yi Liu Signed-off-by: Yi Liu Signed-off-by: Kevin Tian Reviewed-by: Tony Krowiak Reviewed-by: Jason Gunthorpe --- drivers/vfio/vfio_main.c | 92 include/linux/vfio.

[PATCH v2 00/15] Tidy up vfio_device life cycle

2022-09-01 Thread Kevin Tian
tml [2] https://lore.kernel.org/all/0ee29bd6583f17f0ee4ec0769fa50e8ea6703623.ca...@linux.ibm.com/ Kevin Tian (6): vfio: Add helpers for unifying vfio_device life cycle drm/i915/gvt: Use the new device life cycle helpers vfio/platform: Use the new device life cycle helpers vfio/amba: Use the new

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

2022-08-27 Thread Kevin Tian
ing future device-oriented uAPI. Suggested-by: Jason Gunthorpe Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- drivers/vfio/vfio_main.c | 70 +--- include/linux/vfio.h | 6 ++-- 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/dr

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

2022-08-27 Thread Kevin Tian
() -> vfio_device_put_registration() - vfio_device_try_get() -> vfio_device_try_get_registration() Signed-off-by: Kevin Tian --- drivers/vfio/vfio_main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 15a612

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

2022-08-27 Thread Kevin Tian
The right fix is to introduce separate structures for mdev and parent, but this won't happen in short term per prior discussions. Remove vfio_init/uninit_group_dev() as no user now. Signed-off-by: Kevin Tian --- drivers/s390/cio/vfio_ccw_ops.c | 52 + driver

[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 - drivers/vfio/pla

[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

[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 b

[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

[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

[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 b/samples/vfio

[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 b/samples/vfio

[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 b/samples/vfio-mdev

[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

[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 b

[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

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

2022-08-27 Thread Kevin Tian
all existing usages are converted to the new model. Suggested-by: Jason Gunthorpe Co-developed-by: Yi Liu Signed-off-by: Yi Liu Signed-off-by: Kevin Tian --- drivers/vfio/vfio_main.c | 92 include/linux/vfio.h | 25 ++- 2 files changed,

[PATCH 00/15] Tidy up vfio_device life cycle

2022-08-27 Thread Kevin Tian
Thanks Kevin [1] https://listman.redhat.com/archives/libvir-list/2022-August/233482.html [2] https://lore.kernel.org/all/0ee29bd6583f17f0ee4ec0769fa50e8ea6703623.ca...@linux.ibm.com/ Kevin Tian (6): vfio: Add helpers for unifying vfio_device life cycle drm/i915/gvt: Use the new device li