Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201481
b: refs/heads/master
c: 5bc23d3
h: refs/heads/master
i:
  201479: 4b34b57
v: v3
  • Loading branch information
Russell King committed Jul 27, 2010
1 parent 9dbca32 commit b952336
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d746196361c9c635128249bb6cf13e709ae6abe1
refs/heads/master: 5bc23d32d86a132b5636a48dca0fa2528ef69ff9
15 changes: 14 additions & 1 deletion trunk/arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,30 @@ static void *
__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
{
struct arm_vmregion *c;
size_t align;
int bit;

if (!consistent_pte[0]) {
printk(KERN_ERR "%s: not initialised\n", __func__);
dump_stack();
return NULL;
}

/*
* Align the virtual region allocation - maximum alignment is
* a section size, minimum is a page size. This helps reduce
* fragmentation of the DMA space, and also prevents allocations
* smaller than a section from crossing a section boundary.
*/
bit = fls(size - 1) + 1;
if (bit > SECTION_SHIFT)
bit = SECTION_SHIFT;
align = 1 << bit;

/*
* Allocate a virtual address in the consistent mapping region.
*/
c = arm_vmregion_alloc(&consistent_head, size,
c = arm_vmregion_alloc(&consistent_head, align, size,
gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
if (c) {
pte_t *pte;
Expand Down
5 changes: 3 additions & 2 deletions trunk/arch/arm/mm/vmregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
*/

struct arm_vmregion *
arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp)
arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align,
size_t size, gfp_t gfp)
{
unsigned long addr = head->vm_start, end = head->vm_end - size;
unsigned long flags;
Expand All @@ -58,7 +59,7 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp)
goto nospc;
if ((addr + size) <= c->vm_start)
goto found;
addr = c->vm_end;
addr = ALIGN(c->vm_end, align);
if (addr > end)
goto nospc;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/arm/mm/vmregion.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct arm_vmregion {
int vm_active;
};

struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, gfp_t);
struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, size_t, gfp_t);
struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long);
struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long);
void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *);
Expand Down

0 comments on commit b952336

Please sign in to comment.