Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

How to decode MSI message address and data register

Ramakrishna_SaripalliRamakrishna_Saripalli Member Posts: 61

I have an NDIS miniport for a PCIe network card that supports MSi-X. Driver and interrupts work fine.

My question is on the format of the message address and data registers.
During IRP_MN_RESOURCE_REQUIREMENTS, my driver either accepts what is provided or increases the interrupt resources based on certain conditions.
Either way, for interrupt resource 0, my driver assigns CPU #0, interrupt resource 1 CPU #1 and so on and so forth.
During NdisMRegisterInterruptEx after it returns, when I dump the MessageInfo, entry 0 for example has MessageAddress the value of 0xfee035f0. I assume this maps to MSI-X entry 0

My question is as follows.

My driver gets an interrupt on CPU #52. I have a 2 socket system with 48 CPUs on each for a total of 96.
When I query the MSI-X table for this entry, I see message_addr value of 0xfee02f70 and message_data value of 0.
This matches what my device uses for sending the posted writes.

My question is how does the message_address of 0xfee02f70 map to CPU #52?.
If I decode message_addr from Intel's documentation, Intel's documentation says bits 12-19 (in this case 2) map to the CPU Id. I assume this is APIC ID 2.
How do I map this to CPU #52?.
Also, Intel's documentation says bits 4-11 are reserved (reserved means 0 I am assuming) but they are not 0 in my example above.

Further, message_data for this MSI-X entry has a value of 0. This means vector is 0 but Intel's documentation says to never program 0 into the vector.
this matches what my device uses for message_data in the posted write for the MSI.

here are the details of the interrupt assignment that is returned after NdisMRegisterInterruptEx for entry 52.
This command was run in the interrupt handler for CPU 52.

52: kd> ??message_info_table->MessageInfo[0x34]
struct _IO_INTERRUPT_MESSAGE_INFO_ENTRY
+0x000 MessageAddress : _LARGE_INTEGER 0xfee02f70
+0x008 TargetProcessorSet : 0x10000
+0x010 InterruptObject : 0xffffc00f`f861cc60 _KINTERRUPT
+0x018 MessageData : 0
+0x01c Vector : 0x70
+0x020 Irql : 0x7 ''
+0x024 Mode : 1 ( Latched )
+0x028 Polarity : 0 ( InterruptPolarityUnknown )

Am I decoding message_addr and message_data incorrectly?

I realize I should not really care about message_addr and message_data (In my case everything works fine but I am just curious why my decoding is not correct).

Thanks,
Rk

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online