Missing MSI interrupts

Hello,

I’m writing WDM driver and I’m having difficulties with getting message signaled interrupts to work.
Interrupt is sent from Xilinx SoC on PCIe card. I register my ISR like this:

RtlZeroMemory( &IntParams, sizeof( IO_CONNECT_INTERRUPT_PARAMETERS ) );

IntParams.Version = CONNECT_MESSAGE_BASED;
IntParams.MessageBased.ConnectionContext.Generic = &DevExt->InterruptConnectionContext;
IntParams.MessageBased.PhysicalDeviceObject = DevExt->PhysicalDeviceObject;
IntParams.MessageBased.MessageServiceRoutine = Card_MessageSignaledISR;
IntParams.MessageBased.ServiceContext = DeviceObject;
IntParams.MessageBased.SpinLock = NULL;
IntParams.MessageBased.SynchronizeIrql = 0;
IntParams.MessageBased.FloatingSave = FALSE;
IntParams.MessageBased.FallBackServiceRoutine = Card_InterruptServiceRoutine;

Status = IoConnectInterruptEx( &IntParams );

This is called when driver receives IRP_MN_START_DEVICE. IoConntectInterruptEx returns STATUS_SUCCESS but
my ISR never gets called.
Also, I enable MSI in .inf file like this:

HKR,“Interrupt Management”,0x00000010
HKR,“Interrupt Management\MessageSignaledInterruptProperties”,0x00000010
HKR,“Interrupt Management\MessageSignaledInterruptProperties”,MSISupported,0x00010001,1
HKR,“Interrupt Management\MessageSignaledInterruptProperties”,MessageNumberLimit,0x00010001,1

It is worth mentioning that I’m sure that SoC actually triggers interrupt since I wrote
Linux driver for it and it successfully receives it. Any idea what could be wrong with my code?

Thanks in advance.

xxxxx@gmail.com wrote:

I’m writing WDM driver…

Why? There are very, very few good reasons for writing a WDM driver
today. KMDF is unarguably better, and it handles the message-based
stuff for you.

RtlZeroMemory( &IntParams, sizeof( IO_CONNECT_INTERRUPT_PARAMETERS ) );

IntParams.Version = CONNECT_MESSAGE_BASED;
IntParams.MessageBased.ConnectionContext.Generic = &DevExt->InterruptConnectionContext;
IntParams.MessageBased.PhysicalDeviceObject = DevExt->PhysicalDeviceObject;
IntParams.MessageBased.MessageServiceRoutine = Card_MessageSignaledISR;
IntParams.MessageBased.ServiceContext = DeviceObject;
IntParams.MessageBased.SpinLock = NULL;
IntParams.MessageBased.SynchronizeIrql = 0;
IntParams.MessageBased.FloatingSave = FALSE;
IntParams.MessageBased.FallBackServiceRoutine = Card_InterruptServiceRoutine;

Status = IoConnectInterruptEx( &IntParams );

What is the value of IntParams.Version when you return? Are you getting
a CmResourceTypeInterrupt in your AllocatedResourcesTranslated structure?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

The reason is that I wanted to learn in depth about Windows drivers.
I finally managed to solve my problem so I’ll share it here and perhaps someone will find it useful.

The value of IntParams.Version was CONNECT_MESSAGE_BASED after return and I was getting a CmResourceTypeInterrupt so that wasn’t the problem. I also checked MessageAddress and MessageData fields from IO_INTERRUPT_MESSAGE_INFO_ENTRY and those values seemed valid.
Device Manager also showed in Resources tab that my driver has negative IRQ which indicates MSI…
But then I used !devext command in debugger and it said something like:

“Interrupt requirement: 1, Type - MSI
Interrupt resources: ”

and that was strange. Turns out I forgot to pass the IRP in StartDevice to a lower level driver and wait for it to complete and then return STATUS_MORE_PROCESSING_REQUIRED. After I did that my driver started working.

Thanks for answering Tim.

Your “fix” is exactly the reason no sane person would write a hardware
driver in WDM. KMDF takes care of this level of detail for you. Your
argument of learning Windows drivers in depth is invalid.

Don Burn
Windows Driver Consulting
Website: http://www.windrvr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, April 26, 2017 5:23 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Missing MSI interrupts

The reason is that I wanted to learn in depth about Windows drivers.
I finally managed to solve my problem so I’ll share it here and perhaps
someone will find it useful.

The value of IntParams.Version was CONNECT_MESSAGE_BASED after return and I
was getting a CmResourceTypeInterrupt so that wasn’t the problem. I also
checked MessageAddress and MessageData fields from
IO_INTERRUPT_MESSAGE_INFO_ENTRY and those values seemed valid.
Device Manager also showed in Resources tab that my driver has negative IRQ
which indicates MSI…
But then I used !devext command in debugger and it said something like:

“Interrupt requirement: 1, Type - MSI
Interrupt resources: ”

and that was strange. Turns out I forgot to pass the IRP in StartDevice to a
lower level driver and wait for it to complete and then return
STATUS_MORE_PROCESSING_REQUIRED. After I did that my driver started working.

Thanks for answering Tim.


NTDEV is sponsored by OSR

Visit the list online at:
http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software
drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at
http:</http:></http:></http:>

Actually, it reminds me of a classical Russian XVIII -century comedy where the main character
questions the need for learning the geography - according to him, there is no need for it because cab drivers are going to take you to the target destination anyway, and, hence,learning the geography is not the right thing for a nobleman…

Anton Bassov

Anton Bassov wrote

Actually, it reminds me of a classical Russian XVIII -century comedy where the
main character
questions the need for learning the geography - according to him, there is no
need for it because cab drivers are going to take you to the target destination
anyway,

But as it appears today, that was kinda prophesy. Russians can claim they invented self-navigating vehicles long before Google. And smart ovens too :wink:
Wait a little and Visual Studio will code for you…

– pa