Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=49a0429e53f29109cbf1eadd89497286ba81f1ae
Commit:     49a0429e53f29109cbf1eadd89497286ba81f1ae
Parent:     e820482cd2621dba60e403af1c54502daa54b220
Author:     Keshavamurthy, Anil S <[EMAIL PROTECTED]>
AuthorDate: Sun Oct 21 16:41:57 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Oct 22 08:13:19 2007 -0700

    Intel IOMMU: Iommu floppy workaround
    
    This config option (DMAR_FLPY_WA) sets up 1:1 mapping for the floppy device 
so
    that the floppy device which does not use DMA api's will continue to work.
    
    Once the floppy driver starts using DMA api's this config option can be turn
    off or this patch can be yanked out of kernel at that time.
    
    [EMAIL PROTECTED]: cleanups, rename things, build fix]
    [EMAIL PROTECTED]: Kconfig fixes]
    Signed-off-by: Anil S Keshavamurthy <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Cc: Peter Zijlstra <[EMAIL PROTECTED]>
    Cc: Muli Ben-Yehuda <[EMAIL PROTECTED]>
    Cc: "Siddha, Suresh B" <[EMAIL PROTECTED]>
    Cc: Arjan van de Ven <[EMAIL PROTECTED]>
    Cc: Ashok Raj <[EMAIL PROTECTED]>
    Cc: "David S. Miller" <[EMAIL PROTECTED]>
    Cc: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: Greg KH <[EMAIL PROTECTED]>
    Signed-off-by: Jan Engelhardt <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/x86_64/Kconfig       |   10 ++++++++++
 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 5cf9417..c2d2499 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -772,6 +772,16 @@ config DMAR_GFX_WA
         all the OS-visible memory. Hence the driver can continue
         to use physical addresses for DMA.
 
+config DMAR_FLOPPY_WA
+       bool
+       depends on DMAR
+       default y
+       help
+        Floppy disk drivers are know to bypass DMA API calls
+        thereby failing to work when IOMMU is enabled. This
+        workaround will setup a 1:1 mapping for the first
+        16M to make floppy (an ISA device) work.
+
 source "drivers/pci/pcie/Kconfig"
 
 source "drivers/pci/Kconfig"
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 4905e0e..4cca5b9 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -1632,6 +1632,31 @@ error:
 }
 #endif
 
+#ifdef CONFIG_DMAR_FLOPPY_WA
+static inline void iommu_prepare_isa(void)
+{
+       struct pci_dev *pdev;
+       int ret;
+
+       pdev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
+       if (!pdev)
+               return;
+
+       printk(KERN_INFO "IOMMU: Prepare 0-16M unity mapping for LPC\n");
+       ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
+
+       if (ret)
+               printk("IOMMU: Failed to create 0-64M identity map, "
+                       "floppy might not work\n");
+
+}
+#else
+static inline void iommu_prepare_isa(void)
+{
+       return;
+}
+#endif /* !CONFIG_DMAR_FLPY_WA */
+
 int __init init_dmars(void)
 {
        struct dmar_drhd_unit *drhd;
@@ -1697,6 +1722,8 @@ int __init init_dmars(void)
 
        iommu_prepare_gfx_mapping();
 
+       iommu_prepare_isa();
+
        /*
         * for each drhd
         *   enable fault log
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to