Re: [PATCH 5/6] iommu/vt-d: Cleanup after delegating DMA domain to generic iommu
From: Mehta, Sohil
Date: Mon Jun 10 2019 - 14:49:50 EST
On Sun, 2019-06-09 at 10:38 +0800, Lu Baolu wrote:
> Âstatic int __init si_domain_init(int hw)
> @@ -3306,14 +3252,13 @@ static int __init init_dmars(void)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (pasid_supported(iommu))
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_svm_init(iommu);
> Â#endif
> -ÂÂÂÂÂÂÂ}
> Â
> -ÂÂÂÂÂÂÂ/*
> -ÂÂÂÂÂÂÂ * Now that qi is enabled on all iommus, set the root entry
> and flush
> -ÂÂÂÂÂÂÂ * caches. This is required on some Intel X58 chipsets,
> otherwise the
> -ÂÂÂÂÂÂÂ * flush_context function will loop forever and the boot
> hangs.
> -ÂÂÂÂÂÂÂ */
> -ÂÂÂÂÂÂÂfor_each_active_iommu(iommu, drhd) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/*
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ * Now that qi is enabled on all iommus, set the root
> entry and
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ * flush caches. This is required on some Intel X58
> chipsets,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ * otherwise the flush_context function will loop
> forever and
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ * the boot hangs.
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ */
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂiommu_flush_write_buffer(iommu);
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂiommu_set_root_entry(iommu);
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂiommu->flush.flush_context(iommu, 0, 0, 0,
> DMA_CCMD_GLOBAL_INVL);
This changes the intent of the original code. As the comment says
enable QI on all IOMMUs, then flush the caches and set the root entry.
The order of setting the root entries has changed now.
Refer:Â
Commit a4c34ff1c029 ('iommu/vt-d: Enable QI on all IOMMUs before
setting root entry')
--Sohil