Re: [PATCH v3 03/10] PCI: Allow per function PCI slots

From: Farhan Ali
Date: Wed Sep 17 2025 - 13:51:22 EST



On 9/16/2025 11:21 PM, Cédric Le Goater wrote:
Hi Farhan,

Hi Cedric,

Thanks for pointing this out. I missed that dev->slot could be NULL and so the per_func_slot check should be done after the check for !dev->slot. I tried this change on top of the patch in an x86_64 VM and was able to boot the VM without the oops.

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 70296d3b1cfc..3631f7faa0cf 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5061,10 +5061,9 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, bool probe)

  static int pci_dev_reset_slot_function(struct pci_dev *dev, bool probe)
  {
-       if (dev->multifunction && !dev->slot->per_func_slot)
-               return -ENOTTY;
         if (dev->subordinate || !dev->slot ||
-           dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)
+           dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET ||
+           (dev->multifunction && !dev->slot->per_func_slot))
                 return -ENOTTY;
All good.

I have pushed the Linux branch I use for vfio :

   https://github.com/legoater/linux/commits/vfio/

These commits have small changes :

    PCI: Allow per function PCI slots
    vfio-pci/zdev: Add a device feature for error information

Thanks,

C.


Hi Cedric,

Thanks again for your help in reviewing the patches.

Thanks
Farhan