aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 358dd406fe2..4905e0e3a64 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -1602,6 +1602,36 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr,
1602 rmrr->end_address + 1); 1602 rmrr->end_address + 1);
1603} 1603}
1604 1604
1605#ifdef CONFIG_DMAR_GFX_WA
1606extern int arch_get_ram_range(int slot, u64 *addr, u64 *size);
1607static void __init iommu_prepare_gfx_mapping(void)
1608{
1609 struct pci_dev *pdev = NULL;
1610 u64 base, size;
1611 int slot;
1612 int ret;
1613
1614 for_each_pci_dev(pdev) {
1615 if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO ||
1616 !IS_GFX_DEVICE(pdev))
1617 continue;
1618 printk(KERN_INFO "IOMMU: gfx device %s 1-1 mapping\n",
1619 pci_name(pdev));
1620 slot = arch_get_ram_range(0, &base, &size);
1621 while (slot >= 0) {
1622 ret = iommu_prepare_identity_map(pdev,
1623 base, base + size);
1624 if (ret)
1625 goto error;
1626 slot = arch_get_ram_range(slot, &base, &size);
1627 }
1628 continue;
1629error:
1630 printk(KERN_ERR "IOMMU: mapping reserved region failed\n");
1631 }
1632}
1633#endif
1634
1605int __init init_dmars(void) 1635int __init init_dmars(void)
1606{ 1636{
1607 struct dmar_drhd_unit *drhd; 1637 struct dmar_drhd_unit *drhd;
@@ -1665,6 +1695,8 @@ int __init init_dmars(void)
1665 } 1695 }
1666 } 1696 }
1667 1697
1698 iommu_prepare_gfx_mapping();
1699
1668 /* 1700 /*
1669 * for each drhd 1701 * for each drhd
1670 * enable fault log 1702 * enable fault log
@@ -2176,3 +2208,4 @@ int __init intel_iommu_init(void)
2176 dma_ops = &intel_dma_ops; 2208 dma_ops = &intel_dma_ops;
2177 return 0; 2209 return 0;
2178} 2210}
2211