JunningWu / Learning-NVDLA-Notes

NVDLA is an Open source DL/ML accelerator, which is very suitable for individuals or college students. This is the NOTES when I learn and try. Hope THIS PAGE may Helps you a bit. Contact Me:junning.wu@ia.ac.cn
221 stars 66 forks source link

DMA_MEMORY_MAP #11

Open JunningWu opened 6 years ago

JunningWu commented 6 years ago
int
577     dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
578                     dma_addr_t device_addr, size_t size, int
579                     flags)
580 
581 Declare region of memory to be handed out by dma_alloc_coherent() when
582 it's asked for coherent memory for this device.
583 
584 phys_addr is the CPU physical address to which the memory is currently
585 assigned (this will be ioremapped so the CPU can access the region).
586 
587 device_addr is the DMA address the device needs to be programmed
588 with to actually address this memory (this will be handed out as the
589 dma_addr_t in dma_alloc_coherent()).
590 
591 size is the size of the area (must be multiples of PAGE_SIZE).
592 
593 flags can be ORed together and are:
594 
595 - DMA_MEMORY_EXCLUSIVE - only allocate memory from the declared regions.
596   Do not allow dma_alloc_coherent() to fall back to system memory when
597   it's out of memory in the declared region.
598 
599 As a simplification for the platforms, only *one* such region of
600 memory may be declared per device.
601 
602 For reasons of efficiency, most platforms choose to track the declared
603 region only at the granularity of a page.  For smaller allocations,
604 you should use the dma_pool() API.