On Fri, Aug 24, 2012 at 11:55:43PM +0800, Haojian Zhuang wrote:
On Fri, Aug 24, 2012 at 4:57 PM, Russell King - ARM Linux linux@arm.linux.org.uk wrote:
So yet again folk abuse this stuff...
Look at how arm_memblock_steal() works, and note that we DO NOT leave blocks allocated(reserved) but removed from the system memory. To have reserved areas listed without system memory is a bug.
Plus you're supposed to take 1MB at a time, not a page at a time.
Even I added memblock_free(), it doesn't change the result that linear address mapping doesn't exist. It results dmac_xxx() flush fails.
Exactly, because those functions are only designed to be used on _system_ _memory_ - those which have a valid struct page associated with them, and which can be assured of virt_to_phys/phys_to_virt() (or more exactly, the kmap interfaces working) on those pages.
That is not the case with memory which is not under the control of the kernels memory management.
So you're really asking the impossible of the kernel.
If you need this memory to have struct pages, and you don't have the ARMv7 mapping aliasing problem to worry about, there is absolutely no no need what so ever to take them out of the system memory map with memblock_remove().
If you leave them in the block of memory which the kernel believes there to be RAM, yes you can't use ioremap() on it, but you can kmap it, and you can also use DMA with it too - because it will be just like every other bit of normal system memory. It just won't be freed into the memory allocator pools because you have it reserved.
You could also use vmap() on a list of struct pages to map it too.
Can the camera hardware support capturing to scatterlist? Does it have it's own MMU or can the DMA be programmed with a linked-list of pages to operate on?
If there's an IOMMU in silicon, we can make use of scatterlist. But there's no such device in low-end silicons.
Welcome to why "low-end" cut corners cause major problems, some of which are extremely difficult to solve, and some which are even not worth solving. :)
You're really getting into that territory here - you're asking the system for two things simultaneously which aren't compatible with each other.