ppc64 iommu rewrite part 5/5
PATCH 1/1 ppc64 iommu rewrite part 5/5
Implement support for Apple DART IOMMU (PowerMac G5)
This allows to use more than 2Gb of RAM on a PowerMac G5. You can also boot with iommu=off to disable it, but then you get back the 2Gb RAM limitation.
Ben.
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/02/27 22:37:07+11:00 [email protected]
# PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me
#
# include/asm-ppc64/cacheflush.h # 2004/02/27 22:36:53+11:00 [email protected] +3 -0 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/mm/hash_utils.c # 2004/02/27 22:36:53+11:00 [email protected] +23 -0 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/kernel/prom.c # 2004/02/27 22:36:53+11:00 [email protected] +56 -2 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/kernel/pmac_pci.c # 2004/02/27 22:36:53+11:00 [email protected] +6 -0 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/kernel/misc.S # 2004/02/27 22:36:53+11:00 [email protected] +42 -0 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/kernel/Makefile # 2004/02/27 22:36:53+11:00 [email protected] +2 -0 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/Kconfig # 2004/02/27 22:36:53+11:00 [email protected] +11 -0 # PowerMac G5 DART (iommu) support, by Olof Johansson with some hacks from me # # arch/ppc64/kernel/pmac_iommu.c # 2004/02/27 22:30:15+11:00 [email protected] +301 -0 # # arch/ppc64/kernel/pmac_iommu.c # 2004/02/27 22:30:15+11:00 [email protected] +0 -0 # BitKeeper file /home/benh/kernels/linux-iommu/arch/ppc64/kernel/pmac_iommu.c # diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig --- a/arch/ppc64/Kconfig Fri Feb 27 22:44:57 2004 +++ b/arch/ppc64/Kconfig Fri Feb 27 22:44:57 2004 @@ -89,6 +89,17 @@ bool "Apple PowerMac G5 support" select ADB_PMU
+config PMAC_DART
+ bool "Enable DART/IOMMU on PowerMac (allow >2G of RAM)"
+ depends on PPC_PMAC
+ depends on EXPERIMENTAL
+ 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
depends on PPC_PMAC
arch/ppc64/kernel/Makefile +2 -0
@@ -50,6 +50,8 @@ 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 + ifdef CONFIG_SMP obj-$(CONFIG_PPC_PMAC) += pmac_smp.o smp-tbsync.o endif
arch/ppc64/kernel/misc.S +42 -0
48 lines not on this page · raw message
arch/ppc64/kernel/pmac_iommu.c new file +301 -0
301 lines not on this page · raw message
arch/ppc64/kernel/pmac_pci.c +6 -0
@@ -26,6 +26,7 @@#include <asm/pci-bridge.h> #include <asm/machdep.h> #include <asm/pmac_feature.h> +#include <asm/iommu.h> #include "pci.h" #include "pmac.h"
@@ -655,6 +656,11 @@pci_read_irq_line (dev);pci_fix_bus_sysdata (); + +#ifdef CONFIG_PMAC_DART +iommu_setup_pmac (); +#endif /* CONFIG_PMAC_DART */ + }static void __init pmac_fixup_phb_resources (void )
arch/ppc64/kernel/prom.c +56 -2
82 lines not on this page · raw message
arch/ppc64/mm/hash_utils.c +23 -0
@@ -61,6 +61,10 @@* */ +#ifdef CONFIG_PMAC_DART +extern unsigned long dart_tablebase; +#endif /* CONFIG_PMAC_DART */ +HTAB htab_data = {NULL ,0 ,0 ,0 ,0 };extern unsigned long _SDR1;
@@ -180,6 +184,25 @@ base = lmb.memory.region[i].physbase +KERNELBASE ; size = lmb.memory.region[i].size; +#ifdef CONFIG_PMAC_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. +* The DART space is assumed to be a full 16Mb region even if we +* only use 2Mb of that space. We will use more of it later for +* AGP GART. We have to use a full 16Mb large page. +*/ +if (dart_tablebase !=0 && dart_tablebase >= base + && dart_tablebase < (base + size)) { +if (base != dart_tablebase) +create_pte_mapping (base, dart_tablebase, mode_rw, + use_largepages); +if ((base + size) > (dart_tablebase +16 *MB )) +create_pte_mapping (dart_tablebase +16 *MB , base + size, + mode_rw, use_largepages); +continue ; + } +#endif /* CONFIG_PMAC_DART */ create_pte_mapping (base, base + size, mode_rw, use_largepages); } }
include/asm-ppc64/cacheflush.h +3 -0
@@ -23,6 +23,9 @@ struct page *page, unsigned long addr, int len); +extern void flush_dcache_range (unsigned long start,unsigned long stop); +extern void flush_dcache_phys_range (unsigned long start,unsigned long stop); +#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ do { memcpy(dst, src, len); \ flush_icache_user_range(vma, page, vaddr, len); \