diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-11 05:13:24 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-12 03:21:58 -0400 |
commit | 58fc7f1419560efa9c426b829c195050e0147d7f (patch) | |
tree | c6afe7a1a82f9c059238809df6a1dd3c2ead3e22 | |
parent | d99ddec3eee0be8a43b2c1ff624b9dfaaa26b959 (diff) |
x86/amd-iommu: Add support for invalidate_all command
This patch adds support for the invalidate_all command
present in new versions of the AMD IOMMU.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | arch/x86/include/asm/amd_iommu_types.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 24 |
2 files changed, 23 insertions, 2 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index 5c24e465234..df62d26ed2a 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h | |||
@@ -127,6 +127,7 @@ | |||
127 | #define CMD_COMPL_WAIT 0x01 | 127 | #define CMD_COMPL_WAIT 0x01 |
128 | #define CMD_INV_DEV_ENTRY 0x02 | 128 | #define CMD_INV_DEV_ENTRY 0x02 |
129 | #define CMD_INV_IOMMU_PAGES 0x03 | 129 | #define CMD_INV_IOMMU_PAGES 0x03 |
130 | #define CMD_INV_ALL 0x08 | ||
130 | 131 | ||
131 | #define CMD_COMPL_WAIT_STORE_MASK 0x01 | 132 | #define CMD_COMPL_WAIT_STORE_MASK 0x01 |
132 | #define CMD_COMPL_WAIT_INT_MASK 0x02 | 133 | #define CMD_COMPL_WAIT_INT_MASK 0x02 |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index bcf58ea55cf..d6192bcf9f0 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -463,6 +463,12 @@ static void build_inv_iommu_pages(struct iommu_cmd *cmd, u64 address, | |||
463 | cmd->data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK; | 463 | cmd->data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK; |
464 | } | 464 | } |
465 | 465 | ||
466 | static void build_inv_all(struct iommu_cmd *cmd) | ||
467 | { | ||
468 | memset(cmd, 0, sizeof(*cmd)); | ||
469 | CMD_SET_TYPE(cmd, CMD_INV_ALL); | ||
470 | } | ||
471 | |||
466 | /* | 472 | /* |
467 | * Writes the command to the IOMMUs command buffer and informs the | 473 | * Writes the command to the IOMMUs command buffer and informs the |
468 | * hardware about the new command. | 474 | * hardware about the new command. |
@@ -567,10 +573,24 @@ static void iommu_flush_tlb_all(struct amd_iommu *iommu) | |||
567 | iommu_completion_wait(iommu); | 573 | iommu_completion_wait(iommu); |
568 | } | 574 | } |
569 | 575 | ||
576 | static void iommu_flush_all(struct amd_iommu *iommu) | ||
577 | { | ||
578 | struct iommu_cmd cmd; | ||
579 | |||
580 | build_inv_all(&cmd); | ||
581 | |||
582 | iommu_queue_command(iommu, &cmd); | ||
583 | iommu_completion_wait(iommu); | ||
584 | } | ||
585 | |||
570 | void iommu_flush_all_caches(struct amd_iommu *iommu) | 586 | void iommu_flush_all_caches(struct amd_iommu *iommu) |
571 | { | 587 | { |
572 | iommu_flush_dte_all(iommu); | 588 | if (iommu_feature(iommu, FEATURE_IA)) { |
573 | iommu_flush_tlb_all(iommu); | 589 | iommu_flush_all(iommu); |
590 | } else { | ||
591 | iommu_flush_dte_all(iommu); | ||
592 | iommu_flush_tlb_all(iommu); | ||
593 | } | ||
574 | } | 594 | } |
575 | 595 | ||
576 | /* | 596 | /* |