diff options
| author | Joerg Roedel <joerg.roedel@amd.com> | 2009-11-26 09:45:41 -0500 |
|---|---|---|
| committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-11-27 08:20:37 -0500 |
| commit | 8eed9833346781dd15e3bef35a91b0a40787ea3c (patch) | |
| tree | 17e0fb9bc006517cad5949fb9d5d9ecd436cf485 /arch | |
| parent | b00d3bcff4d996f65e337d404b0df5dc201a01ab (diff) | |
x86/amd-iommu: Move reset_iommu_command_buffer out of locked code
This patch removes the ugly contruct where the
iommu->lock must be released while before calling the
reset_iommu_command_buffer function.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/kernel/amd_iommu.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 0eafca58926f..b75fcd9b6a0f 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
| @@ -285,6 +285,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) | |||
| 285 | break; | 285 | break; |
| 286 | case EVENT_TYPE_ILL_CMD: | 286 | case EVENT_TYPE_ILL_CMD: |
| 287 | printk("ILLEGAL_COMMAND_ERROR address=0x%016llx]\n", address); | 287 | printk("ILLEGAL_COMMAND_ERROR address=0x%016llx]\n", address); |
| 288 | iommu->reset_in_progress = true; | ||
| 288 | reset_iommu_command_buffer(iommu); | 289 | reset_iommu_command_buffer(iommu); |
| 289 | dump_command(address); | 290 | dump_command(address); |
| 290 | break; | 291 | break; |
| @@ -407,11 +408,8 @@ static void __iommu_wait_for_completion(struct amd_iommu *iommu) | |||
| 407 | status &= ~MMIO_STATUS_COM_WAIT_INT_MASK; | 408 | status &= ~MMIO_STATUS_COM_WAIT_INT_MASK; |
| 408 | writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET); | 409 | writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET); |
| 409 | 410 | ||
| 410 | if (unlikely(i == EXIT_LOOP_COUNT)) { | 411 | if (unlikely(i == EXIT_LOOP_COUNT)) |
| 411 | spin_unlock(&iommu->lock); | 412 | iommu->reset_in_progress = true; |
| 412 | reset_iommu_command_buffer(iommu); | ||
| 413 | spin_lock(&iommu->lock); | ||
| 414 | } | ||
| 415 | } | 413 | } |
| 416 | 414 | ||
| 417 | /* | 415 | /* |
| @@ -458,6 +456,9 @@ static int iommu_completion_wait(struct amd_iommu *iommu) | |||
| 458 | out: | 456 | out: |
| 459 | spin_unlock_irqrestore(&iommu->lock, flags); | 457 | spin_unlock_irqrestore(&iommu->lock, flags); |
| 460 | 458 | ||
| 459 | if (iommu->reset_in_progress) | ||
| 460 | reset_iommu_command_buffer(iommu); | ||
| 461 | |||
| 461 | return 0; | 462 | return 0; |
| 462 | } | 463 | } |
| 463 | 464 | ||
| @@ -649,8 +650,6 @@ static void reset_iommu_command_buffer(struct amd_iommu *iommu) | |||
| 649 | if (iommu->reset_in_progress) | 650 | if (iommu->reset_in_progress) |
| 650 | panic("AMD-Vi: ILLEGAL_COMMAND_ERROR while resetting command buffer\n"); | 651 | panic("AMD-Vi: ILLEGAL_COMMAND_ERROR while resetting command buffer\n"); |
| 651 | 652 | ||
| 652 | iommu->reset_in_progress = true; | ||
| 653 | |||
| 654 | amd_iommu_reset_cmd_buffer(iommu); | 653 | amd_iommu_reset_cmd_buffer(iommu); |
| 655 | amd_iommu_flush_all_devices(); | 654 | amd_iommu_flush_all_devices(); |
| 656 | amd_iommu_flush_all_domains(); | 655 | amd_iommu_flush_all_domains(); |
