Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112581
b: refs/heads/master
c: 49fbf4e
h: refs/heads/master
i:
  112579: 3ab0b62
v: v3
  • Loading branch information
FUJITA Tomonori authored and Ingo Molnar committed Sep 10, 2008
1 parent 11cc8cf commit 76a178f
Show file tree
Hide file tree
Showing 2 changed files with 7 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: ac4ff656c07ada78316307b0c0ce8a8eb48aa6dd
refs/heads/master: 49fbf4e9f982c704dc365698c5b5efa780aadcb5
10 changes: 6 additions & 4 deletions trunk/arch/x86/kernel/pci-nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
static int
check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
{
if (hwdev && bus + size > *hwdev->dma_mask) {
if (hwdev && !is_buffer_dma_capable(*hwdev->dma_mask, bus, size)) {
if (*hwdev->dma_mask >= DMA_32BIT_MASK)
printk(KERN_ERR
"nommu_%s: overflow %Lx+%zu of device mask %Lx\n",
Expand Down Expand Up @@ -79,6 +79,7 @@ nommu_alloc_coherent(struct device *hwdev, size_t size,
unsigned long dma_mask;
int node;
struct page *page;
dma_addr_t addr;

dma_mask = dma_alloc_coherent_mask(hwdev, gfp);

Expand All @@ -90,14 +91,15 @@ nommu_alloc_coherent(struct device *hwdev, size_t size,
if (!page)
return NULL;

if ((page_to_phys(page) + size > dma_mask) && !(gfp & GFP_DMA)) {
addr = page_to_phys(page);
if (!is_buffer_dma_capable(dma_mask, addr, size) && !(gfp & GFP_DMA)) {
free_pages((unsigned long)page_address(page), get_order(size));
gfp |= GFP_DMA;
goto again;
}

*dma_addr = page_to_phys(page);
if (check_addr("alloc_coherent", hwdev, *dma_addr, size)) {
if (check_addr("alloc_coherent", hwdev, addr, size)) {
*dma_addr = addr;
flush_write_buffers();
return page_address(page);
}
Expand Down

0 comments on commit 76a178f

Please sign in to comment.