Commit 10f8008f authored by Lu Baolu's avatar Lu Baolu Committed by Joerg Roedel

iommu/vt-d: Avoid iova flush queue in strict mode

If Intel IOMMU strict mode is enabled by users, it's unnecessary
to create the iova flush queue.
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 984d03ad
...@@ -1858,10 +1858,12 @@ static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu, ...@@ -1858,10 +1858,12 @@ static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu,
init_iova_domain(&domain->iovad, VTD_PAGE_SIZE, IOVA_START_PFN); init_iova_domain(&domain->iovad, VTD_PAGE_SIZE, IOVA_START_PFN);
err = init_iova_flush_queue(&domain->iovad, if (!intel_iommu_strict) {
iommu_flush_iova, iova_entry_free); err = init_iova_flush_queue(&domain->iovad,
if (err) iommu_flush_iova, iova_entry_free);
return err; if (err)
return err;
}
domain_reserve_special_ranges(domain); domain_reserve_special_ranges(domain);
...@@ -5199,6 +5201,7 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type) ...@@ -5199,6 +5201,7 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
{ {
struct dmar_domain *dmar_domain; struct dmar_domain *dmar_domain;
struct iommu_domain *domain; struct iommu_domain *domain;
int ret;
switch (type) { switch (type) {
case IOMMU_DOMAIN_DMA: case IOMMU_DOMAIN_DMA:
...@@ -5215,11 +5218,14 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type) ...@@ -5215,11 +5218,14 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
return NULL; return NULL;
} }
if (type == IOMMU_DOMAIN_DMA && if (!intel_iommu_strict && type == IOMMU_DOMAIN_DMA) {
init_iova_flush_queue(&dmar_domain->iovad, ret = init_iova_flush_queue(&dmar_domain->iovad,
iommu_flush_iova, iova_entry_free)) { iommu_flush_iova,
pr_warn("iova flush queue initialization failed\n"); iova_entry_free);
intel_iommu_strict = 1; if (ret) {
pr_warn("iova flush queue initialization failed\n");
intel_iommu_strict = 1;
}
} }
domain_update_iommu_cap(dmar_domain); domain_update_iommu_cap(dmar_domain);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment