[PATCH v2 0/1] vfio/pci: Give drivers control of PCI driver_data

From: Simon Song

Date: Wed Sep 30 2026 - 11:31:49 EST


Hi All,

During the discussion of the proposed Rust NVIDIA vGPU VFIO variant
driver [1], Danilo mentioned that vfio-pci-core requires pci driver_data
to point to vfio_pci_core_device, this conflicts with driver data
managed by proposed nvidia vfio variant driver.

This patch moves the responsibility for interpreting driver_data to the
pci driver, the vfio core functions (PM, AER, VGA) takes an explicit
vfio_pci_core_device pointer and no longer depend on pci driver_data

VFIO_PCI_CORE_DEFINE_CALLBACK marcos generate the wrappers for existing
vfio variant drivers, each driver also assigns its own PM ops table to
replace the operation done by vfio-pci-core during registration.

For VGA, drivers provide its decode callback to
vfio_pci_core_register_device, VGA setup/teardown remains inside vfio
core registration/unregistration, this preserves vga initialize
sequence and also remove the core dependacy on driver data.


[1] https://lore.kernel.org/all/DLFD2ZDSK9YQ.3A4R66G8UJMD8@xxxxxxxxxx/

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 | 60 +++++++------------
drivers/vfio/pci/virtio/main.c | 8 ++-
drivers/vfio/pci/xe/main.c | 8 ++-
include/linux/vfio_pci_core.h | 42 ++++++++++++-
12 files changed, 160 insertions(+), 94 deletions(-)

--
2.43.7