diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-11-06 08:59:05 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2008-11-06 08:59:05 -0500 |
commit | 80be308dfa3798c7bad0fc81760b2faf83870e91 (patch) | |
tree | 745661b7a9b6545acfdab389decdce37788ae98a /arch | |
parent | ae9b9403644f3ecc76867af042e7e1cfd5c099d0 (diff) |
AMD IOMMU: fix lazy IO/TLB flushing in unmap path
Lazy flushing needs to take care of the unmap path too which is not yet
implemented and leads to stale IO/TLB entries. This is fixed by this
patch.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 38e88d40ab10..4755bbc7ae5b 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -526,6 +526,9 @@ static void dma_ops_free_addresses(struct dma_ops_domain *dom, | |||
526 | { | 526 | { |
527 | address >>= PAGE_SHIFT; | 527 | address >>= PAGE_SHIFT; |
528 | iommu_area_free(dom->bitmap, address, pages); | 528 | iommu_area_free(dom->bitmap, address, pages); |
529 | |||
530 | if (address + pages >= dom->next_bit) | ||
531 | dom->need_flush = true; | ||
529 | } | 532 | } |
530 | 533 | ||
531 | /**************************************************************************** | 534 | /**************************************************************************** |
@@ -981,8 +984,10 @@ static void __unmap_single(struct amd_iommu *iommu, | |||
981 | 984 | ||
982 | dma_ops_free_addresses(dma_dom, dma_addr, pages); | 985 | dma_ops_free_addresses(dma_dom, dma_addr, pages); |
983 | 986 | ||
984 | if (amd_iommu_unmap_flush) | 987 | if (amd_iommu_unmap_flush || dma_dom->need_flush) { |
985 | iommu_flush_pages(iommu, dma_dom->domain.id, dma_addr, size); | 988 | iommu_flush_pages(iommu, dma_dom->domain.id, dma_addr, size); |
989 | dma_dom->need_flush = false; | ||
990 | } | ||
986 | } | 991 | } |
987 | 992 | ||
988 | /* | 993 | /* |