Hi,
I write KMDF driver for a PCI-board for Windows 7 SP1 32-bit. I would like
to change CPU affinity for interrupt generated by the board. I have made
the following:
-
in AddDevice-callback after calling WdfInterruptCreate the driver calls
WdfInterruptSetPolicy with
Policy = WdfIrqPolicySpecifiedProcessors,
Priority = WdfIrqPriorityHigh,
TargetProcessorSet = 2
-
in EvtDeviceFilterAddResourceRequirements-callback the driver checks what
resources will be assigned to board and using DbgPrint outputs the
following:
Interrupt.AffinityPolicy = 4
Interrupt.TargetedProcessors = 2
Interrupt.Flags | CM_RESOURCE_INTERRUPT_POLICY_INCLUDED = 4
- but in EvtDevicePrepareHardware-callback I see that affinity changed to 3:
Interrupt level: 0xa, Vector: 0xb3, Affinity: 0x3
- and when I check that in EvtDeviceD0Entry-callback
using WdfInterruptGetInfo I get the following:
InterruptInfo:
TargetProcessorSet = 3
MessageNumber = 0
Vector = 179
Irql = 10
Mode = 0
Polarity = 0
ShareDisposition = 3
Group = 0
What I’m doing wrong? Why affinity changes to 3?
May be it’s not important but all interrupts on this Core2Duo system are
handled on CPU0 only.
Best regards,
Alex
You typically cannot request interrupt affinity of a PCI level-triggered interrupt (or PCIe legacy interrupt).
I have *never* understood how these affinity masks and priorities are supposed to work, and what their limitations are.
At some level, PCI interrupts are wired to interrupt controllers… the lines can be shrared, and there’s only such much you can do to change which devices interrupt which processors.
I’m sorry, I know that’s no help. But my point here is just to tell that, despite its seeming simplicity, you’re not asking a question that has an obvious answer.
Peter
OSR
@OSRDrivers
2015-02-05 21:03 GMT+03:00 :
> You typically cannot request interrupt affinity of a PCI level-triggered
> interrupt (or PCIe legacy interrupt).
>
Why? Is it Windows limitation? Is it somewhere documented?
2015-02-05 21:03 GMT+03:00 :
> You typically cannot request interrupt affinity of a PCI level-triggered
> interrupt (or PCIe legacy interrupt).
>
2015-02-06 2:35 GMT+03:00 :
>
>
> I have never understood how these affinity masks and priorities are
> supposed to work, and what their limitations are.
>
> At some level, PCI interrupts are wired to interrupt controllers… the
> lines can be shrared, and there’s only such much you can do to change which
> devices interrupt which processors.
>
> I’m sorry, I know that’s no help. But my point here is just to tell that,
> despite its seeming simplicity, you’re not asking a question that has an
> obvious answer.
>
> Peter
> OSR
> @OSRDrivers
>
>
Peter and Alex,
thank you for your answers - they led to the following explanations: such
interrupts are mostly shared with other devices. And it’s probably not good
if just one of them changes the properties of a shared resource.
When I have disabled in Device Manager all devices that used the same
interrupt as my PCI-board and restarted the driver - the affinity was
changed as expected.
Another method is using Interrupt Affinity Policy Tool: required affinity
mask should be specified for all devices sharing this interrupt.
Alex