Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
en:pcie:hot-reset-linux [2019/04/16 23:02]
alex
en:pcie:hot-reset-linux [2020/04/29 07:58]
alex
Line 3: Line 3:
 Resets in PCI express are a bit complex. There are two main types of resets - conventional reset, and function-level reset. There are also two types of conventional resets, fundamental resets and non-fundamental resets. See the PCI express specification for all of the details. Resets in PCI express are a bit complex. There are two main types of resets - conventional reset, and function-level reset. There are also two types of conventional resets, fundamental resets and non-fundamental resets. See the PCI express specification for all of the details.
  
-A 'cold reset' is a fundamental reset that takes place after power is applied to a PCIe device. There appears to be no standard way of triggering a cold reset, save for turning the system off and back on again. On my machines, the /​sys/​bus/​pci/​slots directory is empty.+A 'cold reset' is a fundamental reset that takes place after power is applied to a PCIe device. There appears to be no standard way of triggering a cold reset, save for turning the system off and back on again. On my machines, the ''​/​sys/​bus/​pci/​slots'' ​directory is empty.
  
 A 'warm reset' is a fundamental reset that is triggered without disconnecting power from the device. There appears to be no standard way of triggering a warm reset. A 'warm reset' is a fundamental reset that is triggered without disconnecting power from the device. There appears to be no standard way of triggering a warm reset.
Line 15: Line 15:
 I am not aware of any '​nice'​ method for triggering a hot reset (there is no sysfs entry for that). However, it is possible to use setpci to do so with the following script: I am not aware of any '​nice'​ method for triggering a hot reset (there is no sysfs entry for that). However, it is possible to use setpci to do so with the following script:
  
-<​code ​sh>+<​code ​bash>
  
 #!/bin/bash #!/bin/bash
Line 65: Line 65:
 Ensure that all attached drivers are unloaded before running this script. This script will attempt to remove the PCIe device, then command the upstream switch port to issue a hot reset, then attempt to rescan the PCIe bus. This script has also only been tested on devices with a single function, so it may need some reworking for devices with multiple functions. ​ Ensure that all attached drivers are unloaded before running this script. This script will attempt to remove the PCIe device, then command the upstream switch port to issue a hot reset, then attempt to rescan the PCIe bus. This script has also only been tested on devices with a single function, so it may need some reworking for devices with multiple functions. ​
  
 +[[https://​unix.stackexchange.com/​a/​474378/​55879|Answer on Stack Exchange]]