mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-07 00:59:06 +00:00
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>
This commit is contained in:
parent
28d0325ce6
commit
7e25a24229
1 changed files with 5 additions and 14 deletions
|
@ -39,7 +39,6 @@
|
||||||
#include <linux/sysdev.h>
|
#include <linux/sysdev.h>
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <asm/iommu.h>
|
#include <asm/iommu.h>
|
||||||
#include <asm/e820.h>
|
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
|
||||||
#define ROOT_SIZE VTD_PAGE_SIZE
|
#define ROOT_SIZE VTD_PAGE_SIZE
|
||||||
|
@ -1908,7 +1907,6 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr,
|
||||||
rmrr->end_address + 1);
|
rmrr->end_address + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DMAR_GFX_WA
|
|
||||||
struct iommu_prepare_data {
|
struct iommu_prepare_data {
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1943,6 +1941,7 @@ static int __init iommu_prepare_with_active_regions(struct pci_dev *pdev)
|
||||||
return data.ret;
|
return data.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_DMAR_GFX_WA
|
||||||
static void __init iommu_prepare_gfx_mapping(void)
|
static void __init iommu_prepare_gfx_mapping(void)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = NULL;
|
struct pci_dev *pdev = NULL;
|
||||||
|
@ -2081,7 +2080,6 @@ static int domain_add_dev_info(struct dmar_domain *domain,
|
||||||
|
|
||||||
static int iommu_prepare_static_identity_mapping(void)
|
static int iommu_prepare_static_identity_mapping(void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct pci_dev *pdev = NULL;
|
struct pci_dev *pdev = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2091,17 +2089,10 @@ static int iommu_prepare_static_identity_mapping(void)
|
||||||
|
|
||||||
printk(KERN_INFO "IOMMU: Setting identity map:\n");
|
printk(KERN_INFO "IOMMU: Setting identity map:\n");
|
||||||
for_each_pci_dev(pdev) {
|
for_each_pci_dev(pdev) {
|
||||||
for (i = 0; i < e820.nr_map; i++) {
|
ret = iommu_prepare_with_active_regions(pdev);
|
||||||
struct e820entry *ei = &e820.map[i];
|
if (ret) {
|
||||||
|
printk(KERN_INFO "1:1 mapping to one domain failed.\n");
|
||||||
if (ei->type == E820_RAM) {
|
return -EFAULT;
|
||||||
ret = iommu_prepare_identity_map(pdev,
|
|
||||||
ei->addr, ei->addr + ei->size);
|
|
||||||
if (ret) {
|
|
||||||
printk(KERN_INFO "1:1 mapping to one domain failed.\n");
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ret = domain_add_dev_info(si_domain, pdev);
|
ret = domain_add_dev_info(si_domain, pdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
Loading…
Reference in a new issue