Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
    • Reset Semantics
    • Reset Sequencing Across Interfaces
    • Presence and Hot-Plug
    • Link Training
    • Capability Negotiation
    • Enumeration and Discovery
    • Link State Machines
    • Versioning and Compatibility
    • Protocols Compared: Bring-Up and Link Management
    • Drills: Bring-Up and Link Management
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 11: Bring-Up and Link Management
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 11: Bring-Up and Link Management
  4. Presence and Hot-Plug

Part 11 · Bring-Up and Link Management · Working (W)

Presence and Hot-Plug

Before talking, a side must know the other exists; while talking, it must survive the other disappearing. Presence detection, orderly and surprise removal, and what the protocol and software must do to keep the rest of the system running.

On this page

    Note

    Level: Working (W) · Answers: How do the two sides agree at start-up?

    Before this: Reset Sequencing Across Interfaces

    Someone unplugs an external drive while it is being written. The host's next write goes to a link that no longer has anything at the other end. On a well-designed system, the operating system reports "device removed", fails the outstanding I/O, and carries on. On a badly designed one, a request waits for ever, and the machine freezes. The cable was the only thing that changed.

    How does each side know the other is there, and what must happen when it suddenly is not?

    The obvious answer, and why it breaks

    The obvious assumption is that the other side is always there: it is soldered on, or it was there at boot. For fixed connections that is true; for anything with a connector or a separate power domain it is not. A protocol that assumes presence has no defined behaviour when the partner vanishes, and "undefined" usually means a hang (lesson 9.9).

    The idea: detect presence, handle absence

    Event

    Detected by

    What must happen

    Arrival

    A presence-detect pin, a receiver detecting a termination, or a link that trains

    Train the link (lesson 11.4), negotiate capabilities (11.5), enumerate (11.6), then start traffic

    Orderly removal

    A request from the user or software (a button, an eject command)

    Quiesce: stop new requests, drain outstanding ones (lesson 12.5), then power down and release

    Surprise removal

    Presence lost, or the link drops unexpectedly

    Mark the device gone at once; complete every outstanding request with an error; release its resources; let software recover

    Flowchart. If the partner is not present, wait and drive inactive. If present, train the link, negotiate and enumerate, then go active with traffic flowing. On removal: an orderly one stops new requests, drains and powers down; a surprise one marks the device gone, fails outstanding requests with errors and frees resources. Both return to waiting.
    Arrival leads through training and enumeration to traffic; an orderly removal drains first; a surprise removal fails everything outstanding at once so nothing waits for ever.

    What surprise removal demands of a design

    • Every outstanding request must end: with a completion timeout at least, ideally completed with an error as soon as the link is known to be down.

    • Accesses after removal must fail fast: a read from a removed device should return an error (often all 1s, with an error logged) rather than hang.

    • State tied to the device must be freed: tags, credits, buffers and translation entries.

    • Software must tolerate it: drivers must expect errors and all-1s data at any time on removable devices.

    How real protocols chose

    Protocol

    Presence and hot-plug

    PCI Express

    Hot-plug slots report presence detect and may support surprise removal. System software marks surprise-removed devices disconnected so further accesses fail rather than wait; orderly removal quiesces the device first.

    USB

    Built for hot-plug: the host detects attach and detach on each port and enumerates new devices (lesson 11.6).

    On-chip interfaces to switchable power domains

    A powered-down partner is effectively absent; isolation logic drives safe values, and requests to it are blocked or answered with errors.

    What breaks

    The opening freeze (illustrative): the storage driver issued a read just as the drive was pulled; the read's completion never came, and the driver had disabled completion timeouts for performance. With timeouts enabled, and the hot-plug controller failing outstanding requests on link-down, the same removal produced an error message and a clean recovery.

    Why this matters

    Senior lens. For every interface whose partner can disappear (connectors, power domains, removable modules), define arrival, orderly removal and surprise removal, and make sure surprise removal completes every outstanding request with an error and frees every resource. Test it by removing the partner in the middle of heavy traffic, repeatedly; that is the test that finds the hang.

    Interview

    Asked: "How does a host notice a device was unplugged?"

    Weak answer: The device tells it.

    Strong answer: The device can't, it's gone. The host notices through presence detection on the slot, the link dropping out of its active state, or, as a last resort, requests timing out. A good design then treats it as surprise removal: marks the device disconnected so new accesses fail at once instead of waiting, completes outstanding requests with errors, frees tags, credits and buffers, and tells the driver. Orderly removal is different: software asks first, the device is quiesced and drained, then powered down.

    Follow-ups: (1) What should a read to a removed device return? (2) Why must outstanding requests be failed immediately?

    Check yourself What is the difference between orderly and surprise removal from the protocol's point of view?

    Orderly removal lets the system stop and drain traffic first; surprise removal leaves requests in flight that must be completed with errors.

    Check yourself Why is a powered-down block similar to an unplugged device?

    It cannot answer requests; unless something blocks or answers them, requests to it hang, exactly as with a removed device.

    Key takeaways

    • A side must detect its partner's presence before talking and survive its disappearance while talking.

    • Orderly removal quiesces and drains; surprise removal must fail every outstanding request with an error at once.

    • Free all state tied to a removed device and make drivers tolerate errors at any time.

    Keep going

    Next: Lesson 11.4, Link Training. Lock, align, equalise: why a fast link must train before it can carry data.

    Related topics

    • Part 11 overview: Bring-Up and Link Management

    Previous

    164 / 234

    Next: Link Training

    Up next

    Up nextLink Training

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Reset Semantics
    • Capability Negotiation
    • Enumeration and Discovery