Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 313641
b: refs/heads/master
c: 0e4bc95
h: refs/heads/master
i:
  313639: 263b836
v: v3
  • Loading branch information
Anton Blanchard authored and Benjamin Herrenschmidt committed Jul 3, 2012
1 parent 0329830 commit 070f876
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 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: c1703e85a7b20ffcefd5360e2542460737ecc15c
refs/heads/master: 0e4bc95d87394364f408627067238453830bdbf3
15 changes: 5 additions & 10 deletions trunk/arch/powerpc/kernel/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,11 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
int build_fail;

spin_lock_irqsave(&(tbl->it_lock), flags);

entry = iommu_range_alloc(dev, tbl, npages, NULL, mask, align_order);
spin_unlock_irqrestore(&(tbl->it_lock), flags);

if (unlikely(entry == DMA_ERROR_CODE)) {
spin_unlock_irqrestore(&(tbl->it_lock), flags);
if (unlikely(entry == DMA_ERROR_CODE))
return DMA_ERROR_CODE;
}

entry += tbl->it_offset; /* Offset into real TCE table */
ret = entry << IOMMU_PAGE_SHIFT; /* Set the return dma address */
Expand All @@ -192,18 +190,17 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
* not altered.
*/
if (unlikely(build_fail)) {
spin_lock_irqsave(&(tbl->it_lock), flags);
__iommu_free(tbl, ret, npages);

spin_unlock_irqrestore(&(tbl->it_lock), flags);

return DMA_ERROR_CODE;
}

/* Flush/invalidate TLB caches if necessary */
if (ppc_md.tce_flush)
ppc_md.tce_flush(tbl);

spin_unlock_irqrestore(&(tbl->it_lock), flags);

/* Make sure updates are seen by hardware */
mb();

Expand Down Expand Up @@ -244,17 +241,15 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
unsigned long flags;

spin_lock_irqsave(&(tbl->it_lock), flags);

__iommu_free(tbl, dma_addr, npages);
spin_unlock_irqrestore(&(tbl->it_lock), flags);

/* Make sure TLB cache is flushed if the HW needs it. We do
* not do an mb() here on purpose, it is not needed on any of
* the current platforms.
*/
if (ppc_md.tce_flush)
ppc_md.tce_flush(tbl);

spin_unlock_irqrestore(&(tbl->it_lock), flags);
}

int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
Expand Down

0 comments on commit 070f876

Please sign in to comment.