omap3isp buffer alignment
Hi Laurent,
If I understood your discussion with Russell [1] correctly, user pointer buffers are required to be page-aligned because of the IOMMU API, and it's desirable to keep the IOMMU driver that way for other subsystems which may use it. So we're stuck with user buffers needing to be page-aligned.
There's a check in ispvideo.c:isp_video_buffer_prepare() that the buffer address is 32-byte aligned. Isn't this superfluous considering the page-aligned restriction?
-Michael
[1]
http://www.mail-archive.com/linux-omap%40vger.kernel.org/msg50611.html
MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
Quoted 7 lines · Michael Jones
Hi Laurent,
If I understood your discussion with Russell [1] correctly, user pointer buffers are required to be page-aligned because of the IOMMU API, and it's desirable to keep the IOMMU driver that way for other subsystems which may use it. So we're stuck with user buffers needing to be page-aligned.
My understanding is that this is actually a hardware requirement. You only can map pages of 4 kiB (at least).
Quoted 3 lines
There's a check in ispvideo.c:isp_video_buffer_prepare() that the buffer address is 32-byte aligned. Isn't this superfluous considering the page-aligned restriction?
I guess the ISP driver isn't assuming that ispmmu_vmap always give page aligned mappings --- or that the page size couls theoretically be smaller. The assumptions might not hold in another implementation of the IOMMU API, which however will be replaced (hopefully at some point) by the improved DMA mapping API.
Cheers,
Signature · 2 lines
Sakari Ailus [email protected]
Quoted 11 lines · On Thursday 11 August 2011 23:21:45 Sakari Ailus wrote:
Quoted 7 lines · Michael Jones
Hi Laurent,
If I understood your discussion with Russell [1] correctly, user pointer buffers are required to be page-aligned because of the IOMMU API, and it's desirable to keep the IOMMU driver that way for other subsystems which may use it. So we're stuck with user buffers needing to be page-aligned.
My understanding is that this is actually a hardware requirement. You only can map pages of 4 kiB (at least).
The IOMMU works on a 4kiB page granularity, but that doesn't require buffers to be page-aligned. If the buffer start address isn't aligned on a page boundary the IOMMU can map the whole page, and the driver can then just add an offset to the virtual address.
Quoted 9 lines
Quoted 3 lines
There's a check in ispvideo.c:isp_video_buffer_prepare() that the buffer address is 32-byte aligned. Isn't this superfluous considering the page-aligned restriction?
I guess the ISP driver isn't assuming that
ispmmu_vmapalways give page aligned mappings --- or that the page size couls theoretically be smaller. The assumptions might not hold in another implementation of the IOMMU API, which however will be replaced (hopefully at some point) by the improved DMA mapping API.
Signature · 3 lines
Regards, Laurent Pinchart