I am using DMA streaming API in my PCIE device driver for DMA transfers.
We use pci_dma_sync_single_for_device and pci_dma_sync_single_for_cpu to handover the buffer to device and cpu respectively. We assume that this will ensure necessary cache invalidation and flushing as per the direction of transfer.
But we still see data corruption. I tried reducing the DMA buffer size and the occurrence of the problem got delayed by 1 day. It is clearly a cache invalidation/flusing issue.
Could you please let us know the correct API usage for the architecture?