virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/22] vfio: Give VFIO_DEVICE_GET_REGION_INFO its own op
@ 2025-10-23 23:09 Jason Gunthorpe
  2025-10-23 23:09 ` [PATCH 01/22] vfio: Provide a get_region_info op Jason Gunthorpe
                   ` (23 more replies)
  0 siblings, 24 replies; 65+ messages in thread
From: Jason Gunthorpe @ 2025-10-23 23:09 UTC (permalink / raw)
  To: Alexander Gordeev, David Airlie, Alex Williamson, Ankit Agrawal,
	Christian Borntraeger, Brett Creeley, dri-devel, Eric Auger,
	Eric Farman, Giovanni Cabiddu, Vasily Gorbik, Heiko Carstens,
	intel-gfx, Jani Nikula, Joonas Lahtinen, Kevin Tian, kvm,
	Kirti Wankhede, linux-s390, Longfang Liu, Matthew Rosato,
	Nikhil Agarwal, Nipun Gupta, Peter Oberparleiter, Halil Pasic,
	Pranjal Shrivastava, qat-linux, Rodrigo Vivi, Simona Vetter,
	Shameer Kolothum, Mostafa Saleh, Sven Schnelle, Tvrtko Ursulin,
	virtualization, Vineeth Vijayan, Yishai Hadas, Zhenyu Wang,
	Zhi Wang
  Cc: patches

There is alot of duplicated code in the drivers for processing
VFIO_DEVICE_GET_REGION_INFO. Introduce a new op get_region_info_caps()
which provides a struct vfio_info_cap and handles the cap chain logic
to write the caps back to userspace and remove all of this duplication
from drivers.

This is done in two steps, the first is a largely mechanical introduction
of the get_region_info(). These patches are best viewed with the diff
option to ignore whitespace (-b) as most of the lines are re-indending
things.

Then drivers are updated to remove the duplicate cap related code. Some
drivers are converted to use vfio_info_add_capability() instead of open
coding a version of it.

This is on github: https://github.com/jgunthorpe/linux/commits/vfio_get_region_info_op

Jason Gunthorpe (22):
  vfio: Provide a get_region_info op
  vfio/hisi: Convert to the get_region_info op
  vfio/virtio: Convert to the get_region_info op
  vfio/nvgrace: Convert to the get_region_info op
  vfio/pci: Fill in the missing get_region_info ops
  vfio/mtty: Provide a get_region_info op
  vfio/mdpy: Provide a get_region_info op
  vfio/mbochs: Provide a get_region_info op
  vfio/platform: Provide a get_region_info op
  vfio/fsl: Provide a get_region_info op
  vfio/cdx: Provide a get_region_info op
  vfio/ccw: Provide a get_region_info op
  vfio/gvt: Provide a get_region_info op
  vfio: Require drivers to implement get_region_info
  vfio: Add get_region_info_caps op
  vfio/mbochs: Convert mbochs to use vfio_info_add_capability()
  vfio/gvt: Convert to get_region_info_caps
  vfio/ccw: Convert to get_region_info_caps
  vfio/pci: Convert all PCI drivers to get_region_info_caps
  vfio/platform: Convert to get_region_info_caps
  vfio: Move the remaining drivers to get_region_info_caps
  vfio: Remove the get_region_info op

 drivers/gpu/drm/i915/gvt/kvmgt.c              | 272 ++++++++----------
 drivers/s390/cio/vfio_ccw_ops.c               |  45 +--
 drivers/vfio/cdx/main.c                       |  29 +-
 drivers/vfio/fsl-mc/vfio_fsl_mc.c             |  43 ++-
 .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c    |  54 ++--
 drivers/vfio/pci/mlx5/main.c                  |   1 +
 drivers/vfio/pci/nvgrace-gpu/main.c           |  53 +---
 drivers/vfio/pci/pds/vfio_dev.c               |   1 +
 drivers/vfio/pci/qat/main.c                   |   1 +
 drivers/vfio/pci/vfio_pci.c                   |   1 +
 drivers/vfio/pci/vfio_pci_core.c              | 110 +++----
 drivers/vfio/pci/virtio/common.h              |   5 +-
 drivers/vfio/pci/virtio/legacy_io.c           |  38 +--
 drivers/vfio/pci/virtio/main.c                |   5 +-
 drivers/vfio/platform/vfio_amba.c             |   1 +
 drivers/vfio/platform/vfio_platform.c         |   1 +
 drivers/vfio/platform/vfio_platform_common.c  |  40 ++-
 drivers/vfio/platform/vfio_platform_private.h |   3 +
 drivers/vfio/vfio_main.c                      |  45 +++
 include/linux/vfio.h                          |   4 +
 include/linux/vfio_pci_core.h                 |   3 +
 samples/vfio-mdev/mbochs.c                    |  71 ++---
 samples/vfio-mdev/mdpy.c                      |  34 +--
 samples/vfio-mdev/mtty.c                      |  33 +--
 24 files changed, 363 insertions(+), 530 deletions(-)


base-commit: 211ddde0823f1442e4ad052a2f30f050145ccada
-- 
2.43.0


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

end of thread, other threads:[~2025-11-07  1:29 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 23:09 [PATCH 00/22] vfio: Give VFIO_DEVICE_GET_REGION_INFO its own op Jason Gunthorpe
2025-10-23 23:09 ` [PATCH 01/22] vfio: Provide a get_region_info op Jason Gunthorpe
2025-11-03  5:57   ` Pranjal Shrivastava
2025-11-03 14:17   ` Eric Auger
2025-10-23 23:09 ` [PATCH 02/22] vfio/hisi: Convert to the " Jason Gunthorpe
2025-10-28  1:55   ` liulongfang
2025-10-28  7:07     ` Tian, Kevin
2025-11-03  6:06   ` Pranjal Shrivastava
2025-11-03 13:31     ` Jason Gunthorpe
2025-11-07  1:29     ` liulongfang
2025-10-23 23:09 ` [PATCH 03/22] vfio/virtio: " Jason Gunthorpe
2025-11-03  6:21   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 04/22] vfio/nvgrace: " Jason Gunthorpe
2025-11-03  6:41   ` Pranjal Shrivastava
2025-11-03 13:35     ` Ankit Agrawal
2025-10-23 23:09 ` [PATCH 05/22] vfio/pci: Fill in the missing get_region_info ops Jason Gunthorpe
2025-11-03  6:43   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 06/22] vfio/mtty: Provide a get_region_info op Jason Gunthorpe
2025-11-03  7:17   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 07/22] vfio/mdpy: " Jason Gunthorpe
2025-11-03  7:18   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 08/22] vfio/mbochs: " Jason Gunthorpe
2025-11-03  7:19   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 09/22] vfio/platform: " Jason Gunthorpe
2025-11-03  7:14   ` Pranjal Shrivastava
2025-11-03  9:53   ` Mostafa Saleh
2025-11-03 13:59   ` Eric Auger
2025-11-03 14:27     ` Jason Gunthorpe
2025-10-23 23:09 ` [PATCH 10/22] vfio/fsl: " Jason Gunthorpe
2025-11-03  7:30   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 11/22] vfio/cdx: " Jason Gunthorpe
2025-11-03  7:31   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 12/22] vfio/ccw: " Jason Gunthorpe
2025-10-23 23:09 ` [PATCH 13/22] vfio/gvt: " Jason Gunthorpe
2025-10-24 10:12   ` Jani Nikula
2025-10-23 23:09 ` [PATCH 14/22] vfio: Require drivers to implement get_region_info Jason Gunthorpe
2025-11-03  7:39   ` Pranjal Shrivastava
2025-11-05 20:48     ` Alex Williamson
2025-11-05 20:56       ` Jason Gunthorpe
2025-11-05 21:19         ` Pranjal Shrivastava
2025-11-03  9:55   ` Mostafa Saleh
2025-10-23 23:09 ` [PATCH 15/22] vfio: Add get_region_info_caps op Jason Gunthorpe
2025-11-03 10:16   ` Pranjal Shrivastava
2025-11-03 11:03     ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 16/22] vfio/mbochs: Convert mbochs to use vfio_info_add_capability() Jason Gunthorpe
2025-10-23 23:09 ` [PATCH 17/22] vfio/gvt: Convert to get_region_info_caps Jason Gunthorpe
2025-10-23 23:09 ` [PATCH 18/22] vfio/ccw: " Jason Gunthorpe
2025-10-28  7:09   ` Tian, Kevin
2025-10-23 23:09 ` [PATCH 19/22] vfio/pci: Convert all PCI drivers " Jason Gunthorpe
2025-10-28 17:08   ` Brett Creeley
2025-11-03 10:25   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 20/22] vfio/platform: Convert " Jason Gunthorpe
2025-11-03  9:57   ` Mostafa Saleh
2025-11-03 10:21   ` Pranjal Shrivastava
2025-11-03 14:20   ` Eric Auger
2025-11-07  1:05     ` Jason Gunthorpe
2025-10-23 23:09 ` [PATCH 21/22] vfio: Move the remaining drivers " Jason Gunthorpe
2025-11-03 10:29   ` Pranjal Shrivastava
2025-10-23 23:09 ` [PATCH 22/22] vfio: Remove the get_region_info op Jason Gunthorpe
2025-11-03 10:52   ` Pranjal Shrivastava
2025-11-07  0:43     ` Jason Gunthorpe
2025-10-28  7:10 ` [PATCH 00/22] vfio: Give VFIO_DEVICE_GET_REGION_INFO its own op Tian, Kevin
2025-11-03  9:53 ` Mostafa Saleh
2025-11-05 20:58   ` Alex Williamson
2025-11-06 20:37     ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).