Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154789
b: refs/heads/master
c: f3a0a52
h: refs/heads/master
i:
  154787: b1b2152
v: v3
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 30, 2009
1 parent 976d6f7 commit d0fe3f7
Show file tree
Hide file tree
Showing 2 changed files with 18 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: 3d7b0e4154b4963d6bd39991ec8eaa09caeb3994
refs/heads/master: f3a0a52fff4dbfdea2dccc908d00c038481d888e
27 changes: 17 additions & 10 deletions trunk/drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,33 +797,40 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
unsigned long last_pfn)
{
int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
struct dma_pte *pte;
struct dma_pte *first_pte, *pte;
int total = agaw_to_level(domain->agaw);
int level;
unsigned long tmp;

BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width);
BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width);

/* we don't need lock here, nobody else touches the iova range */
/* We don't need lock here; nobody else touches the iova range */
level = 2;
while (level <= total) {
tmp = align_to_level(start_pfn, level);

/* Only clear this pte/pmd if we're asked to clear its
_whole_ range */
/* If we can't even clear one PTE at this level, we're done */
if (tmp + level_size(level) - 1 > last_pfn)
return;

while (tmp + level_size(level) - 1 <= last_pfn) {
pte = dma_pfn_level_pte(domain, tmp, level);
if (pte) {
free_pgtable_page(
phys_to_virt(dma_pte_addr(pte)));
first_pte = pte = dma_pfn_level_pte(domain, tmp, level);
if (!pte) {
tmp = align_to_level(tmp + 1, level + 1);
continue;
}
while (tmp + level_size(level) - 1 <= last_pfn &&
(unsigned long)pte >> VTD_PAGE_SHIFT ==
(unsigned long)first_pte >> VTD_PAGE_SHIFT) {
free_pgtable_page(phys_to_virt(dma_pte_addr(pte)));
dma_clear_pte(pte);
domain_flush_cache(domain, pte, sizeof(*pte));
pte++;
tmp += level_size(level);
}
tmp += level_size(level);
domain_flush_cache(domain, first_pte,
(void *)pte - (void *)first_pte);

}
level++;
}
Expand Down

0 comments on commit d0fe3f7

Please sign in to comment.