STRUCT PCI_DRIVER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

Okay bestie, this is struct pci_driver(9) from the Kernel API Manual. It’s the PCI driver structure β€” the blueprint itself, no cap.

✨ SYNOPSIS ✨

       struct pci_driver {
           const char              *name;
           const struct pci_device_id *id_table;
           int (*probe)(struct pci_dev *dev, const struct pci_device_id *id);
           void (*remove)(struct pci_dev *dev);
           int (*suspend)(struct pci_dev *dev, pm_message_t state);
           int (*resume)(struct pci_dev *dev);
           void (*shutdown)(struct pci_dev *dev);
           int (*sriov_configure)(struct pci_dev *dev, int num_vfs);
           int (*sriov_set_msix_vec_count)(struct pci_dev *vf, int
       msix_vec_count);
           u32 (*sriov_get_vf_total_msix)(struct pci_dev *pf);
           const struct pci_error_handlers *err_handler;
           const struct attribute_group **groups;
           const struct attribute_group **dev_groups;
           struct device_driver    driver;
           struct pci_dynids       dynids;
           bool driver_managed_dma;
        };

πŸ‘― Members πŸ‘―

Member-by-member, bestie β€” every single one is here:

  • name β€” Driver name. Simple, iconic, does what it says.
  • id_table β€” Pointer to table of device IDs the driver is interested in. Most drivers should export this table using MODULE_DEVICE_TABLE(pci,...).
  • probe β€” This probing function gets called (during execution of pci_register_driver for already existing devices or later if a new device gets inserted) for all PCI devices which match the ID table and are not "owned" by the other drivers yet. This function gets passed a struct pci_dev for each device whose entry in the ID table matches the device. The probe function returns zero when the driver chooses to take "ownership" of the device or an error code (negative number) otherwise. The pci_device_id parameter is only valid during probe. The probe function always gets called from process context, so it can sleep. πŸ’€
  • remove β€” The remove function gets called whenever a device being handled by this driver is removed (either during deregistration of the driver or when it's manually pulled out of a hot-pluggable slot). The remove function always gets called from process context, so it can sleep. 😴
  • suspend β€” Put device into low power state.
  • resume β€” Wake device from low power state. (Please see Documentation/power/pci.rst for descriptions of PCI Power Management and the related functions.)
  • shutdown β€” Hook into reboot_notifier_list (kernel/sys.c). Intended to stop any idling DMA operations. Useful for enabling wake-on-lan (NIC) or changing the power state of a device before reboot. e.g. drivers/net/e100.c.
  • sriov_configure β€” Optional driver callback to allow configuration of number of VFs to enable via sysfs sriov_numvfs file.
  • sriov_set_msix_vec_count β€” PF Driver callback to change number of MSI-X vectors on a VF. Triggered via sysfs sriov_vf_msix_count. This will change MSI-X Table Size in the VF Message Control registers.
  • sriov_get_vf_total_msix β€” PF driver callback to get the total number of MSI-X vectors available for distribution to the VFs.
  • err_handler β€” See Documentation/PCI/pci-error-recovery.rst.
  • groups β€” Sysfs attribute groups.
  • dev_groups β€” Attributes attached to the device that will be created once it is bound to the driver.
  • driver β€” Driver model structure.
  • dynids β€” List of dynamically added device IDs.
  • driver_managed_dma β€” Device driver doesn't use kernel DMA API for DMA. For most device drivers, no need to care about this flag as long as all DMAs are handled through the kernel DMA API. For some special ones, for example VFIO drivers, they know how to manage the DMA themselves and set this flag so that the IOMMU layer will allow them to setup and manage their own I/O address space.

πŸ”Ž SEE ALSO πŸ”Ž

Kernel file ./include/linux/pci.h β€” and the whole cross-reference squad:


Signed, sealed, and slaying from the ./include/linux source β€” October 2026 β€” struct pci_driver(9) πŸ’…βœ¨

πŸ“¦ where this page comes from