aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-11-23 12:32:38 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-11-27 08:16:29 -0500
commit318afd41d2eca3224de3fd85a3b9a27a3010a98d (patch)
tree83434f1a39ee76536b4a987a25f4ff1153c41438
parent09b4280439ef6fdc55f1353a9135034336eb5d26 (diff)
x86/amd-iommu: Make np-cache a global flag
The non-present cache flag was IOMMU local until now which doesn't make sense. Make this a global flag so we can remove the lase user of 'struct iommu' in the map/unmap path. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--arch/x86/include/asm/amd_iommu_types.h3
-rw-r--r--arch/x86/kernel/amd_iommu.c8
-rw-r--r--arch/x86/kernel/amd_iommu_init.c6
3 files changed, 10 insertions, 7 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h
index b332b7f7d8d6..4899f783df68 100644
--- a/arch/x86/include/asm/amd_iommu_types.h
+++ b/arch/x86/include/asm/amd_iommu_types.h
@@ -211,6 +211,9 @@ extern bool amd_iommu_dump;
211 printk(KERN_INFO "AMD-Vi: " format, ## arg); \ 211 printk(KERN_INFO "AMD-Vi: " format, ## arg); \
212 } while(0); 212 } while(0);
213 213
214/* global flag if IOMMUs cache non-present entries */
215extern bool amd_iommu_np_cache;
216
214/* 217/*
215 * Make iterating over all IOMMUs easier 218 * Make iterating over all IOMMUs easier
216 */ 219 */
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index a1bd99d390ab..5ebd24e4fc57 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -131,12 +131,6 @@ static void amd_iommu_stats_init(void)
131 131
132#endif 132#endif
133 133
134/* returns !0 if the IOMMU is caching non-present entries in its TLB */
135static int iommu_has_npcache(struct amd_iommu *iommu)
136{
137 return iommu->cap & (1UL << IOMMU_CAP_NPCACHE);
138}
139
140/**************************************************************************** 134/****************************************************************************
141 * 135 *
142 * Interrupt handling functions 136 * Interrupt handling functions
@@ -1713,7 +1707,7 @@ retry:
1713 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) { 1707 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) {
1714 iommu_flush_tlb(&dma_dom->domain); 1708 iommu_flush_tlb(&dma_dom->domain);
1715 dma_dom->need_flush = false; 1709 dma_dom->need_flush = false;
1716 } else if (unlikely(iommu_has_npcache(iommu))) 1710 } else if (unlikely(amd_iommu_np_cache))
1717 iommu_flush_pages(&dma_dom->domain, address, size); 1711 iommu_flush_pages(&dma_dom->domain, address, size);
1718 1712
1719out: 1713out:
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 73d5173765d2..fbe4c3c02a91 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -141,6 +141,9 @@ LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
141struct amd_iommu *amd_iommus[MAX_IOMMUS]; 141struct amd_iommu *amd_iommus[MAX_IOMMUS];
142int amd_iommus_present; 142int amd_iommus_present;
143 143
144/* IOMMUs have a non-present cache? */
145bool amd_iommu_np_cache __read_mostly;
146
144/* 147/*
145 * List of protection domains - used during resume 148 * List of protection domains - used during resume
146 */ 149 */
@@ -891,6 +894,9 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
891 init_iommu_from_acpi(iommu, h); 894 init_iommu_from_acpi(iommu, h);
892 init_iommu_devices(iommu); 895 init_iommu_devices(iommu);
893 896
897 if (iommu->cap & (1UL << IOMMU_CAP_NPCACHE))
898 amd_iommu_np_cache = true;
899
894 return pci_enable_device(iommu->dev); 900 return pci_enable_device(iommu->dev);
895} 901}
896 902