[RFC PATCH 3/3] x86-64: Calgary IOMMU - hook it in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch hooks Calgary into the build and the x86-64 IOMMU
initialization paths.

Signed-Off-By: Muli Ben-Yehuda <[email protected]>
Signed-Off-By: Jon Mason <[email protected]>

diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/arch/x86_64/Kconfig linux/arch/x86_64/Kconfig
--- iommu_detected/arch/x86_64/Kconfig	2006-03-14 08:58:23.000000000 +0200
+++ linux/arch/x86_64/Kconfig	2006-03-12 10:49:04.000000000 +0200
@@ -372,6 +372,16 @@ config GART_IOMMU
 	  and a software emulation used on other systems.
 	  If unsure, say Y.
 
+config CALGARY_IOMMU
+	bool "IBM x366 server IOMMU"
+	default y
+	depends on PCI && MPSC && EXPERIMENTAL
+	help
+	  Support for hardware IOMMUs in IBM's x366 server
+	  systems. The IOMMU can be turned off at runtime with the
+	  iommu=off parameter. Normally the kernel will make the right
+	  choice by itself.  If unsure, say Y.
+
 # need this always enabled with GART_IOMMU for the VIA workaround
 config SWIOTLB
 	bool
diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/arch/x86_64/kernel/Makefile linux/arch/x86_64/kernel/Makefile
--- iommu_detected/arch/x86_64/kernel/Makefile	2006-03-14 08:58:23.000000000 +0200
+++ linux/arch/x86_64/kernel/Makefile	2006-02-27 14:20:28.000000000 +0200
@@ -29,6 +29,7 @@ obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspen
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
+obj-$(CONFIG_CALGARY_IOMMU)	+= pci-calgary.o tce.o
 obj-$(CONFIG_SWIOTLB)		+= pci-swiotlb.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_X86_PM_TIMER)	+= pmtimer.o
diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/arch/x86_64/kernel/pci-dma.c linux/arch/x86_64/kernel/pci-dma.c
--- iommu_detected/arch/x86_64/kernel/pci-dma.c	2006-03-14 09:05:48.000000000 +0200
+++ linux/arch/x86_64/kernel/pci-dma.c	2006-03-14 09:21:46.000000000 +0200
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <asm/io.h>
 #include <asm/proto.h>
+#include <asm/calgary.h>
 
 int iommu_merge __read_mostly = 0;
 EXPORT_SYMBOL(iommu_merge);
@@ -270,3 +271,21 @@ __init int iommu_setup(char *p)
     }
     return 1;
 }
+
+static int __init pci_iommu_init(void)
+{
+	int rc = 0;
+
+#ifdef CONFIG_GART_IOMMU
+	rc = gart_iommu_init();
+	if (!rc) /* success? */
+		return 0;
+#endif
+#ifdef CONFIG_CALGARY_IOMMU
+	rc = calgary_iommu_init();
+#endif
+	return rc;
+}
+
+/* Must execute after PCI subsystem */
+fs_initcall(pci_iommu_init);
diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/arch/x86_64/kernel/pci-gart.c linux/arch/x86_64/kernel/pci-gart.c
--- iommu_detected/arch/x86_64/kernel/pci-gart.c	2006-03-14 09:06:44.000000000 +0200
+++ linux/arch/x86_64/kernel/pci-gart.c	2006-03-14 09:23:21.000000000 +0200
@@ -605,7 +605,7 @@ static struct dma_mapping_ops gart_dma_o
 	.unmap_sg = gart_unmap_sg,
 };
 
-static int __init pci_iommu_init(void)
+int __init gart_iommu_init(void)
 { 
 	struct agp_kern_info info;
 	unsigned long aper_size;
@@ -725,10 +725,7 @@ static int __init pci_iommu_init(void)
 	return 0;
 } 
 
-/* Must execute after PCI subsystem */
-fs_initcall(pci_iommu_init);
-
-void gart_parse_options(char *p)
+void __init gart_parse_options(char *p)
 {
 	int arg;
 
diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/arch/x86_64/kernel/setup.c linux/arch/x86_64/kernel/setup.c
--- iommu_detected/arch/x86_64/kernel/setup.c	2006-03-14 08:58:23.000000000 +0200
+++ linux/arch/x86_64/kernel/setup.c	2006-03-12 19:35:24.000000000 +0200
@@ -67,6 +67,7 @@
 #include <asm/swiotlb.h>
 #include <asm/sections.h>
 #include <asm/gart-mapping.h>
+#include <asm/calgary.h>
 
 /*
  * Machine setup..
@@ -388,6 +389,12 @@ static __init void parse_cmdline_early (
 			iommu_setup(from+6); 
 		}
 
+#ifdef CONFIG_CALGARY_IOMMU 
+		if (!memcmp(from,"calgary=",8)) { 
+			calgary_parse_options(from+8);
+		}
+#endif
+
 		if (!memcmp(from,"oops=panic", 10))
 			panic_on_oops = 1;
 
@@ -747,6 +754,9 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_GART_IOMMU
 	iommu_hole_init();
 #endif
+#ifdef CONFIG_CALGARY_IOMMU
+	detect_calgary();
+#endif
 
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/include/asm-x86_64/pci.h linux/include/asm-x86_64/pci.h
--- iommu_detected/include/asm-x86_64/pci.h	2006-03-14 08:59:45.000000000 +0200
+++ linux/include/asm-x86_64/pci.h	2006-03-01 16:18:14.000000000 +0200
@@ -53,7 +53,7 @@ extern int iommu_setup(char *opt);
  */
 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
 
-#ifdef CONFIG_GART_IOMMU
+#if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
 
 /*
  * x86-64 always supports DAC, but sometimes it is useful to force
diff -Naurp --exclude-from /home/muli/w/dontdiff iommu_detected/include/asm-x86_64/proto.h linux/include/asm-x86_64/proto.h
--- iommu_detected/include/asm-x86_64/proto.h	2006-03-14 08:59:45.000000000 +0200
+++ linux/include/asm-x86_64/proto.h	2006-03-14 08:50:10.000000000 +0200
@@ -104,7 +104,9 @@ extern int unsynchronized_tsc(void);
 extern void select_idle_routine(const struct cpuinfo_x86 *c);
 
 extern void gart_parse_options(char *);
-extern void __init no_iommu_init(void);
+extern int gart_iommu_init(void);
+extern void no_iommu_init(void);
+extern void detect_calgary(void);
 
 extern unsigned long table_start, table_end;
 

-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux