Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125616
b: refs/heads/master
c: c6229ca
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel committed Jan 3, 2009
1 parent 5cf5466 commit 0aacf22
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01106066a6900b518debe990ddaadf376d433bd6
refs/heads/master: c6229ca649aa9b312d1f1de20af8d2603b14eead
29 changes: 29 additions & 0 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1718,4 +1718,33 @@ static int amd_iommu_attach_device(struct iommu_domain *dom,
return 0;
}

static int amd_iommu_map_range(struct iommu_domain *dom,
unsigned long iova, phys_addr_t paddr,
size_t size, int iommu_prot)
{
struct protection_domain *domain = dom->priv;
unsigned long i, npages = iommu_num_pages(paddr, size, PAGE_SIZE);
int prot = 0;
int ret;

if (iommu_prot & IOMMU_READ)
prot |= IOMMU_PROT_IR;
if (iommu_prot & IOMMU_WRITE)
prot |= IOMMU_PROT_IW;

iova &= PAGE_MASK;
paddr &= PAGE_MASK;

for (i = 0; i < npages; ++i) {
ret = iommu_map_page(domain, iova, paddr, prot);
if (ret)
return ret;

iova += PAGE_SIZE;
paddr += PAGE_SIZE;
}

return 0;
}

#endif

0 comments on commit 0aacf22

Please sign in to comment.