aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-07-06 11:14:44 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2011-07-06 11:14:44 -0400
commit17f5b569e09cfa3488eaa663cbf9feada2e789f5 (patch)
tree94442ee8d5132bb679cb144d5a47ea8cb0f2ffb6 /drivers/iommu
parent801019d59d4e1d1523e5897949fd3b6843571bd0 (diff)
iommu/amd: Don't use MSI address range for DMA addresses
Reserve the MSI address range in the address allocator so that MSI addresses are not handed out as dma handles. Cc: stable@kernel.org Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 748eab063857..a14f8dc23462 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -28,6 +28,7 @@
28#include <linux/iommu.h> 28#include <linux/iommu.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/amd-iommu.h> 30#include <linux/amd-iommu.h>
31#include <asm/msidef.h>
31#include <asm/proto.h> 32#include <asm/proto.h>
32#include <asm/iommu.h> 33#include <asm/iommu.h>
33#include <asm/gart.h> 34#include <asm/gart.h>
@@ -1202,7 +1203,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,
1202{ 1203{
1203 int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; 1204 int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
1204 struct amd_iommu *iommu; 1205 struct amd_iommu *iommu;
1205 unsigned long i; 1206 unsigned long i, old_size;
1206 1207
1207#ifdef CONFIG_IOMMU_STRESS 1208#ifdef CONFIG_IOMMU_STRESS
1208 populate = false; 1209 populate = false;
@@ -1238,8 +1239,21 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,
1238 } 1239 }
1239 } 1240 }
1240 1241
1242 old_size = dma_dom->aperture_size;
1241 dma_dom->aperture_size += APERTURE_RANGE_SIZE; 1243 dma_dom->aperture_size += APERTURE_RANGE_SIZE;
1242 1244
1245 /* Reserve address range used for MSI messages */
1246 if (old_size < MSI_ADDR_BASE_LO &&
1247 dma_dom->aperture_size > MSI_ADDR_BASE_LO) {
1248 unsigned long spage;
1249 int pages;
1250
1251 pages = iommu_num_pages(MSI_ADDR_BASE_LO, 0x10000, PAGE_SIZE);
1252 spage = MSI_ADDR_BASE_LO >> PAGE_SHIFT;
1253
1254 dma_ops_reserve_addresses(dma_dom, spage, pages);
1255 }
1256
1243 /* Initialize the exclusion range if necessary */ 1257 /* Initialize the exclusion range if necessary */
1244 for_each_iommu(iommu) { 1258 for_each_iommu(iommu) {
1245 if (iommu->exclusion_start && 1259 if (iommu->exclusion_start &&