Thread (21 messages) 21 messages, 5 authors, 2021-08-19

Re: [PATCH V2 06/12] vfio/pci: Split the pci_driver code out of vfio_pci_core.c

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2021-08-19 22:36:21
Also in: kvm, linux-doc, linux-kbuild, linux-pci

On Thu, Aug 19, 2021 at 03:12:35PM -0600, Alex Williamson wrote:
On Wed, 18 Aug 2021 18:16:00 +0300
Yishai Hadas [off-list ref] wrote:
quoted
+
+static int vfio_pci_sriov_configure(struct pci_dev *pdev, int nr_virtfn)
+{
+	might_sleep();
vfio_pci_core_sriov_configure() retained the might_sleep(), it
shouldn't be needed here.
quoted
+
+	if (!enable_sriov)
+		return -ENOENT;
+
+	return vfio_pci_core_sriov_configure(pdev, nr_virtfn);
+}
...
quoted
@@ -509,7 +449,7 @@ static struct vfio_pci_core_device *get_pf_vdev(struct vfio_pci_core_device *vde
 	if (!pf_dev)
 		return NULL;
 
-	if (pci_dev_driver(physfn) != &vfio_pci_driver) {
+	if (pci_dev_driver(physfn) != pci_dev_driver(vdev->pdev)) {
I think this means that the PF and VF must use the same vfio-pci
"variant" driver, it's too bad we're not enabling vfio-pci to own the
PF while vfio-vendor-foo-pci owns the VF since our SR-IOV security
model remains in the core.  We can work on that later though, no loss
of functionality here.
Yes, there are still a few of these references that want to go away..

For this one we probably need to introduce a 'class' notion to the
vfio_device_ops to confirm that the container_of cast is OK.

It was something on my list to look at after this is settled since it
is pretty minor
"vfio-pci" is hardcoded in this comment.  There are a few other user
visible instances of this in vfio-pci-core.c as well:

MODULE_PARM_DESC(disable_vga, "Disable VGA resource access through vfio-pci");
This module_param is on vfio_pci - ideally we'd lift the the VGA code
out of vfio_pci_core into vfio_pci since it really shouldn't apply to
device specific drivers anyhow.

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help