From 21be27554f5d77ee386948881d12c713f73910bb Mon Sep 17 00:00:00 2001 From: "Keshavamurthy, Anil S" Date: Sun, 21 Oct 2007 16:41:57 -0700 Subject: [PATCH] --- yaml --- r: 71975 b: refs/heads/master c: 49a0429e53f29109cbf1eadd89497286ba81f1ae h: refs/heads/master i: 71973: 94b803fd0f812ea1b7c128b6274f25e554989513 71971: 36274560dc219c8a6bfa93b4e55f13cbae3affc1 71967: 8266552af96d29de043b3fcddd5ce80f1be719e2 v: v3 --- [refs] | 2 +- trunk/arch/x86_64/Kconfig | 10 ++++++++++ trunk/drivers/pci/intel-iommu.c | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 55dc47c25679..0f2c789a2fd4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e820482cd2621dba60e403af1c54502daa54b220 +refs/heads/master: 49a0429e53f29109cbf1eadd89497286ba81f1ae diff --git a/trunk/arch/x86_64/Kconfig b/trunk/arch/x86_64/Kconfig index 5cf941774347..c2d24991bb2b 100644 --- a/trunk/arch/x86_64/Kconfig +++ b/trunk/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/trunk/drivers/pci/intel-iommu.c b/trunk/drivers/pci/intel-iommu.c index 4905e0e3a644..4cca5b939e0e 100644 --- a/trunk/drivers/pci/intel-iommu.c +++ b/trunk/drivers/pci/intel-iommu.c @@ -1632,6 +1632,31 @@ static void __init iommu_prepare_gfx_mapping(void) } #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