[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110728234447.0F9F02403FF@tassilo.jf.intel.com>
Date: Thu, 28 Jul 2011 16:44:47 -0700 (PDT)
From: Andi Kleen <andi@...stfloor.org>
To: joerg.roedel@....com, ak@...ux.intel.com,
linux-kernel@...r.kernel.org, stable@...nel.org,
tim.bird@...sony.com
Subject: [PATCH] [42/50] iommu/amd: Don't use MSI address range for DMA addresses
2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <joerg.roedel@....com>
[ upstream commit 17f5b569e09cfa3488eaa663cbf9feada2e789f5 ]
Reserve the MSI address range in the address allocator so
that MSI addresses are not handed out as dma handles.
Cc: stable@...nel.org
Signed-off-by: Joerg Roedel <joerg.roedel@....com>
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
Index: linux-2.6.35.y/arch/x86/kernel/amd_iommu.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/amd_iommu.c
+++ linux-2.6.35.y/arch/x86/kernel/amd_iommu.c
@@ -25,6 +25,7 @@
#include <linux/dma-mapping.h>
#include <linux/iommu-helper.h>
#include <linux/iommu.h>
+#include <asm/msidef.h>
#include <asm/proto.h>
#include <asm/iommu.h>
#include <asm/gart.h>
@@ -1048,7 +1049,7 @@ static int alloc_new_range(struct dma_op
{
int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
struct amd_iommu *iommu;
- unsigned long i;
+ unsigned long i, old_size;
#ifdef CONFIG_IOMMU_STRESS
populate = false;
@@ -1084,8 +1085,21 @@ static int alloc_new_range(struct dma_op
}
}
+ old_size = dma_dom->aperture_size;
dma_dom->aperture_size += APERTURE_RANGE_SIZE;
+ /* Reserve address range used for MSI messages */
+ if (old_size < MSI_ADDR_BASE_LO &&
+ dma_dom->aperture_size > MSI_ADDR_BASE_LO) {
+ unsigned long spage;
+ int pages;
+
+ pages = iommu_num_pages(MSI_ADDR_BASE_LO, 0x10000, PAGE_SIZE);
+ spage = MSI_ADDR_BASE_LO >> PAGE_SHIFT;
+
+ dma_ops_reserve_addresses(dma_dom, spage, pages);
+ }
+
/* Intialize the exclusion range if necessary */
for_each_iommu(iommu) {
if (iommu->exclusion_start &&
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists