Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264417
b: refs/heads/master
c: 4399c8b
h: refs/heads/master
i:
  264415: c538b90
v: v3
  • Loading branch information
Allen Kay authored and David Woodhouse committed Oct 19, 2011
1 parent 9aeaeaa commit 898a506
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 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: 8140a95d228efbcd64d84150e794761a32463947
refs/heads/master: 4399c8bf2b9093696fa8160d79712e7346989c46
17 changes: 8 additions & 9 deletions trunk/drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ static inline bool dma_pte_present(struct dma_pte *pte)
return (pte->val & 3) != 0;
}

static inline bool dma_pte_superpage(struct dma_pte *pte)
{
return (pte->val & (1 << 7));
}

static inline int first_pte_in_page(struct dma_pte *pte)
{
return !((unsigned long)pte & ~VTD_PAGE_MASK);
Expand Down Expand Up @@ -734,29 +739,23 @@ static void free_context_table(struct intel_iommu *iommu)
}

static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain,
unsigned long pfn, int large_level)
unsigned long pfn, int target_level)
{
int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
struct dma_pte *parent, *pte = NULL;
int level = agaw_to_level(domain->agaw);
int offset, target_level;
int offset;

BUG_ON(!domain->pgd);
BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width);
parent = domain->pgd;

/* Search pte */
if (!large_level)
target_level = 1;
else
target_level = large_level;

while (level > 0) {
void *tmp_page;

offset = pfn_level_offset(pfn, level);
pte = &parent[offset];
if (!large_level && (pte->val & DMA_PTE_LARGE_PAGE))
if (!target_level && (dma_pte_superpage(pte) || !dma_pte_present(pte)))
break;
if (level == target_level)
break;
Expand Down

0 comments on commit 898a506

Please sign in to comment.