Porting virt_to_bus to dma_map_single


I have to port an old kernel driver developed for 2.6.x
If contains the following 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)))) {
		pdma->ciobuf.maplist = NULL;
		return -ENOMEM;
	memset(pdma->sglist, 0, pdma->maxpages*entrysz);

	pdma->sgsize    = entrysz;
	pdma->sgbusaddr = virt_to_bus(pdma->sglist);

I think the last line should be converted to:

pdma->sgbusaddr = dma_map_single (&pdma->board->pdev->dev, pdma->sglist, pdma->maxpages*entrysz, DMA_FROM_DEVICE);

When I load the driver (insmod) I got a kernel oops:
Unable to handle kernel NULL pointer dereference at virtual address 00000028

Also tried to use: virt_to_physical (psma->sglist)
But when DMA started I got 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)

I searched google and found a thread here that talks about a patch in tegra_pcie_enable_pci

Is this patch still relevant ?
I’m using last version of JetPack for TX2: 3.3

Thank you in advance,