PCIe Chapter 7: From Device Events to Interrupt Service
Simulated data: Addresses, values and events are created for teaching and do not represent a particular device or platform.
- MSI-X
- Message Signaled Interrupts Extension
The MSI-X interrupt mechanism connects a device event to software service. System software locates and programs the notification table, then enables delivery. The device interface supplies the event contents and counts when software handles the notification.
- MSI-X
- Message Signaled Interrupts Extension
Full Chinese tutorial · Course roadmap · 繁體中文
Reading route: Figure 7-56 locates the Capability fields; Figures 7-60–7-62 identify table capacity, control, and placement; Figure 7-57 describes each entry; §6.1.4.5 explains masked events.
Interrupt mechanisms and their configuration
INTx (legacy level-interrupt emulation) uses Assert_INTx/Deassert_INTx Messages. MSI (Message Signaled Interrupts, notification by memory write) and MSI-X write a system-specified DWORD (four bytes) to a system-specified address, using a Memory Write (MWr) transaction, without an ordinary Completion response. Msg/MsgD are Message packet types without/with data used by the INTx level-emulation mechanism. Interrupt-generating Functions must support MSI, MSI-X, or both; INTx is optional compatibility support. MSI and MSI-X must not be enabled simultaneously, and neither permits INTx service requests while enabled.
A separate MSI memory-write notification example has ID=0x05 and Message Control=0x0184: Multiple Message Capable (MMC)=010b requests four vectors, Multiple Message Enable (MME)=000b, and MSI is disabled. It supports 64-bit Address and Per-Vector Masking (PVM, individual vector masks) but not Extended Message Data. System software may allocate two vectors with MME (allocated vector count)=001b while MSI is disabled, complete configuration, and enable it. MSI supports up to 32 vectors with power-of-two encoding; MSI-X Table Size uses N−1.
Mechanisms and MSI lookup
§6.1–§6.1.4.4 (pp.659–664); Figures 7-44–7-47 (pp.1011–1012), Figure 7-49/Table 7-41 (pp.1013–1014). An ordinary PCI Express Endpoint implementing MSI must support 64-bit Message Address. This separate MSI example does not add an MSI Capability to the main example.
Find the Memory Space table through the Capability
| Offset and width | Value | Decoded meaning |
|---|---|---|
| 0xD0, 16 bits | 0x0011 | ID=0x11, Next=0. |
| 0xD2, 16 bits | 0x0007 | Eight entries; Enable=0, Function Mask=0. |
| 0xD4, 32 bits | 0x00002000 | Table BIR (BAR selection)=0, offset 0x2000. |
| 0xD8, 32 bits | 0x00003000 | PBA (Pending Bit Array) BIR (BAR selection)=0, offset 0x3000. |
- BAR
- Base Address Register
The low three BAR Indicator Register (BIR, BAR selection) bits select the BAR. BIR selects the register that supplies the table base. Masking them leaves the byte offset, without another left shift. Table base=0x80006000; its 8 × 16 bytes occupy 0x80006000–0x8000607F. The Pending Bit Array (PBA, one waiting-message bit per entry) base=0x80007000; its one required QWORD (eight bytes) occupies 0x80007000–0x80007007. Both fit within BAR0 without overlap. The example places ordinary Registers and MSI-X structures in separate naturally aligned 4 KiB regions.
Entry 3 is the fourth entry, starting at 0x80006000 + 3 × 16 = 0x80006030. Offsets +0x00, +0x04, +0x08, and +0x0C hold Message Address, Upper Address, Data, and Vector Control. Example values are 0xFEE01000, 0x00000000, 0x00000045, and initially 0x00000001. Preserve other Vector Control bits and clear Mask only at the appropriate point.
The entry address differs from the interrupt destination. The device ultimately writes 0x00000045 to platform-assigned 0xFEE01000 with all four bytes enabled, without modifying low Data bits. The value 0x45 is not a Table index; this example defines no CPU number or interrupt-controller encoding for it. Relaxed Ordering (RO) and No Snoop, which affect ordering and cache snooping, must be clear.
Stepwise reading route
Figure 7-56 (p.1018) → Figure 7-60/Table 7-49 (p.1022) → Figures 7-61/7-62, Tables 7-50/7-51 (pp.1023–1024) → Figures 7-57/7-58 (p.1019), Equations 7-1/7-2 (p.1021) → Tables 7-52–7-55 (pp.1024–1026). Page isolation: p.1020; message attributes: p.661. A 64-bit BAR's BIR must identify its lower DWORD.
Control notification before unmasking the entry
The authored initialization starts with inactive event sources. System software sets Function Mask, reading Control=0x4007; fills valid Address/Data with entry Mask=1; enables MSI-X while keeping Function Mask set, reading 0xC007; ensures configuration visibility under platform I/O rules; then clears entry 3 Mask and Function Mask, finally reading 0x8007. Other entries remain masked, and work starts only after the notification path is ready.
This is not the only valid sequence. System software manages MSI/MSI-X Message Control read/write (RW) fields; the specification prohibits device drivers from directly modifying them. Table/PBA accesses must use aligned full DWORDs (four bytes) or QWORDs (eight bytes). Address, Data, and applicable Steering Tags must not change in an unmasked entry. To mask a currently unmasked entry, first update Vector Control with a DWORD write, without simultaneously changing Data and Mask using a QWORD.
Required conditions
§6.1.4.2–§6.1.4.5 (pp.662–665); access alignment: p.1020; control ownership: pp.1013, 1022; Reserved preservation: Table 7-55 (p.1026). Function Mask does not alter individual Mask bits.
Pending records a waiting message, not an event count
With MSI-X enabled and entry 3 effectively masked, an event that would require notification must set PBA bit 3 without sending that message. If all other bits are clear, the QWORD reads 0x0000000000000008; repeated events may leave the same value. Unmasking while the event remains pending requires scheduling the message and clearing Pending after transmission. If the underlying event is satisfied while still masked, Pending must clear to avoid an unnecessary notification.
Software should only read Pending bits; writes have undefined results and are not read/write-one-to-clear (RW1C). PBA=0 also does not mean CPU service is complete. Repeated messages for one vector are not guaranteed individual service; event counting and handshakes belong to the device interface.
The example's data writes and MSI-X share one Function and TC0 (Traffic Class 0), so the interrupt write cannot pass earlier Posted writes. The system must let its interrupt handler observe updates arriving before the message, without a device-register read to flush those writes. Chapter 6's mapping and synchronization conditions still apply. Different TCs require additional synchronization. Message arrival order guarantees neither service order nor fixed latency.
Pending and ordering sources
§6.1.4.5–§6.1.4.7 (pp.664–667); Table 7-56 (p.1027). Cross-TC synchronization: p.661; latency: p.660. Reading device status to identify sources sharing a vector serves a different purpose from the data flush discussed above.
Follow the notification path
How does table capacity relate to configured vectors?
Table Size gives capacity. System software may allocate fewer vectors or assign one Address/Data pair to multiple entries.
How do the two masks control delivery?
Function Mask=1 treats all entries as masked without rewriting their individual Mask bits.
The existing Chapter 8 covers Link establishment and reliable delivery. Verified 2026-10-21; citations use Base 6.0 document/PDF pages.


Comments