ikwzm / udmabuf

User space mappable dma buffer device driver for Linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regarding Manual cache management with the CPU cache still being enabled

balaji-ch opened this issue · comments

Do we need to call
fd = open("/sys/class/u-dma-buf/udmabuf0/sync_for_device", O_WRONLY)) != -1)
once before mmap ? or any special care need to be taken for manual cache management ?

Thank you for the issue.

Do we need to call
fd = open("/sys/class/u-dma-buf/udmabuf0/sync_for_device", O_WRONLY)) != -1)
once before mmap ?

there is no need.
It's the same whether you open the file before mmap() or after mmap().

or any special care need to be taken for manual cache management ?

Knowledge of general CPU Cache and Linux Kernel is required.

But here in this example
https://github.com/ikwzm/ZynqMP-FPGA-Linux-Example-2-UltraZed/blob/master/negative.py
udmabuf4.sync_for_device()
udmabuf5.sync_for_device()
is called in the for loop ?

In this example, sync_for_device()/sync_for_cpu() is inside the loop because it runs multiple times to calculate the average time it takes to process it.