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

Home NTDEV

Before Posting...

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

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/


Not Getting Enough MSIx vectors

ajitabhsajitabhs Member Posts: 67

Hi Guys,
I have written a KMDF driver which needs at least three MSIx vectors and can handle up to Max of 32 MSIx vectors. If the driver gets anything less than three vectors, it cannot operate and returns error from "PrepareHardware" Callback. I have tested the driver under QEMU and it works great.

I tried the driver with actual hardware (FPGA) on another machine and for some reason the "PrepareHardware" always gets called with 1 interrupt resource and with only one MSIx message.
I looked at the registry to make sure that the INF file add registry directive is actually creating the MSIx registry entries. I could see that the registry entries are created under

 Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\PCI\VEN_XXXX&DEV_XXXX&SUBSYS_XXXXXXXX&REV_00\4&36daf17&0&0010\Device Parameters\Interrupt 
  Management\MessageSignaledInterruptProperties

and the entries created are

    MessageNumberLimit                REG_DWORD      0x20 (32)
    MSISupported                      REG_DWORD      0x01

The machine that I am testing the driver on is a intel XEON based machine with Windows 10 Enterprise (640-bit).

Any pointers to debug this problem further are highly appreciated.

Thanks
AJ.

Comments

  • msrmsr Member Posts: 363

    Assuming all else correct, you get one of below in windows
    1) All requested MSI-X vectors (should be power of 2)
    2) 1 MSI-x
    3) 1 Line interrupt

    Driver is supposed to work with any of above given config.

    Try #vectors 4 to see if it helps.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,986

    Check the Full set of Capability structures, also.

    Also, I like to check the requested resources by DbgPrint’ing the resource list(s) at the pre Prepare Hardware callbacks (like Query Resource RequirementsQuery Resource Requirements.

    Maybe one of those will help you understand what’s going on.

    Be certain you’re requesting MSI-X resources, and not MSI resources. You should be able to get 32 MSI-X resources, but you’re very unlikely to get 32 MSI resources.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • ajitabhsajitabhs Member Posts: 67

    I figured it out. The device was not requesting the correct resources. The PCIe configuration was not setup properly.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,986

    There you go. Examining the capabilities will show that.

    Another mystery solved.

    Thanks for getting back to us to let us know.

    Peter Viscarola
    OSR
    @OSRDrivers

  • ajitabhsajitabhs Member Posts: 67

    Thanks for the help @Peter_Viscarola_(OSR) and everyone else , I have been a long long time poster on this list, though disappeared for a few years in between, and I always believed the community created by OSR is nothing short of a blessing for all the windows kernel developers. Its amazing what you guys have done and achieved.
    -Aj

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online