mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <mulix@mulix.org>
To: Andi Kleen <ak@suse.de>
Cc: Jon Mason <jdmason@us.ibm.com>, Muli Ben-Yehuda <MULI@il.ibm.com>,
	Linux-Kernel <linux-kernel@vger.kernel.org>,
	discuss@x86-64.org, Andrew Morton <akpm@osdl.org>
Subject: [RFC PATCH 3/3] x86-64: Calgary IOMMU - hook it in
Date: Tue, 14 Mar 2006 10:26:34 +0200	[thread overview]
Message-ID: <20060314082634.GG23631@granada.merseine.nu> (raw)
In-Reply-To: <20060314082552.GF23631@granada.merseine.nu>

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

Signed-Off-By: Muli Ben-Yehuda <mulix@mulix.org>
Signed-Off-By: Jon Mason <jdmason@us.ibm.com>

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/


  reply	other threads:[~2006-03-14  8:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-14  8:24 [RFC PATCH 1/3] x86-64: Calgary IOMMU - introduce iommu_detected Muli Ben-Yehuda
2006-03-14  8:25 ` [PATCH RFC 2/3] x86-64: Calgary IOMMU - Calgary specific bits Muli Ben-Yehuda
2006-03-14  8:26   ` Muli Ben-Yehuda [this message]
2006-03-14 23:03     ` [RFC PATCH 3/3] x86-64: Calgary IOMMU - hook it in Pavel Machek
2006-03-14 23:22       ` Jon Mason
2006-03-14 23:26         ` Pavel Machek
2006-03-15  0:06           ` Jon Mason
2006-03-15  1:38             ` Muli Ben-Yehuda
2006-03-14 23:03   ` [PATCH RFC 2/3] x86-64: Calgary IOMMU - Calgary specific bits Pavel Machek
2006-03-15  0:55     ` Jon Mason
2006-03-15  0:56       ` Olof Johansson
2006-03-15  1:27         ` Jon Mason
2006-03-15  3:18           ` Olof Johansson
2006-03-15  1:52         ` Muli Ben-Yehuda
2006-03-14 15:01 ` [RFC PATCH 1/3] x86-64: Calgary IOMMU - introduce iommu_detected Andi Kleen
2006-03-14 15:07   ` Muli Ben-Yehuda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060314082634.GG23631@granada.merseine.nu \
    --to=mulix@mulix.org \
    --cc=MULI@il.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=discuss@x86-64.org \
    --cc=jdmason@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®