Running into problems with UDMABUF

Paul Cercueil paul at crapouillou.net
Tue Nov 22 18:32:04 UTC 2022


Hi Gerd,

I'm running into a problem trying to use UDMABUF and I'm not sure if 
it's a bug in udmabuf, or I'm just using it wrong.

I create a UDMABUF in userspace, enable CPU access to it, copy some 
data, disable CPU access, then register it with the IIO subsystem using 
an ioctl I'm working on (not yet upstream).

In udmabuf.c, the "get_sg_table" function is first called by the 
"begin_cpu_udmabuf", and then called a second time by "map_udmabuf" 
when the IIO subsystem creates a dma_buf_attachment then maps it.

Now the behaviour I'm seeing, is that the first call to 
"dma_map_sgtable" in get_sg_table sets sg->nents == 1 which is equal to 
sg_nents(sg->sgl) and as such is the expected value, but the second 
call to "dma_map_sgtable" will set sg->nents == 0 and I don't 
understand why.

I wonder if you are seeing this behaviour as well?

Cheers,
-Paul




More information about the dri-devel mailing list