Skip to content

Instantly share code, notes, and snippets.

@mcastelino
Last active March 21, 2023 15:08
Show Gist options
  • Save mcastelino/534b2fd876e1bd097e54051a411647db to your computer and use it in GitHub Desktop.
Save mcastelino/534b2fd876e1bd097e54051a411647db to your computer and use it in GitHub Desktop.
Interrupt Remapping and posted interrupt notes

https://software.intel.com/sites/default/files/managed/c5/15/vt-directed-io-spec.pdf

• Legacy pin interrupts

— For devices that use legacy methods for interrupt routing (such as either through direct wiring to the I/OxAPIC input pins, or through INTx messages), the I/OxAPIC hardware generates the interrupt-request transaction. To identify the source of interrupt requests generated by I/OxAPICs, the interrupt-remapping hardware requires each I/OxAPIC in the platform (enumerated through the ACPI Multiple APIC Descriptor Tables (MADT)) to include a unique 16-bit source-id in its requests. BIOS reports the source-id for these I/OxAPICs via ACPI structures to system software. Refer to Section 8.3.1.1 for more details on I/OxAPIC identity reporting.

• Other Message Signaled Interrupts

— For any other platform devices that are not PCI discoverable and yet capable of generating message-signaled interrupt requests (such as the integrated High Precision Event Timer - HPET devices), the platform must assign unique source-ids that do not conflict with any other source-ids on the platform. BIOS must report the 16-bit source-id for these via ACPI structures described in Section 8.3.1.2.

8.3.1.2 Reporting Scope for MSI Capable HPET Timer Block

High Precision Event Timer (HPET) Timer Block supporting Message Signaled Interrupt (MSI) interrupts may generate interrupt requests directly to the Root-Complex (instead of routing through I/OxAPIC). Platforms supporting interrupt remapping must explicitly enumerate any MSI-capable HPET Timer Block in the platform through the Device Scope of the appropriate remapping hardware unit. In this case, the ‘Start Bus Number’ and ‘Path’ field in the Device Scope structure together provides the unique 16-bit source-id allocated by the platform for the MSI-capable HPET Timer Block.

https://github.com/torvalds/linux/blob/d7197a5ad8528642cb70f1d27d4d5c7332a2b395/arch/x86/kernel/acpi/boot.c#L895

For platforms reporting interrupt remapping capability (INTR_REMAP flag Set in the DMAR structure), each I/OxAPIC in the platform reported through ACPI MADT must be explicitly enumerated under the Device Scope of the appropriate remapping hardware units (even for remapping hardware unit reported with INCLUDE_PCI_ALL flag Set in DRHD structure).

• For I/OxAPICs that are PCI-discoverable, the source-id for such I/OxAPICs (computed using the above pseudocode from its Device Scope structure) must match its PCI requester-id effective at the time of boot.

• For I/OxAPICs that are not PCI-discoverable: — If the ‘Path’ field in Device Scope has a size of 2 bytes, the corresponding I/OxAPIC is a Root- Complex integrated device. The ‘Start Bus Number’ and ‘Path’ field in the Device Scope structure together provides the unique 16-bit source-id allocated by the platform for the I/OxAPIC. Examples are I/OxAPICs integrated to the IOH and south bridge (ICH) components.

— If the ‘Path’ field in Device Scope has a size greater than 2 bytes, the corresponding I/OxAPIC is behind some software visible PCI-PCI bridge. In this case, the ‘Start Bus Number’ and ‘Path’ field in the Device Scope structure together identifies the PCI-path to the I/OxAPIC device. Bus rebalancing actions by system software modifying bus assignments of the device’s parent bridge impacts the bus number portion of device’s source-id. Examples are I/OxAPICs in PCI Express-to-PCI-X bridge components in the platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment