diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/configs/cell_defconfig | 40 | ||||
-rw-r--r-- | arch/powerpc/kernel/cputable.c | 16 | ||||
-rw-r--r-- | arch/powerpc/kernel/kprobes.c | 14 | ||||
-rw-r--r-- | arch/powerpc/kernel/module_64.c | 16 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 70 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 112 | ||||
-rw-r--r-- | arch/powerpc/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 18 | ||||
-rw-r--r-- | arch/powerpc/kernel/systbl.S | 13 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 295 | ||||
-rw-r--r-- | arch/powerpc/mm/init_64.c | 7 | ||||
-rw-r--r-- | arch/powerpc/mm/numa.c | 32 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/Kconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/setup.c | 78 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 101 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_callbacks.c | 13 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/pci.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh_event.c | 8 |
20 files changed, 674 insertions, 185 deletions
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig index fe22e54ab2b0..dbe421dc3c11 100644 --- a/arch/powerpc/configs/cell_defconfig +++ b/arch/powerpc/configs/cell_defconfig | |||
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y | |||
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | ||
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 13 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
13 | CONFIG_PPC=y | 14 | CONFIG_PPC=y |
14 | CONFIG_EARLY_PRINTK=y | 15 | CONFIG_EARLY_PRINTK=y |
@@ -55,6 +56,7 @@ CONFIG_SYSCTL=y | |||
55 | CONFIG_IKCONFIG=y | 56 | CONFIG_IKCONFIG=y |
56 | CONFIG_IKCONFIG_PROC=y | 57 | CONFIG_IKCONFIG_PROC=y |
57 | # CONFIG_CPUSETS is not set | 58 | # CONFIG_CPUSETS is not set |
59 | # CONFIG_RELAY is not set | ||
58 | CONFIG_INITRAMFS_SOURCE="" | 60 | CONFIG_INITRAMFS_SOURCE="" |
59 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 61 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
60 | # CONFIG_EMBEDDED is not set | 62 | # CONFIG_EMBEDDED is not set |
@@ -69,10 +71,6 @@ CONFIG_BASE_FULL=y | |||
69 | CONFIG_FUTEX=y | 71 | CONFIG_FUTEX=y |
70 | CONFIG_EPOLL=y | 72 | CONFIG_EPOLL=y |
71 | CONFIG_SHMEM=y | 73 | CONFIG_SHMEM=y |
72 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
73 | CONFIG_CC_ALIGN_LABELS=0 | ||
74 | CONFIG_CC_ALIGN_LOOPS=0 | ||
75 | CONFIG_CC_ALIGN_JUMPS=0 | ||
76 | CONFIG_SLAB=y | 74 | CONFIG_SLAB=y |
77 | # CONFIG_TINY_SHMEM is not set | 75 | # CONFIG_TINY_SHMEM is not set |
78 | CONFIG_BASE_SMALL=0 | 76 | CONFIG_BASE_SMALL=0 |
@@ -84,7 +82,6 @@ CONFIG_BASE_SMALL=0 | |||
84 | CONFIG_MODULES=y | 82 | CONFIG_MODULES=y |
85 | CONFIG_MODULE_UNLOAD=y | 83 | CONFIG_MODULE_UNLOAD=y |
86 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 84 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
87 | CONFIG_OBSOLETE_MODPARM=y | ||
88 | # CONFIG_MODVERSIONS is not set | 85 | # CONFIG_MODVERSIONS is not set |
89 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 86 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
90 | CONFIG_KMOD=y | 87 | CONFIG_KMOD=y |
@@ -93,6 +90,7 @@ CONFIG_STOP_MACHINE=y | |||
93 | # | 90 | # |
94 | # Block layer | 91 | # Block layer |
95 | # | 92 | # |
93 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
96 | 94 | ||
97 | # | 95 | # |
98 | # IO Schedulers | 96 | # IO Schedulers |
@@ -126,6 +124,7 @@ CONFIG_RTAS_FLASH=y | |||
126 | CONFIG_MMIO_NVRAM=y | 124 | CONFIG_MMIO_NVRAM=y |
127 | CONFIG_CELL_IIC=y | 125 | CONFIG_CELL_IIC=y |
128 | # CONFIG_PPC_MPC106 is not set | 126 | # CONFIG_PPC_MPC106 is not set |
127 | # CONFIG_PPC_970_NAP is not set | ||
129 | # CONFIG_CPU_FREQ is not set | 128 | # CONFIG_CPU_FREQ is not set |
130 | # CONFIG_WANT_EARLY_SERIAL is not set | 129 | # CONFIG_WANT_EARLY_SERIAL is not set |
131 | 130 | ||
@@ -167,7 +166,6 @@ CONFIG_HAVE_MEMORY_PRESENT=y | |||
167 | CONFIG_SPARSEMEM_EXTREME=y | 166 | CONFIG_SPARSEMEM_EXTREME=y |
168 | # CONFIG_MEMORY_HOTPLUG is not set | 167 | # CONFIG_MEMORY_HOTPLUG is not set |
169 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 168 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
170 | CONFIG_MIGRATION=y | ||
171 | # CONFIG_PPC_64K_PAGES is not set | 169 | # CONFIG_PPC_64K_PAGES is not set |
172 | CONFIG_SCHED_SMT=y | 170 | CONFIG_SCHED_SMT=y |
173 | CONFIG_PROC_DEVICETREE=y | 171 | CONFIG_PROC_DEVICETREE=y |
@@ -184,7 +182,6 @@ CONFIG_GENERIC_ISA_DMA=y | |||
184 | # CONFIG_PPC_INDIRECT_PCI is not set | 182 | # CONFIG_PPC_INDIRECT_PCI is not set |
185 | CONFIG_PCI=y | 183 | CONFIG_PCI=y |
186 | CONFIG_PCI_DOMAINS=y | 184 | CONFIG_PCI_DOMAINS=y |
187 | CONFIG_PCI_LEGACY_PROC=y | ||
188 | # CONFIG_PCI_DEBUG is not set | 185 | # CONFIG_PCI_DEBUG is not set |
189 | 186 | ||
190 | # | 187 | # |
@@ -226,6 +223,7 @@ CONFIG_SYN_COOKIES=y | |||
226 | # CONFIG_INET_AH is not set | 223 | # CONFIG_INET_AH is not set |
227 | # CONFIG_INET_ESP is not set | 224 | # CONFIG_INET_ESP is not set |
228 | # CONFIG_INET_IPCOMP is not set | 225 | # CONFIG_INET_IPCOMP is not set |
226 | # CONFIG_INET_XFRM_TUNNEL is not set | ||
229 | CONFIG_INET_TUNNEL=y | 227 | CONFIG_INET_TUNNEL=y |
230 | CONFIG_INET_DIAG=y | 228 | CONFIG_INET_DIAG=y |
231 | CONFIG_INET_TCP_DIAG=y | 229 | CONFIG_INET_TCP_DIAG=y |
@@ -242,6 +240,7 @@ CONFIG_IPV6=y | |||
242 | CONFIG_INET6_AH=m | 240 | CONFIG_INET6_AH=m |
243 | CONFIG_INET6_ESP=m | 241 | CONFIG_INET6_ESP=m |
244 | CONFIG_INET6_IPCOMP=m | 242 | CONFIG_INET6_IPCOMP=m |
243 | CONFIG_INET6_XFRM_TUNNEL=m | ||
245 | CONFIG_INET6_TUNNEL=m | 244 | CONFIG_INET6_TUNNEL=m |
246 | CONFIG_IPV6_TUNNEL=m | 245 | CONFIG_IPV6_TUNNEL=m |
247 | CONFIG_NETFILTER=y | 246 | CONFIG_NETFILTER=y |
@@ -632,6 +631,7 @@ CONFIG_SERIAL_NONSTANDARD=y | |||
632 | # | 631 | # |
633 | CONFIG_SERIAL_8250=y | 632 | CONFIG_SERIAL_8250=y |
634 | CONFIG_SERIAL_8250_CONSOLE=y | 633 | CONFIG_SERIAL_8250_CONSOLE=y |
634 | CONFIG_SERIAL_8250_PCI=y | ||
635 | CONFIG_SERIAL_8250_NR_UARTS=4 | 635 | CONFIG_SERIAL_8250_NR_UARTS=4 |
636 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | 636 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 |
637 | # CONFIG_SERIAL_8250_EXTENDED is not set | 637 | # CONFIG_SERIAL_8250_EXTENDED is not set |
@@ -717,7 +717,6 @@ CONFIG_I2C_ALGOBIT=y | |||
717 | # CONFIG_I2C_PARPORT_LIGHT is not set | 717 | # CONFIG_I2C_PARPORT_LIGHT is not set |
718 | # CONFIG_I2C_PROSAVAGE is not set | 718 | # CONFIG_I2C_PROSAVAGE is not set |
719 | # CONFIG_I2C_SAVAGE4 is not set | 719 | # CONFIG_I2C_SAVAGE4 is not set |
720 | # CONFIG_SCx200_ACB is not set | ||
721 | # CONFIG_I2C_SIS5595 is not set | 720 | # CONFIG_I2C_SIS5595 is not set |
722 | # CONFIG_I2C_SIS630 is not set | 721 | # CONFIG_I2C_SIS630 is not set |
723 | # CONFIG_I2C_SIS96X is not set | 722 | # CONFIG_I2C_SIS96X is not set |
@@ -736,9 +735,7 @@ CONFIG_I2C_ALGOBIT=y | |||
736 | # CONFIG_SENSORS_PCF8574 is not set | 735 | # CONFIG_SENSORS_PCF8574 is not set |
737 | # CONFIG_SENSORS_PCA9539 is not set | 736 | # CONFIG_SENSORS_PCA9539 is not set |
738 | # CONFIG_SENSORS_PCF8591 is not set | 737 | # CONFIG_SENSORS_PCF8591 is not set |
739 | # CONFIG_SENSORS_RTC8564 is not set | ||
740 | # CONFIG_SENSORS_MAX6875 is not set | 738 | # CONFIG_SENSORS_MAX6875 is not set |
741 | # CONFIG_RTC_X1205_I2C is not set | ||
742 | # CONFIG_I2C_DEBUG_CORE is not set | 739 | # CONFIG_I2C_DEBUG_CORE is not set |
743 | # CONFIG_I2C_DEBUG_ALGO is not set | 740 | # CONFIG_I2C_DEBUG_ALGO is not set |
744 | # CONFIG_I2C_DEBUG_BUS is not set | 741 | # CONFIG_I2C_DEBUG_BUS is not set |
@@ -766,10 +763,6 @@ CONFIG_I2C_ALGOBIT=y | |||
766 | # | 763 | # |
767 | 764 | ||
768 | # | 765 | # |
769 | # Multimedia Capabilities Port drivers | ||
770 | # | ||
771 | |||
772 | # | ||
773 | # Multimedia devices | 766 | # Multimedia devices |
774 | # | 767 | # |
775 | # CONFIG_VIDEO_DEV is not set | 768 | # CONFIG_VIDEO_DEV is not set |
@@ -818,6 +811,19 @@ CONFIG_USB_ARCH_HAS_EHCI=y | |||
818 | # CONFIG_MMC is not set | 811 | # CONFIG_MMC is not set |
819 | 812 | ||
820 | # | 813 | # |
814 | # LED devices | ||
815 | # | ||
816 | # CONFIG_NEW_LEDS is not set | ||
817 | |||
818 | # | ||
819 | # LED drivers | ||
820 | # | ||
821 | |||
822 | # | ||
823 | # LED Triggers | ||
824 | # | ||
825 | |||
826 | # | ||
821 | # InfiniBand support | 827 | # InfiniBand support |
822 | # | 828 | # |
823 | CONFIG_INFINIBAND=y | 829 | CONFIG_INFINIBAND=y |
@@ -834,6 +840,11 @@ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y | |||
834 | # | 840 | # |
835 | 841 | ||
836 | # | 842 | # |
843 | # Real Time Clock | ||
844 | # | ||
845 | # CONFIG_RTC_CLASS is not set | ||
846 | |||
847 | # | ||
837 | # File systems | 848 | # File systems |
838 | # | 849 | # |
839 | CONFIG_EXT2_FS=y | 850 | CONFIG_EXT2_FS=y |
@@ -889,7 +900,6 @@ CONFIG_TMPFS=y | |||
889 | CONFIG_HUGETLBFS=y | 900 | CONFIG_HUGETLBFS=y |
890 | CONFIG_HUGETLB_PAGE=y | 901 | CONFIG_HUGETLB_PAGE=y |
891 | CONFIG_RAMFS=y | 902 | CONFIG_RAMFS=y |
892 | # CONFIG_RELAYFS_FS is not set | ||
893 | # CONFIG_CONFIGFS_FS is not set | 903 | # CONFIG_CONFIGFS_FS is not set |
894 | 904 | ||
895 | # | 905 | # |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 39e348a3ade2..3f7182db9ed5 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -57,6 +57,8 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); | |||
57 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) | 57 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) |
58 | #define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\ | 58 | #define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\ |
59 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) | 59 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) |
60 | #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ | ||
61 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) | ||
60 | #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ | 62 | #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ |
61 | PPC_FEATURE_BOOKE) | 63 | PPC_FEATURE_BOOKE) |
62 | 64 | ||
@@ -263,6 +265,20 @@ struct cpu_spec cpu_specs[] = { | |||
263 | .oprofile_type = PPC_OPROFILE_POWER4, | 265 | .oprofile_type = PPC_OPROFILE_POWER4, |
264 | .platform = "power5+", | 266 | .platform = "power5+", |
265 | }, | 267 | }, |
268 | { /* Power6 */ | ||
269 | .pvr_mask = 0xffff0000, | ||
270 | .pvr_value = 0x003e0000, | ||
271 | .cpu_name = "POWER6", | ||
272 | .cpu_features = CPU_FTRS_POWER6, | ||
273 | .cpu_user_features = COMMON_USER_POWER6, | ||
274 | .icache_bsize = 128, | ||
275 | .dcache_bsize = 128, | ||
276 | .num_pmcs = 6, | ||
277 | .cpu_setup = __setup_cpu_power4, | ||
278 | .oprofile_cpu_type = "ppc64/power6", | ||
279 | .oprofile_type = PPC_OPROFILE_POWER4, | ||
280 | .platform = "power6", | ||
281 | }, | ||
266 | { /* Cell Broadband Engine */ | 282 | { /* Cell Broadband Engine */ |
267 | .pvr_mask = 0xffff0000, | 283 | .pvr_mask = 0xffff0000, |
268 | .pvr_value = 0x00700000, | 284 | .pvr_value = 0x00700000, |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 856ef1a832b9..f78866367b70 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -90,15 +90,15 @@ void __kprobes arch_remove_kprobe(struct kprobe *p) | |||
90 | 90 | ||
91 | static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | 91 | static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) |
92 | { | 92 | { |
93 | kprobe_opcode_t insn = *p->ainsn.insn; | ||
94 | |||
95 | regs->msr |= MSR_SE; | 93 | regs->msr |= MSR_SE; |
96 | 94 | ||
97 | /* single step inline if it is a trap variant */ | 95 | /* |
98 | if (is_trap(insn)) | 96 | * On powerpc we should single step on the original |
99 | regs->nip = (unsigned long)p->addr; | 97 | * instruction even if the probed insn is a trap |
100 | else | 98 | * variant as values in regs could play a part in |
101 | regs->nip = (unsigned long)p->ainsn.insn; | 99 | * if the trap is taken or not |
100 | */ | ||
101 | regs->nip = (unsigned long)p->ainsn.insn; | ||
102 | } | 102 | } |
103 | 103 | ||
104 | static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) | 104 | static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 928b8581fcb0..ba34001fca8e 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
@@ -191,11 +191,19 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr, | |||
191 | (void *)hdr | 191 | (void *)hdr |
192 | + sechdrs[sechdrs[i].sh_link].sh_offset); | 192 | + sechdrs[sechdrs[i].sh_link].sh_offset); |
193 | } | 193 | } |
194 | if (!me->arch.stubs_section || !me->arch.toc_section) { | 194 | |
195 | printk("%s: doesn't contain .toc or .stubs.\n", me->name); | 195 | if (!me->arch.stubs_section) { |
196 | printk("%s: doesn't contain .stubs.\n", me->name); | ||
196 | return -ENOEXEC; | 197 | return -ENOEXEC; |
197 | } | 198 | } |
198 | 199 | ||
200 | /* If we don't have a .toc, just use .stubs. We need to set r2 | ||
201 | to some reasonable value in case the module calls out to | ||
202 | other functions via a stub, or if a function pointer escapes | ||
203 | the module by some means. */ | ||
204 | if (!me->arch.toc_section) | ||
205 | me->arch.toc_section = me->arch.stubs_section; | ||
206 | |||
199 | /* Override the stubs size */ | 207 | /* Override the stubs size */ |
200 | sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs); | 208 | sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs); |
201 | return 0; | 209 | return 0; |
@@ -342,7 +350,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
342 | break; | 350 | break; |
343 | 351 | ||
344 | case R_PPC64_TOC16: | 352 | case R_PPC64_TOC16: |
345 | /* Subtact TOC pointer */ | 353 | /* Subtract TOC pointer */ |
346 | value -= my_r2(sechdrs, me); | 354 | value -= my_r2(sechdrs, me); |
347 | if (value + 0x8000 > 0xffff) { | 355 | if (value + 0x8000 > 0xffff) { |
348 | printk("%s: bad TOC16 relocation (%lu)\n", | 356 | printk("%s: bad TOC16 relocation (%lu)\n", |
@@ -355,7 +363,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
355 | break; | 363 | break; |
356 | 364 | ||
357 | case R_PPC64_TOC16_DS: | 365 | case R_PPC64_TOC16_DS: |
358 | /* Subtact TOC pointer */ | 366 | /* Subtract TOC pointer */ |
359 | value -= my_r2(sechdrs, me); | 367 | value -= my_r2(sechdrs, me); |
360 | if ((value & 3) != 0 || value + 0x8000 > 0xffff) { | 368 | if ((value & 3) != 0 || value + 0x8000 > 0xffff) { |
361 | printk("%s: bad TOC16_DS relocation (%lu)\n", | 369 | printk("%s: bad TOC16_DS relocation (%lu)\n", |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 1cb69e8fb0b1..9a07f97f0712 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -885,6 +885,74 @@ void __init unflatten_device_tree(void) | |||
885 | DBG(" <- unflatten_device_tree()\n"); | 885 | DBG(" <- unflatten_device_tree()\n"); |
886 | } | 886 | } |
887 | 887 | ||
888 | /* | ||
889 | * ibm,pa-features is a per-cpu property that contains a string of | ||
890 | * attribute descriptors, each of which has a 2 byte header plus up | ||
891 | * to 254 bytes worth of processor attribute bits. First header | ||
892 | * byte specifies the number of bytes following the header. | ||
893 | * Second header byte is an "attribute-specifier" type, of which | ||
894 | * zero is the only currently-defined value. | ||
895 | * Implementation: Pass in the byte and bit offset for the feature | ||
896 | * that we are interested in. The function will return -1 if the | ||
897 | * pa-features property is missing, or a 1/0 to indicate if the feature | ||
898 | * is supported/not supported. Note that the bit numbers are | ||
899 | * big-endian to match the definition in PAPR. | ||
900 | */ | ||
901 | static struct ibm_pa_feature { | ||
902 | unsigned long cpu_features; /* CPU_FTR_xxx bit */ | ||
903 | unsigned int cpu_user_ftrs; /* PPC_FEATURE_xxx bit */ | ||
904 | unsigned char pabyte; /* byte number in ibm,pa-features */ | ||
905 | unsigned char pabit; /* bit number (big-endian) */ | ||
906 | unsigned char invert; /* if 1, pa bit set => clear feature */ | ||
907 | } ibm_pa_features[] __initdata = { | ||
908 | {0, PPC_FEATURE_HAS_MMU, 0, 0, 0}, | ||
909 | {0, PPC_FEATURE_HAS_FPU, 0, 1, 0}, | ||
910 | {CPU_FTR_SLB, 0, 0, 2, 0}, | ||
911 | {CPU_FTR_CTRL, 0, 0, 3, 0}, | ||
912 | {CPU_FTR_NOEXECUTE, 0, 0, 6, 0}, | ||
913 | {CPU_FTR_NODSISRALIGN, 0, 1, 1, 1}, | ||
914 | {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, | ||
915 | }; | ||
916 | |||
917 | static void __init check_cpu_pa_features(unsigned long node) | ||
918 | { | ||
919 | unsigned char *pa_ftrs; | ||
920 | unsigned long len, tablelen, i, bit; | ||
921 | |||
922 | pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen); | ||
923 | if (pa_ftrs == NULL) | ||
924 | return; | ||
925 | |||
926 | /* find descriptor with type == 0 */ | ||
927 | for (;;) { | ||
928 | if (tablelen < 3) | ||
929 | return; | ||
930 | len = 2 + pa_ftrs[0]; | ||
931 | if (tablelen < len) | ||
932 | return; /* descriptor 0 not found */ | ||
933 | if (pa_ftrs[1] == 0) | ||
934 | break; | ||
935 | tablelen -= len; | ||
936 | pa_ftrs += len; | ||
937 | } | ||
938 | |||
939 | /* loop over bits we know about */ | ||
940 | for (i = 0; i < ARRAY_SIZE(ibm_pa_features); ++i) { | ||
941 | struct ibm_pa_feature *fp = &ibm_pa_features[i]; | ||
942 | |||
943 | if (fp->pabyte >= pa_ftrs[0]) | ||
944 | continue; | ||
945 | bit = (pa_ftrs[2 + fp->pabyte] >> (7 - fp->pabit)) & 1; | ||
946 | if (bit ^ fp->invert) { | ||
947 | cur_cpu_spec->cpu_features |= fp->cpu_features; | ||
948 | cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs; | ||
949 | } else { | ||
950 | cur_cpu_spec->cpu_features &= ~fp->cpu_features; | ||
951 | cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs; | ||
952 | } | ||
953 | } | ||
954 | } | ||
955 | |||
888 | static int __init early_init_dt_scan_cpus(unsigned long node, | 956 | static int __init early_init_dt_scan_cpus(unsigned long node, |
889 | const char *uname, int depth, | 957 | const char *uname, int depth, |
890 | void *data) | 958 | void *data) |
@@ -969,6 +1037,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node, | |||
969 | } | 1037 | } |
970 | #endif /* CONFIG_ALTIVEC */ | 1038 | #endif /* CONFIG_ALTIVEC */ |
971 | 1039 | ||
1040 | check_cpu_pa_features(node); | ||
1041 | |||
972 | #ifdef CONFIG_PPC_PSERIES | 1042 | #ifdef CONFIG_PPC_PSERIES |
973 | if (nthreads > 1) | 1043 | if (nthreads > 1) |
974 | cur_cpu_spec->cpu_features |= CPU_FTR_SMT; | 1044 | cur_cpu_spec->cpu_features |= CPU_FTR_SMT; |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 7e4d54821a07..078fb5533541 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -636,10 +636,96 @@ static void __init early_cmdline_parse(void) | |||
636 | 636 | ||
637 | #ifdef CONFIG_PPC_PSERIES | 637 | #ifdef CONFIG_PPC_PSERIES |
638 | /* | 638 | /* |
639 | * To tell the firmware what our capabilities are, we have to pass | 639 | * There are two methods for telling firmware what our capabilities are. |
640 | * it a fake 32-bit ELF header containing a couple of PT_NOTE sections | 640 | * Newer machines have an "ibm,client-architecture-support" method on the |
641 | * that contain structures that contain the actual values. | 641 | * root node. For older machines, we have to call the "process-elf-header" |
642 | * method in the /packages/elf-loader node, passing it a fake 32-bit | ||
643 | * ELF header containing a couple of PT_NOTE sections that contain | ||
644 | * structures that contain various information. | ||
642 | */ | 645 | */ |
646 | |||
647 | /* | ||
648 | * New method - extensible architecture description vector. | ||
649 | * | ||
650 | * Because the description vector contains a mix of byte and word | ||
651 | * values, we declare it as an unsigned char array, and use this | ||
652 | * macro to put word values in. | ||
653 | */ | ||
654 | #define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ | ||
655 | ((x) >> 8) & 0xff, (x) & 0xff | ||
656 | |||
657 | /* Option vector bits - generic bits in byte 1 */ | ||
658 | #define OV_IGNORE 0x80 /* ignore this vector */ | ||
659 | #define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/ | ||
660 | |||
661 | /* Option vector 1: processor architectures supported */ | ||
662 | #define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */ | ||
663 | #define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */ | ||
664 | #define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */ | ||
665 | #define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */ | ||
666 | #define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */ | ||
667 | #define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */ | ||
668 | |||
669 | /* Option vector 2: Open Firmware options supported */ | ||
670 | #define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */ | ||
671 | |||
672 | /* Option vector 3: processor options supported */ | ||
673 | #define OV3_FP 0x80 /* floating point */ | ||
674 | #define OV3_VMX 0x40 /* VMX/Altivec */ | ||
675 | |||
676 | /* Option vector 5: PAPR/OF options supported */ | ||
677 | #define OV5_LPAR 0x80 /* logical partitioning supported */ | ||
678 | #define OV5_SPLPAR 0x40 /* shared-processor LPAR supported */ | ||
679 | /* ibm,dynamic-reconfiguration-memory property supported */ | ||
680 | #define OV5_DRCONF_MEMORY 0x20 | ||
681 | #define OV5_LARGE_PAGES 0x10 /* large pages supported */ | ||
682 | |||
683 | /* | ||
684 | * The architecture vector has an array of PVR mask/value pairs, | ||
685 | * followed by # option vectors - 1, followed by the option vectors. | ||
686 | */ | ||
687 | static unsigned char ibm_architecture_vec[] = { | ||
688 | W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ | ||
689 | W(0xffff0000), W(0x003e0000), /* POWER6 */ | ||
690 | W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */ | ||
691 | 5 - 1, /* 5 option vectors */ | ||
692 | |||
693 | /* option vector 1: processor architectures supported */ | ||
694 | 3 - 1, /* length */ | ||
695 | 0, /* don't ignore, don't halt */ | ||
696 | OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | | ||
697 | OV1_PPC_2_04 | OV1_PPC_2_05, | ||
698 | |||
699 | /* option vector 2: Open Firmware options supported */ | ||
700 | 34 - 1, /* length */ | ||
701 | OV2_REAL_MODE, | ||
702 | 0, 0, | ||
703 | W(0xffffffff), /* real_base */ | ||
704 | W(0xffffffff), /* real_size */ | ||
705 | W(0xffffffff), /* virt_base */ | ||
706 | W(0xffffffff), /* virt_size */ | ||
707 | W(0xffffffff), /* load_base */ | ||
708 | W(64), /* 128MB min RMA */ | ||
709 | W(0xffffffff), /* full client load */ | ||
710 | 0, /* min RMA percentage of total RAM */ | ||
711 | 48, /* max log_2(hash table size) */ | ||
712 | |||
713 | /* option vector 3: processor options supported */ | ||
714 | 3 - 1, /* length */ | ||
715 | 0, /* don't ignore, don't halt */ | ||
716 | OV3_FP | OV3_VMX, | ||
717 | |||
718 | /* option vector 4: IBM PAPR implementation */ | ||
719 | 2 - 1, /* length */ | ||
720 | 0, /* don't halt */ | ||
721 | |||
722 | /* option vector 5: PAPR/OF options */ | ||
723 | 3 - 1, /* length */ | ||
724 | 0, /* don't ignore, don't halt */ | ||
725 | OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES, | ||
726 | }; | ||
727 | |||
728 | /* Old method - ELF header with PT_NOTE sections */ | ||
643 | static struct fake_elf { | 729 | static struct fake_elf { |
644 | Elf32_Ehdr elfhdr; | 730 | Elf32_Ehdr elfhdr; |
645 | Elf32_Phdr phdr[2]; | 731 | Elf32_Phdr phdr[2]; |
@@ -728,8 +814,26 @@ static struct fake_elf { | |||
728 | 814 | ||
729 | static void __init prom_send_capabilities(void) | 815 | static void __init prom_send_capabilities(void) |
730 | { | 816 | { |
731 | ihandle elfloader; | 817 | ihandle elfloader, root; |
818 | prom_arg_t ret; | ||
819 | |||
820 | root = call_prom("open", 1, 1, ADDR("/")); | ||
821 | if (root != 0) { | ||
822 | /* try calling the ibm,client-architecture-support method */ | ||
823 | if (call_prom_ret("call-method", 3, 2, &ret, | ||
824 | ADDR("ibm,client-architecture-support"), | ||
825 | ADDR(ibm_architecture_vec)) == 0) { | ||
826 | /* the call exists... */ | ||
827 | if (ret) | ||
828 | prom_printf("WARNING: ibm,client-architecture" | ||
829 | "-support call FAILED!\n"); | ||
830 | call_prom("close", 1, 0, root); | ||
831 | return; | ||
832 | } | ||
833 | call_prom("close", 1, 0, root); | ||
834 | } | ||
732 | 835 | ||
836 | /* no ibm,client-architecture-support call, try the old way */ | ||
733 | elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader")); | 837 | elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader")); |
734 | if (elfloader == 0) { | 838 | if (elfloader == 0) { |
735 | prom_printf("couldn't open /packages/elf-loader\n"); | 839 | prom_printf("couldn't open /packages/elf-loader\n"); |
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index bcb83574335b..4a677d1bd4ef 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
@@ -538,7 +538,7 @@ void do_syscall_trace_enter(struct pt_regs *regs) | |||
538 | do_syscall_trace(); | 538 | do_syscall_trace(); |
539 | 539 | ||
540 | if (unlikely(current->audit_context)) | 540 | if (unlikely(current->audit_context)) |
541 | audit_syscall_entry(current, | 541 | audit_syscall_entry( |
542 | #ifdef CONFIG_PPC32 | 542 | #ifdef CONFIG_PPC32 |
543 | AUDIT_ARCH_PPC, | 543 | AUDIT_ARCH_PPC, |
544 | #else | 544 | #else |
@@ -556,8 +556,7 @@ void do_syscall_trace_leave(struct pt_regs *regs) | |||
556 | #endif | 556 | #endif |
557 | 557 | ||
558 | if (unlikely(current->audit_context)) | 558 | if (unlikely(current->audit_context)) |
559 | audit_syscall_exit(current, | 559 | audit_syscall_exit((regs->ccr&0x1000)?AUDITSC_FAILURE:AUDITSC_SUCCESS, |
560 | (regs->ccr&0x1000)?AUDITSC_FAILURE:AUDITSC_SUCCESS, | ||
561 | regs->result); | 560 | regs->result); |
562 | 561 | ||
563 | if ((test_thread_flag(TIF_SYSCALL_TRACE) | 562 | if ((test_thread_flag(TIF_SYSCALL_TRACE) |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 1d93e73a7003..684ab1d49c65 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -516,3 +516,11 @@ void probe_machine(void) | |||
516 | 516 | ||
517 | printk(KERN_INFO "Using %s machine description\n", ppc_md.name); | 517 | printk(KERN_INFO "Using %s machine description\n", ppc_md.name); |
518 | } | 518 | } |
519 | |||
520 | int check_legacy_ioport(unsigned long base_port) | ||
521 | { | ||
522 | if (ppc_md.check_legacy_ioport == NULL) | ||
523 | return 0; | ||
524 | return ppc_md.check_legacy_ioport(base_port); | ||
525 | } | ||
526 | EXPORT_SYMBOL(check_legacy_ioport); | ||
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 13e91c4d70a8..4467c49903b6 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -594,14 +594,6 @@ void ppc64_terminate_msg(unsigned int src, const char *msg) | |||
594 | printk("[terminate]%04x %s\n", src, msg); | 594 | printk("[terminate]%04x %s\n", src, msg); |
595 | } | 595 | } |
596 | 596 | ||
597 | int check_legacy_ioport(unsigned long base_port) | ||
598 | { | ||
599 | if (ppc_md.check_legacy_ioport == NULL) | ||
600 | return 0; | ||
601 | return ppc_md.check_legacy_ioport(base_port); | ||
602 | } | ||
603 | EXPORT_SYMBOL(check_legacy_ioport); | ||
604 | |||
605 | void cpu_die(void) | 597 | void cpu_die(void) |
606 | { | 598 | { |
607 | if (ppc_md.cpu_die) | 599 | if (ppc_md.cpu_die) |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index ed737cacf92d..5bc2585c8036 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -322,13 +322,31 @@ static void register_nodes(void) | |||
322 | } | 322 | } |
323 | } | 323 | } |
324 | } | 324 | } |
325 | |||
326 | int sysfs_add_device_to_node(struct sys_device *dev, int nid) | ||
327 | { | ||
328 | struct node *node = &node_devices[nid]; | ||
329 | return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, | ||
330 | kobject_name(&dev->kobj)); | ||
331 | } | ||
332 | |||
333 | void sysfs_remove_device_from_node(struct sys_device *dev, int nid) | ||
334 | { | ||
335 | struct node *node = &node_devices[nid]; | ||
336 | sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); | ||
337 | } | ||
338 | |||
325 | #else | 339 | #else |
326 | static void register_nodes(void) | 340 | static void register_nodes(void) |
327 | { | 341 | { |
328 | return; | 342 | return; |
329 | } | 343 | } |
344 | |||
330 | #endif | 345 | #endif |
331 | 346 | ||
347 | EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); | ||
348 | EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); | ||
349 | |||
332 | /* Only valid if CPU is present. */ | 350 | /* Only valid if CPU is present. */ |
333 | static ssize_t show_physical_id(struct sys_device *dev, char *buf) | 351 | static ssize_t show_physical_id(struct sys_device *dev, char *buf) |
334 | { | 352 | { |
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index 0b98eea73c5e..cf56a1d499ff 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S | |||
@@ -325,6 +325,19 @@ SYSCALL(unshare) | |||
325 | SYSCALL(splice) | 325 | SYSCALL(splice) |
326 | SYSCALL(tee) | 326 | SYSCALL(tee) |
327 | SYSCALL(vmsplice) | 327 | SYSCALL(vmsplice) |
328 | COMPAT_SYS(openat) | ||
329 | SYSCALL(mkdirat) | ||
330 | SYSCALL(mknodat) | ||
331 | SYSCALL(fchownat) | ||
332 | COMPAT_SYS(futimesat) | ||
333 | SYSX(sys_newfstatat, sys_fstatat64, sys_fstatat64) | ||
334 | SYSCALL(unlinkat) | ||
335 | SYSCALL(renameat) | ||
336 | SYSCALL(linkat) | ||
337 | SYSCALL(symlinkat) | ||
338 | SYSCALL(readlinkat) | ||
339 | SYSCALL(fchmodat) | ||
340 | SYSCALL(faccessat) | ||
328 | 341 | ||
329 | /* | 342 | /* |
330 | * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c | 343 | * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 7370f9f33e29..266b8b2ceac9 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -30,13 +30,66 @@ | |||
30 | #define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT) | 30 | #define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT) |
31 | #define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT) | 31 | #define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT) |
32 | 32 | ||
33 | #ifdef CONFIG_PPC_64K_PAGES | ||
34 | #define HUGEPTE_INDEX_SIZE (PMD_SHIFT-HPAGE_SHIFT) | ||
35 | #else | ||
36 | #define HUGEPTE_INDEX_SIZE (PUD_SHIFT-HPAGE_SHIFT) | ||
37 | #endif | ||
38 | #define PTRS_PER_HUGEPTE (1 << HUGEPTE_INDEX_SIZE) | ||
39 | #define HUGEPTE_TABLE_SIZE (sizeof(pte_t) << HUGEPTE_INDEX_SIZE) | ||
40 | |||
41 | #define HUGEPD_SHIFT (HPAGE_SHIFT + HUGEPTE_INDEX_SIZE) | ||
42 | #define HUGEPD_SIZE (1UL << HUGEPD_SHIFT) | ||
43 | #define HUGEPD_MASK (~(HUGEPD_SIZE-1)) | ||
44 | |||
45 | #define huge_pgtable_cache (pgtable_cache[HUGEPTE_CACHE_NUM]) | ||
46 | |||
47 | /* Flag to mark huge PD pointers. This means pmd_bad() and pud_bad() | ||
48 | * will choke on pointers to hugepte tables, which is handy for | ||
49 | * catching screwups early. */ | ||
50 | #define HUGEPD_OK 0x1 | ||
51 | |||
52 | typedef struct { unsigned long pd; } hugepd_t; | ||
53 | |||
54 | #define hugepd_none(hpd) ((hpd).pd == 0) | ||
55 | |||
56 | static inline pte_t *hugepd_page(hugepd_t hpd) | ||
57 | { | ||
58 | BUG_ON(!(hpd.pd & HUGEPD_OK)); | ||
59 | return (pte_t *)(hpd.pd & ~HUGEPD_OK); | ||
60 | } | ||
61 | |||
62 | static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr) | ||
63 | { | ||
64 | unsigned long idx = ((addr >> HPAGE_SHIFT) & (PTRS_PER_HUGEPTE-1)); | ||
65 | pte_t *dir = hugepd_page(*hpdp); | ||
66 | |||
67 | return dir + idx; | ||
68 | } | ||
69 | |||
70 | static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, | ||
71 | unsigned long address) | ||
72 | { | ||
73 | pte_t *new = kmem_cache_alloc(huge_pgtable_cache, | ||
74 | GFP_KERNEL|__GFP_REPEAT); | ||
75 | |||
76 | if (! new) | ||
77 | return -ENOMEM; | ||
78 | |||
79 | spin_lock(&mm->page_table_lock); | ||
80 | if (!hugepd_none(*hpdp)) | ||
81 | kmem_cache_free(huge_pgtable_cache, new); | ||
82 | else | ||
83 | hpdp->pd = (unsigned long)new | HUGEPD_OK; | ||
84 | spin_unlock(&mm->page_table_lock); | ||
85 | return 0; | ||
86 | } | ||
87 | |||
33 | /* Modelled after find_linux_pte() */ | 88 | /* Modelled after find_linux_pte() */ |
34 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) | 89 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) |
35 | { | 90 | { |
36 | pgd_t *pg; | 91 | pgd_t *pg; |
37 | pud_t *pu; | 92 | pud_t *pu; |
38 | pmd_t *pm; | ||
39 | pte_t *pt; | ||
40 | 93 | ||
41 | BUG_ON(! in_hugepage_area(mm->context, addr)); | 94 | BUG_ON(! in_hugepage_area(mm->context, addr)); |
42 | 95 | ||
@@ -46,26 +99,14 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) | |||
46 | if (!pgd_none(*pg)) { | 99 | if (!pgd_none(*pg)) { |
47 | pu = pud_offset(pg, addr); | 100 | pu = pud_offset(pg, addr); |
48 | if (!pud_none(*pu)) { | 101 | if (!pud_none(*pu)) { |
49 | pm = pmd_offset(pu, addr); | ||
50 | #ifdef CONFIG_PPC_64K_PAGES | 102 | #ifdef CONFIG_PPC_64K_PAGES |
51 | /* Currently, we use the normal PTE offset within full | 103 | pmd_t *pm; |
52 | * size PTE pages, thus our huge PTEs are scattered in | 104 | pm = pmd_offset(pu, addr); |
53 | * the PTE page and we do waste some. We may change | 105 | if (!pmd_none(*pm)) |
54 | * that in the future, but the current mecanism keeps | 106 | return hugepte_offset((hugepd_t *)pm, addr); |
55 | * things much simpler | 107 | #else |
56 | */ | 108 | return hugepte_offset((hugepd_t *)pu, addr); |
57 | if (!pmd_none(*pm)) { | 109 | #endif |
58 | /* Note: pte_offset_* are all equivalent on | ||
59 | * ppc64 as we don't have HIGHMEM | ||
60 | */ | ||
61 | pt = pte_offset_kernel(pm, addr); | ||
62 | return pt; | ||
63 | } | ||
64 | #else /* CONFIG_PPC_64K_PAGES */ | ||
65 | /* On 4k pages, we put huge PTEs in the PMD page */ | ||
66 | pt = (pte_t *)pm; | ||
67 | return pt; | ||
68 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
69 | } | 110 | } |
70 | } | 111 | } |
71 | 112 | ||
@@ -76,8 +117,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) | |||
76 | { | 117 | { |
77 | pgd_t *pg; | 118 | pgd_t *pg; |
78 | pud_t *pu; | 119 | pud_t *pu; |
79 | pmd_t *pm; | 120 | hugepd_t *hpdp = NULL; |
80 | pte_t *pt; | ||
81 | 121 | ||
82 | BUG_ON(! in_hugepage_area(mm->context, addr)); | 122 | BUG_ON(! in_hugepage_area(mm->context, addr)); |
83 | 123 | ||
@@ -87,23 +127,182 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) | |||
87 | pu = pud_alloc(mm, pg, addr); | 127 | pu = pud_alloc(mm, pg, addr); |
88 | 128 | ||
89 | if (pu) { | 129 | if (pu) { |
130 | #ifdef CONFIG_PPC_64K_PAGES | ||
131 | pmd_t *pm; | ||
90 | pm = pmd_alloc(mm, pu, addr); | 132 | pm = pmd_alloc(mm, pu, addr); |
91 | if (pm) { | 133 | if (pm) |
134 | hpdp = (hugepd_t *)pm; | ||
135 | #else | ||
136 | hpdp = (hugepd_t *)pu; | ||
137 | #endif | ||
138 | } | ||
139 | |||
140 | if (! hpdp) | ||
141 | return NULL; | ||
142 | |||
143 | if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr)) | ||
144 | return NULL; | ||
145 | |||
146 | return hugepte_offset(hpdp, addr); | ||
147 | } | ||
148 | |||
149 | static void free_hugepte_range(struct mmu_gather *tlb, hugepd_t *hpdp) | ||
150 | { | ||
151 | pte_t *hugepte = hugepd_page(*hpdp); | ||
152 | |||
153 | hpdp->pd = 0; | ||
154 | tlb->need_flush = 1; | ||
155 | pgtable_free_tlb(tlb, pgtable_free_cache(hugepte, HUGEPTE_CACHE_NUM, | ||
156 | HUGEPTE_TABLE_SIZE-1)); | ||
157 | } | ||
158 | |||
92 | #ifdef CONFIG_PPC_64K_PAGES | 159 | #ifdef CONFIG_PPC_64K_PAGES |
93 | /* See comment in huge_pte_offset. Note that if we ever | 160 | static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, |
94 | * want to put the page size in the PMD, we would have | 161 | unsigned long addr, unsigned long end, |
95 | * to open code our own pte_alloc* function in order | 162 | unsigned long floor, unsigned long ceiling) |
96 | * to populate and set the size atomically | 163 | { |
97 | */ | 164 | pmd_t *pmd; |
98 | pt = pte_alloc_map(mm, pm, addr); | 165 | unsigned long next; |
99 | #else /* CONFIG_PPC_64K_PAGES */ | 166 | unsigned long start; |
100 | pt = (pte_t *)pm; | 167 | |
101 | #endif /* CONFIG_PPC_64K_PAGES */ | 168 | start = addr; |
102 | return pt; | 169 | pmd = pmd_offset(pud, addr); |
103 | } | 170 | do { |
171 | next = pmd_addr_end(addr, end); | ||
172 | if (pmd_none(*pmd)) | ||
173 | continue; | ||
174 | free_hugepte_range(tlb, (hugepd_t *)pmd); | ||
175 | } while (pmd++, addr = next, addr != end); | ||
176 | |||
177 | start &= PUD_MASK; | ||
178 | if (start < floor) | ||
179 | return; | ||
180 | if (ceiling) { | ||
181 | ceiling &= PUD_MASK; | ||
182 | if (!ceiling) | ||
183 | return; | ||
104 | } | 184 | } |
185 | if (end - 1 > ceiling - 1) | ||
186 | return; | ||
105 | 187 | ||
106 | return NULL; | 188 | pmd = pmd_offset(pud, start); |
189 | pud_clear(pud); | ||
190 | pmd_free_tlb(tlb, pmd); | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, | ||
195 | unsigned long addr, unsigned long end, | ||
196 | unsigned long floor, unsigned long ceiling) | ||
197 | { | ||
198 | pud_t *pud; | ||
199 | unsigned long next; | ||
200 | unsigned long start; | ||
201 | |||
202 | start = addr; | ||
203 | pud = pud_offset(pgd, addr); | ||
204 | do { | ||
205 | next = pud_addr_end(addr, end); | ||
206 | #ifdef CONFIG_PPC_64K_PAGES | ||
207 | if (pud_none_or_clear_bad(pud)) | ||
208 | continue; | ||
209 | hugetlb_free_pmd_range(tlb, pud, addr, next, floor, ceiling); | ||
210 | #else | ||
211 | if (pud_none(*pud)) | ||
212 | continue; | ||
213 | free_hugepte_range(tlb, (hugepd_t *)pud); | ||
214 | #endif | ||
215 | } while (pud++, addr = next, addr != end); | ||
216 | |||
217 | start &= PGDIR_MASK; | ||
218 | if (start < floor) | ||
219 | return; | ||
220 | if (ceiling) { | ||
221 | ceiling &= PGDIR_MASK; | ||
222 | if (!ceiling) | ||
223 | return; | ||
224 | } | ||
225 | if (end - 1 > ceiling - 1) | ||
226 | return; | ||
227 | |||
228 | pud = pud_offset(pgd, start); | ||
229 | pgd_clear(pgd); | ||
230 | pud_free_tlb(tlb, pud); | ||
231 | } | ||
232 | |||
233 | /* | ||
234 | * This function frees user-level page tables of a process. | ||
235 | * | ||
236 | * Must be called with pagetable lock held. | ||
237 | */ | ||
238 | void hugetlb_free_pgd_range(struct mmu_gather **tlb, | ||
239 | unsigned long addr, unsigned long end, | ||
240 | unsigned long floor, unsigned long ceiling) | ||
241 | { | ||
242 | pgd_t *pgd; | ||
243 | unsigned long next; | ||
244 | unsigned long start; | ||
245 | |||
246 | /* | ||
247 | * Comments below take from the normal free_pgd_range(). They | ||
248 | * apply here too. The tests against HUGEPD_MASK below are | ||
249 | * essential, because we *don't* test for this at the bottom | ||
250 | * level. Without them we'll attempt to free a hugepte table | ||
251 | * when we unmap just part of it, even if there are other | ||
252 | * active mappings using it. | ||
253 | * | ||
254 | * The next few lines have given us lots of grief... | ||
255 | * | ||
256 | * Why are we testing HUGEPD* at this top level? Because | ||
257 | * often there will be no work to do at all, and we'd prefer | ||
258 | * not to go all the way down to the bottom just to discover | ||
259 | * that. | ||
260 | * | ||
261 | * Why all these "- 1"s? Because 0 represents both the bottom | ||
262 | * of the address space and the top of it (using -1 for the | ||
263 | * top wouldn't help much: the masks would do the wrong thing). | ||
264 | * The rule is that addr 0 and floor 0 refer to the bottom of | ||
265 | * the address space, but end 0 and ceiling 0 refer to the top | ||
266 | * Comparisons need to use "end - 1" and "ceiling - 1" (though | ||
267 | * that end 0 case should be mythical). | ||
268 | * | ||
269 | * Wherever addr is brought up or ceiling brought down, we | ||
270 | * must be careful to reject "the opposite 0" before it | ||
271 | * confuses the subsequent tests. But what about where end is | ||
272 | * brought down by HUGEPD_SIZE below? no, end can't go down to | ||
273 | * 0 there. | ||
274 | * | ||
275 | * Whereas we round start (addr) and ceiling down, by different | ||
276 | * masks at different levels, in order to test whether a table | ||
277 | * now has no other vmas using it, so can be freed, we don't | ||
278 | * bother to round floor or end up - the tests don't need that. | ||
279 | */ | ||
280 | |||
281 | addr &= HUGEPD_MASK; | ||
282 | if (addr < floor) { | ||
283 | addr += HUGEPD_SIZE; | ||
284 | if (!addr) | ||
285 | return; | ||
286 | } | ||
287 | if (ceiling) { | ||
288 | ceiling &= HUGEPD_MASK; | ||
289 | if (!ceiling) | ||
290 | return; | ||
291 | } | ||
292 | if (end - 1 > ceiling - 1) | ||
293 | end -= HUGEPD_SIZE; | ||
294 | if (addr > end - 1) | ||
295 | return; | ||
296 | |||
297 | start = addr; | ||
298 | pgd = pgd_offset((*tlb)->mm, addr); | ||
299 | do { | ||
300 | BUG_ON(! in_hugepage_area((*tlb)->mm->context, addr)); | ||
301 | next = pgd_addr_end(addr, end); | ||
302 | if (pgd_none_or_clear_bad(pgd)) | ||
303 | continue; | ||
304 | hugetlb_free_pud_range(*tlb, pgd, addr, next, floor, ceiling); | ||
305 | } while (pgd++, addr = next, addr != end); | ||
107 | } | 306 | } |
108 | 307 | ||
109 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | 308 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, |
@@ -841,3 +1040,27 @@ repeat: | |||
841 | out: | 1040 | out: |
842 | return err; | 1041 | return err; |
843 | } | 1042 | } |
1043 | |||
1044 | static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags) | ||
1045 | { | ||
1046 | memset(addr, 0, kmem_cache_size(cache)); | ||
1047 | } | ||
1048 | |||
1049 | static int __init hugetlbpage_init(void) | ||
1050 | { | ||
1051 | if (!cpu_has_feature(CPU_FTR_16M_PAGE)) | ||
1052 | return -ENODEV; | ||
1053 | |||
1054 | huge_pgtable_cache = kmem_cache_create("hugepte_cache", | ||
1055 | HUGEPTE_TABLE_SIZE, | ||
1056 | HUGEPTE_TABLE_SIZE, | ||
1057 | SLAB_HWCACHE_ALIGN | | ||
1058 | SLAB_MUST_HWCACHE_ALIGN, | ||
1059 | zero_ctor, NULL); | ||
1060 | if (! huge_pgtable_cache) | ||
1061 | panic("hugetlbpage_init(): could not create hugepte cache\n"); | ||
1062 | |||
1063 | return 0; | ||
1064 | } | ||
1065 | |||
1066 | module_init(hugetlbpage_init); | ||
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index babebd15bdc4..9e30f968c184 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -162,7 +162,14 @@ static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { | |||
162 | }; | 162 | }; |
163 | #endif /* CONFIG_PPC_64K_PAGES */ | 163 | #endif /* CONFIG_PPC_64K_PAGES */ |
164 | 164 | ||
165 | #ifdef CONFIG_HUGETLB_PAGE | ||
166 | /* Hugepages need one extra cache, initialized in hugetlbpage.c. We | ||
167 | * can't put into the tables above, because HPAGE_SHIFT is not compile | ||
168 | * time constant. */ | ||
169 | kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)+1]; | ||
170 | #else | ||
165 | kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; | 171 | kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; |
172 | #endif | ||
166 | 173 | ||
167 | void pgtable_cache_init(void) | 174 | void pgtable_cache_init(void) |
168 | { | 175 | { |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 0a335f34974c..092355f37399 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -194,7 +194,7 @@ static int *of_get_associativity(struct device_node *dev) | |||
194 | /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa | 194 | /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa |
195 | * info is found. | 195 | * info is found. |
196 | */ | 196 | */ |
197 | static int of_node_to_nid(struct device_node *device) | 197 | static int of_node_to_nid_single(struct device_node *device) |
198 | { | 198 | { |
199 | int nid = -1; | 199 | int nid = -1; |
200 | unsigned int *tmp; | 200 | unsigned int *tmp; |
@@ -216,6 +216,28 @@ out: | |||
216 | return nid; | 216 | return nid; |
217 | } | 217 | } |
218 | 218 | ||
219 | /* Walk the device tree upwards, looking for an associativity id */ | ||
220 | int of_node_to_nid(struct device_node *device) | ||
221 | { | ||
222 | struct device_node *tmp; | ||
223 | int nid = -1; | ||
224 | |||
225 | of_node_get(device); | ||
226 | while (device) { | ||
227 | nid = of_node_to_nid_single(device); | ||
228 | if (nid != -1) | ||
229 | break; | ||
230 | |||
231 | tmp = device; | ||
232 | device = of_get_parent(tmp); | ||
233 | of_node_put(tmp); | ||
234 | } | ||
235 | of_node_put(device); | ||
236 | |||
237 | return nid; | ||
238 | } | ||
239 | EXPORT_SYMBOL_GPL(of_node_to_nid); | ||
240 | |||
219 | /* | 241 | /* |
220 | * In theory, the "ibm,associativity" property may contain multiple | 242 | * In theory, the "ibm,associativity" property may contain multiple |
221 | * associativity lists because a resource may be multiply connected | 243 | * associativity lists because a resource may be multiply connected |
@@ -300,7 +322,7 @@ static int __cpuinit numa_setup_cpu(unsigned long lcpu) | |||
300 | goto out; | 322 | goto out; |
301 | } | 323 | } |
302 | 324 | ||
303 | nid = of_node_to_nid(cpu); | 325 | nid = of_node_to_nid_single(cpu); |
304 | 326 | ||
305 | if (nid < 0 || !node_online(nid)) | 327 | if (nid < 0 || !node_online(nid)) |
306 | nid = any_online_node(NODE_MASK_ALL); | 328 | nid = any_online_node(NODE_MASK_ALL); |
@@ -393,7 +415,7 @@ static int __init parse_numa_properties(void) | |||
393 | 415 | ||
394 | cpu = find_cpu_node(i); | 416 | cpu = find_cpu_node(i); |
395 | BUG_ON(!cpu); | 417 | BUG_ON(!cpu); |
396 | nid = of_node_to_nid(cpu); | 418 | nid = of_node_to_nid_single(cpu); |
397 | of_node_put(cpu); | 419 | of_node_put(cpu); |
398 | 420 | ||
399 | /* | 421 | /* |
@@ -437,7 +459,7 @@ new_range: | |||
437 | * have associativity properties. If none, then | 459 | * have associativity properties. If none, then |
438 | * everything goes to default_nid. | 460 | * everything goes to default_nid. |
439 | */ | 461 | */ |
440 | nid = of_node_to_nid(memory); | 462 | nid = of_node_to_nid_single(memory); |
441 | if (nid < 0) | 463 | if (nid < 0) |
442 | nid = default_nid; | 464 | nid = default_nid; |
443 | node_set_online(nid); | 465 | node_set_online(nid); |
@@ -776,7 +798,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr) | |||
776 | ha_new_range: | 798 | ha_new_range: |
777 | start = read_n_cells(n_mem_addr_cells, &memcell_buf); | 799 | start = read_n_cells(n_mem_addr_cells, &memcell_buf); |
778 | size = read_n_cells(n_mem_size_cells, &memcell_buf); | 800 | size = read_n_cells(n_mem_size_cells, &memcell_buf); |
779 | nid = of_node_to_nid(memory); | 801 | nid = of_node_to_nid_single(memory); |
780 | 802 | ||
781 | /* Domains not present at boot default to 0 */ | 803 | /* Domains not present at boot default to 0 */ |
782 | if (nid < 0 || !node_online(nid)) | 804 | if (nid < 0 || !node_online(nid)) |
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig index c2a3db8edb0c..6a02d51086c8 100644 --- a/arch/powerpc/platforms/cell/Kconfig +++ b/arch/powerpc/platforms/cell/Kconfig | |||
@@ -12,7 +12,8 @@ config SPU_FS | |||
12 | 12 | ||
13 | config SPUFS_MMAP | 13 | config SPUFS_MMAP |
14 | bool | 14 | bool |
15 | depends on SPU_FS && SPARSEMEM && !PPC_64K_PAGES | 15 | depends on SPU_FS && SPARSEMEM |
16 | select MEMORY_HOTPLUG | ||
16 | default y | 17 | default y |
17 | 18 | ||
18 | endmenu | 19 | endmenu |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index dac5d0365fde..6574b22b3cf3 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
30 | #include <linux/root_dev.h> | 30 | #include <linux/root_dev.h> |
31 | #include <linux/console.h> | 31 | #include <linux/console.h> |
32 | #include <linux/mutex.h> | ||
33 | #include <linux/memory_hotplug.h> | ||
32 | 34 | ||
33 | #include <asm/mmu.h> | 35 | #include <asm/mmu.h> |
34 | #include <asm/processor.h> | 36 | #include <asm/processor.h> |
@@ -46,6 +48,7 @@ | |||
46 | #include <asm/cputable.h> | 48 | #include <asm/cputable.h> |
47 | #include <asm/ppc-pci.h> | 49 | #include <asm/ppc-pci.h> |
48 | #include <asm/irq.h> | 50 | #include <asm/irq.h> |
51 | #include <asm/spu.h> | ||
49 | 52 | ||
50 | #include "interrupt.h" | 53 | #include "interrupt.h" |
51 | #include "iommu.h" | 54 | #include "iommu.h" |
@@ -69,77 +72,6 @@ static void cell_show_cpuinfo(struct seq_file *m) | |||
69 | of_node_put(root); | 72 | of_node_put(root); |
70 | } | 73 | } |
71 | 74 | ||
72 | #ifdef CONFIG_SPARSEMEM | ||
73 | static int __init find_spu_node_id(struct device_node *spe) | ||
74 | { | ||
75 | unsigned int *id; | ||
76 | #ifdef CONFIG_NUMA | ||
77 | struct device_node *cpu; | ||
78 | cpu = spe->parent->parent; | ||
79 | id = (unsigned int *)get_property(cpu, "node-id", NULL); | ||
80 | #else | ||
81 | id = NULL; | ||
82 | #endif | ||
83 | return id ? *id : 0; | ||
84 | } | ||
85 | |||
86 | static void __init cell_spuprop_present(struct device_node *spe, | ||
87 | const char *prop, int early) | ||
88 | { | ||
89 | struct address_prop { | ||
90 | unsigned long address; | ||
91 | unsigned int len; | ||
92 | } __attribute__((packed)) *p; | ||
93 | int proplen; | ||
94 | |||
95 | unsigned long start_pfn, end_pfn, pfn; | ||
96 | int node_id; | ||
97 | |||
98 | p = (void*)get_property(spe, prop, &proplen); | ||
99 | WARN_ON(proplen != sizeof (*p)); | ||
100 | |||
101 | node_id = find_spu_node_id(spe); | ||
102 | |||
103 | start_pfn = p->address >> PAGE_SHIFT; | ||
104 | end_pfn = (p->address + p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
105 | |||
106 | /* We need to call memory_present *before* the call to sparse_init, | ||
107 | but we can initialize the page structs only *after* that call. | ||
108 | Thus, we're being called twice. */ | ||
109 | if (early) | ||
110 | memory_present(node_id, start_pfn, end_pfn); | ||
111 | else { | ||
112 | /* As the pages backing SPU LS and I/O are outside the range | ||
113 | of regular memory, their page structs were not initialized | ||
114 | by free_area_init. Do it here instead. */ | ||
115 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { | ||
116 | struct page *page = pfn_to_page(pfn); | ||
117 | set_page_links(page, ZONE_DMA, node_id, pfn); | ||
118 | init_page_count(page); | ||
119 | reset_page_mapcount(page); | ||
120 | SetPageReserved(page); | ||
121 | INIT_LIST_HEAD(&page->lru); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static void __init cell_spumem_init(int early) | ||
127 | { | ||
128 | struct device_node *node; | ||
129 | for (node = of_find_node_by_type(NULL, "spe"); | ||
130 | node; node = of_find_node_by_type(node, "spe")) { | ||
131 | cell_spuprop_present(node, "local-store", early); | ||
132 | cell_spuprop_present(node, "problem", early); | ||
133 | cell_spuprop_present(node, "priv1", early); | ||
134 | cell_spuprop_present(node, "priv2", early); | ||
135 | } | ||
136 | } | ||
137 | #else | ||
138 | static void __init cell_spumem_init(int early) | ||
139 | { | ||
140 | } | ||
141 | #endif | ||
142 | |||
143 | static void cell_progress(char *s, unsigned short hex) | 75 | static void cell_progress(char *s, unsigned short hex) |
144 | { | 76 | { |
145 | printk("*** %04x : %s\n", hex, s ? s : ""); | 77 | printk("*** %04x : %s\n", hex, s ? s : ""); |
@@ -172,8 +104,6 @@ static void __init cell_setup_arch(void) | |||
172 | #endif | 104 | #endif |
173 | 105 | ||
174 | mmio_nvram_init(); | 106 | mmio_nvram_init(); |
175 | |||
176 | cell_spumem_init(0); | ||
177 | } | 107 | } |
178 | 108 | ||
179 | /* | 109 | /* |
@@ -189,8 +119,6 @@ static void __init cell_init_early(void) | |||
189 | 119 | ||
190 | ppc64_interrupt_controller = IC_CELL_PIC; | 120 | ppc64_interrupt_controller = IC_CELL_PIC; |
191 | 121 | ||
192 | cell_spumem_init(1); | ||
193 | |||
194 | DBG(" <- cell_init_early()\n"); | 122 | DBG(" <- cell_init_early()\n"); |
195 | } | 123 | } |
196 | 124 | ||
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 269dda4fd0b4..ad141fe8d52d 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -306,19 +306,19 @@ spu_request_irqs(struct spu *spu) | |||
306 | 306 | ||
307 | snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number); | 307 | snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number); |
308 | ret = request_irq(irq_base + spu->isrc, | 308 | ret = request_irq(irq_base + spu->isrc, |
309 | spu_irq_class_0, 0, spu->irq_c0, spu); | 309 | spu_irq_class_0, SA_INTERRUPT, spu->irq_c0, spu); |
310 | if (ret) | 310 | if (ret) |
311 | goto out; | 311 | goto out; |
312 | 312 | ||
313 | snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number); | 313 | snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number); |
314 | ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, | 314 | ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, |
315 | spu_irq_class_1, 0, spu->irq_c1, spu); | 315 | spu_irq_class_1, SA_INTERRUPT, spu->irq_c1, spu); |
316 | if (ret) | 316 | if (ret) |
317 | goto out1; | 317 | goto out1; |
318 | 318 | ||
319 | snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number); | 319 | snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number); |
320 | ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, | 320 | ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, |
321 | spu_irq_class_2, 0, spu->irq_c2, spu); | 321 | spu_irq_class_2, SA_INTERRUPT, spu->irq_c2, spu); |
322 | if (ret) | 322 | if (ret) |
323 | goto out2; | 323 | goto out2; |
324 | goto out; | 324 | goto out; |
@@ -487,10 +487,14 @@ int spu_irq_class_1_bottom(struct spu *spu) | |||
487 | ea = spu->dar; | 487 | ea = spu->dar; |
488 | dsisr = spu->dsisr; | 488 | dsisr = spu->dsisr; |
489 | if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) { | 489 | if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) { |
490 | u64 flags; | ||
491 | |||
490 | access = (_PAGE_PRESENT | _PAGE_USER); | 492 | access = (_PAGE_PRESENT | _PAGE_USER); |
491 | access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; | 493 | access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; |
494 | local_irq_save(flags); | ||
492 | if (hash_page(ea, access, 0x300) != 0) | 495 | if (hash_page(ea, access, 0x300) != 0) |
493 | error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; | 496 | error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; |
497 | local_irq_restore(flags); | ||
494 | } | 498 | } |
495 | if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) { | 499 | if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) { |
496 | if ((ret = spu_handle_mm_fault(spu)) != 0) | 500 | if ((ret = spu_handle_mm_fault(spu)) != 0) |
@@ -516,8 +520,50 @@ void spu_irq_setaffinity(struct spu *spu, int cpu) | |||
516 | } | 520 | } |
517 | EXPORT_SYMBOL_GPL(spu_irq_setaffinity); | 521 | EXPORT_SYMBOL_GPL(spu_irq_setaffinity); |
518 | 522 | ||
519 | static void __iomem * __init map_spe_prop(struct device_node *n, | 523 | static int __init find_spu_node_id(struct device_node *spe) |
520 | const char *name) | 524 | { |
525 | unsigned int *id; | ||
526 | struct device_node *cpu; | ||
527 | cpu = spe->parent->parent; | ||
528 | id = (unsigned int *)get_property(cpu, "node-id", NULL); | ||
529 | return id ? *id : 0; | ||
530 | } | ||
531 | |||
532 | static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, | ||
533 | const char *prop) | ||
534 | { | ||
535 | static DEFINE_MUTEX(add_spumem_mutex); | ||
536 | |||
537 | struct address_prop { | ||
538 | unsigned long address; | ||
539 | unsigned int len; | ||
540 | } __attribute__((packed)) *p; | ||
541 | int proplen; | ||
542 | |||
543 | unsigned long start_pfn, nr_pages; | ||
544 | struct pglist_data *pgdata; | ||
545 | struct zone *zone; | ||
546 | int ret; | ||
547 | |||
548 | p = (void*)get_property(spe, prop, &proplen); | ||
549 | WARN_ON(proplen != sizeof (*p)); | ||
550 | |||
551 | start_pfn = p->address >> PAGE_SHIFT; | ||
552 | nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
553 | |||
554 | pgdata = NODE_DATA(spu->nid); | ||
555 | zone = pgdata->node_zones; | ||
556 | |||
557 | /* XXX rethink locking here */ | ||
558 | mutex_lock(&add_spumem_mutex); | ||
559 | ret = __add_pages(zone, start_pfn, nr_pages); | ||
560 | mutex_unlock(&add_spumem_mutex); | ||
561 | |||
562 | return ret; | ||
563 | } | ||
564 | |||
565 | static void __iomem * __init map_spe_prop(struct spu *spu, | ||
566 | struct device_node *n, const char *name) | ||
521 | { | 567 | { |
522 | struct address_prop { | 568 | struct address_prop { |
523 | unsigned long address; | 569 | unsigned long address; |
@@ -526,6 +572,8 @@ static void __iomem * __init map_spe_prop(struct device_node *n, | |||
526 | 572 | ||
527 | void *p; | 573 | void *p; |
528 | int proplen; | 574 | int proplen; |
575 | void* ret = NULL; | ||
576 | int err = 0; | ||
529 | 577 | ||
530 | p = get_property(n, name, &proplen); | 578 | p = get_property(n, name, &proplen); |
531 | if (proplen != sizeof (struct address_prop)) | 579 | if (proplen != sizeof (struct address_prop)) |
@@ -533,7 +581,14 @@ static void __iomem * __init map_spe_prop(struct device_node *n, | |||
533 | 581 | ||
534 | prop = p; | 582 | prop = p; |
535 | 583 | ||
536 | return ioremap(prop->address, prop->len); | 584 | err = cell_spuprop_present(spu, n, name); |
585 | if (err && (err != -EEXIST)) | ||
586 | goto out; | ||
587 | |||
588 | ret = ioremap(prop->address, prop->len); | ||
589 | |||
590 | out: | ||
591 | return ret; | ||
537 | } | 592 | } |
538 | 593 | ||
539 | static void spu_unmap(struct spu *spu) | 594 | static void spu_unmap(struct spu *spu) |
@@ -544,44 +599,45 @@ static void spu_unmap(struct spu *spu) | |||
544 | iounmap((u8 __iomem *)spu->local_store); | 599 | iounmap((u8 __iomem *)spu->local_store); |
545 | } | 600 | } |
546 | 601 | ||
547 | static int __init spu_map_device(struct spu *spu, struct device_node *spe) | 602 | static int __init spu_map_device(struct spu *spu, struct device_node *node) |
548 | { | 603 | { |
549 | char *prop; | 604 | char *prop; |
550 | int ret; | 605 | int ret; |
551 | 606 | ||
552 | ret = -ENODEV; | 607 | ret = -ENODEV; |
553 | prop = get_property(spe, "isrc", NULL); | 608 | prop = get_property(node, "isrc", NULL); |
554 | if (!prop) | 609 | if (!prop) |
555 | goto out; | 610 | goto out; |
556 | spu->isrc = *(unsigned int *)prop; | 611 | spu->isrc = *(unsigned int *)prop; |
557 | 612 | ||
558 | spu->name = get_property(spe, "name", NULL); | 613 | spu->name = get_property(node, "name", NULL); |
559 | if (!spu->name) | 614 | if (!spu->name) |
560 | goto out; | 615 | goto out; |
561 | 616 | ||
562 | prop = get_property(spe, "local-store", NULL); | 617 | prop = get_property(node, "local-store", NULL); |
563 | if (!prop) | 618 | if (!prop) |
564 | goto out; | 619 | goto out; |
565 | spu->local_store_phys = *(unsigned long *)prop; | 620 | spu->local_store_phys = *(unsigned long *)prop; |
566 | 621 | ||
567 | /* we use local store as ram, not io memory */ | 622 | /* we use local store as ram, not io memory */ |
568 | spu->local_store = (void __force *)map_spe_prop(spe, "local-store"); | 623 | spu->local_store = (void __force *) |
624 | map_spe_prop(spu, node, "local-store"); | ||
569 | if (!spu->local_store) | 625 | if (!spu->local_store) |
570 | goto out; | 626 | goto out; |
571 | 627 | ||
572 | prop = get_property(spe, "problem", NULL); | 628 | prop = get_property(node, "problem", NULL); |
573 | if (!prop) | 629 | if (!prop) |
574 | goto out_unmap; | 630 | goto out_unmap; |
575 | spu->problem_phys = *(unsigned long *)prop; | 631 | spu->problem_phys = *(unsigned long *)prop; |
576 | 632 | ||
577 | spu->problem= map_spe_prop(spe, "problem"); | 633 | spu->problem= map_spe_prop(spu, node, "problem"); |
578 | if (!spu->problem) | 634 | if (!spu->problem) |
579 | goto out_unmap; | 635 | goto out_unmap; |
580 | 636 | ||
581 | spu->priv1= map_spe_prop(spe, "priv1"); | 637 | spu->priv1= map_spe_prop(spu, node, "priv1"); |
582 | /* priv1 is not available on a hypervisor */ | 638 | /* priv1 is not available on a hypervisor */ |
583 | 639 | ||
584 | spu->priv2= map_spe_prop(spe, "priv2"); | 640 | spu->priv2= map_spe_prop(spu, node, "priv2"); |
585 | if (!spu->priv2) | 641 | if (!spu->priv2) |
586 | goto out_unmap; | 642 | goto out_unmap; |
587 | ret = 0; | 643 | ret = 0; |
@@ -593,17 +649,6 @@ out: | |||
593 | return ret; | 649 | return ret; |
594 | } | 650 | } |
595 | 651 | ||
596 | static int __init find_spu_node_id(struct device_node *spe) | ||
597 | { | ||
598 | unsigned int *id; | ||
599 | struct device_node *cpu; | ||
600 | |||
601 | cpu = spe->parent->parent; | ||
602 | id = (unsigned int *)get_property(cpu, "node-id", NULL); | ||
603 | |||
604 | return id ? *id : 0; | ||
605 | } | ||
606 | |||
607 | static int __init create_spu(struct device_node *spe) | 652 | static int __init create_spu(struct device_node *spe) |
608 | { | 653 | { |
609 | struct spu *spu; | 654 | struct spu *spu; |
@@ -620,6 +665,10 @@ static int __init create_spu(struct device_node *spe) | |||
620 | goto out_free; | 665 | goto out_free; |
621 | 666 | ||
622 | spu->node = find_spu_node_id(spe); | 667 | spu->node = find_spu_node_id(spe); |
668 | spu->nid = of_node_to_nid(spe); | ||
669 | if (spu->nid == -1) | ||
670 | spu->nid = 0; | ||
671 | |||
623 | spu->stop_code = 0; | 672 | spu->stop_code = 0; |
624 | spu->slb_replace = 0; | 673 | spu->slb_replace = 0; |
625 | spu->mm = NULL; | 674 | spu->mm = NULL; |
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c index b283380a2a18..95b36430aa0f 100644 --- a/arch/powerpc/platforms/cell/spu_callbacks.c +++ b/arch/powerpc/platforms/cell/spu_callbacks.c | |||
@@ -319,6 +319,19 @@ void *spu_syscall_table[] = { | |||
319 | [__NR_splice] sys_splice, | 319 | [__NR_splice] sys_splice, |
320 | [__NR_tee] sys_tee, | 320 | [__NR_tee] sys_tee, |
321 | [__NR_vmsplice] sys_vmsplice, | 321 | [__NR_vmsplice] sys_vmsplice, |
322 | [__NR_openat] sys_openat, | ||
323 | [__NR_mkdirat] sys_mkdirat, | ||
324 | [__NR_mknodat] sys_mknodat, | ||
325 | [__NR_fchownat] sys_fchownat, | ||
326 | [__NR_futimesat] sys_futimesat, | ||
327 | [__NR_newfstatat] sys_newfstatat, | ||
328 | [__NR_unlinkat] sys_unlinkat, | ||
329 | [__NR_renameat] sys_renameat, | ||
330 | [__NR_linkat] sys_linkat, | ||
331 | [__NR_symlinkat] sys_symlinkat, | ||
332 | [__NR_readlinkat] sys_readlinkat, | ||
333 | [__NR_fchmodat] sys_fchmodat, | ||
334 | [__NR_faccessat] sys_faccessat, | ||
322 | }; | 335 | }; |
323 | 336 | ||
324 | long spu_sys_callback(struct spu_syscall_block *s) | 337 | long spu_sys_callback(struct spu_syscall_block *s) |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f5d8d15d74fa..ea179afea632 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -1097,7 +1097,7 @@ pmac_pci_enable_device_hook(struct pci_dev *dev, int initial) | |||
1097 | * (iBook second controller) | 1097 | * (iBook second controller) |
1098 | */ | 1098 | */ |
1099 | if (dev->vendor == PCI_VENDOR_ID_APPLE | 1099 | if (dev->vendor == PCI_VENDOR_ID_APPLE |
1100 | && (dev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x10)) | 1100 | && dev->class == PCI_CLASS_SERIAL_USB_OHCI |
1101 | && !node) { | 1101 | && !node) { |
1102 | printk(KERN_INFO "Apple USB OHCI %s disabled by firmware\n", | 1102 | printk(KERN_INFO "Apple USB OHCI %s disabled by firmware\n", |
1103 | pci_name(dev)); | 1103 | pci_name(dev)); |
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index a1bda6f96fd1..40020c65c89e 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c | |||
@@ -118,7 +118,15 @@ int eeh_send_failure_event (struct device_node *dn, | |||
118 | { | 118 | { |
119 | unsigned long flags; | 119 | unsigned long flags; |
120 | struct eeh_event *event; | 120 | struct eeh_event *event; |
121 | char *location; | ||
121 | 122 | ||
123 | if (!mem_init_done) { | ||
124 | printk(KERN_ERR "EEH: event during early boot not handled\n"); | ||
125 | location = (char *) get_property(dn, "ibm,loc-code", NULL); | ||
126 | printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); | ||
127 | printk(KERN_ERR "EEH: PCI location = %s\n", location); | ||
128 | return 1; | ||
129 | } | ||
122 | event = kmalloc(sizeof(*event), GFP_ATOMIC); | 130 | event = kmalloc(sizeof(*event), GFP_ATOMIC); |
123 | if (event == NULL) { | 131 | if (event == NULL) { |
124 | printk (KERN_ERR "EEH: out of memory, event not handled\n"); | 132 | printk (KERN_ERR "EEH: out of memory, event not handled\n"); |