Re: AMD IOMMU causing filesystem corruption

From: Joerg Roedel
Date: Fri Apr 07 2017 - 06:27:57 EST


On Tue, Apr 04, 2017 at 09:29:37AM -0700, Samuel Sieb wrote:
> That's what I did. While running with iommu=off, I compiled and
> installed a 4.11rc kernel with the patch. I rebooted to use that
> kernel and then compiled and installed a 4.10 kernel with that patch
> and another unrelated patch. That is what I described above. The
> filesystem destruction happened while running the 4.11rc kernel with
> that patch. Is there any way to verify that the patch was actually
> having any effect? Can I check if ATS is enabled or not? I will
> have to rebuild the system before I can test again.

Also, please try the attached debug-diff on your kernel. It completly
disables the use of ATS in the amd-iommu driver.

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 98940d1392cb..f019aa67c54c 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -467,7 +467,7 @@ static int iommu_init_device(struct device *dev)
struct amd_iommu *iommu;

iommu = amd_iommu_rlookup_table[dev_data->devid];
- dev_data->iommu_v2 = iommu->is_iommu_v2;
+ dev_data->iommu_v2 = false;
}

dev->archdata.iommu = dev_data;
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 6130278c5d71..41d0e645960c 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -171,7 +171,7 @@ int amd_iommus_present;

/* IOMMUs have a non-present cache? */
bool amd_iommu_np_cache __read_mostly;
-bool amd_iommu_iotlb_sup __read_mostly = true;
+bool amd_iommu_iotlb_sup __read_mostly = false;

u32 amd_iommu_max_pasid __read_mostly = ~0;