Protect windows from DMA to illegal RAM area

Hello,

The FPGA is initiating DMA to contiguous buffer (AllocateContinuousPhysicalMemory in attached Init.txt)
The driver writes physical address and size to registers in FPGA in order to initiate the DMA.

Due to a firmware error, after a while the data is written to an area outside the pre-allocated buffer.
If this happens, the PC hangs or we have a blue screen with a message (each time different message)
Is it possible to protect windows some how from such case ?
The goal is to catch the moment that FPGA is trying to do such thing.

Thank you,
Zvika

No. How would you do that? And what purpose would it serve? Even if you knew when it happened, what could you do about it? You can’t stop the FPGA.

If you think it’s just writing one page to many, you can of course allocate the common buffer a bit larger. If it’s writing a random address, then there is absolutely nothing you can do except fix the hardware.

VT-d and similar tech actually can do this. But it requires hardware assist to protect dma operations. Generally only used for virtualized IO.
https://software.intel.com/content/www/us/en/develop/articles/intel-virtualization-technology-for-directed-io-vt-d-enhancing-intel-platforms-for-efficient-virtualization-of-io-devices.html#:~:text=I%2FO%20performance%20through%20direct,amount%20of%20I%2FO%20performance.

Mr. Roddy is correct. The IOMMU (what Windows calls DMA Remapping) can do this. But it requires OS-level support. And so, Mr. Roberts answer is the ultimate answer. Fix the firmware.

Peter

Hi Tim, Mark, Peter,

Thank you very much !

Best regards,
Zvika

So does OS level support for IOMMU exist outside of virtual machines context? If yes, in which version?

  • pa

Yes, it does. Windows 1803.

Peter

Can IOMMU eliminate need for bounce buffers?
That’s, if a device supports only 32 bit memory space, can it be mapped directly to the 64-bit system RAM with IOMMU “mapping registers”?
I’ve started reading on the Intel VT-d (not finished yet) and got a hunch that it won’t do this?

– pa