mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-25 15:53:58 +00:00
ARM: dma-mapping: fix atomic allocation alignment
The alignment mask is calculated incorrectly. Fixing the calculation makes strange hangs/lockups disappear during the boot with Amstrad E3 and 3.6-rc1 kernel. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
This commit is contained in:
parent
39f78e7056
commit
e4ea6918c9
1 changed files with 3 additions and 3 deletions
|
@ -423,7 +423,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
|
||||||
unsigned int pageno;
|
unsigned int pageno;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
size_t align;
|
unsigned long align_mask;
|
||||||
|
|
||||||
if (!pool->vaddr) {
|
if (!pool->vaddr) {
|
||||||
WARN(1, "coherent pool not initialised!\n");
|
WARN(1, "coherent pool not initialised!\n");
|
||||||
|
@ -435,11 +435,11 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
|
||||||
* small, so align them to their order in pages, minimum is a page
|
* small, so align them to their order in pages, minimum is a page
|
||||||
* size. This helps reduce fragmentation of the DMA space.
|
* size. This helps reduce fragmentation of the DMA space.
|
||||||
*/
|
*/
|
||||||
align = PAGE_SIZE << get_order(size);
|
align_mask = (1 << get_order(size)) - 1;
|
||||||
|
|
||||||
spin_lock_irqsave(&pool->lock, flags);
|
spin_lock_irqsave(&pool->lock, flags);
|
||||||
pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages,
|
pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages,
|
||||||
0, count, (1 << align) - 1);
|
0, count, align_mask);
|
||||||
if (pageno < pool->nr_pages) {
|
if (pageno < pool->nr_pages) {
|
||||||
bitmap_set(pool->bitmap, pageno, count);
|
bitmap_set(pool->bitmap, pageno, count);
|
||||||
ptr = pool->vaddr + PAGE_SIZE * pageno;
|
ptr = pool->vaddr + PAGE_SIZE * pageno;
|
||||||
|
|
Loading…
Add table
Reference in a new issue