Hello,
I'm working with 4.4.38 installed on NVIDIA's TX2.
This an ARM architecture.
The SMMU is enabled.
The SBC receives data with DMA from a PCIe endpoint.
Can I use: dma_alloc_coherent to get contiguous physical buffer ?
Or should I use another DMA API ?
The original code is:
Code:
memset(&pdma->cioque, 0, sizeof(struct gefspa_ioque_t));
memset(&pdma->ciobuf, 0, sizeof(struct gefspa_iobuf_t));
if (NULL == (pdma->ciobuf.maplist = (struct page **) kmalloc(pdma->maxpages * sizeof(struct page*), GFP_KERNEL))) {
return -ENOMEM;
}
memset(pdma->ciobuf.maplist, 0, pdma->maxpages * sizeof(struct page*));
if(NULL == (pdma->sglist = (void*) __get_dma_pages(GFP_KERNEL, __get_order(pdma->maxpages*entrysz)))) {
kfree(pdma->ciobuf.maplist);
pdma->ciobuf.maplist = NULL;
return -ENOMEM;
}
memset(pdma->sglist, 0, pdma->maxpages*entrysz);
pdma->sgsize = entrysz;
pdma->sgbusaddr = virt_to_phys(pdma->sglist);
But virt_to_phys cause the following kernel oops:
[ 3368.052470] arm-smmu 12000000.iommu: Unhandled context fault: iova=0xea9e8000, fsynr=0x1, cb=22, sid=17(0x11 - AFI), pgd=0, pud=0, pmd=0, pte=0
[ 3368.313623] irq 55: nobody cared (try booting with the "irqpoll" option)
Thank you,
Zvika