aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Wright <chrisw@redhat.com>2009-06-25 21:52:05 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-26 06:26:27 -0400
commit7e25a2422987a37729706b18583d177966919d2a (patch)
treedd7ec2e5912b81d73998efa5ab29089ffc50eef1 /drivers
parent28d0325ce6e0a52f53d8af687e6427fee59004d3 (diff)
intel-iommu: fix Identity Mapping to be arch independent
Drop the e820 scanning and use existing function for finding valid RAM regions to add to 1:1 mapping. Signed-off-by: Chris Wright <chrisw@redhat.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intel-iommu.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index e53eacd75c8d..420afa887283 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -39,7 +39,6 @@
39#include <linux/sysdev.h> 39#include <linux/sysdev.h>
40#include <asm/cacheflush.h> 40#include <asm/cacheflush.h>
41#include <asm/iommu.h> 41#include <asm/iommu.h>
42#include <asm/e820.h>
43#include "pci.h" 42#include "pci.h"
44 43
45#define ROOT_SIZE VTD_PAGE_SIZE 44#define ROOT_SIZE VTD_PAGE_SIZE
@@ -1908,7 +1907,6 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr,
1908 rmrr->end_address + 1); 1907 rmrr->end_address + 1);
1909} 1908}
1910 1909
1911#ifdef CONFIG_DMAR_GFX_WA
1912struct iommu_prepare_data { 1910struct iommu_prepare_data {
1913 struct pci_dev *pdev; 1911 struct pci_dev *pdev;
1914 int ret; 1912 int ret;
@@ -1943,6 +1941,7 @@ static int __init iommu_prepare_with_active_regions(struct pci_dev *pdev)
1943 return data.ret; 1941 return data.ret;
1944} 1942}
1945 1943
1944#ifdef CONFIG_DMAR_GFX_WA
1946static void __init iommu_prepare_gfx_mapping(void) 1945static void __init iommu_prepare_gfx_mapping(void)
1947{ 1946{
1948 struct pci_dev *pdev = NULL; 1947 struct pci_dev *pdev = NULL;
@@ -2081,7 +2080,6 @@ static int domain_add_dev_info(struct dmar_domain *domain,
2081 2080
2082static int iommu_prepare_static_identity_mapping(void) 2081static int iommu_prepare_static_identity_mapping(void)
2083{ 2082{
2084 int i;
2085 struct pci_dev *pdev = NULL; 2083 struct pci_dev *pdev = NULL;
2086 int ret; 2084 int ret;
2087 2085
@@ -2091,17 +2089,10 @@ static int iommu_prepare_static_identity_mapping(void)
2091 2089
2092 printk(KERN_INFO "IOMMU: Setting identity map:\n"); 2090 printk(KERN_INFO "IOMMU: Setting identity map:\n");
2093 for_each_pci_dev(pdev) { 2091 for_each_pci_dev(pdev) {
2094 for (i = 0; i < e820.nr_map; i++) { 2092 ret = iommu_prepare_with_active_regions(pdev);
2095 struct e820entry *ei = &e820.map[i]; 2093 if (ret) {
2096 2094 printk(KERN_INFO "1:1 mapping to one domain failed.\n");
2097 if (ei->type == E820_RAM) { 2095 return -EFAULT;
2098 ret = iommu_prepare_identity_map(pdev,
2099 ei->addr, ei->addr + ei->size);
2100 if (ret) {
2101 printk(KERN_INFO "1:1 mapping to one domain failed.\n");
2102 return -EFAULT;
2103 }
2104 }
2105 } 2096 }
2106 ret = domain_add_dev_info(si_domain, pdev); 2097 ret = domain_add_dev_info(si_domain, pdev);
2107 if (ret) 2098 if (ret)