diff options
| author | Joerg Roedel <joerg.roedel@amd.com> | 2011-12-22 14:51:53 +0100 | 
|---|---|---|
| committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-12-22 14:56:56 +0100 | 
| commit | 1456e9d2c4667a6e9221eda27b9648fb3bcc1e8e (patch) | |
| tree | 6ef0a4f1ba7d25c97babd5a0f2a41db068150281 /drivers/iommu/amd_iommu_init.c | |
| parent | 2655d7a29703f29d4b6b8e4ee1f4d682b3b28f9c (diff) | |
| download | olio-linux-3.10-1456e9d2c4667a6e9221eda27b9648fb3bcc1e8e.tar.xz olio-linux-3.10-1456e9d2c4667a6e9221eda27b9648fb3bcc1e8e.zip  | |
iommu/amd: Set IOTLB invalidation timeout
To protect the command buffer from hanging when a device
does not respond to an IOTLB invalidation, set a timeout of
1s for outstanding IOTLB invalidations.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
| -rw-r--r-- | drivers/iommu/amd_iommu_init.c | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 38784733cbb..bdea288dc18 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -306,6 +306,16 @@ static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit)  	writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);  } +static void iommu_set_inv_tlb_timeout(struct amd_iommu *iommu, int timeout) +{ +	u32 ctrl; + +	ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET); +	ctrl &= ~CTRL_INV_TO_MASK; +	ctrl |= (timeout << CONTROL_INV_TIMEOUT) & CTRL_INV_TO_MASK; +	writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET); +} +  /* Function to enable the hardware */  static void iommu_enable(struct amd_iommu *iommu)  { @@ -1300,6 +1310,9 @@ static void iommu_init_flags(struct amd_iommu *iommu)  	 * make IOMMU memory accesses cache coherent  	 */  	iommu_feature_enable(iommu, CONTROL_COHERENT_EN); + +	/* Set IOTLB invalidation timeout to 1s */ +	iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);  }  static void iommu_apply_resume_quirks(struct amd_iommu *iommu)  |