diff options
-rw-r--r-- | arch/x86_64/Kconfig | 10 | ||||
-rw-r--r-- | drivers/pci/intel-iommu.c | 27 |
2 files changed, 37 insertions, 0 deletions
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 5cf941774347..c2d24991bb2b 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -772,6 +772,16 @@ config DMAR_GFX_WA | |||
772 | all the OS-visible memory. Hence the driver can continue | 772 | all the OS-visible memory. Hence the driver can continue |
773 | to use physical addresses for DMA. | 773 | to use physical addresses for DMA. |
774 | 774 | ||
775 | config DMAR_FLOPPY_WA | ||
776 | bool | ||
777 | depends on DMAR | ||
778 | default y | ||
779 | help | ||
780 | Floppy disk drivers are know to bypass DMA API calls | ||
781 | thereby failing to work when IOMMU is enabled. This | ||
782 | workaround will setup a 1:1 mapping for the first | ||
783 | 16M to make floppy (an ISA device) work. | ||
784 | |||
775 | source "drivers/pci/pcie/Kconfig" | 785 | source "drivers/pci/pcie/Kconfig" |
776 | 786 | ||
777 | source "drivers/pci/Kconfig" | 787 | source "drivers/pci/Kconfig" |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 4905e0e3a644..4cca5b939e0e 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1632,6 +1632,31 @@ error: | |||
1632 | } | 1632 | } |
1633 | #endif | 1633 | #endif |
1634 | 1634 | ||
1635 | #ifdef CONFIG_DMAR_FLOPPY_WA | ||
1636 | static inline void iommu_prepare_isa(void) | ||
1637 | { | ||
1638 | struct pci_dev *pdev; | ||
1639 | int ret; | ||
1640 | |||
1641 | pdev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); | ||
1642 | if (!pdev) | ||
1643 | return; | ||
1644 | |||
1645 | printk(KERN_INFO "IOMMU: Prepare 0-16M unity mapping for LPC\n"); | ||
1646 | ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024); | ||
1647 | |||
1648 | if (ret) | ||
1649 | printk("IOMMU: Failed to create 0-64M identity map, " | ||
1650 | "floppy might not work\n"); | ||
1651 | |||
1652 | } | ||
1653 | #else | ||
1654 | static inline void iommu_prepare_isa(void) | ||
1655 | { | ||
1656 | return; | ||
1657 | } | ||
1658 | #endif /* !CONFIG_DMAR_FLPY_WA */ | ||
1659 | |||
1635 | int __init init_dmars(void) | 1660 | int __init init_dmars(void) |
1636 | { | 1661 | { |
1637 | struct dmar_drhd_unit *drhd; | 1662 | struct dmar_drhd_unit *drhd; |
@@ -1697,6 +1722,8 @@ int __init init_dmars(void) | |||
1697 | 1722 | ||
1698 | iommu_prepare_gfx_mapping(); | 1723 | iommu_prepare_gfx_mapping(); |
1699 | 1724 | ||
1725 | iommu_prepare_isa(); | ||
1726 | |||
1700 | /* | 1727 | /* |
1701 | * for each drhd | 1728 | * for each drhd |
1702 | * enable fault log | 1729 | * enable fault log |