Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v1 00/13] PCI/IOV: Improve reset handling with VFs enabled
@ 2026-10-19  8:35 Lukasz Laguna
  2026-10-19  8:35 ` [PATCH v1 01/13] PCI/IOV: Introduce pci_iov_get_virtfn() Lukasz Laguna
                   ` (12 more replies)
  0 siblings, 13 replies; 27+ messages in thread
From: Lukasz Laguna @ 2026-10-19  8:35 UTC (permalink / raw)
  To: linux-pci, bhelgaas
  Cc: michal.winiarski, djbw, brett.creeley, anthony.l.nguyen,
	przemyslaw.kitszel, pabeni, andrew+netdev, davem, edumazet, kuba

This series improves reset handling for SR-IOV devices. Today there
are a few gaps when resets happen with VFs enabled:

 1. VF state is lost across PF reset. The PCI core saves and restores
    the PF's config state, including its SR-IOV capability, and the
    kernel representation of each VF (struct pci_dev / struct device)
    survives the reset, but the VFs' hardware state does not. From the
    PCI point of view, the VFs do not exist between the PF reset and
    the restore of the PF IOV state. Their config space is lost, and
    their drivers are never notified about the reset.

 2. VFs are prepared in the wrong order during bus and slot reset. VFs
    are handled like any other device on the bus, and because the walk
    is top-down, the PF's .reset_prepare() runs before its VFs'
    callbacks.

 3. The "bus" reset method is unavailable for a PF with VFs enabled.
    pci_parent_bus_reset() accepts a device only if no other devices
    are on its bus. A PF's VFs sit on the same bus as the PF, so
    enabling VFs makes the PF fail this check. The VFs are in the PF's
    reset domain, so they should not block a bus reset of the PF.

This series addresses these gaps as follows:

 - Patches 1-3 add the PCI core helpers used by the rest of the series.

 - Patch 4 fixes (1) and (2). It locks all VFs together with the PF
   around a function reset, saves and restores the VFs' config state,
   and calls the VF drivers' .reset_prepare() / .reset_done()
   callbacks, so both architected and device-specific state can be
   preserved. During bus and slot resets, VFs are skipped in the device
   walk and handled through their PF. VFs are prepared before the PF
   and restored after it. As a result, pci_reset_function_locked() now
   requires PF callers to hold the device locks of all enabled VFs as
   well.

 - Patches 5-7 adapt PF drivers to the new core behavior. ionic and
   pds_core call pci_reset_function_locked() from their error resume
   handlers, so they now need to lock the VFs around it. i40e no longer
   needs to restore the VFs' MSI state in its .reset_done(), since the
   PCI core now restores the VFs' config state.

 - Patch 8 fixes (3). pci_parent_bus_reset() now ignores the PF's own
   VFs when it checks for other devices on the bus.

 - Patches 9-13 replace open-coded VF lookups with the new helpers.
   PCI/TSM and ixgbe use the VF iterators, and ice, liquidio and xe
   use pci_iov_get_virtfn(). These patches depend on patches 1-2 and
   are independent of the reset changes.

Lukasz Laguna (12):
  PCI/IOV: Introduce pci_iov_get_virtfn()
  PCI/IOV: Introduce VF iterators
  PCI/IOV: Introduce VF locking helpers
  ionic: Lock VFs around pci_reset_function_locked()
  pds_core: Lock VFs around pci_reset_function_locked()
  i40e: Drop VF MSI state restore from PF reset_done
  PCI/IOV: Allow bus reset_method for PF with VFs enabled
  PCI/TSM: Use generic VF iterators
  ixgbe: Use generic VF iterator
  ice: Use pci_iov_get_virtfn()
  liquidio: Use pci_iov_get_virtfn()
  drm/xe/pf: Use pci_iov_get_virtfn()

Michał Winiarski (1):
  PCI/IOV: Allow VF drivers to handle resets

 drivers/gpu/drm/xe/xe_pci_sriov.c             |   4 +-
 drivers/net/ethernet/amd/pds_core/main.c      |   5 +-
 .../ethernet/cavium/liquidio/octeon_mailbox.c |  10 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c   |   3 -
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    |  26 ----
 .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |   3 -
 drivers/net/ethernet/intel/ice/ice_sriov.c    |  20 +--
 .../net/ethernet/intel/ixgbe/ixgbe_sriov.c    |  25 +--
 .../ethernet/pensando/ionic/ionic_bus_pci.c   |   5 +-
 drivers/pci/iov.c                             |  88 ++++++++++-
 drivers/pci/pci.c                             | 146 +++++++++++++++++-
 drivers/pci/tsm.c                             |  25 +--
 include/linux/pci.h                           |  63 ++++++++
 13 files changed, 308 insertions(+), 115 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2026-10-19  9:03 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  8:35 [PATCH v1 00/13] PCI/IOV: Improve reset handling with VFs enabled Lukasz Laguna
2026-10-19  8:35 ` [PATCH v1 01/13] PCI/IOV: Introduce pci_iov_get_virtfn() Lukasz Laguna
2026-10-19  8:43   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 02/13] PCI/IOV: Introduce VF iterators Lukasz Laguna
2026-10-19  8:43   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 03/13] PCI/IOV: Introduce VF locking helpers Lukasz Laguna
2026-10-19  8:47   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 04/13] PCI/IOV: Allow VF drivers to handle resets Lukasz Laguna
2026-10-19  9:03   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 05/13] ionic: Lock VFs around pci_reset_function_locked() Lukasz Laguna
2026-10-19  8:45   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 06/13] pds_core: " Lukasz Laguna
2026-10-19  8:44   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 07/13] i40e: Drop VF MSI state restore from PF reset_done Lukasz Laguna
2026-10-19  8:42   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 08/13] PCI/IOV: Allow bus reset_method for PF with VFs enabled Lukasz Laguna
2026-10-19  8:48   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 09/13] PCI/TSM: Use generic VF iterators Lukasz Laguna
2026-10-19  8:40   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 10/13] ixgbe: Use generic VF iterator Lukasz Laguna
2026-10-19  8:41   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 11/13] ice: Use pci_iov_get_virtfn() Lukasz Laguna
2026-10-19  8:42   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 12/13] liquidio: " Lukasz Laguna
2026-10-19  8:43   ` sashiko-bot
2026-10-19  8:35 ` [PATCH v1 13/13] drm/xe/pf: " Lukasz Laguna
2026-10-19  8:43   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox