Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Matters needing attention in using DMA

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Dirty data caused by DMA

When using DMA for data handling, when you need to stop the transmission of DMA halfway, you need to stop the dma request of the controller, then forcibly close DMA, and finally release memory, otherwise it may cause DMA to move data to the freed memory.

2. The influence of power saving on DMA.

After using DMA to transport data from ram to fifo, before releasing the power-saving lock, you should pay special attention to not only relying on the completion interrupt of DMA, the completion interrupt of DMA only means that DMA has moved all the data to the fifo of the peripheral, but not the code peripheral has finished the data transmission in fifo. FIFO must be added to determine whether there is data, otherwise power saving will lead to the loss of unfinished data in fifo.

3. The influence of Cache on DMA.

Before mem-- > dev transfer, you need to clean cache to ensure that the data in cache is transferred to the real RAM, and then start DMA;. After dev-- > mem transfer, you need invalid cache to ensure that each read data will be fetched from RAM again. (note: in A9 processor, the invalidate operation will only invalidate the current cacheline and there will be no other operations; in A53 processor, 32-bit or 64-bit mode, if the cacheline of invalidate is dirty, cache will automatically increase the clean operation before invalidate. ) cache consistency needs to be considered in the use of DMA, and it is possible to step on other people's space during cache consistency operation, so when applying for DMA space, you need to pay attention to cache line alignment between address and size.

4. The influence of MMU on DMA.

MMU completes the mapping between virtual address and physical address. Virtual address is visible to CPU but not visible to DMA. Physical address is invisible to CPU and visible to DMA. 1. When configuring DMA transport addresses, you need to pay attention to translating physical addresses into virtual addresses; the addresses from kmalloc on Linux are physically continuous and can be used by DMA after address translation, while the addresses from vmalloc are physically discontiguous and cannot be used by DMA even if translated.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report