* [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode
@ 2019-12-19 5:18 Lu Baolu
2019-12-19 5:18 ` [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton Lu Baolu
2019-12-28 2:47 ` [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode Lu Baolu
0 siblings, 2 replies; 4+ messages in thread
From: Lu Baolu @ 2019-12-19 5:18 UTC (permalink / raw)
To: Joerg Roedel
Cc: kevin.tian, ashok.raj, linux-kernel, iommu, jacob.jun.pan,
David Woodhouse
If Intel IOMMU strict mode is enabled by users, it's unnecessary
to create the iova flush queue.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel-iommu.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 0726705d2d89..93e1d7c3ac7c 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -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);
- err = init_iova_flush_queue(&domain->iovad,
- iommu_flush_iova, iova_entry_free);
- if (err)
- return err;
+ if (!intel_iommu_strict) {
+ err = init_iova_flush_queue(&domain->iovad,
+ iommu_flush_iova, iova_entry_free);
+ if (err)
+ return err;
+ }
domain_reserve_special_ranges(domain);
@@ -5199,6 +5201,7 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
{
struct dmar_domain *dmar_domain;
struct iommu_domain *domain;
+ int ret;
switch (type) {
case IOMMU_DOMAIN_DMA:
@@ -5215,11 +5218,14 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
return NULL;
}
- if (type == IOMMU_DOMAIN_DMA &&
- init_iova_flush_queue(&dmar_domain->iovad,
- iommu_flush_iova, iova_entry_free)) {
- pr_warn("iova flush queue initialization failed\n");
- intel_iommu_strict = 1;
+ if (!intel_iommu_strict && type == IOMMU_DOMAIN_DMA) {
+ ret = init_iova_flush_queue(&dmar_domain->iovad,
+ iommu_flush_iova,
+ iova_entry_free);
+ if (ret) {
+ pr_warn("iova flush queue initialization failed\n");
+ intel_iommu_strict = 1;
+ }
}
domain_update_iommu_cap(dmar_domain);
--
2.17.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton
2019-12-19 5:18 [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode Lu Baolu
@ 2019-12-19 5:18 ` Lu Baolu
2019-12-28 2:47 ` Lu Baolu
2019-12-28 2:47 ` [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode Lu Baolu
1 sibling, 1 reply; 4+ messages in thread
From: Lu Baolu @ 2019-12-19 5:18 UTC (permalink / raw)
To: Joerg Roedel
Cc: kevin.tian, ashok.raj, linux-kernel, iommu, jacob.jun.pan,
David Woodhouse
Currently if flush queue initialization fails, we return error
or enforce the system-wide strict mode. These are unnecessary
because we always check the existence of a flush queue before
queuing any iova's for lazy flushing. Printing a informational
message is enough.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel-iommu.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 93e1d7c3ac7c..65eee8cf6d59 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1854,15 +1854,15 @@ static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu,
{
int adjust_width, agaw;
unsigned long sagaw;
- int err;
+ int ret;
init_iova_domain(&domain->iovad, VTD_PAGE_SIZE, IOVA_START_PFN);
if (!intel_iommu_strict) {
- err = init_iova_flush_queue(&domain->iovad,
+ ret = init_iova_flush_queue(&domain->iovad,
iommu_flush_iova, iova_entry_free);
- if (err)
- return err;
+ if (ret)
+ pr_info("iova flush queue initialization failed\n");
}
domain_reserve_special_ranges(domain);
@@ -5222,10 +5222,8 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
ret = init_iova_flush_queue(&dmar_domain->iovad,
iommu_flush_iova,
iova_entry_free);
- if (ret) {
- pr_warn("iova flush queue initialization failed\n");
- intel_iommu_strict = 1;
- }
+ if (ret)
+ pr_info("iova flush queue initialization failed\n");
}
domain_update_iommu_cap(dmar_domain);
--
2.17.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode
2019-12-19 5:18 [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode Lu Baolu
2019-12-19 5:18 ` [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton Lu Baolu
@ 2019-12-28 2:47 ` Lu Baolu
1 sibling, 0 replies; 4+ messages in thread
From: Lu Baolu @ 2019-12-28 2:47 UTC (permalink / raw)
To: Joerg Roedel
Cc: kevin.tian, ashok.raj, linux-kernel, iommu, jacob.jun.pan,
David Woodhouse
On 12/19/19 1:18 PM, Lu Baolu wrote:
> If Intel IOMMU strict mode is enabled by users, it's unnecessary
> to create the iova flush queue.
>
> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
Queued for v5.6.
Thanks,
-baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton
2019-12-19 5:18 ` [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton Lu Baolu
@ 2019-12-28 2:47 ` Lu Baolu
0 siblings, 0 replies; 4+ messages in thread
From: Lu Baolu @ 2019-12-28 2:47 UTC (permalink / raw)
To: Joerg Roedel
Cc: kevin.tian, ashok.raj, linux-kernel, iommu, jacob.jun.pan,
David Woodhouse
On 12/19/19 1:18 PM, Lu Baolu wrote:
> Currently if flush queue initialization fails, we return error
> or enforce the system-wide strict mode. These are unnecessary
> because we always check the existence of a flush queue before
> queuing any iova's for lazy flushing. Printing a informational
> message is enough.
>
> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
Queued for v5.6.
Thanks,
-baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-28 2:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 5:18 [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode Lu Baolu
2019-12-19 5:18 ` [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton Lu Baolu
2019-12-28 2:47 ` Lu Baolu
2019-12-28 2:47 ` [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode Lu Baolu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).