mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/1] vfio/pci: Give drivers control of PCI driver_data
@ 2026-10-05 18:42 Simon Song
  2026-10-05 18:42 ` [PATCH v3 1/1] vfio/pci: Remove the core dependency on driver data Simon Song
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Song @ 2026-10-05 18:42 UTC (permalink / raw)
  To: alex, jgg
  Cc: dakr, acourbot, yishaih, skolothumtho, kevin.tian, jhubbard,
	ecourtney, cjia, smitra, kjaju, alkumar, ankita, aniketa,
	kwankhede, targupta, linux-kernel, kvm, zhiwang, zhiw,
	Simon Song

Hi all,

This patch lets VFIO PCI variant drivers store their private structures
in PCI driver_data, removing the requirement that it point directly to
struct vfio_pci_core_device. This also accommodates the typed driver data
used by the Rust PCI infrastructure, as discussed for the proposed Rust
NVIDIA vGPU VFIO driver [1].

Runtime PM and AER helpers receive an explicit vfio_pci_core_device
pointer. VFIO_PCI_CORE_DEFINE_CALLBACKS() generates per-driver wrappers
that retrieve the driver's private data and pass its embedded core device
to these helpers. Each driver installs its own PM ops table.

VGA initialization selects the decode callback in vfio_pci_vga_init()
based on vfio_vga_disabled(vdev). Both callbacks use pci_dev directly and
do not depend on driver_data.

Changes since v2 [2]:
- Drop the unused pci_channel_state_t argument from the core AER helper
  and its callers, preserving the PCI callback signature (Danilo).
- Wrap each driver's PM ops pointer with pm_ptr() so unused tables can
  be removed when CONFIG_PM=n (Sashiko).

Changes since v1:
- Extend VFIO_PCI_CORE_DEFINE_CALLBACKS() to accept the driver's private
  structure type and the member containing vfio_pci_core_device.
- Store each variant driver's private structure in PCI driver_data.
- Select the VGA decode callback in the core and retain the one-argument
  vfio_pci_core_register_device() interface.

[1] https://lore.kernel.org/all/DLFD2ZDSK9YQ.3A4R66G8UJMD8@kernel.org/
[2] https://lore.kernel.org/r/20260930143641.4160785-1-xinmengs@nvidia.com/

Thanks,
Simon

Simon Song (1):
  vfio/pci: Remove the core dependency on driver data

 .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c    | 27 ++++----
 drivers/vfio/pci/ism/main.c                   | 19 +++---
 drivers/vfio/pci/mlx5/main.c                  | 13 ++--
 drivers/vfio/pci/nvgrace-gpu/main.c           | 19 +++---
 drivers/vfio/pci/pds/pci_drv.c                |  8 ++-
 drivers/vfio/pci/pds/vfio_dev.c               |  5 +-
 drivers/vfio/pci/qat/main.c                   | 12 ++--
 drivers/vfio/pci/vfio_pci.c                   | 33 +++++++++-
 drivers/vfio/pci/vfio_pci_core.c              | 61 +++++++------------
 drivers/vfio/pci/virtio/main.c                |  8 ++-
 drivers/vfio/pci/xe/main.c                    |  8 ++-
 include/linux/vfio_pci_core.h                 | 41 ++++++++++++-
 12 files changed, 159 insertions(+), 95 deletions(-)

-- 
2.43.7


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

end of thread, other threads:[~2026-10-05 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05 18:42 [PATCH v3 0/1] vfio/pci: Give drivers control of PCI driver_data Simon Song
2026-10-05 18:42 ` [PATCH v3 1/1] vfio/pci: Remove the core dependency on driver data Simon Song
2026-10-05 19:21   ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®