cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
1,285 Views
Registered: ‎04-06-2018

Petalinux design failed to dma_alloc_coherent

Jump to solution

Hello all,

I am trying to make a DMA Linux driver work, the axidmatest.c is working and an approach using the DMA registers from the user space is also working , but the driver seems to have a long way to go, which starts with failing to allocate. But I did enable CMA in the kernel configuration , even changing to 60MB , which you can see in my dmesg:

OF: fdt: Reserved memory: unsupported node format, ignoring
cma: dma_contiguous_reserve(limit ffffffff)
cma: dma_contiguous_reserve: reserving 60 MiB for global area
cma: cma_declare_contiguous(size 0x03c00000, base 0x00000000, limit 0xffffffff alignment 0x00000000)
cma: Reserved 60 MiB at 0x3c400000

it fails in the section of the code :

/* ask for the buffers and a descriptor chain */
    lp->bsize = (lp->buff_size * lp->buff_number) + (lp->buff_number * DESC_SIZE);
    /* try to alloc the buffer */
    lp->b_virt = dma_alloc_coherent(&pdev->dev, PAGE_ALIGN(lp->bsize),
                        &lp->b_phys, GFP_KERNEL);
    if (!lp->b_virt) {
         dev_err(&pdev->dev,
             "Buffer memory allocation failed\n");
        printk("Buffer memory allocation failed\n");
         rc = -ENOMEM;
        goto error3;
     }

can you guys see anything I am missing ? in the process of dma coherent allocation ?

Best Regards.

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
1,252 Views
Registered: ‎04-06-2018

at the end of the day , my problem was a difference in the name between my device tree file: compatible had a different name from the device driver.

but I also edited the device tree to increase the coherent_pool with :

chosen {
        bootargs = "console=ttyPS0,115200 earlyprintk coherent_pool=32MiB";
           };

View solution in original post

Tags (2)
0 Kudos
1 Reply
Highlighted
Contributor
Contributor
1,253 Views
Registered: ‎04-06-2018

at the end of the day , my problem was a difference in the name between my device tree file: compatible had a different name from the device driver.

but I also edited the device tree to increase the coherent_pool with :

chosen {
        bootargs = "console=ttyPS0,115200 earlyprintk coherent_pool=32MiB";
           };

View solution in original post

Tags (2)
0 Kudos