PCI: Remove pcie_flr() and convert all callers to use pcie_reset_flr()
Subsystems (17)
RFC PATCH 1/1 PCI: Remove pcie_flr() and convert all callers to use pcie_reset_flr()
The pcie_reset_flr() function includes validation checks to verify FLR support before performing the reset, while pcie_flr() performs the reset unconditionally. Having both functions creates unnecessary complexity.
Commit 56f107d7813f ("PCI: Add pcie_reset_flr() with 'probe' argument") introduced pcie_reset_flr() and removed pcie_has_flr(), converting callers that previously used the pcie_has_flr() + pcie_flr() to use pcie_reset_flr() instead. However, it did not convert all pcie_flr() callers, leaving two different FLR mechanisms in the kernel.
One of the callers of pcie_flr(), the Intel 82599 Virtual Function has a defect where FLR works despite not advertising FLR support in the PCIe Device Capability register. Rather than using pcie_flr() to work around this, enable the FLR capability bit in devcap via an early quirk. This allows the device to use the standard pcie_reset_flr() path instead of requiring a device-specific reset method.
Remove pcie_flr() entirely and convert all remaining callers to pcie_reset_flr(), ensuring consistent validation across the kernel.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 2 +- drivers/infiniband/hw/hfi1/chip.c | 4 +- .../net/ethernet/broadcom/bnge/bnge_core.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +- .../ethernet/cavium/liquidio/lio_vf_main.c | 2 +- .../ethernet/cavium/liquidio/octeon_mailbox.c | 3 +- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- .../ethernet/freescale/enetc/enetc_pci_mdio.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 3 +- drivers/pci/pci.c | 38 ++++++------------ drivers/pci/quirks.c | 40 +++++++++---------- drivers/ptp/ptp_netc.c | 2 +- include/linux/pci.h | 1 - 15 files changed, 49 insertions(+), 60 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_aer.c +1 -1
@@ -89,7 +89,7 @@ EXPORT_SYMBOL_GPL(adf_reset_sbr);void adf_reset_flr (struct adf_accel_dev *accel_dev) { -pcie_flr (accel_to_pci_dev (accel_dev)); +pcie_reset_flr (accel_to_pci_dev (accel_dev),PCI_RESET_DO_RESET ); }EXPORT_SYMBOL_GPL (adf_reset_flr);
drivers/infiniband/hw/hfi1/chip.c +2 -2
@@ -14042,7 +14042,7 @@ static int init_chip(struct hfi1_devdata *dd)dd_dev_info (dd,"Resetting CSRs with FLR\n" );/* do the FLR, the DC reset will remain */ -pcie_flr (dd->pcidev); +pcie_reset_flr (dd->pcidev,PCI_RESET_DO_RESET );/* restore command and BARs */ ret =restore_pci_variables (dd);
@@ -14054,7 +14054,7 @@ static int init_chip(struct hfi1_devdata *dd)if (is_ax (dd)) {dd_dev_info (dd,"Resetting CSRs with FLR\n" ); -pcie_flr (dd->pcidev); +pcie_reset_flr (dd->pcidev,PCI_RESET_DO_RESET ); ret =restore_pci_variables (dd);if (ret) { dd_dev_err(dd, "%s: Could not restore PCI variables\n",
drivers/net/ethernet/broadcom/bnge/bnge_core.c +1 -1
@@ -274,7 +274,7 @@ static int bnge_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)if (is_kdump_kernel ()) {pci_clear_master (pdev); -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); } rc =bnge_pci_enable (pdev);
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -2
@@ -16918,7 +16918,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)*/ if (is_kdump_kernel ()) {pci_clear_master (pdev); -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); } max_irqs =bnxt_get_max_irq (pdev);
@@ -17203,7 +17203,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)netif_close (dev);if (bnxt_hwrm_func_drv_unrgtr (bp)) { -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); goto shutdown_exit; }bnxt_ptp_clear (bp);
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +1 -1
@@ -429,7 +429,7 @@ static void octeon_pci_flr(struct octeon_device *oct)pci_write_config_word (oct->pci_dev,PCI_COMMAND ,PCI_COMMAND_INTX_DISABLE ); -pcie_flr (oct->pci_dev); +pcie_reset_flr (oct->pci_dev,PCI_RESET_DO_RESET );pci_cfg_access_unlock (oct->pci_dev);
drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c +2 -1
@@ -260,7 +260,8 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,dev_info (&oct->pci_dev->dev,"got a request for FLR from VF that owns DPI ring %u\n" , mbox->q_no); -pcie_flr (oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]); +pcie_reset_flr (oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no], +PCI_RESET_DO_RESET );break ;case OCTEON_PF_CHANGED_VF_MACADDR :
drivers/net/ethernet/freescale/enetc/enetc.c +1 -1
@@ -3635,7 +3635,7 @@ int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv)size_t alloc_size;int err, len; -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); err =pci_enable_device_mem (pdev);if (err)return dev_err_probe (&pdev->dev, err,"device enable failed\n" );
drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +1 -1
@@ -73,7 +73,7 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, mdio_priv->mdio_base =ENETC_EMDIO_BASE ;snprintf (bus->id,MII_BUS_ID_SIZE ,"%s" ,dev_name (dev)); -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); err =pci_enable_device_mem (pdev);if (err) {dev_err (dev,"device enable failed\n" );
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -5180,7 +5180,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)if (is_kdump_kernel ()) {pci_save_state (pdev);pci_clear_master (pdev); - err =pcie_flr (pdev); + err =pcie_reset_flr (pdev,PCI_RESET_DO_RESET );if (err)return err;pci_restore_state (pdev);
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -1
@@ -8318,7 +8318,7 @@ static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter)if (status_reg !=IXGBE_FAILED_READ_CFG_WORD && status_reg &PCI_STATUS_REC_MASTER_ABORT ) {ixgbe_bad_vf_abort (adapter, vf); -pcie_flr (vfdev); +pcie_reset_flr (vfdev,PCI_RESET_DO_RESET ); } } }
drivers/net/ethernet/microsoft/mana/mana_en.c +2 -1
@@ -3305,7 +3305,8 @@ static int mana_dealloc_queues(struct net_device *ndev) }if (atomic_read (&txq->pending_sends)) { err = -pcie_flr (to_pci_dev (gd->gdma_context->dev)); +pcie_reset_flr (to_pci_dev (gd->gdma_context->dev), +PCI_RESET_DO_RESET );if (err) { netdev_err(ndev, "flr failed %d with %d pkts pending in txq %u\n", err,
drivers/pci/pci.c +13 -25
@@ -4321,16 +4321,25 @@ int pci_wait_for_pending_transaction(struct pci_dev *dev)EXPORT_SYMBOL (pci_wait_for_pending_transaction);/** -* pcie_flr - initiate a PCIe function level reset +* pcie_reset_flr - initiate a PCIe function level reset * @dev: device to reset +* @probe: if true, return 0 if device can be reset this way * -* Initiate a function level reset unconditionally on @dev without -* checking any flags and DEVCAP +* Initiate a function level reset on @dev. */ -int pcie_flr (struct pci_dev *dev) +int pcie_reset_flr (struct pci_dev *dev,bool probe) {int ret; +if (dev->dev_flags &PCI_DEV_FLAGS_NO_FLR_RESET ) +return -ENOTTY ; + +if (!(dev->devcap &PCI_EXP_DEVCAP_FLR )) +return -ENOTTY ; + +if (probe) +return 0 ; +if (!pci_wait_for_pending_transaction (dev))pci_err (dev,"timed out waiting for pending transaction; performing function level reset anyway\n" );
@@ -4357,28 +4366,7 @@ int pcie_flr(struct pci_dev *dev) done:pci_dev_reset_iommu_done (dev);return ret; -} -EXPORT_SYMBOL_GPL (pcie_flr); - -/** -* pcie_reset_flr - initiate a PCIe function level reset -* @dev: device to reset -* @probe: if true, return 0 if device can be reset this way -* -* Initiate a function level reset on @dev. -*/ -int pcie_reset_flr (struct pci_dev *dev,bool probe) -{ -if (dev->dev_flags &PCI_DEV_FLAGS_NO_FLR_RESET ) -return -ENOTTY ; - -if (!(dev->devcap &PCI_EXP_DEVCAP_FLR )) -return -ENOTTY ; - -if (probe) -return 0 ; -return pcie_flr (dev); }EXPORT_SYMBOL_GPL (pcie_reset_flr);
drivers/pci/quirks.c +20 -20
@@ -2019,6 +2019,23 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_0, quirk_pcDECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_PXH_1 , quirk_pcie_pxh);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_PXHV , quirk_pcie_pxh); +#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed +static void quirk_intel_82599_sfp_virtfn (struct pci_dev *dev) +{ +/* +* http://www.intel.com/content/dam/doc/datasheet/82599-10-gbe-controller-datasheet.pdf +* +* The 82599 supports FLR on VFs, but FLR support is reported only +* in the PF DEVCAP (sec 9.3.10.4), not in the VF DEVCAP (sec 9.5). +* So enable PCI_EXP_DEVCAP_FLR directly without first checking if it is +* supported. +*/ + + dev->devcap |=PCI_EXP_DEVCAP_FLR ; +} + +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82599_SFP_VF , quirk_intel_82599_sfp_virtfn); +/* * Some Intel PCI Express chipsets have trouble with downstream device * power management.
@@ -3944,20 +3961,6 @@ DECLARE_PCI_FIXUP_SUSPEND_LATE(PCI_VENDOR_ID_INTEL,* reset a single function if other methods (e.g. FLR, PM D0->D3) are * not available. */ -static int reset_intel_82599_sfp_virtfn (struct pci_dev *dev,bool probe) -{ -/* -* http://www.intel.com/content/dam/doc/datasheet/82599-10-gbe-controller-datasheet.pdf -* -* The 82599 supports FLR on VFs, but FLR support is reported only -* in the PF DEVCAP (sec 9.3.10.4), not in the VF DEVCAP (sec 9.5). -* Thus we must call pcie_flr() directly without first checking if it is -* supported. -*/ -if (!probe) -pcie_flr (dev); -return 0 ; -}#define SOUTH_CHICKEN2 0xc2004#define PCH_PP_STATUS 0xc7200
@@ -4058,7 +4061,7 @@ static int reset_chelsio_generic_dev(struct pci_dev *dev, bool probe)PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL); -pcie_flr (dev); +pcie_reset_flr (dev,PCI_RESET_DO_RESET );/* * Restore the configuration information (BAR values, etc.) including
@@ -4070,7 +4073,6 @@ static int reset_chelsio_generic_dev(struct pci_dev *dev, bool probe)return 0 ; } -#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed#define PCI_DEVICE_ID_INTEL_IVB_M_VGA 0x0156#define PCI_DEVICE_ID_INTEL_IVB_M2_VGA 0x0166
@@ -4150,7 +4152,7 @@ static int nvme_disable_and_flr(struct pci_dev *dev, bool probe)pci_iounmap (dev, bar); -pcie_flr (dev); +pcie_reset_flr (dev,PCI_RESET_DO_RESET );return 0 ; }
@@ -4207,7 +4209,7 @@ static int reset_hinic_vf_dev(struct pci_dev *pdev, bool probe) val = val |HINIC_VF_FLR_PROC_BIT ;iowrite32be (val, bar +HINIC_VF_OP ); -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET );/* * The device must recapture its Bus and Device Numbers after FLR
@@ -4238,8 +4240,6 @@ static int reset_hinic_vf_dev(struct pci_dev *pdev, bool probe) }static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82599_SFP_VF , - reset_intel_82599_sfp_virtfn }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_IVB_M_VGA , reset_ivb_igd }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_IVB_M2_VGA ,
drivers/ptp/ptp_netc.c +1 -1
@@ -802,7 +802,7 @@ static int netc_timer_pci_probe(struct pci_dev *pdev)if (!priv)return -ENOMEM ; -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); err =pci_enable_device_mem (pdev);if (err)return dev_err_probe (dev, err,"Failed to enable device\n" );
include/linux/pci.h +0 -1
@@ -1468,7 +1468,6 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,int pcie_link_speed_mbps (struct pci_dev *pdev);void pcie_print_link_status (struct pci_dev *dev);int pcie_reset_flr (struct pci_dev *dev,bool probe); -int pcie_flr (struct pci_dev *dev);int __pci_reset_function_locked (struct pci_dev *dev);int pci_reset_function (struct pci_dev *dev);int pci_reset_function_locked (struct pci_dev *dev);
Signature · 1 line
2.43.0
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Farhan,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
[also build test ERROR on tnguy-net-queue/dev-queue linus/master v7.1 next-20260615] [cannot apply to pci/next pci/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Farhan-Ali/PCI-Remove-pcie_flr-and-convert-all-callers-to-use-pcie_reset_flr/20260616-034658 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20260615192200.3489-1-alifm%40linux.ibm.com patch subject: [RFC PATCH v1] PCI: Remove pcie_flr() and convert all callers to use pcie_reset_flr() config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260616/[email protected]/config) compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project e19d1f51a2c80b63cd8ca95bcc757b7077112808) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260616/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/net/dsa/netc/netc_main.c:890:2: error: call to undeclared function 'pcie_flr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
890 | pcie_flr(pdev);
| ^
1 error generated.
--
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:12281:4: error: call to undeclared function 'pcie_flr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
12281 | pcie_flr(vfdev);
| ^1 error generated.
vim +/pcie_flr +890 drivers/net/dsa/netc/netc_main.c
187fbae024c843 Wei Fang 2026-05-18 881
187fbae024c843 Wei Fang 2026-05-18 882 static int netc_switch_pci_init(struct pci_dev *pdev)
187fbae024c843 Wei Fang 2026-05-18 883 {
187fbae024c843 Wei Fang 2026-05-18 884 struct device *dev = &pdev->dev;
187fbae024c843 Wei Fang 2026-05-18 885 struct netc_switch_regs *regs;
187fbae024c843 Wei Fang 2026-05-18 886 struct netc_switch *priv;
187fbae024c843 Wei Fang 2026-05-18 887 void __iomem *base;
187fbae024c843 Wei Fang 2026-05-18 888 int err;
187fbae024c843 Wei Fang 2026-05-18 889
187fbae024c843 Wei Fang 2026-05-18 @890 pcie_flr(pdev);
187fbae024c843 Wei Fang 2026-05-18 891 err = pcim_enable_device(pdev);
187fbae024c843 Wei Fang 2026-05-18 892 if (err)
187fbae024c843 Wei Fang 2026-05-18 893 return dev_err_probe(dev, err, "Failed to enable device\n");
187fbae024c843 Wei Fang 2026-05-18 894
187fbae024c843 Wei Fang 2026-05-18 895 err = pcim_request_all_regions(pdev, KBUILD_MODNAME);
187fbae024c843 Wei Fang 2026-05-18 896 if (err)
187fbae024c843 Wei Fang 2026-05-18 897 return dev_err_probe(dev, err, "Failed to request regions\n");
187fbae024c843 Wei Fang 2026-05-18 898
187fbae024c843 Wei Fang 2026-05-18 899 /* The command BD rings and NTMP tables need DMA. No need to check
187fbae024c843 Wei Fang 2026-05-18 900 * the return value, because it never returns fail when the mask is
187fbae024c843 Wei Fang 2026-05-18 901 * DMA_BIT_MASK(64), see dma-api-howto.rst.
187fbae024c843 Wei Fang 2026-05-18 902 */
187fbae024c843 Wei Fang 2026-05-18 903 dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
187fbae024c843 Wei Fang 2026-05-18 904
187fbae024c843 Wei Fang 2026-05-18 905 if (pci_resource_len(pdev, NETC_REGS_BAR) < NETC_REGS_SIZE) {
187fbae024c843 Wei Fang 2026-05-18 906 return dev_err_probe(dev, -EINVAL,
187fbae024c843 Wei Fang 2026-05-18 907 "Invalid register space size\n");
187fbae024c843 Wei Fang 2026-05-18 908 }
187fbae024c843 Wei Fang 2026-05-18 909
187fbae024c843 Wei Fang 2026-05-18 910 base = pcim_iomap(pdev, NETC_REGS_BAR, 0);
187fbae024c843 Wei Fang 2026-05-18 911 if (!base)
187fbae024c843 Wei Fang 2026-05-18 912 return dev_err_probe(dev, -ENXIO, "pcim_iomap() failed\n");
187fbae024c843 Wei Fang 2026-05-18 913
187fbae024c843 Wei Fang 2026-05-18 914 pci_set_master(pdev);
187fbae024c843 Wei Fang 2026-05-18 915
187fbae024c843 Wei Fang 2026-05-18 916 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
187fbae024c843 Wei Fang 2026-05-18 917 if (!priv)
187fbae024c843 Wei Fang 2026-05-18 918 return -ENOMEM;
187fbae024c843 Wei Fang 2026-05-18 919
187fbae024c843 Wei Fang 2026-05-18 920 priv->pdev = pdev;
187fbae024c843 Wei Fang 2026-05-18 921 priv->dev = dev;
187fbae024c843 Wei Fang 2026-05-18 922
187fbae024c843 Wei Fang 2026-05-18 923 regs = &priv->regs;
187fbae024c843 Wei Fang 2026-05-18 924 regs->base = base;
187fbae024c843 Wei Fang 2026-05-18 925 regs->port = regs->base + NETC_REGS_PORT_BASE;
187fbae024c843 Wei Fang 2026-05-18 926 regs->global = regs->base + NETC_REGS_GLOBAL_BASE;
187fbae024c843 Wei Fang 2026-05-18 927 pci_set_drvdata(pdev, priv);
187fbae024c843 Wei Fang 2026-05-18 928
187fbae024c843 Wei Fang 2026-05-18 929 return 0;
187fbae024c843 Wei Fang 2026-05-18 930 }
187fbae024c843 Wei Fang 2026-05-18 931 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Farhan,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
[also build test ERROR on tnguy-net-queue/dev-queue linus/master v7.1 next-20260615] [cannot apply to pci/next pci/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Farhan-Ali/PCI-Remove-pcie_flr-and-convert-all-callers-to-use-pcie_reset_flr/20260616-034658 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20260615192200.3489-1-alifm%40linux.ibm.com patch subject: [RFC PATCH v1] PCI: Remove pcie_flr() and convert all callers to use pcie_reset_flr() config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20260616/[email protected]/config) compiler: hppa-linux-gcc (GCC) 16.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260616/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/net/dsa/netc/netc_main.c: In function 'netc_switch_pci_init':
>> drivers/net/dsa/netc/netc_main.c:890:9: error: implicit declaration of function 'pcie_flr' [-Wimplicit-function-declaration]
890 | pcie_flr(pdev);
| ^~~~~~~~
--
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c: In function 'ixgbe_io_error_detected':
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:12281:25: error: implicit declaration of function 'pcie_flr' [-Wimplicit-function-declaration]
12281 | pcie_flr(vfdev);
| ^~~~~~~~vim +/pcie_flr +890 drivers/net/dsa/netc/netc_main.c
187fbae024c843 Wei Fang 2026-05-18 881
187fbae024c843 Wei Fang 2026-05-18 882 static int netc_switch_pci_init(struct pci_dev *pdev)
187fbae024c843 Wei Fang 2026-05-18 883 {
187fbae024c843 Wei Fang 2026-05-18 884 struct device *dev = &pdev->dev;
187fbae024c843 Wei Fang 2026-05-18 885 struct netc_switch_regs *regs;
187fbae024c843 Wei Fang 2026-05-18 886 struct netc_switch *priv;
187fbae024c843 Wei Fang 2026-05-18 887 void __iomem *base;
187fbae024c843 Wei Fang 2026-05-18 888 int err;
187fbae024c843 Wei Fang 2026-05-18 889
187fbae024c843 Wei Fang 2026-05-18 @890 pcie_flr(pdev);
187fbae024c843 Wei Fang 2026-05-18 891 err = pcim_enable_device(pdev);
187fbae024c843 Wei Fang 2026-05-18 892 if (err)
187fbae024c843 Wei Fang 2026-05-18 893 return dev_err_probe(dev, err, "Failed to enable device\n");
187fbae024c843 Wei Fang 2026-05-18 894
187fbae024c843 Wei Fang 2026-05-18 895 err = pcim_request_all_regions(pdev, KBUILD_MODNAME);
187fbae024c843 Wei Fang 2026-05-18 896 if (err)
187fbae024c843 Wei Fang 2026-05-18 897 return dev_err_probe(dev, err, "Failed to request regions\n");
187fbae024c843 Wei Fang 2026-05-18 898
187fbae024c843 Wei Fang 2026-05-18 899 /* The command BD rings and NTMP tables need DMA. No need to check
187fbae024c843 Wei Fang 2026-05-18 900 * the return value, because it never returns fail when the mask is
187fbae024c843 Wei Fang 2026-05-18 901 * DMA_BIT_MASK(64), see dma-api-howto.rst.
187fbae024c843 Wei Fang 2026-05-18 902 */
187fbae024c843 Wei Fang 2026-05-18 903 dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
187fbae024c843 Wei Fang 2026-05-18 904
187fbae024c843 Wei Fang 2026-05-18 905 if (pci_resource_len(pdev, NETC_REGS_BAR) < NETC_REGS_SIZE) {
187fbae024c843 Wei Fang 2026-05-18 906 return dev_err_probe(dev, -EINVAL,
187fbae024c843 Wei Fang 2026-05-18 907 "Invalid register space size\n");
187fbae024c843 Wei Fang 2026-05-18 908 }
187fbae024c843 Wei Fang 2026-05-18 909
187fbae024c843 Wei Fang 2026-05-18 910 base = pcim_iomap(pdev, NETC_REGS_BAR, 0);
187fbae024c843 Wei Fang 2026-05-18 911 if (!base)
187fbae024c843 Wei Fang 2026-05-18 912 return dev_err_probe(dev, -ENXIO, "pcim_iomap() failed\n");
187fbae024c843 Wei Fang 2026-05-18 913
187fbae024c843 Wei Fang 2026-05-18 914 pci_set_master(pdev);
187fbae024c843 Wei Fang 2026-05-18 915
187fbae024c843 Wei Fang 2026-05-18 916 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
187fbae024c843 Wei Fang 2026-05-18 917 if (!priv)
187fbae024c843 Wei Fang 2026-05-18 918 return -ENOMEM;
187fbae024c843 Wei Fang 2026-05-18 919
187fbae024c843 Wei Fang 2026-05-18 920 priv->pdev = pdev;
187fbae024c843 Wei Fang 2026-05-18 921 priv->dev = dev;
187fbae024c843 Wei Fang 2026-05-18 922
187fbae024c843 Wei Fang 2026-05-18 923 regs = &priv->regs;
187fbae024c843 Wei Fang 2026-05-18 924 regs->base = base;
187fbae024c843 Wei Fang 2026-05-18 925 regs->port = regs->base + NETC_REGS_PORT_BASE;
187fbae024c843 Wei Fang 2026-05-18 926 regs->global = regs->base + NETC_REGS_GLOBAL_BASE;
187fbae024c843 Wei Fang 2026-05-18 927 pci_set_drvdata(pdev, priv);
187fbae024c843 Wei Fang 2026-05-18 928
187fbae024c843 Wei Fang 2026-05-18 929 return 0;
187fbae024c843 Wei Fang 2026-05-18 930 }
187fbae024c843 Wei Fang 2026-05-18 931 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
New issues:
- [Critical] Unchecked VF FLR failure introduces a reliable DMA Use-After-Free (UAF) in the MANA driver during queue teardown.
- [High] Replacing pcie_flr() with pcie_reset_flr() silently breaks Function Level Reset (FLR) for all SR-IOV Virtual Functions (VFs) across multiple drivers.
- [High] Silent FLR failure in PCI reset quirks causes the kernel to block for 20 seconds during device teardown or initialization.
- [Low] The patch breaks the kernel build because it missed converting a caller of pcie_flr() in the ixgbe driver.
Pre-existing issues:
- [Critical] An unbounded MMIO read loop causes an infinite loop and hard lockup if the PCIe device is hot-unplugged or encounters a fatal hardware error. --
commit e494ba565a5af359d72294da06691da5e6507322
Author: Farhan Ali <[email protected]>
Subject: PCI: Remove pcie_flr() and convert all callers to use pcie_reset_flr()
This patch removes the unconditional pcie_flr() function and converts its remaining callers to use pcie_reset_flr(). This ensures validation checks, such as verifying FLR support in the device capabilities, are applied consistently across the kernel.
Quoted 3 lines
drivers/pci/pci.c +0
-0
[ ... ]
drivers/pci/pci.c
Quoted 9 lines
int
pcie_reset_flr(struct pci_dev *dev, bool probe){drivers/pci/pci.c +0
-0int ret;if (dev->dev_flags &PCI_DEV_FLAGS_NO_FLR_RESET )return -ENOTTY ;if (!(dev->devcap &PCI_EXP_DEVCAP_FLR ))return -ENOTTY ;
[Severity: High]
According to the PCIe Base Specification, SR-IOV Virtual Functions do not report FLR capability in their Device Capabilities register, so this check will fail for VFs.
Is this a regression that inadvertently breaks FLR for VFs that previously relied on pcie_flr() bypassing this check? Callers that ignore the return value will silently skip resetting the hardware.
Quoted 3 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0
-0
[ ... ]
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter) · line 8323
Quoted 7 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1
-1@@ -8319,7 +8319,7 @@ static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter)if (status_reg !=IXGBE_FAILED_READ_CFG_WORD && status_reg &PCI_STATUS_REC_MASTER_ABORT ) {ixgbe_bad_vf_abort (adapter, vf); -pcie_flr (vfdev); +pcie_reset_flr (vfdev,PCI_RESET_DO_RESET ); }
[Severity: Low]
Does this patch introduce a build regression by missing another caller in ixgbe_main.c?
Searching the tree might reveal that ixgbe_io_error_detected() still calls the now-removed pcie_flr(), which would cause a build failure when compiling with CONFIG_IXGBE.
Quoted 3 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +0
-0
[ ... ]
drivers/net/ethernet/microsoft/mana/mana_en.c static int mana_dealloc_queues(struct net_device *ndev) · line 3313
Quoted 10 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +2
-1@@ -3306,7 +3306,8 @@ static int mana_dealloc_queues(struct net_device *ndev) }if (atomic_read (&txq->pending_sends)) { err = -pcie_flr (to_pci_dev (gd->gdma_context->dev)); +pcie_reset_flr (to_pci_dev (gd->gdma_context->dev), +PCI_RESET_DO_RESET );if (err) { netdev_err(ndev, "flr failed %d with %d pkts pending in txq %u\n", err,
[Severity: Critical]
If pcie_reset_flr() returns -ENOTTY for VFs, the FLR fails and this loop breaks early.
Will the driver then proceed to unmap and free active SKB buffers in the subsequent loop:
mana_dealloc_queues() {
...
for (i = 0; i < apc->num_queues; i++) {
txq = &apc->tx_qp[i].txq;
while ((skb = skb_dequeue(&txq->pending_skbs))) {
mana_unmap_skb(skb, apc);
dev_kfree_skb_any(skb);
}
...
}Since the hardware wasn't reset and remains active, can this lead to a DMA use-after-free regression as the hardware continues to process the freed memory?
Quoted 3 lines
drivers/pci/quirks.c +0
-0
[ ... ]
drivers/pci/quirks.c static int reset_hinic_vf_dev(struct pci_dev *pdev, bool probe) · line 4215
Quoted 9 lines
drivers/pci/quirks.c +1
-1@@ -4207,7 +4209,7 @@ static int reset_hinic_vf_dev(struct pci_dev *pdev, bool probe) val = val |HINIC_VF_FLR_PROC_BIT ;iowrite32be (val, bar +HINIC_VF_OP ); -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET );/* * The device must recapture its Bus and Device Numbers after FLR
[Severity: High]
If pcie_reset_flr() returns -ENOTTY without actually issuing a reset to the hardware, will the firmware ever clear the HINIC_VF_FLR_PROC_BIT?
Looking at the rest of reset_hinic_vf_dev(), it appears the code will subsequently spin in a busy-wait loop for the full 20-second timeout waiting for that bit to clear:
reset_hinic_vf_dev() {
...
do {
val = ioread32be(bar + HINIC_VF_OP);
if (!(val & HINIC_VF_FLR_PROC_BIT))
goto reset_complete;
msleep(20);
} while (time_before(jiffies, timeout));
...
}Could this regression silently block the thread for 20 seconds during device teardown?
Quoted 3 lines
drivers/ptp/ptp_netc.c +0
-0
[ ... ]
drivers/ptp/ptp_netc.c static int netc_timer_pci_probe(struct pci_dev *pdev) · line 806
Quoted 7 lines
drivers/ptp/ptp_netc.c +1
-1@@ -802,7 +802,7 @@ static int netc_timer_pci_probe(struct pci_dev *pdev)if (!priv)return -ENOMEM ; -pcie_flr (pdev); +pcie_reset_flr (pdev,PCI_RESET_DO_RESET ); err =pci_enable_device_mem (pdev);
[Severity: Critical]
This is a pre-existing issue, but while reviewing this driver's PCIe handling, does the interrupt handler have an unbounded loop on PCIe disconnect?
In netc_timer_handle_etts_event(), the code continuously reads a memory-mapped register:
netc_timer_handle_etts_event() {
...
while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index)) {
...
}
...
}If the device is removed or experiences a fatal error, the MMIO read will return all 1s (0xFFFFFFFF). Because 0xFFFFFFFF masked with the bit is always true, would this loop spin infinitely and cause a hard lockup?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1