All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] Make vfio_mdev type safe
@ 2021-03-23 17:55 ` Jason Gunthorpe
  0 siblings, 0 replies; 101+ messages in thread
From: Jason Gunthorpe @ 2021-03-23 17:55 UTC (permalink / raw)
  To: David Airlie, Tony Krowiak, Alex Williamson,
	Christian Borntraeger, Cornelia Huck, Jonathan Corbet,
	Daniel Vetter, dri-devel, Eric Farman, Harald Freudenberger,
	Vasily Gorbik, Heiko Carstens, intel-gfx, intel-gvt-dev,
	Jani Nikula, Joonas Lahtinen, kvm, Kirti Wankhede, linux-doc,
	linux-s390, Peter Oberparleiter, Halil Pasic, Pierre Morel,
	Rodrigo Vivi, Vineeth Vijayan, Zhenyu Wang, Zhi Wang
  Cc: Raj, Ashok, Dong Jia Shi, Neo Jia, Dan Williams,
	Christoph Hellwig, Jike Song, Gerd Hoffmann, Leon Romanovsky,
	Max Gurtovoy, Tarun Gupta

Prologue
========

This is series #2 in part of a larger work that arose from the minor
remark that the mdev_parent_ops indirection shim is useless and
complicates things.

It follows the "Embed struct vfio_device in all sub-structures" already
sent, and must be applied on top of it.

A preview of the future series's is here:
  https://github.com/jgunthorpe/linux/pull/3/commits

========
This series:

vfio_mdev has a number of different objects: mdev_parent, mdev_type and
mdev_device.

Unfortunately the types of these have been erased in various places
throughout the API, and this makes it very hard to understand this code or
maintain it by the time it reaches all of the drivers.

This series puts in all the types and aligns some of the design with the
driver core standard for a driver core bus driver:

 - Replace 'struct device *' with 'struct mdev_device *
 - Replace 'struct device *' with 'struct mdev_type *' and
   mtype_get_parent_dev()
 - Replace 'struct kobject *' with 'struct mdev_type *'

Now that types are clear it is easy to spot a few places that have
duplicated information.

More significantly we can now understand how to directly fix the
obfuscated 'kobj->name' matching by realizing the the kobj is a mdev_type,
which is linked to the supported_types_list provided by the driver, and
thus the core code can directly return the array indexes all the drivers
actually want.

Jason

Jason Gunthorpe (18):
  vfio/mdev: Fix missing static's on MDEV_TYPE_ATTR's
  vfio/mdev: Add missing typesafety around mdev_device
  vfio/mdev: Simplify driver registration
  vfio/mdev: Use struct mdev_type in struct mdev_device
  vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer
  vfio/mdev: Expose mdev_get/put_parent to mdev_private.h
  vfio/mdev: Add missing reference counting to mdev_type
  vfio/mdev: Reorganize mdev_device_create()
  vfio/mdev: Add missing error handling to dev_set_name()
  vfio/mdev: Remove duplicate storage of parent in mdev_device
  vfio/mdev: Add mdev/mtype_get_type_group_id()
  vfio/mtty: Use mdev_get_type_group_id()
  vfio/mdpy: Use mdev_get_type_group_id()
  vfio/mbochs: Use mdev_get_type_group_id()
  vfio/gvt: Make DRM_I915_GVT depend on VFIO_MDEV
  vfio/gvt: Use mdev_get_type_group_id()
  vfio/mdev: Remove kobj from mdev_parent_ops->create()
  vfio/mdev: Correct the function signatures for the
    mdev_type_attributes

 .../driver-api/vfio-mediated-device.rst       |   9 +-
 drivers/gpu/drm/i915/Kconfig                  |   1 +
 drivers/gpu/drm/i915/gvt/gvt.c                |  41 ++---
 drivers/gpu/drm/i915/gvt/gvt.h                |   4 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c              |   7 +-
 drivers/s390/cio/vfio_ccw_ops.c               |  17 +-
 drivers/s390/crypto/vfio_ap_ops.c             |  14 +-
 drivers/vfio/mdev/mdev_core.c                 | 160 ++++++------------
 drivers/vfio/mdev/mdev_driver.c               |  19 +--
 drivers/vfio/mdev/mdev_private.h              |  40 ++---
 drivers/vfio/mdev/mdev_sysfs.c                |  59 ++++---
 drivers/vfio/mdev/vfio_mdev.c                 |  29 ++--
 drivers/vfio/vfio_iommu_type1.c               |  25 +--
 include/linux/mdev.h                          |  80 ++++++---
 samples/vfio-mdev/mbochs.c                    |  55 +++---
 samples/vfio-mdev/mdpy.c                      |  56 +++---
 samples/vfio-mdev/mtty.c                      |  66 ++------
 17 files changed, 306 insertions(+), 376 deletions(-)

-- 
2.31.0


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

end of thread, other threads:[~2021-04-06 19:41 UTC | newest]

Thread overview: 101+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 17:55 [PATCH 00/18] Make vfio_mdev type safe Jason Gunthorpe
2021-03-23 17:55 ` [Intel-gfx] " Jason Gunthorpe
2021-03-23 17:55 ` Jason Gunthorpe
2021-03-23 17:55 ` [PATCH 01/18] vfio/mdev: Fix missing static's on MDEV_TYPE_ATTR's Jason Gunthorpe
2021-03-23 17:55 ` [PATCH 02/18] vfio/mdev: Add missing typesafety around mdev_device Jason Gunthorpe
2021-03-26  2:04   ` Tian, Kevin
2021-03-30 15:24   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 03/18] vfio/mdev: Simplify driver registration Jason Gunthorpe
2021-03-23 19:14   ` Christoph Hellwig
2021-03-26 12:10     ` Jason Gunthorpe
2021-03-26 12:55       ` Christoph Hellwig
2021-03-26  2:17   ` Tian, Kevin
2021-03-30 15:28   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 04/18] vfio/mdev: Use struct mdev_type in struct mdev_device Jason Gunthorpe
2021-03-23 19:15   ` Christoph Hellwig
2021-03-26  2:29   ` Tian, Kevin
2021-04-06 18:41     ` Jason Gunthorpe
2021-03-30 15:31   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 05/18] vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer Jason Gunthorpe
2021-03-23 19:15   ` Christoph Hellwig
2021-04-06 16:08     ` Jason Gunthorpe
2021-03-26  2:38   ` Tian, Kevin
2021-03-29  8:42   ` Max Gurtovoy
2021-03-30 15:34   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 06/18] vfio/mdev: Expose mdev_get/put_parent to mdev_private.h Jason Gunthorpe
2021-03-23 19:16   ` Christoph Hellwig
2021-03-26  2:47   ` Tian, Kevin
2021-03-30 15:37   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 07/18] vfio/mdev: Add missing reference counting to mdev_type Jason Gunthorpe
2021-03-23 19:17   ` Christoph Hellwig
2021-03-26  2:52   ` Tian, Kevin
2021-03-30 15:38   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 08/18] vfio/mdev: Reorganize mdev_device_create() Jason Gunthorpe
2021-03-23 19:20   ` Christoph Hellwig
2021-03-26  3:33     ` Tian, Kevin
2021-03-26  3:36       ` Tian, Kevin
2021-04-06 16:40     ` Jason Gunthorpe
2021-03-26  3:31   ` Tian, Kevin
2021-03-30 15:50   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 09/18] vfio/mdev: Add missing error handling to dev_set_name() Jason Gunthorpe
2021-03-23 19:21   ` Christoph Hellwig
2021-03-26  3:35   ` Tian, Kevin
2021-03-29  8:50   ` Max Gurtovoy
2021-03-30 15:53   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 10/18] vfio/mdev: Remove duplicate storage of parent in mdev_device Jason Gunthorpe
2021-03-23 19:22   ` Christoph Hellwig
2021-03-26  3:53   ` Tian, Kevin
2021-03-26 11:53     ` Jason Gunthorpe
2021-03-30 16:14       ` Cornelia Huck
2021-03-30 16:50         ` Jason Gunthorpe
2021-03-30 16:15   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 11/18] vfio/mdev: Add mdev/mtype_get_type_group_id() Jason Gunthorpe
2021-03-23 19:23   ` Christoph Hellwig
2021-04-06 18:53     ` Jason Gunthorpe
2021-03-26  5:52   ` Tian, Kevin
2021-03-30 16:26   ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 12/18] vfio/mtty: Use mdev_get_type_group_id() Jason Gunthorpe
2021-03-23 19:24   ` Christoph Hellwig
2021-03-23 17:55 ` [PATCH 13/18] vfio/mdpy: " Jason Gunthorpe
2021-03-23 19:25   ` Christoph Hellwig
2021-03-23 17:55 ` [PATCH 14/18] vfio/mbochs: " Jason Gunthorpe
2021-03-23 19:25   ` Christoph Hellwig
2021-03-23 17:55 ` [PATCH 15/18] vfio/gvt: Make DRM_I915_GVT depend on VFIO_MDEV Jason Gunthorpe
2021-03-23 17:55   ` [Intel-gfx] " Jason Gunthorpe
2021-03-23 19:26   ` Christoph Hellwig
2021-03-23 19:39     ` Jason Gunthorpe
2021-03-23 19:39       ` [Intel-gfx] " Jason Gunthorpe
2021-03-30  4:39       ` Zhenyu Wang
2021-03-30  4:39         ` Zhenyu Wang
2021-03-26  6:03   ` Tian, Kevin
2021-03-26  6:03     ` Tian, Kevin
2021-03-23 17:55 ` [PATCH 16/18] vfio/gvt: Use mdev_get_type_group_id() Jason Gunthorpe
2021-03-23 17:55   ` [Intel-gfx] " Jason Gunthorpe
2021-03-23 19:28   ` Christoph Hellwig
2021-03-26  6:09   ` Tian, Kevin
2021-03-26  6:09     ` [Intel-gfx] " Tian, Kevin
2021-03-23 17:55 ` [PATCH 17/18] vfio/mdev: Remove kobj from mdev_parent_ops->create() Jason Gunthorpe
2021-03-23 17:55   ` [Intel-gfx] " Jason Gunthorpe
2021-03-23 17:55   ` Jason Gunthorpe
2021-03-23 19:29   ` Christoph Hellwig
2021-03-23 19:29     ` [Intel-gfx] " Christoph Hellwig
2021-03-26  6:11   ` Tian, Kevin
2021-03-26  6:11     ` [Intel-gfx] " Tian, Kevin
2021-03-26  6:11     ` Tian, Kevin
2021-03-30 16:29   ` Cornelia Huck
2021-03-30 16:29     ` [Intel-gfx] " Cornelia Huck
2021-03-30 16:29     ` Cornelia Huck
2021-03-23 17:55 ` [PATCH 18/18] vfio/mdev: Correct the function signatures for the mdev_type_attributes Jason Gunthorpe
2021-03-23 17:55   ` [Intel-gfx] " Jason Gunthorpe
2021-03-23 17:55   ` Jason Gunthorpe
2021-03-23 19:31   ` Christoph Hellwig
2021-03-23 19:31     ` [Intel-gfx] " Christoph Hellwig
2021-04-06 18:34     ` Jason Gunthorpe
2021-04-06 18:34       ` [Intel-gfx] " Jason Gunthorpe
2021-04-06 18:34       ` Jason Gunthorpe
2021-03-26  7:03   ` Tian, Kevin
2021-03-26  7:03     ` [Intel-gfx] " Tian, Kevin
2021-03-26  7:03     ` Tian, Kevin
2021-03-30 16:35   ` Cornelia Huck
2021-03-30 16:35     ` [Intel-gfx] " Cornelia Huck
2021-03-30 16:35     ` Cornelia Huck

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.