Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145909
b: refs/heads/master
c: 53812c1
h: refs/heads/master
i:
  145907: 5797166
v: v3
  • Loading branch information
Joerg Roedel committed May 28, 2009
1 parent eec7fb5 commit 32cb8c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 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: 8bda3092bcfa68f786d94549ae026e8db1eff041
refs/heads/master: 53812c115cda1f660b286c939669154a56976f6b
20 changes: 18 additions & 2 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,8 @@ static dma_addr_t dma_ops_domain_map(struct amd_iommu *iommu,
paddr &= PAGE_MASK;

pte = dma_ops_get_pte(dom, address);
if (!pte)
return bad_dma_address;

__pte = paddr | IOMMU_PTE_P | IOMMU_PTE_FC;

Expand Down Expand Up @@ -1248,7 +1250,7 @@ static dma_addr_t __map_single(struct device *dev,
u64 dma_mask)
{
dma_addr_t offset = paddr & ~PAGE_MASK;
dma_addr_t address, start;
dma_addr_t address, start, ret;
unsigned int pages;
unsigned long align_mask = 0;
int i;
Expand All @@ -1271,7 +1273,10 @@ static dma_addr_t __map_single(struct device *dev,

start = address;
for (i = 0; i < pages; ++i) {
dma_ops_domain_map(iommu, dma_dom, start, paddr, dir);
ret = dma_ops_domain_map(iommu, dma_dom, start, paddr, dir);
if (ret == bad_dma_address)
goto out_unmap;

paddr += PAGE_SIZE;
start += PAGE_SIZE;
}
Expand All @@ -1287,6 +1292,17 @@ static dma_addr_t __map_single(struct device *dev,

out:
return address;

out_unmap:

for (--i; i >= 0; --i) {
start -= PAGE_SIZE;
dma_ops_domain_unmap(iommu, dma_dom, start);
}

dma_ops_free_addresses(dma_dom, address, pages);

return bad_dma_address;
}

/*
Expand Down

0 comments on commit 32cb8c4

Please sign in to comment.