diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-09-02 08:10:32 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-09-02 08:10:32 -0400 |
commit | f1ca1512e765337a7c09eb875eedef8ea4e07654 (patch) | |
tree | 79bc491e98ab55af1575a3e4dec8e31f1f32be62 | |
parent | c6a389f123b9f68d605bb7e0f9b32ec1e3e14132 (diff) |
iommu/amd: Make sure iommu->need_sync contains correct value
The value is only set to true but never set back to false,
which causes to many completion-wait commands to be sent to
hardware. Fix it with this patch.
Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | drivers/iommu/amd_iommu.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index a14f8dc23462..45652231dae8 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -605,7 +605,9 @@ static void build_inv_all(struct iommu_cmd *cmd) | |||
605 | * Writes the command to the IOMMUs command buffer and informs the | 605 | * Writes the command to the IOMMUs command buffer and informs the |
606 | * hardware about the new command. | 606 | * hardware about the new command. |
607 | */ | 607 | */ |
608 | static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd) | 608 | static int iommu_queue_command_sync(struct amd_iommu *iommu, |
609 | struct iommu_cmd *cmd, | ||
610 | bool sync) | ||
609 | { | 611 | { |
610 | u32 left, tail, head, next_tail; | 612 | u32 left, tail, head, next_tail; |
611 | unsigned long flags; | 613 | unsigned long flags; |
@@ -639,13 +641,18 @@ again: | |||
639 | copy_cmd_to_buffer(iommu, cmd, tail); | 641 | copy_cmd_to_buffer(iommu, cmd, tail); |
640 | 642 | ||
641 | /* We need to sync now to make sure all commands are processed */ | 643 | /* We need to sync now to make sure all commands are processed */ |
642 | iommu->need_sync = true; | 644 | iommu->need_sync = sync; |
643 | 645 | ||
644 | spin_unlock_irqrestore(&iommu->lock, flags); | 646 | spin_unlock_irqrestore(&iommu->lock, flags); |
645 | 647 | ||
646 | return 0; | 648 | return 0; |
647 | } | 649 | } |
648 | 650 | ||
651 | static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd) | ||
652 | { | ||
653 | return iommu_queue_command_sync(iommu, cmd, true); | ||
654 | } | ||
655 | |||
649 | /* | 656 | /* |
650 | * This function queues a completion wait command into the command | 657 | * This function queues a completion wait command into the command |
651 | * buffer of an IOMMU | 658 | * buffer of an IOMMU |
@@ -661,7 +668,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu) | |||
661 | 668 | ||
662 | build_completion_wait(&cmd, (u64)&sem); | 669 | build_completion_wait(&cmd, (u64)&sem); |
663 | 670 | ||
664 | ret = iommu_queue_command(iommu, &cmd); | 671 | ret = iommu_queue_command_sync(iommu, &cmd, false); |
665 | if (ret) | 672 | if (ret) |
666 | return ret; | 673 | return ret; |
667 | 674 | ||