Linux 零拷贝
我有一个 PCI 设备,需要从用户空间读取和写入。我正在尝试使用零拷贝;有没有一种方法可以完全在用户空间内分配、固定和获取用户空间地址的物理地址,或者我是否需要一个调用 virt_to_phys 或 get_user_pages 的内核模块?设备的内存通过 MMIO 映射到用户空间内存,因此我可以向其传递所需的任何数据。谢谢。
I have a PCI device that needs to read and write from userspace. I'm trying to use zero copy; is there a way to allocate, pin, and get the physical address of a userspace address completely within userspace or do I need to have a kernel module that, say, calls virt_to_phys or get_user_pages? The device's memory is mapped into userspace memory via MMIO so I can pass it any data that's needed. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这完全是一次黑客攻击,但我将 Linux 限制在一定范围内,并使用 MMIO 为我的设备分配内核不知道的内存。
It was a total hack, but I limited Linux to a range of memory and used MMIO to allocate memory for my device that the kernel was unaware of.
基本上你需要内存支持 DMA,据我所知只有内核模块可以做到这一点。请参阅http://lxr.free-electrons.com/源/Documentation/PCI/PCI-DMA-mapping.txt
Basically you need the memory to be DMA-able, and as far as I know only a kernel module can do that. See http://lxr.free-electrons.com/source/Documentation/PCI/PCI-DMA-mapping.txt