Windows Driver Kit: Kernel-Mode Driver Architecture
Interrupt Affinity and Priority
The affinity of an interrupt is the set of processors that service that interrupt. Each device has an affinity policy: the system uses the affinity policy to compute the affinity for that device's interrupts. The priority of an interrupt determines the order in which the system services interrupts for different devices.
On Windows Vista and later operating systems, administrators can use the registry to set an affinity policy and priority for an interrupt.
Administrators can set the following entries under the \Interrupt Management\Affinity Policy registry key:
- DevicePolicy is a REG_DWORD value that specifies an affinity policy. Each possible setting corresponds to a IRQ_DEVICE_POLICY value.
- AssignmentSetOverride is a REG_BINARY value that specifies a KAFFINITY. If DevicePolicy is 0x04 (IrqPolicySpecifiedProcessors), the this specifies the set of processors to assign interrupts for.
- DevicePriority is a REG_DWORD value that specifies a priority. Each possible setting corresponds to a IRQ_PRIORITY value.
The following table lists the IRQ_DEVICE_POLICY values, and the corresponding registry setting for DevicePolicy. For more information about the meaning of each value, see IRQ_DEVICE_POLICY.
| IRQ_DEVICE_POLICY value | Numeric value in registry |
| IrqPolicyMachineDefault | 0x00 |
| IrqPolicyAllCloseProcessors | 0x01 |
| IrqPolicyOneCloseProcessor | 0x02 |
| IrqPolicyAllProcessorsInMachine | 0x03 |
| IrqPolicySpecifiedProcessors | 0x04 |
| IrqPolicySpreadMessagesAcrossAllProcessors | 0x05 |
The following table lists the IRQ_PRIORITY values, and the corresponding registry setting for DevicePriority. For more information about the meaning of each value, see IRQ_PRIORITY.
| IRQ_PRIORITY value | Numeric value in registry |
| IrqPriorityUndefined | 0x00 |
| IrqPriorityLow | 0x01 |
| IrqPriorityNormal | 0x02 |
| IrqPriorityHigh | 0x03 |
A driver's INF file can provide default settings for the registry values. Here is an example of how to set the DevicePolicy value to IrqPolicyOneCloseProcessor in the INF file. For more information, see INF AddReg Directive.
[install-section-name.HW]
AddReg=add-registry-section
[add-registry-section]
HKR, "Interrupt Management\Affinity Policy", DevicePolicy, 0x00010001, 2
The system makes the registry settings available to the device's driver when it sends the IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP to the driver. The system provides an IO_RESOURCE_DESCRIPTOR structure for each interrupt with the Type member set to CmResourceTypeInterrupt. For a message-based interrupt, the CM_RESOURCE_INTERRUPT_MESSAGE bit of the Flags member is set; otherwise, it is clear. The u.Interrupt member describes the settings for the interrupt.
The following table gives the correspondence between registry settings and members of u.Interrupt.
| Registry Value | Member of u.Interrupt |
| DevicePolicy | AffinityPolicy |
| AssignmentSetOverride | TargetedProcessors |
| DevicePriority | PriorityPolicy |