DMA remapping in Miniport driver

I have connected Intel Thunderbolt3 with NVMe device attached, but failed to load NVMe driver (Storport Miniport Driver). It fails to allocate memory using “StorPortGetUncachedExtension” api. I believe it is expecting DMA remapping since Thunderbolt is external adapter and Windows has add Kernel DMA protection. Any help will be appreciable for how to do DMA remapping in Storport Miniport driver.

I’m not sure how you got from a failure in StorPortGetUncachedExtension to a DMA problem. Thunderbolt 3 literally has 4 lanes of PCIe inside it. It looks exactly like PCIe. We have a PCIe telemetry board that transfers its data by DMA, and it just plugged-and-played in a Thunderbolt 3 PCIe dock. No driver changes were needed at all.

What operating system are you using? Thunderbolt 3 does hot-plug, and the PCIe hot-plug support in older Windows is problematic. Although the fact that the driver is getting loaded at all suggests that part is OK.

Tim_Roberts,
Thank you for your valuable comments, but as per the below link the driver must do DMA remapping for external devices(Thunderbolt3) when the kernel DMA protection is enabled. I am using Windows Build 10.0.17763.
https://docs.microsoft.com/en-us/windows/security/information-protection/kernel-dma-protection-for-thunderbolt

My driver is working fine when the NVMe device is connected to the system’s PCI slots/M.2 slot, but failed to load the driver when NVMe device is connected through Thunderbolt3. And I found the “StorPortGetUncachedExtension” is getting failed to allocate the memory in HWFindAdpater function.
As per the above link, the driver must be capable of DMA remapping and Microsoft NVMe inbox driver has added this feature and hence working fine.
I am not getting any clue, how to add the DMA remapping in Miniport driver, any help would be really appreciable.
Thanks

You shouldn’t have to do anything to support DMA remapping, aside from properly following the Windows/StorPort DMA model. There are no “extra steps” needed to support DMA remapping. A properly written StorPort Miniport will “just work”…

How do you setup your PORT_CONFIGURATION_INFORMATION structure?

Peter