-
Notifications
You must be signed in to change notification settings - Fork 169
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
Using "u-dma-buf" on x86 with IOMMU enabled #68
Comments
For completion: CONFIG_CMA=y CONFIG_CMA_DEBUGFS=y After trying "echo "create udmabuf1 0x9000" > /dev/u-dma-buf-mgr" "dmesg" shows [ 126.157968] u-dma-buf-mgr : create udmabuf1 36864 Best regards |
Thank you for the issue.
Yes. Unfortunately, u-dma-buf does not support IOMMU. |
I believe this is further complicated by the IOMMU presenting different address spaces to different devices, meaning the address for DMA needs to be translated to one that the specific device can use. |
summary from chatGPT void *cpu_addr; // for kernel access
dma_addr_t dma_addr; // for device access
unsigned long phys_addr; // for mmap to user-space
/* Allocate DMA-coherent memory */
cpu_addr = dma_alloc_coherent(dev, size, &dma_addr, GFP_KERNEL);
if (!cpu_addr) {
/* Error handling */
}
/* convert to phys addr */
phys_addr = virt_to_phys(cpu_addr);
then, user-space can mmap phys_addr to access dma buffer |
Hi!
First of all, I would like to thank you for your work.
However, I have a problem using "u-dma-buf" on an x86 system with IOMMU enabled.
If the option "VT-d" is activated in the BIOS, then the command "echo "create udmabuf1 0x9000" > /dev/u-dma-buf-mgr" always returns an error.
The reason is that the function "dma_alloc_coherent()" (used in "udmabuf_device_setup()") returns with the value "0".
If IOMMU is disabled in the Linux command line with "intel_iommu=off", then the buffer can be successfully created with the command "echo "create udmabuf1 0x9000" > /dev/u-dma-buf-mgr".
May the driver "u-dma-buf" only be used with deactivated IOMMU?
I would be very grateful for any advice!
Best regards
Jan-Marc.
The text was updated successfully, but these errors were encountered: