Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197887
b: refs/heads/master
c: a99c47a
h: refs/heads/master
i:
  197885: 506e2b6
  197883: eec6a52
  197879: 6e9eb17
  197871: 98aca2d
  197855: 253131d
  197823: 8dd322c
  197759: 3b4ec2f
  197631: 25ce0b3
v: v3
  • Loading branch information
Tom Lyon authored and David Woodhouse committed May 17, 2010
1 parent 3c72b87 commit 0c558c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 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: 4f506e07e0a3dff34427cece255a8f390a78d5a0
refs/heads/master: a99c47a228c194aa75bffdcb82806c5f33c7c63b
40 changes: 21 additions & 19 deletions trunk/drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3433,19 +3433,6 @@ static void vm_domain_remove_all_dev_info(struct dmar_domain *domain)
/* domain id for virtual machine, it won't be set in context */
static unsigned long vm_domid;

static int vm_domain_min_agaw(struct dmar_domain *domain)
{
int i;
int min_agaw = domain->agaw;

for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) {
if (min_agaw > g_iommus[i]->agaw)
min_agaw = g_iommus[i]->agaw;
}

return min_agaw;
}

static struct dmar_domain *iommu_alloc_vm_domain(void)
{
struct dmar_domain *domain;
Expand Down Expand Up @@ -3574,7 +3561,6 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
struct pci_dev *pdev = to_pci_dev(dev);
struct intel_iommu *iommu;
int addr_width;
u64 end;

/* normally pdev is not mapped */
if (unlikely(domain_context_mapped(pdev))) {
Expand All @@ -3597,14 +3583,30 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,

/* check if this iommu agaw is sufficient for max mapped address */
addr_width = agaw_to_width(iommu->agaw);
end = DOMAIN_MAX_ADDR(addr_width);
end = end & VTD_PAGE_MASK;
if (end < dmar_domain->max_addr) {
printk(KERN_ERR "%s: iommu agaw (%d) is not "
if (addr_width > cap_mgaw(iommu->cap))
addr_width = cap_mgaw(iommu->cap);

if (dmar_domain->max_addr > (1LL << addr_width)) {
printk(KERN_ERR "%s: iommu width (%d) is not "
"sufficient for the mapped address (%llx)\n",
__func__, iommu->agaw, dmar_domain->max_addr);
__func__, addr_width, dmar_domain->max_addr);
return -EFAULT;
}
dmar_domain->gaw = addr_width;

/*
* Knock out extra levels of page tables if necessary
*/
while (iommu->agaw < dmar_domain->agaw) {
struct dma_pte *pte;

pte = dmar_domain->pgd;
if (dma_pte_present(pte)) {
free_pgtable_page(dmar_domain->pgd);
dmar_domain->pgd = (struct dma_pte *)dma_pte_addr(pte);
}
dmar_domain->agaw--;
}

return domain_add_dev_info(dmar_domain, pdev, CONTEXT_TT_MULTI_LEVEL);
}
Expand Down

0 comments on commit 0c558c4

Please sign in to comment.