summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/amd_iommu_types.h
diff options
context:
space:
mode:
authorJoerg Roedel2009-05-15 12:30:05 +0200
committerJoerg Roedel2009-05-28 18:14:15 +0200
commit384de72910a7bf96a02a6d8023fe9e16d872beb2 (patch)
tree623a37e8e37180b505e1d997ee83c93528344d55 /arch/x86/include/asm/amd_iommu_types.h
parentamd-iommu: handle page table allocation failures in dma_ops code (diff)
downloadkernel-qcow2-linux-384de72910a7bf96a02a6d8023fe9e16d872beb2.tar.gz
kernel-qcow2-linux-384de72910a7bf96a02a6d8023fe9e16d872beb2.tar.xz
kernel-qcow2-linux-384de72910a7bf96a02a6d8023fe9e16d872beb2.zip
amd-iommu: make address allocator aware of multiple aperture ranges
This patch changes the AMD IOMMU address allocator to allow up to 32 aperture ranges per dma_ops domain. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/include/asm/amd_iommu_types.h')
-rw-r--r--arch/x86/include/asm/amd_iommu_types.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h
index 4c64c9bc6839..eca912931a85 100644
--- a/arch/x86/include/asm/amd_iommu_types.h
+++ b/arch/x86/include/asm/amd_iommu_types.h
@@ -195,7 +195,12 @@
#define PD_DEFAULT_MASK (1UL << 1) /* domain is a default dma_ops
domain for an IOMMU */
-#define APERTURE_RANGE_SIZE (128 * 1024 * 1024)
+#define APERTURE_RANGE_SHIFT 27 /* 128 MB */
+#define APERTURE_RANGE_SIZE (1ULL << APERTURE_RANGE_SHIFT)
+#define APERTURE_RANGE_PAGES (APERTURE_RANGE_SIZE >> PAGE_SHIFT)
+#define APERTURE_MAX_RANGES 32 /* allows 4GB of DMA address space */
+#define APERTURE_RANGE_INDEX(a) ((a) >> APERTURE_RANGE_SHIFT)
+#define APERTURE_PAGE_INDEX(a) (((a) >> 21) & 0x3fULL)
/*
* This structure contains generic data for IOMMU protection domains
@@ -227,6 +232,8 @@ struct aperture_range {
* just calculate its address in constant time.
*/
u64 *pte_pages[64];
+
+ unsigned long offset;
};
/*
@@ -245,7 +252,7 @@ struct dma_ops_domain {
unsigned long next_bit;
/* address space relevant data */
- struct aperture_range aperture;
+ struct aperture_range *aperture[APERTURE_MAX_RANGES];
/* This will be set to true when TLB needs to be flushed */
bool need_flush;