Skip to contentSkip to conversation

ppc64: Make the DART "iommu" code more generic

PATCH New Benjamin Herrenschmidt 1 participant 1 message Sep 27, 2004 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc64: Make the DART "iommu" code more generic

Hi !

The "DART" iommu used on Apple U3 chipset will appear into 3rd party products soon, thus the code shouldn't be named "pmac_*" anymore. Also, the explicit config option is no longer needed, there is no reason to build a PowerMac kernel without the iommu support, and it can always be disabled at runtime with a cmdline option for testing or debugging.

This patch do the appropriate renaming and makes the config option implicit & selected when pmac support is included.

(Patch looks big because of the file renaming)

arch/ppc64/Kconfig +4 -9
diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
@@ -78,6 +78,7 @@
 	bool "  Apple G5 based machines"
 	default y
 	select ADB_PMU
+	select U3_DART
 
 config PPC
 	bool
@@ -109,16 +110,10 @@
 	  processors, that is, which share physical processors between
 	  two or more partitions.
 
-config PMAC_DART
-	bool "Enable DART/IOMMU on PowerMac (allow >2G of RAM)"
-	depends on PPC_PMAC
-	depends on EXPERIMENTAL
+config U3_DART
+	bool 
+	depends on PPC_MULTIPLATFORM
 	default n
-	help
-	  Enabling DART makes it possible to boot a PowerMac G5 with more
-	  than 2GB of memory. Note that the code is very new and untested
-	  at this time, so it has to be considered experimental. Enabling
-	  this might result in data loss.
 
 config PPC_PMAC64
 	bool
arch/ppc64/kernel/Makefile +1 -1
diff -Nru a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
@@ -49,7 +49,7 @@
 obj-$(CONFIG_PPC_PMAC)		+= pmac_setup.o pmac_feature.o pmac_pci.o \
 				   pmac_time.o pmac_nvram.o pmac_low_i2c.o \
 				   open_pic_u3.o
-obj-$(CONFIG_PMAC_DART)		+= pmac_iommu.o
+obj-$(CONFIG_U3_DART)		+= u3_iommu.o
 
 ifdef CONFIG_SMP
 obj-$(CONFIG_PPC_PMAC)		+= pmac_smp.o smp-tbsync.o
arch/ppc64/kernel/pmac.h +0 -2
diff -Nru a/arch/ppc64/kernel/pmac.h b/arch/ppc64/kernel/pmac.h
@@ -29,6 +29,4 @@
 
 extern void pmac_nvram_init(void);
 
-extern void pmac_iommu_alloc(void);
-
 #endif /* __PMAC_H__ */
arch/ppc64/kernel/pmac_iommu.c deleted +0 -321

321 lines not on this page · raw message

arch/ppc64/kernel/pmac_pci.c +1 -3
diff -Nru a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c
@@ -664,9 +664,7 @@
 
 	pci_fix_bus_sysdata();
 
-#ifdef CONFIG_PMAC_DART
-	iommu_setup_pmac();
-#endif /* CONFIG_PMAC_DART */
+	iommu_setup_u3();
 
 }
 
arch/ppc64/kernel/pmac_setup.c +0 -10
diff -Nru a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
@@ -447,16 +447,6 @@
 	if (platform != PLATFORM_POWERMAC)
 		return 0;
 
-#ifdef CONFIG_PMAC_DART
-	/*
-	 * On U3, the DART (iommu) must be allocated now since it
-	 * has an impact on htab_initialize (due to the large page it
-	 * occupies having to be broken up so the DART itself is not
-	 * part of the cacheable linar mapping
-	 */
-	pmac_iommu_alloc();
-#endif /* CONFIG_PMAC_DART */
-
 	return 1;
 }
 
arch/ppc64/kernel/prom_init.c +0 -7
diff -Nru a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
@@ -423,13 +423,6 @@
 		else if (!strncmp(opt, RELOC("force"), 5))
 			RELOC(iommu_force_on) = 1;
 	}
-
-#ifndef CONFIG_PMAC_DART
-	if (RELOC(of_platform) == PLATFORM_POWERMAC) {
-		RELOC(ppc64_iommu_off) = 1;
-		prom_printf("DART disabled on PowerMac !\n");
-	}
-#endif
 }
 
 /*
arch/ppc64/kernel/setup.c +11 -0
diff -Nru a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
@@ -50,6 +50,7 @@
 #include <asm/setup.h>
 #include <asm/system.h>
 #include <asm/rtas.h>
+#include <asm/iommu.h>
 
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
@@ -404,6 +405,16 @@
 	EARLY_DEBUG_INIT();
 
 	DBG("Found, Initializing memory management...\n");
+
+#ifdef CONFIG_U3_DART
+	/*
+	 * On U3, the DART (iommu) must be allocated now since it
+	 * has an impact on htab_initialize (due to the large page it
+	 * occupies having to be broken up so the DART itself is not
+	 * part of the cacheable linar mapping
+	 */
+	alloc_u3_dart_table();
+#endif /* CONFIG_U3_DART */
 
 	/*
 	 * Initialize stab / SLB management
arch/ppc64/kernel/u3_iommu.c new file +321 -0

321 lines not on this page · raw message

arch/ppc64/mm/hash_utils.c +4 -4
diff -Nru a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c
@@ -71,9 +71,9 @@
  *
  */
 
-#ifdef CONFIG_PMAC_DART
+#ifdef CONFIG_U3_DART
 extern unsigned long dart_tablebase;
-#endif /* CONFIG_PMAC_DART */
+#endif /* CONFIG_U3_DART */
 
 HTAB htab_data = {NULL, 0, 0, 0, 0};
 
@@ -203,7 +203,7 @@
 
 		DBG("creating mapping for region: %lx : %lx\n", base, size);
 
-#ifdef CONFIG_PMAC_DART
+#ifdef CONFIG_U3_DART
 		/* Do not map the DART space. Fortunately, it will be aligned
 		 * in such a way that it will not cross two lmb regions and will
 		 * fit within a single 16Mb page.
@@ -223,7 +223,7 @@
 						   mode_rw, use_largepages);
 			continue;
 		}
-#endif /* CONFIG_PMAC_DART */
+#endif /* CONFIG_U3_DART */
 		create_pte_mapping(base, base + size, mode_rw, use_largepages);
 	}
 	DBG(" <- htab_initialize()\n");
include/asm-ppc64/iommu.h +3 -1
diff -Nru a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
@@ -108,7 +108,7 @@
 
 /* Walks all buses and creates iommu tables */
 extern void iommu_setup_pSeries(void);
-extern void iommu_setup_pmac(void);
+extern void iommu_setup_u3(void);
 
 /* Creates table for an individual device node */
 extern void iommu_devnode_init(struct device_node *dn);
@@ -154,6 +154,8 @@
 
 extern void pci_iommu_init(void);
 extern void pci_dma_init_direct(void);
+
+extern void alloc_u3_dart_table(void);
 
 extern int ppc64_iommu_off;