Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125618
b: refs/heads/master
c: 645c4c8
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel committed Jan 3, 2009
1 parent 04f841d commit 161f788
Show file tree
Hide file tree
Showing 2 changed files with 32 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: eb74ff6cc0080c7f6270fdfffba65c4eff23d3ad
refs/heads/master: 645c4c8d7289a718c9c828ec217f2b94e3b3e6ff
31 changes: 31 additions & 0 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1788,4 +1788,35 @@ static void amd_iommu_unmap_range(struct iommu_domain *dom,
iommu_flush_domain(domain->id);
}

static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
unsigned long iova)
{
struct protection_domain *domain = dom->priv;
unsigned long offset = iova & ~PAGE_MASK;
phys_addr_t paddr;
u64 *pte;

pte = &domain->pt_root[IOMMU_PTE_L2_INDEX(iova)];

if (!IOMMU_PTE_PRESENT(*pte))
return 0;

pte = IOMMU_PTE_PAGE(*pte);
pte = &pte[IOMMU_PTE_L1_INDEX(iova)];

if (!IOMMU_PTE_PRESENT(*pte))
return 0;

pte = IOMMU_PTE_PAGE(*pte);
pte = &pte[IOMMU_PTE_L0_INDEX(iova)];

if (!IOMMU_PTE_PRESENT(*pte))
return 0;

paddr = *pte & IOMMU_PAGE_MASK;
paddr |= offset;

return paddr;
}

#endif

0 comments on commit 161f788

Please sign in to comment.