All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] Provide core infrastructure for managing open/release
@ 2021-07-15  0:20 ` Jason Gunthorpe
  0 siblings, 0 replies; 115+ messages in thread
From: Jason Gunthorpe @ 2021-07-15  0:20 UTC (permalink / raw)
  To: David Airlie, Tony Krowiak, Alex Williamson,
	Christian Borntraeger, Cornelia Huck, Jonathan Corbet,
	Daniel Vetter, Diana Craciun, dri-devel, Eric Auger, Eric Farman,
	Harald Freudenberger, Vasily Gorbik, Heiko Carstens, intel-gfx,
	intel-gvt-dev, Jani Nikula, Jason Herne, Joonas Lahtinen, kvm,
	Kirti Wankhede, linux-doc, linux-s390, Matthew Rosato,
	Peter Oberparleiter, Halil Pasic, Rodrigo Vivi, Vineeth Vijayan,
	Zhenyu Wang, Zhi Wang
  Cc: Raj, Ashok, Christoph Hellwig, Leon Romanovsky, Max Gurtovoy,
	Yishai Hadas

Prologue:

This is the first series of three to send the "mlx5_vfio_pci" driver that has
been discussed on the list for a while now.
 - Reorganize reflck to support splitting vfio_pci
 - Split vfio_pci into vfio_pci/vfio_pci_core and provide infrastructure
   for non-generic VFIO PCI drivers
 - The new driver mlx5_vfio_pci that is a full implementation of
   suspend/resume functionality for mlx5 devices.

A preview of all the patches can be seen here:

https://github.com/jgunthorpe/linux/commits/mlx5_vfio_pci

===============

This is in support of Max's series to split vfio-pci. For that to work the
reflck concept embedded in vfio-pci needs to be sharable across all of the
new VFIO PCI drivers which motivated re-examining how this is
implemented.

Another significant issue is how the VFIO PCI core includes code like:

   if (pci_dev_driver(pdev) != &vfio_pci_driver)

Which is not scalable if there are going to be multiple different driver
types.

This series takes the approach of moving the "reflck" mechanism into the
core code as a "device set". Each vfio_device driver can specify how
vfio_devices are grouped into the set using a key and the set comes along
with a set-global mutex. The core code manages creating per-device set
memory and associating it with each vfio_device.

In turn this allows the core code to provide an open/close_device()
operation that is called only for the first/last FD, and is called under
the global device set lock.

Review of all the drivers show that they are either already open coding
the first/last semantic or are buggy and missing it. All drivers are
migrated/fixed to the new open/close_device ops and the unused per-FD
open()/release() ops are deleted.

The special behavior of PCI around the bus/slot "reset group" is recast in
terms of the device set which conslidates the reflck, eliminates two
touches of pci_dev_driver(), and allows the reset mechanism to share
across all VFIO PCI drivers. PCI is changed to acquire devices directly
from the device set instead of trying to work backwards from the struct
pci_device.

Overall a few minor bugs are squashed and quite a bit of code is removed
through consolidation.

Jason Gunthorpe (11):
  vfio/samples: Remove module get/put
  vfio: Provide better generic support for open/release vfio_device_ops
  vfio/samples: Delete useless open/close
  vfio/fsl: Move to the device set infrastructure
  vfio/platform: Use open_device() instead of open coding a refcnt
    scheme
  vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set
  vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set
  vfio/mbochs: Fix close when multiple device FDs are open
  vfio/ap,ccw: Fix open/close when multiple device FDs are open
  vfio/gvt: Fix open/close when multiple device FDs are open
  vfio: Remove struct vfio_device_ops open/release

Max Gurtovoy (1):
  vfio: Introduce a vfio_uninit_group_dev() API call

Yishai Hadas (1):
  vfio/pci: Move to the device set infrastructure

 Documentation/driver-api/vfio.rst             |   4 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c              |   8 +-
 drivers/s390/cio/vfio_ccw_ops.c               |   8 +-
 drivers/s390/crypto/vfio_ap_ops.c             |   8 +-
 drivers/vfio/fsl-mc/vfio_fsl_mc.c             | 158 ++----
 drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c        |   6 +-
 drivers/vfio/fsl-mc/vfio_fsl_mc_private.h     |   7 -
 drivers/vfio/mdev/vfio_mdev.c                 |  29 +-
 drivers/vfio/pci/vfio_pci.c                   | 459 ++++++------------
 drivers/vfio/pci/vfio_pci_private.h           |   7 -
 drivers/vfio/platform/vfio_platform_common.c  |  86 ++--
 drivers/vfio/platform/vfio_platform_private.h |   1 -
 drivers/vfio/vfio.c                           | 149 +++++-
 include/linux/mdev.h                          |   9 +-
 include/linux/vfio.h                          |  26 +-
 samples/vfio-mdev/mbochs.c                    |  16 +-
 samples/vfio-mdev/mdpy.c                      |  40 +-
 samples/vfio-mdev/mtty.c                      |  40 +-
 18 files changed, 439 insertions(+), 622 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 115+ messages in thread

end of thread, other threads:[~2021-07-21  7:28 UTC | newest]

Thread overview: 115+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15  0:20 [PATCH 00/13] Provide core infrastructure for managing open/release Jason Gunthorpe
2021-07-15  0:20 ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20 ` Jason Gunthorpe
2021-07-15  0:20 ` [PATCH 01/13] vfio/samples: Remove module get/put Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-19 11:42   ` Cornelia Huck
2021-07-19 11:42     ` [Intel-gfx] " Cornelia Huck
2021-07-19 11:42     ` Cornelia Huck
2021-07-15  0:20 ` [PATCH 02/13] vfio: Introduce a vfio_uninit_group_dev() API call Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-15  3:49   ` Leon Romanovsky
2021-07-15  3:49     ` [Intel-gfx] " Leon Romanovsky
2021-07-15  3:49     ` Leon Romanovsky
2021-07-15 12:45     ` Jason Gunthorpe
2021-07-15 12:45       ` [Intel-gfx] " Jason Gunthorpe
2021-07-15 12:45       ` Jason Gunthorpe
2021-07-19 12:11   ` Cornelia Huck
2021-07-19 12:11     ` [Intel-gfx] " Cornelia Huck
2021-07-19 12:11     ` Cornelia Huck
2021-07-19 12:17     ` Jason Gunthorpe
2021-07-19 12:17       ` [Intel-gfx] " Jason Gunthorpe
2021-07-19 12:17       ` Jason Gunthorpe
2021-07-19 12:43       ` Cornelia Huck
2021-07-19 12:43         ` [Intel-gfx] " Cornelia Huck
2021-07-19 12:43         ` Cornelia Huck
2021-07-15  0:20 ` [PATCH 03/13] vfio: Provide better generic support for open/release vfio_device_ops Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-19 12:58   ` Cornelia Huck
2021-07-19 12:58     ` [Intel-gfx] " Cornelia Huck
2021-07-19 12:58     ` Cornelia Huck
2021-07-19 13:01     ` Jason Gunthorpe
2021-07-19 13:01       ` [Intel-gfx] " Jason Gunthorpe
2021-07-19 13:01       ` Jason Gunthorpe
2021-07-19 13:03       ` Jason Gunthorpe
2021-07-19 13:03         ` [Intel-gfx] " Jason Gunthorpe
2021-07-19 13:03         ` Jason Gunthorpe
2021-07-15  0:20 ` [PATCH 04/13] vfio/samples: Delete useless open/close Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-19 13:01   ` Cornelia Huck
2021-07-19 13:01     ` [Intel-gfx] " Cornelia Huck
2021-07-19 13:01     ` Cornelia Huck
2021-07-15  0:20 ` [PATCH 05/13] vfio/fsl: Move to the device set infrastructure Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-20 16:12   ` Diana Craciun OSS
2021-07-20 16:12     ` [Intel-gfx] " Diana Craciun OSS
2021-07-20 16:12     ` Diana Craciun OSS
2021-07-20 16:17     ` Jason Gunthorpe
2021-07-20 16:17       ` [Intel-gfx] " Jason Gunthorpe
2021-07-20 16:17       ` Jason Gunthorpe
2021-07-20 16:23       ` Diana Craciun OSS
2021-07-20 16:23         ` [Intel-gfx] " Diana Craciun OSS
2021-07-20 16:23         ` Diana Craciun OSS
2021-07-20 16:25         ` Jason Gunthorpe
2021-07-20 16:25           ` [Intel-gfx] " Jason Gunthorpe
2021-07-20 16:25           ` Jason Gunthorpe
2021-07-15  0:20 ` [PATCH 06/13] vfio/platform: Use open_device() instead of open coding a refcnt scheme Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-15  0:20 ` [PATCH 07/13] vfio/pci: Move to the device set infrastructure Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-15  0:20 ` [PATCH 08/13] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-15  0:20 ` [PATCH 09/13] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-15 21:00   ` Alex Williamson
2021-07-15 21:00     ` [Intel-gfx] " Alex Williamson
2021-07-15 21:00     ` Alex Williamson
2021-07-15 22:11     ` Jason Gunthorpe
2021-07-15 22:11       ` [Intel-gfx] " Jason Gunthorpe
2021-07-15 22:11       ` Jason Gunthorpe
2021-07-15 22:27       ` Alex Williamson
2021-07-15 22:27         ` [Intel-gfx] " Alex Williamson
2021-07-15 22:27         ` Alex Williamson
2021-07-15  0:20 ` [PATCH 10/13] vfio/mbochs: Fix close when multiple device FDs are open Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-19 14:45   ` Cornelia Huck
2021-07-19 14:45     ` [Intel-gfx] " Cornelia Huck
2021-07-19 14:45     ` Cornelia Huck
2021-07-15  0:20 ` [PATCH 11/13] vfio/ap,ccw: Fix open/close " Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] [PATCH 11/13] vfio/ap, ccw: " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-19 14:40   ` [PATCH 11/13] vfio/ap,ccw: " Cornelia Huck
2021-07-19 14:40     ` [Intel-gfx] [PATCH 11/13] vfio/ap, ccw: " Cornelia Huck
2021-07-19 14:40     ` [PATCH 11/13] vfio/ap,ccw: " Cornelia Huck
2021-07-15  0:20 ` [PATCH 12/13] vfio/gvt: " Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-16  6:50   ` Zhenyu Wang
2021-07-16  6:50     ` [Intel-gfx] " Zhenyu Wang
2021-07-16  6:50     ` Zhenyu Wang
2021-07-19 14:47   ` Cornelia Huck
2021-07-19 14:47     ` [Intel-gfx] " Cornelia Huck
2021-07-19 14:47     ` Cornelia Huck
2021-07-15  0:20 ` [PATCH 13/13] vfio: Remove struct vfio_device_ops open/release Jason Gunthorpe
2021-07-15  0:20   ` [Intel-gfx] " Jason Gunthorpe
2021-07-15  0:20   ` Jason Gunthorpe
2021-07-15 13:28 ` [PATCH 00/13] Provide core infrastructure for managing open/release Kirti Wankhede
2021-07-15 13:28   ` [Intel-gfx] " Kirti Wankhede
2021-07-15 13:28   ` Kirti Wankhede
2021-07-15 14:55   ` Jason Gunthorpe
2021-07-15 14:55     ` [Intel-gfx] " Jason Gunthorpe
2021-07-15 14:55     ` Jason Gunthorpe
2021-07-16 16:49 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Provide core infrastructure for managing open/release (rev2) Patchwork
2021-07-16 17:18 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-16 22:10 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-07-20 17:19 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Provide core infrastructure for managing open/release (rev3) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.