|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 1/2] iommu/amd-vi: allow disable_iommu() against non-initialized IOMMUs
Introduce a force option to disable_iommu() that allows it to disable the
IOMMU, even when ->enabled is not set. While there remove the unlikely(),
this is not a hot path anyway.
No functional change, as there are no current callers that pass force ==
true.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/drivers/passthrough/amd/iommu_init.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c
b/xen/drivers/passthrough/amd/iommu_init.c
index d77dd8511288..76ae78e5ea53 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -929,13 +929,13 @@ static void enable_iommu(struct amd_iommu *iommu)
amd_iommu_flush_all_caches(iommu);
}
-static void disable_iommu(struct amd_iommu *iommu)
+static void disable_iommu(struct amd_iommu *iommu, bool force)
{
unsigned long flags;
spin_lock_irqsave(&iommu->lock, flags);
- if ( unlikely(!iommu->enabled) )
+ if ( !iommu->enabled && !force )
goto out;
if ( !iommu->ctrl.int_cap_xt_en )
@@ -1139,7 +1139,7 @@ static void __init amd_iommu_init_cleanup(void)
iommu->ctrl.int_cap_xt_en = 0;
if ( iommu->enabled )
- disable_iommu(iommu);
+ disable_iommu(iommu, false);
else if ( iommu->mmio_base )
writeq(iommu->ctrl.raw,
iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
@@ -1584,7 +1584,7 @@ void cf_check amd_iommu_crash_shutdown(void)
struct amd_iommu *iommu;
for_each_amd_iommu ( iommu )
- disable_iommu(iommu);
+ disable_iommu(iommu, false);
}
void cf_check amd_iommu_resume(void)
@@ -1598,7 +1598,7 @@ void cf_check amd_iommu_resume(void)
* To make sure that iommus have not been touched
* before re-enablement
*/
- disable_iommu(iommu);
+ disable_iommu(iommu, false);
enable_iommu(iommu);
if ( !iommu->features.flds.ia_sup )
invalidate_all = false;
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |