Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28738
b: refs/heads/master
c: 8eb6c6e
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Paul Mackerras committed Jun 9, 2006
1 parent 0be6b38 commit 24e6a0b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 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: 318facbee05417fb432603a8309a10cdb942a87b
refs/heads/master: 8eb6c6e3b9c8bfed3d75536ab142d7694627c2e5
14 changes: 8 additions & 6 deletions trunk/arch/powerpc/kernel/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,12 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
* to the dma address (mapping) of the first page.
*/
void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
dma_addr_t *dma_handle, unsigned long mask, gfp_t flag)
dma_addr_t *dma_handle, unsigned long mask, gfp_t flag, int node)
{
void *ret = NULL;
dma_addr_t mapping;
unsigned int npages, order;
struct page *page;

size = PAGE_ALIGN(size);
npages = size >> PAGE_SHIFT;
Expand All @@ -560,19 +561,20 @@ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
return NULL;

/* Alloc enough pages (and possibly more) */
ret = (void *)__get_free_pages(flag, order);
if (!ret)
page = alloc_pages_node(flag, order, node);
if (!page)
return NULL;
ret = page_address(page);
memset(ret, 0, size);

/* Set up tces to cover the allocated range */
mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL,
mask >> PAGE_SHIFT, order);
if (mapping == DMA_ERROR_CODE) {
free_pages((unsigned long)ret, order);
ret = NULL;
} else
*dma_handle = mapping;
return NULL;
}
*dma_handle = mapping;
return ret;
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/powerpc/kernel/pci_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
return iommu_alloc_coherent(device_to_table(hwdev), size, dma_handle,
device_to_mask(hwdev), flag);
device_to_mask(hwdev), flag,
pcibus_to_node(to_pci_dev(hwdev)->bus));
}

static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static void *vio_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size,
dma_handle, ~0ul, flag);
dma_handle, ~0ul, flag, -1);
}

static void vio_free_coherent(struct device *dev, size_t size,
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/asm-powerpc/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction);

extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
dma_addr_t *dma_handle, unsigned long mask, gfp_t flag);
dma_addr_t *dma_handle, unsigned long mask,
gfp_t flag, int node);
extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
void *vaddr, dma_addr_t dma_handle);
extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
Expand Down

0 comments on commit 24e6a0b

Please sign in to comment.