aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig10
-rw-r--r--arch/sparc/Kconfig.debug5
-rw-r--r--arch/sparc/boot/btfixupprep.c6
-rw-r--r--arch/sparc/configs/sparc64_defconfig73
-rw-r--r--arch/sparc/include/asm/atomic_32.h2
-rw-r--r--arch/sparc/include/asm/atomic_64.h4
-rw-r--r--arch/sparc/include/asm/bitops_64.h11
-rw-r--r--arch/sparc/include/asm/cache.h5
-rw-r--r--arch/sparc/include/asm/cpudata_64.h2
-rw-r--r--arch/sparc/include/asm/device.h15
-rw-r--r--arch/sparc/include/asm/fb.h2
-rw-r--r--arch/sparc/include/asm/floppy_64.h4
-rw-r--r--arch/sparc/include/asm/irqflags_64.h23
-rw-r--r--arch/sparc/include/asm/lmb.h10
-rw-r--r--arch/sparc/include/asm/memblock.h10
-rw-r--r--arch/sparc/include/asm/of_device.h1
-rw-r--r--arch/sparc/include/asm/parport.h9
-rw-r--r--arch/sparc/include/asm/pgtable_32.h5
-rw-r--r--arch/sparc/include/asm/scatterlist.h5
-rw-r--r--arch/sparc/include/asm/stat.h4
-rw-r--r--arch/sparc/include/asm/thread_info_32.h2
-rw-r--r--arch/sparc/include/asm/thread_info_64.h4
-rw-r--r--arch/sparc/kernel/Makefile10
-rw-r--r--arch/sparc/kernel/apc.c7
-rw-r--r--arch/sparc/kernel/auxio_64.c9
-rw-r--r--arch/sparc/kernel/central.c19
-rw-r--r--arch/sparc/kernel/chmc.c17
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/ftrace.c60
-rw-r--r--arch/sparc/kernel/helpers.S75
-rw-r--r--arch/sparc/kernel/hvapi.c1
-rw-r--r--arch/sparc/kernel/iommu.c1
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/irq_64.c31
-rw-r--r--arch/sparc/kernel/kgdb_32.c6
-rw-r--r--arch/sparc/kernel/kgdb_64.c9
-rw-r--r--arch/sparc/kernel/kprobes.c1
-rw-r--r--arch/sparc/kernel/kstack.h19
-rw-r--r--arch/sparc/kernel/led.c1
-rw-r--r--arch/sparc/kernel/leon_kernel.c1
-rw-r--r--arch/sparc/kernel/leon_smp.c1
-rw-r--r--arch/sparc/kernel/mdesc.c16
-rw-r--r--arch/sparc/kernel/module.c2
-rw-r--r--arch/sparc/kernel/nmi.c10
-rw-r--r--arch/sparc/kernel/of_device_32.c17
-rw-r--r--arch/sparc/kernel/of_device_64.c29
-rw-r--r--arch/sparc/kernel/of_device_common.c5
-rw-r--r--arch/sparc/kernel/pci.c14
-rw-r--r--arch/sparc/kernel/pci_common.c20
-rw-r--r--arch/sparc/kernel/pci_fire.c11
-rw-r--r--arch/sparc/kernel/pci_msi.c19
-rw-r--r--arch/sparc/kernel/pci_psycho.c11
-rw-r--r--arch/sparc/kernel/pci_sabre.c11
-rw-r--r--arch/sparc/kernel/pci_schizo.c21
-rw-r--r--arch/sparc/kernel/pci_sun4v.c15
-rw-r--r--arch/sparc/kernel/pcr.c3
-rw-r--r--arch/sparc/kernel/perf_event.c125
-rw-r--r--arch/sparc/kernel/pmc.c7
-rw-r--r--arch/sparc/kernel/power.c11
-rw-r--r--arch/sparc/kernel/process_32.c2
-rw-r--r--arch/sparc/kernel/process_64.c1
-rw-r--r--arch/sparc/kernel/prom_64.c4
-rw-r--r--arch/sparc/kernel/psycho_common.c2
-rw-r--r--arch/sparc/kernel/ptrace_32.c4
-rw-r--r--arch/sparc/kernel/ptrace_64.c4
-rw-r--r--arch/sparc/kernel/rtrap_64.S12
-rw-r--r--arch/sparc/kernel/sbus.c16
-rw-r--r--arch/sparc/kernel/setup_64.c1
-rw-r--r--arch/sparc/kernel/smp_64.c12
-rw-r--r--arch/sparc/kernel/stacktrace.c23
-rw-r--r--arch/sparc/kernel/sun4c_irq.c1
-rw-r--r--arch/sparc/kernel/sun4d_irq.c2
-rw-r--r--arch/sparc/kernel/sun4m_irq.c1
-rw-r--r--arch/sparc/kernel/sys_sparc32.c2
-rw-r--r--arch/sparc/kernel/sysfs.c4
-rw-r--r--arch/sparc/kernel/time_32.c27
-rw-r--r--arch/sparc/kernel/time_64.c31
-rw-r--r--arch/sparc/kernel/traps_64.c41
-rw-r--r--arch/sparc/kernel/ttable.S2
-rw-r--r--arch/sparc/kernel/unaligned_64.c6
-rw-r--r--arch/sparc/kernel/us2e_cpufreq.c8
-rw-r--r--arch/sparc/kernel/us3_cpufreq.c8
-rw-r--r--arch/sparc/kernel/vio.c1
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S5
-rw-r--r--arch/sparc/lib/mcount.S159
-rw-r--r--arch/sparc/mm/hugetlbpage.c1
-rw-r--r--arch/sparc/mm/init_32.c1
-rw-r--r--arch/sparc/mm/init_64.c58
-rw-r--r--arch/sparc/mm/srmmu.c4
-rw-r--r--arch/sparc/mm/sun4c.c4
-rw-r--r--arch/sparc/mm/tsb.c1
91 files changed, 784 insertions, 494 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 6db513674050..c0015db247ba 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -37,9 +37,12 @@ config SPARC64
37 def_bool 64BIT 37 def_bool 64BIT
38 select ARCH_SUPPORTS_MSI 38 select ARCH_SUPPORTS_MSI
39 select HAVE_FUNCTION_TRACER 39 select HAVE_FUNCTION_TRACER
40 select HAVE_FUNCTION_GRAPH_TRACER
41 select HAVE_FUNCTION_GRAPH_FP_TEST
42 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
40 select HAVE_KRETPROBES 43 select HAVE_KRETPROBES
41 select HAVE_KPROBES 44 select HAVE_KPROBES
42 select HAVE_LMB 45 select HAVE_MEMBLOCK
43 select HAVE_SYSCALL_WRAPPERS 46 select HAVE_SYSCALL_WRAPPERS
44 select HAVE_DYNAMIC_FTRACE 47 select HAVE_DYNAMIC_FTRACE
45 select HAVE_FTRACE_MCOUNT_RECORD 48 select HAVE_FTRACE_MCOUNT_RECORD
@@ -72,7 +75,7 @@ config ARCH_USES_GETTIMEOFFSET
72 75
73config GENERIC_CMOS_UPDATE 76config GENERIC_CMOS_UPDATE
74 bool 77 bool
75 default y if SPARC64 78 default y
76 79
77config GENERIC_CLOCKEVENTS 80config GENERIC_CLOCKEVENTS
78 bool 81 bool
@@ -130,6 +133,9 @@ config ZONE_DMA
130config NEED_DMA_MAP_STATE 133config NEED_DMA_MAP_STATE
131 def_bool y 134 def_bool y
132 135
136config NEED_SG_DMA_LENGTH
137 def_bool y
138
133config GENERIC_ISA_DMA 139config GENERIC_ISA_DMA
134 bool 140 bool
135 default y if SPARC32 141 default y if SPARC32
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug
index 9d3c889718ac..1b4a831565f9 100644
--- a/arch/sparc/Kconfig.debug
+++ b/arch/sparc/Kconfig.debug
@@ -19,13 +19,10 @@ config DEBUG_DCFLUSH
19 bool "D-cache flush debugging" 19 bool "D-cache flush debugging"
20 depends on SPARC64 && DEBUG_KERNEL 20 depends on SPARC64 && DEBUG_KERNEL
21 21
22config STACK_DEBUG
23 bool "Stack Overflow Detection Support"
24
25config MCOUNT 22config MCOUNT
26 bool 23 bool
27 depends on SPARC64 24 depends on SPARC64
28 depends on STACK_DEBUG || FUNCTION_TRACER 25 depends on FUNCTION_TRACER
29 default y 26 default y
30 27
31config FRAME_POINTER 28config FRAME_POINTER
diff --git a/arch/sparc/boot/btfixupprep.c b/arch/sparc/boot/btfixupprep.c
index bbf91b9c3d39..da031159e2b7 100644
--- a/arch/sparc/boot/btfixupprep.c
+++ b/arch/sparc/boot/btfixupprep.c
@@ -216,7 +216,7 @@ main1:
216 switch (buffer[nbase+3]) { 216 switch (buffer[nbase+3]) {
217 case 'f': 217 case 'f':
218 if (initval) { 218 if (initval) {
219 fprintf(stderr, "Cannot use pre-initalized fixups for calls\n%s\n", buffer); 219 fprintf(stderr, "Cannot use pre-initialized fixups for calls\n%s\n", buffer);
220 exit(1); 220 exit(1);
221 } 221 }
222 if (!strcmp (sect, "__ksymtab")) { 222 if (!strcmp (sect, "__ksymtab")) {
@@ -273,7 +273,7 @@ main1:
273 break; 273 break;
274 case 'i': 274 case 'i':
275 if (initval) { 275 if (initval) {
276 fprintf(stderr, "Cannot use pre-initalized fixups for INT\n%s\n", buffer); 276 fprintf(stderr, "Cannot use pre-initialized fixups for INT\n%s\n", buffer);
277 exit(1); 277 exit(1);
278 } 278 }
279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) { 279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) {
@@ -325,7 +325,7 @@ main1:
325 (*rr)->next = NULL; 325 (*rr)->next = NULL;
326 } 326 }
327 printf("! Generated by btfixupprep. Do not edit.\n\n"); 327 printf("! Generated by btfixupprep. Do not edit.\n\n");
328 printf("\t.section\t\".data.init\",#alloc,#write\n\t.align\t4\n\n"); 328 printf("\t.section\t\".data..init\",#alloc,#write\n\t.align\t4\n\n");
329 printf("\t.global\t___btfixup_start\n___btfixup_start:\n\n"); 329 printf("\t.global\t___btfixup_start\n___btfixup_start:\n\n");
330 for (i = 0; i < last; i++) { 330 for (i = 0; i < last; i++) {
331 f = array + i; 331 f = array + i;
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 56e3163673e3..1dc07a0014c1 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.33 3# Linux kernel version: 2.6.34
4# Wed Mar 3 02:54:29 2010 4# Wed May 26 21:14:01 2010
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_SPARC=y 7CONFIG_SPARC=y
@@ -23,6 +23,7 @@ CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
23CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 23CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
25CONFIG_MMU=y 25CONFIG_MMU=y
26CONFIG_NEED_DMA_MAP_STATE=y
26CONFIG_ARCH_NO_VIRT_TO_BUS=y 27CONFIG_ARCH_NO_VIRT_TO_BUS=y
27CONFIG_OF=y 28CONFIG_OF=y
28CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 29CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -106,10 +107,9 @@ CONFIG_PERF_COUNTERS=y
106# CONFIG_DEBUG_PERF_USE_VMALLOC is not set 107# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
107CONFIG_VM_EVENT_COUNTERS=y 108CONFIG_VM_EVENT_COUNTERS=y
108CONFIG_PCI_QUIRKS=y 109CONFIG_PCI_QUIRKS=y
109CONFIG_SLUB_DEBUG=y
110# CONFIG_COMPAT_BRK is not set 110# CONFIG_COMPAT_BRK is not set
111# CONFIG_SLAB is not set 111CONFIG_SLAB=y
112CONFIG_SLUB=y 112# CONFIG_SLUB is not set
113# CONFIG_SLOB is not set 113# CONFIG_SLOB is not set
114CONFIG_PROFILING=y 114CONFIG_PROFILING=y
115CONFIG_TRACEPOINTS=y 115CONFIG_TRACEPOINTS=y
@@ -238,6 +238,7 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
238CONFIG_SPARSEMEM_VMEMMAP=y 238CONFIG_SPARSEMEM_VMEMMAP=y
239CONFIG_PAGEFLAGS_EXTENDED=y 239CONFIG_PAGEFLAGS_EXTENDED=y
240CONFIG_SPLIT_PTLOCK_CPUS=4 240CONFIG_SPLIT_PTLOCK_CPUS=4
241# CONFIG_COMPACTION is not set
241CONFIG_MIGRATION=y 242CONFIG_MIGRATION=y
242CONFIG_PHYS_ADDR_T_64BIT=y 243CONFIG_PHYS_ADDR_T_64BIT=y
243CONFIG_ZONE_DMA_FLAG=0 244CONFIG_ZONE_DMA_FLAG=0
@@ -350,6 +351,7 @@ CONFIG_IPV6_TUNNEL=m
350# CONFIG_RDS is not set 351# CONFIG_RDS is not set
351# CONFIG_TIPC is not set 352# CONFIG_TIPC is not set
352# CONFIG_ATM is not set 353# CONFIG_ATM is not set
354# CONFIG_L2TP is not set
353# CONFIG_BRIDGE is not set 355# CONFIG_BRIDGE is not set
354# CONFIG_NET_DSA is not set 356# CONFIG_NET_DSA is not set
355CONFIG_VLAN_8021Q=m 357CONFIG_VLAN_8021Q=m
@@ -366,6 +368,7 @@ CONFIG_VLAN_8021Q=m
366# CONFIG_IEEE802154 is not set 368# CONFIG_IEEE802154 is not set
367# CONFIG_NET_SCHED is not set 369# CONFIG_NET_SCHED is not set
368# CONFIG_DCB is not set 370# CONFIG_DCB is not set
371CONFIG_RPS=y
369 372
370# 373#
371# Network testing 374# Network testing
@@ -385,9 +388,14 @@ CONFIG_WIRELESS=y
385# 388#
386# CFG80211 needs to be enabled for MAC80211 389# CFG80211 needs to be enabled for MAC80211
387# 390#
391
392#
393# Some wireless drivers require a rate control algorithm
394#
388# CONFIG_WIMAX is not set 395# CONFIG_WIMAX is not set
389# CONFIG_RFKILL is not set 396# CONFIG_RFKILL is not set
390# CONFIG_NET_9P is not set 397# CONFIG_NET_9P is not set
398# CONFIG_CAIF is not set
391 399
392# 400#
393# Device Drivers 401# Device Drivers
@@ -439,6 +447,7 @@ CONFIG_MISC_DEVICES=y
439# CONFIG_ENCLOSURE_SERVICES is not set 447# CONFIG_ENCLOSURE_SERVICES is not set
440# CONFIG_HP_ILO is not set 448# CONFIG_HP_ILO is not set
441# CONFIG_ISL29003 is not set 449# CONFIG_ISL29003 is not set
450# CONFIG_SENSORS_TSL2550 is not set
442# CONFIG_DS1682 is not set 451# CONFIG_DS1682 is not set
443# CONFIG_C2PORT is not set 452# CONFIG_C2PORT is not set
444 453
@@ -511,6 +520,7 @@ CONFIG_BLK_DEV_IDEDMA=y
511# 520#
512# SCSI device support 521# SCSI device support
513# 522#
523CONFIG_SCSI_MOD=y
514CONFIG_RAID_ATTRS=m 524CONFIG_RAID_ATTRS=m
515CONFIG_SCSI=y 525CONFIG_SCSI=y
516CONFIG_SCSI_DMA=y 526CONFIG_SCSI_DMA=y
@@ -655,6 +665,7 @@ CONFIG_PHYLIB=m
655# CONFIG_NATIONAL_PHY is not set 665# CONFIG_NATIONAL_PHY is not set
656# CONFIG_STE10XP is not set 666# CONFIG_STE10XP is not set
657# CONFIG_LSI_ET1011C_PHY is not set 667# CONFIG_LSI_ET1011C_PHY is not set
668# CONFIG_MICREL_PHY is not set
658# CONFIG_MDIO_BITBANG is not set 669# CONFIG_MDIO_BITBANG is not set
659CONFIG_NET_ETHERNET=y 670CONFIG_NET_ETHERNET=y
660CONFIG_MII=m 671CONFIG_MII=m
@@ -731,6 +742,8 @@ CONFIG_NETDEV_10000=y
731# CONFIG_CHELSIO_T1 is not set 742# CONFIG_CHELSIO_T1 is not set
732CONFIG_CHELSIO_T3_DEPENDS=y 743CONFIG_CHELSIO_T3_DEPENDS=y
733# CONFIG_CHELSIO_T3 is not set 744# CONFIG_CHELSIO_T3 is not set
745CONFIG_CHELSIO_T4_DEPENDS=y
746# CONFIG_CHELSIO_T4 is not set
734# CONFIG_ENIC is not set 747# CONFIG_ENIC is not set
735# CONFIG_IXGBE is not set 748# CONFIG_IXGBE is not set
736# CONFIG_IXGBEVF is not set 749# CONFIG_IXGBEVF is not set
@@ -763,6 +776,7 @@ CONFIG_NIU=m
763# CONFIG_USB_PEGASUS is not set 776# CONFIG_USB_PEGASUS is not set
764# CONFIG_USB_RTL8150 is not set 777# CONFIG_USB_RTL8150 is not set
765# CONFIG_USB_USBNET is not set 778# CONFIG_USB_USBNET is not set
779# CONFIG_USB_IPHETH is not set
766# CONFIG_WAN is not set 780# CONFIG_WAN is not set
767# CONFIG_FDDI is not set 781# CONFIG_FDDI is not set
768# CONFIG_HIPPI is not set 782# CONFIG_HIPPI is not set
@@ -775,7 +789,6 @@ CONFIG_PPP_DEFLATE=m
775CONFIG_PPP_BSDCOMP=m 789CONFIG_PPP_BSDCOMP=m
776CONFIG_PPP_MPPE=m 790CONFIG_PPP_MPPE=m
777CONFIG_PPPOE=m 791CONFIG_PPPOE=m
778# CONFIG_PPPOL2TP is not set
779# CONFIG_SLIP is not set 792# CONFIG_SLIP is not set
780CONFIG_SLHC=m 793CONFIG_SLHC=m
781# CONFIG_NET_FC is not set 794# CONFIG_NET_FC is not set
@@ -813,6 +826,7 @@ CONFIG_INPUT_KEYBOARD=y
813CONFIG_KEYBOARD_ATKBD=y 826CONFIG_KEYBOARD_ATKBD=y
814# CONFIG_QT2160 is not set 827# CONFIG_QT2160 is not set
815CONFIG_KEYBOARD_LKKBD=m 828CONFIG_KEYBOARD_LKKBD=m
829# CONFIG_KEYBOARD_TCA6416 is not set
816# CONFIG_KEYBOARD_MAX7359 is not set 830# CONFIG_KEYBOARD_MAX7359 is not set
817# CONFIG_KEYBOARD_NEWTON is not set 831# CONFIG_KEYBOARD_NEWTON is not set
818# CONFIG_KEYBOARD_OPENCORES is not set 832# CONFIG_KEYBOARD_OPENCORES is not set
@@ -837,6 +851,7 @@ CONFIG_MOUSE_SERIAL=y
837# CONFIG_INPUT_TABLET is not set 851# CONFIG_INPUT_TABLET is not set
838# CONFIG_INPUT_TOUCHSCREEN is not set 852# CONFIG_INPUT_TOUCHSCREEN is not set
839CONFIG_INPUT_MISC=y 853CONFIG_INPUT_MISC=y
854# CONFIG_INPUT_AD714X is not set
840CONFIG_INPUT_SPARCSPKR=y 855CONFIG_INPUT_SPARCSPKR=y
841# CONFIG_INPUT_ATI_REMOTE is not set 856# CONFIG_INPUT_ATI_REMOTE is not set
842# CONFIG_INPUT_ATI_REMOTE2 is not set 857# CONFIG_INPUT_ATI_REMOTE2 is not set
@@ -845,6 +860,7 @@ CONFIG_INPUT_SPARCSPKR=y
845# CONFIG_INPUT_YEALINK is not set 860# CONFIG_INPUT_YEALINK is not set
846# CONFIG_INPUT_CM109 is not set 861# CONFIG_INPUT_CM109 is not set
847# CONFIG_INPUT_UINPUT is not set 862# CONFIG_INPUT_UINPUT is not set
863# CONFIG_INPUT_PCF8574 is not set
848 864
849# 865#
850# Hardware I/O ports 866# Hardware I/O ports
@@ -868,6 +884,7 @@ CONFIG_HW_CONSOLE=y
868# CONFIG_VT_HW_CONSOLE_BINDING is not set 884# CONFIG_VT_HW_CONSOLE_BINDING is not set
869# CONFIG_DEVKMEM is not set 885# CONFIG_DEVKMEM is not set
870# CONFIG_SERIAL_NONSTANDARD is not set 886# CONFIG_SERIAL_NONSTANDARD is not set
887# CONFIG_N_GSM is not set
871# CONFIG_NOZOMI is not set 888# CONFIG_NOZOMI is not set
872 889
873# 890#
@@ -888,7 +905,10 @@ CONFIG_SERIAL_SUNHV=y
888CONFIG_SERIAL_CORE=y 905CONFIG_SERIAL_CORE=y
889CONFIG_SERIAL_CORE_CONSOLE=y 906CONFIG_SERIAL_CORE_CONSOLE=y
890# CONFIG_SERIAL_JSM is not set 907# CONFIG_SERIAL_JSM is not set
908# CONFIG_SERIAL_TIMBERDALE is not set
891# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set 909# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
910# CONFIG_SERIAL_ALTERA_JTAGUART is not set
911# CONFIG_SERIAL_ALTERA_UART is not set
892CONFIG_UNIX98_PTYS=y 912CONFIG_UNIX98_PTYS=y
893# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 913# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
894# CONFIG_LEGACY_PTYS is not set 914# CONFIG_LEGACY_PTYS is not set
@@ -935,6 +955,7 @@ CONFIG_I2C_ALGOBIT=y
935# 955#
936# CONFIG_I2C_OCORES is not set 956# CONFIG_I2C_OCORES is not set
937# CONFIG_I2C_SIMTEC is not set 957# CONFIG_I2C_SIMTEC is not set
958# CONFIG_I2C_XILINX is not set
938 959
939# 960#
940# External I2C/SMBus adapter drivers 961# External I2C/SMBus adapter drivers
@@ -948,15 +969,9 @@ CONFIG_I2C_ALGOBIT=y
948# 969#
949# CONFIG_I2C_PCA_PLATFORM is not set 970# CONFIG_I2C_PCA_PLATFORM is not set
950# CONFIG_I2C_STUB is not set 971# CONFIG_I2C_STUB is not set
951
952#
953# Miscellaneous I2C Chip support
954#
955# CONFIG_SENSORS_TSL2550 is not set
956# CONFIG_I2C_DEBUG_CORE is not set 972# CONFIG_I2C_DEBUG_CORE is not set
957# CONFIG_I2C_DEBUG_ALGO is not set 973# CONFIG_I2C_DEBUG_ALGO is not set
958# CONFIG_I2C_DEBUG_BUS is not set 974# CONFIG_I2C_DEBUG_BUS is not set
959# CONFIG_I2C_DEBUG_CHIP is not set
960# CONFIG_SPI is not set 975# CONFIG_SPI is not set
961 976
962# 977#
@@ -982,10 +997,11 @@ CONFIG_HWMON=y
982# CONFIG_SENSORS_ADM1029 is not set 997# CONFIG_SENSORS_ADM1029 is not set
983# CONFIG_SENSORS_ADM1031 is not set 998# CONFIG_SENSORS_ADM1031 is not set
984# CONFIG_SENSORS_ADM9240 is not set 999# CONFIG_SENSORS_ADM9240 is not set
1000# CONFIG_SENSORS_ADT7411 is not set
985# CONFIG_SENSORS_ADT7462 is not set 1001# CONFIG_SENSORS_ADT7462 is not set
986# CONFIG_SENSORS_ADT7470 is not set 1002# CONFIG_SENSORS_ADT7470 is not set
987# CONFIG_SENSORS_ADT7473 is not set
988# CONFIG_SENSORS_ADT7475 is not set 1003# CONFIG_SENSORS_ADT7475 is not set
1004# CONFIG_SENSORS_ASC7621 is not set
989# CONFIG_SENSORS_ATXP1 is not set 1005# CONFIG_SENSORS_ATXP1 is not set
990# CONFIG_SENSORS_DS1621 is not set 1006# CONFIG_SENSORS_DS1621 is not set
991# CONFIG_SENSORS_I5K_AMB is not set 1007# CONFIG_SENSORS_I5K_AMB is not set
@@ -1052,18 +1068,21 @@ CONFIG_SSB_POSSIBLE=y
1052# Multifunction device drivers 1068# Multifunction device drivers
1053# 1069#
1054# CONFIG_MFD_CORE is not set 1070# CONFIG_MFD_CORE is not set
1071# CONFIG_MFD_88PM860X is not set
1055# CONFIG_MFD_SM501 is not set 1072# CONFIG_MFD_SM501 is not set
1056# CONFIG_HTC_PASIC3 is not set 1073# CONFIG_HTC_PASIC3 is not set
1057# CONFIG_TWL4030_CORE is not set 1074# CONFIG_TWL4030_CORE is not set
1058# CONFIG_MFD_TMIO is not set 1075# CONFIG_MFD_TMIO is not set
1059# CONFIG_PMIC_DA903X is not set 1076# CONFIG_PMIC_DA903X is not set
1060# CONFIG_PMIC_ADP5520 is not set 1077# CONFIG_PMIC_ADP5520 is not set
1078# CONFIG_MFD_MAX8925 is not set
1061# CONFIG_MFD_WM8400 is not set 1079# CONFIG_MFD_WM8400 is not set
1062# CONFIG_MFD_WM831X is not set 1080# CONFIG_MFD_WM831X is not set
1063# CONFIG_MFD_WM8350_I2C is not set 1081# CONFIG_MFD_WM8350_I2C is not set
1082# CONFIG_MFD_WM8994 is not set
1064# CONFIG_MFD_PCF50633 is not set 1083# CONFIG_MFD_PCF50633 is not set
1065# CONFIG_AB3100_CORE is not set 1084# CONFIG_AB3100_CORE is not set
1066# CONFIG_MFD_88PM8607 is not set 1085# CONFIG_LPC_SCH is not set
1067# CONFIG_REGULATOR is not set 1086# CONFIG_REGULATOR is not set
1068# CONFIG_MEDIA_SUPPORT is not set 1087# CONFIG_MEDIA_SUPPORT is not set
1069 1088
@@ -1113,6 +1132,7 @@ CONFIG_FB_FFB=y
1113# CONFIG_FB_LEO is not set 1132# CONFIG_FB_LEO is not set
1114CONFIG_FB_XVR500=y 1133CONFIG_FB_XVR500=y
1115CONFIG_FB_XVR2500=y 1134CONFIG_FB_XVR2500=y
1135CONFIG_FB_XVR1000=y
1116# CONFIG_FB_S1D13XXX is not set 1136# CONFIG_FB_S1D13XXX is not set
1117# CONFIG_FB_NVIDIA is not set 1137# CONFIG_FB_NVIDIA is not set
1118# CONFIG_FB_RIVA is not set 1138# CONFIG_FB_RIVA is not set
@@ -1302,11 +1322,14 @@ CONFIG_USB_HIDDEV=y
1302CONFIG_HID_A4TECH=y 1322CONFIG_HID_A4TECH=y
1303CONFIG_HID_APPLE=y 1323CONFIG_HID_APPLE=y
1304CONFIG_HID_BELKIN=y 1324CONFIG_HID_BELKIN=y
1325# CONFIG_HID_CANDO is not set
1305CONFIG_HID_CHERRY=y 1326CONFIG_HID_CHERRY=y
1306CONFIG_HID_CHICONY=y 1327CONFIG_HID_CHICONY=y
1328# CONFIG_HID_PRODIKEYS is not set
1307CONFIG_HID_CYPRESS=y 1329CONFIG_HID_CYPRESS=y
1308CONFIG_HID_DRAGONRISE=y 1330CONFIG_HID_DRAGONRISE=y
1309# CONFIG_DRAGONRISE_FF is not set 1331# CONFIG_DRAGONRISE_FF is not set
1332# CONFIG_HID_EGALAX is not set
1310CONFIG_HID_EZKEY=y 1333CONFIG_HID_EZKEY=y
1311CONFIG_HID_KYE=y 1334CONFIG_HID_KYE=y
1312CONFIG_HID_GYRATION=y 1335CONFIG_HID_GYRATION=y
@@ -1324,7 +1347,9 @@ CONFIG_HID_ORTEK=y
1324CONFIG_HID_PANTHERLORD=y 1347CONFIG_HID_PANTHERLORD=y
1325# CONFIG_PANTHERLORD_FF is not set 1348# CONFIG_PANTHERLORD_FF is not set
1326CONFIG_HID_PETALYNX=y 1349CONFIG_HID_PETALYNX=y
1350# CONFIG_HID_PICOLCD is not set
1327# CONFIG_HID_QUANTA is not set 1351# CONFIG_HID_QUANTA is not set
1352# CONFIG_HID_ROCCAT_KONE is not set
1328CONFIG_HID_SAMSUNG=y 1353CONFIG_HID_SAMSUNG=y
1329CONFIG_HID_SONY=y 1354CONFIG_HID_SONY=y
1330# CONFIG_HID_STANTUM is not set 1355# CONFIG_HID_STANTUM is not set
@@ -1338,6 +1363,7 @@ CONFIG_HID_THRUSTMASTER=y
1338# CONFIG_THRUSTMASTER_FF is not set 1363# CONFIG_THRUSTMASTER_FF is not set
1339CONFIG_HID_ZEROPLUS=y 1364CONFIG_HID_ZEROPLUS=y
1340# CONFIG_ZEROPLUS_FF is not set 1365# CONFIG_ZEROPLUS_FF is not set
1366# CONFIG_HID_ZYDACRON is not set
1341CONFIG_USB_SUPPORT=y 1367CONFIG_USB_SUPPORT=y
1342CONFIG_USB_ARCH_HAS_HCD=y 1368CONFIG_USB_ARCH_HAS_HCD=y
1343CONFIG_USB_ARCH_HAS_OHCI=y 1369CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1352,7 +1378,6 @@ CONFIG_USB=y
1352# CONFIG_USB_DEVICEFS is not set 1378# CONFIG_USB_DEVICEFS is not set
1353# CONFIG_USB_DEVICE_CLASS is not set 1379# CONFIG_USB_DEVICE_CLASS is not set
1354# CONFIG_USB_DYNAMIC_MINORS is not set 1380# CONFIG_USB_DYNAMIC_MINORS is not set
1355# CONFIG_USB_OTG is not set
1356# CONFIG_USB_MON is not set 1381# CONFIG_USB_MON is not set
1357# CONFIG_USB_WUSB is not set 1382# CONFIG_USB_WUSB is not set
1358# CONFIG_USB_WUSB_CBAF is not set 1383# CONFIG_USB_WUSB_CBAF is not set
@@ -1430,7 +1455,6 @@ CONFIG_USB_STORAGE=m
1430# CONFIG_USB_RIO500 is not set 1455# CONFIG_USB_RIO500 is not set
1431# CONFIG_USB_LEGOTOWER is not set 1456# CONFIG_USB_LEGOTOWER is not set
1432# CONFIG_USB_LCD is not set 1457# CONFIG_USB_LCD is not set
1433# CONFIG_USB_BERRY_CHARGE is not set
1434# CONFIG_USB_LED is not set 1458# CONFIG_USB_LED is not set
1435# CONFIG_USB_CYPRESS_CY7C63 is not set 1459# CONFIG_USB_CYPRESS_CY7C63 is not set
1436# CONFIG_USB_CYTHERM is not set 1460# CONFIG_USB_CYTHERM is not set
@@ -1443,7 +1467,6 @@ CONFIG_USB_STORAGE=m
1443# CONFIG_USB_IOWARRIOR is not set 1467# CONFIG_USB_IOWARRIOR is not set
1444# CONFIG_USB_TEST is not set 1468# CONFIG_USB_TEST is not set
1445# CONFIG_USB_ISIGHTFW is not set 1469# CONFIG_USB_ISIGHTFW is not set
1446# CONFIG_USB_VST is not set
1447# CONFIG_USB_GADGET is not set 1470# CONFIG_USB_GADGET is not set
1448 1471
1449# 1472#
@@ -1519,10 +1542,6 @@ CONFIG_RTC_DRV_STARFIRE=y
1519# CONFIG_DMADEVICES is not set 1542# CONFIG_DMADEVICES is not set
1520# CONFIG_AUXDISPLAY is not set 1543# CONFIG_AUXDISPLAY is not set
1521# CONFIG_UIO is not set 1544# CONFIG_UIO is not set
1522
1523#
1524# TI VLYNQ
1525#
1526# CONFIG_STAGING is not set 1545# CONFIG_STAGING is not set
1527 1546
1528# 1547#
@@ -1610,6 +1629,7 @@ CONFIG_MISC_FILESYSTEMS=y
1610# CONFIG_BEFS_FS is not set 1629# CONFIG_BEFS_FS is not set
1611# CONFIG_BFS_FS is not set 1630# CONFIG_BFS_FS is not set
1612# CONFIG_EFS_FS is not set 1631# CONFIG_EFS_FS is not set
1632# CONFIG_LOGFS is not set
1613# CONFIG_CRAMFS is not set 1633# CONFIG_CRAMFS is not set
1614# CONFIG_SQUASHFS is not set 1634# CONFIG_SQUASHFS is not set
1615# CONFIG_VXFS_FS is not set 1635# CONFIG_VXFS_FS is not set
@@ -1624,6 +1644,7 @@ CONFIG_NETWORK_FILESYSTEMS=y
1624# CONFIG_NFS_FS is not set 1644# CONFIG_NFS_FS is not set
1625# CONFIG_NFSD is not set 1645# CONFIG_NFSD is not set
1626# CONFIG_SMB_FS is not set 1646# CONFIG_SMB_FS is not set
1647# CONFIG_CEPH_FS is not set
1627# CONFIG_CIFS is not set 1648# CONFIG_CIFS is not set
1628# CONFIG_NCP_FS is not set 1649# CONFIG_NCP_FS is not set
1629# CONFIG_CODA_FS is not set 1650# CONFIG_CODA_FS is not set
@@ -1702,8 +1723,8 @@ CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1702CONFIG_SCHEDSTATS=y 1723CONFIG_SCHEDSTATS=y
1703# CONFIG_TIMER_STATS is not set 1724# CONFIG_TIMER_STATS is not set
1704# CONFIG_DEBUG_OBJECTS is not set 1725# CONFIG_DEBUG_OBJECTS is not set
1705# CONFIG_SLUB_DEBUG_ON is not set 1726# CONFIG_DEBUG_SLAB is not set
1706# CONFIG_SLUB_STATS is not set 1727# CONFIG_DEBUG_KMEMLEAK is not set
1707# CONFIG_DEBUG_RT_MUTEXES is not set 1728# CONFIG_DEBUG_RT_MUTEXES is not set
1708# CONFIG_RT_MUTEX_TESTER is not set 1729# CONFIG_RT_MUTEX_TESTER is not set
1709# CONFIG_DEBUG_SPINLOCK is not set 1730# CONFIG_DEBUG_SPINLOCK is not set
@@ -1738,6 +1759,9 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
1738# CONFIG_DEBUG_PAGEALLOC is not set 1759# CONFIG_DEBUG_PAGEALLOC is not set
1739CONFIG_NOP_TRACER=y 1760CONFIG_NOP_TRACER=y
1740CONFIG_HAVE_FUNCTION_TRACER=y 1761CONFIG_HAVE_FUNCTION_TRACER=y
1762CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1763CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
1764CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1741CONFIG_HAVE_DYNAMIC_FTRACE=y 1765CONFIG_HAVE_DYNAMIC_FTRACE=y
1742CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1766CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1743CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 1767CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
@@ -1765,12 +1789,12 @@ CONFIG_BLK_DEV_IO_TRACE=y
1765# CONFIG_RING_BUFFER_BENCHMARK is not set 1789# CONFIG_RING_BUFFER_BENCHMARK is not set
1766# CONFIG_DYNAMIC_DEBUG is not set 1790# CONFIG_DYNAMIC_DEBUG is not set
1767# CONFIG_DMA_API_DEBUG is not set 1791# CONFIG_DMA_API_DEBUG is not set
1792# CONFIG_ATOMIC64_SELFTEST is not set
1768# CONFIG_SAMPLES is not set 1793# CONFIG_SAMPLES is not set
1769CONFIG_HAVE_ARCH_KGDB=y 1794CONFIG_HAVE_ARCH_KGDB=y
1770# CONFIG_KGDB is not set 1795# CONFIG_KGDB is not set
1771# CONFIG_DEBUG_STACK_USAGE is not set 1796# CONFIG_DEBUG_STACK_USAGE is not set
1772# CONFIG_DEBUG_DCFLUSH is not set 1797# CONFIG_DEBUG_DCFLUSH is not set
1773# CONFIG_STACK_DEBUG is not set
1774# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set 1798# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
1775 1799
1776# 1800#
@@ -1891,6 +1915,7 @@ CONFIG_CRYPTO_DEFLATE=y
1891# 1915#
1892# CONFIG_CRYPTO_ANSI_CPRNG is not set 1916# CONFIG_CRYPTO_ANSI_CPRNG is not set
1893CONFIG_CRYPTO_HW=y 1917CONFIG_CRYPTO_HW=y
1918# CONFIG_CRYPTO_DEV_NIAGARA2 is not set
1894# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1919# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1895CONFIG_BINARY_PRINTF=y 1920CONFIG_BINARY_PRINTF=y
1896 1921
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index f0d343c3b956..7ae128b19d3f 100644
--- a/arch/sparc/include/asm/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
@@ -25,7 +25,7 @@ extern int atomic_cmpxchg(atomic_t *, int, int);
25extern int atomic_add_unless(atomic_t *, int, int); 25extern int atomic_add_unless(atomic_t *, int, int);
26extern void atomic_set(atomic_t *, int); 26extern void atomic_set(atomic_t *, int);
27 27
28#define atomic_read(v) ((v)->counter) 28#define atomic_read(v) (*(volatile int *)&(v)->counter)
29 29
30#define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) 30#define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v)))
31#define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v))) 31#define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v)))
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index f2e48009989e..2050ca02c423 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -13,8 +13,8 @@
13#define ATOMIC_INIT(i) { (i) } 13#define ATOMIC_INIT(i) { (i) }
14#define ATOMIC64_INIT(i) { (i) } 14#define ATOMIC64_INIT(i) { (i) }
15 15
16#define atomic_read(v) ((v)->counter) 16#define atomic_read(v) (*(volatile int *)&(v)->counter)
17#define atomic64_read(v) ((v)->counter) 17#define atomic64_read(v) (*(volatile long *)&(v)->counter)
18 18
19#define atomic_set(v, i) (((v)->counter) = i) 19#define atomic_set(v, i) (((v)->counter) = i)
20#define atomic64_set(v, i) (((v)->counter) = i) 20#define atomic64_set(v, i) (((v)->counter) = i)
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index e72ac9cdfb98..766121a67a24 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -44,7 +44,7 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
44 44
45#ifdef ULTRA_HAS_POPULATION_COUNT 45#ifdef ULTRA_HAS_POPULATION_COUNT
46 46
47static inline unsigned int hweight64(unsigned long w) 47static inline unsigned int __arch_hweight64(unsigned long w)
48{ 48{
49 unsigned int res; 49 unsigned int res;
50 50
@@ -52,7 +52,7 @@ static inline unsigned int hweight64(unsigned long w)
52 return res; 52 return res;
53} 53}
54 54
55static inline unsigned int hweight32(unsigned int w) 55static inline unsigned int __arch_hweight32(unsigned int w)
56{ 56{
57 unsigned int res; 57 unsigned int res;
58 58
@@ -60,7 +60,7 @@ static inline unsigned int hweight32(unsigned int w)
60 return res; 60 return res;
61} 61}
62 62
63static inline unsigned int hweight16(unsigned int w) 63static inline unsigned int __arch_hweight16(unsigned int w)
64{ 64{
65 unsigned int res; 65 unsigned int res;
66 66
@@ -68,7 +68,7 @@ static inline unsigned int hweight16(unsigned int w)
68 return res; 68 return res;
69} 69}
70 70
71static inline unsigned int hweight8(unsigned int w) 71static inline unsigned int __arch_hweight8(unsigned int w)
72{ 72{
73 unsigned int res; 73 unsigned int res;
74 74
@@ -78,9 +78,10 @@ static inline unsigned int hweight8(unsigned int w)
78 78
79#else 79#else
80 80
81#include <asm-generic/bitops/hweight.h> 81#include <asm-generic/bitops/arch_hweight.h>
82 82
83#endif 83#endif
84#include <asm-generic/bitops/const_hweight.h>
84#include <asm-generic/bitops/lock.h> 85#include <asm-generic/bitops/lock.h>
85#endif /* __KERNEL__ */ 86#endif /* __KERNEL__ */
86 87
diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h
index 41f85ae4bd4a..69358b590c91 100644
--- a/arch/sparc/include/asm/cache.h
+++ b/arch/sparc/include/asm/cache.h
@@ -7,9 +7,10 @@
7#ifndef _SPARC_CACHE_H 7#ifndef _SPARC_CACHE_H
8#define _SPARC_CACHE_H 8#define _SPARC_CACHE_H
9 9
10#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
11
10#define L1_CACHE_SHIFT 5 12#define L1_CACHE_SHIFT 5
11#define L1_CACHE_BYTES 32 13#define L1_CACHE_BYTES 32
12#define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)))
13 14
14#ifdef CONFIG_SPARC32 15#ifdef CONFIG_SPARC32
15#define SMP_CACHE_BYTES_SHIFT 5 16#define SMP_CACHE_BYTES_SHIFT 5
@@ -19,7 +20,7 @@
19 20
20#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) 21#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
21 22
22#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 23#define __read_mostly __attribute__((__section__(".data..read_mostly")))
23 24
24#ifdef CONFIG_SPARC32 25#ifdef CONFIG_SPARC32
25#include <asm/asi.h> 26#include <asm/asi.h>
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h
index 926397d345ff..050ef35b9dcf 100644
--- a/arch/sparc/include/asm/cpudata_64.h
+++ b/arch/sparc/include/asm/cpudata_64.h
@@ -17,7 +17,7 @@ typedef struct {
17 unsigned int __nmi_count; 17 unsigned int __nmi_count;
18 unsigned long clock_tick; /* %tick's per second */ 18 unsigned long clock_tick; /* %tick's per second */
19 unsigned long __pad; 19 unsigned long __pad;
20 unsigned int __pad1; 20 unsigned int irq0_irqs;
21 unsigned int __pad2; 21 unsigned int __pad2;
22 22
23 /* Dcache line 2, rarely used */ 23 /* Dcache line 2, rarely used */
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index f3b85b6b0b76..d4c452147412 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -13,25 +13,10 @@ struct dev_archdata {
13 void *iommu; 13 void *iommu;
14 void *stc; 14 void *stc;
15 void *host_controller; 15 void *host_controller;
16
17 struct device_node *prom_node;
18 struct of_device *op; 16 struct of_device *op;
19
20 int numa_node; 17 int numa_node;
21}; 18};
22 19
23static inline void dev_archdata_set_node(struct dev_archdata *ad,
24 struct device_node *np)
25{
26 ad->prom_node = np;
27}
28
29static inline struct device_node *
30dev_archdata_get_node(const struct dev_archdata *ad)
31{
32 return ad->prom_node;
33}
34
35struct pdev_archdata { 20struct pdev_archdata {
36}; 21};
37 22
diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
index b83e44729655..e834880be204 100644
--- a/arch/sparc/include/asm/fb.h
+++ b/arch/sparc/include/asm/fb.h
@@ -18,7 +18,7 @@ static inline int fb_is_primary_device(struct fb_info *info)
18 struct device *dev = info->device; 18 struct device *dev = info->device;
19 struct device_node *node; 19 struct device_node *node;
20 20
21 node = dev->archdata.prom_node; 21 node = dev->of_node;
22 if (node && 22 if (node &&
23 node == of_console_device) 23 node == of_console_device)
24 return 1; 24 return 1;
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 36439d67ad71..8fac3ab22f36 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -589,7 +589,7 @@ static unsigned long __init sun_floppy_init(void)
589 if (!op) 589 if (!op)
590 return 0; 590 return 0;
591 591
592 state_prop = of_get_property(op->node, "status", NULL); 592 state_prop = of_get_property(op->dev.of_node, "status", NULL);
593 if (state_prop && !strncmp(state_prop, "disabled", 8)) 593 if (state_prop && !strncmp(state_prop, "disabled", 8))
594 return 0; 594 return 0;
595 595
@@ -716,7 +716,7 @@ static unsigned long __init sun_floppy_init(void)
716 716
717 return sun_floppy_types[0]; 717 return sun_floppy_types[0];
718 } 718 }
719 prop = of_get_property(op->node, "status", NULL); 719 prop = of_get_property(op->dev.of_node, "status", NULL);
720 if (prop && !strncmp(state, "disabled", 8)) 720 if (prop && !strncmp(state, "disabled", 8))
721 return 0; 721 return 0;
722 722
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index 8b49bf920df3..bfa1ea45b4cd 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -76,9 +76,26 @@ static inline int raw_irqs_disabled(void)
76 */ 76 */
77static inline unsigned long __raw_local_irq_save(void) 77static inline unsigned long __raw_local_irq_save(void)
78{ 78{
79 unsigned long flags = __raw_local_save_flags(); 79 unsigned long flags, tmp;
80 80
81 raw_local_irq_disable(); 81 /* Disable interrupts to PIL_NORMAL_MAX unless we already
82 * are using PIL_NMI, in which case PIL_NMI is retained.
83 *
84 * The only values we ever program into the %pil are 0,
85 * PIL_NORMAL_MAX and PIL_NMI.
86 *
87 * Since PIL_NMI is the largest %pil value and all bits are
88 * set in it (0xf), it doesn't matter what PIL_NORMAL_MAX
89 * actually is.
90 */
91 __asm__ __volatile__(
92 "rdpr %%pil, %0\n\t"
93 "or %0, %2, %1\n\t"
94 "wrpr %1, 0x0, %%pil"
95 : "=r" (flags), "=r" (tmp)
96 : "i" (PIL_NORMAL_MAX)
97 : "memory"
98 );
82 99
83 return flags; 100 return flags;
84} 101}
diff --git a/arch/sparc/include/asm/lmb.h b/arch/sparc/include/asm/lmb.h
deleted file mode 100644
index 6a352cbcf520..000000000000
--- a/arch/sparc/include/asm/lmb.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _SPARC64_LMB_H
2#define _SPARC64_LMB_H
3
4#include <asm/oplib.h>
5
6#define LMB_DBG(fmt...) prom_printf(fmt)
7
8#define LMB_REAL_LIMIT 0
9
10#endif /* !(_SPARC64_LMB_H) */
diff --git a/arch/sparc/include/asm/memblock.h b/arch/sparc/include/asm/memblock.h
new file mode 100644
index 000000000000..f12af880649b
--- /dev/null
+++ b/arch/sparc/include/asm/memblock.h
@@ -0,0 +1,10 @@
1#ifndef _SPARC64_MEMBLOCK_H
2#define _SPARC64_MEMBLOCK_H
3
4#include <asm/oplib.h>
5
6#define MEMBLOCK_DBG(fmt...) prom_printf(fmt)
7
8#define MEMBLOCK_REAL_LIMIT 0
9
10#endif /* !(_SPARC64_MEMBLOCK_H) */
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h
index a5d9811f9697..f320246a0586 100644
--- a/arch/sparc/include/asm/of_device.h
+++ b/arch/sparc/include/asm/of_device.h
@@ -14,7 +14,6 @@
14 */ 14 */
15struct of_device 15struct of_device
16{ 16{
17 struct device_node *node;
18 struct device dev; 17 struct device dev;
19 struct resource resource[PROMREG_MAX]; 18 struct resource resource[PROMREG_MAX];
20 unsigned int irqs[PROMINTR_MAX]; 19 unsigned int irqs[PROMINTR_MAX];
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index ff9ead640c4a..c333b8d0949b 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -113,7 +113,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
113 struct parport *p; 113 struct parport *p;
114 int slot, err; 114 int slot, err;
115 115
116 parent = op->node->parent; 116 parent = op->dev.of_node->parent;
117 if (!strcmp(parent->name, "dma")) { 117 if (!strcmp(parent->name, "dma")) {
118 p = parport_pc_probe_port(base, base + 0x400, 118 p = parport_pc_probe_port(base, base + 0x400,
119 op->irqs[0], PARPORT_DMA_NOFIFO, 119 op->irqs[0], PARPORT_DMA_NOFIFO,
@@ -232,8 +232,11 @@ static const struct of_device_id ecpp_match[] = {
232}; 232};
233 233
234static struct of_platform_driver ecpp_driver = { 234static struct of_platform_driver ecpp_driver = {
235 .name = "ecpp", 235 .driver = {
236 .match_table = ecpp_match, 236 .name = "ecpp",
237 .owner = THIS_MODULE,
238 .of_match_table = ecpp_match,
239 },
237 .probe = ecpp_probe, 240 .probe = ecpp_probe,
238 .remove = __devexit_p(ecpp_remove), 241 .remove = __devexit_p(ecpp_remove),
239}; 242};
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 77f906d8cc21..0ece77f47753 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -142,13 +142,12 @@ BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
142#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) 142#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
143#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd) 143#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd)
144 144
145BTFIXUPDEF_SETHI(none_mask)
146BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) 145BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
147BTFIXUPDEF_CALL(void, pte_clear, pte_t *) 146BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
148 147
149static inline int pte_none(pte_t pte) 148static inline int pte_none(pte_t pte)
150{ 149{
151 return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask)); 150 return !pte_val(pte);
152} 151}
153 152
154#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) 153#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte)
@@ -160,7 +159,7 @@ BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *)
160 159
161static inline int pmd_none(pmd_t pmd) 160static inline int pmd_none(pmd_t pmd)
162{ 161{
163 return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask)); 162 return !pmd_val(pmd);
164} 163}
165 164
166#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd) 165#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd)
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index d1120257b033..433e45f05fd4 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -1,8 +1,9 @@
1#ifndef _SPARC_SCATTERLIST_H 1#ifndef _SPARC_SCATTERLIST_H
2#define _SPARC_SCATTERLIST_H 2#define _SPARC_SCATTERLIST_H
3 3
4#define sg_dma_len(sg) ((sg)->dma_length)
5
6#include <asm-generic/scatterlist.h> 4#include <asm-generic/scatterlist.h>
7 5
6#define ISA_DMA_THRESHOLD (~0UL)
7#define ARCH_HAS_SG_CHAIN
8
8#endif /* !(_SPARC_SCATTERLIST_H) */ 9#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/stat.h b/arch/sparc/include/asm/stat.h
index 39327d6a57eb..a232e9e1f4e5 100644
--- a/arch/sparc/include/asm/stat.h
+++ b/arch/sparc/include/asm/stat.h
@@ -53,8 +53,8 @@ struct stat {
53 ino_t st_ino; 53 ino_t st_ino;
54 mode_t st_mode; 54 mode_t st_mode;
55 short st_nlink; 55 short st_nlink;
56 uid16_t st_uid; 56 unsigned short st_uid;
57 gid16_t st_gid; 57 unsigned short st_gid;
58 unsigned short st_rdev; 58 unsigned short st_rdev;
59 off_t st_size; 59 off_t st_size;
60 time_t st_atime; 60 time_t st_atime;
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 844d73a0340c..9dd0318d3ddf 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -132,7 +132,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
132 * this quantum (SMP) */ 132 * this quantum (SMP) */
133#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling 133#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
134 * TIF_NEED_RESCHED */ 134 * TIF_NEED_RESCHED */
135#define TIF_MEMDIE 10 135#define TIF_MEMDIE 10 /* is terminating due to OOM killer */
136#define TIF_FREEZE 11 /* is freezing for suspend */ 136#define TIF_FREEZE 11 /* is freezing for suspend */
137 137
138/* as above, but as bit values */ 138/* as above, but as bit values */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 9e2d9447f2ad..fb2ea7705a46 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -111,7 +111,7 @@ struct thread_info {
111#define THREAD_SHIFT PAGE_SHIFT 111#define THREAD_SHIFT PAGE_SHIFT
112#endif /* PAGE_SHIFT == 13 */ 112#endif /* PAGE_SHIFT == 13 */
113 113
114#define PREEMPT_ACTIVE 0x4000000 114#define PREEMPT_ACTIVE 0x10000000
115 115
116/* 116/*
117 * macros/functions for gaining access to the thread information structure 117 * macros/functions for gaining access to the thread information structure
@@ -223,7 +223,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
223 * an immediate value in instructions such as andcc. 223 * an immediate value in instructions such as andcc.
224 */ 224 */
225/* flag bit 12 is available */ 225/* flag bit 12 is available */
226#define TIF_MEMDIE 13 226#define TIF_MEMDIE 13 /* is terminating due to OOM killer */
227#define TIF_POLLING_NRFLAG 14 227#define TIF_POLLING_NRFLAG 14
228#define TIF_FREEZE 15 /* is freezing for suspend */ 228#define TIF_FREEZE 15 /* is freezing for suspend */
229 229
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index c6316142db4e..0c2dc1f24a9a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -13,6 +13,14 @@ extra-y += init_task.o
13CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS) 13CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS)
14extra-y += vmlinux.lds 14extra-y += vmlinux.lds
15 15
16ifdef CONFIG_FUNCTION_TRACER
17# Do not profile debug and lowlevel utilities
18CFLAGS_REMOVE_ftrace.o := -pg
19CFLAGS_REMOVE_time_$(BITS).o := -pg
20CFLAGS_REMOVE_perf_event.o := -pg
21CFLAGS_REMOVE_pcr.o := -pg
22endif
23
16obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o 24obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o
17obj-$(CONFIG_SPARC32) += etrap_32.o 25obj-$(CONFIG_SPARC32) += etrap_32.o
18obj-$(CONFIG_SPARC32) += rtrap_32.o 26obj-$(CONFIG_SPARC32) += rtrap_32.o
@@ -85,7 +93,7 @@ obj-$(CONFIG_KGDB) += kgdb_$(BITS).o
85 93
86 94
87obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 95obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
88CFLAGS_REMOVE_ftrace.o := -pg 96obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
89 97
90obj-$(CONFIG_EARLYFB) += btext.o 98obj-$(CONFIG_EARLYFB) += btext.o
91obj-$(CONFIG_STACKTRACE) += stacktrace.o 99obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 71ec90b9e316..b27476caa133 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -174,8 +174,11 @@ static struct of_device_id __initdata apc_match[] = {
174MODULE_DEVICE_TABLE(of, apc_match); 174MODULE_DEVICE_TABLE(of, apc_match);
175 175
176static struct of_platform_driver apc_driver = { 176static struct of_platform_driver apc_driver = {
177 .name = "apc", 177 .driver = {
178 .match_table = apc_match, 178 .name = "apc",
179 .owner = THIS_MODULE,
180 .of_match_table = apc_match,
181 },
179 .probe = apc_probe, 182 .probe = apc_probe,
180}; 183};
181 184
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 9f52db2d441c..ddc84128b3c2 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -104,7 +104,7 @@ MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match)
106{ 106{
107 struct device_node *dp = dev->node; 107 struct device_node *dp = dev->dev.of_node;
108 unsigned long size; 108 unsigned long size;
109 109
110 if (!strcmp(dp->parent->name, "ebus")) { 110 if (!strcmp(dp->parent->name, "ebus")) {
@@ -132,10 +132,11 @@ static int __devinit auxio_probe(struct of_device *dev, const struct of_device_i
132} 132}
133 133
134static struct of_platform_driver auxio_driver = { 134static struct of_platform_driver auxio_driver = {
135 .match_table = auxio_match,
136 .probe = auxio_probe, 135 .probe = auxio_probe,
137 .driver = { 136 .driver = {
138 .name = "auxio", 137 .name = "auxio",
138 .owner = THIS_MODULE,
139 .of_match_table = auxio_match,
139 }, 140 },
140}; 141};
141 142
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 4589ca33220f..434335f65823 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/slab.h>
8#include <linux/string.h> 9#include <linux/string.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/of_device.h> 11#include <linux/of_device.h>
@@ -148,10 +149,11 @@ static struct of_device_id __initdata clock_board_match[] = {
148}; 149};
149 150
150static struct of_platform_driver clock_board_driver = { 151static struct of_platform_driver clock_board_driver = {
151 .match_table = clock_board_match,
152 .probe = clock_board_probe, 152 .probe = clock_board_probe,
153 .driver = { 153 .driver = {
154 .name = "clock_board", 154 .name = "clock_board",
155 .owner = THIS_MODULE,
156 .of_match_table = clock_board_match,
155 }, 157 },
156}; 158};
157 159
@@ -167,7 +169,7 @@ static int __devinit fhc_probe(struct of_device *op,
167 goto out; 169 goto out;
168 } 170 }
169 171
170 if (!strcmp(op->node->parent->name, "central")) 172 if (!strcmp(op->dev.of_node->parent->name, "central"))
171 p->central = true; 173 p->central = true;
172 174
173 p->pregs = of_ioremap(&op->resource[0], 0, 175 p->pregs = of_ioremap(&op->resource[0], 0,
@@ -182,7 +184,7 @@ static int __devinit fhc_probe(struct of_device *op,
182 reg = upa_readl(p->pregs + FHC_PREGS_BSR); 184 reg = upa_readl(p->pregs + FHC_PREGS_BSR);
183 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e); 185 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e);
184 } else { 186 } else {
185 p->board_num = of_getintprop_default(op->node, "board#", -1); 187 p->board_num = of_getintprop_default(op->dev.of_node, "board#", -1);
186 if (p->board_num == -1) { 188 if (p->board_num == -1) {
187 printk(KERN_ERR "fhc: No board# property\n"); 189 printk(KERN_ERR "fhc: No board# property\n");
188 goto out_unmap_pregs; 190 goto out_unmap_pregs;
@@ -253,10 +255,11 @@ static struct of_device_id __initdata fhc_match[] = {
253}; 255};
254 256
255static struct of_platform_driver fhc_driver = { 257static struct of_platform_driver fhc_driver = {
256 .match_table = fhc_match,
257 .probe = fhc_probe, 258 .probe = fhc_probe,
258 .driver = { 259 .driver = {
259 .name = "fhc", 260 .name = "fhc",
261 .owner = THIS_MODULE,
262 .of_match_table = fhc_match,
260 }, 263 },
261}; 264};
262 265
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index e1a9598e2a4d..870cb65b3f21 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -425,7 +425,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
425 INIT_LIST_HEAD(&p->list); 425 INIT_LIST_HEAD(&p->list);
426 426
427 err = -ENODEV; 427 err = -ENODEV;
428 prop = of_get_property(op->node, "portid", &len); 428 prop = of_get_property(op->dev.of_node, "portid", &len);
429 if (!prop || len != 4) { 429 if (!prop || len != 4) {
430 printk(KERN_ERR PFX "Cannot find portid.\n"); 430 printk(KERN_ERR PFX "Cannot find portid.\n");
431 goto out_free; 431 goto out_free;
@@ -433,7 +433,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
433 433
434 p->portid = *prop; 434 p->portid = *prop;
435 435
436 prop = of_get_property(op->node, "memory-control-register-1", &len); 436 prop = of_get_property(op->dev.of_node, "memory-control-register-1", &len);
437 if (!prop || len != 8) { 437 if (!prop || len != 8) {
438 printk(KERN_ERR PFX "Cannot get memory control register 1.\n"); 438 printk(KERN_ERR PFX "Cannot get memory control register 1.\n");
439 goto out_free; 439 goto out_free;
@@ -449,7 +449,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
449 } 449 }
450 450
451 err = -ENODEV; 451 err = -ENODEV;
452 ml = of_get_property(op->node, "memory-layout", &p->layout_len); 452 ml = of_get_property(op->dev.of_node, "memory-layout", &p->layout_len);
453 if (!ml) { 453 if (!ml) {
454 printk(KERN_ERR PFX "Cannot get memory layout property.\n"); 454 printk(KERN_ERR PFX "Cannot get memory layout property.\n");
455 goto out_iounmap; 455 goto out_iounmap;
@@ -466,7 +466,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
466 mc_list_add(&p->list); 466 mc_list_add(&p->list);
467 467
468 printk(KERN_INFO PFX "UltraSPARC-IIIi memory controller at %s\n", 468 printk(KERN_INFO PFX "UltraSPARC-IIIi memory controller at %s\n",
469 op->node->full_name); 469 op->dev.of_node->full_name);
470 470
471 dev_set_drvdata(&op->dev, p); 471 dev_set_drvdata(&op->dev, p);
472 472
@@ -693,7 +693,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
693static int __devinit chmc_probe(struct of_device *op, 693static int __devinit chmc_probe(struct of_device *op,
694 const struct of_device_id *match) 694 const struct of_device_id *match)
695{ 695{
696 struct device_node *dp = op->node; 696 struct device_node *dp = op->dev.of_node;
697 unsigned long ver; 697 unsigned long ver;
698 const void *pval; 698 const void *pval;
699 int len, portid; 699 int len, portid;
@@ -811,8 +811,11 @@ static const struct of_device_id us3mc_match[] = {
811MODULE_DEVICE_TABLE(of, us3mc_match); 811MODULE_DEVICE_TABLE(of, us3mc_match);
812 812
813static struct of_platform_driver us3mc_driver = { 813static struct of_platform_driver us3mc_driver = {
814 .name = "us3mc", 814 .driver = {
815 .match_table = us3mc_match, 815 .name = "us3mc",
816 .owner = THIS_MODULE,
817 .of_match_table = us3mc_match,
818 },
816 .probe = us3mc_probe, 819 .probe = us3mc_probe,
817 .remove = __devexit_p(us3mc_remove), 820 .remove = __devexit_p(us3mc_remove),
818}; 821};
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index 7430ed080b23..8de64c8126bc 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/slab.h>
7#include <linux/kernel.h> 8#include <linux/kernel.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/cpumask.h> 10#include <linux/cpumask.h>
diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c
index 9103a56b39e8..03ab022e51c5 100644
--- a/arch/sparc/kernel/ftrace.c
+++ b/arch/sparc/kernel/ftrace.c
@@ -13,7 +13,7 @@ static const u32 ftrace_nop = 0x01000000;
13 13
14static u32 ftrace_call_replace(unsigned long ip, unsigned long addr) 14static u32 ftrace_call_replace(unsigned long ip, unsigned long addr)
15{ 15{
16 static u32 call; 16 u32 call;
17 s32 off; 17 s32 off;
18 18
19 off = ((s32)addr - (s32)ip); 19 off = ((s32)addr - (s32)ip);
@@ -91,3 +91,61 @@ int __init ftrace_dyn_arch_init(void *data)
91 return 0; 91 return 0;
92} 92}
93#endif 93#endif
94
95#ifdef CONFIG_FUNCTION_GRAPH_TRACER
96
97#ifdef CONFIG_DYNAMIC_FTRACE
98extern void ftrace_graph_call(void);
99
100int ftrace_enable_ftrace_graph_caller(void)
101{
102 unsigned long ip = (unsigned long)(&ftrace_graph_call);
103 u32 old, new;
104
105 old = *(u32 *) &ftrace_graph_call;
106 new = ftrace_call_replace(ip, (unsigned long) &ftrace_graph_caller);
107 return ftrace_modify_code(ip, old, new);
108}
109
110int ftrace_disable_ftrace_graph_caller(void)
111{
112 unsigned long ip = (unsigned long)(&ftrace_graph_call);
113 u32 old, new;
114
115 old = *(u32 *) &ftrace_graph_call;
116 new = ftrace_call_replace(ip, (unsigned long) &ftrace_stub);
117
118 return ftrace_modify_code(ip, old, new);
119}
120
121#endif /* !CONFIG_DYNAMIC_FTRACE */
122
123/*
124 * Hook the return address and push it in the stack of return addrs
125 * in current thread info.
126 */
127unsigned long prepare_ftrace_return(unsigned long parent,
128 unsigned long self_addr,
129 unsigned long frame_pointer)
130{
131 unsigned long return_hooker = (unsigned long) &return_to_handler;
132 struct ftrace_graph_ent trace;
133
134 if (unlikely(atomic_read(&current->tracing_graph_pause)))
135 return parent + 8UL;
136
137 if (ftrace_push_return_trace(parent, self_addr, &trace.depth,
138 frame_pointer) == -EBUSY)
139 return parent + 8UL;
140
141 trace.func = self_addr;
142
143 /* Only trace if the calling function expects to */
144 if (!ftrace_graph_entry(&trace)) {
145 current->curr_ret_stack--;
146 return parent + 8UL;
147 }
148
149 return return_hooker;
150}
151#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
diff --git a/arch/sparc/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 314dd0c9fc5b..92090cc9e829 100644
--- a/arch/sparc/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
@@ -46,6 +46,81 @@ stack_trace_flush:
46 nop 46 nop
47 .size stack_trace_flush,.-stack_trace_flush 47 .size stack_trace_flush,.-stack_trace_flush
48 48
49#ifdef CONFIG_PERF_EVENTS
50 .globl perf_arch_fetch_caller_regs
51 .type perf_arch_fetch_caller_regs,#function
52perf_arch_fetch_caller_regs:
53 /* We always read the %pstate into %o5 since we will use
54 * that to construct a fake %tstate to store into the regs.
55 */
56 rdpr %pstate, %o5
57 brz,pn %o2, 50f
58 mov %o2, %g7
59
60 /* Turn off interrupts while we walk around the register
61 * window by hand.
62 */
63 wrpr %o5, PSTATE_IE, %pstate
64
65 /* The %canrestore tells us how many register windows are
66 * still live in the chip above us, past that we have to
67 * walk the frame as saved on the stack. We stash away
68 * the %cwp in %g1 so we can return back to the original
69 * register window.
70 */
71 rdpr %cwp, %g1
72 rdpr %canrestore, %g2
73 sub %g1, 1, %g3
74
75 /* We have the skip count in %g7, if it hits zero then
76 * %fp/%i7 are the registers we need. Otherwise if our
77 * %canrestore count maintained in %g2 hits zero we have
78 * to start traversing the stack.
79 */
8010: brz,pn %g2, 4f
81 sub %g2, 1, %g2
82 wrpr %g3, %cwp
83 subcc %g7, 1, %g7
84 bne,pt %xcc, 10b
85 sub %g3, 1, %g3
86
87 /* We found the values we need in the cpu's register
88 * windows.
89 */
90 mov %fp, %g3
91 ba,pt %xcc, 3f
92 mov %i7, %g2
93
9450: mov %fp, %g3
95 ba,pt %xcc, 2f
96 mov %i7, %g2
97
98 /* We hit the end of the valid register windows in the
99 * cpu, start traversing the stack frame.
100 */
1014: mov %fp, %g3
102
10320: ldx [%g3 + STACK_BIAS + RW_V9_I7], %g2
104 subcc %g7, 1, %g7
105 bne,pn %xcc, 20b
106 ldx [%g3 + STACK_BIAS + RW_V9_I6], %g3
107
108 /* Restore the current register window position and
109 * re-enable interrupts.
110 */
1113: wrpr %g1, %cwp
112 wrpr %o5, %pstate
113
1142: stx %g3, [%o0 + PT_V9_FP]
115 sllx %o5, 8, %o5
116 stx %o5, [%o0 + PT_V9_TSTATE]
117 stx %g2, [%o0 + PT_V9_TPC]
118 add %g2, 4, %g2
119 retl
120 stx %g2, [%o0 + PT_V9_TNPC]
121 .size perf_arch_fetch_caller_regs,.-perf_arch_fetch_caller_regs
122#endif /* CONFIG_PERF_EVENTS */
123
49#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
50 .globl hard_smp_processor_id 125 .globl hard_smp_processor_id
51 .type hard_smp_processor_id,#function 126 .type hard_smp_processor_id,#function
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c
index 1d272c3b5740..7c60afb835b0 100644
--- a/arch/sparc/kernel/hvapi.c
+++ b/arch/sparc/kernel/hvapi.c
@@ -5,7 +5,6 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/slab.h>
9 8
10#include <asm/hypervisor.h> 9#include <asm/hypervisor.h>
11#include <asm/oplib.h> 10#include <asm/oplib.h>
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 8414549c1834..47977a77f6c6 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/slab.h>
9#include <linux/delay.h> 10#include <linux/delay.h>
10#include <linux/device.h> 11#include <linux/device.h>
11#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 84e5386714cd..703e4aa9bc38 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -290,7 +290,7 @@ static void *sbus_alloc_coherent(struct device *dev, size_t len,
290 if (mmu_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0) 290 if (mmu_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0)
291 goto err_noiommu; 291 goto err_noiommu;
292 292
293 res->name = op->node->name; 293 res->name = op->dev.of_node->name;
294 294
295 return (void *)(unsigned long)res->start; 295 return (void *)(unsigned long)res->start;
296 296
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index e1cbdb94d97b..830d70a3e20b 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -20,7 +20,9 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/ftrace.h>
23#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/kmemleak.h>
24 26
25#include <asm/ptrace.h> 27#include <asm/ptrace.h>
26#include <asm/processor.h> 28#include <asm/processor.h>
@@ -45,6 +47,7 @@
45 47
46#include "entry.h" 48#include "entry.h"
47#include "cpumap.h" 49#include "cpumap.h"
50#include "kstack.h"
48 51
49#define NUM_IVECS (IMAP_INR + 1) 52#define NUM_IVECS (IMAP_INR + 1)
50 53
@@ -647,6 +650,14 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
647 bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC); 650 bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC);
648 if (unlikely(!bucket)) 651 if (unlikely(!bucket))
649 return 0; 652 return 0;
653
654 /* The only reference we store to the IRQ bucket is
655 * by physical address which kmemleak can't see, tell
656 * it that this object explicitly is not a leak and
657 * should be scanned.
658 */
659 kmemleak_not_leak(bucket);
660
650 __flush_dcache_range((unsigned long) bucket, 661 __flush_dcache_range((unsigned long) bucket,
651 ((unsigned long) bucket + 662 ((unsigned long) bucket +
652 sizeof(struct ino_bucket))); 663 sizeof(struct ino_bucket)));
@@ -703,25 +714,7 @@ void ack_bad_irq(unsigned int virt_irq)
703void *hardirq_stack[NR_CPUS]; 714void *hardirq_stack[NR_CPUS];
704void *softirq_stack[NR_CPUS]; 715void *softirq_stack[NR_CPUS];
705 716
706static __attribute__((always_inline)) void *set_hardirq_stack(void) 717void __irq_entry handler_irq(int irq, struct pt_regs *regs)
707{
708 void *orig_sp, *sp = hardirq_stack[smp_processor_id()];
709
710 __asm__ __volatile__("mov %%sp, %0" : "=r" (orig_sp));
711 if (orig_sp < sp ||
712 orig_sp > (sp + THREAD_SIZE)) {
713 sp += THREAD_SIZE - 192 - STACK_BIAS;
714 __asm__ __volatile__("mov %0, %%sp" : : "r" (sp));
715 }
716
717 return orig_sp;
718}
719static __attribute__((always_inline)) void restore_hardirq_stack(void *orig_sp)
720{
721 __asm__ __volatile__("mov %0, %%sp" : : "r" (orig_sp));
722}
723
724void handler_irq(int irq, struct pt_regs *regs)
725{ 718{
726 unsigned long pstate, bucket_pa; 719 unsigned long pstate, bucket_pa;
727 struct pt_regs *old_regs; 720 struct pt_regs *old_regs;
diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c
index 04df4edc0073..539243b236fa 100644
--- a/arch/sparc/kernel/kgdb_32.c
+++ b/arch/sparc/kernel/kgdb_32.c
@@ -158,6 +158,12 @@ void kgdb_arch_exit(void)
158{ 158{
159} 159}
160 160
161void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
162{
163 regs->pc = ip;
164 regs->npc = regs->pc + 4;
165}
166
161struct kgdb_arch arch_kgdb_ops = { 167struct kgdb_arch arch_kgdb_ops = {
162 /* Breakpoint instruction: ta 0x7d */ 168 /* Breakpoint instruction: ta 0x7d */
163 .gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x7d }, 169 .gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x7d },
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index f5a0fd490b59..768290a6c028 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kgdb.h> 6#include <linux/kgdb.h>
7#include <linux/kdebug.h> 7#include <linux/kdebug.h>
8#include <linux/ftrace.h>
8 9
9#include <asm/kdebug.h> 10#include <asm/kdebug.h>
10#include <asm/ptrace.h> 11#include <asm/ptrace.h>
@@ -108,7 +109,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
108} 109}
109 110
110#ifdef CONFIG_SMP 111#ifdef CONFIG_SMP
111void smp_kgdb_capture_client(int irq, struct pt_regs *regs) 112void __irq_entry smp_kgdb_capture_client(int irq, struct pt_regs *regs)
112{ 113{
113 unsigned long flags; 114 unsigned long flags;
114 115
@@ -180,6 +181,12 @@ void kgdb_arch_exit(void)
180{ 181{
181} 182}
182 183
184void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
185{
186 regs->tpc = ip;
187 regs->tnpc = regs->tpc + 4;
188}
189
183struct kgdb_arch arch_kgdb_ops = { 190struct kgdb_arch arch_kgdb_ops = {
184 /* Breakpoint instruction: ta 0x72 */ 191 /* Breakpoint instruction: ta 0x72 */
185 .gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x72 }, 192 .gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x72 },
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 6716584e48ab..a39d1ba5a119 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -7,6 +7,7 @@
7#include <linux/kprobes.h> 7#include <linux/kprobes.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/kdebug.h> 9#include <linux/kdebug.h>
10#include <linux/slab.h>
10#include <asm/signal.h> 11#include <asm/signal.h>
11#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
diff --git a/arch/sparc/kernel/kstack.h b/arch/sparc/kernel/kstack.h
index 5247283d1c03..53dfb92e09fb 100644
--- a/arch/sparc/kernel/kstack.h
+++ b/arch/sparc/kernel/kstack.h
@@ -61,4 +61,23 @@ check_magic:
61 61
62} 62}
63 63
64static inline __attribute__((always_inline)) void *set_hardirq_stack(void)
65{
66 void *orig_sp, *sp = hardirq_stack[smp_processor_id()];
67
68 __asm__ __volatile__("mov %%sp, %0" : "=r" (orig_sp));
69 if (orig_sp < sp ||
70 orig_sp > (sp + THREAD_SIZE)) {
71 sp += THREAD_SIZE - 192 - STACK_BIAS;
72 __asm__ __volatile__("mov %0, %%sp" : : "r" (sp));
73 }
74
75 return orig_sp;
76}
77
78static inline __attribute__((always_inline)) void restore_hardirq_stack(void *orig_sp)
79{
80 __asm__ __volatile__("mov %0, %%sp" : : "r" (orig_sp));
81}
82
64#endif /* _KSTACK_H */ 83#endif /* _KSTACK_H */
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c
index 00d034ea2164..3ae36f36e758 100644
--- a/arch/sparc/kernel/led.c
+++ b/arch/sparc/kernel/led.c
@@ -3,6 +3,7 @@
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/slab.h>
6#include <linux/string.h> 7#include <linux/string.h>
7#include <linux/jiffies.h> 8#include <linux/jiffies.h>
8#include <linux/timer.h> 9#include <linux/timer.h>
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 0409d62d8ca2..6a7b4dbc8e09 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -7,7 +7,6 @@
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/mutex.h> 9#include <linux/mutex.h>
10#include <linux/slab.h>
11#include <linux/of.h> 10#include <linux/of.h>
12#include <linux/of_platform.h> 11#include <linux/of_platform.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 85787577f683..e1656fc41ccb 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -22,6 +22,7 @@
22#include <linux/profile.h> 22#include <linux/profile.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/gfp.h>
25 26
26#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
27#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index cdc91d919e93..83e85c2e802a 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -4,7 +4,7 @@
4 */ 4 */
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/lmb.h> 7#include <linux/memblock.h>
8#include <linux/log2.h> 8#include <linux/log2.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/slab.h> 10#include <linux/slab.h>
@@ -86,7 +86,7 @@ static void mdesc_handle_init(struct mdesc_handle *hp,
86 hp->handle_size = handle_size; 86 hp->handle_size = handle_size;
87} 87}
88 88
89static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size) 89static struct mdesc_handle * __init mdesc_memblock_alloc(unsigned int mdesc_size)
90{ 90{
91 unsigned int handle_size, alloc_size; 91 unsigned int handle_size, alloc_size;
92 struct mdesc_handle *hp; 92 struct mdesc_handle *hp;
@@ -97,7 +97,7 @@ static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
97 mdesc_size); 97 mdesc_size);
98 alloc_size = PAGE_ALIGN(handle_size); 98 alloc_size = PAGE_ALIGN(handle_size);
99 99
100 paddr = lmb_alloc(alloc_size, PAGE_SIZE); 100 paddr = memblock_alloc(alloc_size, PAGE_SIZE);
101 101
102 hp = NULL; 102 hp = NULL;
103 if (paddr) { 103 if (paddr) {
@@ -107,7 +107,7 @@ static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
107 return hp; 107 return hp;
108} 108}
109 109
110static void mdesc_lmb_free(struct mdesc_handle *hp) 110static void mdesc_memblock_free(struct mdesc_handle *hp)
111{ 111{
112 unsigned int alloc_size; 112 unsigned int alloc_size;
113 unsigned long start; 113 unsigned long start;
@@ -120,9 +120,9 @@ static void mdesc_lmb_free(struct mdesc_handle *hp)
120 free_bootmem_late(start, alloc_size); 120 free_bootmem_late(start, alloc_size);
121} 121}
122 122
123static struct mdesc_mem_ops lmb_mdesc_ops = { 123static struct mdesc_mem_ops memblock_mdesc_ops = {
124 .alloc = mdesc_lmb_alloc, 124 .alloc = mdesc_memblock_alloc,
125 .free = mdesc_lmb_free, 125 .free = mdesc_memblock_free,
126}; 126};
127 127
128static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size) 128static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
@@ -914,7 +914,7 @@ void __init sun4v_mdesc_init(void)
914 914
915 printk("MDESC: Size is %lu bytes.\n", len); 915 printk("MDESC: Size is %lu bytes.\n", len);
916 916
917 hp = mdesc_alloc(len, &lmb_mdesc_ops); 917 hp = mdesc_alloc(len, &memblock_mdesc_ops);
918 if (hp == NULL) { 918 if (hp == NULL) {
919 prom_printf("MDESC: alloc of %lu bytes failed.\n", len); 919 prom_printf("MDESC: alloc of %lu bytes failed.\n", len);
920 prom_halt(); 920 prom_halt();
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 0ee642f63234..f848aadf54dc 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -9,9 +9,9 @@
9#include <linux/elf.h> 9#include <linux/elf.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/gfp.h>
12#include <linux/string.h> 13#include <linux/string.h>
13#include <linux/ctype.h> 14#include <linux/ctype.h>
14#include <linux/slab.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/processor.h> 17#include <asm/processor.h>
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index b287b62c7ea3..a4bd7ba74c89 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -23,6 +23,8 @@
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/pcr.h> 24#include <asm/pcr.h>
25 25
26#include "kstack.h"
27
26/* We don't have a real NMI on sparc64, but we can fake one 28/* We don't have a real NMI on sparc64, but we can fake one
27 * up using profiling counter overflow interrupts and interrupt 29 * up using profiling counter overflow interrupts and interrupt
28 * levels. 30 * levels.
@@ -92,7 +94,7 @@ static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
92notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) 94notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
93{ 95{
94 unsigned int sum, touched = 0; 96 unsigned int sum, touched = 0;
95 int cpu = smp_processor_id(); 97 void *orig_sp;
96 98
97 clear_softint(1 << irq); 99 clear_softint(1 << irq);
98 100
@@ -100,13 +102,15 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
100 102
101 nmi_enter(); 103 nmi_enter();
102 104
105 orig_sp = set_hardirq_stack();
106
103 if (notify_die(DIE_NMI, "nmi", regs, 0, 107 if (notify_die(DIE_NMI, "nmi", regs, 0,
104 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) 108 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
105 touched = 1; 109 touched = 1;
106 else 110 else
107 pcr_ops->write(PCR_PIC_PRIV); 111 pcr_ops->write(PCR_PIC_PRIV);
108 112
109 sum = kstat_irqs_cpu(0, cpu); 113 sum = local_cpu_data().irq0_irqs;
110 if (__get_cpu_var(nmi_touch)) { 114 if (__get_cpu_var(nmi_touch)) {
111 __get_cpu_var(nmi_touch) = 0; 115 __get_cpu_var(nmi_touch) = 0;
112 touched = 1; 116 touched = 1;
@@ -125,6 +129,8 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
125 pcr_ops->write(pcr_enable); 129 pcr_ops->write(pcr_enable);
126 } 130 }
127 131
132 restore_hardirq_stack(orig_sp);
133
128 nmi_exit(); 134 nmi_exit();
129} 135}
130 136
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index da527b33ebc7..47e63f1e719c 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -254,10 +254,10 @@ static void __init build_device_resources(struct of_device *op,
254 return; 254 return;
255 255
256 p_op = to_of_device(parent); 256 p_op = to_of_device(parent);
257 bus = of_match_bus(p_op->node); 257 bus = of_match_bus(p_op->dev.of_node);
258 bus->count_cells(op->node, &na, &ns); 258 bus->count_cells(op->dev.of_node, &na, &ns);
259 259
260 preg = of_get_property(op->node, bus->addr_prop_name, &num_reg); 260 preg = of_get_property(op->dev.of_node, bus->addr_prop_name, &num_reg);
261 if (!preg || num_reg == 0) 261 if (!preg || num_reg == 0)
262 return; 262 return;
263 263
@@ -271,8 +271,8 @@ static void __init build_device_resources(struct of_device *op,
271 struct resource *r = &op->resource[index]; 271 struct resource *r = &op->resource[index];
272 u32 addr[OF_MAX_ADDR_CELLS]; 272 u32 addr[OF_MAX_ADDR_CELLS];
273 const u32 *reg = (preg + (index * ((na + ns) * 4))); 273 const u32 *reg = (preg + (index * ((na + ns) * 4)));
274 struct device_node *dp = op->node; 274 struct device_node *dp = op->dev.of_node;
275 struct device_node *pp = p_op->node; 275 struct device_node *pp = p_op->dev.of_node;
276 struct of_bus *pbus, *dbus; 276 struct of_bus *pbus, *dbus;
277 u64 size, result = OF_BAD_ADDR; 277 u64 size, result = OF_BAD_ADDR;
278 unsigned long flags; 278 unsigned long flags;
@@ -321,7 +321,7 @@ static void __init build_device_resources(struct of_device *op,
321 321
322 if (of_resource_verbose) 322 if (of_resource_verbose)
323 printk("%s reg[%d] -> %llx\n", 323 printk("%s reg[%d] -> %llx\n",
324 op->node->full_name, index, 324 op->dev.of_node->full_name, index,
325 result); 325 result);
326 326
327 if (result != OF_BAD_ADDR) { 327 if (result != OF_BAD_ADDR) {
@@ -329,7 +329,7 @@ static void __init build_device_resources(struct of_device *op,
329 r->end = result + size - 1; 329 r->end = result + size - 1;
330 r->flags = flags | ((result >> 32ULL) & 0xffUL); 330 r->flags = flags | ((result >> 32ULL) & 0xffUL);
331 } 331 }
332 r->name = op->node->name; 332 r->name = op->dev.of_node->name;
333 } 333 }
334} 334}
335 335
@@ -345,10 +345,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
345 return NULL; 345 return NULL;
346 346
347 sd = &op->dev.archdata; 347 sd = &op->dev.archdata;
348 sd->prom_node = dp;
349 sd->op = op; 348 sd->op = op;
350 349
351 op->node = dp; 350 op->dev.of_node = dp;
352 351
353 op->clock_freq = of_getintprop_default(dp, "clock-frequency", 352 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
354 (25*1000*1000)); 353 (25*1000*1000));
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index b3d4cb5d21b3..1dae8079f728 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -323,10 +323,10 @@ static void __init build_device_resources(struct of_device *op,
323 return; 323 return;
324 324
325 p_op = to_of_device(parent); 325 p_op = to_of_device(parent);
326 bus = of_match_bus(p_op->node); 326 bus = of_match_bus(p_op->dev.of_node);
327 bus->count_cells(op->node, &na, &ns); 327 bus->count_cells(op->dev.of_node, &na, &ns);
328 328
329 preg = of_get_property(op->node, bus->addr_prop_name, &num_reg); 329 preg = of_get_property(op->dev.of_node, bus->addr_prop_name, &num_reg);
330 if (!preg || num_reg == 0) 330 if (!preg || num_reg == 0)
331 return; 331 return;
332 332
@@ -340,7 +340,7 @@ static void __init build_device_resources(struct of_device *op,
340 if (num_reg > PROMREG_MAX) { 340 if (num_reg > PROMREG_MAX) {
341 printk(KERN_WARNING "%s: Too many regs (%d), " 341 printk(KERN_WARNING "%s: Too many regs (%d), "
342 "limiting to %d.\n", 342 "limiting to %d.\n",
343 op->node->full_name, num_reg, PROMREG_MAX); 343 op->dev.of_node->full_name, num_reg, PROMREG_MAX);
344 num_reg = PROMREG_MAX; 344 num_reg = PROMREG_MAX;
345 } 345 }
346 346
@@ -348,8 +348,8 @@ static void __init build_device_resources(struct of_device *op,
348 struct resource *r = &op->resource[index]; 348 struct resource *r = &op->resource[index];
349 u32 addr[OF_MAX_ADDR_CELLS]; 349 u32 addr[OF_MAX_ADDR_CELLS];
350 const u32 *reg = (preg + (index * ((na + ns) * 4))); 350 const u32 *reg = (preg + (index * ((na + ns) * 4)));
351 struct device_node *dp = op->node; 351 struct device_node *dp = op->dev.of_node;
352 struct device_node *pp = p_op->node; 352 struct device_node *pp = p_op->dev.of_node;
353 struct of_bus *pbus, *dbus; 353 struct of_bus *pbus, *dbus;
354 u64 size, result = OF_BAD_ADDR; 354 u64 size, result = OF_BAD_ADDR;
355 unsigned long flags; 355 unsigned long flags;
@@ -397,7 +397,7 @@ static void __init build_device_resources(struct of_device *op,
397 397
398 if (of_resource_verbose) 398 if (of_resource_verbose)
399 printk("%s reg[%d] -> %llx\n", 399 printk("%s reg[%d] -> %llx\n",
400 op->node->full_name, index, 400 op->dev.of_node->full_name, index,
401 result); 401 result);
402 402
403 if (result != OF_BAD_ADDR) { 403 if (result != OF_BAD_ADDR) {
@@ -408,7 +408,7 @@ static void __init build_device_resources(struct of_device *op,
408 r->end = result + size - 1; 408 r->end = result + size - 1;
409 r->flags = flags; 409 r->flags = flags;
410 } 410 }
411 r->name = op->node->name; 411 r->name = op->dev.of_node->name;
412 } 412 }
413} 413}
414 414
@@ -530,7 +530,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
530 struct device *parent, 530 struct device *parent,
531 unsigned int irq) 531 unsigned int irq)
532{ 532{
533 struct device_node *dp = op->node; 533 struct device_node *dp = op->dev.of_node;
534 struct device_node *pp, *ip; 534 struct device_node *pp, *ip;
535 unsigned int orig_irq = irq; 535 unsigned int orig_irq = irq;
536 int nid; 536 int nid;
@@ -575,7 +575,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
575 575
576 if (of_irq_verbose) 576 if (of_irq_verbose)
577 printk("%s: Apply [%s:%x] imap --> [%s:%x]\n", 577 printk("%s: Apply [%s:%x] imap --> [%s:%x]\n",
578 op->node->full_name, 578 op->dev.of_node->full_name,
579 pp->full_name, this_orig_irq, 579 pp->full_name, this_orig_irq,
580 (iret ? iret->full_name : "NULL"), irq); 580 (iret ? iret->full_name : "NULL"), irq);
581 581
@@ -594,7 +594,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
594 if (of_irq_verbose) 594 if (of_irq_verbose)
595 printk("%s: PCI swizzle [%s] " 595 printk("%s: PCI swizzle [%s] "
596 "%x --> %x\n", 596 "%x --> %x\n",
597 op->node->full_name, 597 op->dev.of_node->full_name,
598 pp->full_name, this_orig_irq, 598 pp->full_name, this_orig_irq,
599 irq); 599 irq);
600 600
@@ -611,11 +611,11 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
611 if (!ip) 611 if (!ip)
612 return orig_irq; 612 return orig_irq;
613 613
614 irq = ip->irq_trans->irq_build(op->node, irq, 614 irq = ip->irq_trans->irq_build(op->dev.of_node, irq,
615 ip->irq_trans->data); 615 ip->irq_trans->data);
616 if (of_irq_verbose) 616 if (of_irq_verbose)
617 printk("%s: Apply IRQ trans [%s] %x --> %x\n", 617 printk("%s: Apply IRQ trans [%s] %x --> %x\n",
618 op->node->full_name, ip->full_name, orig_irq, irq); 618 op->dev.of_node->full_name, ip->full_name, orig_irq, irq);
619 619
620out: 620out:
621 nid = of_node_to_nid(dp); 621 nid = of_node_to_nid(dp);
@@ -640,10 +640,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
640 return NULL; 640 return NULL;
641 641
642 sd = &op->dev.archdata; 642 sd = &op->dev.archdata;
643 sd->prom_node = dp;
644 sd->op = op; 643 sd->op = op;
645 644
646 op->node = dp; 645 op->dev.of_node = dp;
647 646
648 op->clock_freq = of_getintprop_default(dp, "clock-frequency", 647 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
649 (25*1000*1000)); 648 (25*1000*1000));
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index cb8eb799bb6c..10c6c36a6e75 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -4,7 +4,6 @@
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/mod_devicetable.h> 6#include <linux/mod_devicetable.h>
7#include <linux/slab.h>
8#include <linux/errno.h> 7#include <linux/errno.h>
9#include <linux/irq.h> 8#include <linux/irq.h>
10#include <linux/of_device.h> 9#include <linux/of_device.h>
@@ -17,7 +16,7 @@ static int node_match(struct device *dev, void *data)
17 struct of_device *op = to_of_device(dev); 16 struct of_device *op = to_of_device(dev);
18 struct device_node *dp = data; 17 struct device_node *dp = data;
19 18
20 return (op->node == dp); 19 return (op->dev.of_node == dp);
21} 20}
22 21
23struct of_device *of_find_device_by_node(struct device_node *dp) 22struct of_device *of_find_device_by_node(struct device_node *dp)
@@ -49,7 +48,7 @@ EXPORT_SYMBOL(irq_of_parse_and_map);
49void of_propagate_archdata(struct of_device *bus) 48void of_propagate_archdata(struct of_device *bus)
50{ 49{
51 struct dev_archdata *bus_sd = &bus->dev.archdata; 50 struct dev_archdata *bus_sd = &bus->dev.archdata;
52 struct device_node *bus_dp = bus->node; 51 struct device_node *bus_dp = bus->dev.of_node;
53 struct device_node *dp; 52 struct device_node *dp;
54 53
55 for (dp = bus_dp->child; dp; dp = dp->sibling) { 54 for (dp = bus_dp->child; dp; dp = dp->sibling) {
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 5ac539a5930f..8a8363adb8bd 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -261,7 +261,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
261 sd->iommu = pbm->iommu; 261 sd->iommu = pbm->iommu;
262 sd->stc = &pbm->stc; 262 sd->stc = &pbm->stc;
263 sd->host_controller = pbm; 263 sd->host_controller = pbm;
264 sd->prom_node = node;
265 sd->op = op = of_find_device_by_node(node); 264 sd->op = op = of_find_device_by_node(node);
266 sd->numa_node = pbm->numa_node; 265 sd->numa_node = pbm->numa_node;
267 266
@@ -285,6 +284,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
285 dev->sysdata = node; 284 dev->sysdata = node;
286 dev->dev.parent = bus->bridge; 285 dev->dev.parent = bus->bridge;
287 dev->dev.bus = &pci_bus_type; 286 dev->dev.bus = &pci_bus_type;
287 dev->dev.of_node = node;
288 dev->devfn = devfn; 288 dev->devfn = devfn;
289 dev->multifunction = 0; /* maybe a lie? */ 289 dev->multifunction = 0; /* maybe a lie? */
290 set_pcie_port_type(dev); 290 set_pcie_port_type(dev);
@@ -653,7 +653,7 @@ show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char *
653 struct device_node *dp; 653 struct device_node *dp;
654 654
655 pdev = to_pci_dev(dev); 655 pdev = to_pci_dev(dev);
656 dp = pdev->dev.archdata.prom_node; 656 dp = pdev->dev.of_node;
657 657
658 return snprintf (buf, PAGE_SIZE, "%s\n", dp->full_name); 658 return snprintf (buf, PAGE_SIZE, "%s\n", dp->full_name);
659} 659}
@@ -683,7 +683,7 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
683struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm, 683struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
684 struct device *parent) 684 struct device *parent)
685{ 685{
686 struct device_node *node = pbm->op->node; 686 struct device_node *node = pbm->op->dev.of_node;
687 struct pci_bus *bus; 687 struct pci_bus *bus;
688 688
689 printk("PCI: Scanning PBM %s\n", node->full_name); 689 printk("PCI: Scanning PBM %s\n", node->full_name);
@@ -1022,7 +1022,7 @@ void arch_teardown_msi_irq(unsigned int virt_irq)
1022 1022
1023struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) 1023struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
1024{ 1024{
1025 return pdev->dev.archdata.prom_node; 1025 return pdev->dev.of_node;
1026} 1026}
1027EXPORT_SYMBOL(pci_device_to_OF_node); 1027EXPORT_SYMBOL(pci_device_to_OF_node);
1028 1028
@@ -1151,15 +1151,13 @@ static int __init of_pci_slot_init(void)
1151 struct device_node *node; 1151 struct device_node *node;
1152 1152
1153 if (pbus->self) { 1153 if (pbus->self) {
1154 struct dev_archdata *sd = pbus->self->sysdata;
1155
1156 /* PCI->PCI bridge */ 1154 /* PCI->PCI bridge */
1157 node = sd->prom_node; 1155 node = pbus->self->dev.of_node;
1158 } else { 1156 } else {
1159 struct pci_pbm_info *pbm = pbus->sysdata; 1157 struct pci_pbm_info *pbm = pbus->sysdata;
1160 1158
1161 /* Host PCI controller */ 1159 /* Host PCI controller */
1162 node = pbm->op->node; 1160 node = pbm->op->dev.of_node;
1163 } 1161 }
1164 1162
1165 pci_bus_slot_names(node, pbus); 1163 pci_bus_slot_names(node, pbus);
diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index b775658a927d..6c7a33af3ba6 100644
--- a/arch/sparc/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
@@ -314,12 +314,12 @@ struct pci_ops sun4v_pci_ops = {
314 314
315void pci_get_pbm_props(struct pci_pbm_info *pbm) 315void pci_get_pbm_props(struct pci_pbm_info *pbm)
316{ 316{
317 const u32 *val = of_get_property(pbm->op->node, "bus-range", NULL); 317 const u32 *val = of_get_property(pbm->op->dev.of_node, "bus-range", NULL);
318 318
319 pbm->pci_first_busno = val[0]; 319 pbm->pci_first_busno = val[0];
320 pbm->pci_last_busno = val[1]; 320 pbm->pci_last_busno = val[1];
321 321
322 val = of_get_property(pbm->op->node, "ino-bitmap", NULL); 322 val = of_get_property(pbm->op->dev.of_node, "ino-bitmap", NULL);
323 if (val) { 323 if (val) {
324 pbm->ino_bitmap = (((u64)val[1] << 32UL) | 324 pbm->ino_bitmap = (((u64)val[1] << 32UL) |
325 ((u64)val[0] << 0UL)); 325 ((u64)val[0] << 0UL));
@@ -365,20 +365,26 @@ static void pci_register_legacy_regions(struct resource *io_res,
365 365
366static void pci_register_iommu_region(struct pci_pbm_info *pbm) 366static void pci_register_iommu_region(struct pci_pbm_info *pbm)
367{ 367{
368 const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL); 368 const u32 *vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma",
369 NULL);
369 370
370 if (vdma) { 371 if (vdma) {
371 struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL); 372 struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
372 373
373 if (!rp) { 374 if (!rp) {
374 prom_printf("Cannot allocate IOMMU resource.\n"); 375 pr_info("%s: Cannot allocate IOMMU resource.\n",
375 prom_halt(); 376 pbm->name);
377 return;
376 } 378 }
377 rp->name = "IOMMU"; 379 rp->name = "IOMMU";
378 rp->start = pbm->mem_space.start + (unsigned long) vdma[0]; 380 rp->start = pbm->mem_space.start + (unsigned long) vdma[0];
379 rp->end = rp->start + (unsigned long) vdma[1] - 1UL; 381 rp->end = rp->start + (unsigned long) vdma[1] - 1UL;
380 rp->flags = IORESOURCE_BUSY; 382 rp->flags = IORESOURCE_BUSY;
381 request_resource(&pbm->mem_space, rp); 383 if (request_resource(&pbm->mem_space, rp)) {
384 pr_info("%s: Unable to request IOMMU resource.\n",
385 pbm->name);
386 kfree(rp);
387 }
382 } 388 }
383} 389}
384 390
@@ -389,7 +395,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
389 int num_pbm_ranges; 395 int num_pbm_ranges;
390 396
391 saw_mem = saw_io = 0; 397 saw_mem = saw_io = 0;
392 pbm_ranges = of_get_property(pbm->op->node, "ranges", &i); 398 pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i);
393 if (!pbm_ranges) { 399 if (!pbm_ranges) {
394 prom_printf("PCI: Fatal error, missing PBM ranges property " 400 prom_printf("PCI: Fatal error, missing PBM ranges property "
395 " for %s\n", 401 " for %s\n",
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index d53f45bc7dda..51cfa09e392a 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -413,7 +413,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
413 struct of_device *op, u32 portid) 413 struct of_device *op, u32 portid)
414{ 414{
415 const struct linux_prom64_registers *regs; 415 const struct linux_prom64_registers *regs;
416 struct device_node *dp = op->node; 416 struct device_node *dp = op->dev.of_node;
417 int err; 417 int err;
418 418
419 pbm->numa_node = -1; 419 pbm->numa_node = -1;
@@ -458,7 +458,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
458static int __devinit fire_probe(struct of_device *op, 458static int __devinit fire_probe(struct of_device *op,
459 const struct of_device_id *match) 459 const struct of_device_id *match)
460{ 460{
461 struct device_node *dp = op->node; 461 struct device_node *dp = op->dev.of_node;
462 struct pci_pbm_info *pbm; 462 struct pci_pbm_info *pbm;
463 struct iommu *iommu; 463 struct iommu *iommu;
464 u32 portid; 464 u32 portid;
@@ -508,8 +508,11 @@ static struct of_device_id __initdata fire_match[] = {
508}; 508};
509 509
510static struct of_platform_driver fire_driver = { 510static struct of_platform_driver fire_driver = {
511 .name = DRIVER_NAME, 511 .driver = {
512 .match_table = fire_match, 512 .name = DRIVER_NAME,
513 .owner = THIS_MODULE,
514 .of_match_table = fire_match,
515 },
513 .probe = fire_probe, 516 .probe = fire_probe,
514}; 517};
515 518
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index e1b0541feb19..548b8ca9c210 100644
--- a/arch/sparc/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -4,6 +4,7 @@
4 */ 4 */
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/interrupt.h> 6#include <linux/interrupt.h>
7#include <linux/slab.h>
7#include <linux/irq.h> 8#include <linux/irq.h>
8 9
9#include "pci_impl.h" 10#include "pci_impl.h"
@@ -323,7 +324,7 @@ void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
323 const u32 *val; 324 const u32 *val;
324 int len; 325 int len;
325 326
326 val = of_get_property(pbm->op->node, "#msi-eqs", &len); 327 val = of_get_property(pbm->op->dev.of_node, "#msi-eqs", &len);
327 if (!val || len != 4) 328 if (!val || len != 4)
328 goto no_msi; 329 goto no_msi;
329 pbm->msiq_num = *val; 330 pbm->msiq_num = *val;
@@ -346,16 +347,16 @@ void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
346 u32 msi64_len; 347 u32 msi64_len;
347 } *arng; 348 } *arng;
348 349
349 val = of_get_property(pbm->op->node, "msi-eq-size", &len); 350 val = of_get_property(pbm->op->dev.of_node, "msi-eq-size", &len);
350 if (!val || len != 4) 351 if (!val || len != 4)
351 goto no_msi; 352 goto no_msi;
352 353
353 pbm->msiq_ent_count = *val; 354 pbm->msiq_ent_count = *val;
354 355
355 mqp = of_get_property(pbm->op->node, 356 mqp = of_get_property(pbm->op->dev.of_node,
356 "msi-eq-to-devino", &len); 357 "msi-eq-to-devino", &len);
357 if (!mqp) 358 if (!mqp)
358 mqp = of_get_property(pbm->op->node, 359 mqp = of_get_property(pbm->op->dev.of_node,
359 "msi-eq-devino", &len); 360 "msi-eq-devino", &len);
360 if (!mqp || len != sizeof(struct msiq_prop)) 361 if (!mqp || len != sizeof(struct msiq_prop))
361 goto no_msi; 362 goto no_msi;
@@ -363,27 +364,27 @@ void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
363 pbm->msiq_first = mqp->first_msiq; 364 pbm->msiq_first = mqp->first_msiq;
364 pbm->msiq_first_devino = mqp->first_devino; 365 pbm->msiq_first_devino = mqp->first_devino;
365 366
366 val = of_get_property(pbm->op->node, "#msi", &len); 367 val = of_get_property(pbm->op->dev.of_node, "#msi", &len);
367 if (!val || len != 4) 368 if (!val || len != 4)
368 goto no_msi; 369 goto no_msi;
369 pbm->msi_num = *val; 370 pbm->msi_num = *val;
370 371
371 mrng = of_get_property(pbm->op->node, "msi-ranges", &len); 372 mrng = of_get_property(pbm->op->dev.of_node, "msi-ranges", &len);
372 if (!mrng || len != sizeof(struct msi_range_prop)) 373 if (!mrng || len != sizeof(struct msi_range_prop))
373 goto no_msi; 374 goto no_msi;
374 pbm->msi_first = mrng->first_msi; 375 pbm->msi_first = mrng->first_msi;
375 376
376 val = of_get_property(pbm->op->node, "msi-data-mask", &len); 377 val = of_get_property(pbm->op->dev.of_node, "msi-data-mask", &len);
377 if (!val || len != 4) 378 if (!val || len != 4)
378 goto no_msi; 379 goto no_msi;
379 pbm->msi_data_mask = *val; 380 pbm->msi_data_mask = *val;
380 381
381 val = of_get_property(pbm->op->node, "msix-data-width", &len); 382 val = of_get_property(pbm->op->dev.of_node, "msix-data-width", &len);
382 if (!val || len != 4) 383 if (!val || len != 4)
383 goto no_msi; 384 goto no_msi;
384 pbm->msix_data_width = *val; 385 pbm->msix_data_width = *val;
385 386
386 arng = of_get_property(pbm->op->node, "msi-address-ranges", 387 arng = of_get_property(pbm->op->dev.of_node, "msi-address-ranges",
387 &len); 388 &len);
388 if (!arng || len != sizeof(struct addr_range_prop)) 389 if (!arng || len != sizeof(struct addr_range_prop))
389 goto no_msi; 390 goto no_msi;
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 142b9d6984a8..558a70512824 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -285,7 +285,7 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ 285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
286static void psycho_register_error_handlers(struct pci_pbm_info *pbm) 286static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
287{ 287{
288 struct of_device *op = of_find_device_by_node(pbm->op->node); 288 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
289 unsigned long base = pbm->controller_regs; 289 unsigned long base = pbm->controller_regs;
290 u64 tmp; 290 u64 tmp;
291 int err; 291 int err;
@@ -507,7 +507,7 @@ static int __devinit psycho_probe(struct of_device *op,
507 const struct of_device_id *match) 507 const struct of_device_id *match)
508{ 508{
509 const struct linux_prom64_registers *pr_regs; 509 const struct linux_prom64_registers *pr_regs;
510 struct device_node *dp = op->node; 510 struct device_node *dp = op->dev.of_node;
511 struct pci_pbm_info *pbm; 511 struct pci_pbm_info *pbm;
512 struct iommu *iommu; 512 struct iommu *iommu;
513 int is_pbm_a, err; 513 int is_pbm_a, err;
@@ -602,8 +602,11 @@ static struct of_device_id __initdata psycho_match[] = {
602}; 602};
603 603
604static struct of_platform_driver psycho_driver = { 604static struct of_platform_driver psycho_driver = {
605 .name = DRIVER_NAME, 605 .driver = {
606 .match_table = psycho_match, 606 .name = DRIVER_NAME,
607 .owner = THIS_MODULE,
608 .of_match_table = psycho_match,
609 },
607 .probe = psycho_probe, 610 .probe = psycho_probe,
608}; 611};
609 612
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index ba6fbeba3e2c..6dad8e3b7506 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -310,7 +310,7 @@ static irqreturn_t sabre_ce_intr(int irq, void *dev_id)
310 310
311static void sabre_register_error_handlers(struct pci_pbm_info *pbm) 311static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
312{ 312{
313 struct device_node *dp = pbm->op->node; 313 struct device_node *dp = pbm->op->dev.of_node;
314 struct of_device *op; 314 struct of_device *op;
315 unsigned long base = pbm->controller_regs; 315 unsigned long base = pbm->controller_regs;
316 u64 tmp; 316 u64 tmp;
@@ -456,7 +456,7 @@ static int __devinit sabre_probe(struct of_device *op,
456 const struct of_device_id *match) 456 const struct of_device_id *match)
457{ 457{
458 const struct linux_prom64_registers *pr_regs; 458 const struct linux_prom64_registers *pr_regs;
459 struct device_node *dp = op->node; 459 struct device_node *dp = op->dev.of_node;
460 struct pci_pbm_info *pbm; 460 struct pci_pbm_info *pbm;
461 u32 upa_portid, dma_mask; 461 u32 upa_portid, dma_mask;
462 struct iommu *iommu; 462 struct iommu *iommu;
@@ -596,8 +596,11 @@ static struct of_device_id __initdata sabre_match[] = {
596}; 596};
597 597
598static struct of_platform_driver sabre_driver = { 598static struct of_platform_driver sabre_driver = {
599 .name = DRIVER_NAME, 599 .driver = {
600 .match_table = sabre_match, 600 .name = DRIVER_NAME,
601 .owner = THIS_MODULE,
602 .of_match_table = sabre_match,
603 },
601 .probe = sabre_probe, 604 .probe = sabre_probe,
602}; 605};
603 606
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 2b5cdde77af7..97a1ae2e1c02 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -844,7 +844,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
844 */ 844 */
845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) 845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
846{ 846{
847 struct of_device *op = of_find_device_by_node(pbm->op->node); 847 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
848 u64 tmp, err_mask, err_no_mask; 848 u64 tmp, err_mask, err_no_mask;
849 int err; 849 int err;
850 850
@@ -939,7 +939,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
939 939
940static void schizo_register_error_handlers(struct pci_pbm_info *pbm) 940static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
941{ 941{
942 struct of_device *op = of_find_device_by_node(pbm->op->node); 942 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
943 u64 tmp, err_mask, err_no_mask; 943 u64 tmp, err_mask, err_no_mask;
944 int err; 944 int err;
945 945
@@ -1068,7 +1068,7 @@ static void __devinit schizo_scan_bus(struct pci_pbm_info *pbm,
1068{ 1068{
1069 pbm_config_busmastering(pbm); 1069 pbm_config_busmastering(pbm);
1070 pbm->is_66mhz_capable = 1070 pbm->is_66mhz_capable =
1071 (of_find_property(pbm->op->node, "66mhz-capable", NULL) 1071 (of_find_property(pbm->op->dev.of_node, "66mhz-capable", NULL)
1072 != NULL); 1072 != NULL);
1073 1073
1074 pbm->pci_bus = pci_scan_one_pbm(pbm, parent); 1074 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
@@ -1138,7 +1138,7 @@ static int schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1138 u32 dma_mask; 1138 u32 dma_mask;
1139 u64 control; 1139 u64 control;
1140 1140
1141 vdma = of_get_property(pbm->op->node, "virtual-dma", NULL); 1141 vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", NULL);
1142 if (!vdma) 1142 if (!vdma)
1143 vdma = vdma_default; 1143 vdma = vdma_default;
1144 1144
@@ -1268,7 +1268,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1268 pbm->chip_version >= 0x2) 1268 pbm->chip_version >= 0x2)
1269 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; 1269 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT;
1270 1270
1271 if (!of_find_property(pbm->op->node, "no-bus-parking", NULL)) 1271 if (!of_find_property(pbm->op->dev.of_node, "no-bus-parking", NULL))
1272 tmp |= SCHIZO_PCICTRL_PARK; 1272 tmp |= SCHIZO_PCICTRL_PARK;
1273 else 1273 else
1274 tmp &= ~SCHIZO_PCICTRL_PARK; 1274 tmp &= ~SCHIZO_PCICTRL_PARK;
@@ -1311,7 +1311,7 @@ static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
1311 int chip_type) 1311 int chip_type)
1312{ 1312{
1313 const struct linux_prom64_registers *regs; 1313 const struct linux_prom64_registers *regs;
1314 struct device_node *dp = op->node; 1314 struct device_node *dp = op->dev.of_node;
1315 const char *chipset_name; 1315 const char *chipset_name;
1316 int is_pbm_a, err; 1316 int is_pbm_a, err;
1317 1317
@@ -1415,7 +1415,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid,
1415 1415
1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type) 1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type)
1417{ 1417{
1418 struct device_node *dp = op->node; 1418 struct device_node *dp = op->dev.of_node;
1419 struct pci_pbm_info *pbm; 1419 struct pci_pbm_info *pbm;
1420 struct iommu *iommu; 1420 struct iommu *iommu;
1421 u32 portid; 1421 u32 portid;
@@ -1491,8 +1491,11 @@ static struct of_device_id __initdata schizo_match[] = {
1491}; 1491};
1492 1492
1493static struct of_platform_driver schizo_driver = { 1493static struct of_platform_driver schizo_driver = {
1494 .name = DRIVER_NAME, 1494 .driver = {
1495 .match_table = schizo_match, 1495 .name = DRIVER_NAME,
1496 .owner = THIS_MODULE,
1497 .of_match_table = schizo_match,
1498 },
1496 .probe = schizo_probe, 1499 .probe = schizo_probe,
1497}; 1500};
1498 1501
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 23c33ff9c31e..a24af6f7e17f 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -540,7 +540,7 @@ static void __devinit pci_sun4v_scan_bus(struct pci_pbm_info *pbm,
540 struct property *prop; 540 struct property *prop;
541 struct device_node *dp; 541 struct device_node *dp;
542 542
543 dp = pbm->op->node; 543 dp = pbm->op->dev.of_node;
544 prop = of_find_property(dp, "66mhz-capable", NULL); 544 prop = of_find_property(dp, "66mhz-capable", NULL);
545 pbm->is_66mhz_capable = (prop != NULL); 545 pbm->is_66mhz_capable = (prop != NULL);
546 pbm->pci_bus = pci_scan_one_pbm(pbm, parent); 546 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
@@ -584,7 +584,7 @@ static int __devinit pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
584 u32 dma_mask, dma_offset; 584 u32 dma_mask, dma_offset;
585 const u32 *vdma; 585 const u32 *vdma;
586 586
587 vdma = of_get_property(pbm->op->node, "virtual-dma", NULL); 587 vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", NULL);
588 if (!vdma) 588 if (!vdma)
589 vdma = vdma_default; 589 vdma = vdma_default;
590 590
@@ -881,7 +881,7 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, 881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
882 struct of_device *op, u32 devhandle) 882 struct of_device *op, u32 devhandle)
883{ 883{
884 struct device_node *dp = op->node; 884 struct device_node *dp = op->dev.of_node;
885 int err; 885 int err;
886 886
887 pbm->numa_node = of_node_to_nid(dp); 887 pbm->numa_node = of_node_to_nid(dp);
@@ -929,7 +929,7 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
929 u32 devhandle; 929 u32 devhandle;
930 int i, err; 930 int i, err;
931 931
932 dp = op->node; 932 dp = op->dev.of_node;
933 933
934 if (!hvapi_negotiated++) { 934 if (!hvapi_negotiated++) {
935 err = sun4v_hvapi_register(HV_GRP_PCI, 935 err = sun4v_hvapi_register(HV_GRP_PCI,
@@ -1009,8 +1009,11 @@ static struct of_device_id __initdata pci_sun4v_match[] = {
1009}; 1009};
1010 1010
1011static struct of_platform_driver pci_sun4v_driver = { 1011static struct of_platform_driver pci_sun4v_driver = {
1012 .name = DRIVER_NAME, 1012 .driver = {
1013 .match_table = pci_sun4v_match, 1013 .name = DRIVER_NAME,
1014 .owner = THIS_MODULE,
1015 .of_match_table = pci_sun4v_match,
1016 },
1014 .probe = pci_sun4v_probe, 1017 .probe = pci_sun4v_probe,
1015}; 1018};
1016 1019
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
index 2d94e7a03af5..c4a6a50b4849 100644
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -8,6 +8,7 @@
8#include <linux/irq.h> 8#include <linux/irq.h>
9 9
10#include <linux/perf_event.h> 10#include <linux/perf_event.h>
11#include <linux/ftrace.h>
11 12
12#include <asm/pil.h> 13#include <asm/pil.h>
13#include <asm/pcr.h> 14#include <asm/pcr.h>
@@ -34,7 +35,7 @@ unsigned int picl_shift;
34 * Therefore in such situations we defer the work by signalling 35 * Therefore in such situations we defer the work by signalling
35 * a lower level cpu IRQ. 36 * a lower level cpu IRQ.
36 */ 37 */
37void deferred_pcr_work_irq(int irq, struct pt_regs *regs) 38void __irq_entry deferred_pcr_work_irq(int irq, struct pt_regs *regs)
38{ 39{
39 struct pt_regs *old_regs; 40 struct pt_regs *old_regs;
40 41
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 68cb9b42088f..44faabc3c02c 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/perf_event.h> 15#include <linux/perf_event.h>
16#include <linux/kprobes.h> 16#include <linux/kprobes.h>
17#include <linux/ftrace.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/kdebug.h> 19#include <linux/kdebug.h>
19#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -91,6 +92,8 @@ struct cpu_hw_events {
91 92
92 /* Enabled/disable state. */ 93 /* Enabled/disable state. */
93 int enabled; 94 int enabled;
95
96 unsigned int group_flag;
94}; 97};
95DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; 98DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
96 99
@@ -654,6 +657,7 @@ static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
654 cpuc->current_idx[i] = idx; 657 cpuc->current_idx[i] = idx;
655 658
656 enc = perf_event_get_enc(cpuc->events[i]); 659 enc = perf_event_get_enc(cpuc->events[i]);
660 pcr &= ~mask_for_index(idx);
657 pcr |= event_encoding(enc, idx); 661 pcr |= event_encoding(enc, idx);
658 } 662 }
659out: 663out:
@@ -980,53 +984,6 @@ static int collect_events(struct perf_event *group, int max_count,
980 return n; 984 return n;
981} 985}
982 986
983static void event_sched_in(struct perf_event *event)
984{
985 event->state = PERF_EVENT_STATE_ACTIVE;
986 event->oncpu = smp_processor_id();
987 event->tstamp_running += event->ctx->time - event->tstamp_stopped;
988 if (is_software_event(event))
989 event->pmu->enable(event);
990}
991
992int hw_perf_group_sched_in(struct perf_event *group_leader,
993 struct perf_cpu_context *cpuctx,
994 struct perf_event_context *ctx)
995{
996 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
997 struct perf_event *sub;
998 int n0, n;
999
1000 if (!sparc_pmu)
1001 return 0;
1002
1003 n0 = cpuc->n_events;
1004 n = collect_events(group_leader, perf_max_events - n0,
1005 &cpuc->event[n0], &cpuc->events[n0],
1006 &cpuc->current_idx[n0]);
1007 if (n < 0)
1008 return -EAGAIN;
1009 if (check_excludes(cpuc->event, n0, n))
1010 return -EINVAL;
1011 if (sparc_check_constraints(cpuc->event, cpuc->events, n + n0))
1012 return -EAGAIN;
1013 cpuc->n_events = n0 + n;
1014 cpuc->n_added += n;
1015
1016 cpuctx->active_oncpu += n;
1017 n = 1;
1018 event_sched_in(group_leader);
1019 list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
1020 if (sub->state != PERF_EVENT_STATE_OFF) {
1021 event_sched_in(sub);
1022 n++;
1023 }
1024 }
1025 ctx->nr_active += n;
1026
1027 return 1;
1028}
1029
1030static int sparc_pmu_enable(struct perf_event *event) 987static int sparc_pmu_enable(struct perf_event *event)
1031{ 988{
1032 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 989 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1044,11 +1001,20 @@ static int sparc_pmu_enable(struct perf_event *event)
1044 cpuc->events[n0] = event->hw.event_base; 1001 cpuc->events[n0] = event->hw.event_base;
1045 cpuc->current_idx[n0] = PIC_NO_INDEX; 1002 cpuc->current_idx[n0] = PIC_NO_INDEX;
1046 1003
1004 /*
1005 * If group events scheduling transaction was started,
1006 * skip the schedulability test here, it will be peformed
1007 * at commit time(->commit_txn) as a whole
1008 */
1009 if (cpuc->group_flag & PERF_EVENT_TXN_STARTED)
1010 goto nocheck;
1011
1047 if (check_excludes(cpuc->event, n0, 1)) 1012 if (check_excludes(cpuc->event, n0, 1))
1048 goto out; 1013 goto out;
1049 if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1)) 1014 if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1))
1050 goto out; 1015 goto out;
1051 1016
1017nocheck:
1052 cpuc->n_events++; 1018 cpuc->n_events++;
1053 cpuc->n_added++; 1019 cpuc->n_added++;
1054 1020
@@ -1128,11 +1094,61 @@ static int __hw_perf_event_init(struct perf_event *event)
1128 return 0; 1094 return 0;
1129} 1095}
1130 1096
1097/*
1098 * Start group events scheduling transaction
1099 * Set the flag to make pmu::enable() not perform the
1100 * schedulability test, it will be performed at commit time
1101 */
1102static void sparc_pmu_start_txn(const struct pmu *pmu)
1103{
1104 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1105
1106 cpuhw->group_flag |= PERF_EVENT_TXN_STARTED;
1107}
1108
1109/*
1110 * Stop group events scheduling transaction
1111 * Clear the flag and pmu::enable() will perform the
1112 * schedulability test.
1113 */
1114static void sparc_pmu_cancel_txn(const struct pmu *pmu)
1115{
1116 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1117
1118 cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED;
1119}
1120
1121/*
1122 * Commit group events scheduling transaction
1123 * Perform the group schedulability test as a whole
1124 * Return 0 if success
1125 */
1126static int sparc_pmu_commit_txn(const struct pmu *pmu)
1127{
1128 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1129 int n;
1130
1131 if (!sparc_pmu)
1132 return -EINVAL;
1133
1134 cpuc = &__get_cpu_var(cpu_hw_events);
1135 n = cpuc->n_events;
1136 if (check_excludes(cpuc->event, 0, n))
1137 return -EINVAL;
1138 if (sparc_check_constraints(cpuc->event, cpuc->events, n))
1139 return -EAGAIN;
1140
1141 return 0;
1142}
1143
1131static const struct pmu pmu = { 1144static const struct pmu pmu = {
1132 .enable = sparc_pmu_enable, 1145 .enable = sparc_pmu_enable,
1133 .disable = sparc_pmu_disable, 1146 .disable = sparc_pmu_disable,
1134 .read = sparc_pmu_read, 1147 .read = sparc_pmu_read,
1135 .unthrottle = sparc_pmu_unthrottle, 1148 .unthrottle = sparc_pmu_unthrottle,
1149 .start_txn = sparc_pmu_start_txn,
1150 .cancel_txn = sparc_pmu_cancel_txn,
1151 .commit_txn = sparc_pmu_commit_txn,
1136}; 1152};
1137 1153
1138const struct pmu *hw_perf_event_init(struct perf_event *event) 1154const struct pmu *hw_perf_event_init(struct perf_event *event)
@@ -1276,6 +1292,9 @@ static void perf_callchain_kernel(struct pt_regs *regs,
1276 struct perf_callchain_entry *entry) 1292 struct perf_callchain_entry *entry)
1277{ 1293{
1278 unsigned long ksp, fp; 1294 unsigned long ksp, fp;
1295#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1296 int graph = 0;
1297#endif
1279 1298
1280 callchain_store(entry, PERF_CONTEXT_KERNEL); 1299 callchain_store(entry, PERF_CONTEXT_KERNEL);
1281 callchain_store(entry, regs->tpc); 1300 callchain_store(entry, regs->tpc);
@@ -1303,6 +1322,16 @@ static void perf_callchain_kernel(struct pt_regs *regs,
1303 fp = (unsigned long)sf->fp + STACK_BIAS; 1322 fp = (unsigned long)sf->fp + STACK_BIAS;
1304 } 1323 }
1305 callchain_store(entry, pc); 1324 callchain_store(entry, pc);
1325#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1326 if ((pc + 8UL) == (unsigned long) &return_to_handler) {
1327 int index = current->curr_ret_stack;
1328 if (current->ret_stack && index >= graph) {
1329 pc = current->ret_stack[index - graph].ret;
1330 callchain_store(entry, pc);
1331 graph++;
1332 }
1333 }
1334#endif
1306 } while (entry->nr < PERF_MAX_STACK_DEPTH); 1335 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1307} 1336}
1308 1337
@@ -1337,7 +1366,7 @@ static void perf_callchain_user_32(struct pt_regs *regs,
1337 callchain_store(entry, PERF_CONTEXT_USER); 1366 callchain_store(entry, PERF_CONTEXT_USER);
1338 callchain_store(entry, regs->tpc); 1367 callchain_store(entry, regs->tpc);
1339 1368
1340 ufp = regs->u_regs[UREG_I6]; 1369 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
1341 do { 1370 do {
1342 struct sparc_stackf32 *usf, sf; 1371 struct sparc_stackf32 *usf, sf;
1343 unsigned long pc; 1372 unsigned long pc;
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 5e4563d86f19..9589d8b9b0c1 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -79,8 +79,11 @@ static struct of_device_id __initdata pmc_match[] = {
79MODULE_DEVICE_TABLE(of, pmc_match); 79MODULE_DEVICE_TABLE(of, pmc_match);
80 80
81static struct of_platform_driver pmc_driver = { 81static struct of_platform_driver pmc_driver = {
82 .name = "pmc", 82 .driver = {
83 .match_table = pmc_match, 83 .name = "pmc",
84 .owner = THIS_MODULE,
85 .of_match_table = pmc_match,
86 },
84 .probe = pmc_probe, 87 .probe = pmc_probe,
85}; 88};
86 89
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index e2a045c235a1..168d4cb63f5b 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -41,9 +41,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id
41 power_reg = of_ioremap(res, 0, 0x4, "power"); 41 power_reg = of_ioremap(res, 0, 0x4, "power");
42 42
43 printk(KERN_INFO "%s: Control reg at %llx\n", 43 printk(KERN_INFO "%s: Control reg at %llx\n",
44 op->node->name, res->start); 44 op->dev.of_node->name, res->start);
45 45
46 if (has_button_interrupt(irq, op->node)) { 46 if (has_button_interrupt(irq, op->dev.of_node)) {
47 if (request_irq(irq, 47 if (request_irq(irq,
48 power_handler, 0, "power", NULL) < 0) 48 power_handler, 0, "power", NULL) < 0)
49 printk(KERN_ERR "power: Cannot setup IRQ handler.\n"); 49 printk(KERN_ERR "power: Cannot setup IRQ handler.\n");
@@ -60,10 +60,11 @@ static struct of_device_id __initdata power_match[] = {
60}; 60};
61 61
62static struct of_platform_driver power_driver = { 62static struct of_platform_driver power_driver = {
63 .match_table = power_match,
64 .probe = power_probe, 63 .probe = power_probe,
65 .driver = { 64 .driver = {
66 .name = "power", 65 .name = "power",
66 .owner = THIS_MODULE,
67 .of_match_table = power_match,
67 }, 68 },
68}; 69};
69 70
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index c49865b30719..40e29fc8a4d6 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -17,13 +17,13 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h> 20#include <linux/user.h>
22#include <linux/smp.h> 21#include <linux/smp.h>
23#include <linux/reboot.h> 22#include <linux/reboot.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/pm.h> 24#include <linux/pm.h>
26#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h>
27 27
28#include <asm/auxio.h> 28#include <asm/auxio.h>
29#include <asm/oplib.h> 29#include <asm/oplib.h>
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index a5cf3864b31f..dbe81a368b45 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -202,6 +202,7 @@ void show_regs(struct pt_regs *regs)
202 regs->u_regs[15]); 202 regs->u_regs[15]);
203 printk("RPC: <%pS>\n", (void *) regs->u_regs[15]); 203 printk("RPC: <%pS>\n", (void *) regs->u_regs[15]);
204 show_regwindow(regs); 204 show_regwindow(regs);
205 show_stack(current, (unsigned long *) regs->u_regs[UREG_FP]);
205} 206}
206 207
207struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; 208struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index fb06ac2bd38f..466a32763ea8 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -20,7 +20,7 @@
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/lmb.h> 23#include <linux/memblock.h>
24#include <linux/of_device.h> 24#include <linux/of_device.h>
25 25
26#include <asm/prom.h> 26#include <asm/prom.h>
@@ -34,7 +34,7 @@
34 34
35void * __init prom_early_alloc(unsigned long size) 35void * __init prom_early_alloc(unsigned long size)
36{ 36{
37 unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES); 37 unsigned long paddr = memblock_alloc(size, SMP_CACHE_BYTES);
38 void *ret; 38 void *ret;
39 39
40 if (!paddr) { 40 if (!paddr) {
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 8f1478475421..3f34ac853931 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -450,7 +450,7 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op, 450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op,
451 const char *chip_name, int chip_type) 451 const char *chip_name, int chip_type)
452{ 452{
453 struct device_node *dp = op->node; 453 struct device_node *dp = op->dev.of_node;
454 454
455 pbm->name = dp->full_name; 455 pbm->name = dp->full_name;
456 pbm->numa_node = -1; 456 pbm->numa_node = -1;
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 7e3dfd9bb97e..e608f397e11f 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -65,6 +65,7 @@ static int genregs32_get(struct task_struct *target,
65 *k++ = regs->u_regs[pos++]; 65 *k++ = regs->u_regs[pos++];
66 66
67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
68 reg_window -= 16;
68 for (; count > 0 && pos < 32; count--) { 69 for (; count > 0 && pos < 32; count--) {
69 if (get_user(*k++, &reg_window[pos++])) 70 if (get_user(*k++, &reg_window[pos++]))
70 return -EFAULT; 71 return -EFAULT;
@@ -76,6 +77,7 @@ static int genregs32_get(struct task_struct *target,
76 } 77 }
77 78
78 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 79 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
80 reg_window -= 16;
79 for (; count > 0 && pos < 32; count--) { 81 for (; count > 0 && pos < 32; count--) {
80 if (get_user(reg, &reg_window[pos++]) || 82 if (get_user(reg, &reg_window[pos++]) ||
81 put_user(reg, u++)) 83 put_user(reg, u++))
@@ -141,6 +143,7 @@ static int genregs32_set(struct task_struct *target,
141 regs->u_regs[pos++] = *k++; 143 regs->u_regs[pos++] = *k++;
142 144
143 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 145 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
146 reg_window -= 16;
144 for (; count > 0 && pos < 32; count--) { 147 for (; count > 0 && pos < 32; count--) {
145 if (put_user(*k++, &reg_window[pos++])) 148 if (put_user(*k++, &reg_window[pos++]))
146 return -EFAULT; 149 return -EFAULT;
@@ -153,6 +156,7 @@ static int genregs32_set(struct task_struct *target,
153 } 156 }
154 157
155 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 158 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
159 reg_window -= 16;
156 for (; count > 0 && pos < 32; count--) { 160 for (; count > 0 && pos < 32; count--) {
157 if (get_user(reg, u++) || 161 if (get_user(reg, u++) ||
158 put_user(reg, &reg_window[pos++])) 162 put_user(reg, &reg_window[pos++]))
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 2f6524d1a817..aa90da08bf61 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -492,6 +492,7 @@ static int genregs32_get(struct task_struct *target,
492 *k++ = regs->u_regs[pos++]; 492 *k++ = regs->u_regs[pos++];
493 493
494 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 494 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
495 reg_window -= 16;
495 if (target == current) { 496 if (target == current) {
496 for (; count > 0 && pos < 32; count--) { 497 for (; count > 0 && pos < 32; count--) {
497 if (get_user(*k++, &reg_window[pos++])) 498 if (get_user(*k++, &reg_window[pos++]))
@@ -516,6 +517,7 @@ static int genregs32_get(struct task_struct *target,
516 } 517 }
517 518
518 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 519 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
520 reg_window -= 16;
519 if (target == current) { 521 if (target == current) {
520 for (; count > 0 && pos < 32; count--) { 522 for (; count > 0 && pos < 32; count--) {
521 if (get_user(reg, &reg_window[pos++]) || 523 if (get_user(reg, &reg_window[pos++]) ||
@@ -599,6 +601,7 @@ static int genregs32_set(struct task_struct *target,
599 regs->u_regs[pos++] = *k++; 601 regs->u_regs[pos++] = *k++;
600 602
601 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 603 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
604 reg_window -= 16;
602 if (target == current) { 605 if (target == current) {
603 for (; count > 0 && pos < 32; count--) { 606 for (; count > 0 && pos < 32; count--) {
604 if (put_user(*k++, &reg_window[pos++])) 607 if (put_user(*k++, &reg_window[pos++]))
@@ -625,6 +628,7 @@ static int genregs32_set(struct task_struct *target,
625 } 628 }
626 629
627 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 630 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
631 reg_window -= 16;
628 if (target == current) { 632 if (target == current) {
629 for (; count > 0 && pos < 32; count--) { 633 for (; count > 0 && pos < 32; count--) {
630 if (get_user(reg, u++) || 634 if (get_user(reg, u++) ||
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 83f1873c6c13..090b9e9ad5e3 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -130,7 +130,17 @@ rtrap_xcall:
130 nop 130 nop
131 call trace_hardirqs_on 131 call trace_hardirqs_on
132 nop 132 nop
133 wrpr %l4, %pil 133 /* Do not actually set the %pil here. We will do that
134 * below after we clear PSTATE_IE in the %pstate register.
135 * If we re-enable interrupts here, we can recurse down
136 * the hardirq stack potentially endlessly, causing a
137 * stack overflow.
138 *
139 * It is tempting to put this test and trace_hardirqs_on
140 * call at the 'rt_continue' label, but that will not work
141 * as that path hits unconditionally and we do not want to
142 * execute this in NMI return paths, for example.
143 */
134#endif 144#endif
135rtrap_no_irq_enable: 145rtrap_no_irq_enable:
136 andcc %l1, TSTATE_PRIV, %l3 146 andcc %l1, TSTATE_PRIV, %l3
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index 406e0872504e..cfeaf04b9cdf 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -63,10 +63,10 @@ void sbus_set_sbus64(struct device *dev, int bursts)
63 int slot; 63 int slot;
64 u64 val; 64 u64 val;
65 65
66 regs = of_get_property(op->node, "reg", NULL); 66 regs = of_get_property(op->dev.of_node, "reg", NULL);
67 if (!regs) { 67 if (!regs) {
68 printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n", 68 printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n",
69 op->node->full_name); 69 op->dev.of_node->full_name);
70 return; 70 return;
71 } 71 }
72 slot = regs->which_io; 72 slot = regs->which_io;
@@ -287,7 +287,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
287 SYSIO_UEAFSR_SPIO | SYSIO_UEAFSR_SDRD | SYSIO_UEAFSR_SDWR); 287 SYSIO_UEAFSR_SPIO | SYSIO_UEAFSR_SDRD | SYSIO_UEAFSR_SDWR);
288 upa_writeq(error_bits, afsr_reg); 288 upa_writeq(error_bits, afsr_reg);
289 289
290 portid = of_getintprop_default(op->node, "portid", -1); 290 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
291 291
292 /* Log the error. */ 292 /* Log the error. */
293 printk("SYSIO[%x]: Uncorrectable ECC Error, primary error type[%s]\n", 293 printk("SYSIO[%x]: Uncorrectable ECC Error, primary error type[%s]\n",
@@ -361,7 +361,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
361 SYSIO_CEAFSR_SPIO | SYSIO_CEAFSR_SDRD | SYSIO_CEAFSR_SDWR); 361 SYSIO_CEAFSR_SPIO | SYSIO_CEAFSR_SDRD | SYSIO_CEAFSR_SDWR);
362 upa_writeq(error_bits, afsr_reg); 362 upa_writeq(error_bits, afsr_reg);
363 363
364 portid = of_getintprop_default(op->node, "portid", -1); 364 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
365 365
366 printk("SYSIO[%x]: Correctable ECC Error, primary error type[%s]\n", 366 printk("SYSIO[%x]: Correctable ECC Error, primary error type[%s]\n",
367 portid, 367 portid,
@@ -439,7 +439,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
439 SYSIO_SBAFSR_SLE | SYSIO_SBAFSR_STO | SYSIO_SBAFSR_SBERR); 439 SYSIO_SBAFSR_SLE | SYSIO_SBAFSR_STO | SYSIO_SBAFSR_SBERR);
440 upa_writeq(error_bits, afsr_reg); 440 upa_writeq(error_bits, afsr_reg);
441 441
442 portid = of_getintprop_default(op->node, "portid", -1); 442 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
443 443
444 /* Log the error. */ 444 /* Log the error. */
445 printk("SYSIO[%x]: SBUS Error, primary error type[%s] read(%d)\n", 445 printk("SYSIO[%x]: SBUS Error, primary error type[%s] read(%d)\n",
@@ -496,7 +496,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
496 u64 control; 496 u64 control;
497 int portid; 497 int portid;
498 498
499 portid = of_getintprop_default(op->node, "portid", -1); 499 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
500 500
501 irq = sbus_build_irq(op, SYSIO_UE_INO); 501 irq = sbus_build_irq(op, SYSIO_UE_INO);
502 if (request_irq(irq, sysio_ue_handler, 0, 502 if (request_irq(irq, sysio_ue_handler, 0,
@@ -537,7 +537,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
537static void __init sbus_iommu_init(struct of_device *op) 537static void __init sbus_iommu_init(struct of_device *op)
538{ 538{
539 const struct linux_prom64_registers *pr; 539 const struct linux_prom64_registers *pr;
540 struct device_node *dp = op->node; 540 struct device_node *dp = op->dev.of_node;
541 struct iommu *iommu; 541 struct iommu *iommu;
542 struct strbuf *strbuf; 542 struct strbuf *strbuf;
543 unsigned long regs, reg_base; 543 unsigned long regs, reg_base;
@@ -589,7 +589,7 @@ static void __init sbus_iommu_init(struct of_device *op)
589 */ 589 */
590 iommu->write_complete_reg = regs + 0x2000UL; 590 iommu->write_complete_reg = regs + 0x2000UL;
591 591
592 portid = of_getintprop_default(op->node, "portid", -1); 592 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
593 printk(KERN_INFO "SYSIO: UPA portID %x, at %016lx\n", 593 printk(KERN_INFO "SYSIO: UPA portID %x, at %016lx\n",
594 portid, regs); 594 portid, regs);
595 595
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index a2a79e76344f..5f72de67588b 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -12,7 +12,6 @@
12#include <linux/stddef.h> 12#include <linux/stddef.h>
13#include <linux/unistd.h> 13#include <linux/unistd.h>
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <linux/slab.h>
16#include <asm/smp.h> 15#include <asm/smp.h>
17#include <linux/user.h> 16#include <linux/user.h>
18#include <linux/screen_info.h> 17#include <linux/screen_info.h>
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index eb14844a0021..b6a2b8f47040 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -22,7 +22,9 @@
22#include <linux/profile.h> 22#include <linux/profile.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/vmalloc.h> 24#include <linux/vmalloc.h>
25#include <linux/ftrace.h>
25#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/slab.h>
26 28
27#include <asm/head.h> 29#include <asm/head.h>
28#include <asm/ptrace.h> 30#include <asm/ptrace.h>
@@ -822,13 +824,13 @@ void arch_send_call_function_single_ipi(int cpu)
822 &cpumask_of_cpu(cpu)); 824 &cpumask_of_cpu(cpu));
823} 825}
824 826
825void smp_call_function_client(int irq, struct pt_regs *regs) 827void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs)
826{ 828{
827 clear_softint(1 << irq); 829 clear_softint(1 << irq);
828 generic_smp_call_function_interrupt(); 830 generic_smp_call_function_interrupt();
829} 831}
830 832
831void smp_call_function_single_client(int irq, struct pt_regs *regs) 833void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs)
832{ 834{
833 clear_softint(1 << irq); 835 clear_softint(1 << irq);
834 generic_smp_call_function_single_interrupt(); 836 generic_smp_call_function_single_interrupt();
@@ -964,7 +966,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
964 put_cpu(); 966 put_cpu();
965} 967}
966 968
967void smp_new_mmu_context_version_client(int irq, struct pt_regs *regs) 969void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs)
968{ 970{
969 struct mm_struct *mm; 971 struct mm_struct *mm;
970 unsigned long flags; 972 unsigned long flags;
@@ -1148,7 +1150,7 @@ void smp_release(void)
1148 */ 1150 */
1149extern void prom_world(int); 1151extern void prom_world(int);
1150 1152
1151void smp_penguin_jailcell(int irq, struct pt_regs *regs) 1153void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs)
1152{ 1154{
1153 clear_softint(1 << irq); 1155 clear_softint(1 << irq);
1154 1156
@@ -1364,7 +1366,7 @@ void smp_send_reschedule(int cpu)
1364 &cpumask_of_cpu(cpu)); 1366 &cpumask_of_cpu(cpu));
1365} 1367}
1366 1368
1367void smp_receive_signal_client(int irq, struct pt_regs *regs) 1369void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs)
1368{ 1370{
1369 clear_softint(1 << irq); 1371 clear_softint(1 << irq);
1370} 1372}
diff --git a/arch/sparc/kernel/stacktrace.c b/arch/sparc/kernel/stacktrace.c
index acb12f673757..3e0815349630 100644
--- a/arch/sparc/kernel/stacktrace.c
+++ b/arch/sparc/kernel/stacktrace.c
@@ -1,6 +1,7 @@
1#include <linux/sched.h> 1#include <linux/sched.h>
2#include <linux/stacktrace.h> 2#include <linux/stacktrace.h>
3#include <linux/thread_info.h> 3#include <linux/thread_info.h>
4#include <linux/ftrace.h>
4#include <linux/module.h> 5#include <linux/module.h>
5#include <asm/ptrace.h> 6#include <asm/ptrace.h>
6#include <asm/stacktrace.h> 7#include <asm/stacktrace.h>
@@ -12,6 +13,10 @@ static void __save_stack_trace(struct thread_info *tp,
12 bool skip_sched) 13 bool skip_sched)
13{ 14{
14 unsigned long ksp, fp; 15 unsigned long ksp, fp;
16#ifdef CONFIG_FUNCTION_GRAPH_TRACER
17 struct task_struct *t;
18 int graph = 0;
19#endif
15 20
16 if (tp == current_thread_info()) { 21 if (tp == current_thread_info()) {
17 stack_trace_flush(); 22 stack_trace_flush();
@@ -21,6 +26,9 @@ static void __save_stack_trace(struct thread_info *tp,
21 } 26 }
22 27
23 fp = ksp + STACK_BIAS; 28 fp = ksp + STACK_BIAS;
29#ifdef CONFIG_FUNCTION_GRAPH_TRACER
30 t = tp->task;
31#endif
24 do { 32 do {
25 struct sparc_stackf *sf; 33 struct sparc_stackf *sf;
26 struct pt_regs *regs; 34 struct pt_regs *regs;
@@ -44,8 +52,21 @@ static void __save_stack_trace(struct thread_info *tp,
44 52
45 if (trace->skip > 0) 53 if (trace->skip > 0)
46 trace->skip--; 54 trace->skip--;
47 else if (!skip_sched || !in_sched_functions(pc)) 55 else if (!skip_sched || !in_sched_functions(pc)) {
48 trace->entries[trace->nr_entries++] = pc; 56 trace->entries[trace->nr_entries++] = pc;
57#ifdef CONFIG_FUNCTION_GRAPH_TRACER
58 if ((pc + 8UL) == (unsigned long) &return_to_handler) {
59 int index = t->curr_ret_stack;
60 if (t->ret_stack && index >= graph) {
61 pc = t->ret_stack[index - graph].ret;
62 if (trace->nr_entries <
63 trace->max_entries)
64 trace->entries[trace->nr_entries++] = pc;
65 graph++;
66 }
67 }
68#endif
69 }
49 } while (trace->nr_entries < trace->max_entries); 70 } while (trace->nr_entries < trace->max_entries);
50} 71}
51 72
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index bc3adbf79c6a..892fb884910a 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -16,7 +16,6 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/slab.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/of.h> 20#include <linux/of.h>
22#include <linux/of_device.h> 21#include <linux/of_device.h>
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index ab036a72de5a..e11b4612dabb 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -183,7 +183,7 @@ void sun4d_free_irq(unsigned int irq, void *dev_id)
183 goto out_unlock; 183 goto out_unlock;
184 } 184 }
185 185
186 if (action && tmp) 186 if (tmp)
187 tmp->next = action->next; 187 tmp->next = action->next;
188 else 188 else
189 *actionp = action->next; 189 *actionp = action->next;
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c
index 301892e2d718..7f3b97ff62c1 100644
--- a/arch/sparc/kernel/sun4m_irq.c
+++ b/arch/sparc/kernel/sun4m_irq.c
@@ -17,7 +17,6 @@
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/slab.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/ioport.h> 21#include <linux/ioport.h>
23#include <linux/of.h> 22#include <linux/of.h>
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index daded3b96398..c0ca87553e1c 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -21,7 +21,6 @@
21#include <linux/sem.h> 21#include <linux/sem.h>
22#include <linux/msg.h> 22#include <linux/msg.h>
23#include <linux/shm.h> 23#include <linux/shm.h>
24#include <linux/slab.h>
25#include <linux/uio.h> 24#include <linux/uio.h>
26#include <linux/nfs_fs.h> 25#include <linux/nfs_fs.h>
27#include <linux/quota.h> 26#include <linux/quota.h>
@@ -44,6 +43,7 @@
44#include <linux/compat.h> 43#include <linux/compat.h>
45#include <linux/vfs.h> 44#include <linux/vfs.h>
46#include <linux/ptrace.h> 45#include <linux/ptrace.h>
46#include <linux/slab.h>
47 47
48#include <asm/types.h> 48#include <asm/types.h>
49#include <asm/uaccess.h> 49#include <asm/uaccess.h>
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index ca39c606fe8e..1eb8b00aed75 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -107,12 +107,12 @@ static unsigned long run_on_cpu(unsigned long cpu,
107 unsigned long ret; 107 unsigned long ret;
108 108
109 /* should return -EINVAL to userspace */ 109 /* should return -EINVAL to userspace */
110 if (set_cpus_allowed(current, cpumask_of_cpu(cpu))) 110 if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
111 return 0; 111 return 0;
112 112
113 ret = func(arg); 113 ret = func(arg);
114 114
115 set_cpus_allowed(current, old_affinity); 115 set_cpus_allowed_ptr(current, &old_affinity);
116 116
117 return ret; 117 return ret;
118} 118}
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 0d4c09b15efc..e404b063be2c 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -78,6 +78,11 @@ __volatile__ unsigned int *master_l10_counter;
78 78
79u32 (*do_arch_gettimeoffset)(void); 79u32 (*do_arch_gettimeoffset)(void);
80 80
81int update_persistent_clock(struct timespec now)
82{
83 return set_rtc_mmss(now.tv_sec);
84}
85
81/* 86/*
82 * timer_interrupt() needs to keep up the real-time clock, 87 * timer_interrupt() needs to keep up the real-time clock,
83 * as well as call the "do_timer()" routine every clocktick 88 * as well as call the "do_timer()" routine every clocktick
@@ -87,9 +92,6 @@ u32 (*do_arch_gettimeoffset)(void);
87 92
88static irqreturn_t timer_interrupt(int dummy, void *dev_id) 93static irqreturn_t timer_interrupt(int dummy, void *dev_id)
89{ 94{
90 /* last time the cmos clock got updated */
91 static long last_rtc_update;
92
93#ifndef CONFIG_SMP 95#ifndef CONFIG_SMP
94 profile_tick(CPU_PROFILING); 96 profile_tick(CPU_PROFILING);
95#endif 97#endif
@@ -101,16 +103,6 @@ static irqreturn_t timer_interrupt(int dummy, void *dev_id)
101 103
102 do_timer(1); 104 do_timer(1);
103 105
104 /* Determine when to update the Mostek clock. */
105 if (ntp_synced() &&
106 xtime.tv_sec > last_rtc_update + 660 &&
107 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
108 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
109 if (set_rtc_mmss(xtime.tv_sec) == 0)
110 last_rtc_update = xtime.tv_sec;
111 else
112 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
113 }
114 write_sequnlock(&xtime_lock); 106 write_sequnlock(&xtime_lock);
115 107
116#ifndef CONFIG_SMP 108#ifndef CONFIG_SMP
@@ -152,7 +144,7 @@ static struct platform_device m48t59_rtc = {
152 144
153static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) 145static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
154{ 146{
155 struct device_node *dp = op->node; 147 struct device_node *dp = op->dev.of_node;
156 const char *model = of_get_property(dp, "model", NULL); 148 const char *model = of_get_property(dp, "model", NULL);
157 149
158 if (!model) 150 if (!model)
@@ -185,10 +177,11 @@ static struct of_device_id __initdata clock_match[] = {
185}; 177};
186 178
187static struct of_platform_driver clock_driver = { 179static struct of_platform_driver clock_driver = {
188 .match_table = clock_match,
189 .probe = clock_probe, 180 .probe = clock_probe,
190 .driver = { 181 .driver = {
191 .name = "rtc", 182 .name = "rtc",
183 .owner = THIS_MODULE,
184 .of_match_table = clock_match,
192 }, 185 },
193}; 186};
194 187
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 67e165102885..21e9fcae0668 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -35,6 +35,7 @@
35#include <linux/clocksource.h> 35#include <linux/clocksource.h>
36#include <linux/of_device.h> 36#include <linux/of_device.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/ftrace.h>
38 39
39#include <asm/oplib.h> 40#include <asm/oplib.h>
40#include <asm/timer.h> 41#include <asm/timer.h>
@@ -423,7 +424,7 @@ static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *
423 struct resource *r; 424 struct resource *r;
424 425
425 printk(KERN_INFO "%s: RTC regs at 0x%llx\n", 426 printk(KERN_INFO "%s: RTC regs at 0x%llx\n",
426 op->node->full_name, op->resource[0].start); 427 op->dev.of_node->full_name, op->resource[0].start);
427 428
428 /* The CMOS RTC driver only accepts IORESOURCE_IO, so cons 429 /* The CMOS RTC driver only accepts IORESOURCE_IO, so cons
429 * up a fake resource so that the probe works for all cases. 430 * up a fake resource so that the probe works for all cases.
@@ -462,10 +463,11 @@ static struct of_device_id __initdata rtc_match[] = {
462}; 463};
463 464
464static struct of_platform_driver rtc_driver = { 465static struct of_platform_driver rtc_driver = {
465 .match_table = rtc_match,
466 .probe = rtc_probe, 466 .probe = rtc_probe,
467 .driver = { 467 .driver = {
468 .name = "rtc", 468 .name = "rtc",
469 .owner = THIS_MODULE,
470 .of_match_table = rtc_match,
469 }, 471 },
470}; 472};
471 473
@@ -479,7 +481,7 @@ static int __devinit bq4802_probe(struct of_device *op, const struct of_device_i
479{ 481{
480 482
481 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
482 op->node->full_name, op->resource[0].start); 484 op->dev.of_node->full_name, op->resource[0].start);
483 485
484 rtc_bq4802_device.resource = &op->resource[0]; 486 rtc_bq4802_device.resource = &op->resource[0];
485 return platform_device_register(&rtc_bq4802_device); 487 return platform_device_register(&rtc_bq4802_device);
@@ -494,10 +496,11 @@ static struct of_device_id __initdata bq4802_match[] = {
494}; 496};
495 497
496static struct of_platform_driver bq4802_driver = { 498static struct of_platform_driver bq4802_driver = {
497 .match_table = bq4802_match,
498 .probe = bq4802_probe, 499 .probe = bq4802_probe,
499 .driver = { 500 .driver = {
500 .name = "bq4802", 501 .name = "bq4802",
502 .owner = THIS_MODULE,
503 .of_match_table = bq4802_match,
501 }, 504 },
502}; 505};
503 506
@@ -533,7 +536,7 @@ static struct platform_device m48t59_rtc = {
533 536
534static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match)
535{ 538{
536 struct device_node *dp = op->node; 539 struct device_node *dp = op->dev.of_node;
537 540
538 /* On an Enterprise system there can be multiple mostek clocks. 541 /* On an Enterprise system there can be multiple mostek clocks.
539 * We should only match the one that is on the central FHC bus. 542 * We should only match the one that is on the central FHC bus.
@@ -557,10 +560,11 @@ static struct of_device_id __initdata mostek_match[] = {
557}; 560};
558 561
559static struct of_platform_driver mostek_driver = { 562static struct of_platform_driver mostek_driver = {
560 .match_table = mostek_match,
561 .probe = mostek_probe, 563 .probe = mostek_probe,
562 .driver = { 564 .driver = {
563 .name = "mostek", 565 .name = "mostek",
566 .owner = THIS_MODULE,
567 .of_match_table = mostek_match,
564 }, 568 },
565}; 569};
566 570
@@ -717,7 +721,7 @@ static struct clock_event_device sparc64_clockevent = {
717}; 721};
718static DEFINE_PER_CPU(struct clock_event_device, sparc64_events); 722static DEFINE_PER_CPU(struct clock_event_device, sparc64_events);
719 723
720void timer_interrupt(int irq, struct pt_regs *regs) 724void __irq_entry timer_interrupt(int irq, struct pt_regs *regs)
721{ 725{
722 struct pt_regs *old_regs = set_irq_regs(regs); 726 struct pt_regs *old_regs = set_irq_regs(regs);
723 unsigned long tick_mask = tick_ops->softint_mask; 727 unsigned long tick_mask = tick_ops->softint_mask;
@@ -728,6 +732,7 @@ void timer_interrupt(int irq, struct pt_regs *regs)
728 732
729 irq_enter(); 733 irq_enter();
730 734
735 local_cpu_data().irq0_irqs++;
731 kstat_incr_irqs_this_cpu(0, irq_to_desc(0)); 736 kstat_incr_irqs_this_cpu(0, irq_to_desc(0));
732 737
733 if (unlikely(!evt->event_handler)) { 738 if (unlikely(!evt->event_handler)) {
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index bdc05a21908b..42ad2ba85010 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -17,6 +17,8 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/kdebug.h> 19#include <linux/kdebug.h>
20#include <linux/ftrace.h>
21#include <linux/gfp.h>
20 22
21#include <asm/smp.h> 23#include <asm/smp.h>
22#include <asm/delay.h> 24#include <asm/delay.h>
@@ -2153,6 +2155,9 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2153 unsigned long fp, thread_base, ksp; 2155 unsigned long fp, thread_base, ksp;
2154 struct thread_info *tp; 2156 struct thread_info *tp;
2155 int count = 0; 2157 int count = 0;
2158#ifdef CONFIG_FUNCTION_GRAPH_TRACER
2159 int graph = 0;
2160#endif
2156 2161
2157 ksp = (unsigned long) _ksp; 2162 ksp = (unsigned long) _ksp;
2158 if (!tsk) 2163 if (!tsk)
@@ -2192,6 +2197,16 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2192 } 2197 }
2193 2198
2194 printk(" [%016lx] %pS\n", pc, (void *) pc); 2199 printk(" [%016lx] %pS\n", pc, (void *) pc);
2200#ifdef CONFIG_FUNCTION_GRAPH_TRACER
2201 if ((pc + 8UL) == (unsigned long) &return_to_handler) {
2202 int index = tsk->curr_ret_stack;
2203 if (tsk->ret_stack && index >= graph) {
2204 pc = tsk->ret_stack[index - graph].ret;
2205 printk(" [%016lx] %pS\n", pc, (void *) pc);
2206 graph++;
2207 }
2208 }
2209#endif
2195 } while (++count < 16); 2210 } while (++count < 16);
2196} 2211}
2197 2212
@@ -2202,27 +2217,6 @@ void dump_stack(void)
2202 2217
2203EXPORT_SYMBOL(dump_stack); 2218EXPORT_SYMBOL(dump_stack);
2204 2219
2205static inline int is_kernel_stack(struct task_struct *task,
2206 struct reg_window *rw)
2207{
2208 unsigned long rw_addr = (unsigned long) rw;
2209 unsigned long thread_base, thread_end;
2210
2211 if (rw_addr < PAGE_OFFSET) {
2212 if (task != &init_task)
2213 return 0;
2214 }
2215
2216 thread_base = (unsigned long) task_stack_page(task);
2217 thread_end = thread_base + sizeof(union thread_union);
2218 if (rw_addr >= thread_base &&
2219 rw_addr < thread_end &&
2220 !(rw_addr & 0x7UL))
2221 return 1;
2222
2223 return 0;
2224}
2225
2226static inline struct reg_window *kernel_stack_up(struct reg_window *rw) 2220static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2227{ 2221{
2228 unsigned long fp = rw->ins[6]; 2222 unsigned long fp = rw->ins[6];
@@ -2251,6 +2245,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2251 show_regs(regs); 2245 show_regs(regs);
2252 add_taint(TAINT_DIE); 2246 add_taint(TAINT_DIE);
2253 if (regs->tstate & TSTATE_PRIV) { 2247 if (regs->tstate & TSTATE_PRIV) {
2248 struct thread_info *tp = current_thread_info();
2254 struct reg_window *rw = (struct reg_window *) 2249 struct reg_window *rw = (struct reg_window *)
2255 (regs->u_regs[UREG_FP] + STACK_BIAS); 2250 (regs->u_regs[UREG_FP] + STACK_BIAS);
2256 2251
@@ -2258,8 +2253,8 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2258 * find some badly aligned kernel stack. 2253 * find some badly aligned kernel stack.
2259 */ 2254 */
2260 while (rw && 2255 while (rw &&
2261 count++ < 30&& 2256 count++ < 30 &&
2262 is_kernel_stack(current, rw)) { 2257 kstack_valid(tp, (unsigned long) rw)) {
2263 printk("Caller[%016lx]: %pS\n", rw->ins[7], 2258 printk("Caller[%016lx]: %pS\n", rw->ins[7],
2264 (void *) rw->ins[7]); 2259 (void *) rw->ins[7]);
2265 2260
diff --git a/arch/sparc/kernel/ttable.S b/arch/sparc/kernel/ttable.S
index 76d837fc47d3..c6dfdaa29e20 100644
--- a/arch/sparc/kernel/ttable.S
+++ b/arch/sparc/kernel/ttable.S
@@ -64,7 +64,7 @@ tl0_irq6: TRAP_IRQ(smp_call_function_single_client, 6)
64tl0_irq6: BTRAP(0x46) 64tl0_irq6: BTRAP(0x46)
65#endif 65#endif
66tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7) 66tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7)
67#ifdef CONFIG_KGDB 67#if defined(CONFIG_KGDB) && defined(CONFIG_SMP)
68tl0_irq8: TRAP_IRQ(smp_kgdb_capture_client, 8) 68tl0_irq8: TRAP_IRQ(smp_kgdb_capture_client, 8)
69#else 69#else
70tl0_irq8: BTRAP(0x48) 70tl0_irq8: BTRAP(0x48)
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index ebce43018c49..c752c4c479bd 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -50,7 +50,7 @@ static inline enum direction decode_direction(unsigned int insn)
50} 50}
51 51
52/* 16 = double-word, 8 = extra-word, 4 = word, 2 = half-word */ 52/* 16 = double-word, 8 = extra-word, 4 = word, 2 = half-word */
53static inline int decode_access_size(unsigned int insn) 53static inline int decode_access_size(struct pt_regs *regs, unsigned int insn)
54{ 54{
55 unsigned int tmp; 55 unsigned int tmp;
56 56
@@ -66,7 +66,7 @@ static inline int decode_access_size(unsigned int insn)
66 return 2; 66 return 2;
67 else { 67 else {
68 printk("Impossible unaligned trap. insn=%08x\n", insn); 68 printk("Impossible unaligned trap. insn=%08x\n", insn);
69 die_if_kernel("Byte sized unaligned access?!?!", current_thread_info()->kregs); 69 die_if_kernel("Byte sized unaligned access?!?!", regs);
70 70
71 /* GCC should never warn that control reaches the end 71 /* GCC should never warn that control reaches the end
72 * of this function without returning a value because 72 * of this function without returning a value because
@@ -286,7 +286,7 @@ static void log_unaligned(struct pt_regs *regs)
286asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) 286asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
287{ 287{
288 enum direction dir = decode_direction(insn); 288 enum direction dir = decode_direction(insn);
289 int size = decode_access_size(insn); 289 int size = decode_access_size(regs, insn);
290 int orig_asi, asi; 290 int orig_asi, asi;
291 291
292 current_thread_info()->kern_una_regs = regs; 292 current_thread_info()->kern_una_regs = regs;
diff --git a/arch/sparc/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
index 791c15138f3a..8f982b76c712 100644
--- a/arch/sparc/kernel/us2e_cpufreq.c
+++ b/arch/sparc/kernel/us2e_cpufreq.c
@@ -238,12 +238,12 @@ static unsigned int us2e_freq_get(unsigned int cpu)
238 return 0; 238 return 0;
239 239
240 cpus_allowed = current->cpus_allowed; 240 cpus_allowed = current->cpus_allowed;
241 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 241 set_cpus_allowed_ptr(current, cpumask_of(cpu));
242 242
243 clock_tick = sparc64_get_clock_tick(cpu) / 1000; 243 clock_tick = sparc64_get_clock_tick(cpu) / 1000;
244 estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR); 244 estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
245 245
246 set_cpus_allowed(current, cpus_allowed); 246 set_cpus_allowed_ptr(current, &cpus_allowed);
247 247
248 return clock_tick / estar_to_divisor(estar); 248 return clock_tick / estar_to_divisor(estar);
249} 249}
@@ -259,7 +259,7 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
259 return; 259 return;
260 260
261 cpus_allowed = current->cpus_allowed; 261 cpus_allowed = current->cpus_allowed;
262 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 262 set_cpus_allowed_ptr(current, cpumask_of(cpu));
263 263
264 new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000; 264 new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000;
265 new_bits = index_to_estar_mode(index); 265 new_bits = index_to_estar_mode(index);
@@ -281,7 +281,7 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
281 281
282 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 282 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
283 283
284 set_cpus_allowed(current, cpus_allowed); 284 set_cpus_allowed_ptr(current, &cpus_allowed);
285} 285}
286 286
287static int us2e_freq_target(struct cpufreq_policy *policy, 287static int us2e_freq_target(struct cpufreq_policy *policy,
diff --git a/arch/sparc/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
index 365b6464e2ce..f35d1e794548 100644
--- a/arch/sparc/kernel/us3_cpufreq.c
+++ b/arch/sparc/kernel/us3_cpufreq.c
@@ -86,12 +86,12 @@ static unsigned int us3_freq_get(unsigned int cpu)
86 return 0; 86 return 0;
87 87
88 cpus_allowed = current->cpus_allowed; 88 cpus_allowed = current->cpus_allowed;
89 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 89 set_cpus_allowed_ptr(current, cpumask_of(cpu));
90 90
91 reg = read_safari_cfg(); 91 reg = read_safari_cfg();
92 ret = get_current_freq(cpu, reg); 92 ret = get_current_freq(cpu, reg);
93 93
94 set_cpus_allowed(current, cpus_allowed); 94 set_cpus_allowed_ptr(current, &cpus_allowed);
95 95
96 return ret; 96 return ret;
97} 97}
@@ -106,7 +106,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
106 return; 106 return;
107 107
108 cpus_allowed = current->cpus_allowed; 108 cpus_allowed = current->cpus_allowed;
109 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 109 set_cpus_allowed_ptr(current, cpumask_of(cpu));
110 110
111 new_freq = sparc64_get_clock_tick(cpu) / 1000; 111 new_freq = sparc64_get_clock_tick(cpu) / 1000;
112 switch (index) { 112 switch (index) {
@@ -140,7 +140,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
140 140
141 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 141 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
142 142
143 set_cpus_allowed(current, cpus_allowed); 143 set_cpus_allowed_ptr(current, &cpus_allowed);
144} 144}
145 145
146static int us3_freq_target(struct cpufreq_policy *policy, 146static int us3_freq_target(struct cpufreq_policy *policy,
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index c28c71449a6c..3cb1def9806c 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h>
13#include <linux/irq.h> 14#include <linux/irq.h>
14#include <linux/init.h> 15#include <linux/init.h>
15 16
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 4e5992593967..0c1e6783657f 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -46,11 +46,16 @@ SECTIONS
46 SCHED_TEXT 46 SCHED_TEXT
47 LOCK_TEXT 47 LOCK_TEXT
48 KPROBES_TEXT 48 KPROBES_TEXT
49 IRQENTRY_TEXT
49 *(.gnu.warning) 50 *(.gnu.warning)
50 } = 0 51 } = 0
51 _etext = .; 52 _etext = .;
52 53
53 RO_DATA(PAGE_SIZE) 54 RO_DATA(PAGE_SIZE)
55
56 /* Start of data section */
57 _sdata = .;
58
54 .data1 : { 59 .data1 : {
55 *(.data1) 60 *(.data1)
56 } 61 }
diff --git a/arch/sparc/lib/mcount.S b/arch/sparc/lib/mcount.S
index 24b8b12deed2..3ad6cbdc2163 100644
--- a/arch/sparc/lib/mcount.S
+++ b/arch/sparc/lib/mcount.S
@@ -7,26 +7,11 @@
7 7
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9 9
10#include <asm/ptrace.h>
11#include <asm/thread_info.h>
12
13/* 10/*
14 * This is the main variant and is called by C code. GCC's -pg option 11 * This is the main variant and is called by C code. GCC's -pg option
15 * automatically instruments every C function with a call to this. 12 * automatically instruments every C function with a call to this.
16 */ 13 */
17 14
18#ifdef CONFIG_STACK_DEBUG
19
20#define OVSTACKSIZE 4096 /* lets hope this is enough */
21
22 .data
23 .align 8
24panicstring:
25 .asciz "Stack overflow\n"
26 .align 8
27ovstack:
28 .skip OVSTACKSIZE
29#endif
30 .text 15 .text
31 .align 32 16 .align 32
32 .globl _mcount 17 .globl _mcount
@@ -35,84 +20,48 @@ ovstack:
35 .type mcount,#function 20 .type mcount,#function
36_mcount: 21_mcount:
37mcount: 22mcount:
38#ifdef CONFIG_STACK_DEBUG
39 /*
40 * Check whether %sp is dangerously low.
41 */
42 ldub [%g6 + TI_FPDEPTH], %g1
43 srl %g1, 1, %g3
44 add %g3, 1, %g3
45 sllx %g3, 8, %g3 ! each fpregs frame is 256b
46 add %g3, 192, %g3
47 add %g6, %g3, %g3 ! where does task_struct+frame end?
48 sub %g3, STACK_BIAS, %g3
49 cmp %sp, %g3
50 bg,pt %xcc, 1f
51 nop
52 lduh [%g6 + TI_CPU], %g1
53 sethi %hi(hardirq_stack), %g3
54 or %g3, %lo(hardirq_stack), %g3
55 sllx %g1, 3, %g1
56 ldx [%g3 + %g1], %g7
57 sub %g7, STACK_BIAS, %g7
58 cmp %sp, %g7
59 bleu,pt %xcc, 2f
60 sethi %hi(THREAD_SIZE), %g3
61 add %g7, %g3, %g7
62 cmp %sp, %g7
63 blu,pn %xcc, 1f
642: sethi %hi(softirq_stack), %g3
65 or %g3, %lo(softirq_stack), %g3
66 ldx [%g3 + %g1], %g7
67 sub %g7, STACK_BIAS, %g7
68 cmp %sp, %g7
69 bleu,pt %xcc, 3f
70 sethi %hi(THREAD_SIZE), %g3
71 add %g7, %g3, %g7
72 cmp %sp, %g7
73 blu,pn %xcc, 1f
74 nop
75 /* If we are already on ovstack, don't hop onto it
76 * again, we are already trying to output the stack overflow
77 * message.
78 */
793: sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough
80 or %g7, %lo(ovstack), %g7
81 add %g7, OVSTACKSIZE, %g3
82 sub %g3, STACK_BIAS + 192, %g3
83 sub %g7, STACK_BIAS, %g7
84 cmp %sp, %g7
85 blu,pn %xcc, 2f
86 cmp %sp, %g3
87 bleu,pn %xcc, 1f
88 nop
892: mov %g3, %sp
90 sethi %hi(panicstring), %g3
91 call prom_printf
92 or %g3, %lo(panicstring), %o0
93 call prom_halt
94 nop
951:
96#endif
97#ifdef CONFIG_FUNCTION_TRACER 23#ifdef CONFIG_FUNCTION_TRACER
98#ifdef CONFIG_DYNAMIC_FTRACE 24#ifdef CONFIG_DYNAMIC_FTRACE
99 mov %o7, %o0 25 /* Do nothing, the retl/nop below is all we need. */
100 .globl mcount_call
101mcount_call:
102 call ftrace_stub
103 mov %o0, %o7
104#else 26#else
105 sethi %hi(ftrace_trace_function), %g1 27 sethi %hi(function_trace_stop), %g1
28 lduw [%g1 + %lo(function_trace_stop)], %g2
29 brnz,pn %g2, 2f
30 sethi %hi(ftrace_trace_function), %g1
106 sethi %hi(ftrace_stub), %g2 31 sethi %hi(ftrace_stub), %g2
107 ldx [%g1 + %lo(ftrace_trace_function)], %g1 32 ldx [%g1 + %lo(ftrace_trace_function)], %g1
108 or %g2, %lo(ftrace_stub), %g2 33 or %g2, %lo(ftrace_stub), %g2
109 cmp %g1, %g2 34 cmp %g1, %g2
110 be,pn %icc, 1f 35 be,pn %icc, 1f
111 mov %i7, %o1 36 mov %i7, %g3
112 jmpl %g1, %g0 37 save %sp, -176, %sp
113 mov %o7, %o0 38 mov %g3, %o1
39 jmpl %g1, %o7
40 mov %i7, %o0
41 ret
42 restore
114 /* not reached */ 43 /* not reached */
1151: 441:
45#ifdef CONFIG_FUNCTION_GRAPH_TRACER
46 sethi %hi(ftrace_graph_return), %g1
47 ldx [%g1 + %lo(ftrace_graph_return)], %g3
48 cmp %g2, %g3
49 bne,pn %xcc, 5f
50 sethi %hi(ftrace_graph_entry_stub), %g2
51 sethi %hi(ftrace_graph_entry), %g1
52 or %g2, %lo(ftrace_graph_entry_stub), %g2
53 ldx [%g1 + %lo(ftrace_graph_entry)], %g1
54 cmp %g1, %g2
55 be,pt %xcc, 2f
56 nop
575: mov %i7, %g2
58 mov %fp, %g3
59 save %sp, -176, %sp
60 mov %g2, %l0
61 ba,pt %xcc, ftrace_graph_caller
62 mov %g3, %l1
63#endif
642:
116#endif 65#endif
117#endif 66#endif
118 retl 67 retl
@@ -131,14 +80,50 @@ ftrace_stub:
131 .globl ftrace_caller 80 .globl ftrace_caller
132 .type ftrace_caller,#function 81 .type ftrace_caller,#function
133ftrace_caller: 82ftrace_caller:
134 mov %i7, %o1 83 sethi %hi(function_trace_stop), %g1
135 mov %o7, %o0 84 mov %i7, %g2
85 lduw [%g1 + %lo(function_trace_stop)], %g1
86 brnz,pn %g1, ftrace_stub
87 mov %fp, %g3
88 save %sp, -176, %sp
89 mov %g2, %o1
90 mov %g2, %l0
91 mov %g3, %l1
136 .globl ftrace_call 92 .globl ftrace_call
137ftrace_call: 93ftrace_call:
138 call ftrace_stub 94 call ftrace_stub
139 mov %o0, %o7 95 mov %i7, %o0
140 retl 96#ifdef CONFIG_FUNCTION_GRAPH_TRACER
97 .globl ftrace_graph_call
98ftrace_graph_call:
99 call ftrace_stub
141 nop 100 nop
101#endif
102 ret
103 restore
104#ifdef CONFIG_FUNCTION_GRAPH_TRACER
105 .size ftrace_graph_call,.-ftrace_graph_call
106#endif
107 .size ftrace_call,.-ftrace_call
142 .size ftrace_caller,.-ftrace_caller 108 .size ftrace_caller,.-ftrace_caller
143#endif 109#endif
144#endif 110#endif
111
112#ifdef CONFIG_FUNCTION_GRAPH_TRACER
113ENTRY(ftrace_graph_caller)
114 mov %l0, %o0
115 mov %i7, %o1
116 call prepare_ftrace_return
117 mov %l1, %o2
118 ret
119 restore %o0, -8, %i7
120END(ftrace_graph_caller)
121
122ENTRY(return_to_handler)
123 save %sp, -176, %sp
124 call ftrace_return_to_handler
125 mov %fp, %o0
126 jmpl %o0 + 8, %g0
127 restore
128END(return_to_handler)
129#endif
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index f27d10369e0c..5fdddf134caa 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -10,7 +10,6 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/hugetlb.h> 11#include <linux/hugetlb.h>
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/slab.h>
14#include <linux/sysctl.h> 13#include <linux/sysctl.h>
15 14
16#include <asm/mman.h> 15#include <asm/mman.h>
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index dc7c3b17a15f..6d0e02c4fe09 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -24,6 +24,7 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/pagemap.h> 25#include <linux/pagemap.h>
26#include <linux/poison.h> 26#include <linux/poison.h>
27#include <linux/gfp.h>
27 28
28#include <asm/sections.h> 29#include <asm/sections.h>
29#include <asm/system.h> 30#include <asm/system.h>
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 9245a822a2f1..f0434513df15 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -13,7 +13,6 @@
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/hugetlb.h> 15#include <linux/hugetlb.h>
16#include <linux/slab.h>
17#include <linux/initrd.h> 16#include <linux/initrd.h>
18#include <linux/swap.h> 17#include <linux/swap.h>
19#include <linux/pagemap.h> 18#include <linux/pagemap.h>
@@ -24,8 +23,9 @@
24#include <linux/cache.h> 23#include <linux/cache.h>
25#include <linux/sort.h> 24#include <linux/sort.h>
26#include <linux/percpu.h> 25#include <linux/percpu.h>
27#include <linux/lmb.h> 26#include <linux/memblock.h>
28#include <linux/mmzone.h> 27#include <linux/mmzone.h>
28#include <linux/gfp.h>
29 29
30#include <asm/head.h> 30#include <asm/head.h>
31#include <asm/system.h> 31#include <asm/system.h>
@@ -726,7 +726,7 @@ static void __init find_ramdisk(unsigned long phys_base)
726 initrd_start = ramdisk_image; 726 initrd_start = ramdisk_image;
727 initrd_end = ramdisk_image + sparc_ramdisk_size; 727 initrd_end = ramdisk_image + sparc_ramdisk_size;
728 728
729 lmb_reserve(initrd_start, sparc_ramdisk_size); 729 memblock_reserve(initrd_start, sparc_ramdisk_size);
730 730
731 initrd_start += PAGE_OFFSET; 731 initrd_start += PAGE_OFFSET;
732 initrd_end += PAGE_OFFSET; 732 initrd_end += PAGE_OFFSET;
@@ -822,7 +822,7 @@ static void __init allocate_node_data(int nid)
822 struct pglist_data *p; 822 struct pglist_data *p;
823 823
824#ifdef CONFIG_NEED_MULTIPLE_NODES 824#ifdef CONFIG_NEED_MULTIPLE_NODES
825 paddr = lmb_alloc_nid(sizeof(struct pglist_data), 825 paddr = memblock_alloc_nid(sizeof(struct pglist_data),
826 SMP_CACHE_BYTES, nid, nid_range); 826 SMP_CACHE_BYTES, nid, nid_range);
827 if (!paddr) { 827 if (!paddr) {
828 prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); 828 prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid);
@@ -843,7 +843,7 @@ static void __init allocate_node_data(int nid)
843 if (p->node_spanned_pages) { 843 if (p->node_spanned_pages) {
844 num_pages = bootmem_bootmap_pages(p->node_spanned_pages); 844 num_pages = bootmem_bootmap_pages(p->node_spanned_pages);
845 845
846 paddr = lmb_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid, 846 paddr = memblock_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid,
847 nid_range); 847 nid_range);
848 if (!paddr) { 848 if (!paddr) {
849 prom_printf("Cannot allocate bootmap for nid[%d]\n", 849 prom_printf("Cannot allocate bootmap for nid[%d]\n",
@@ -974,11 +974,11 @@ static void __init add_node_ranges(void)
974{ 974{
975 int i; 975 int i;
976 976
977 for (i = 0; i < lmb.memory.cnt; i++) { 977 for (i = 0; i < memblock.memory.cnt; i++) {
978 unsigned long size = lmb_size_bytes(&lmb.memory, i); 978 unsigned long size = memblock_size_bytes(&memblock.memory, i);
979 unsigned long start, end; 979 unsigned long start, end;
980 980
981 start = lmb.memory.region[i].base; 981 start = memblock.memory.region[i].base;
982 end = start + size; 982 end = start + size;
983 while (start < end) { 983 while (start < end) {
984 unsigned long this_end; 984 unsigned long this_end;
@@ -1010,7 +1010,7 @@ static int __init grab_mlgroups(struct mdesc_handle *md)
1010 if (!count) 1010 if (!count)
1011 return -ENOENT; 1011 return -ENOENT;
1012 1012
1013 paddr = lmb_alloc(count * sizeof(struct mdesc_mlgroup), 1013 paddr = memblock_alloc(count * sizeof(struct mdesc_mlgroup),
1014 SMP_CACHE_BYTES); 1014 SMP_CACHE_BYTES);
1015 if (!paddr) 1015 if (!paddr)
1016 return -ENOMEM; 1016 return -ENOMEM;
@@ -1051,7 +1051,7 @@ static int __init grab_mblocks(struct mdesc_handle *md)
1051 if (!count) 1051 if (!count)
1052 return -ENOENT; 1052 return -ENOENT;
1053 1053
1054 paddr = lmb_alloc(count * sizeof(struct mdesc_mblock), 1054 paddr = memblock_alloc(count * sizeof(struct mdesc_mblock),
1055 SMP_CACHE_BYTES); 1055 SMP_CACHE_BYTES);
1056 if (!paddr) 1056 if (!paddr)
1057 return -ENOMEM; 1057 return -ENOMEM;
@@ -1279,8 +1279,8 @@ static int bootmem_init_numa(void)
1279 1279
1280static void __init bootmem_init_nonnuma(void) 1280static void __init bootmem_init_nonnuma(void)
1281{ 1281{
1282 unsigned long top_of_ram = lmb_end_of_DRAM(); 1282 unsigned long top_of_ram = memblock_end_of_DRAM();
1283 unsigned long total_ram = lmb_phys_mem_size(); 1283 unsigned long total_ram = memblock_phys_mem_size();
1284 unsigned int i; 1284 unsigned int i;
1285 1285
1286 numadbg("bootmem_init_nonnuma()\n"); 1286 numadbg("bootmem_init_nonnuma()\n");
@@ -1292,15 +1292,15 @@ static void __init bootmem_init_nonnuma(void)
1292 1292
1293 init_node_masks_nonnuma(); 1293 init_node_masks_nonnuma();
1294 1294
1295 for (i = 0; i < lmb.memory.cnt; i++) { 1295 for (i = 0; i < memblock.memory.cnt; i++) {
1296 unsigned long size = lmb_size_bytes(&lmb.memory, i); 1296 unsigned long size = memblock_size_bytes(&memblock.memory, i);
1297 unsigned long start_pfn, end_pfn; 1297 unsigned long start_pfn, end_pfn;
1298 1298
1299 if (!size) 1299 if (!size)
1300 continue; 1300 continue;
1301 1301
1302 start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; 1302 start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT;
1303 end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); 1303 end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i);
1304 add_active_range(0, start_pfn, end_pfn); 1304 add_active_range(0, start_pfn, end_pfn);
1305 } 1305 }
1306 1306
@@ -1338,9 +1338,9 @@ static void __init trim_reserved_in_node(int nid)
1338 1338
1339 numadbg(" trim_reserved_in_node(%d)\n", nid); 1339 numadbg(" trim_reserved_in_node(%d)\n", nid);
1340 1340
1341 for (i = 0; i < lmb.reserved.cnt; i++) { 1341 for (i = 0; i < memblock.reserved.cnt; i++) {
1342 unsigned long start = lmb.reserved.region[i].base; 1342 unsigned long start = memblock.reserved.region[i].base;
1343 unsigned long size = lmb_size_bytes(&lmb.reserved, i); 1343 unsigned long size = memblock_size_bytes(&memblock.reserved, i);
1344 unsigned long end = start + size; 1344 unsigned long end = start + size;
1345 1345
1346 reserve_range_in_node(nid, start, end); 1346 reserve_range_in_node(nid, start, end);
@@ -1384,7 +1384,7 @@ static unsigned long __init bootmem_init(unsigned long phys_base)
1384 unsigned long end_pfn; 1384 unsigned long end_pfn;
1385 int nid; 1385 int nid;
1386 1386
1387 end_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; 1387 end_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
1388 max_pfn = max_low_pfn = end_pfn; 1388 max_pfn = max_low_pfn = end_pfn;
1389 min_low_pfn = (phys_base >> PAGE_SHIFT); 1389 min_low_pfn = (phys_base >> PAGE_SHIFT);
1390 1390
@@ -1734,7 +1734,7 @@ void __init paging_init(void)
1734 sun4v_ktsb_init(); 1734 sun4v_ktsb_init();
1735 } 1735 }
1736 1736
1737 lmb_init(); 1737 memblock_init();
1738 1738
1739 /* Find available physical memory... 1739 /* Find available physical memory...
1740 * 1740 *
@@ -1752,17 +1752,17 @@ void __init paging_init(void)
1752 phys_base = 0xffffffffffffffffUL; 1752 phys_base = 0xffffffffffffffffUL;
1753 for (i = 0; i < pavail_ents; i++) { 1753 for (i = 0; i < pavail_ents; i++) {
1754 phys_base = min(phys_base, pavail[i].phys_addr); 1754 phys_base = min(phys_base, pavail[i].phys_addr);
1755 lmb_add(pavail[i].phys_addr, pavail[i].reg_size); 1755 memblock_add(pavail[i].phys_addr, pavail[i].reg_size);
1756 } 1756 }
1757 1757
1758 lmb_reserve(kern_base, kern_size); 1758 memblock_reserve(kern_base, kern_size);
1759 1759
1760 find_ramdisk(phys_base); 1760 find_ramdisk(phys_base);
1761 1761
1762 lmb_enforce_memory_limit(cmdline_memory_size); 1762 memblock_enforce_memory_limit(cmdline_memory_size);
1763 1763
1764 lmb_analyze(); 1764 memblock_analyze();
1765 lmb_dump_all(); 1765 memblock_dump_all();
1766 1766
1767 set_bit(0, mmu_context_bmap); 1767 set_bit(0, mmu_context_bmap);
1768 1768
@@ -1816,8 +1816,8 @@ void __init paging_init(void)
1816 */ 1816 */
1817 for_each_possible_cpu(i) { 1817 for_each_possible_cpu(i) {
1818 /* XXX Use node local allocations... XXX */ 1818 /* XXX Use node local allocations... XXX */
1819 softirq_stack[i] = __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 1819 softirq_stack[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
1820 hardirq_stack[i] = __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 1820 hardirq_stack[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
1821 } 1821 }
1822 1822
1823 /* Setup bootmem... */ 1823 /* Setup bootmem... */
@@ -2117,7 +2117,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
2117 "node=%d entry=%lu/%lu\n", start, block, nr, 2117 "node=%d entry=%lu/%lu\n", start, block, nr,
2118 node, 2118 node,
2119 addr >> VMEMMAP_CHUNK_SHIFT, 2119 addr >> VMEMMAP_CHUNK_SHIFT,
2120 VMEMMAP_SIZE >> VMEMMAP_CHUNK_SHIFT); 2120 VMEMMAP_SIZE);
2121 } 2121 }
2122 } 2122 }
2123 return 0; 2123 return 0;
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index df49b200ca4c..b0b43aa5e45a 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/slab.h>
14#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
15#include <linux/pagemap.h> 14#include <linux/pagemap.h>
16#include <linux/init.h> 15#include <linux/init.h>
@@ -20,6 +19,7 @@
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
21#include <linux/kdebug.h> 20#include <linux/kdebug.h>
22#include <linux/log2.h> 21#include <linux/log2.h>
22#include <linux/gfp.h>
23 23
24#include <asm/bitext.h> 24#include <asm/bitext.h>
25#include <asm/page.h> 25#include <asm/page.h>
@@ -2215,8 +2215,6 @@ void __init ld_mmu_srmmu(void)
2215 BTFIXUPSET_CALL(pmd_page, srmmu_pmd_page, BTFIXUPCALL_NORM); 2215 BTFIXUPSET_CALL(pmd_page, srmmu_pmd_page, BTFIXUPCALL_NORM);
2216 BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM); 2216 BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM);
2217 2217
2218 BTFIXUPSET_SETHI(none_mask, 0xF0000000);
2219
2220 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM); 2218 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM);
2221 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0); 2219 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0);
2222 2220
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 18652534b91a..4289f90f8697 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -12,6 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/slab.h>
15#include <linux/bootmem.h> 16#include <linux/bootmem.h>
16#include <linux/highmem.h> 17#include <linux/highmem.h>
17#include <linux/fs.h> 18#include <linux/fs.h>
@@ -2086,9 +2087,6 @@ void __init ld_mmu_sun4c(void)
2086 2087
2087 BTFIXUPSET_CALL(set_pte, sun4c_set_pte, BTFIXUPCALL_STO1O0); 2088 BTFIXUPSET_CALL(set_pte, sun4c_set_pte, BTFIXUPCALL_STO1O0);
2088 2089
2089 /* The 2.4.18 code does not set this on sun4c, how does it work? XXX */
2090 /* BTFIXUPSET_SETHI(none_mask, 0x00000000); */ /* Defaults to zero? */
2091
2092 BTFIXUPSET_CALL(pte_pfn, sun4c_pte_pfn, BTFIXUPCALL_NORM); 2090 BTFIXUPSET_CALL(pte_pfn, sun4c_pte_pfn, BTFIXUPCALL_NORM);
2093#if 0 /* PAGE_SHIFT <= 12 */ /* Eek. Investigate. XXX */ 2091#if 0 /* PAGE_SHIFT <= 12 */ /* Eek. Investigate. XXX */
2094 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_ANDNINT(PAGE_SIZE - 1)); 2092 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_ANDNINT(PAGE_SIZE - 1));
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index 36a0813f9517..101d7c82870b 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/preempt.h> 7#include <linux/preempt.h>
8#include <linux/slab.h>
8#include <asm/system.h> 9#include <asm/system.h>
9#include <asm/page.h> 10#include <asm/page.h>
10#include <asm/tlbflush.h> 11#include <asm/tlbflush.h>