diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-09-17 07:47:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-18 03:25:04 -0400 |
commit | ee2fa7435b6dddf1ca119f298ad0100cf50c0397 (patch) | |
tree | 358bd578bc7e0f555307b7bd30464e27c9992e04 /arch | |
parent | ba0593bf553c450a03dbc5f8c1f0ff58b778a0c8 (diff) |
AMD IOMMU: set iommu sunc flag after command queuing
The iommu->need_sync flag must be set after the command is queued to
avoid race conditions.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 69b4d060b21c..a96d8c049a88 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -140,6 +140,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu) | |||
140 | static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid) | 140 | static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid) |
141 | { | 141 | { |
142 | struct iommu_cmd cmd; | 142 | struct iommu_cmd cmd; |
143 | int ret; | ||
143 | 144 | ||
144 | BUG_ON(iommu == NULL); | 145 | BUG_ON(iommu == NULL); |
145 | 146 | ||
@@ -147,9 +148,11 @@ static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid) | |||
147 | CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY); | 148 | CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY); |
148 | cmd.data[0] = devid; | 149 | cmd.data[0] = devid; |
149 | 150 | ||
151 | ret = iommu_queue_command(iommu, &cmd); | ||
152 | |||
150 | iommu->need_sync = 1; | 153 | iommu->need_sync = 1; |
151 | 154 | ||
152 | return iommu_queue_command(iommu, &cmd); | 155 | return ret; |
153 | } | 156 | } |
154 | 157 | ||
155 | /* | 158 | /* |
@@ -159,6 +162,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu, | |||
159 | u64 address, u16 domid, int pde, int s) | 162 | u64 address, u16 domid, int pde, int s) |
160 | { | 163 | { |
161 | struct iommu_cmd cmd; | 164 | struct iommu_cmd cmd; |
165 | int ret; | ||
162 | 166 | ||
163 | memset(&cmd, 0, sizeof(cmd)); | 167 | memset(&cmd, 0, sizeof(cmd)); |
164 | address &= PAGE_MASK; | 168 | address &= PAGE_MASK; |
@@ -171,9 +175,11 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu, | |||
171 | if (pde) /* PDE bit - we wan't flush everything not only the PTEs */ | 175 | if (pde) /* PDE bit - we wan't flush everything not only the PTEs */ |
172 | cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK; | 176 | cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK; |
173 | 177 | ||
178 | ret = iommu_queue_command(iommu, &cmd); | ||
179 | |||
174 | iommu->need_sync = 1; | 180 | iommu->need_sync = 1; |
175 | 181 | ||
176 | return iommu_queue_command(iommu, &cmd); | 182 | return ret; |
177 | } | 183 | } |
178 | 184 | ||
179 | /* | 185 | /* |