]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iommu/amd: Don't clear DTE flags when modifying it
authorJoerg Roedel <jroedel@suse.de>
Tue, 20 Oct 2015 12:59:36 +0000 (14:59 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:28:16 +0000 (19:28 -0800)
Orabug: 22623807

commit cbf3ccd09d683abf1cacd36e3640872ee912d99b upstream.

During device assignment/deassignment the flags in the DTE
get lost, which might cause spurious faults, for example
when the device tries to access the system management range.
Fix this by not clearing the flags with the rest of the DTE.

Reported-by: G. Richard Bellamy <rbellamy@pteradigm.com>
Tested-by: G. Richard Bellamy <rbellamy@pteradigm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 11d9bb923f7f15361313e6f52bcd6dac0ebbe117)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/iommu/amd_iommu.c
drivers/iommu/amd_iommu_types.h

index ca9f4edbb940981184ccd909f9909251f97d96a4..f0fd5352f8ef96191db6b6f78847c363a00461b4 100644 (file)
@@ -2099,8 +2099,8 @@ static void set_dte_entry(u16 devid, struct protection_domain *domain, bool ats)
 static void clear_dte_entry(u16 devid)
 {
        /* remove entry from the device table seen by the hardware */
-       amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
-       amd_iommu_dev_table[devid].data[1] = 0;
+       amd_iommu_dev_table[devid].data[0]  = IOMMU_PTE_P | IOMMU_PTE_TV;
+       amd_iommu_dev_table[devid].data[1] &= DTE_FLAG_MASK;
 
        amd_iommu_apply_erratum_63(devid);
 }
index 05030e523771a6ee3befbe890ed45b47a86f8f7f..cbfd0f4c46082d5240582f6c027d7d47fa28f60c 100644 (file)
 #define IOMMU_PTE_IR (1ULL << 61)
 #define IOMMU_PTE_IW (1ULL << 62)
 
+#define DTE_FLAG_MASK  (0x3ffULL << 32)
 #define DTE_FLAG_IOTLB (0x01UL << 32)
 #define DTE_FLAG_GV    (0x01ULL << 55)
 #define DTE_GLX_SHIFT  (56)