]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/x86/kernel/amd_iommu.c
Merge branches 'dma-debug/next', 'amd-iommu/command-cleanups', 'amd-iommu/ats' and...
[mv-sheeva.git] / arch / x86 / kernel / amd_iommu.c
index e4791f66aa3831bba6d7dceb0fc685e9d832866d..dc5dddafe5c24a148d28736b9cfe2f9f2ef8c97d 100644 (file)
@@ -495,6 +495,12 @@ static void build_inv_iotlb_pages(struct iommu_cmd *cmd, u16 devid, int qdep,
                cmd->data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK;
 }
 
+static void build_inv_all(struct iommu_cmd *cmd)
+{
+       memset(cmd, 0, sizeof(*cmd));
+       CMD_SET_TYPE(cmd, CMD_INV_ALL);
+}
+
 /*
  * Writes the command to the IOMMUs command buffer and informs the
  * hardware about the new command.
@@ -599,10 +605,24 @@ static void iommu_flush_tlb_all(struct amd_iommu *iommu)
        iommu_completion_wait(iommu);
 }
 
+static void iommu_flush_all(struct amd_iommu *iommu)
+{
+       struct iommu_cmd cmd;
+
+       build_inv_all(&cmd);
+
+       iommu_queue_command(iommu, &cmd);
+       iommu_completion_wait(iommu);
+}
+
 void iommu_flush_all_caches(struct amd_iommu *iommu)
 {
-       iommu_flush_dte_all(iommu);
-       iommu_flush_tlb_all(iommu);
+       if (iommu_feature(iommu, FEATURE_IA)) {
+               iommu_flush_all(iommu);
+       } else {
+               iommu_flush_dte_all(iommu);
+               iommu_flush_tlb_all(iommu);
+       }
 }
 
 /*