From: Simon Song <xinmengs@nvidia.com>
To: <alex@shazbot.org>, <jgg@nvidia.com>
Cc: <dakr@kernel.org>, <acourbot@nvidia.com>, <yishaih@nvidia.com>,
<skolothumtho@nvidia.com>, <kevin.tian@intel.com>,
<jhubbard@nvidia.com>, <ecourtney@nvidia.com>, <cjia@nvidia.com>,
<smitra@nvidia.com>, <kjaju@nvidia.com>, <alkumar@nvidia.com>,
<ankita@nvidia.com>, <aniketa@nvidia.com>, <kwankhede@nvidia.com>,
<targupta@nvidia.com>, <linux-kernel@vger.kernel.org>,
<kvm@vger.kernel.org>, <zhiwang@kernel.org>, <zhiw@nvidia.com>,
Simon Song <xinmengs@nvidia.com>
Subject: [PATCH v3 0/1] vfio/pci: Give drivers control of PCI driver_data
Date: Mon, 5 Oct 2026 11:42:35 -0700 [thread overview]
Message-ID: <20261005184236.1946167-1-xinmengs@nvidia.com> (raw)
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
next reply other threads:[~2026-10-05 18:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 18:42 Simon Song [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261005184236.1946167-1-xinmengs@nvidia.com \
--to=xinmengs@nvidia.com \
--cc=acourbot@nvidia.com \
--cc=alex@shazbot.org \
--cc=alkumar@nvidia.com \
--cc=aniketa@nvidia.com \
--cc=ankita@nvidia.com \
--cc=cjia@nvidia.com \
--cc=dakr@kernel.org \
--cc=ecourtney@nvidia.com \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=kjaju@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=skolothumtho@nvidia.com \
--cc=smitra@nvidia.com \
--cc=targupta@nvidia.com \
--cc=yishaih@nvidia.com \
--cc=zhiw@nvidia.com \
--cc=zhiwang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®