PCIe Hot Plug Explained Clearly in One Expert Guide

What is PCIe Hot Plug?

PCIe Hot Plug refers to the capability that allows PCIe devices to be safely inserted or removed while the system is powered on. It is widely used in servers and data center environments. PCIe Hot Plug is an important method for enhancing a system’s RAS (Reliability, Availability, and Serviceability) capability.

The registers required for the hot-plug controller are integrated into the Root and Switch ports. Under software control, these controllers and port interfaces must manage the PCIe card’s interface signals to ensure orderly power-up and power-down during hot-plug operations.

PCIe Hot Plug is a “no surprise” method, meaning the system must be notified in advance. Software prepares the card and the slot, informs the user of the hot-plug status, and notifies them when it is safe to proceed.

Surprise Removal: PCIe CEM specifies detection pins PRSNT1# and PRSNT2# for device presence. PRSNT1# is grounded, and PRSNT2# is pulled high. These pins are shorter than the others, so they disconnect first when a PCIe card is removed, giving software an early “surprise” removal signal and allowing time to cut power before full disconnection.

PCIe Hot Plug Components and Structure

PCIe uses point-to-point connections, and each port connected to a connector requires a hot plug controller. Standard software interfaces defined for each Root port and Switch port control hot-plug operations.

The elements required for hot-plug are divided into software and hardware components.

Software components include:

  • User Interface: provided by OS vendor
  • Hot Plug Service: provided by OS vendor
  • Standard Hot Plug System Driver: provided by the system board or OS vendor
  • Device Driver: provided by the adapter card vendor

Hardware components include:

  • Hot Plug Controller: receives and processes commands from the hot-plug system driver
  • Card Slot Power Switching Logic: controlled by the hot-plug controller to switch power
  • Card Reset Logic: sends PERST# signal to the slot
  • Power Indicator: shows power status on the connector
  • Attention Indicator: warning light indicating hot-plug failure, usually off
  • Attention Button: pressed by the user to notify the software of a device replacement
  • Card Present Detect Pins: PRSNT1# and PRSNT2# signals to detect if a PCIe device is present
    • PRSNT1# is grounded
    • PRSNT2# is high when no device is present, and low when a device is inserted

Detailed PCIe Hot Plug Process

The following outlines the specific procedures for removing and inserting a PCIe device.

PCIe Device Removal Process:

Normal status indicators:

  • Attention Indicator: Yellow – Off
  • Power Indicator: Green – On

The user presses the Attention Button or informs the system via software to remove the PCIe device. The hot-plug controller detects the button press and sends an interrupt to the Root Complex (RC). The Hot Plug Service calls the hot-plug driver to read the slot status and check the Attention button state.

The driver causes the power indicator to blink for 5 seconds, signaling the user. Within these 5 seconds, the user can press the button again to cancel the request. If the software confirms the request, the indicator keeps blinking. If the PCIe device is involved in critical system operations, the request may be denied, and the indicator will be turned back on.

If the request is valid, the device driver will quiesce the device—stopping it from generating new requests and completing or aborting any outstanding requests. The software disables the PCIe link using the Link Control register.

The software commands the hot-plug controller to power off the slot. Once successful, the software turns off the power indicator light to inform the user. The user releases the mechanical lock (if any), and the hot-plug controller disconnects all switched signals (e.g., SMBus and JTAG) from the slot.

Now the PCIe device can be physically removed. The OS releases the memory space, I/O space, interrupt lines, etc., assigned to the device.

PCIe Device Insertion Process:

The user inserts the PCIe device and locks the MRL (if applicable). The user presses the Attention Button or informs the system through software.

Pressing the button sets a status register bit and sends an interrupt to the RC. The software reads the slot status and recognizes the request. The driver instructs the controller to blink the slot’s power indicator, warning the user that the device should not be removed. (If the user presses the button again within 5 seconds, the request is canceled.)

The driver instructs the hot-plug controller to power on the slot. After power is applied, the software turns on the power indicator. Once link training is complete, the software allocates necessary resources and configures the PCIe function. The OS identifies and loads the appropriate driver for the PCIe device.

The OS calls the driver to complete device initialization and enable the PCIe device.

PCIe Hot Plug Controller Programming Interface

The programming interface for the PCIe hot-plug controller is provided via the PCIe capability registers (shown in the red box in the diagram).

PCIe supports the following hot-plug events, each with a status and enable field. The status indicates the event has occurred but has not yet been handled by software. The enable field indicates whether the event notification is enabled.

  • Slot Event
    • Attention Button Pressed
    • Power Fault Detected
    • MRL Sensor Changed
    • Presence Detect Changed
    • Command Completed Event
    • Data Link Layer State Changed Event
End-of-Yunze-blog

Disclaimer:

  1. This channel does not make any representations or warranties regarding the availability, accuracy, timeliness, effectiveness, or completeness of any information posted. It hereby disclaims any liability or consequences arising from the use of the information.
  2. This channel is non-commercial and non-profit. The re-posted content does not signify endorsement of its views or responsibility for its authenticity. It does not intend to constitute any other guidance. This channel is not liable for any inaccuracies or errors in the re-posted or published information, directly or indirectly.
  3. Some data, materials, text, images, etc., used in this channel are sourced from the internet, and all reposts are duly credited to their sources. If you discover any work that infringes on your intellectual property rights or personal legal interests, please contact us, and we will promptly modify or remove it.

Leave a Reply