diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-07-03 13:35:08 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-04 05:44:40 -0400 |
commit | 999ba417cc1a43881126d08876d5d7e653113ae3 (patch) | |
tree | 6e8bcde9d590566e61c96491d3959d9c01c39066 /arch/x86/kernel/amd_iommu.c | |
parent | 5f6a59d8ad55781d4d2ff0d327f84aaeed2c4127 (diff) |
x86, AMD IOMMU: flush domain TLB when there is more than one page to flush
This patch changes the domain TLB flushing behavior of the driver. When there
is more than one page to flush it flushes the whole domain TLB instead of every
single page. So we send only a single command to the IOMMU in every case which
is faster to execute.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Cc: iommu@lists.linux-foundation.org
Cc: bhavna.sarathy@amd.com
Cc: robert.richter@amd.com
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/amd_iommu.c')
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 329b2c3f2fed..f2766d84c7a0 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -140,16 +140,22 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu, | |||
140 | static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid, | 140 | static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid, |
141 | u64 address, size_t size) | 141 | u64 address, size_t size) |
142 | { | 142 | { |
143 | int i; | 143 | int s = 0; |
144 | unsigned pages = to_pages(address, size); | 144 | unsigned pages = to_pages(address, size); |
145 | 145 | ||
146 | address &= PAGE_MASK; | 146 | address &= PAGE_MASK; |
147 | 147 | ||
148 | for (i = 0; i < pages; ++i) { | 148 | if (pages > 1) { |
149 | iommu_queue_inv_iommu_pages(iommu, address, domid, 0, 0); | 149 | /* |
150 | address += PAGE_SIZE; | 150 | * If we have to flush more than one page, flush all |
151 | * TLB entries for this domain | ||
152 | */ | ||
153 | address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS; | ||
154 | s = 1; | ||
151 | } | 155 | } |
152 | 156 | ||
157 | iommu_queue_inv_iommu_pages(iommu, address, domid, 0, s); | ||
158 | |||
153 | return 0; | 159 | return 0; |
154 | } | 160 | } |
155 | 161 | ||