Skip to content

Commit

Permalink
intel-iommu: Fix enabling snooping feature by mistake
Browse files Browse the repository at this point in the history
Two defects work together result in KVM device passthrough randomly can't
work:
1. iommu_snooping is not initialized to zero when vm_iommu_init() called.
So it is possible to get a random value.
2. One line added by commit 2c2e2c3("IOMMU Identity Mapping Support")
change the code path, let it bypass domain_update_iommu_cap(), as well as
missing the increment of domain iommu reference count.

The latter is also likely to cause a leak of domains on repeated VMM 
assignment and deassignment.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Sheng Yang authored and David Woodhouse committed Aug 6, 2009
1 parent 33041ec commit c5b1525
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain, int segment,
}

set_bit(num, iommu->domain_ids);
set_bit(iommu->seq_id, &domain->iommu_bmp);
iommu->domains[num] = domain;
id = num;
}
Expand Down Expand Up @@ -3409,6 +3408,7 @@ static int md_domain_init(struct dmar_domain *domain, int guest_width)

domain->iommu_count = 0;
domain->iommu_coherency = 0;
domain->iommu_snooping = 0;
domain->max_addr = 0;

/* always allocate the top pgd */
Expand Down

0 comments on commit c5b1525

Please sign in to comment.