Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect use of DMA API #17

Open
patstew opened this issue Feb 19, 2019 · 1 comment
Open

Incorrect use of DMA API #17

patstew opened this issue Feb 19, 2019 · 1 comment
Assignees
Labels

Comments

@patstew
Copy link
Contributor

patstew commented Feb 19, 2019

I think the kernel module is technically using the DMA API incorrectly. dma_map_page and dma_map_single are supposed to be for 'streaming DMA' where you write to the buffer in userspace, then dma_map it, then hand it over to the device. Otherwise data in the CPU cache can be missed. I think dma_alloc_coherent is the correct thing to use in cases like this where the buffer contents are changed repeatedly. I suspect that x86_64 doesn't have a problem because the cache is coherent anyway, but it's a problem for me on 32-bit ARM. So it probably won't affect 99% of users, but I thought I'd report it in case anyone else has problems.
I've worked around it by using another memory allocation system I have on my platform.

@enfiskutensykkel
Copy link
Owner

enfiskutensykkel commented Feb 19, 2019

Yes, this is probably the case. I haven't tested properly on ARM, it's on my TODO list. I will look a bit more into this. Thank you for your observations and comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants