diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 16:43:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 16:43:24 -0400 |
commit | a3da5bf84a97d48cfaf66c6842470fc403da5121 (patch) | |
tree | cdf66c0cff8c61eedd60601fc9dffdd1ed39b880 /drivers/pci/intel-iommu.c | |
parent | 3b23e665b68387f5ee7b21f7b75ceea4d9acae4a (diff) | |
parent | d59fdcf2ac501de99c3dfb452af5e254d4342886 (diff) |
Merge branch 'x86/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (821 commits)
x86: make 64bit hpet_set_mapping to use ioremap too, v2
x86: get x86_phys_bits early
x86: max_low_pfn_mapped fix #4
x86: change _node_to_cpumask_ptr to return const ptr
x86: I/O APIC: remove an IRQ2-mask hack
x86: fix numaq_tsc_disable calling
x86, e820: remove end_user_pfn
x86: max_low_pfn_mapped fix, #3
x86: max_low_pfn_mapped fix, #2
x86: max_low_pfn_mapped fix, #1
x86_64: fix delayed signals
x86: remove conflicting nx6325 and nx6125 quirks
x86: Recover timer_ack lost in the merge of the NMI watchdog
x86: I/O APIC: Never configure IRQ2
x86: L-APIC: Always fully configure IRQ0
x86: L-APIC: Set IRQ0 as edge-triggered
x86: merge dwarf2 headers
x86: use AS_CFI instead of UNWIND_INFO
x86: use ignore macro instead of hash comment
x86: use matching CFI_ENDPROC
...
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r-- | drivers/pci/intel-iommu.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 66c0fd21894b..bb0642318a95 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1637,12 +1637,43 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr, | |||
1637 | } | 1637 | } |
1638 | 1638 | ||
1639 | #ifdef CONFIG_DMAR_GFX_WA | 1639 | #ifdef CONFIG_DMAR_GFX_WA |
1640 | extern int arch_get_ram_range(int slot, u64 *addr, u64 *size); | 1640 | struct iommu_prepare_data { |
1641 | struct pci_dev *pdev; | ||
1642 | int ret; | ||
1643 | }; | ||
1644 | |||
1645 | static int __init iommu_prepare_work_fn(unsigned long start_pfn, | ||
1646 | unsigned long end_pfn, void *datax) | ||
1647 | { | ||
1648 | struct iommu_prepare_data *data; | ||
1649 | |||
1650 | data = (struct iommu_prepare_data *)datax; | ||
1651 | |||
1652 | data->ret = iommu_prepare_identity_map(data->pdev, | ||
1653 | start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT); | ||
1654 | return data->ret; | ||
1655 | |||
1656 | } | ||
1657 | |||
1658 | static int __init iommu_prepare_with_active_regions(struct pci_dev *pdev) | ||
1659 | { | ||
1660 | int nid; | ||
1661 | struct iommu_prepare_data data; | ||
1662 | |||
1663 | data.pdev = pdev; | ||
1664 | data.ret = 0; | ||
1665 | |||
1666 | for_each_online_node(nid) { | ||
1667 | work_with_active_regions(nid, iommu_prepare_work_fn, &data); | ||
1668 | if (data.ret) | ||
1669 | return data.ret; | ||
1670 | } | ||
1671 | return data.ret; | ||
1672 | } | ||
1673 | |||
1641 | static void __init iommu_prepare_gfx_mapping(void) | 1674 | static void __init iommu_prepare_gfx_mapping(void) |
1642 | { | 1675 | { |
1643 | struct pci_dev *pdev = NULL; | 1676 | struct pci_dev *pdev = NULL; |
1644 | u64 base, size; | ||
1645 | int slot; | ||
1646 | int ret; | 1677 | int ret; |
1647 | 1678 | ||
1648 | for_each_pci_dev(pdev) { | 1679 | for_each_pci_dev(pdev) { |
@@ -1651,17 +1682,9 @@ static void __init iommu_prepare_gfx_mapping(void) | |||
1651 | continue; | 1682 | continue; |
1652 | printk(KERN_INFO "IOMMU: gfx device %s 1-1 mapping\n", | 1683 | printk(KERN_INFO "IOMMU: gfx device %s 1-1 mapping\n", |
1653 | pci_name(pdev)); | 1684 | pci_name(pdev)); |
1654 | slot = arch_get_ram_range(0, &base, &size); | 1685 | ret = iommu_prepare_with_active_regions(pdev); |
1655 | while (slot >= 0) { | 1686 | if (ret) |
1656 | ret = iommu_prepare_identity_map(pdev, | 1687 | printk(KERN_ERR "IOMMU: mapping reserved region failed\n"); |
1657 | base, base + size); | ||
1658 | if (ret) | ||
1659 | goto error; | ||
1660 | slot = arch_get_ram_range(slot, &base, &size); | ||
1661 | } | ||
1662 | continue; | ||
1663 | error: | ||
1664 | printk(KERN_ERR "IOMMU: mapping reserved region failed\n"); | ||
1665 | } | 1688 | } |
1666 | } | 1689 | } |
1667 | #endif | 1690 | #endif |