Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154764
b: refs/heads/master
c: 90dcfb5
h: refs/heads/master
v: v3
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 29, 2009
1 parent 754afc3 commit 9b31904
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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: 77dfa56c94d2855a25ff552b74980a5538e129f8
refs/heads/master: 90dcfb5eb2fd427b16135a14f176a6902750b6b4
12 changes: 7 additions & 5 deletions trunk/drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,16 +740,17 @@ static struct dma_pte * addr_to_dma_pte(struct dmar_domain *domain, u64 addr)
}

/* return address's pte at specific level */
static struct dma_pte *dma_addr_level_pte(struct dmar_domain *domain, u64 addr,
int level)
static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain,
unsigned long pfn,
int level)
{
struct dma_pte *parent, *pte = NULL;
int total = agaw_to_level(domain->agaw);
int offset;

parent = domain->pgd;
while (level <= total) {
offset = pfn_level_offset(addr >> VTD_PAGE_SHIFT, total);
offset = pfn_level_offset(pfn, total);
pte = &parent[offset];
if (level == total)
return pte;
Expand All @@ -768,7 +769,7 @@ static void dma_pte_clear_one(struct dmar_domain *domain, u64 addr)
struct dma_pte *pte = NULL;

/* get last level pte */
pte = dma_addr_level_pte(domain, addr, 1);
pte = dma_pfn_level_pte(domain, addr >> VTD_PAGE_SHIFT, 1);

if (pte) {
dma_clear_pte(pte);
Expand Down Expand Up @@ -817,7 +818,8 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
return;

while (tmp < end) {
pte = dma_addr_level_pte(domain, tmp, level);
pte = dma_pfn_level_pte(domain, tmp >> VTD_PAGE_SHIFT,
level);
if (pte) {
free_pgtable_page(
phys_to_virt(dma_pte_addr(pte)));
Expand Down

0 comments on commit 9b31904

Please sign in to comment.