PCI: Reduce delay after FLR of Microsoft MANA devices
PATCH v2 1/1 PCI: Reduce delay after FLR of Microsoft MANA devices
From: Graham Whyte <[email protected]>
Add a device-specific reset for Microsoft MANA devices with the FLR delay reduced from 100ms to 10ms. While this is not compliant with the pci spec, these devices safely complete the FLR much quicker than 100ms and this can be reduced to optimize certain scenarios
---
Changes in v2:
- Removed unnecessary EXPORT_SYMBOL_GPL for function pci_dev_wait
- Link to v1:https://lore.kernel.org/linux-pci/20250522085253.GN7435@unreal/T/#m7453647902a1b22840f5e39434a631fd7b2515ce
--- drivers/pci/pci.c | 2 +- drivers/pci/pci.h | 1 + drivers/pci/quirks.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -1262,7 +1262,7 @@ void pci_resume_bus(struct pci_bus *bus)pci_walk_bus (bus, pci_resume_one,NULL ); } -static int pci_dev_wait (struct pci_dev *dev,char *reset_type,int timeout) +int pci_dev_wait (struct pci_dev *dev,char *reset_type,int timeout) {int delay =1 ;bool retrain = false;
drivers/pci/pci.h +1 -0
@@ -109,6 +109,7 @@ void pci_init_reset_methods(struct pci_dev *dev);int pci_bridge_secondary_bus_reset (struct pci_dev *dev);int pci_bus_error_reset (struct pci_dev *dev);int __pci_reset_bus (struct pci_bus *bus); +int pci_dev_wait (struct pci_dev *dev,char *reset_type,int timeout);struct pci_cap_saved_data {u16 cap_nr;
drivers/pci/quirks.c +55 -0
67 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 4 lines · On Wed, May 28, 2025 at 06:10:47PM +0000, [email protected] wrote:
Add a device-specific reset for Microsoft MANA devices with the FLR delay reduced from 100ms to 10ms. While this is not compliant with the pci spec, these devices safely complete the FLR much quicker than 100ms and this can be reduced to optimize certain scenarios
How often do you reset these devices that 90 msec makes a difference? What are these "certain scenarios"?
There are already "d3hot_delay" and "d3cold_delay" members in struct pci_dev. I'm wondering if it would make sense to add another one, say, "flr_delay". That would allow other devices to reduce or lengthen the delay without each of them having to duplicate pcie_flr(). The code duplication makes this difficult to maintain long-term.
Thanks,
Lukas
Quoted 9 lines · Lukas Wunner
Quoted 4 lines · On Wed, May 28, 2025 at 06:10:47PM +0000, [email protected] wrote:
Add a device-specific reset for Microsoft MANA devices with the FLR delay reduced from 100ms to 10ms. While this is not compliant with the pci spec, these devices safely complete the FLR much quicker than 100ms and this can be reduced to optimize certain scenarios
How often do you reset these devices that 90 msec makes a difference? What are these "certain scenarios"?
VF removal and rescan is the main scenario for runtime repairs and driver updates. Doing this on scale with 100ms adds up to significant time across multiple VFs.
Quoted 7 lines
There are already "
d3hot_delay" and "d3cold_delay" members in structpci_dev. I'm wondering if it would make sense to add another one, say, "flr_delay". That would allow other devices to reduce or lengthen the delay without each of them having to duplicatepcie_flr(). The code duplication makes this difficult to maintain long-term.
This is a good suggestion, we can make this more generic.
Quoted 3 lines
Thanks,
Lukas
Quoted 7 lines · Graham Whyte
Quoted 6 lines · Lukas Wunner
Quoted 4 lines · On Wed, May 28, 2025 at 06:10:47PM +0000, [email protected] wrote:
Add a device-specific reset for Microsoft MANA devices with the FLR delay reduced from 100ms to 10ms. While this is not compliant with the pci spec, these devices safely complete the FLR much quicker than 100ms and this can be reduced to optimize certain scenarios
Quoted 7 lines
Quoted 2 lines
How often do you reset these devices that 90 msec makes a difference? What are these "certain scenarios"?
VF removal and rescan is the main scenario for runtime repairs and driver updates.
Doing this on scale with 100ms adds up to significant time across multiple VFs.
Please mention this in the commit message to avoid head-scratching by someone reading it down the road.
Thanks,
Lukas