5

This is in reference to this answer given to a similar dma/pci question. I gathered from this answer that the PC does not have a dma capable of transferring data to/from a PCI card, and that the PCI card must provide the dma capabilites. I have received similar answers from colleagues saying, "A two-way dma needs to be on the FPGA (referring to the PCI card) to enable burst transfers to/from cpu memory."

My understanding is that when the PC receives a read request, it needs to fulfill the read request by creating a return packet with the data requested. So, if the card requests a page of data (4096 bytes), the PC needs to return a packet with 4096 bytes. How does the card's dma reach across the bus and use it's dma to fill the needed packet as this answer suggests?

Community
  • 1
  • 1
tomcat
  • 219
  • 3
  • 9

1 Answers1

2

I think there might be a misunderstanding here. The card does not "reach across" the bus to use a DMA function in the PC.

The card itself is a bus master. It can directly read and write the entire memory of the PC, just like the CPU can. From the PC memory system point of view, there is no difference between the card or the main CPU in the PC. Both are bus masters. Both can perform reads and writes to memory.

Bursts of 4096 Bytes are not supported. You will have to split it up into multiple smaller bursts.

Timmy Brolin
  • 1,101
  • 1
  • 8
  • 18
  • How can the card read and write the entire memory of the PC, isn't that dependent on your hardware configuration? You are correct about bursts, I was getting confused with dma page size limitations. I will edit my question to reflect that. – tomcat Apr 23 '15 at 19:14
  • All PCIe cards have full access to the entire memory of the PC. They are bus masters, just like the main CPU itself. Bus masters can do whatever they want. It is not dependent on any system-side hardware configuration. This is in fact a known security problem as well. A specially designed PCI card can read and write the entire system, completely bypassing any password protection you may have. – Timmy Brolin Apr 23 '15 at 21:51
  • How much does this statement still valid nowadays? Isn't any protection on the dma coherent memory allocated by the device's driver? It seems very strange any PCIe card can read the whole memory with clear passwords and so on. – Alexis Apr 25 '20 at 13:13
  • Yes, there are hardware protection in modern computers. But for operating systems to use this protection requires a new compatibility breaking API towards device drivers. So enforcing it would break compatibility with tons of device drivers. Things are improving, but protection is still not in place everywhere. This is a rather well known security problem. – Timmy Brolin May 04 '20 at 10:56