Browse Source

[PATCH] x86_64: Rename IOMMU option, fix help and mark option embedded.

 - Rename the GART_IOMMU option to IOMMU to make clear it's not
   just for AMD
 - Rewrite the help text to better emphatise this fact
 - Make it an embedded option because too many people get it wrong.

To my astonishment I discovered the aacraid driver tests this
symbol directly. This looks quite broken to me - it's an internal
implementation detail of the PCI DMA API. Can the maintainer
please clarify what this test was intended to do?

Cc: linux-scsi@vger.kernel.org
Cc: alan@redhat.com
Cc: markh@osdl.org
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andi Kleen 19 years ago
parent
commit
a813ce432f

+ 16 - 14
arch/x86_64/Kconfig

@@ -386,24 +386,26 @@ config HPET_EMULATE_RTC
 	bool "Provide RTC interrupt"
 	bool "Provide RTC interrupt"
 	depends on HPET_TIMER && RTC=y
 	depends on HPET_TIMER && RTC=y
 
 
-config GART_IOMMU
-	bool "K8 GART IOMMU support"
+# Mark as embedded because too many people got it wrong.
+# The code disables itself when not needed.
+config IOMMU
+	bool "IOMMU support" if EMBEDDED
 	default y
 	default y
 	select SWIOTLB
 	select SWIOTLB
 	select AGP
 	select AGP
 	depends on PCI
 	depends on PCI
 	help
 	help
-	  Support for hardware IOMMU in AMD's Opteron/Athlon64 Processors
-	  and for the bounce buffering software IOMMU.
-	  Needed to run systems with more than 3GB of memory properly with
-	  32-bit PCI devices that do not support DAC (Double Address Cycle).
-	  The IOMMU can be turned off at runtime with the iommu=off parameter.
-  	  Normally the kernel will take the right choice by itself.
-  	  This option includes a driver for the AMD Opteron/Athlon64 IOMMU
-  	  northbridge and a software emulation used on other systems without
-	  hardware IOMMU.  If unsure, say Y.
-
-# need this always selected by GART_IOMMU for the VIA workaround
+	  Support for full DMA access of devices with 32bit memory access only
+	  on systems with more than 3GB. This is usually needed for USB,
+	  sound, many IDE/SATA chipsets and some other devices.
+	  Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
+	  based IOMMU and a software bounce buffer based IOMMU used on Intel
+	  systems and as fallback.
+	  The code is only active when needed (enough memory and limited
+	  device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
+	  too.
+
+# need this always selected by IOMMU for the VIA workaround
 config SWIOTLB
 config SWIOTLB
 	bool
 	bool
 
 
@@ -503,7 +505,7 @@ config REORDER
 
 
 config K8_NB
 config K8_NB
 	def_bool y
 	def_bool y
-	depends on AGP_AMD64 || GART_IOMMU || (PCI && NUMA)
+	depends on AGP_AMD64 || IOMMU || (PCI && NUMA)
 
 
 endmenu
 endmenu
 
 

+ 1 - 1
arch/x86_64/Kconfig.debug

@@ -13,7 +13,7 @@ config DEBUG_RODATA
 	 If in doubt, say "N".
 	 If in doubt, say "N".
 
 
 config IOMMU_DEBUG
 config IOMMU_DEBUG
-       depends on GART_IOMMU && DEBUG_KERNEL
+       depends on IOMMU && DEBUG_KERNEL
        bool "Enable IOMMU debugging"
        bool "Enable IOMMU debugging"
        help
        help
          Force the IOMMU to on even when you have less than 4GB of
          Force the IOMMU to on even when you have less than 4GB of

+ 1 - 1
arch/x86_64/kernel/Makefile

@@ -28,7 +28,7 @@ obj-$(CONFIG_PM)		+= suspend.o
 obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
 obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
-obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
+obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
 obj-$(CONFIG_SWIOTLB)		+= pci-swiotlb.o
 obj-$(CONFIG_SWIOTLB)		+= pci-swiotlb.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_X86_PM_TIMER)	+= pmtimer.o
 obj-$(CONFIG_X86_PM_TIMER)	+= pmtimer.o

+ 1 - 1
arch/x86_64/kernel/io_apic.c

@@ -319,7 +319,7 @@ void __init check_ioapic(void)
 				vendor &= 0xffff;
 				vendor &= 0xffff;
 				switch (vendor) { 
 				switch (vendor) { 
 				case PCI_VENDOR_ID_VIA:
 				case PCI_VENDOR_ID_VIA:
-#ifdef CONFIG_GART_IOMMU
+#ifdef CONFIG_IOMMU
 					if ((end_pfn > MAX_DMA32_PFN ||
 					if ((end_pfn > MAX_DMA32_PFN ||
 					     force_iommu) &&
 					     force_iommu) &&
 					    !iommu_aperture_allowed) {
 					    !iommu_aperture_allowed) {

+ 1 - 1
arch/x86_64/kernel/pci-dma.c

@@ -266,7 +266,7 @@ __init int iommu_setup(char *p)
 		    swiotlb = 1;
 		    swiotlb = 1;
 #endif
 #endif
 
 
-#ifdef CONFIG_GART_IOMMU
+#ifdef CONFIG_IOMMU
 	    gart_parse_options(p);
 	    gart_parse_options(p);
 #endif
 #endif
 
 

+ 1 - 1
arch/x86_64/kernel/setup.c

@@ -702,7 +702,7 @@ void __init setup_arch(char **cmdline_p)
 
 
 	e820_setup_gap();
 	e820_setup_gap();
 
 
-#ifdef CONFIG_GART_IOMMU
+#ifdef CONFIG_IOMMU
 	iommu_hole_init();
 	iommu_hole_init();
 #endif
 #endif
 
 

+ 2 - 2
drivers/char/agp/Kconfig

@@ -55,9 +55,9 @@ config AGP_AMD
 	  X on AMD Irongate, 761, and 762 chipsets.
 	  X on AMD Irongate, 761, and 762 chipsets.
 
 
 config AGP_AMD64
 config AGP_AMD64
-	tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
+	tristate "AMD Opteron/Athlon64 on-CPU GART support" if !IOMMU
 	depends on AGP && X86
 	depends on AGP && X86
-	default y if GART_IOMMU
+	default y if IOMMU
 	help
 	help
 	  This option gives you AGP support for the GLX component of
 	  This option gives you AGP support for the GLX component of
 	  X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
 	  X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.

+ 2 - 2
drivers/char/agp/amd64-agp.c

@@ -292,7 +292,7 @@ static int __devinit aperture_valid(u64 aper, u32 size)
 /*
 /*
  * W*s centric BIOS sometimes only set up the aperture in the AGP
  * W*s centric BIOS sometimes only set up the aperture in the AGP
  * bridge, not the northbridge. On AMD64 this is handled early
  * bridge, not the northbridge. On AMD64 this is handled early
- * in aperture.c, but when GART_IOMMU is not enabled or we run
+ * in aperture.c, but when IOMMU is not enabled or we run
  * on a 32bit kernel this needs to be redone.
  * on a 32bit kernel this needs to be redone.
  * Unfortunately it is impossible to fix the aperture here because it's too late
  * Unfortunately it is impossible to fix the aperture here because it's too late
  * to allocate that much memory. But at least error out cleanly instead of
  * to allocate that much memory. But at least error out cleanly instead of
@@ -775,7 +775,7 @@ static void __exit agp_amd64_cleanup(void)
 
 
 /* On AMD64 the PCI driver needs to initialize this driver early
 /* On AMD64 the PCI driver needs to initialize this driver early
    for the IOMMU, so it has to be called via a backdoor. */
    for the IOMMU, so it has to be called via a backdoor. */
-#ifndef CONFIG_GART_IOMMU
+#ifndef CONFIG_IOMMU
 module_init(agp_amd64_init);
 module_init(agp_amd64_init);
 module_exit(agp_amd64_cleanup);
 module_exit(agp_amd64_cleanup);
 #endif
 #endif

+ 4 - 1
drivers/scsi/aacraid/comminit.c

@@ -104,8 +104,11 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
 	 * always true on real computers. It also has some slight problems
 	 * always true on real computers. It also has some slight problems
 	 * with the GART on x86-64. I've btw never tried DMA from PCI space
 	 * with the GART on x86-64. I've btw never tried DMA from PCI space
 	 * on this platform but don't be surprised if its problematic.
 	 * on this platform but don't be surprised if its problematic.
+	 * [AK: something is very very wrong when a driver tests this symbol.
+ 	 *  Someone should figure out what the comment writer really meant here and fix
+	 *  the code. Or just remove that bad code. ]
 	 */
 	 */
-#ifndef CONFIG_GART_IOMMU
+#ifndef CONFIG_IOMMU
 	if ((num_physpages << (PAGE_SHIFT - 12)) <= AAC_MAX_HOSTPHYSMEMPAGES) {
 	if ((num_physpages << (PAGE_SHIFT - 12)) <= AAC_MAX_HOSTPHYSMEMPAGES) {
 		init->HostPhysMemPages = 
 		init->HostPhysMemPages = 
 			cpu_to_le32(num_physpages << (PAGE_SHIFT-12));
 			cpu_to_le32(num_physpages << (PAGE_SHIFT-12));

+ 1 - 1
include/asm-x86_64/pci.h

@@ -52,7 +52,7 @@ extern int iommu_setup(char *opt);
  */
  */
 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
 
 
-#ifdef CONFIG_GART_IOMMU
+#ifdef CONFIG_IOMMU
 
 
 /*
 /*
  * x86-64 always supports DAC, but sometimes it is useful to force
  * x86-64 always supports DAC, but sometimes it is useful to force

+ 1 - 1
include/asm-x86_64/proto.h

@@ -116,7 +116,7 @@ extern int skip_ioapic_setup;
 extern int acpi_ht;
 extern int acpi_ht;
 extern int acpi_disabled;
 extern int acpi_disabled;
 
 
-#ifdef CONFIG_GART_IOMMU
+#ifdef CONFIG_IOMMU
 extern int fallback_aper_order;
 extern int fallback_aper_order;
 extern int fallback_aper_force;
 extern int fallback_aper_force;
 extern int iommu_aperture;
 extern int iommu_aperture;