Message Signaled Interrupts

Last updated

Message Signaled Interrupts (MSI) are a method of signaling interrupts, using special in-band messages to replace traditional out-of-band signals on dedicated interrupt lines. While message signaled interrupts are more complex to implement in a device, they have some significant advantages over pin-based out-of-band interrupt signalling, such as improved interrupt handling performance. This is in contrast to traditional interrupt mechanisms, such as the legacy interrupt request (IRQ) system.

Contents

Message signaled interrupts are supported in PCI bus since its version 2.2, and in later available PCI Express bus. Some non-PCI architectures also use message signaled interrupts.

Overview

Traditionally, a device has an interrupt line (pin) which it asserts when it wants to signal an interrupt to the host processing environment. This traditional form of interrupt signalling is an out-of-band form of control signalling since it uses a dedicated path to send such control information, separately from the main data path. MSI replaces those dedicated interrupt lines with in-band signalling, by exchanging special messages that indicate interrupts through the main data path. In particular, MSI allows the device to write a small amount of interrupt-describing data to a special memory-mapped I/O address, and the chipset then delivers the corresponding interrupt to a processor. [1] [2] [3]

A common misconception with MSI is that it allows the device to send data to a processor as part of the interrupt. The data that is sent as part of the memory write transaction is used by the chipset to determine which interrupt to trigger on which processor; that data is not available for the device to communicate additional information to the interrupt handler. [1] [2] [3]

As an example, PCI Express does not have separate interrupt pins at all; instead, it uses special in-band messages to allow pin assertion or deassertion to be emulated. Some non-PCI architectures also use MSI; as another example, HP GSC devices do not have interrupt pins and can generate interrupts only by writing directly to the processor's interrupt register in memory space.[ citation needed ] The HyperTransport protocol also supports MSI. [4]

Advantages

While more complex to implement in a device, message signalled interrupts have some significant advantages over pin-based out-of-band interrupt signalling. On the mechanical side, fewer pins makes for a simpler, cheaper, and more reliable connector. While this is no advantage to the standard PCI connector, PCI Express takes advantage of these savings.

MSI increases the number of interrupts that are possible. While conventional PCI was limited to four interrupts per card (and, because they were shared among all cards, most are using only one), message signalled interrupts allow dozens of interrupts per card, when that is useful. [1]

There is also a slight performance advantage. In software, a pin-based interrupt could race with a posted write to memory. That is, the PCI device would write data to memory and then send an interrupt to indicate the DMA write was complete. However, a PCI bridge or memory controller might buffer the write in order to not interfere with some other memory use. The interrupt could arrive before the DMA write was complete, and the processor could read stale data from memory. [5] To prevent this race, interrupt handlers were required to read from the device to ensure that the DMA write had finished. This read had a moderate performance penalty. An MSI write cannot pass a DMA write, so the race is eliminated. [6]

MSI types

PCI defines two optional extensions to support Message Signalled Interrupts, MSI and MSI-X. PCI Express defines its own message-based mechanism to emulate legacy PCI interrupts.

MSI

MSI (first defined in PCI 2.2) permits a device to allocate 1, 2, 4, 8, 16 or 32 interrupts. The device is programmed with an address to write to (this address is generally a control register in an interrupt controller), and a 16-bit data word to identify it. The interrupt number is added to the data word to identify the interrupt. [1] Some platforms such as Windows do not use all 32 interrupts but only use up to 16 interrupts. [7]

MSI-X

MSI-X (first defined in PCI 3.0) permits a device to allocate up to 2048 interrupts. The single address used by original MSI was found to be restrictive for some architectures. In particular, it made it difficult to target individual interrupts to different processors, which is helpful in some high-speed networking applications. MSI-X allows a larger number of interrupts and gives each one a separate target address and data word. Devices with MSI-X do not necessarily support 2048 interrupts. [3] [8] [9] [10]

Optional features in MSI (64-bit addressing and interrupt masking) are also mandatory with MSI-X.

PCI Express legacy interrupt emulation

PCI Express does not have physical interrupt pins, but emulates the 4 physical interrupt pins of PCI via dedicated PCI Express Messages such as Assert_INTA and Deassert_INTC. Being message-based (at the PCI Express layer), this mechanism provides some, but not all, of the advantages of the PCI layer MSI mechanism: the 4 virtual pins per device are no longer shared on the bus (although PCI Express controllers may still combine legacy interrupts internally), and interrupt changes no longer inherently suffer from race conditions.

PCI Express permits devices to use these legacy interrupt messages, retaining software compatibility with PCI drivers, but they are required to also support MSI or MSI-X in the PCI layer.

x86 systems

On Intel systems, the LAPIC must be enabled for the PCI (and PCI Express) MSI/MSI-X to work, even on uniprocessor (single core) systems. [11] [12] In these systems, MSIs are handled by writing the interrupt vector directly into the LAPIC of the processor/core that needs to service the interrupt. The Intel LAPICs of 2009 supported up to 224 MSI-based interrupts. [12] According to a 2009 Intel benchmark using Linux, using MSI reduced the latency of interrupts by a factor of almost three when compared to I/O APIC delivery. [13]

Operating system support

In the Microsoft family of operating systems, Windows Vista and later versions have support for both MSI and MSI-X. Support was added in the Longhorn development cycle around 2004. [14] MSI is not supported in earlier versions like Windows XP or Windows Server 2003. [15]

Solaris Express 6/05 released in 2005 added support for MSI an MSI-X as part of their new device driver interface (DDI) interrupt framework. [16]

FreeBSD 6.3 and 7.0 released in 2008 added support for MSI and MSI-X. [17]

OpenBSD 5.0 released in 2011 added support for MSI. [18] 6.0 added support for MSI-X. [19]

Linux gained support for MSI and MSI-X around 2003. [20] Linux kernel versions before 2.6.20 are known to have serious bugs and limitations in their implementation of MSI/MSI-X. [21]

Haiku gained support for MSI around 2010. [22] MSI-X support was added later, in 2013. [23]

NetBSD 8.0 released in 2018 added support for MSI and MSI-X.

VxWorks 7 supports MSI and MSI-X

See also

Related Research Articles

<span class="mw-page-title-main">Accelerated Graphics Port</span> Expansion bus standard

Accelerated Graphics Port (AGP) is a parallel expansion card standard, designed for attaching a video card to a computer system to assist in the acceleration of 3D computer graphics. It was originally designed as a successor to PCI-type connections for video cards. Since 2004, AGP was progressively phased out in favor of PCI Express (PCIe), which is serial, as opposed to parallel; by mid-2008, PCI Express cards dominated the market and only a few AGP models were available, with GPU manufacturers and add-in board partners eventually dropping support for the interface in favor of PCI Express.

<span class="mw-page-title-main">Industry Standard Architecture</span> Internal expansion bus in early PC compatibles

Industry Standard Architecture (ISA) is the 16-bit internal bus of IBM PC/AT and similar computers based on the Intel 80286 and its immediate successors during the 1980s. The bus was (largely) backward compatible with the 8-bit bus of the 8088-based IBM PC, including the IBM PC/XT as well as IBM PC compatibles.

<span class="mw-page-title-main">Peripheral Component Interconnect</span> Local computer bus for attaching hardware devices

Peripheral Component Interconnect (PCI) is a local computer bus for attaching hardware devices in a computer and is part of the PCI Local Bus standard. The PCI bus supports the functions found on a processor bus but in a standardized format that is independent of any given processor's native bus. Devices connected to the PCI bus appear to a bus master to be connected directly to its own bus and are assigned addresses in the processor's address space. It is a parallel bus, synchronous to a single bus clock. Attached devices can take either the form of an integrated circuit fitted onto the motherboard or an expansion card that fits into a slot. The PCI Local Bus was first implemented in IBM PC compatibles, where it displaced the combination of several slow Industry Standard Architecture (ISA) slots and one fast VESA Local Bus (VLB) slot as the bus configuration. It has subsequently been adopted for other computer types. Typical PCI cards used in PCs include: network cards, sound cards, modems, extra ports such as Universal Serial Bus (USB) or serial, TV tuner cards and hard disk drive host adapters. PCI video cards replaced ISA and VLB cards until rising bandwidth needs outgrew the abilities of PCI. The preferred interface for video cards then became Accelerated Graphics Port (AGP), a superset of PCI, before giving way to PCI Express.

Direct memory access (DMA) is a feature of computer systems that allows certain hardware subsystems to access main system memory independently of the central processing unit (CPU).

<span class="mw-page-title-main">I²C</span> Serial communication bus

I2C (Inter-Integrated Circuit; pronounced as “eye-squared-see” or “eye-two-see”), alternatively known as I2C or IIC, is a synchronous, multi-controller/multi-target (historically-termed as master/slave), single-ended, serial communication bus invented in 1982 by Philips Semiconductors. It is widely used for attaching lower-speed peripheral ICs to processors and microcontrollers in short-distance, intra-board communication.

<span class="mw-page-title-main">PCI Express</span> Computer expansion bus standard

PCI Express, officially abbreviated as PCIe or PCI-e, is a high-speed serial computer expansion bus standard, designed to replace the older PCI, PCI-X and AGP bus standards. It is the common motherboard interface for personal computers' graphics cards, sound cards, hard disk drive host adapters, SSDs, Wi-Fi and Ethernet hardware connections. PCIe has numerous improvements over the older standards, including higher maximum system bus throughput, lower I/O pin count and smaller physical footprint, better performance scaling for bus devices, a more detailed error detection and reporting mechanism, and native hot-swap functionality. More recent revisions of the PCIe standard provide hardware support for I/O virtualization.

<span class="mw-page-title-main">PCI-X</span> Computer bus and expansion card standard

PCI-X, short for Peripheral Component Interconnect eXtended, is a computer bus and expansion card standard that enhances the 32-bit PCI local bus for higher bandwidth demanded mostly by servers and workstations. It uses a modified protocol to support higher clock speeds, but is otherwise similar in electrical implementation. PCI-X 2.0 added speeds up to 533 MHz, with a reduction in electrical signal levels.

x86 virtualization is the use of hardware-assisted virtualization capabilities on an x86/x86-64 CPU.

PCI configuration space is the underlying way that the Conventional PCI, PCI-X and PCI Express perform auto configuration of the cards inserted into their bus.

<span class="mw-page-title-main">Low Pin Count</span> Low-bandwidth computer motherboard bus

The Low Pin Count (LPC) bus is a computer bus used on IBM-compatible personal computers to connect low-bandwidth devices to the CPU, such as the BIOS ROM, "legacy" I/O devices, and Trusted Platform Module (TPM). "Legacy" I/O devices usually include serial and parallel ports, PS/2 keyboard, PS/2 mouse, and floppy disk controller.

In computing, serial presence detect (SPD) is a standardized way to automatically access information about a memory module. Earlier 72-pin SIMMs included five pins that provided five bits of parallel presence detect (PPD) data, but the 168-pin DIMM standard changed to a serial presence detect to encode more information.

In a computer, an interrupt request is a hardware signal sent to the processor that temporarily stops a running program and allows a special program, an interrupt handler, to run instead. Hardware interrupts are used to handle events such as receiving data from a modem or network card, key presses, or mouse movements.

In computing, Intel's Advanced Programmable Interrupt Controller (APIC) is a family of programmable interrupt controllers. As its name suggests, the APIC is more advanced than Intel's 8259 Programmable Interrupt Controller (PIC), particularly enabling the construction of multiprocessor systems. It is one of several architectural designs intended to solve interrupt routing efficiency issues in multiprocessor computer systems.

<span class="mw-page-title-main">Input–output memory management unit</span> Configuration in computing

In computing, an input–output memory management unit (IOMMU) is a memory management unit (MMU) connecting a direct-memory-access–capable (DMA-capable) I/O bus to the main memory. Like a traditional MMU, which translates CPU-visible virtual addresses to physical addresses, the IOMMU maps device-visible virtual addresses to physical addresses. Some units also provide memory protection from faulty or malicious devices.

The graphics address remapping table (GART), also known as the graphics aperture remapping table, or graphics translation table (GTT), is an I/O memory management unit (IOMMU) used by Accelerated Graphics Port (AGP) and PCI Express (PCIe) graphics cards. The GART allows the graphics card direct memory access (DMA) to the host system memory, through which buffers of textures, polygon meshes and other data are loaded. AMD later reused the same mechanism for I/O virtualization with other peripherals including disk controllers and network adapters.

<span class="mw-page-title-main">USB 3.0</span> Third major version of the Universal Serial Bus standard

Universal Serial Bus 3.0, marketed as SuperSpeed USB, is the third major version of the Universal Serial Bus (USB) standard for interfacing computers and electronic devices. It was released in November 2008. The USB 3.0 specification defined a new architecture and protocol, named SuperSpeed, which included a new lane for a new signal coding scheme providing full-duplex data transfers that physically required five additional wires and pins, while preserving the USB 2.0 architecture and protocols and therefore keeping the original four pins and wires for the USB 2.0 backward-compatibility, resulting in nine wires in total and nine or ten pins at connector interfaces. The new transfer rate, marketed as SuperSpeed USB (SS), can transfer signals at up to 5 Gbit/s with nominal data rate of 500 MB/s after encoding overhead, which is about 10 times faster than High-Speed. USB 3.0 Type-A and B connectors are usually blue, to distinguish them from USB 2.0 connectors, as recommended by the specification. and by the initials SS.

NVM Express (NVMe) or Non-Volatile Memory Host Controller Interface Specification (NVMHCIS) is an open, logical-device interface specification for accessing a computer's non-volatile storage media usually attached via the PCI Express bus. The initial NVM stands for non-volatile memory, which is often NAND flash memory that comes in several physical form factors, including solid-state drives (SSDs), PCIe add-in cards, and M.2 cards, the successor to mSATA cards. NVM Express, as a logical-device interface, has been designed to capitalize on the low latency and internal parallelism of solid-state storage devices.

A DMA attack is a type of side channel attack in computer security, in which an attacker can penetrate a computer or other device, by exploiting the presence of high-speed expansion ports that permit direct memory access (DMA).

<span class="mw-page-title-main">M.2</span> Standard for miniature computer expansion cards

M.2, pronounced m dot two and formerly known as the Next Generation Form Factor (NGFF), is a specification for internally mounted computer expansion cards and associated connectors. M.2 replaces the Mini-SATA (mSATA) standard, which uses the PCI Express Mini Card physical card layout and connectors. Employing a more flexible physical specification, M.2 allows different module widths and lengths, which, paired with the availability of more advanced interfacing features, makes M.2 more suitable than mSATA in general for solid-state storage applications, particularly in smaller devices such as ultrabooks and tablets.

References

  1. 1 2 3 4 PCI Local Bus Specification Revision 2.2. PCI-SIG. December 1998.{{cite book}}: |work= ignored (help)
  2. 1 2 PCI Local Bus Specification Revision 2.3. PCI-SIG. 2002.{{cite book}}: |work= ignored (help)
  3. 1 2 3 PCI Local Bus Specification Revision 3.0. PCI-SIG. August 2002.{{cite book}}: |work= ignored (help)
  4. Don Anderson; Jay Trodden (2003). HyperTransport System Architecture. Addison-Wesley Professional. p. 200. ISBN   978-0-321-16845-0.
  5. Coleman, James (2009). "Overview of Interrupt Delivery Methods, Legacy XT-PIC Interrupts, XT-PIC Limitations". Reducing Interrupt Latency Through the Use of Message Signalled Interrupts (PDF). Intel Corporation. p. 10.
  6. Corbet, Jonathan; Rubini, Alessandro; Kroah-Hartman, Greg (2009). "Chapter 15: Memory Mapping and DMA". Linux Device Drivers (3rd ed.). O'Reilly Media. Retrieved 2019-04-20.
  7. Microsoft. "Enabling Message-Signalled Interrupts in the Registry". Microsoft Corporation. Retrieved 12 April 2013.
  8. "Section 6.1: MSI & MSI-X". PCI Express Base Specification Revision 1.0a. PCI-SIG. April 2003.
  9. "Section 6.1: MSI & MSI-X". PCI Express Base Specification Revision 1.1. PCI-SIG. March 2005.
  10. "MSI-X Engineering Change Notice". PCI Local Bus Specification Revision 2.3 (PDF). PCI-SIG.
  11. APIC-Based Interrupt Subsystems on Uniprocessor PCs
  12. 1 2 Coleman, James (2009). Reducing Interrupt Latency Through the Use of Message Signalled Interrupts (PDF). Intel Corporation. pp. 10, 11.
  13. Coleman, James (2009). "Results, Workstation Class Platform". Reducing Interrupt Latency Through the Use of Message Signalled Interrupts (PDF). Intel Corporation. p. 19.
  14. Interrupt Architecture Enhancements in Microsoft Windows Vista, Aug 11, 2004
  15. PCI, PCI-X, and PCI Express: Frequently Asked Questions, November 18, 2005, page 4
  16. John Stearns, Govinda Tatti, Edward Gillett and Anish Gupta, (March 27, 2006) Changes made to support MSI in Solaris Express Advanced Interrupt Handlers in the Solaris Express 6/05 OS
  17. John H. Baldwin, "PCI Interrupts for x86 Machines under FreeBSD", "availability" section
  18. Mark Kettenis, (May 2011) MSI interrupts for many devices, on those architectures which can support them (amd64, i386, sparc64 only so far)
  19. Mark Kettenis, (May 2016) Initial support for MSI-X has been added
  20. MSI-HOWTO.txt first version
  21. With Myri10GE, can I use MSI-X interrupts on Linux 2.6.18 and earlier?
  22. Haiku commit adding MSI support
  23. Haiku commit adding MSI-X support