DYNAMIC CONFIGURATION

Hot-Plug Complete Guide

Native PCIe Hot-Plug: insertion, removal, indicators, and power control

1. What is Hot-Plug?

What is PCIe Hot-Plug?

Hot-Plug enables adding or removing PCIe devices while the system is running without shutdown. It includes hardware mechanisms (indicators, sensors) and software support for safe device management.

Hot-Plug Elements

Element Purpose
Attention Button User request for attention
Attention Indicator Visual status (amber LED)
Power Indicator Power status (green LED)
Power Controller Slot power on/off
Presence Detect Card inserted detection
MRL Sensor Latch position detection
Electromechanical Interlock Prevent removal while powered

2. Hot-Plug Scenarios

Card Insertion Flow

    1. Card inserted → Presence Detect triggers
    2. MRL closed → MRL Sensor detects
    3. Software notified via interrupt
    4. Software enables Power Controller
    5. Power Indicator set to ON
    6. Link training begins
    7. Device enumerated and configured
    8. Driver loaded

Card Removal Flow (Ordered)

    1. User presses Attention Button
    2. Attention Indicator blinks
    3. Software quiesces device (stop I/O)
    4. Driver unloaded
    5. Software disables Power Controller
    6. Power Indicator set to OFF
    7. Attention Indicator solid (safe to remove)
    8. User opens MRL and removes card

Surprise Removal

Card removed without software coordination:

3. Hot-Plug Registers

Slot Capabilities Register

Bit Field Description
0 Attention Button Present Slot has attention button
1 Power Controller Present Slot has power control
2 MRL Sensor Present Slot has latch sensor
3 Attention Indicator Present Slot has attention LED
4 Power Indicator Present Slot has power LED
5 Hot-Plug Surprise Supports surprise removal
6 Hot-Plug Capable Slot supports hot-plug
7 Electromechanical Interlock Present Slot has interlock

Slot Control Register

Bits Field Values
1:0 Attention Indicator Control 00=Rsvd, 01=On, 10=Blink, 11=Off
3:2 Power Indicator Control 00=Rsvd, 01=On, 10=Blink, 11=Off
4 Power Controller Control 0=Power On, 1=Power Off
5 Electromechanical Interlock Control 1=Unlock

Slot Status Register

Bit Field Description
0 Attention Button Pressed Button was pressed
1 Power Fault Detected Slot power fault
2 MRL Sensor Changed Latch position changed
3 Presence Detect Changed Card presence changed
6 Presence Detect State 1=Card present
7 MRL Sensor State 0=Closed, 1=Open

4. Indicator States

Power Indicator

State Meaning
ON (solid green) Slot powered, card functional
Blink Power transition in progress
OFF Slot not powered

Attention Indicator

State Meaning
ON (solid amber) Problem with slot/card
Blink Action in progress
OFF Normal operation

5. Data Link Layer State Changed

DL_Active status change can trigger hot-plug notification:

6. Linux Hot-Plug

Checking Hot-Plug Support

    # Check slot capabilities
    lspci -vvv -s 00:1c.0 | grep -A5 "Slot:"
    
    # View hot-plug events
    dmesg | grep -i pciehp
    
    # Manual rescan
    echo 1 > /sys/bus/pci/rescan
    
    # Remove device
    echo 1 > /sys/bus/pci/devices/0000:03:00.0/remove

7. Power Fault Handling