PCIe Chapter 11: Hot-Plug and Topology Changes

Connect insertion to a usable function

This is a managed insertion path. Power-controller support and notification capabilities determine which actions apply. Control-operation completion, link readiness and resource configuration are distinct conditions.This is a managed insertion path. Power-controller support and notification capabilities determine which actions apply. Control-operation completion, link readiness and resource configuration are distinct conditions.Hot-plug management softwarePort / slot controllerNew functionPresence / event notification ←Control power where supported →Check power, reset and link conditionsAfter the required waits: enumerate, configure, bind
This is a managed insertion path. Power-controller support and notification capabilities determine which actions apply. Control-operation completion, link readiness and resource configuration are distinct conditions.

Managed hot-plug connects presence, power, link readiness and software configuration. Chapter 3/4 enumeration and resource allocation are reused after the applicable link and reset waits.

Specification route: Slot implementation and hot-plug capability → Figures 7-30–7-32 → Section 6.7.3 operations and notification → enumeration and resources.

PCIe Hot-Plug turns changes at a physical slot into consistent software state. Capability, notification, power, Link readiness, and resource assignment require different evidence. This report follows one insertion, then compares orderly and asynchronous removal.

Start capability discovery at the Port that manages the slot

After locating the PCI Express Capability at 0x70 on 02:01.0, use Figure 7-23 for Port Type and Slot Implemented, then Figure 7-30 for Slot Capabilities. Do not search the Endpoint for its parent slot controller. Physical elements depend on the form factor; Base does not require identical buttons, latches, and indicators everywhere.

Initial slot snapshot
RegisterOffset / widthValue
PCI Express Capabilities0x72 / 16 bits0x0162
Slot Capabilities0x84 / 32 bits0x002825DF
Slot Control0x88 / 16 bits0x17F8
Slot Status0x8A / 16 bits0x0048

0x0162 means Version=2, Type=6, and Slot Implemented=1. Slot Capabilities bits 0–4 indicate an Attention Button, Power Controller, MRL sensor, and both indicators. MRL means Manually-operated Retention Latch. Bit 6 declares Hot-Plug capability; bit 18=0 indicates Command Completed support. Bits 31:19 identify physical slot 5, not Device Number. Power Limit Value=75 and Scale=0 specify a 75 W limit, not measured consumption.

HPS bit 5=0, so this example demonstrates orderly operation. This bit alone does not classify every asynchronous-removal architecture: Base 6.0 deprecates the old HPS mechanism for async hot-plug and recommends DPC. SFI can also suppress the HPS read value.

DPC
Downstream Port Containment
Lookup route

§6.7/Table 6-7 (pp.727–728); Figure 7-23/Table 7-19 (pp.953–954) → Figures 7-30–7-32/Tables 7-27–7-29 (pp.980–986). HPS versus DPC: §6.7.6 (pp.741–742).

Separate current state, pending events, and notification

Slot Status=0x0048 has Presence Detect State bit 6 and Presence Detect Changed bit 3 set. One reports current presence; the other records a pending event. Further slot events of the same type are ignored until that pending event is cleared. A bit is therefore neither a counter nor a complete history.

Out-of-band detection detects insertion while main power is off in this example. Generally, with In-Band PD Disable=0, Presence is the OR of in-band and applicable out-of-band detection; in-band detection requires power. Presence=1 does not establish Link Active.

0x17F8 enables Presence Changed, Command Completed, DLL State Changed, and the Hot-Plug master interrupt enable. Recording an event is distinct from receiving an interrupt, which additionally depends on the selected INTx or MSI/MSI-X enable, vector, and routing conditions.

MSI
Message Signaled Interrupt
MSI-X
Message Signaled Interrupts Extension
Acknowledging events at separate times
Slot Status snapshotRW1C value written to 0x8AReadback without new events
0x0048: Presence Changed0x00080x0040
0x0050: Command Completed0x00100x0040
0x0140: DLL State Changed0x01000x0040

Preserve and process the evidence before writing 1 to selected RW1C bits. Presence is read-only. Recheck concurrent changes; do not indiscriminately perform a 32-bit read-modify-write across adjacent Control and Status.

Events and interrupts

§6.7.3.1, §6.7.3.4 (pp.735–737); Tables 7-28/7-29 (pp.983–986). Interrupt transport: Chapter 7.

Command completion does not authorize immediate enumeration

With the latch closed, sufficient power budget, and no previous command pending, the example writes Slot Control=0x12F8: Power On, Power Indicator Blink, Attention Indicator Off, with notification settings preserved. Any Slot Control write is a hot-plug command. Since Command Completed is supported, wait for the preceding command before another write. After one second without completion, the specification permits retrying or issuing the next command; this does not prove power succeeded.

Author-created insertion timeline
TimeEvidence or actionMeaning
0 msWrite Power OnStart the insertion power sequence.
20 msCommand CompletedThe controller can accept another command; the physical action need not be complete.
40 msLink Status=0x2043Data Link Layer Link Active reads 1.
140 msBegin Configuration Requests100 ms after observing Active; no early-readiness mechanism applies.

Power Controller Control readback is not a power measurement; faults can prevent power-up. After DLL State Changed, read Link Active before configuration access. The one-second DLL-change deadline starts at the Power On write here. Declaring an already-active device broken for not returning Successful Configuration Completions requires allowing at least one second from Active. These deadlines answer different questions.

Completion and wait conditions

§6.7.3.2–§6.7.3.3 (pp.735–736); Tables 7-28/7-29 (pp.984–986). Reset/readiness exceptions: §6.6.1 (pp.721–723) and Chapter 9.

Configuration access still requires usable resources afterward

Suppose only 0x80080000–0x800FFFFF remains available along the path: 0x80000 bytes, or 512 KiB. A new size-aligned BAR requiring 0x100000 bytes, or 1 MiB, cannot fit even if Configuration Requests succeed. Writing a BAR outside a Bridge Window does not automatically extend forwarding.

BAR
Base Address Register

Reserving Bus Numbers and address ranges can help. Reallocation depends on Host Bridge resources, every intervening window, and software coordination. This is an author-created system deduction, not a guarantee that every hot-added card fits. Chapters 3–4 cover enumeration and BAR calculation.

Allocation boundaries

PCI Firmware 3.3 §3.5 (pp.34–37), §4.3.2 (p.47); Chapter 4.

When is it safe to remove the card after pressing the button?

The Attention Button requests a hot-plug operation. When software accepts removal, it blinks the Power Indicator to acknowledge the request and allow cancellation. Software then coordinates device quiescence, powers the slot down and observes the required wait before allowing physical removal.

Simulated data: this teaching scenario does not represent a particular device or platform. Continue with Switch Downstream Port 02:01.0 controlling the slot and Endpoint 03:00.0 downstream. Assume insertion completed, the device is operating with a steady-on indicator, no power fault exists, and software owns hot-plug control. The manually operated retention latch remains closed until physical removal is permitted. An out-of-band presence mechanism keeps Presence Detect State at 1 while the card remains inserted, even after main power is off.

The earlier insertion snapshot had Attention Button Pressed Enable cleared. Here, software first sets that bit and Hot-Plug Interrupt Enable in 02:01.0 Slot Control and completes the command processing. The Port's interrupt mechanism is also correctly enabled. Follow the main path downward; the right branch cancels removal. Scroll horizontally on a narrow screen.

An accepted button request leads to removal only after cancellation, quiescence and power waitsFollow the main path downward. A second button press during the five-second interval takes the right branch and cancels removal. The main path proceeds only after software and device work is quiesced. The power indicator remains blinking until the power-off wait and removal conditions are satisfied.Record and clear the first button eventSoftware accepts the removal requestPower Indicator starts blinkingFive-second cancellation interval beginsNo cancellation: stop new workHandle outstanding work with the deviceIf quiescence fails, do not proceedRequest Power Off; keep the indicator blinkingFollow Command Completed sequencingWait at least 1 s after turning power offWhen removal conditions are satisfied,software turns Power Indicator OffUser removes the cardPresence changes from 1 to 0Second press within 5 sCancel removalKeep the card powered
Author-created normal-removal flow based on §6.7.1.5 and §6.7.1.8. The right branch cancels the operation; it does not rejoin the power-off path. The vertical spacing is not elapsed time.

Clear the first button event so a second press can be recorded

Figure 7-32 and Table 7-29 place Attention Button Pressed in Slot Status bit 0, with RW1C behavior: writing 1 clears the bit. Assume Slot Status reads 0x0041: presence and the button event are set, with all other bits zero. The example saves the event, then performs a 16-bit write of 0x0001 to 0x8A to clear only that event. Under §6.7.3.1, further events of the same type are ignored while one remains pending. Leaving the first press pending prevents a second press from producing a new event record.

Next, §6.7.1.5 starts the five-second abort interval when the Power Indicator begins blinking after software accepts the request. A second press during that interval cancels the operation. The cancellation branch in this example keeps device power on and restores the steady-on indicator under the command completion rules. The interval begins at the start of blinking, rather than at interrupt delivery or a later Status read.

After the cancellation interval, quiesce device work

This example starts quiescence after five seconds without cancellation: stop accepting new work and coordinate outstanding reads, writes, direct memory access (DMA) and interrupts with the driver and device. That scheduling is an author-created system flow. Queue shutdown, cancellation and data preservation depend on device and software documentation. If quiescence has not succeeded, remain at this step and keep removal prohibited.

DMA
Direct Memory Access, device access to memory

For example, clearing Bus Master Enable constrains subsequent relevant Requests from the Function. Earlier Memory Reads, Posted Writes already in the path, and application data still need their respective completion or preservation evidence. Slot Status alone does not provide those device and software guarantees.

Command completion does not end the power-off wait

Figure 7-31 and Table 7-28 define Power Controller Control=1 as the Power Off request. Power Indicator Control=10b keeps the indicator blinking. Both fields can be written in one Slot Control command, but the order of its actions is unspecified. The indicator is already blinking before this example requests power off.

This slot supports Command Completed, so §6.7.3.2 requires waiting for the preceding command to complete before issuing the next Slot Control command. Section 6.7.1.8 separately requires at least one second after turning power off before any action that relies on power removal. Software must not turn the Power Indicator off or attempt to turn power back on before that wait completes.Command Completed makes the controller ready for another command; the power-off wait still applies. Control readback reports the last written request, not a voltage measurement.

Once the power-off wait and applicable removal conditions are satisfied, software sets Power Indicator Control=11b to turn the indicator off. Table 6-9, Power Indicator States, gives the user-facing meaning: blinking means an operation is in progress and insertion or removal is prohibited; Off permits insertion or removal. Which supplies and signals must be removed depends on the slot's form-factor specification. Auxiliary power or other signals may remain present.

Card presence, main power and Link availability change at different stages of this example
ObservationPresence Detect StateMain power and Link in this examplePower Indicator and user action
Request accepted; coordination in progress1: card remains insertedPowered; Link availableBlinking; wait for the operation
Power-off wait and removal preparation complete; card not yet pulled1: out-of-band detection remains assertedMain power off; Link Active=0Off; release the latch and remove the card under the slot rules
Card removed and presence indication updated0; Presence Detect Changed recordedNo Link available for device operationOff; software handles subsequent slot events

The table describes known outcomes at successive stages of this scenario. A snapshot containing only Command Completed=1, Power Controller Control=1 and Presence Detect State=1 shows command-interface readiness, the last power-off request and detected card presence. The control-write and processing timeline is still needed to establish whether the power-off wait completed.

If the device disappears asynchronously, access may be lost before this coordination completes. Software must handle invalidated state and outstanding work. DPC can contain downstream error propagation; device and software evidence still determines application and data-preservation outcomes. See Chapter 12 for containment and recovery, rather than repeating the orderly button sequence.

DPC
Downstream Port Containment
Reading path: button, indicator, power-off wait and register fields

PCI Express Base Specification Revision 6.0: start with §6.7.1.5 Attention Button (PDF/printed p.731) for request acceptance and the five-second abort interval. Follow Table 6-9 Power Indicator States and §6.7.1.1.2 Power Indicator (pp.729–730) for On, Blinking and Off meanings, then §6.7.1.8 Power Controller (pp.731–732) for the one-second power-off wait. Event and command handling follows §6.7.3.1 Slot Events and §6.7.3.2 Command Completed Events (pp.735–736). Locate fields in Figure 7-31 Slot Control Register/Table 7-28 (pp.982–984) and Figure 7-32 Slot Status Register/Table 7-29 (pp.985–986): enables, indicator control, power control, RW1C and presence. PDF and printed page numbers are identical here. Removal models and containment retain §6.7, §6.7.6 and §6.2.11 (pp.727, 741–742, 694–697). Device quiescence and data preservation require device and software documentation.

Check the interpretation

Does Presence Changed=1 with Presence=0 mean no device was ever inserted?

No. A pending event and the current state do not reconstruct a complete history. Sources: §6.7.3.1, Table 7-29.

Do Command Completed and Power Fault contradict each other?

No. The command interface can accept another command without proving power succeeded. The fault still needs handling. Sources: Tables 7-28/7-29.

Jia-Chang

Jia-Chang

Human

Comments

  Write a comment ...