aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-09-24 06:59:11 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-24 06:59:18 -0400
commitd2ff6de537c61a0f05731c6679f3e1abc2d95e68 (patch)
tree821aa38121f57a9d5419388ef10ea6f3aa445d4d /arch
parente23a8b6a8f319c0f08b6ccef2dccbb37e7603dc2 (diff)
parenta724eada8c2a7b62463b73ccf73fd0bb6e928aeb (diff)
Merge branch 'linus' into x86/urgent
Merge reason: Queueing up dependent early-printk fix. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig8
-rw-r--r--arch/alpha/boot/tools/objstrip.c2
-rw-r--r--arch/alpha/include/asm/hardirq.h14
-rw-r--r--arch/alpha/include/asm/mman.h5
-rw-r--r--arch/alpha/kernel/pci_iommu.c6
-rw-r--r--arch/alpha/kernel/time.c79
-rw-r--r--arch/alpha/mm/init.c2
-rw-r--r--arch/alpha/mm/numa.c2
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/configs/n770_defconfig2
-rw-r--r--arch/arm/configs/nhk8815_defconfig2
-rw-r--r--arch/arm/configs/omap3_beagle_defconfig47
-rw-r--r--arch/arm/configs/omap_3430sdp_defconfig39
-rw-r--r--arch/arm/configs/omap_ldp_defconfig54
-rw-r--r--arch/arm/include/asm/mman.h18
-rw-r--r--arch/arm/include/asm/unistd.h2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/mach-at91/Kconfig7
-rw-r--r--arch/arm/mach-at91/Makefile1
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c96
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c2
-rw-r--r--arch/arm/mach-at91/board-cam60.c2
-rw-r--r--arch/arm/mach-at91/board-neocore926.c2
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c277
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c2
-rw-r--r--arch/arm/mach-at91/include/mach/board.h5
-rw-r--r--arch/arm/mach-ep93xx/clock.c88
-rw-r--r--arch/arm/mach-ep93xx/core.c32
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h6
-rw-r--r--arch/arm/mach-ep93xx/include/mach/fb.h56
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h2
-rw-r--r--arch/arm/mach-ixp4xx/common.c16
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/system.h6
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c155
-rw-r--r--arch/arm/mach-nomadik/include/mach/fsmc.h29
-rw-r--r--arch/arm/mach-nomadik/include/mach/nand.h16
-rw-r--r--arch/arm/mach-omap2/board-apollon.c4
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c4
-rw-r--r--arch/arm/mach-omap2/devices.c71
-rw-r--r--arch/arm/mach-omap2/gpmc.c63
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.c78
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.h2
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/plat-mxc/include/mach/spi.h27
-rw-r--r--arch/arm/plat-omap/include/mach/gpmc.h4
-rw-r--r--arch/arm/plat-omap/include/mach/irqs.h2
-rw-r--r--arch/arm/plat-omap/include/mach/lcd_mipid.h5
-rw-r--r--arch/arm/plat-omap/include/mach/mmc.h20
-rw-r--r--arch/arm/plat-omap/include/mach/omapfb.h4
-rw-r--r--arch/avr32/include/asm/mman.h18
-rw-r--r--arch/avr32/mm/init.c2
-rw-r--r--arch/blackfin/include/asm/sections.h38
-rw-r--r--arch/blackfin/include/asm/unistd.h2
-rw-r--r--arch/blackfin/mach-bf538/include/mach/defBF539.h2
-rw-r--r--arch/blackfin/mach-common/entry.S2
-rw-r--r--arch/cris/include/asm/mman.h20
-rw-r--r--arch/cris/mm/init.c2
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/frv/include/asm/gdb-stub.h1
-rw-r--r--arch/frv/include/asm/hardirq.h17
-rw-r--r--arch/frv/include/asm/mman.h19
-rw-r--r--arch/frv/include/asm/perf_event.h (renamed from arch/frv/include/asm/perf_counter.h)10
-rw-r--r--arch/frv/include/asm/unistd.h2
-rw-r--r--arch/frv/kernel/debug-stub.c1
-rw-r--r--arch/frv/kernel/entry.S2
-rw-r--r--arch/frv/kernel/process.c4
-rw-r--r--arch/frv/lib/Makefile2
-rw-r--r--arch/frv/lib/cache.S2
-rw-r--r--arch/frv/lib/perf_event.c (renamed from arch/frv/lib/perf_counter.c)8
-rw-r--r--arch/h8300/include/asm/hardirq.h15
-rw-r--r--arch/h8300/include/asm/mman.h18
-rw-r--r--arch/h8300/kernel/irq.c5
-rw-r--r--arch/h8300/kernel/timer/tpu.c1
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/hp/common/sba_iommu.c7
-rw-r--r--arch/ia64/ia32/sys_ia32.c2
-rw-r--r--arch/ia64/include/asm/cputime.h1
-rw-r--r--arch/ia64/include/asm/mman.h14
-rw-r--r--arch/ia64/kernel/pci-swiotlb.c2
-rw-r--r--arch/ia64/mm/init.c7
-rw-r--r--arch/m32r/Kconfig6
-rw-r--r--arch/m32r/include/asm/hardirq.h15
-rw-r--r--arch/m32r/include/asm/mman.h18
-rw-r--r--arch/m32r/kernel/ptrace.c5
-rw-r--r--arch/m32r/kernel/smpboot.c2
-rw-r--r--arch/m32r/kernel/time.c74
-rw-r--r--arch/m32r/mm/init.c2
-rw-r--r--arch/m68k/Kconfig6
-rw-r--r--arch/m68k/include/asm/hardirq_mm.h12
-rw-r--r--arch/m68k/include/asm/mman.h18
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68k/kernel/time.c70
-rw-r--r--arch/m68k/mm/init.c2
-rw-r--r--arch/m68knommu/kernel/syscalltable.S2
-rw-r--r--arch/microblaze/include/asm/unistd.h2
-rw-r--r--arch/microblaze/kernel/syscall_table.S2
-rw-r--r--arch/microblaze/mm/init.c2
-rw-r--r--arch/mips/include/asm/mman.h5
-rw-r--r--arch/mips/include/asm/pgtable.h10
-rw-r--r--arch/mips/include/asm/unistd.h6
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/mm/init.c9
-rw-r--r--arch/mn10300/include/asm/cacheflush.h4
-rw-r--r--arch/mn10300/include/asm/gdb-stub.h1
-rw-r--r--arch/mn10300/include/asm/mman.h29
-rw-r--r--arch/mn10300/include/asm/unistd.h2
-rw-r--r--arch/mn10300/kernel/asm-offsets.c2
-rw-r--r--arch/mn10300/kernel/entry.S2
-rw-r--r--arch/mn10300/kernel/mn10300-serial-low.S2
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c14
-rw-r--r--arch/mn10300/kernel/setup.c2
-rw-r--r--arch/mn10300/mm/init.c2
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/parisc/include/asm/mman.h5
-rw-r--r--arch/parisc/include/asm/perf_counter.h7
-rw-r--r--arch/parisc/include/asm/perf_event.h7
-rw-r--r--arch/parisc/include/asm/unistd.h4
-rw-r--r--arch/parisc/kernel/syscall_table.S2
-rw-r--r--arch/parisc/mm/init.c2
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8377_rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8377_wlan.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8378_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8378_rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8379_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8379_rdb.dts1
-rw-r--r--arch/powerpc/include/asm/cputime.h13
-rw-r--r--arch/powerpc/include/asm/hw_irq.h22
-rw-r--r--arch/powerpc/include/asm/mman.h2
-rw-r--r--arch/powerpc/include/asm/paca.h2
-rw-r--r--arch/powerpc/include/asm/perf_event.h (renamed from arch/powerpc/include/asm/perf_counter.h)22
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/include/asm/unistd.h2
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/entry_64.S8
-rw-r--r--arch/powerpc/kernel/irq.c8
-rw-r--r--arch/powerpc/kernel/mpc7450-pmu.c2
-rw-r--r--arch/powerpc/kernel/perf_callchain.c2
-rw-r--r--arch/powerpc/kernel/perf_event.c (renamed from arch/powerpc/kernel/perf_counter.c)566
-rw-r--r--arch/powerpc/kernel/power4-pmu.c2
-rw-r--r--arch/powerpc/kernel/power5+-pmu.c2
-rw-r--r--arch/powerpc/kernel/power5-pmu.c2
-rw-r--r--arch/powerpc/kernel/power6-pmu.c2
-rw-r--r--arch/powerpc/kernel/power7-pmu.c2
-rw-r--r--arch/powerpc/kernel/ppc970-pmu.c2
-rw-r--r--arch/powerpc/kernel/setup-common.c2
-rw-r--r--arch/powerpc/kernel/time.c34
-rw-r--r--arch/powerpc/kernel/udbg_16550.c2
-rw-r--r--arch/powerpc/mm/fault.c8
-rw-r--r--arch/powerpc/mm/init_32.c36
-rw-r--r--arch/powerpc/mm/init_64.c29
-rw-r--r--arch/powerpc/mm/mem.c8
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype4
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c4
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c2
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c2
-rw-r--r--arch/powerpc/sysdev/axonram.c2
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/defconfig37
-rw-r--r--arch/s390/hypfs/inode.c6
-rw-r--r--arch/s390/include/asm/cputime.h1
-rw-r--r--arch/s390/include/asm/lowcore.h9
-rw-r--r--arch/s390/include/asm/mman.h13
-rw-r--r--arch/s390/include/asm/perf_counter.h10
-rw-r--r--arch/s390/include/asm/perf_event.h10
-rw-r--r--arch/s390/include/asm/processor.h2
-rw-r--r--arch/s390/include/asm/unistd.h2
-rw-r--r--arch/s390/kernel/asm-offsets.c7
-rw-r--r--arch/s390/kernel/compat_linux.c83
-rw-r--r--arch/s390/kernel/compat_linux.h4
-rw-r--r--arch/s390/kernel/compat_wrapper.S35
-rw-r--r--arch/s390/kernel/entry.h6
-rw-r--r--arch/s390/kernel/process.c40
-rw-r--r--arch/s390/kernel/ptrace.c19
-rw-r--r--arch/s390/kernel/sclp.S5
-rw-r--r--arch/s390/kernel/smp.c50
-rw-r--r--arch/s390/kernel/suspend.c24
-rw-r--r--arch/s390/kernel/swsusp_asm64.S102
-rw-r--r--arch/s390/kernel/syscalls.S10
-rw-r--r--arch/s390/kvm/interrupt.c2
-rw-r--r--arch/s390/mm/fault.c8
-rw-r--r--arch/s390/mm/init.c2
-rw-r--r--arch/s390/mm/page-states.c52
-rw-r--r--arch/s390/mm/pgtable.c17
-rw-r--r--arch/score/include/asm/page.h3
-rw-r--r--arch/score/include/asm/thread_info.h15
-rw-r--r--arch/score/kernel/vmlinux.lds.S77
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/include/asm/perf_counter.h9
-rw-r--r--arch/sh/include/asm/perf_event.h9
-rw-r--r--arch/sh/include/asm/unistd_32.h2
-rw-r--r--arch/sh/include/asm/unistd_64.h2
-rw-r--r--arch/sh/kernel/syscalls_32.S2
-rw-r--r--arch/sh/kernel/syscalls_64.S2
-rw-r--r--arch/sh/mm/fault_32.c8
-rw-r--r--arch/sh/mm/init.c8
-rw-r--r--arch/sh/mm/tlbflush_64.c8
-rw-r--r--arch/sparc/Kconfig4
-rw-r--r--arch/sparc/include/asm/mman.h2
-rw-r--r--arch/sparc/include/asm/perf_counter.h14
-rw-r--r--arch/sparc/include/asm/perf_event.h14
-rw-r--r--arch/sparc/include/asm/unistd.h2
-rw-r--r--arch/sparc/include/asm/vio.h2
-rw-r--r--arch/sparc/kernel/Makefile2
-rw-r--r--arch/sparc/kernel/irq_64.c2
-rw-r--r--arch/sparc/kernel/nmi.c4
-rw-r--r--arch/sparc/kernel/pcr.c10
-rw-r--r--arch/sparc/kernel/perf_event.c (renamed from arch/sparc/kernel/perf_counter.c)178
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/mm/init_32.c2
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/include/asm/hardirq.h26
-rw-r--r--arch/um/include/shared/ptrace_user.h2
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/skas/mmu.c4
-rw-r--r--arch/x86/Kconfig12
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/include/asm/acpi.h1
-rw-r--r--arch/x86/include/asm/entry_arch.h2
-rw-r--r--arch/x86/include/asm/perf_event.h (renamed from arch/x86/include/asm/perf_counter.h)30
-rw-r--r--arch/x86/include/asm/syscall.h14
-rw-r--r--arch/x86/include/asm/unistd_32.h2
-rw-r--r--arch/x86/include/asm/unistd_64.h4
-rw-r--r--arch/x86/kernel/Makefile1
-rw-r--r--arch/x86/kernel/apic/apic.c6
-rw-r--r--arch/x86/kernel/cpu/Makefile2
-rw-r--r--arch/x86/kernel/cpu/amd.c2
-rw-r--r--arch/x86/kernel/cpu/common.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event.c (renamed from arch/x86/kernel/cpu/perf_counter.c)556
-rw-r--r--arch/x86/kernel/cpu/perfctr-watchdog.c2
-rw-r--r--arch/x86/kernel/e820.c2
-rw-r--r--arch/x86/kernel/early_printk.c780
-rw-r--r--arch/x86/kernel/entry_64.S24
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/microcode_core.c4
-rw-r--r--arch/x86/kernel/pci-swiotlb.c5
-rw-r--r--arch/x86/kernel/ptrace.c21
-rw-r--r--arch/x86/kernel/setup.c3
-rw-r--r--arch/x86/kernel/sfi.c122
-rw-r--r--arch/x86/kernel/syscall_table_32.S2
-rw-r--r--arch/x86/lguest/boot.c10
-rw-r--r--arch/x86/mm/fault.c8
-rw-r--r--arch/x86/mm/init_32.c12
-rw-r--r--arch/x86/mm/init_64.c12
-rw-r--r--arch/x86/mm/kmemcheck/kmemcheck.c3
-rw-r--r--arch/x86/oprofile/op_model_ppro.c4
-rw-r--r--arch/x86/oprofile/op_x86_model.h2
-rw-r--r--arch/x86/pci/mmconfig-shared.c8
-rw-r--r--arch/x86/pci/mmconfig_32.c2
-rw-r--r--arch/xtensa/include/asm/mman.h5
-rw-r--r--arch/xtensa/mm/init.c2
266 files changed, 2777 insertions, 2679 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 9fb8aae5c391..443448154f32 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -45,6 +45,14 @@ config GENERIC_CALIBRATE_DELAY
45 bool 45 bool
46 default y 46 default y
47 47
48config GENERIC_TIME
49 bool
50 default y
51
52config ARCH_USES_GETTIMEOFFSET
53 bool
54 default y
55
48config ZONE_DMA 56config ZONE_DMA
49 bool 57 bool
50 default y 58 default y
diff --git a/arch/alpha/boot/tools/objstrip.c b/arch/alpha/boot/tools/objstrip.c
index ef1838230291..9d0727d18aee 100644
--- a/arch/alpha/boot/tools/objstrip.c
+++ b/arch/alpha/boot/tools/objstrip.c
@@ -93,7 +93,7 @@ main (int argc, char *argv[])
93 ofd = 1; 93 ofd = 1;
94 if (i < argc) { 94 if (i < argc) {
95 ofd = open(argv[i++], O_WRONLY | O_CREAT | O_TRUNC, 0666); 95 ofd = open(argv[i++], O_WRONLY | O_CREAT | O_TRUNC, 0666);
96 if (fd == -1) { 96 if (ofd == -1) {
97 perror("open"); 97 perror("open");
98 exit(1); 98 exit(1);
99 } 99 }
diff --git a/arch/alpha/include/asm/hardirq.h b/arch/alpha/include/asm/hardirq.h
index 88971460fa6c..242c09ba98c4 100644
--- a/arch/alpha/include/asm/hardirq.h
+++ b/arch/alpha/include/asm/hardirq.h
@@ -1,17 +1,9 @@
1#ifndef _ALPHA_HARDIRQ_H 1#ifndef _ALPHA_HARDIRQ_H
2#define _ALPHA_HARDIRQ_H 2#define _ALPHA_HARDIRQ_H
3 3
4#include <linux/threads.h>
5#include <linux/cache.h>
6
7
8/* entry.S is sensitive to the offsets of these fields */
9typedef struct {
10 unsigned long __softirq_pending;
11} ____cacheline_aligned irq_cpustat_t;
12
13#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
14
15void ack_bad_irq(unsigned int irq); 4void ack_bad_irq(unsigned int irq);
5#define ack_bad_irq ack_bad_irq
6
7#include <asm-generic/hardirq.h>
16 8
17#endif /* _ALPHA_HARDIRQ_H */ 9#endif /* _ALPHA_HARDIRQ_H */
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h
index 90d7c35d2867..99c56d47879d 100644
--- a/arch/alpha/include/asm/mman.h
+++ b/arch/alpha/include/asm/mman.h
@@ -28,6 +28,8 @@
28#define MAP_NORESERVE 0x10000 /* don't check for reservations */ 28#define MAP_NORESERVE 0x10000 /* don't check for reservations */
29#define MAP_POPULATE 0x20000 /* populate (prefault) pagetables */ 29#define MAP_POPULATE 0x20000 /* populate (prefault) pagetables */
30#define MAP_NONBLOCK 0x40000 /* do not block on IO */ 30#define MAP_NONBLOCK 0x40000 /* do not block on IO */
31#define MAP_STACK 0x80000 /* give out an address that is best suited for process/thread stacks */
32#define MAP_HUGETLB 0x100000 /* create a huge page mapping */
31 33
32#define MS_ASYNC 1 /* sync memory asynchronously */ 34#define MS_ASYNC 1 /* sync memory asynchronously */
33#define MS_SYNC 2 /* synchronous memory sync */ 35#define MS_SYNC 2 /* synchronous memory sync */
@@ -48,6 +50,9 @@
48#define MADV_DONTFORK 10 /* don't inherit across fork */ 50#define MADV_DONTFORK 10 /* don't inherit across fork */
49#define MADV_DOFORK 11 /* do inherit across fork */ 51#define MADV_DOFORK 11 /* do inherit across fork */
50 52
53#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
54#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
55
51/* compatibility flags */ 56/* compatibility flags */
52#define MAP_FILE 0 57#define MAP_FILE 0
53 58
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index bfb880af959d..d15aedfe6066 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -268,11 +268,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
268 assume it doesn't support sg mapping, and, since we tried to 268 assume it doesn't support sg mapping, and, since we tried to
269 use direct_map above, it now must be considered an error. */ 269 use direct_map above, it now must be considered an error. */
270 if (! alpha_mv.mv_pci_tbi) { 270 if (! alpha_mv.mv_pci_tbi) {
271 static int been_here = 0; /* Only print the message once. */ 271 printk_once(KERN_WARNING "pci_map_single: no HW sg\n");
272 if (!been_here) {
273 printk(KERN_WARNING "pci_map_single: no HW sg\n");
274 been_here = 1;
275 }
276 return 0; 272 return 0;
277 } 273 }
278 274
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index b04e2cbf23a4..5d0826654c61 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -408,28 +408,17 @@ time_init(void)
408 * part. So we can't do the "find absolute time in terms of cycles" thing 408 * part. So we can't do the "find absolute time in terms of cycles" thing
409 * that the other ports do. 409 * that the other ports do.
410 */ 410 */
411void 411u32 arch_gettimeoffset(void)
412do_gettimeofday(struct timeval *tv)
413{ 412{
414 unsigned long flags;
415 unsigned long sec, usec, seq;
416 unsigned long delta_cycles, delta_usec, partial_tick;
417
418 do {
419 seq = read_seqbegin_irqsave(&xtime_lock, flags);
420
421 delta_cycles = rpcc() - state.last_time;
422 sec = xtime.tv_sec;
423 usec = (xtime.tv_nsec / 1000);
424 partial_tick = state.partial_tick;
425
426 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
427
428#ifdef CONFIG_SMP 413#ifdef CONFIG_SMP
429 /* Until and unless we figure out how to get cpu cycle counters 414 /* Until and unless we figure out how to get cpu cycle counters
430 in sync and keep them there, we can't use the rpcc tricks. */ 415 in sync and keep them there, we can't use the rpcc tricks. */
431 delta_usec = 0; 416 return 0;
432#else 417#else
418 unsigned long delta_cycles, delta_usec, partial_tick;
419
420 delta_cycles = rpcc() - state.last_time;
421 partial_tick = state.partial_tick;
433 /* 422 /*
434 * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks) 423 * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
435 * = cycles * (s_t_p_c) * 1e6 / (2**48 * ticks) 424 * = cycles * (s_t_p_c) * 1e6 / (2**48 * ticks)
@@ -446,64 +435,10 @@ do_gettimeofday(struct timeval *tv)
446 delta_usec = (delta_cycles * state.scaled_ticks_per_cycle 435 delta_usec = (delta_cycles * state.scaled_ticks_per_cycle
447 + partial_tick) * 15625; 436 + partial_tick) * 15625;
448 delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; 437 delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
438 return delta_usec * 1000;
449#endif 439#endif
450
451 usec += delta_usec;
452 if (usec >= 1000000) {
453 sec += 1;
454 usec -= 1000000;
455 }
456
457 tv->tv_sec = sec;
458 tv->tv_usec = usec;
459} 440}
460 441
461EXPORT_SYMBOL(do_gettimeofday);
462
463int
464do_settimeofday(struct timespec *tv)
465{
466 time_t wtm_sec, sec = tv->tv_sec;
467 long wtm_nsec, nsec = tv->tv_nsec;
468 unsigned long delta_nsec;
469
470 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
471 return -EINVAL;
472
473 write_seqlock_irq(&xtime_lock);
474
475 /* The offset that is added into time in do_gettimeofday above
476 must be subtracted out here to keep a coherent view of the
477 time. Without this, a full-tick error is possible. */
478
479#ifdef CONFIG_SMP
480 delta_nsec = 0;
481#else
482 delta_nsec = rpcc() - state.last_time;
483 delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle
484 + state.partial_tick) * 15625;
485 delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
486 delta_nsec *= 1000;
487#endif
488
489 nsec -= delta_nsec;
490
491 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
492 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
493
494 set_normalized_timespec(&xtime, sec, nsec);
495 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
496
497 ntp_clear();
498
499 write_sequnlock_irq(&xtime_lock);
500 clock_was_set();
501 return 0;
502}
503
504EXPORT_SYMBOL(do_settimeofday);
505
506
507/* 442/*
508 * In order to set the CMOS clock precisely, set_rtc_mmss has to be 443 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
509 * called 500 ms after the second nowtime has started, because when 444 * called 500 ms after the second nowtime has started, because when
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index af71d38c8e41..a0902c20d677 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -299,7 +299,7 @@ printk_memory_info(void)
299 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 299 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
300 300
301 printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, %luk data, %luk init)\n", 301 printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, %luk data, %luk init)\n",
302 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 302 nr_free_pages() << (PAGE_SHIFT-10),
303 max_mapnr << (PAGE_SHIFT-10), 303 max_mapnr << (PAGE_SHIFT-10),
304 codesize >> 10, 304 codesize >> 10,
305 reservedpages << (PAGE_SHIFT-10), 305 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 0eab55749423..10b403554b65 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -349,7 +349,7 @@ void __init mem_init(void)
349 349
350 printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, " 350 printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, "
351 "%luk data, %luk init)\n", 351 "%luk data, %luk init)\n",
352 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), 352 nr_free_pages() << (PAGE_SHIFT-10),
353 num_physpages << (PAGE_SHIFT-10), 353 num_physpages << (PAGE_SHIFT-10),
354 codesize >> 10, 354 codesize >> 10,
355 reservedpages << (PAGE_SHIFT-10), 355 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 7350557a81e0..54661125a8bf 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -25,7 +25,7 @@ KBUILD_CFLAGS +=$(call cc-option,-marm,)
25# Select a platform tht is kept up-to-date 25# Select a platform tht is kept up-to-date
26KBUILD_DEFCONFIG := versatile_defconfig 26KBUILD_DEFCONFIG := versatile_defconfig
27 27
28# defines filename extension depending memory manement type. 28# defines filename extension depending memory management type.
29ifeq ($(CONFIG_MMU),) 29ifeq ($(CONFIG_MMU),)
30MMUEXT := -nommu 30MMUEXT := -nommu
31endif 31endif
diff --git a/arch/arm/configs/n770_defconfig b/arch/arm/configs/n770_defconfig
index 672f6db06a52..a1657b73683f 100644
--- a/arch/arm/configs/n770_defconfig
+++ b/arch/arm/configs/n770_defconfig
@@ -875,7 +875,7 @@ CONFIG_FB_OMAP_LCDC_EXTERNAL=y
875CONFIG_FB_OMAP_LCDC_HWA742=y 875CONFIG_FB_OMAP_LCDC_HWA742=y
876# CONFIG_FB_OMAP_LCDC_BLIZZARD is not set 876# CONFIG_FB_OMAP_LCDC_BLIZZARD is not set
877CONFIG_FB_OMAP_MANUAL_UPDATE=y 877CONFIG_FB_OMAP_MANUAL_UPDATE=y
878# CONFIG_FB_OMAP_LCD_MIPID is not set 878CONFIG_FB_OMAP_LCD_MIPID=y
879# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set 879# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
880CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=2 880CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=2
881# CONFIG_FB_OMAP_DMA_TUNE is not set 881# CONFIG_FB_OMAP_DMA_TUNE is not set
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 9bb45b932f04..600cb270f2bf 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -498,7 +498,7 @@ CONFIG_MTD_CFI_I2=y
498# CONFIG_MTD_DOC2001PLUS is not set 498# CONFIG_MTD_DOC2001PLUS is not set
499CONFIG_MTD_NAND=y 499CONFIG_MTD_NAND=y
500CONFIG_MTD_NAND_VERIFY_WRITE=y 500CONFIG_MTD_NAND_VERIFY_WRITE=y
501# CONFIG_MTD_NAND_ECC_SMC is not set 501CONFIG_MTD_NAND_ECC_SMC=y
502# CONFIG_MTD_NAND_MUSEUM_IDS is not set 502# CONFIG_MTD_NAND_MUSEUM_IDS is not set
503# CONFIG_MTD_NAND_GPIO is not set 503# CONFIG_MTD_NAND_GPIO is not set
504CONFIG_MTD_NAND_IDS=y 504CONFIG_MTD_NAND_IDS=y
diff --git a/arch/arm/configs/omap3_beagle_defconfig b/arch/arm/configs/omap3_beagle_defconfig
index 51c0fa8897cd..357d4021e2d0 100644
--- a/arch/arm/configs/omap3_beagle_defconfig
+++ b/arch/arm/configs/omap3_beagle_defconfig
@@ -778,7 +778,33 @@ CONFIG_DAB=y
778# 778#
779# CONFIG_VGASTATE is not set 779# CONFIG_VGASTATE is not set
780# CONFIG_VIDEO_OUTPUT_CONTROL is not set 780# CONFIG_VIDEO_OUTPUT_CONTROL is not set
781# CONFIG_FB is not set 781CONFIG_FB=y
782# CONFIG_FIRMWARE_EDID is not set
783# CONFIG_FB_DDC is not set
784CONFIG_FB_CFB_FILLRECT=y
785CONFIG_FB_CFB_COPYAREA=y
786CONFIG_FB_CFB_IMAGEBLIT=y
787# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
788# CONFIG_FB_SYS_FILLRECT is not set
789# CONFIG_FB_SYS_COPYAREA is not set
790# CONFIG_FB_SYS_IMAGEBLIT is not set
791# CONFIG_FB_FOREIGN_ENDIAN is not set
792# CONFIG_FB_SYS_FOPS is not set
793# CONFIG_FB_SVGALIB is not set
794# CONFIG_FB_MACMODES is not set
795# CONFIG_FB_BACKLIGHT is not set
796# CONFIG_FB_MODE_HELPERS is not set
797# CONFIG_FB_TILEBLITTING is not set
798
799#
800# Frame buffer hardware drivers
801#
802# CONFIG_FB_S1D13XXX is not set
803# CONFIG_FB_VIRTUAL is not set
804CONFIG_FB_OMAP=y
805# CONFIG_FB_OMAP_LCDC_EXTERNAL is not set
806# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
807CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=2
782# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 808# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
783 809
784# 810#
@@ -791,6 +817,25 @@ CONFIG_DAB=y
791# 817#
792# CONFIG_VGA_CONSOLE is not set 818# CONFIG_VGA_CONSOLE is not set
793CONFIG_DUMMY_CONSOLE=y 819CONFIG_DUMMY_CONSOLE=y
820CONFIG_FRAMEBUFFER_CONSOLE=y
821# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
822CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
823CONFIG_FONTS=y
824CONFIG_FONT_8x8=y
825CONFIG_FONT_8x16=y
826# CONFIG_FONT_6x11 is not set
827# CONFIG_FONT_7x14 is not set
828# CONFIG_FONT_PEARL_8x8 is not set
829# CONFIG_FONT_ACORN_8x8 is not set
830# CONFIG_FONT_MINI_4x6 is not set
831# CONFIG_FONT_SUN8x16 is not set
832# CONFIG_FONT_SUN12x22 is not set
833# CONFIG_FONT_10x18 is not set
834# CONFIG_LOGO is not set
835
836#
837# Sound
838#
794# CONFIG_SOUND is not set 839# CONFIG_SOUND is not set
795# CONFIG_HID_SUPPORT is not set 840# CONFIG_HID_SUPPORT is not set
796CONFIG_USB_SUPPORT=y 841CONFIG_USB_SUPPORT=y
diff --git a/arch/arm/configs/omap_3430sdp_defconfig b/arch/arm/configs/omap_3430sdp_defconfig
index 9a510eab75a6..8a4a7e2ba87b 100644
--- a/arch/arm/configs/omap_3430sdp_defconfig
+++ b/arch/arm/configs/omap_3430sdp_defconfig
@@ -1313,8 +1313,33 @@ CONFIG_DVB_ISL6421=m
1313# Graphics support 1313# Graphics support
1314# 1314#
1315# CONFIG_VGASTATE is not set 1315# CONFIG_VGASTATE is not set
1316# CONFIG_VIDEO_OUTPUT_CONTROL is not set 1316CONFIG_FB=y
1317# CONFIG_FB is not set 1317# CONFIG_FIRMWARE_EDID is not set
1318# CONFIG_FB_DDC is not set
1319CONFIG_FB_CFB_FILLRECT=y
1320CONFIG_FB_CFB_COPYAREA=y
1321CONFIG_FB_CFB_IMAGEBLIT=y
1322# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1323# CONFIG_FB_SYS_FILLRECT is not set
1324# CONFIG_FB_SYS_COPYAREA is not set
1325# CONFIG_FB_SYS_IMAGEBLIT is not set
1326# CONFIG_FB_FOREIGN_ENDIAN is not set
1327# CONFIG_FB_SYS_FOPS is not set
1328# CONFIG_FB_SVGALIB is not set
1329# CONFIG_FB_MACMODES is not set
1330# CONFIG_FB_BACKLIGHT is not set
1331# CONFIG_FB_MODE_HELPERS is not set
1332# CONFIG_FB_TILEBLITTING is not set
1333
1334#
1335# Frame buffer hardware drivers
1336#
1337# CONFIG_FB_S1D13XXX is not set
1338# CONFIG_FB_VIRTUAL is not set
1339CONFIG_FB_OMAP=y
1340# CONFIG_FB_OMAP_LCDC_EXTERNAL is not set
1341# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
1342CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=2
1318# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1343# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1319 1344
1320# 1345#
@@ -1331,6 +1356,16 @@ CONFIG_DISPLAY_SUPPORT=y
1331# 1356#
1332# CONFIG_VGA_CONSOLE is not set 1357# CONFIG_VGA_CONSOLE is not set
1333CONFIG_DUMMY_CONSOLE=y 1358CONFIG_DUMMY_CONSOLE=y
1359CONFIG_FRAMEBUFFER_CONSOLE=y
1360# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1361# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1362# CONFIG_FONTS is not set
1363CONFIG_FONT_8x8=y
1364CONFIG_FONT_8x16=y
1365CONFIG_LOGO=y
1366CONFIG_LOGO_LINUX_MONO=y
1367CONFIG_LOGO_LINUX_VGA16=y
1368CONFIG_LOGO_LINUX_CLUT224=y
1334CONFIG_SOUND=y 1369CONFIG_SOUND=y
1335CONFIG_SOUND_OSS_CORE=y 1370CONFIG_SOUND_OSS_CORE=y
1336CONFIG_SND=y 1371CONFIG_SND=y
diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
index 679a4a3e265e..b9c48919a68c 100644
--- a/arch/arm/configs/omap_ldp_defconfig
+++ b/arch/arm/configs/omap_ldp_defconfig
@@ -690,6 +690,7 @@ CONFIG_GPIOLIB=y
690# CONFIG_GPIO_MAX732X is not set 690# CONFIG_GPIO_MAX732X is not set
691# CONFIG_GPIO_PCA953X is not set 691# CONFIG_GPIO_PCA953X is not set
692# CONFIG_GPIO_PCF857X is not set 692# CONFIG_GPIO_PCF857X is not set
693CONFIG_GPIO_TWL4030=y
693 694
694# 695#
695# PCI GPIO expanders: 696# PCI GPIO expanders:
@@ -742,6 +743,7 @@ CONFIG_SSB_POSSIBLE=y
742# CONFIG_MFD_SM501 is not set 743# CONFIG_MFD_SM501 is not set
743# CONFIG_HTC_EGPIO is not set 744# CONFIG_HTC_EGPIO is not set
744# CONFIG_HTC_PASIC3 is not set 745# CONFIG_HTC_PASIC3 is not set
746CONFIG_TWL4030_CORE=y
745# CONFIG_MFD_TMIO is not set 747# CONFIG_MFD_TMIO is not set
746# CONFIG_MFD_T7L66XB is not set 748# CONFIG_MFD_T7L66XB is not set
747# CONFIG_MFD_TC6387XB is not set 749# CONFIG_MFD_TC6387XB is not set
@@ -767,8 +769,46 @@ CONFIG_DAB=y
767# 769#
768# CONFIG_VGASTATE is not set 770# CONFIG_VGASTATE is not set
769CONFIG_VIDEO_OUTPUT_CONTROL=m 771CONFIG_VIDEO_OUTPUT_CONTROL=m
770# CONFIG_FB is not set 772CONFIG_FB=y
771# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 773CONFIG_FIRMWARE_EDID=y
774# CONFIG_FB_DDC is not set
775# CONFIG_FB_BOOT_VESA_SUPPORT is not set
776CONFIG_FB_CFB_FILLRECT=y
777CONFIG_FB_CFB_COPYAREA=y
778CONFIG_FB_CFB_IMAGEBLIT=y
779# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
780# CONFIG_FB_SYS_FILLRECT is not set
781# CONFIG_FB_SYS_COPYAREA is not set
782# CONFIG_FB_SYS_IMAGEBLIT is not set
783# CONFIG_FB_FOREIGN_ENDIAN is not set
784# CONFIG_FB_SYS_FOPS is not set
785# CONFIG_FB_SVGALIB is not set
786# CONFIG_FB_MACMODES is not set
787# CONFIG_FB_BACKLIGHT is not set
788CONFIG_FB_MODE_HELPERS=y
789CONFIG_FB_TILEBLITTING=y
790
791#
792# Frame buffer hardware drivers
793#
794# CONFIG_FB_S1D13XXX is not set
795# CONFIG_FB_VIRTUAL is not set
796# CONFIG_FB_METRONOME is not set
797CONFIG_FB_OMAP=y
798CONFIG_FB_OMAP_LCD_VGA=y
799# CONFIG_FB_OMAP_LCDC_EXTERNAL is not set
800# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
801CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=4
802CONFIG_BACKLIGHT_LCD_SUPPORT=y
803CONFIG_LCD_CLASS_DEVICE=y
804# CONFIG_LCD_LTV350QV is not set
805# CONFIG_LCD_ILI9320 is not set
806# CONFIG_LCD_TDO24M is not set
807# CONFIG_LCD_VGG2432A4 is not set
808CONFIG_LCD_PLATFORM=y
809CONFIG_BACKLIGHT_CLASS_DEVICE=y
810# CONFIG_BACKLIGHT_CORGI is not set
811# CONFIG_BACKLIGHT_GENERIC is not set
772 812
773# 813#
774# Display device support 814# Display device support
@@ -780,6 +820,16 @@ CONFIG_VIDEO_OUTPUT_CONTROL=m
780# 820#
781# CONFIG_VGA_CONSOLE is not set 821# CONFIG_VGA_CONSOLE is not set
782CONFIG_DUMMY_CONSOLE=y 822CONFIG_DUMMY_CONSOLE=y
823CONFIG_FRAMEBUFFER_CONSOLE=y
824# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
825# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
826# CONFIG_FONTS is not set
827CONFIG_FONT_8x8=y
828CONFIG_FONT_8x16=y
829CONFIG_LOGO=y
830CONFIG_LOGO_LINUX_MONO=y
831CONFIG_LOGO_LINUX_VGA16=y
832CONFIG_LOGO_LINUX_CLUT224=y
783CONFIG_SOUND=y 833CONFIG_SOUND=y
784CONFIG_SND=y 834CONFIG_SND=y
785# CONFIG_SND_SEQUENCER is not set 835# CONFIG_SND_SEQUENCER is not set
diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h
index fc26976d8e3a..8eebf89f5ab1 100644
--- a/arch/arm/include/asm/mman.h
+++ b/arch/arm/include/asm/mman.h
@@ -1,17 +1 @@
1#ifndef __ARM_MMAN_H__ #include <asm-generic/mman.h>
2#define __ARM_MMAN_H__
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ARM_MMAN_H__ */
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 9122c9ee18fb..89f7eade20af 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -390,7 +390,7 @@
390#define __NR_preadv (__NR_SYSCALL_BASE+361) 390#define __NR_preadv (__NR_SYSCALL_BASE+361)
391#define __NR_pwritev (__NR_SYSCALL_BASE+362) 391#define __NR_pwritev (__NR_SYSCALL_BASE+362)
392#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) 392#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
393#define __NR_perf_counter_open (__NR_SYSCALL_BASE+364) 393#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)
394 394
395/* 395/*
396 * The following SWIs are ARM private. 396 * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index ecfa98954d1d..fafce1b5c69f 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -373,7 +373,7 @@
373 CALL(sys_preadv) 373 CALL(sys_preadv)
374 CALL(sys_pwritev) 374 CALL(sys_pwritev)
375 CALL(sys_rt_tgsigqueueinfo) 375 CALL(sys_rt_tgsigqueueinfo)
376 CALL(sys_perf_counter_open) 376 CALL(sys_perf_event_open)
377#ifndef syscalls_counted 377#ifndef syscalls_counted
378.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 378.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
379#define syscalls_counted 379#define syscalls_counted
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index a24d824c428b..e35d54d43e70 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -289,6 +289,13 @@ config MACH_NEOCORE926
289 help 289 help
290 Select this if you are using the Adeneo Neocore 926 board. 290 Select this if you are using the Adeneo Neocore 926 board.
291 291
292config MACH_AT91SAM9G20EK_2MMC
293 bool "Atmel AT91SAM9G20-EK Evaluation Kit modified for 2 MMC Slots"
294 depends on ARCH_AT91SAM9G20
295 help
296 Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
297 Rev A or B modified for 2 MMC Slots.
298
292endif 299endif
293 300
294# ---------------------------------------------------------- 301# ----------------------------------------------------------
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index a6ed015d82ed..ada440aab0c5 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
59 59
60# AT91SAM9G20 board-specific support 60# AT91SAM9G20 board-specific support
61obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o 61obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
62obj-$(CONFIG_MACH_AT91SAM9G20EK_2MMC) += board-sam9g20ek-2slot-mmc.o
62obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o 63obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
63 64
64# AT91SAM9G45 board-specific support 65# AT91SAM9G45 board-specific support
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index ee4ea0e720cf..07eb7b07e442 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -278,6 +278,102 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
278void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 278void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
279#endif 279#endif
280 280
281/* --------------------------------------------------------------------
282 * MMC / SD Slot for Atmel MCI Driver
283 * -------------------------------------------------------------------- */
284
285#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
286static u64 mmc_dmamask = DMA_BIT_MASK(32);
287static struct mci_platform_data mmc_data;
288
289static struct resource mmc_resources[] = {
290 [0] = {
291 .start = AT91SAM9260_BASE_MCI,
292 .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
293 .flags = IORESOURCE_MEM,
294 },
295 [1] = {
296 .start = AT91SAM9260_ID_MCI,
297 .end = AT91SAM9260_ID_MCI,
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302static struct platform_device at91sam9260_mmc_device = {
303 .name = "atmel_mci",
304 .id = -1,
305 .dev = {
306 .dma_mask = &mmc_dmamask,
307 .coherent_dma_mask = DMA_BIT_MASK(32),
308 .platform_data = &mmc_data,
309 },
310 .resource = mmc_resources,
311 .num_resources = ARRAY_SIZE(mmc_resources),
312};
313
314void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
315{
316 unsigned int i;
317 unsigned int slot_count = 0;
318
319 if (!data)
320 return;
321
322 for (i = 0; i < ATMEL_MCI_MAX_NR_SLOTS; i++) {
323 if (data->slot[i].bus_width) {
324 /* input/irq */
325 if (data->slot[i].detect_pin) {
326 at91_set_gpio_input(data->slot[i].detect_pin, 1);
327 at91_set_deglitch(data->slot[i].detect_pin, 1);
328 }
329 if (data->slot[i].wp_pin)
330 at91_set_gpio_input(data->slot[i].wp_pin, 1);
331
332 switch (i) {
333 case 0:
334 /* CMD */
335 at91_set_A_periph(AT91_PIN_PA7, 1);
336 /* DAT0, maybe DAT1..DAT3 */
337 at91_set_A_periph(AT91_PIN_PA6, 1);
338 if (data->slot[i].bus_width == 4) {
339 at91_set_A_periph(AT91_PIN_PA9, 1);
340 at91_set_A_periph(AT91_PIN_PA10, 1);
341 at91_set_A_periph(AT91_PIN_PA11, 1);
342 }
343 slot_count++;
344 break;
345 case 1:
346 /* CMD */
347 at91_set_B_periph(AT91_PIN_PA1, 1);
348 /* DAT0, maybe DAT1..DAT3 */
349 at91_set_B_periph(AT91_PIN_PA0, 1);
350 if (data->slot[i].bus_width == 4) {
351 at91_set_B_periph(AT91_PIN_PA5, 1);
352 at91_set_B_periph(AT91_PIN_PA4, 1);
353 at91_set_B_periph(AT91_PIN_PA3, 1);
354 }
355 slot_count++;
356 break;
357 default:
358 printk(KERN_ERR
359 "AT91: SD/MMC slot %d not available\n", i);
360 break;
361 }
362 }
363 }
364
365 if (slot_count) {
366 /* CLK */
367 at91_set_A_periph(AT91_PIN_PA8, 0);
368
369 mmc_data = *data;
370 platform_device_register(&at91sam9260_mmc_device);
371 }
372}
373#else
374void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
375#endif
376
281 377
282/* -------------------------------------------------------------------- 378/* --------------------------------------------------------------------
283 * NAND / SmartMedia 379 * NAND / SmartMedia
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 61e52b66bc72..50667bed7cc9 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -53,7 +53,7 @@ static void __init afeb9260_map_io(void)
53 /* Initialize processor: 18.432 MHz crystal */ 53 /* Initialize processor: 18.432 MHz crystal */
54 at91sam9260_initialize(18432000); 54 at91sam9260_initialize(18432000);
55 55
56 /* DGBU on ttyS0. (Rx & Tx only) */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0); 57 at91_register_uart(0, 0, 0);
58 58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ 59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index d3ba29c5d8c8..02138af631e7 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -50,7 +50,7 @@ static void __init cam60_map_io(void)
50 /* Initialize processor: 10 MHz crystal */ 50 /* Initialize processor: 10 MHz crystal */
51 at91sam9260_initialize(10000000); 51 at91sam9260_initialize(10000000);
52 52
53 /* DGBU on ttyS0. (Rx & Tx only) */ 53 /* DBGU on ttyS0. (Rx & Tx only) */
54 at91_register_uart(0, 0, 0); 54 at91_register_uart(0, 0, 0);
55 55
56 /* set serial console to ttyS0 (ie, DBGU) */ 56 /* set serial console to ttyS0 (ie, DBGU) */
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 9ba7ba2cc3b1..8c0b71c95be4 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -56,7 +56,7 @@ static void __init neocore926_map_io(void)
56 /* Initialize processor: 20 MHz crystal */ 56 /* Initialize processor: 20 MHz crystal */
57 at91sam9263_initialize(20000000); 57 at91sam9263_initialize(20000000);
58 58
59 /* DGBU on ttyS0. (Rx & Tx only) */ 59 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_register_uart(0, 0, 0); 60 at91_register_uart(0, 0, 0);
61 61
62 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */ 62 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 4cff9a7e61d2..664938e8f661 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -53,7 +53,7 @@ static void __init ek_map_io(void)
53 /* Initialize processor: 12.000 MHz crystal */ 53 /* Initialize processor: 12.000 MHz crystal */
54 at91sam9260_initialize(12000000); 54 at91sam9260_initialize(12000000);
55 55
56 /* DGBU on ttyS0. (Rx & Tx only) */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0); 57 at91_register_uart(0, 0, 0);
58 58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ 59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 93a0f8b100eb..ba9d501b5c50 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -54,7 +54,7 @@ static void __init ek_map_io(void)
54 /* Initialize processor: 18.432 MHz crystal */ 54 /* Initialize processor: 18.432 MHz crystal */
55 at91sam9260_initialize(18432000); 55 at91sam9260_initialize(18432000);
56 56
57 /* DGBU on ttyS0. (Rx & Tx only) */ 57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0); 58 at91_register_uart(0, 0, 0);
59 59
60 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ 60 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index f9b19993a7a9..c4c8865d52d7 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -61,7 +61,7 @@ static void __init ek_map_io(void)
61 /* Setup the LEDs */ 61 /* Setup the LEDs */
62 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14); 62 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
63 63
64 /* DGBU on ttyS0. (Rx & Tx only) */ 64 /* DBGU on ttyS0. (Rx & Tx only) */
65 at91_register_uart(0, 0, 0); 65 at91_register_uart(0, 0, 0);
66 66
67 /* set serial console to ttyS0 (ie, DBGU) */ 67 /* set serial console to ttyS0 (ie, DBGU) */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 1bf7bd4cbe13..26f1aa6049af 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -57,7 +57,7 @@ static void __init ek_map_io(void)
57 /* Initialize processor: 16.367 MHz crystal */ 57 /* Initialize processor: 16.367 MHz crystal */
58 at91sam9263_initialize(16367660); 58 at91sam9263_initialize(16367660);
59 59
60 /* DGBU on ttyS0. (Rx & Tx only) */ 60 /* DBGU on ttyS0. (Rx & Tx only) */
61 at91_register_uart(0, 0, 0); 61 at91_register_uart(0, 0, 0);
62 62
63 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */ 63 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
diff --git a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
new file mode 100644
index 000000000000..a28e53faf71d
--- /dev/null
+++ b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
@@ -0,0 +1,277 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
4 * Copyright (C) 2009 Rob Emanuele
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/at73c213.h>
28#include <linux/clk.h>
29
30#include <mach/hardware.h>
31#include <asm/setup.h>
32#include <asm/mach-types.h>
33#include <asm/irq.h>
34
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38
39#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/at91sam9_smc.h>
42
43#include "sam9_smc.h"
44#include "generic.h"
45
46
47static void __init ek_map_io(void)
48{
49 /* Initialize processor: 18.432 MHz crystal */
50 at91sam9260_initialize(18432000);
51
52 /* DGBU on ttyS0. (Rx & Tx only) */
53 at91_register_uart(0, 0, 0);
54
55 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
56 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
57 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
58 | ATMEL_UART_RI);
59
60 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
61 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
62
63 /* set serial console to ttyS0 (ie, DBGU) */
64 at91_set_serial_console(0);
65}
66
67static void __init ek_init_irq(void)
68{
69 at91sam9260_init_interrupts(NULL);
70}
71
72
73/*
74 * USB Host port
75 */
76static struct at91_usbh_data __initdata ek_usbh_data = {
77 .ports = 2,
78};
79
80/*
81 * USB Device port
82 */
83static struct at91_udc_data __initdata ek_udc_data = {
84 .vbus_pin = AT91_PIN_PC5,
85 .pullup_pin = 0, /* pull-up driven by UDC */
86};
87
88
89/*
90 * SPI devices.
91 */
92static struct spi_board_info ek_spi_devices[] = {
93#if !defined(CONFIG_MMC_ATMELMCI)
94 { /* DataFlash chip */
95 .modalias = "mtd_dataflash",
96 .chip_select = 1,
97 .max_speed_hz = 15 * 1000 * 1000,
98 .bus_num = 0,
99 },
100#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
101 { /* DataFlash card */
102 .modalias = "mtd_dataflash",
103 .chip_select = 0,
104 .max_speed_hz = 15 * 1000 * 1000,
105 .bus_num = 0,
106 },
107#endif
108#endif
109};
110
111
112/*
113 * MACB Ethernet device
114 */
115static struct at91_eth_data __initdata ek_macb_data = {
116 .phy_irq_pin = AT91_PIN_PC12,
117 .is_rmii = 1,
118};
119
120
121/*
122 * NAND flash
123 */
124static struct mtd_partition __initdata ek_nand_partition[] = {
125 {
126 .name = "Bootstrap",
127 .offset = 0,
128 .size = 4 * SZ_1M,
129 },
130 {
131 .name = "Partition 1",
132 .offset = MTDPART_OFS_NXTBLK,
133 .size = 60 * SZ_1M,
134 },
135 {
136 .name = "Partition 2",
137 .offset = MTDPART_OFS_NXTBLK,
138 .size = MTDPART_SIZ_FULL,
139 },
140};
141
142static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
143{
144 *num_partitions = ARRAY_SIZE(ek_nand_partition);
145 return ek_nand_partition;
146}
147
148/* det_pin is not connected */
149static struct atmel_nand_data __initdata ek_nand_data = {
150 .ale = 21,
151 .cle = 22,
152 .rdy_pin = AT91_PIN_PC13,
153 .enable_pin = AT91_PIN_PC14,
154 .partition_info = nand_partitions,
155#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
156 .bus_width_16 = 1,
157#else
158 .bus_width_16 = 0,
159#endif
160};
161
162static struct sam9_smc_config __initdata ek_nand_smc_config = {
163 .ncs_read_setup = 0,
164 .nrd_setup = 2,
165 .ncs_write_setup = 0,
166 .nwe_setup = 2,
167
168 .ncs_read_pulse = 4,
169 .nrd_pulse = 4,
170 .ncs_write_pulse = 4,
171 .nwe_pulse = 4,
172
173 .read_cycle = 7,
174 .write_cycle = 7,
175
176 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
177 .tdf_cycles = 3,
178};
179
180static void __init ek_add_device_nand(void)
181{
182 /* setup bus-width (8 or 16) */
183 if (ek_nand_data.bus_width_16)
184 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
185 else
186 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
187
188 /* configure chip-select 3 (NAND) */
189 sam9_smc_configure(3, &ek_nand_smc_config);
190
191 at91_add_device_nand(&ek_nand_data);
192}
193
194
195/*
196 * MCI (SD/MMC)
197 * det_pin and wp_pin are not connected
198 */
199#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
200static struct mci_platform_data __initdata ek_mmc_data = {
201 .slot[0] = {
202 .bus_width = 4,
203 .detect_pin = -ENODEV,
204 .wp_pin = -ENODEV,
205 },
206 .slot[1] = {
207 .bus_width = 4,
208 .detect_pin = -ENODEV,
209 .wp_pin = -ENODEV,
210 },
211
212};
213#else
214static struct amci_platform_data __initdata ek_mmc_data = {
215};
216#endif
217
218/*
219 * LEDs
220 */
221static struct gpio_led ek_leds[] = {
222 { /* "bottom" led, green, userled1 to be defined */
223 .name = "ds5",
224 .gpio = AT91_PIN_PB12,
225 .active_low = 1,
226 .default_trigger = "none",
227 },
228 { /* "power" led, yellow */
229 .name = "ds1",
230 .gpio = AT91_PIN_PB13,
231 .default_trigger = "heartbeat",
232 }
233};
234
235static struct i2c_board_info __initdata ek_i2c_devices[] = {
236 {
237 I2C_BOARD_INFO("24c512", 0x50),
238 },
239};
240
241
242static void __init ek_board_init(void)
243{
244 /* Serial */
245 at91_add_device_serial();
246 /* USB Host */
247 at91_add_device_usbh(&ek_usbh_data);
248 /* USB Device */
249 at91_add_device_udc(&ek_udc_data);
250 /* SPI */
251 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
252 /* NAND */
253 ek_add_device_nand();
254 /* Ethernet */
255 at91_add_device_eth(&ek_macb_data);
256 /* MMC */
257 at91_add_device_mci(0, &ek_mmc_data);
258 /* I2C */
259 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
260 /* LEDs */
261 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
262 /* PCK0 provides MCLK to the WM8731 */
263 at91_set_B_periph(AT91_PIN_PC1, 0);
264 /* SSC (for WM8731) */
265 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
266}
267
268MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
269 /* Maintainer: Rob Emanuele */
270 .phys_io = AT91_BASE_SYS,
271 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
272 .boot_params = AT91_SDRAM_BASE + 0x100,
273 .timer = &at91sam926x_timer,
274 .map_io = ek_map_io,
275 .init_irq = ek_init_irq,
276 .init_machine = ek_board_init,
277MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index ca470d504ea0..29cf83177484 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -50,7 +50,7 @@ static void __init ek_map_io(void)
50 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
51 at91sam9260_initialize(18432000); 51 at91sam9260_initialize(18432000);
52 52
53 /* DGBU on ttyS0. (Rx & Tx only) */ 53 /* DBGU on ttyS0. (Rx & Tx only) */
54 at91_register_uart(0, 0, 0); 54 at91_register_uart(0, 0, 0);
55 55
56 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ 56 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 9d07679efce7..94ffb5c103b9 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -43,7 +43,7 @@ static void __init ek_map_io(void)
43 /* Initialize processor: 12.000 MHz crystal */ 43 /* Initialize processor: 12.000 MHz crystal */
44 at91sam9rl_initialize(12000000); 44 at91sam9rl_initialize(12000000);
45 45
46 /* DGBU on ttyS0. (Rx & Tx only) */ 46 /* DBGU on ttyS0. (Rx & Tx only) */
47 at91_register_uart(0, 0, 0); 47 at91_register_uart(0, 0, 0);
48 48
49 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ 49 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index d13304c0bc45..905d6ef76807 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -53,7 +53,7 @@ static void __init ek_map_io(void)
53 /* Initialize processor: 12.000 MHz crystal */ 53 /* Initialize processor: 12.000 MHz crystal */
54 at91sam9260_initialize(12000000); 54 at91sam9260_initialize(12000000);
55 55
56 /* DGBU on ttyS0. (Rx & Tx only) */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0); 57 at91_register_uart(0, 0, 0);
58 58
59 /* set serial console to ttyS0 (ie, DBGU) */ 59 /* set serial console to ttyS0 (ie, DBGU) */
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index d96405b7d578..b6a3480383e5 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -52,7 +52,7 @@ static void __init ek_map_io(void)
52 /* Initialize processor: 12.00 MHz crystal */ 52 /* Initialize processor: 12.00 MHz crystal */
53 at91sam9263_initialize(12000000); 53 at91sam9263_initialize(12000000);
54 54
55 /* DGBU on ttyS0. (Rx & Tx only) */ 55 /* DBGU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0); 56 at91_register_uart(0, 0, 0);
57 57
58 /* set serial console to ttyS0 (ie, DBGU) */ 58 /* set serial console to ttyS0 (ie, DBGU) */
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 13f27a4b882d..583f38a38df7 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -37,6 +37,7 @@
37#include <linux/leds.h> 37#include <linux/leds.h>
38#include <linux/spi/spi.h> 38#include <linux/spi/spi.h>
39#include <linux/usb/atmel_usba_udc.h> 39#include <linux/usb/atmel_usba_udc.h>
40#include <linux/atmel-mci.h>
40#include <sound/atmel-ac97c.h> 41#include <sound/atmel-ac97c.h>
41 42
42 /* USB Device */ 43 /* USB Device */
@@ -64,6 +65,7 @@ struct at91_cf_data {
64extern void __init at91_add_device_cf(struct at91_cf_data *data); 65extern void __init at91_add_device_cf(struct at91_cf_data *data);
65 66
66 /* MMC / SD */ 67 /* MMC / SD */
68 /* at91_mci platform config */
67struct at91_mmc_data { 69struct at91_mmc_data {
68 u8 det_pin; /* card detect IRQ */ 70 u8 det_pin; /* card detect IRQ */
69 unsigned slot_b:1; /* uses Slot B */ 71 unsigned slot_b:1; /* uses Slot B */
@@ -73,6 +75,9 @@ struct at91_mmc_data {
73}; 75};
74extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data); 76extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data);
75 77
78 /* atmel-mci platform config */
79extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
80
76 /* Ethernet (EMAC & MACB) */ 81 /* Ethernet (EMAC & MACB) */
77struct at91_eth_data { 82struct at91_eth_data {
78 u32 phy_mask; 83 u32 phy_mask;
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 3dd0e2a23095..dda19cd76194 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -37,7 +37,7 @@ struct clk {
37static unsigned long get_uart_rate(struct clk *clk); 37static unsigned long get_uart_rate(struct clk *clk);
38 38
39static int set_keytchclk_rate(struct clk *clk, unsigned long rate); 39static int set_keytchclk_rate(struct clk *clk, unsigned long rate);
40 40static int set_div_rate(struct clk *clk, unsigned long rate);
41 41
42static struct clk clk_uart1 = { 42static struct clk clk_uart1 = {
43 .sw_locked = 1, 43 .sw_locked = 1,
@@ -76,6 +76,13 @@ static struct clk clk_pwm = {
76 .rate = EP93XX_EXT_CLK_RATE, 76 .rate = EP93XX_EXT_CLK_RATE,
77}; 77};
78 78
79static struct clk clk_video = {
80 .sw_locked = 1,
81 .enable_reg = EP93XX_SYSCON_VIDCLKDIV,
82 .enable_mask = EP93XX_SYSCON_CLKDIV_ENABLE,
83 .set_rate = set_div_rate,
84};
85
79/* DMA Clocks */ 86/* DMA Clocks */
80static struct clk clk_m2p0 = { 87static struct clk clk_m2p0 = {
81 .enable_reg = EP93XX_SYSCON_PWRCNT, 88 .enable_reg = EP93XX_SYSCON_PWRCNT,
@@ -140,6 +147,7 @@ static struct clk_lookup clocks[] = {
140 INIT_CK(NULL, "pll2", &clk_pll2), 147 INIT_CK(NULL, "pll2", &clk_pll2),
141 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host), 148 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host),
142 INIT_CK("ep93xx-keypad", NULL, &clk_keypad), 149 INIT_CK("ep93xx-keypad", NULL, &clk_keypad),
150 INIT_CK("ep93xx-fb", NULL, &clk_video),
143 INIT_CK(NULL, "pwm_clk", &clk_pwm), 151 INIT_CK(NULL, "pwm_clk", &clk_pwm),
144 INIT_CK(NULL, "m2p0", &clk_m2p0), 152 INIT_CK(NULL, "m2p0", &clk_m2p0),
145 INIT_CK(NULL, "m2p1", &clk_m2p1), 153 INIT_CK(NULL, "m2p1", &clk_m2p1),
@@ -236,6 +244,84 @@ static int set_keytchclk_rate(struct clk *clk, unsigned long rate)
236 return 0; 244 return 0;
237} 245}
238 246
247static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel,
248 int *pdiv, int *div)
249{
250 unsigned long max_rate, best_rate = 0,
251 actual_rate = 0, mclk_rate = 0, rate_err = -1;
252 int i, found = 0, __div = 0, __pdiv = 0;
253
254 /* Don't exceed the maximum rate */
255 max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4),
256 (unsigned long)EP93XX_EXT_CLK_RATE / 4);
257 rate = min(rate, max_rate);
258
259 /*
260 * Try the two pll's and the external clock
261 * Because the valid predividers are 2, 2.5 and 3, we multiply
262 * all the clocks by 2 to avoid floating point math.
263 *
264 * This is based on the algorithm in the ep93xx raster guide:
265 * http://be-a-maverick.com/en/pubs/appNote/AN269REV1.pdf
266 *
267 */
268 for (i = 0; i < 3; i++) {
269 if (i == 0)
270 mclk_rate = EP93XX_EXT_CLK_RATE * 2;
271 else if (i == 1)
272 mclk_rate = clk_pll1.rate * 2;
273 else if (i == 2)
274 mclk_rate = clk_pll2.rate * 2;
275
276 /* Try each predivider value */
277 for (__pdiv = 4; __pdiv <= 6; __pdiv++) {
278 __div = mclk_rate / (rate * __pdiv);
279 if (__div < 2 || __div > 127)
280 continue;
281
282 actual_rate = mclk_rate / (__pdiv * __div);
283
284 if (!found || abs(actual_rate - rate) < rate_err) {
285 *pdiv = __pdiv - 3;
286 *div = __div;
287 *psel = (i == 2);
288 *esel = (i != 0);
289 best_rate = actual_rate;
290 rate_err = abs(actual_rate - rate);
291 found = 1;
292 }
293 }
294 }
295
296 if (!found)
297 return 0;
298
299 return best_rate;
300}
301
302static int set_div_rate(struct clk *clk, unsigned long rate)
303{
304 unsigned long actual_rate;
305 int psel = 0, esel = 0, pdiv = 0, div = 0;
306 u32 val;
307
308 actual_rate = calc_clk_div(rate, &psel, &esel, &pdiv, &div);
309 if (actual_rate == 0)
310 return -EINVAL;
311 clk->rate = actual_rate;
312
313 /* Clear the esel, psel, pdiv and div bits */
314 val = __raw_readl(clk->enable_reg);
315 val &= ~0x7fff;
316
317 /* Set the new esel, psel, pdiv and div bits for the new clock rate */
318 val |= (esel ? EP93XX_SYSCON_CLKDIV_ESEL : 0) |
319 (psel ? EP93XX_SYSCON_CLKDIV_PSEL : 0) |
320 (pdiv << EP93XX_SYSCON_CLKDIV_PDIV_SHIFT) | div;
321 ep93xx_syscon_swlocked_write(val, clk->enable_reg);
322 return 0;
323}
324
239int clk_set_rate(struct clk *clk, unsigned long rate) 325int clk_set_rate(struct clk *clk, unsigned long rate)
240{ 326{
241 if (clk->set_rate) 327 if (clk->set_rate)
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 16b92c37ec99..f7ebed942f66 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -30,6 +30,7 @@
30#include <linux/i2c-gpio.h> 30#include <linux/i2c-gpio.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/fb.h>
33 34
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35#include <asm/mach/time.h> 36#include <asm/mach/time.h>
@@ -682,6 +683,37 @@ void ep93xx_pwm_release_gpio(struct platform_device *pdev)
682EXPORT_SYMBOL(ep93xx_pwm_release_gpio); 683EXPORT_SYMBOL(ep93xx_pwm_release_gpio);
683 684
684 685
686/*************************************************************************
687 * EP93xx video peripheral handling
688 *************************************************************************/
689static struct ep93xxfb_mach_info ep93xxfb_data;
690
691static struct resource ep93xx_fb_resource[] = {
692 {
693 .start = EP93XX_RASTER_PHYS_BASE,
694 .end = EP93XX_RASTER_PHYS_BASE + 0x800 - 1,
695 .flags = IORESOURCE_MEM,
696 },
697};
698
699static struct platform_device ep93xx_fb_device = {
700 .name = "ep93xx-fb",
701 .id = -1,
702 .dev = {
703 .platform_data = &ep93xxfb_data,
704 .coherent_dma_mask = DMA_BIT_MASK(32),
705 .dma_mask = &ep93xx_fb_device.dev.coherent_dma_mask,
706 },
707 .num_resources = ARRAY_SIZE(ep93xx_fb_resource),
708 .resource = ep93xx_fb_resource,
709};
710
711void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data)
712{
713 ep93xxfb_data = *data;
714 platform_device_register(&ep93xx_fb_device);
715}
716
685extern void ep93xx_gpio_init(void); 717extern void ep93xx_gpio_init(void);
686 718
687void __init ep93xx_init_devices(void) 719void __init ep93xx_init_devices(void)
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
index ea78e908fc82..0fbf87b16338 100644
--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
+++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
@@ -70,6 +70,7 @@
70#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) 70#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000)
71#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) 71#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000)
72 72
73#define EP93XX_RASTER_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00030000)
73#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) 74#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000)
74 75
75#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) 76#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000)
@@ -207,6 +208,11 @@
207#define EP93XX_SYSCON_DEVCFG_ADCPD (1<<2) 208#define EP93XX_SYSCON_DEVCFG_ADCPD (1<<2)
208#define EP93XX_SYSCON_DEVCFG_KEYS (1<<1) 209#define EP93XX_SYSCON_DEVCFG_KEYS (1<<1)
209#define EP93XX_SYSCON_DEVCFG_SHENA (1<<0) 210#define EP93XX_SYSCON_DEVCFG_SHENA (1<<0)
211#define EP93XX_SYSCON_VIDCLKDIV EP93XX_SYSCON_REG(0x84)
212#define EP93XX_SYSCON_CLKDIV_ENABLE (1<<15)
213#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14)
214#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13)
215#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8
210#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90) 216#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90)
211#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31) 217#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31)
212#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) 218#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16)
diff --git a/arch/arm/mach-ep93xx/include/mach/fb.h b/arch/arm/mach-ep93xx/include/mach/fb.h
new file mode 100644
index 000000000000..d5ae11d7c453
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/fb.h
@@ -0,0 +1,56 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/fb.h
3 */
4
5#ifndef __ASM_ARCH_EP93XXFB_H
6#define __ASM_ARCH_EP93XXFB_H
7
8struct platform_device;
9struct fb_videomode;
10struct fb_info;
11
12#define EP93XXFB_USE_MODEDB 0
13
14/* VideoAttributes flags */
15#define EP93XXFB_STATE_MACHINE_ENABLE (1 << 0)
16#define EP93XXFB_PIXEL_CLOCK_ENABLE (1 << 1)
17#define EP93XXFB_VSYNC_ENABLE (1 << 2)
18#define EP93XXFB_PIXEL_DATA_ENABLE (1 << 3)
19#define EP93XXFB_COMPOSITE_SYNC (1 << 4)
20#define EP93XXFB_SYNC_VERT_HIGH (1 << 5)
21#define EP93XXFB_SYNC_HORIZ_HIGH (1 << 6)
22#define EP93XXFB_SYNC_BLANK_HIGH (1 << 7)
23#define EP93XXFB_PCLK_FALLING (1 << 8)
24#define EP93XXFB_ENABLE_AC (1 << 9)
25#define EP93XXFB_ENABLE_LCD (1 << 10)
26#define EP93XXFB_ENABLE_CCIR (1 << 12)
27#define EP93XXFB_USE_PARALLEL_INTERFACE (1 << 13)
28#define EP93XXFB_ENABLE_INTERRUPT (1 << 14)
29#define EP93XXFB_USB_INTERLACE (1 << 16)
30#define EP93XXFB_USE_EQUALIZATION (1 << 17)
31#define EP93XXFB_USE_DOUBLE_HORZ (1 << 18)
32#define EP93XXFB_USE_DOUBLE_VERT (1 << 19)
33#define EP93XXFB_USE_BLANK_PIXEL (1 << 20)
34#define EP93XXFB_USE_SDCSN0 (0 << 21)
35#define EP93XXFB_USE_SDCSN1 (1 << 21)
36#define EP93XXFB_USE_SDCSN2 (2 << 21)
37#define EP93XXFB_USE_SDCSN3 (3 << 21)
38
39#define EP93XXFB_ENABLE (EP93XXFB_STATE_MACHINE_ENABLE | \
40 EP93XXFB_PIXEL_CLOCK_ENABLE | \
41 EP93XXFB_VSYNC_ENABLE | \
42 EP93XXFB_PIXEL_DATA_ENABLE)
43
44struct ep93xxfb_mach_info {
45 unsigned int num_modes;
46 const struct fb_videomode *modes;
47 const struct fb_videomode *default_mode;
48 int bpp;
49 unsigned int flags;
50
51 int (*setup)(struct platform_device *pdev);
52 void (*teardown)(struct platform_device *pdev);
53 void (*blank)(int blank_mode, struct fb_info *info);
54};
55
56#endif /* __ASM_ARCH_EP93XXFB_H */
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index 5f5fa6574d34..01a0f0838e5b 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -6,6 +6,7 @@
6 6
7struct i2c_board_info; 7struct i2c_board_info;
8struct platform_device; 8struct platform_device;
9struct ep93xxfb_mach_info;
9 10
10struct ep93xx_eth_data 11struct ep93xx_eth_data
11{ 12{
@@ -33,6 +34,7 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
33 34
34void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); 35void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
35void ep93xx_register_i2c(struct i2c_board_info *devices, int num); 36void ep93xx_register_i2c(struct i2c_board_info *devices, int num);
37void ep93xx_register_fb(struct ep93xxfb_mach_info *data);
36void ep93xx_register_pwm(int pwm0, int pwm1); 38void ep93xx_register_pwm(int pwm0, int pwm1);
37int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); 39int ep93xx_pwm_acquire_gpio(struct platform_device *pdev);
38void ep93xx_pwm_release_gpio(struct platform_device *pdev); 40void ep93xx_pwm_release_gpio(struct platform_device *pdev);
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 5083f03e9b5e..cfd52fb341cb 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -41,8 +41,8 @@
41#include <asm/mach/irq.h> 41#include <asm/mach/irq.h>
42#include <asm/mach/time.h> 42#include <asm/mach/time.h>
43 43
44static int __init ixp4xx_clocksource_init(void); 44static void __init ixp4xx_clocksource_init(void);
45static int __init ixp4xx_clockevent_init(void); 45static void __init ixp4xx_clockevent_init(void);
46static struct clock_event_device clockevent_ixp4xx; 46static struct clock_event_device clockevent_ixp4xx;
47 47
48/************************************************************************* 48/*************************************************************************
@@ -267,7 +267,7 @@ void __init ixp4xx_init_irq(void)
267 267
268static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id) 268static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
269{ 269{
270 struct clock_event_device *evt = &clockevent_ixp4xx; 270 struct clock_event_device *evt = dev_id;
271 271
272 /* Clear Pending Interrupt by writing '1' to it */ 272 /* Clear Pending Interrupt by writing '1' to it */
273 *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND; 273 *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
@@ -281,6 +281,7 @@ static struct irqaction ixp4xx_timer_irq = {
281 .name = "timer1", 281 .name = "timer1",
282 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 282 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
283 .handler = ixp4xx_timer_interrupt, 283 .handler = ixp4xx_timer_interrupt,
284 .dev_id = &clockevent_ixp4xx,
284}; 285};
285 286
286void __init ixp4xx_timer_init(void) 287void __init ixp4xx_timer_init(void)
@@ -401,7 +402,7 @@ void __init ixp4xx_sys_init(void)
401/* 402/*
402 * clocksource 403 * clocksource
403 */ 404 */
404cycle_t ixp4xx_get_cycles(struct clocksource *cs) 405static cycle_t ixp4xx_get_cycles(struct clocksource *cs)
405{ 406{
406 return *IXP4XX_OSTS; 407 return *IXP4XX_OSTS;
407} 408}
@@ -417,14 +418,12 @@ static struct clocksource clocksource_ixp4xx = {
417 418
418unsigned long ixp4xx_timer_freq = FREQ; 419unsigned long ixp4xx_timer_freq = FREQ;
419EXPORT_SYMBOL(ixp4xx_timer_freq); 420EXPORT_SYMBOL(ixp4xx_timer_freq);
420static int __init ixp4xx_clocksource_init(void) 421static void __init ixp4xx_clocksource_init(void)
421{ 422{
422 clocksource_ixp4xx.mult = 423 clocksource_ixp4xx.mult =
423 clocksource_hz2mult(ixp4xx_timer_freq, 424 clocksource_hz2mult(ixp4xx_timer_freq,
424 clocksource_ixp4xx.shift); 425 clocksource_ixp4xx.shift);
425 clocksource_register(&clocksource_ixp4xx); 426 clocksource_register(&clocksource_ixp4xx);
426
427 return 0;
428} 427}
429 428
430/* 429/*
@@ -480,7 +479,7 @@ static struct clock_event_device clockevent_ixp4xx = {
480 .set_next_event = ixp4xx_set_next_event, 479 .set_next_event = ixp4xx_set_next_event,
481}; 480};
482 481
483static int __init ixp4xx_clockevent_init(void) 482static void __init ixp4xx_clockevent_init(void)
484{ 483{
485 clockevent_ixp4xx.mult = div_sc(FREQ, NSEC_PER_SEC, 484 clockevent_ixp4xx.mult = div_sc(FREQ, NSEC_PER_SEC,
486 clockevent_ixp4xx.shift); 485 clockevent_ixp4xx.shift);
@@ -491,5 +490,4 @@ static int __init ixp4xx_clockevent_init(void)
491 clockevent_ixp4xx.cpumask = cpumask_of(0); 490 clockevent_ixp4xx.cpumask = cpumask_of(0);
492 491
493 clockevents_register_device(&clockevent_ixp4xx); 492 clockevents_register_device(&clockevent_ixp4xx);
494 return 0;
495} 493}
diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-ixp4xx/include/mach/system.h
index d2aa26f5acd7..54c0af7fa2d4 100644
--- a/arch/arm/mach-ixp4xx/include/mach/system.h
+++ b/arch/arm/mach-ixp4xx/include/mach/system.h
@@ -13,9 +13,11 @@
13 13
14static inline void arch_idle(void) 14static inline void arch_idle(void)
15{ 15{
16 /* ixp4xx does not implement the XScale PWRMODE register,
17 * so it must not call cpu_do_idle() here.
18 */
16#if 0 19#if 0
17 if (!hlt_counter) 20 cpu_do_idle();
18 cpu_do_idle(0);
19#endif 21#endif
20} 22}
21 23
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 79bdea943eb4..6bfd537d5afb 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -16,12 +16,164 @@
16#include <linux/amba/bus.h> 16#include <linux/amba/bus.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/mtd/mtd.h>
20#include <linux/mtd/nand.h>
21#include <linux/mtd/partitions.h>
22#include <linux/io.h>
23#include <asm/sizes.h>
19#include <asm/mach-types.h> 24#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
21#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27#include <asm/mach/flash.h>
22#include <mach/setup.h> 28#include <mach/setup.h>
29#include <mach/nand.h>
30#include <mach/fsmc.h>
23#include "clock.h" 31#include "clock.h"
24 32
33/* These adresses span 16MB, so use three individual pages */
34static struct resource nhk8815_nand_resources[] = {
35 {
36 .name = "nand_addr",
37 .start = NAND_IO_ADDR,
38 .end = NAND_IO_ADDR + 0xfff,
39 .flags = IORESOURCE_MEM,
40 }, {
41 .name = "nand_cmd",
42 .start = NAND_IO_CMD,
43 .end = NAND_IO_CMD + 0xfff,
44 .flags = IORESOURCE_MEM,
45 }, {
46 .name = "nand_data",
47 .start = NAND_IO_DATA,
48 .end = NAND_IO_DATA + 0xfff,
49 .flags = IORESOURCE_MEM,
50 }
51};
52
53static int nhk8815_nand_init(void)
54{
55 /* FSMC setup for nand chip select (8-bit nand in 8815NHK) */
56 writel(0x0000000E, FSMC_PCR(0));
57 writel(0x000D0A00, FSMC_PMEM(0));
58 writel(0x00100A00, FSMC_PATT(0));
59
60 /* enable access to the chip select area */
61 writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0));
62
63 return 0;
64}
65
66/*
67 * These partitions are the same as those used in the 2.6.20 release
68 * shipped by the vendor; the first two partitions are mandated
69 * by the boot ROM, and the bootloader area is somehow oversized...
70 */
71static struct mtd_partition nhk8815_partitions[] = {
72 {
73 .name = "X-Loader(NAND)",
74 .offset = 0,
75 .size = SZ_256K,
76 }, {
77 .name = "MemInit(NAND)",
78 .offset = MTDPART_OFS_APPEND,
79 .size = SZ_256K,
80 }, {
81 .name = "BootLoader(NAND)",
82 .offset = MTDPART_OFS_APPEND,
83 .size = SZ_2M,
84 }, {
85 .name = "Kernel zImage(NAND)",
86 .offset = MTDPART_OFS_APPEND,
87 .size = 3 * SZ_1M,
88 }, {
89 .name = "Root Filesystem(NAND)",
90 .offset = MTDPART_OFS_APPEND,
91 .size = 22 * SZ_1M,
92 }, {
93 .name = "User Filesystem(NAND)",
94 .offset = MTDPART_OFS_APPEND,
95 .size = MTDPART_SIZ_FULL,
96 }
97};
98
99static struct nomadik_nand_platform_data nhk8815_nand_data = {
100 .parts = nhk8815_partitions,
101 .nparts = ARRAY_SIZE(nhk8815_partitions),
102 .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \
103 | NAND_NO_READRDY | NAND_NO_AUTOINCR,
104 .init = nhk8815_nand_init,
105};
106
107static struct platform_device nhk8815_nand_device = {
108 .name = "nomadik_nand",
109 .dev = {
110 .platform_data = &nhk8815_nand_data,
111 },
112 .resource = nhk8815_nand_resources,
113 .num_resources = ARRAY_SIZE(nhk8815_nand_resources),
114};
115
116/* These are the partitions for the OneNand device, different from above */
117static struct mtd_partition nhk8815_onenand_partitions[] = {
118 {
119 .name = "X-Loader(OneNAND)",
120 .offset = 0,
121 .size = SZ_256K,
122 }, {
123 .name = "MemInit(OneNAND)",
124 .offset = MTDPART_OFS_APPEND,
125 .size = SZ_256K,
126 }, {
127 .name = "BootLoader(OneNAND)",
128 .offset = MTDPART_OFS_APPEND,
129 .size = SZ_2M-SZ_256K,
130 }, {
131 .name = "SysImage(OneNAND)",
132 .offset = MTDPART_OFS_APPEND,
133 .size = 4 * SZ_1M,
134 }, {
135 .name = "Root Filesystem(OneNAND)",
136 .offset = MTDPART_OFS_APPEND,
137 .size = 22 * SZ_1M,
138 }, {
139 .name = "User Filesystem(OneNAND)",
140 .offset = MTDPART_OFS_APPEND,
141 .size = MTDPART_SIZ_FULL,
142 }
143};
144
145static struct flash_platform_data nhk8815_onenand_data = {
146 .parts = nhk8815_onenand_partitions,
147 .nr_parts = ARRAY_SIZE(nhk8815_onenand_partitions),
148};
149
150static struct resource nhk8815_onenand_resource[] = {
151 {
152 .start = 0x30000000,
153 .end = 0x30000000 + SZ_128K - 1,
154 .flags = IORESOURCE_MEM,
155 },
156};
157
158static struct platform_device nhk8815_onenand_device = {
159 .name = "onenand",
160 .id = -1,
161 .dev = {
162 .platform_data = &nhk8815_onenand_data,
163 },
164 .resource = nhk8815_onenand_resource,
165 .num_resources = ARRAY_SIZE(nhk8815_onenand_resource),
166};
167
168static void __init nhk8815_onenand_init(void)
169{
170#ifdef CONFIG_ONENAND
171 /* Set up SMCS0 for OneNand */
172 writel(0x000030db, FSMC_BCR0);
173 writel(0x02100551, FSMC_BTR0);
174#endif
175}
176
25#define __MEM_4K_RESOURCE(x) \ 177#define __MEM_4K_RESOURCE(x) \
26 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} 178 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
27 179
@@ -81,6 +233,8 @@ static int __init nhk8815_eth_init(void)
81device_initcall(nhk8815_eth_init); 233device_initcall(nhk8815_eth_init);
82 234
83static struct platform_device *nhk8815_platform_devices[] __initdata = { 235static struct platform_device *nhk8815_platform_devices[] __initdata = {
236 &nhk8815_nand_device,
237 &nhk8815_onenand_device,
84 &nhk8815_eth_device, 238 &nhk8815_eth_device,
85 /* will add more devices */ 239 /* will add more devices */
86}; 240};
@@ -90,6 +244,7 @@ static void __init nhk8815_platform_init(void)
90 int i; 244 int i;
91 245
92 cpu8815_platform_init(); 246 cpu8815_platform_init();
247 nhk8815_onenand_init();
93 platform_add_devices(nhk8815_platform_devices, 248 platform_add_devices(nhk8815_platform_devices,
94 ARRAY_SIZE(nhk8815_platform_devices)); 249 ARRAY_SIZE(nhk8815_platform_devices));
95 250
diff --git a/arch/arm/mach-nomadik/include/mach/fsmc.h b/arch/arm/mach-nomadik/include/mach/fsmc.h
new file mode 100644
index 000000000000..8c2c05183685
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/fsmc.h
@@ -0,0 +1,29 @@
1
2/* Definitions for the Nomadik FSMC "Flexible Static Memory controller" */
3
4#ifndef __ASM_ARCH_FSMC_H
5#define __ASM_ARCH_FSMC_H
6
7#include <mach/hardware.h>
8/*
9 * Register list
10 */
11
12/* bus control reg. and bus timing reg. for CS0..CS3 */
13#define FSMC_BCR(x) (NOMADIK_FSMC_VA + (x << 3))
14#define FSMC_BTR(x) (NOMADIK_FSMC_VA + (x << 3) + 0x04)
15
16/* PC-card and NAND:
17 * PCR = control register
18 * PMEM = memory timing
19 * PATT = attribute timing
20 * PIO = I/O timing
21 * PECCR = ECC result
22 */
23#define FSMC_PCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x00)
24#define FSMC_PMEM(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x08)
25#define FSMC_PATT(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x0c)
26#define FSMC_PIO(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x10)
27#define FSMC_PECCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x14)
28
29#endif /* __ASM_ARCH_FSMC_H */
diff --git a/arch/arm/mach-nomadik/include/mach/nand.h b/arch/arm/mach-nomadik/include/mach/nand.h
new file mode 100644
index 000000000000..c3c8254c22a5
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/nand.h
@@ -0,0 +1,16 @@
1#ifndef __ASM_ARCH_NAND_H
2#define __ASM_ARCH_NAND_H
3
4struct nomadik_nand_platform_data {
5 struct mtd_partition *parts;
6 int nparts;
7 int options;
8 int (*init) (void);
9 int (*exit) (void);
10};
11
12#define NAND_IO_DATA 0x40000000
13#define NAND_IO_CMD 0x40800000
14#define NAND_IO_ADDR 0x41000000
15
16#endif /* __ASM_ARCH_NAND_H */
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 7a2b54c7291a..a1132288c701 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -87,7 +87,7 @@ static struct mtd_partition apollon_partitions[] = {
87 }, 87 },
88}; 88};
89 89
90static struct flash_platform_data apollon_flash_data = { 90static struct onenand_platform_data apollon_flash_data = {
91 .parts = apollon_partitions, 91 .parts = apollon_partitions,
92 .nr_parts = ARRAY_SIZE(apollon_partitions), 92 .nr_parts = ARRAY_SIZE(apollon_partitions),
93}; 93};
@@ -99,7 +99,7 @@ static struct resource apollon_flash_resource[] = {
99}; 99};
100 100
101static struct platform_device apollon_onenand_device = { 101static struct platform_device apollon_onenand_device = {
102 .name = "onenand", 102 .name = "onenand-flash",
103 .id = -1, 103 .id = -1,
104 .dev = { 104 .dev = {
105 .platform_data = &apollon_flash_data, 105 .platform_data = &apollon_flash_data,
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index e70baa799018..e6e8290b7828 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -19,6 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/regulator/machine.h> 20#include <linux/regulator/machine.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/mmc/host.h>
22 23
23#include <mach/mcspi.h> 24#include <mach/mcspi.h>
24#include <mach/mux.h> 25#include <mach/mux.h>
@@ -102,6 +103,7 @@ static struct twl4030_hsmmc_info mmc[] = {
102 .cover_only = true, 103 .cover_only = true,
103 .gpio_cd = 160, 104 .gpio_cd = 160,
104 .gpio_wp = -EINVAL, 105 .gpio_wp = -EINVAL,
106 .power_saving = true,
105 }, 107 },
106 { 108 {
107 .name = "internal", 109 .name = "internal",
@@ -109,6 +111,8 @@ static struct twl4030_hsmmc_info mmc[] = {
109 .wires = 8, 111 .wires = 8,
110 .gpio_cd = -EINVAL, 112 .gpio_cd = -EINVAL,
111 .gpio_wp = -EINVAL, 113 .gpio_wp = -EINVAL,
114 .nonremovable = true,
115 .power_saving = true,
112 }, 116 },
113 {} /* Terminator */ 117 {} /* Terminator */
114}; 118};
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index a2e915639b72..bcfcfc7fdb9b 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -257,6 +257,11 @@ static inline void omap_init_sti(void) {}
257#define OMAP2_MCSPI3_BASE 0x480b8000 257#define OMAP2_MCSPI3_BASE 0x480b8000
258#define OMAP2_MCSPI4_BASE 0x480ba000 258#define OMAP2_MCSPI4_BASE 0x480ba000
259 259
260#define OMAP4_MCSPI1_BASE 0x48098100
261#define OMAP4_MCSPI2_BASE 0x4809a100
262#define OMAP4_MCSPI3_BASE 0x480b8100
263#define OMAP4_MCSPI4_BASE 0x480ba100
264
260static struct omap2_mcspi_platform_config omap2_mcspi1_config = { 265static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
261 .num_cs = 4, 266 .num_cs = 4,
262}; 267};
@@ -301,7 +306,8 @@ static struct platform_device omap2_mcspi2 = {
301 }, 306 },
302}; 307};
303 308
304#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) 309#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
310 defined(CONFIG_ARCH_OMAP4)
305static struct omap2_mcspi_platform_config omap2_mcspi3_config = { 311static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
306 .num_cs = 2, 312 .num_cs = 2,
307}; 313};
@@ -325,7 +331,7 @@ static struct platform_device omap2_mcspi3 = {
325}; 331};
326#endif 332#endif
327 333
328#ifdef CONFIG_ARCH_OMAP3 334#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
329static struct omap2_mcspi_platform_config omap2_mcspi4_config = { 335static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
330 .num_cs = 1, 336 .num_cs = 1,
331}; 337};
@@ -351,14 +357,25 @@ static struct platform_device omap2_mcspi4 = {
351 357
352static void omap_init_mcspi(void) 358static void omap_init_mcspi(void)
353{ 359{
360 if (cpu_is_omap44xx()) {
361 omap2_mcspi1_resources[0].start = OMAP4_MCSPI1_BASE;
362 omap2_mcspi1_resources[0].end = OMAP4_MCSPI1_BASE + 0xff;
363 omap2_mcspi2_resources[0].start = OMAP4_MCSPI2_BASE;
364 omap2_mcspi2_resources[0].end = OMAP4_MCSPI2_BASE + 0xff;
365 omap2_mcspi3_resources[0].start = OMAP4_MCSPI3_BASE;
366 omap2_mcspi3_resources[0].end = OMAP4_MCSPI3_BASE + 0xff;
367 omap2_mcspi4_resources[0].start = OMAP4_MCSPI4_BASE;
368 omap2_mcspi4_resources[0].end = OMAP4_MCSPI4_BASE + 0xff;
369 }
354 platform_device_register(&omap2_mcspi1); 370 platform_device_register(&omap2_mcspi1);
355 platform_device_register(&omap2_mcspi2); 371 platform_device_register(&omap2_mcspi2);
356#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) 372#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
357 if (cpu_is_omap2430() || cpu_is_omap343x()) 373 defined(CONFIG_ARCH_OMAP4)
374 if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
358 platform_device_register(&omap2_mcspi3); 375 platform_device_register(&omap2_mcspi3);
359#endif 376#endif
360#ifdef CONFIG_ARCH_OMAP3 377#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
361 if (cpu_is_omap343x()) 378 if (cpu_is_omap343x() || cpu_is_omap44xx())
362 platform_device_register(&omap2_mcspi4); 379 platform_device_register(&omap2_mcspi4);
363#endif 380#endif
364} 381}
@@ -397,7 +414,7 @@ static inline void omap_init_sha1_md5(void) { }
397 414
398/*-------------------------------------------------------------------------*/ 415/*-------------------------------------------------------------------------*/
399 416
400#ifdef CONFIG_ARCH_OMAP3 417#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
401 418
402#define MMCHS_SYSCONFIG 0x0010 419#define MMCHS_SYSCONFIG 0x0010
403#define MMCHS_SYSCONFIG_SWRESET (1 << 1) 420#define MMCHS_SYSCONFIG_SWRESET (1 << 1)
@@ -424,8 +441,8 @@ static struct platform_device dummy_pdev = {
424 **/ 441 **/
425static void __init omap_hsmmc_reset(void) 442static void __init omap_hsmmc_reset(void)
426{ 443{
427 u32 i, nr_controllers = cpu_is_omap34xx() ? OMAP34XX_NR_MMC : 444 u32 i, nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
428 OMAP24XX_NR_MMC; 445 (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
429 446
430 for (i = 0; i < nr_controllers; i++) { 447 for (i = 0; i < nr_controllers; i++) {
431 u32 v, base = 0; 448 u32 v, base = 0;
@@ -442,8 +459,21 @@ static void __init omap_hsmmc_reset(void)
442 case 2: 459 case 2:
443 base = OMAP3_MMC3_BASE; 460 base = OMAP3_MMC3_BASE;
444 break; 461 break;
462 case 3:
463 if (!cpu_is_omap44xx())
464 return;
465 base = OMAP4_MMC4_BASE;
466 break;
467 case 4:
468 if (!cpu_is_omap44xx())
469 return;
470 base = OMAP4_MMC5_BASE;
471 break;
445 } 472 }
446 473
474 if (cpu_is_omap44xx())
475 base += OMAP4_MMC_REG_OFFSET;
476
447 dummy_pdev.id = i; 477 dummy_pdev.id = i;
448 dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i); 478 dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
449 iclk = clk_get(dev, "ick"); 479 iclk = clk_get(dev, "ick");
@@ -581,11 +611,23 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
581 irq = INT_24XX_MMC2_IRQ; 611 irq = INT_24XX_MMC2_IRQ;
582 break; 612 break;
583 case 2: 613 case 2:
584 if (!cpu_is_omap34xx()) 614 if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
585 return; 615 return;
586 base = OMAP3_MMC3_BASE; 616 base = OMAP3_MMC3_BASE;
587 irq = INT_34XX_MMC3_IRQ; 617 irq = INT_34XX_MMC3_IRQ;
588 break; 618 break;
619 case 3:
620 if (!cpu_is_omap44xx())
621 return;
622 base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
623 irq = INT_44XX_MMC4_IRQ;
624 break;
625 case 4:
626 if (!cpu_is_omap44xx())
627 return;
628 base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
629 irq = INT_44XX_MMC5_IRQ;
630 break;
589 default: 631 default:
590 continue; 632 continue;
591 } 633 }
@@ -593,8 +635,15 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
593 if (cpu_is_omap2420()) { 635 if (cpu_is_omap2420()) {
594 size = OMAP2420_MMC_SIZE; 636 size = OMAP2420_MMC_SIZE;
595 name = "mmci-omap"; 637 name = "mmci-omap";
638 } else if (cpu_is_omap44xx()) {
639 if (i < 3) {
640 base += OMAP4_MMC_REG_OFFSET;
641 irq += IRQ_GIC_START;
642 }
643 size = OMAP4_HSMMC_SIZE;
644 name = "mmci-omap-hs";
596 } else { 645 } else {
597 size = HSMMC_SIZE; 646 size = OMAP3_HSMMC_SIZE;
598 name = "mmci-omap-hs"; 647 name = "mmci-omap-hs";
599 } 648 }
600 omap_mmc_add(name, i, base, size, irq, mmc_data[i]); 649 omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index f91934b2b092..15876828db23 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -57,6 +57,11 @@
57#define GPMC_CHUNK_SHIFT 24 /* 16 MB */ 57#define GPMC_CHUNK_SHIFT 24 /* 16 MB */
58#define GPMC_SECTION_SHIFT 28 /* 128 MB */ 58#define GPMC_SECTION_SHIFT 28 /* 128 MB */
59 59
60#define PREFETCH_FIFOTHRESHOLD (0x40 << 8)
61#define CS_NUM_SHIFT 24
62#define ENABLE_PREFETCH (0x1 << 7)
63#define DMA_MPU_MODE 2
64
60static struct resource gpmc_mem_root; 65static struct resource gpmc_mem_root;
61static struct resource gpmc_cs_mem[GPMC_CS_NUM]; 66static struct resource gpmc_cs_mem[GPMC_CS_NUM];
62static DEFINE_SPINLOCK(gpmc_mem_lock); 67static DEFINE_SPINLOCK(gpmc_mem_lock);
@@ -386,6 +391,63 @@ void gpmc_cs_free(int cs)
386} 391}
387EXPORT_SYMBOL(gpmc_cs_free); 392EXPORT_SYMBOL(gpmc_cs_free);
388 393
394/**
395 * gpmc_prefetch_enable - configures and starts prefetch transfer
396 * @cs: nand cs (chip select) number
397 * @dma_mode: dma mode enable (1) or disable (0)
398 * @u32_count: number of bytes to be transferred
399 * @is_write: prefetch read(0) or write post(1) mode
400 */
401int gpmc_prefetch_enable(int cs, int dma_mode,
402 unsigned int u32_count, int is_write)
403{
404 uint32_t prefetch_config1;
405
406 if (!(gpmc_read_reg(GPMC_PREFETCH_CONTROL))) {
407 /* Set the amount of bytes to be prefetched */
408 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, u32_count);
409
410 /* Set dma/mpu mode, the prefetch read / post write and
411 * enable the engine. Set which cs is has requested for.
412 */
413 prefetch_config1 = ((cs << CS_NUM_SHIFT) |
414 PREFETCH_FIFOTHRESHOLD |
415 ENABLE_PREFETCH |
416 (dma_mode << DMA_MPU_MODE) |
417 (0x1 & is_write));
418 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, prefetch_config1);
419 } else {
420 return -EBUSY;
421 }
422 /* Start the prefetch engine */
423 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x1);
424
425 return 0;
426}
427EXPORT_SYMBOL(gpmc_prefetch_enable);
428
429/**
430 * gpmc_prefetch_reset - disables and stops the prefetch engine
431 */
432void gpmc_prefetch_reset(void)
433{
434 /* Stop the PFPW engine */
435 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x0);
436
437 /* Reset/disable the PFPW engine */
438 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, 0x0);
439}
440EXPORT_SYMBOL(gpmc_prefetch_reset);
441
442/**
443 * gpmc_prefetch_status - reads prefetch status of engine
444 */
445int gpmc_prefetch_status(void)
446{
447 return gpmc_read_reg(GPMC_PREFETCH_STATUS);
448}
449EXPORT_SYMBOL(gpmc_prefetch_status);
450
389static void __init gpmc_mem_init(void) 451static void __init gpmc_mem_init(void)
390{ 452{
391 int cs; 453 int cs;
@@ -452,6 +514,5 @@ void __init gpmc_init(void)
452 l &= 0x03 << 3; 514 l &= 0x03 << 3;
453 l |= (0x02 << 3) | (1 << 0); 515 l |= (0x02 << 3) | (1 << 0);
454 gpmc_write_reg(GPMC_SYSCONFIG, l); 516 gpmc_write_reg(GPMC_SYSCONFIG, l);
455
456 gpmc_mem_init(); 517 gpmc_mem_init();
457} 518}
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index 3c04c2f1b23f..c9c59a2db4e2 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -198,6 +198,18 @@ static int twl_mmc_resume(struct device *dev, int slot)
198#define twl_mmc_resume NULL 198#define twl_mmc_resume NULL
199#endif 199#endif
200 200
201#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
202
203static int twl4030_mmc_get_context_loss(struct device *dev)
204{
205 /* FIXME: PM DPS not implemented yet */
206 return 0;
207}
208
209#else
210#define twl4030_mmc_get_context_loss NULL
211#endif
212
201static int twl_mmc1_set_power(struct device *dev, int slot, int power_on, 213static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
202 int vdd) 214 int vdd)
203{ 215{
@@ -328,6 +340,61 @@ static int twl_mmc23_set_power(struct device *dev, int slot, int power_on, int v
328 return ret; 340 return ret;
329} 341}
330 342
343static int twl_mmc1_set_sleep(struct device *dev, int slot, int sleep, int vdd,
344 int cardsleep)
345{
346 struct twl_mmc_controller *c = &hsmmc[0];
347 int mode = sleep ? REGULATOR_MODE_STANDBY : REGULATOR_MODE_NORMAL;
348
349 return regulator_set_mode(c->vcc, mode);
350}
351
352static int twl_mmc23_set_sleep(struct device *dev, int slot, int sleep, int vdd,
353 int cardsleep)
354{
355 struct twl_mmc_controller *c = NULL;
356 struct omap_mmc_platform_data *mmc = dev->platform_data;
357 int i, err, mode;
358
359 for (i = 1; i < ARRAY_SIZE(hsmmc); i++) {
360 if (mmc == hsmmc[i].mmc) {
361 c = &hsmmc[i];
362 break;
363 }
364 }
365
366 if (c == NULL)
367 return -ENODEV;
368
369 /*
370 * If we don't see a Vcc regulator, assume it's a fixed
371 * voltage always-on regulator.
372 */
373 if (!c->vcc)
374 return 0;
375
376 mode = sleep ? REGULATOR_MODE_STANDBY : REGULATOR_MODE_NORMAL;
377
378 if (!c->vcc_aux)
379 return regulator_set_mode(c->vcc, mode);
380
381 if (cardsleep) {
382 /* VCC can be turned off if card is asleep */
383 struct regulator *vcc_aux = c->vcc_aux;
384
385 c->vcc_aux = NULL;
386 if (sleep)
387 err = twl_mmc23_set_power(dev, slot, 0, 0);
388 else
389 err = twl_mmc23_set_power(dev, slot, 1, vdd);
390 c->vcc_aux = vcc_aux;
391 } else
392 err = regulator_set_mode(c->vcc, mode);
393 if (err)
394 return err;
395 return regulator_set_mode(c->vcc_aux, mode);
396}
397
331static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata; 398static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
332 399
333void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers) 400void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
@@ -390,6 +457,9 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
390 } else 457 } else
391 mmc->slots[0].switch_pin = -EINVAL; 458 mmc->slots[0].switch_pin = -EINVAL;
392 459
460 mmc->get_context_loss_count =
461 twl4030_mmc_get_context_loss;
462
393 /* write protect normally uses an OMAP gpio */ 463 /* write protect normally uses an OMAP gpio */
394 if (gpio_is_valid(c->gpio_wp)) { 464 if (gpio_is_valid(c->gpio_wp)) {
395 gpio_request(c->gpio_wp, "mmc_wp"); 465 gpio_request(c->gpio_wp, "mmc_wp");
@@ -400,6 +470,12 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
400 } else 470 } else
401 mmc->slots[0].gpio_wp = -EINVAL; 471 mmc->slots[0].gpio_wp = -EINVAL;
402 472
473 if (c->nonremovable)
474 mmc->slots[0].nonremovable = 1;
475
476 if (c->power_saving)
477 mmc->slots[0].power_saving = 1;
478
403 /* NOTE: MMC slots should have a Vcc regulator set up. 479 /* NOTE: MMC slots should have a Vcc regulator set up.
404 * This may be from a TWL4030-family chip, another 480 * This may be from a TWL4030-family chip, another
405 * controllable regulator, or a fixed supply. 481 * controllable regulator, or a fixed supply.
@@ -412,6 +488,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
412 case 1: 488 case 1:
413 /* on-chip level shifting via PBIAS0/PBIAS1 */ 489 /* on-chip level shifting via PBIAS0/PBIAS1 */
414 mmc->slots[0].set_power = twl_mmc1_set_power; 490 mmc->slots[0].set_power = twl_mmc1_set_power;
491 mmc->slots[0].set_sleep = twl_mmc1_set_sleep;
415 break; 492 break;
416 case 2: 493 case 2:
417 if (c->ext_clock) 494 if (c->ext_clock)
@@ -422,6 +499,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
422 case 3: 499 case 3:
423 /* off-chip level shifting, or none */ 500 /* off-chip level shifting, or none */
424 mmc->slots[0].set_power = twl_mmc23_set_power; 501 mmc->slots[0].set_power = twl_mmc23_set_power;
502 mmc->slots[0].set_sleep = twl_mmc23_set_sleep;
425 break; 503 break;
426 default: 504 default:
427 pr_err("MMC%d configuration not supported!\n", c->mmc); 505 pr_err("MMC%d configuration not supported!\n", c->mmc);
diff --git a/arch/arm/mach-omap2/mmc-twl4030.h b/arch/arm/mach-omap2/mmc-twl4030.h
index 3807c45c9a6c..a47e68563fb6 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.h
+++ b/arch/arm/mach-omap2/mmc-twl4030.h
@@ -12,6 +12,8 @@ struct twl4030_hsmmc_info {
12 bool transceiver; /* MMC-2 option */ 12 bool transceiver; /* MMC-2 option */
13 bool ext_clock; /* use external pin for input clock */ 13 bool ext_clock; /* use external pin for input clock */
14 bool cover_only; /* No card detect - just cover switch */ 14 bool cover_only; /* No card detect - just cover switch */
15 bool nonremovable; /* Nonremovable e.g. eMMC */
16 bool power_saving; /* Try to sleep or power off when possible */
15 int gpio_cd; /* or -EINVAL */ 17 int gpio_cd; /* or -EINVAL */
16 int gpio_wp; /* or -EINVAL */ 18 int gpio_wp; /* or -EINVAL */
17 char *name; /* or NULL for default */ 19 char *name; /* or NULL for default */
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index ea36186f32c3..f982606d7bf9 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -596,8 +596,8 @@ void __init mem_init(void)
596 596
597 printk(KERN_NOTICE "Memory: %luKB available (%dK code, " 597 printk(KERN_NOTICE "Memory: %luKB available (%dK code, "
598 "%dK data, %dK init, %luK highmem)\n", 598 "%dK data, %dK init, %luK highmem)\n",
599 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 599 nr_free_pages() << (PAGE_SHIFT-10), codesize >> 10,
600 codesize >> 10, datasize >> 10, initsize >> 10, 600 datasize >> 10, initsize >> 10,
601 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 601 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
602 602
603 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 603 if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
diff --git a/arch/arm/plat-mxc/include/mach/spi.h b/arch/arm/plat-mxc/include/mach/spi.h
new file mode 100644
index 000000000000..08be445e8eb8
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/spi.h
@@ -0,0 +1,27 @@
1
2#ifndef __MACH_SPI_H_
3#define __MACH_SPI_H_
4
5/*
6 * struct spi_imx_master - device.platform_data for SPI controller devices.
7 * @chipselect: Array of chipselects for this master. Numbers >= 0 mean gpio
8 * pins, numbers < 0 mean internal CSPI chipselects according
9 * to MXC_SPI_CS(). Normally you want to use gpio based chip
10 * selects as the CSPI module tries to be intelligent about
11 * when to assert the chipselect: The CSPI module deasserts the
12 * chipselect once it runs out of input data. The other problem
13 * is that it is not possible to mix between high active and low
14 * active chipselects on one single bus using the internal
15 * chipselects. Unfortunately Freescale decided to put some
16 * chipselects on dedicated pins which are not usable as gpios,
17 * so we have to support the internal chipselects.
18 * @num_chipselect: ARRAY_SIZE(chipselect)
19 */
20struct spi_imx_master {
21 int *chipselect;
22 int num_chipselect;
23};
24
25#define MXC_SPI_CS(no) ((no) - 32)
26
27#endif /* __MACH_SPI_H_*/
diff --git a/arch/arm/plat-omap/include/mach/gpmc.h b/arch/arm/plat-omap/include/mach/gpmc.h
index 921b16532ff5..9c99cda77ba6 100644
--- a/arch/arm/plat-omap/include/mach/gpmc.h
+++ b/arch/arm/plat-omap/include/mach/gpmc.h
@@ -103,6 +103,10 @@ extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
103extern void gpmc_cs_free(int cs); 103extern void gpmc_cs_free(int cs);
104extern int gpmc_cs_set_reserved(int cs, int reserved); 104extern int gpmc_cs_set_reserved(int cs, int reserved);
105extern int gpmc_cs_reserved(int cs); 105extern int gpmc_cs_reserved(int cs);
106extern int gpmc_prefetch_enable(int cs, int dma_mode,
107 unsigned int u32_count, int is_write);
108extern void gpmc_prefetch_reset(void);
109extern int gpmc_prefetch_status(void);
106extern void __init gpmc_init(void); 110extern void __init gpmc_init(void);
107 111
108#endif 112#endif
diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h
index fb7cb7723990..28a165058b61 100644
--- a/arch/arm/plat-omap/include/mach/irqs.h
+++ b/arch/arm/plat-omap/include/mach/irqs.h
@@ -503,6 +503,7 @@
503#define INT_44XX_FPKA_READY_IRQ (50 + IRQ_GIC_START) 503#define INT_44XX_FPKA_READY_IRQ (50 + IRQ_GIC_START)
504#define INT_44XX_SHA1MD51_IRQ (51 + IRQ_GIC_START) 504#define INT_44XX_SHA1MD51_IRQ (51 + IRQ_GIC_START)
505#define INT_44XX_RNG_IRQ (52 + IRQ_GIC_START) 505#define INT_44XX_RNG_IRQ (52 + IRQ_GIC_START)
506#define INT_44XX_MMC5_IRQ (59 + IRQ_GIC_START)
506#define INT_44XX_I2C3_IRQ (61 + IRQ_GIC_START) 507#define INT_44XX_I2C3_IRQ (61 + IRQ_GIC_START)
507#define INT_44XX_FPKA_ERROR_IRQ (64 + IRQ_GIC_START) 508#define INT_44XX_FPKA_ERROR_IRQ (64 + IRQ_GIC_START)
508#define INT_44XX_PBIAS_IRQ (75 + IRQ_GIC_START) 509#define INT_44XX_PBIAS_IRQ (75 + IRQ_GIC_START)
@@ -511,6 +512,7 @@
511#define INT_44XX_TLL_IRQ (78 + IRQ_GIC_START) 512#define INT_44XX_TLL_IRQ (78 + IRQ_GIC_START)
512#define INT_44XX_PARTHASH_IRQ (79 + IRQ_GIC_START) 513#define INT_44XX_PARTHASH_IRQ (79 + IRQ_GIC_START)
513#define INT_44XX_MMC3_IRQ (94 + IRQ_GIC_START) 514#define INT_44XX_MMC3_IRQ (94 + IRQ_GIC_START)
515#define INT_44XX_MMC4_IRQ (96 + IRQ_GIC_START)
514 516
515 517
516/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730/850) and 518/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730/850) and
diff --git a/arch/arm/plat-omap/include/mach/lcd_mipid.h b/arch/arm/plat-omap/include/mach/lcd_mipid.h
index f8fbc4801e52..8e52c6572281 100644
--- a/arch/arm/plat-omap/include/mach/lcd_mipid.h
+++ b/arch/arm/plat-omap/include/mach/lcd_mipid.h
@@ -16,7 +16,12 @@ enum mipid_test_result {
16struct mipid_platform_data { 16struct mipid_platform_data {
17 int nreset_gpio; 17 int nreset_gpio;
18 int data_lines; 18 int data_lines;
19
19 void (*shutdown)(struct mipid_platform_data *pdata); 20 void (*shutdown)(struct mipid_platform_data *pdata);
21 void (*set_bklight_level)(struct mipid_platform_data *pdata,
22 int level);
23 int (*get_bklight_level)(struct mipid_platform_data *pdata);
24 int (*get_bklight_max)(struct mipid_platform_data *pdata);
20}; 25};
21 26
22#endif 27#endif
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
index 81d5b36534b3..7229b9593301 100644
--- a/arch/arm/plat-omap/include/mach/mmc.h
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -25,11 +25,18 @@
25 25
26#define OMAP24XX_NR_MMC 2 26#define OMAP24XX_NR_MMC 2
27#define OMAP34XX_NR_MMC 3 27#define OMAP34XX_NR_MMC 3
28#define OMAP44XX_NR_MMC 5
28#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE 29#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
29#define HSMMC_SIZE 0x200 30#define OMAP3_HSMMC_SIZE 0x200
31#define OMAP4_HSMMC_SIZE 0x1000
30#define OMAP2_MMC1_BASE 0x4809c000 32#define OMAP2_MMC1_BASE 0x4809c000
31#define OMAP2_MMC2_BASE 0x480b4000 33#define OMAP2_MMC2_BASE 0x480b4000
32#define OMAP3_MMC3_BASE 0x480ad000 34#define OMAP3_MMC3_BASE 0x480ad000
35#define OMAP4_MMC4_BASE 0x480d1000
36#define OMAP4_MMC5_BASE 0x480d5000
37#define OMAP4_MMC_REG_OFFSET 0x100
38#define HSMMC5 (1 << 4)
39#define HSMMC4 (1 << 3)
33#define HSMMC3 (1 << 2) 40#define HSMMC3 (1 << 2)
34#define HSMMC2 (1 << 1) 41#define HSMMC2 (1 << 1)
35#define HSMMC1 (1 << 0) 42#define HSMMC1 (1 << 0)
@@ -59,6 +66,9 @@ struct omap_mmc_platform_data {
59 int (*suspend)(struct device *dev, int slot); 66 int (*suspend)(struct device *dev, int slot);
60 int (*resume)(struct device *dev, int slot); 67 int (*resume)(struct device *dev, int slot);
61 68
69 /* Return context loss count due to PM states changing */
70 int (*get_context_loss_count)(struct device *dev);
71
62 u64 dma_mask; 72 u64 dma_mask;
63 73
64 struct omap_mmc_slot_data { 74 struct omap_mmc_slot_data {
@@ -80,12 +90,20 @@ struct omap_mmc_platform_data {
80 /* use the internal clock */ 90 /* use the internal clock */
81 unsigned internal_clock:1; 91 unsigned internal_clock:1;
82 92
93 /* nonremovable e.g. eMMC */
94 unsigned nonremovable:1;
95
96 /* Try to sleep or power off when possible */
97 unsigned power_saving:1;
98
83 int switch_pin; /* gpio (card detect) */ 99 int switch_pin; /* gpio (card detect) */
84 int gpio_wp; /* gpio (write protect) */ 100 int gpio_wp; /* gpio (write protect) */
85 101
86 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode); 102 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
87 int (* set_power)(struct device *dev, int slot, int power_on, int vdd); 103 int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
88 int (* get_ro)(struct device *dev, int slot); 104 int (* get_ro)(struct device *dev, int slot);
105 int (*set_sleep)(struct device *dev, int slot, int sleep,
106 int vdd, int cardsleep);
89 107
90 /* return MMC cover switch state, can be NULL if not supported. 108 /* return MMC cover switch state, can be NULL if not supported.
91 * 109 *
diff --git a/arch/arm/plat-omap/include/mach/omapfb.h b/arch/arm/plat-omap/include/mach/omapfb.h
index 7b74d1255e0b..b226bdf45739 100644
--- a/arch/arm/plat-omap/include/mach/omapfb.h
+++ b/arch/arm/plat-omap/include/mach/omapfb.h
@@ -276,8 +276,8 @@ typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
276 void *fbi); 276 void *fbi);
277 277
278struct omapfb_mem_region { 278struct omapfb_mem_region {
279 dma_addr_t paddr; 279 u32 paddr;
280 void *vaddr; 280 void __iomem *vaddr;
281 unsigned long size; 281 unsigned long size;
282 u8 type; /* OMAPFB_PLANE_MEM_* */ 282 u8 type; /* OMAPFB_PLANE_MEM_* */
283 unsigned alloc:1; /* allocated by the driver */ 283 unsigned alloc:1; /* allocated by the driver */
diff --git a/arch/avr32/include/asm/mman.h b/arch/avr32/include/asm/mman.h
index 9a92b15f6a66..8eebf89f5ab1 100644
--- a/arch/avr32/include/asm/mman.h
+++ b/arch/avr32/include/asm/mman.h
@@ -1,17 +1 @@
1#ifndef __ASM_AVR32_MMAN_H__ #include <asm-generic/mman.h>
2#define __ASM_AVR32_MMAN_H__
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ASM_AVR32_MMAN_H__ */
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index e819fa69a90e..376f18c4a6cb 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -141,7 +141,7 @@ void __init mem_init(void)
141 141
142 printk ("Memory: %luk/%luk available (%dk kernel code, " 142 printk ("Memory: %luk/%luk available (%dk kernel code, "
143 "%dk reserved, %dk data, %dk init)\n", 143 "%dk reserved, %dk data, %dk init)\n",
144 (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10), 144 nr_free_pages() << (PAGE_SHIFT - 10),
145 totalram_pages << (PAGE_SHIFT - 10), 145 totalram_pages << (PAGE_SHIFT - 10),
146 codesize >> 10, 146 codesize >> 10,
147 reservedpages << (PAGE_SHIFT - 10), 147 reservedpages << (PAGE_SHIFT - 10),
diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h
index e7fd0ecd73f7..ae4dae1e370b 100644
--- a/arch/blackfin/include/asm/sections.h
+++ b/arch/blackfin/include/asm/sections.h
@@ -1,9 +1,6 @@
1#ifndef _BLACKFIN_SECTIONS_H 1#ifndef _BLACKFIN_SECTIONS_H
2#define _BLACKFIN_SECTIONS_H 2#define _BLACKFIN_SECTIONS_H
3 3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7/* only used when MTD_UCLINUX */ 4/* only used when MTD_UCLINUX */
8extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size; 5extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
9 6
@@ -15,4 +12,39 @@ extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[],
15 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[], 12 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[],
16 _ebss_l2[], _l2_lma_start[]; 13 _ebss_l2[], _l2_lma_start[];
17 14
15#include <asm/mem_map.h>
16
17/* Blackfin systems have discontinuous memory map and no virtualized memory */
18static inline int arch_is_kernel_text(unsigned long addr)
19{
20 return
21 (L1_CODE_LENGTH &&
22 addr >= (unsigned long)_stext_l1 &&
23 addr < (unsigned long)_etext_l1)
24 ||
25 (L2_LENGTH &&
26 addr >= (unsigned long)_stext_l2 &&
27 addr < (unsigned long)_etext_l2);
28}
29#define arch_is_kernel_text(addr) arch_is_kernel_text(addr)
30
31static inline int arch_is_kernel_data(unsigned long addr)
32{
33 return
34 (L1_DATA_A_LENGTH &&
35 addr >= (unsigned long)_sdata_l1 &&
36 addr < (unsigned long)_ebss_l1)
37 ||
38 (L1_DATA_B_LENGTH &&
39 addr >= (unsigned long)_sdata_b_l1 &&
40 addr < (unsigned long)_ebss_b_l1)
41 ||
42 (L2_LENGTH &&
43 addr >= (unsigned long)_sdata_l2 &&
44 addr < (unsigned long)_ebss_l2);
45}
46#define arch_is_kernel_data(addr) arch_is_kernel_data(addr)
47
48#include <asm-generic/sections.h>
49
18#endif 50#endif
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index c8e7ee4768cd..02b1529dad57 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -381,7 +381,7 @@
381#define __NR_preadv 366 381#define __NR_preadv 366
382#define __NR_pwritev 367 382#define __NR_pwritev 367
383#define __NR_rt_tgsigqueueinfo 368 383#define __NR_rt_tgsigqueueinfo 368
384#define __NR_perf_counter_open 369 384#define __NR_perf_event_open 369
385 385
386#define __NR_syscall 370 386#define __NR_syscall 370
387#define NR_syscalls __NR_syscall 387#define NR_syscalls __NR_syscall
diff --git a/arch/blackfin/mach-bf538/include/mach/defBF539.h b/arch/blackfin/mach-bf538/include/mach/defBF539.h
index bdc330cd0e1c..1c58914a8740 100644
--- a/arch/blackfin/mach-bf538/include/mach/defBF539.h
+++ b/arch/blackfin/mach-bf538/include/mach/defBF539.h
@@ -2325,7 +2325,7 @@
2325#define AMBEN_B0_B1 0x0004 /* Enable Asynchronous Memory Banks 0 & 1 only */ 2325#define AMBEN_B0_B1 0x0004 /* Enable Asynchronous Memory Banks 0 & 1 only */
2326#define AMBEN_B0_B1_B2 0x0006 /* Enable Asynchronous Memory Banks 0, 1, and 2 */ 2326#define AMBEN_B0_B1_B2 0x0006 /* Enable Asynchronous Memory Banks 0, 1, and 2 */
2327#define AMBEN_ALL 0x0008 /* Enable Asynchronous Memory Banks (all) 0, 1, 2, and 3 */ 2327#define AMBEN_ALL 0x0008 /* Enable Asynchronous Memory Banks (all) 0, 1, 2, and 3 */
2328#define CDPRIO 0x0100 /* DMA has priority over core for for external accesses */ 2328#define CDPRIO 0x0100 /* DMA has priority over core for external accesses */
2329 2329
2330/* EBIU_AMGCTL Bit Positions */ 2330/* EBIU_AMGCTL Bit Positions */
2331#define AMCKEN_P 0x0000 /* Enable CLKOUT */ 2331#define AMCKEN_P 0x0000 /* Enable CLKOUT */
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 01af24cde362..1e7cac23e25f 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -1620,7 +1620,7 @@ ENTRY(_sys_call_table)
1620 .long _sys_preadv 1620 .long _sys_preadv
1621 .long _sys_pwritev 1621 .long _sys_pwritev
1622 .long _sys_rt_tgsigqueueinfo 1622 .long _sys_rt_tgsigqueueinfo
1623 .long _sys_perf_counter_open 1623 .long _sys_perf_event_open
1624 1624
1625 .rept NR_syscalls-(.-_sys_call_table)/4 1625 .rept NR_syscalls-(.-_sys_call_table)/4
1626 .long _sys_ni_syscall 1626 .long _sys_ni_syscall
diff --git a/arch/cris/include/asm/mman.h b/arch/cris/include/asm/mman.h
index b7f0afba3ce0..8eebf89f5ab1 100644
--- a/arch/cris/include/asm/mman.h
+++ b/arch/cris/include/asm/mman.h
@@ -1,19 +1 @@
1#ifndef __CRIS_MMAN_H__ #include <asm-generic/mman.h>
2#define __CRIS_MMAN_H__
3
4/* verbatim copy of asm-i386/ version */
5
6#include <asm-generic/mman-common.h>
7
8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
10#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
11#define MAP_LOCKED 0x2000 /* pages are locked */
12#define MAP_NORESERVE 0x4000 /* don't check for reservations */
13#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
14#define MAP_NONBLOCK 0x10000 /* do not block on IO */
15
16#define MCL_CURRENT 1 /* lock all current mappings */
17#define MCL_FUTURE 2 /* lock all future mappings */
18
19#endif /* __CRIS_MMAN_H__ */
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 514f46a4b230..ff68b9f516a1 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -54,7 +54,7 @@ mem_init(void)
54 printk(KERN_INFO 54 printk(KERN_INFO
55 "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, " 55 "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
56 "%dk init)\n" , 56 "%dk init)\n" ,
57 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 57 nr_free_pages() << (PAGE_SHIFT-10),
58 max_mapnr << (PAGE_SHIFT-10), 58 max_mapnr << (PAGE_SHIFT-10),
59 codesize >> 10, 59 codesize >> 10,
60 reservedpages << (PAGE_SHIFT-10), 60 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index b86e19c9b5b0..4b5830bcbe2e 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -7,7 +7,7 @@ config FRV
7 default y 7 default y
8 select HAVE_IDE 8 select HAVE_IDE
9 select HAVE_ARCH_TRACEHOOK 9 select HAVE_ARCH_TRACEHOOK
10 select HAVE_PERF_COUNTERS 10 select HAVE_PERF_EVENTS
11 11
12config ZONE_DMA 12config ZONE_DMA
13 bool 13 bool
diff --git a/arch/frv/include/asm/gdb-stub.h b/arch/frv/include/asm/gdb-stub.h
index 24f9738670bd..2da716407ff2 100644
--- a/arch/frv/include/asm/gdb-stub.h
+++ b/arch/frv/include/asm/gdb-stub.h
@@ -90,7 +90,6 @@ extern void gdbstub_do_rx(void);
90extern asmlinkage void __debug_stub_init_break(void); 90extern asmlinkage void __debug_stub_init_break(void);
91extern asmlinkage void __break_hijack_kernel_event(void); 91extern asmlinkage void __break_hijack_kernel_event(void);
92extern asmlinkage void __break_hijack_kernel_event_breaks_here(void); 92extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
93extern asmlinkage void start_kernel(void);
94 93
95extern asmlinkage void gdbstub_rx_handler(void); 94extern asmlinkage void gdbstub_rx_handler(void);
96extern asmlinkage void gdbstub_rx_irq(void); 95extern asmlinkage void gdbstub_rx_irq(void);
diff --git a/arch/frv/include/asm/hardirq.h b/arch/frv/include/asm/hardirq.h
index fc47515822a2..5fc8b6f5bc55 100644
--- a/arch/frv/include/asm/hardirq.h
+++ b/arch/frv/include/asm/hardirq.h
@@ -12,24 +12,15 @@
12#ifndef __ASM_HARDIRQ_H 12#ifndef __ASM_HARDIRQ_H
13#define __ASM_HARDIRQ_H 13#define __ASM_HARDIRQ_H
14 14
15#include <linux/threads.h> 15#include <asm/atomic.h>
16#include <linux/irq.h>
17
18typedef struct {
19 unsigned int __softirq_pending;
20 unsigned long idle_timestamp;
21} ____cacheline_aligned irq_cpustat_t;
22
23#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
24
25#ifdef CONFIG_SMP
26#error SMP not available on FR-V
27#endif /* CONFIG_SMP */
28 16
29extern atomic_t irq_err_count; 17extern atomic_t irq_err_count;
30static inline void ack_bad_irq(int irq) 18static inline void ack_bad_irq(int irq)
31{ 19{
32 atomic_inc(&irq_err_count); 20 atomic_inc(&irq_err_count);
33} 21}
22#define ack_bad_irq ack_bad_irq
23
24#include <asm-generic/hardirq.h>
34 25
35#endif 26#endif
diff --git a/arch/frv/include/asm/mman.h b/arch/frv/include/asm/mman.h
index 58c1d11e2ac7..8eebf89f5ab1 100644
--- a/arch/frv/include/asm/mman.h
+++ b/arch/frv/include/asm/mman.h
@@ -1,18 +1 @@
1#ifndef __ASM_MMAN_H__ #include <asm-generic/mman.h>
2#define __ASM_MMAN_H__
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ASM_MMAN_H__ */
18
diff --git a/arch/frv/include/asm/perf_counter.h b/arch/frv/include/asm/perf_event.h
index ccf726e61b2e..a69e0155d146 100644
--- a/arch/frv/include/asm/perf_counter.h
+++ b/arch/frv/include/asm/perf_event.h
@@ -1,4 +1,4 @@
1/* FRV performance counter support 1/* FRV performance event support
2 * 2 *
3 * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,9 +9,9 @@
9 * 2 of the Licence, or (at your option) any later version. 9 * 2 of the Licence, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _ASM_PERF_COUNTER_H 12#ifndef _ASM_PERF_EVENT_H
13#define _ASM_PERF_COUNTER_H 13#define _ASM_PERF_EVENT_H
14 14
15#define PERF_COUNTER_INDEX_OFFSET 0 15#define PERF_EVENT_INDEX_OFFSET 0
16 16
17#endif /* _ASM_PERF_COUNTER_H */ 17#endif /* _ASM_PERF_EVENT_H */
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 4a8fb427ce0a..be6ef0f5cd42 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -342,7 +342,7 @@
342#define __NR_preadv 333 342#define __NR_preadv 333
343#define __NR_pwritev 334 343#define __NR_pwritev 334
344#define __NR_rt_tgsigqueueinfo 335 344#define __NR_rt_tgsigqueueinfo 335
345#define __NR_perf_counter_open 336 345#define __NR_perf_event_open 336
346 346
347#ifdef __KERNEL__ 347#ifdef __KERNEL__
348 348
diff --git a/arch/frv/kernel/debug-stub.c b/arch/frv/kernel/debug-stub.c
index 2f6c60c921e0..2845139c8077 100644
--- a/arch/frv/kernel/debug-stub.c
+++ b/arch/frv/kernel/debug-stub.c
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/serial_reg.h> 17#include <linux/serial_reg.h>
18#include <linux/start_kernel.h>
18 19
19#include <asm/system.h> 20#include <asm/system.h>
20#include <asm/serial-regs.h> 21#include <asm/serial-regs.h>
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index fde1e446b440..189397ec012a 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1525,6 +1525,6 @@ sys_call_table:
1525 .long sys_preadv 1525 .long sys_preadv
1526 .long sys_pwritev 1526 .long sys_pwritev
1527 .long sys_rt_tgsigqueueinfo /* 335 */ 1527 .long sys_rt_tgsigqueueinfo /* 335 */
1528 .long sys_perf_counter_open 1528 .long sys_perf_event_open
1529 1529
1530syscall_table_size = (. - sys_call_table) 1530syscall_table_size = (. - sys_call_table)
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 0de50df74970..904255938216 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -83,13 +83,9 @@ void (*idle)(void) = core_sleep_idle;
83 */ 83 */
84void cpu_idle(void) 84void cpu_idle(void)
85{ 85{
86 int cpu = smp_processor_id();
87
88 /* endless idle loop with no priority at all */ 86 /* endless idle loop with no priority at all */
89 while (1) { 87 while (1) {
90 while (!need_resched()) { 88 while (!need_resched()) {
91 irq_stat[cpu].idle_timestamp = jiffies;
92
93 check_pgt_cache(); 89 check_pgt_cache();
94 90
95 if (!frv_dma_inprogress && idle) 91 if (!frv_dma_inprogress && idle)
diff --git a/arch/frv/lib/Makefile b/arch/frv/lib/Makefile
index 0a377210c89b..f4709756d0d9 100644
--- a/arch/frv/lib/Makefile
+++ b/arch/frv/lib/Makefile
@@ -5,4 +5,4 @@
5lib-y := \ 5lib-y := \
6 __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \ 6 __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \
7 checksum.o memcpy.o memset.o atomic-ops.o atomic64-ops.o \ 7 checksum.o memcpy.o memset.o atomic-ops.o atomic64-ops.o \
8 outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o perf_counter.o 8 outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o perf_event.o
diff --git a/arch/frv/lib/cache.S b/arch/frv/lib/cache.S
index 0e10ad8dc462..0c4fb204911b 100644
--- a/arch/frv/lib/cache.S
+++ b/arch/frv/lib/cache.S
@@ -1,4 +1,4 @@
1/* cache.S: cache managment routines 1/* cache.S: cache management routines
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
diff --git a/arch/frv/lib/perf_counter.c b/arch/frv/lib/perf_event.c
index 2000feecd571..9ac5acfd2e91 100644
--- a/arch/frv/lib/perf_counter.c
+++ b/arch/frv/lib/perf_event.c
@@ -1,4 +1,4 @@
1/* Performance counter handling 1/* Performance event handling
2 * 2 *
3 * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,11 +9,11 @@
9 * 2 of the Licence, or (at your option) any later version. 9 * 2 of the Licence, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13 13
14/* 14/*
15 * mark the performance counter as pending 15 * mark the performance event as pending
16 */ 16 */
17void set_perf_counter_pending(void) 17void set_perf_event_pending(void)
18{ 18{
19} 19}
diff --git a/arch/h8300/include/asm/hardirq.h b/arch/h8300/include/asm/hardirq.h
index 9d7f7a7462b2..c2e1aa0f0d14 100644
--- a/arch/h8300/include/asm/hardirq.h
+++ b/arch/h8300/include/asm/hardirq.h
@@ -1,18 +1,7 @@
1#ifndef __H8300_HARDIRQ_H 1#ifndef __H8300_HARDIRQ_H
2#define __H8300_HARDIRQ_H 2#define __H8300_HARDIRQ_H
3 3
4#include <linux/kernel.h> 4#include <asm/irq.h>
5#include <linux/threads.h>
6#include <linux/interrupt.h>
7#include <linux/irq.h>
8
9typedef struct {
10 unsigned int __softirq_pending;
11} ____cacheline_aligned irq_cpustat_t;
12
13#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
14
15extern void ack_bad_irq(unsigned int irq);
16 5
17#define HARDIRQ_BITS 8 6#define HARDIRQ_BITS 8
18 7
@@ -25,4 +14,6 @@ extern void ack_bad_irq(unsigned int irq);
25# error HARDIRQ_BITS is too low! 14# error HARDIRQ_BITS is too low!
26#endif 15#endif
27 16
17#include <asm-generic/hardirq.h>
18
28#endif 19#endif
diff --git a/arch/h8300/include/asm/mman.h b/arch/h8300/include/asm/mman.h
index cf35f0a6f12e..8eebf89f5ab1 100644
--- a/arch/h8300/include/asm/mman.h
+++ b/arch/h8300/include/asm/mman.h
@@ -1,17 +1 @@
1#ifndef __H8300_MMAN_H__ #include <asm-generic/mman.h>
2#define __H8300_MMAN_H__
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __H8300_MMAN_H__ */
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index 74f8dd7b34d2..5c913d472119 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -81,11 +81,6 @@ struct irq_chip h8300irq_chip = {
81 .end = h8300_end_irq, 81 .end = h8300_end_irq,
82}; 82};
83 83
84void ack_bad_irq(unsigned int irq)
85{
86 printk("unexpected IRQ trap at vector %02x\n", irq);
87}
88
89#if defined(CONFIG_RAMKERNEL) 84#if defined(CONFIG_RAMKERNEL)
90static unsigned long __init *get_vector_address(void) 85static unsigned long __init *get_vector_address(void)
91{ 86{
diff --git a/arch/h8300/kernel/timer/tpu.c b/arch/h8300/kernel/timer/tpu.c
index e7c6e614a758..2193a2e2859a 100644
--- a/arch/h8300/kernel/timer/tpu.c
+++ b/arch/h8300/kernel/timer/tpu.c
@@ -7,7 +7,6 @@
7 * 7 *
8 */ 8 */
9 9
10#include <linux/config.h>
11#include <linux/errno.h> 10#include <linux/errno.h>
12#include <linux/sched.h> 11#include <linux/sched.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 011a1cdf0eb5..6851e52ed5a2 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -500,6 +500,10 @@ config HAVE_ARCH_NODEDATA_EXTENSION
500 def_bool y 500 def_bool y
501 depends on NUMA 501 depends on NUMA
502 502
503config ARCH_PROC_KCORE_TEXT
504 def_bool y
505 depends on PROC_KCORE
506
503config IA32_SUPPORT 507config IA32_SUPPORT
504 bool "Support for Linux/x86 binaries" 508 bool "Support for Linux/x86 binaries"
505 help 509 help
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 8cfb001092ab..674a8374c6d9 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -2026,24 +2026,21 @@ acpi_sba_ioc_add(struct acpi_device *device)
2026 struct ioc *ioc; 2026 struct ioc *ioc;
2027 acpi_status status; 2027 acpi_status status;
2028 u64 hpa, length; 2028 u64 hpa, length;
2029 struct acpi_buffer buffer;
2030 struct acpi_device_info *dev_info; 2029 struct acpi_device_info *dev_info;
2031 2030
2032 status = hp_acpi_csr_space(device->handle, &hpa, &length); 2031 status = hp_acpi_csr_space(device->handle, &hpa, &length);
2033 if (ACPI_FAILURE(status)) 2032 if (ACPI_FAILURE(status))
2034 return 1; 2033 return 1;
2035 2034
2036 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 2035 status = acpi_get_object_info(device->handle, &dev_info);
2037 status = acpi_get_object_info(device->handle, &buffer);
2038 if (ACPI_FAILURE(status)) 2036 if (ACPI_FAILURE(status))
2039 return 1; 2037 return 1;
2040 dev_info = buffer.pointer;
2041 2038
2042 /* 2039 /*
2043 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI 2040 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI
2044 * root bridges, and its CSR space includes the IOC function. 2041 * root bridges, and its CSR space includes the IOC function.
2045 */ 2042 */
2046 if (strncmp("HWP0001", dev_info->hardware_id.value, 7) == 0) { 2043 if (strncmp("HWP0001", dev_info->hardware_id.string, 7) == 0) {
2047 hpa += ZX1_IOC_OFFSET; 2044 hpa += ZX1_IOC_OFFSET;
2048 /* zx1 based systems default to kernel page size iommu pages */ 2045 /* zx1 based systems default to kernel page size iommu pages */
2049 if (!iovp_shift) 2046 if (!iovp_shift)
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 16ef61a91d95..625ed8f76fce 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1270,7 +1270,7 @@ putreg (struct task_struct *child, int regno, unsigned int value)
1270 case PT_CS: 1270 case PT_CS:
1271 if (value != __USER_CS) 1271 if (value != __USER_CS)
1272 printk(KERN_ERR 1272 printk(KERN_ERR
1273 "ia32.putreg: attempt to to set invalid segment register %d = %x\n", 1273 "ia32.putreg: attempt to set invalid segment register %d = %x\n",
1274 regno, value); 1274 regno, value);
1275 break; 1275 break;
1276 default: 1276 default:
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h
index d20b998cb91d..7fa8a8594660 100644
--- a/arch/ia64/include/asm/cputime.h
+++ b/arch/ia64/include/asm/cputime.h
@@ -30,6 +30,7 @@ typedef u64 cputime_t;
30typedef u64 cputime64_t; 30typedef u64 cputime64_t;
31 31
32#define cputime_zero ((cputime_t)0) 32#define cputime_zero ((cputime_t)0)
33#define cputime_one_jiffy jiffies_to_cputime(1)
33#define cputime_max ((~((cputime_t)0) >> 1) - 1) 34#define cputime_max ((~((cputime_t)0) >> 1) - 1)
34#define cputime_add(__a, __b) ((__a) + (__b)) 35#define cputime_add(__a, __b) ((__a) + (__b))
35#define cputime_sub(__a, __b) ((__a) - (__b)) 36#define cputime_sub(__a, __b) ((__a) - (__b))
diff --git a/arch/ia64/include/asm/mman.h b/arch/ia64/include/asm/mman.h
index 48cf8b98a0b4..4459028e5aa8 100644
--- a/arch/ia64/include/asm/mman.h
+++ b/arch/ia64/include/asm/mman.h
@@ -8,19 +8,9 @@
8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 */ 9 */
10 10
11#include <asm-generic/mman-common.h> 11#include <asm-generic/mman.h>
12 12
13#define MAP_GROWSDOWN 0x00100 /* stack-like segment */ 13#define MAP_GROWSUP 0x0200 /* register stack-like segment */
14#define MAP_GROWSUP 0x00200 /* register stack-like segment */
15#define MAP_DENYWRITE 0x00800 /* ETXTBSY */
16#define MAP_EXECUTABLE 0x01000 /* mark it as an executable */
17#define MAP_LOCKED 0x02000 /* pages are locked */
18#define MAP_NORESERVE 0x04000 /* don't check for reservations */
19#define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */
20#define MAP_NONBLOCK 0x10000 /* do not block on IO */
21
22#define MCL_CURRENT 1 /* lock all current mappings */
23#define MCL_FUTURE 2 /* lock all future mappings */
24 14
25#ifdef __KERNEL__ 15#ifdef __KERNEL__
26#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c
index 223abb134105..285aae8431c6 100644
--- a/arch/ia64/kernel/pci-swiotlb.c
+++ b/arch/ia64/kernel/pci-swiotlb.c
@@ -46,7 +46,7 @@ void __init swiotlb_dma_init(void)
46 46
47void __init pci_swiotlb_init(void) 47void __init pci_swiotlb_init(void)
48{ 48{
49 if (!iommu_detected || iommu_pass_through) { 49 if (!iommu_detected) {
50#ifdef CONFIG_IA64_GENERIC 50#ifdef CONFIG_IA64_GENERIC
51 swiotlb = 1; 51 swiotlb = 1;
52 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n"); 52 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b115b3bbf04a..1857766a63c1 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -617,7 +617,6 @@ mem_init (void)
617 long reserved_pages, codesize, datasize, initsize; 617 long reserved_pages, codesize, datasize, initsize;
618 pg_data_t *pgdat; 618 pg_data_t *pgdat;
619 int i; 619 int i;
620 static struct kcore_list kcore_mem, kcore_vmem, kcore_kernel;
621 620
622 BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE); 621 BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE);
623 BUG_ON(PTRS_PER_PMD * sizeof(pmd_t) != PAGE_SIZE); 622 BUG_ON(PTRS_PER_PMD * sizeof(pmd_t) != PAGE_SIZE);
@@ -639,10 +638,6 @@ mem_init (void)
639 638
640 high_memory = __va(max_low_pfn * PAGE_SIZE); 639 high_memory = __va(max_low_pfn * PAGE_SIZE);
641 640
642 kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE);
643 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
644 kclist_add(&kcore_kernel, _stext, _end - _stext);
645
646 for_each_online_pgdat(pgdat) 641 for_each_online_pgdat(pgdat)
647 if (pgdat->bdata->node_bootmem_map) 642 if (pgdat->bdata->node_bootmem_map)
648 totalram_pages += free_all_bootmem_node(pgdat); 643 totalram_pages += free_all_bootmem_node(pgdat);
@@ -655,7 +650,7 @@ mem_init (void)
655 initsize = (unsigned long) __init_end - (unsigned long) __init_begin; 650 initsize = (unsigned long) __init_end - (unsigned long) __init_begin;
656 651
657 printk(KERN_INFO "Memory: %luk/%luk available (%luk code, %luk reserved, " 652 printk(KERN_INFO "Memory: %luk/%luk available (%luk code, %luk reserved, "
658 "%luk data, %luk init)\n", (unsigned long) nr_free_pages() << (PAGE_SHIFT - 10), 653 "%luk data, %luk init)\n", nr_free_pages() << (PAGE_SHIFT - 10),
659 num_physpages << (PAGE_SHIFT - 10), codesize >> 10, 654 num_physpages << (PAGE_SHIFT - 10), codesize >> 10,
660 reserved_pages << (PAGE_SHIFT - 10), datasize >> 10, initsize >> 10); 655 reserved_pages << (PAGE_SHIFT - 10), datasize >> 10, initsize >> 10);
661 656
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index cabba332cc48..c41234f1b825 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -41,6 +41,12 @@ config HZ
41 int 41 int
42 default 100 42 default 100
43 43
44config GENERIC_TIME
45 def_bool y
46
47config ARCH_USES_GETTIMEOFFSET
48 def_bool y
49
44source "init/Kconfig" 50source "init/Kconfig"
45 51
46source "kernel/Kconfig.freezer" 52source "kernel/Kconfig.freezer"
diff --git a/arch/m32r/include/asm/hardirq.h b/arch/m32r/include/asm/hardirq.h
index cb8aa762f235..4c31c0ae215e 100644
--- a/arch/m32r/include/asm/hardirq.h
+++ b/arch/m32r/include/asm/hardirq.h
@@ -2,14 +2,7 @@
2#ifndef __ASM_HARDIRQ_H 2#ifndef __ASM_HARDIRQ_H
3#define __ASM_HARDIRQ_H 3#define __ASM_HARDIRQ_H
4 4
5#include <linux/threads.h> 5#include <asm/irq.h>
6#include <linux/irq.h>
7
8typedef struct {
9 unsigned int __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t;
11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
13 6
14#if NR_IRQS > 256 7#if NR_IRQS > 256
15#define HARDIRQ_BITS 9 8#define HARDIRQ_BITS 9
@@ -26,11 +19,7 @@ typedef struct {
26# error HARDIRQ_BITS is too low! 19# error HARDIRQ_BITS is too low!
27#endif 20#endif
28 21
29static inline void ack_bad_irq(int irq) 22#include <asm-generic/hardirq.h>
30{
31 printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
32 BUG();
33}
34 23
35#endif /* __ASM_HARDIRQ_H */ 24#endif /* __ASM_HARDIRQ_H */
36#endif /* __KERNEL__ */ 25#endif /* __KERNEL__ */
diff --git a/arch/m32r/include/asm/mman.h b/arch/m32r/include/asm/mman.h
index 04a5f40aa401..8eebf89f5ab1 100644
--- a/arch/m32r/include/asm/mman.h
+++ b/arch/m32r/include/asm/mman.h
@@ -1,17 +1 @@
1#ifndef __M32R_MMAN_H__ #include <asm-generic/mman.h>
2#define __M32R_MMAN_H__
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __M32R_MMAN_H__ */
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c
index 98b8feb12ed8..98682bba0ed9 100644
--- a/arch/m32r/kernel/ptrace.c
+++ b/arch/m32r/kernel/ptrace.c
@@ -77,7 +77,7 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
77 struct user * dummy = NULL; 77 struct user * dummy = NULL;
78#endif 78#endif
79 79
80 if ((off & 3) || (off < 0) || (off > sizeof(struct user) - 3)) 80 if ((off & 3) || off > sizeof(struct user) - 3)
81 return -EIO; 81 return -EIO;
82 82
83 off >>= 2; 83 off >>= 2;
@@ -139,8 +139,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
139 struct user * dummy = NULL; 139 struct user * dummy = NULL;
140#endif 140#endif
141 141
142 if ((off & 3) || off < 0 || 142 if ((off & 3) || off > sizeof(struct user) - 3)
143 off > sizeof(struct user) - 3)
144 return -EIO; 143 return -EIO;
145 144
146 off >>= 2; 145 off >>= 2;
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 2547d6c4a827..655ea1c47a0f 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -213,7 +213,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
213 if (!physid_isset(phys_id, phys_cpu_present_map)) 213 if (!physid_isset(phys_id, phys_cpu_present_map))
214 continue; 214 continue;
215 215
216 if ((max_cpus >= 0) && (max_cpus <= cpucount + 1)) 216 if (max_cpus <= cpucount + 1)
217 continue; 217 continue;
218 218
219 do_boot_cpu(phys_id); 219 do_boot_cpu(phys_id);
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index cada3ba4b990..ba61c4c73202 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -48,7 +48,7 @@ extern void smp_local_timer_interrupt(void);
48 48
49static unsigned long latch; 49static unsigned long latch;
50 50
51static unsigned long do_gettimeoffset(void) 51u32 arch_gettimeoffset(void)
52{ 52{
53 unsigned long elapsed_time = 0; /* [us] */ 53 unsigned long elapsed_time = 0; /* [us] */
54 54
@@ -93,79 +93,10 @@ static unsigned long do_gettimeoffset(void)
93#error no chip configuration 93#error no chip configuration
94#endif 94#endif
95 95
96 return elapsed_time; 96 return elapsed_time * 1000;
97} 97}
98 98
99/* 99/*
100 * This version of gettimeofday has near microsecond resolution.
101 */
102void do_gettimeofday(struct timeval *tv)
103{
104 unsigned long seq;
105 unsigned long usec, sec;
106 unsigned long max_ntp_tick = tick_usec - tickadj;
107
108 do {
109 seq = read_seqbegin(&xtime_lock);
110
111 usec = do_gettimeoffset();
112
113 /*
114 * If time_adjust is negative then NTP is slowing the clock
115 * so make sure not to go into next possible interval.
116 * Better to lose some accuracy than have time go backwards..
117 */
118 if (unlikely(time_adjust < 0))
119 usec = min(usec, max_ntp_tick);
120
121 sec = xtime.tv_sec;
122 usec += (xtime.tv_nsec / 1000);
123 } while (read_seqretry(&xtime_lock, seq));
124
125 while (usec >= 1000000) {
126 usec -= 1000000;
127 sec++;
128 }
129
130 tv->tv_sec = sec;
131 tv->tv_usec = usec;
132}
133
134EXPORT_SYMBOL(do_gettimeofday);
135
136int do_settimeofday(struct timespec *tv)
137{
138 time_t wtm_sec, sec = tv->tv_sec;
139 long wtm_nsec, nsec = tv->tv_nsec;
140
141 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
142 return -EINVAL;
143
144 write_seqlock_irq(&xtime_lock);
145 /*
146 * This is revolting. We need to set "xtime" correctly. However, the
147 * value in this location is the value at the most recent update of
148 * wall time. Discover what correction gettimeofday() would have
149 * made, and then undo it!
150 */
151 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
152
153 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
154 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
155
156 set_normalized_timespec(&xtime, sec, nsec);
157 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
158
159 ntp_clear();
160 write_sequnlock_irq(&xtime_lock);
161 clock_was_set();
162
163 return 0;
164}
165
166EXPORT_SYMBOL(do_settimeofday);
167
168/*
169 * In order to set the CMOS clock precisely, set_rtc_mmss has to be 100 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
170 * called 500 ms after the second nowtime has started, because when 101 * called 500 ms after the second nowtime has started, because when
171 * nowtime is written into the registers of the CMOS clock, it will 102 * nowtime is written into the registers of the CMOS clock, it will
@@ -192,6 +123,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
192#ifndef CONFIG_SMP 123#ifndef CONFIG_SMP
193 profile_tick(CPU_PROFILING); 124 profile_tick(CPU_PROFILING);
194#endif 125#endif
126 /* XXX FIXME. Uh, the xtime_lock should be held here, no? */
195 do_timer(1); 127 do_timer(1);
196 128
197#ifndef CONFIG_SMP 129#ifndef CONFIG_SMP
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index 24d429f9358a..9f581df3952b 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -171,7 +171,7 @@ void __init mem_init(void)
171 171
172 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " 172 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
173 "%dk reserved, %dk data, %dk init)\n", 173 "%dk reserved, %dk data, %dk init)\n",
174 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 174 nr_free_pages() << (PAGE_SHIFT-10),
175 num_physpages << (PAGE_SHIFT-10), 175 num_physpages << (PAGE_SHIFT-10),
176 codesize >> 10, 176 codesize >> 10,
177 reservedpages << (PAGE_SHIFT-10), 177 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index fb87c08c6b57..29dd8489ffec 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -58,6 +58,12 @@ config HZ
58 int 58 int
59 default 100 59 default 100
60 60
61config GENERIC_TIME
62 def_bool y
63
64config ARCH_USES_GETTIMEOFFSET
65 def_bool y
66
61mainmenu "Linux/68k Kernel Configuration" 67mainmenu "Linux/68k Kernel Configuration"
62 68
63source "init/Kconfig" 69source "init/Kconfig"
diff --git a/arch/m68k/include/asm/hardirq_mm.h b/arch/m68k/include/asm/hardirq_mm.h
index 394ee946015c..554f65b6cd3b 100644
--- a/arch/m68k/include/asm/hardirq_mm.h
+++ b/arch/m68k/include/asm/hardirq_mm.h
@@ -1,16 +1,8 @@
1#ifndef __M68K_HARDIRQ_H 1#ifndef __M68K_HARDIRQ_H
2#define __M68K_HARDIRQ_H 2#define __M68K_HARDIRQ_H
3 3
4#include <linux/threads.h>
5#include <linux/cache.h>
6
7/* entry.S is sensitive to the offsets of these fields */
8typedef struct {
9 unsigned int __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t;
11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
13
14#define HARDIRQ_BITS 8 4#define HARDIRQ_BITS 8
15 5
6#include <asm-generic/hardirq.h>
7
16#endif 8#endif
diff --git a/arch/m68k/include/asm/mman.h b/arch/m68k/include/asm/mman.h
index 9f5c4c4b3c7b..8eebf89f5ab1 100644
--- a/arch/m68k/include/asm/mman.h
+++ b/arch/m68k/include/asm/mman.h
@@ -1,17 +1 @@
1#ifndef __M68K_MMAN_H__ #include <asm-generic/mman.h>
2#define __M68K_MMAN_H__
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __M68K_MMAN_H__ */
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 946d8691f2b0..48b87f5ced50 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -335,7 +335,7 @@
335#define __NR_preadv 329 335#define __NR_preadv 329
336#define __NR_pwritev 330 336#define __NR_pwritev 330
337#define __NR_rt_tgsigqueueinfo 331 337#define __NR_rt_tgsigqueueinfo 331
338#define __NR_perf_counter_open 332 338#define __NR_perf_event_open 332
339 339
340#ifdef __KERNEL__ 340#ifdef __KERNEL__
341 341
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 922f52e7ed1a..c5b33634c980 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -756,5 +756,5 @@ sys_call_table:
756 .long sys_preadv 756 .long sys_preadv
757 .long sys_pwritev /* 330 */ 757 .long sys_pwritev /* 330 */
758 .long sys_rt_tgsigqueueinfo 758 .long sys_rt_tgsigqueueinfo
759 .long sys_perf_counter_open 759 .long sys_perf_event_open
760 760
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 54d980795fc4..17dc2a31a7ca 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -91,77 +91,11 @@ void __init time_init(void)
91 mach_sched_init(timer_interrupt); 91 mach_sched_init(timer_interrupt);
92} 92}
93 93
94/* 94u32 arch_gettimeoffset(void)
95 * This version of gettimeofday has near microsecond resolution.
96 */
97void do_gettimeofday(struct timeval *tv)
98{ 95{
99 unsigned long flags; 96 return mach_gettimeoffset() * 1000;
100 unsigned long seq;
101 unsigned long usec, sec;
102 unsigned long max_ntp_tick = tick_usec - tickadj;
103
104 do {
105 seq = read_seqbegin_irqsave(&xtime_lock, flags);
106
107 usec = mach_gettimeoffset();
108
109 /*
110 * If time_adjust is negative then NTP is slowing the clock
111 * so make sure not to go into next possible interval.
112 * Better to lose some accuracy than have time go backwards..
113 */
114 if (unlikely(time_adjust < 0))
115 usec = min(usec, max_ntp_tick);
116
117 sec = xtime.tv_sec;
118 usec += xtime.tv_nsec/1000;
119 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
120
121
122 while (usec >= 1000000) {
123 usec -= 1000000;
124 sec++;
125 }
126
127 tv->tv_sec = sec;
128 tv->tv_usec = usec;
129}
130
131EXPORT_SYMBOL(do_gettimeofday);
132
133int do_settimeofday(struct timespec *tv)
134{
135 time_t wtm_sec, sec = tv->tv_sec;
136 long wtm_nsec, nsec = tv->tv_nsec;
137
138 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
139 return -EINVAL;
140
141 write_seqlock_irq(&xtime_lock);
142 /* This is revolting. We need to set the xtime.tv_nsec
143 * correctly. However, the value in this location is
144 * is value at the last tick.
145 * Discover what correction gettimeofday
146 * would have done, and then undo it!
147 */
148 nsec -= 1000 * mach_gettimeoffset();
149
150 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
151 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
152
153 set_normalized_timespec(&xtime, sec, nsec);
154 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
155
156 ntp_clear();
157 write_sequnlock_irq(&xtime_lock);
158 clock_was_set();
159 return 0;
160} 97}
161 98
162EXPORT_SYMBOL(do_settimeofday);
163
164
165static int __init rtc_init(void) 99static int __init rtc_init(void)
166{ 100{
167 struct platform_device *pdev; 101 struct platform_device *pdev;
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 0007b2adf3a3..774549accd2d 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -126,7 +126,7 @@ void __init mem_init(void)
126#endif 126#endif
127 127
128 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", 128 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
129 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), 129 nr_free_pages() << (PAGE_SHIFT-10),
130 totalram_pages << (PAGE_SHIFT-10), 130 totalram_pages << (PAGE_SHIFT-10),
131 codepages << (PAGE_SHIFT-10), 131 codepages << (PAGE_SHIFT-10),
132 datapages << (PAGE_SHIFT-10), 132 datapages << (PAGE_SHIFT-10),
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
index 0ae123e08985..23535cc415ae 100644
--- a/arch/m68knommu/kernel/syscalltable.S
+++ b/arch/m68knommu/kernel/syscalltable.S
@@ -350,7 +350,7 @@ ENTRY(sys_call_table)
350 .long sys_preadv 350 .long sys_preadv
351 .long sys_pwritev /* 330 */ 351 .long sys_pwritev /* 330 */
352 .long sys_rt_tgsigqueueinfo 352 .long sys_rt_tgsigqueueinfo
353 .long sys_perf_counter_open 353 .long sys_perf_event_open
354 354
355 .rept NR_syscalls-(.-sys_call_table)/4 355 .rept NR_syscalls-(.-sys_call_table)/4
356 .long sys_ni_syscall 356 .long sys_ni_syscall
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index 0b852327c0e7..cb05a07e55e9 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -381,7 +381,7 @@
381#define __NR_preadv 363 /* new */ 381#define __NR_preadv 363 /* new */
382#define __NR_pwritev 364 /* new */ 382#define __NR_pwritev 364 /* new */
383#define __NR_rt_tgsigqueueinfo 365 /* new */ 383#define __NR_rt_tgsigqueueinfo 365 /* new */
384#define __NR_perf_counter_open 366 /* new */ 384#define __NR_perf_event_open 366 /* new */
385 385
386#define __NR_syscalls 367 386#define __NR_syscalls 367
387 387
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 457216097dfd..ecec19155135 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -370,4 +370,4 @@ ENTRY(sys_call_table)
370 .long sys_ni_syscall 370 .long sys_ni_syscall
371 .long sys_ni_syscall 371 .long sys_ni_syscall
372 .long sys_rt_tgsigqueueinfo /* 365 */ 372 .long sys_rt_tgsigqueueinfo /* 365 */
373 .long sys_perf_counter_open 373 .long sys_perf_event_open
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index f207f1a94dbc..1110784eb3f7 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -204,7 +204,7 @@ void __init mem_init(void)
204 totalram_pages += free_all_bootmem(); 204 totalram_pages += free_all_bootmem();
205 205
206 printk(KERN_INFO "Memory: %luk/%luk available\n", 206 printk(KERN_INFO "Memory: %luk/%luk available\n",
207 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 207 nr_free_pages() << (PAGE_SHIFT-10),
208 num_physpages << (PAGE_SHIFT-10)); 208 num_physpages << (PAGE_SHIFT-10));
209#ifdef CONFIG_MMU 209#ifdef CONFIG_MMU
210 mem_init_done = 1; 210 mem_init_done = 1;
diff --git a/arch/mips/include/asm/mman.h b/arch/mips/include/asm/mman.h
index e4d6f1fb1cf7..a2250f390a29 100644
--- a/arch/mips/include/asm/mman.h
+++ b/arch/mips/include/asm/mman.h
@@ -46,6 +46,8 @@
46#define MAP_LOCKED 0x8000 /* pages are locked */ 46#define MAP_LOCKED 0x8000 /* pages are locked */
47#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 47#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
48#define MAP_NONBLOCK 0x20000 /* do not block on IO */ 48#define MAP_NONBLOCK 0x20000 /* do not block on IO */
49#define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */
50#define MAP_HUGETLB 0x80000 /* create a huge page mapping */
49 51
50/* 52/*
51 * Flags for msync 53 * Flags for msync
@@ -71,6 +73,9 @@
71#define MADV_DONTFORK 10 /* don't inherit across fork */ 73#define MADV_DONTFORK 10 /* don't inherit across fork */
72#define MADV_DOFORK 11 /* do inherit across fork */ 74#define MADV_DOFORK 11 /* do inherit across fork */
73 75
76#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
77#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
78
74/* compatibility flags */ 79/* compatibility flags */
75#define MAP_FILE 0 80#define MAP_FILE 0
76 81
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 1a9f9b257551..d6eb6134abec 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -76,6 +76,16 @@ extern unsigned long zero_page_mask;
76#define ZERO_PAGE(vaddr) \ 76#define ZERO_PAGE(vaddr) \
77 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))) 77 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
78 78
79#define is_zero_pfn is_zero_pfn
80static inline int is_zero_pfn(unsigned long pfn)
81{
82 extern unsigned long zero_pfn;
83 unsigned long offset_from_zero_pfn = pfn - zero_pfn;
84 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
85}
86
87#define my_zero_pfn(addr) page_to_pfn(ZERO_PAGE(addr))
88
79extern void paging_init(void); 89extern void paging_init(void);
80 90
81/* 91/*
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index e753a777949b..8c9dfa9e9018 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -353,7 +353,7 @@
353#define __NR_preadv (__NR_Linux + 330) 353#define __NR_preadv (__NR_Linux + 330)
354#define __NR_pwritev (__NR_Linux + 331) 354#define __NR_pwritev (__NR_Linux + 331)
355#define __NR_rt_tgsigqueueinfo (__NR_Linux + 332) 355#define __NR_rt_tgsigqueueinfo (__NR_Linux + 332)
356#define __NR_perf_counter_open (__NR_Linux + 333) 356#define __NR_perf_event_open (__NR_Linux + 333)
357#define __NR_accept4 (__NR_Linux + 334) 357#define __NR_accept4 (__NR_Linux + 334)
358 358
359/* 359/*
@@ -664,7 +664,7 @@
664#define __NR_preadv (__NR_Linux + 289) 664#define __NR_preadv (__NR_Linux + 289)
665#define __NR_pwritev (__NR_Linux + 290) 665#define __NR_pwritev (__NR_Linux + 290)
666#define __NR_rt_tgsigqueueinfo (__NR_Linux + 291) 666#define __NR_rt_tgsigqueueinfo (__NR_Linux + 291)
667#define __NR_perf_counter_open (__NR_Linux + 292) 667#define __NR_perf_event_open (__NR_Linux + 292)
668#define __NR_accept4 (__NR_Linux + 293) 668#define __NR_accept4 (__NR_Linux + 293)
669 669
670/* 670/*
@@ -979,7 +979,7 @@
979#define __NR_preadv (__NR_Linux + 293) 979#define __NR_preadv (__NR_Linux + 293)
980#define __NR_pwritev (__NR_Linux + 294) 980#define __NR_pwritev (__NR_Linux + 294)
981#define __NR_rt_tgsigqueueinfo (__NR_Linux + 295) 981#define __NR_rt_tgsigqueueinfo (__NR_Linux + 295)
982#define __NR_perf_counter_open (__NR_Linux + 296) 982#define __NR_perf_event_open (__NR_Linux + 296)
983#define __NR_accept4 (__NR_Linux + 297) 983#define __NR_accept4 (__NR_Linux + 297)
984 984
985/* 985/*
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 7c2de4f091c4..fd2a9bb620d6 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -581,7 +581,7 @@ einval: li v0, -ENOSYS
581 sys sys_preadv 6 /* 4330 */ 581 sys sys_preadv 6 /* 4330 */
582 sys sys_pwritev 6 582 sys sys_pwritev 6
583 sys sys_rt_tgsigqueueinfo 4 583 sys sys_rt_tgsigqueueinfo 4
584 sys sys_perf_counter_open 5 584 sys sys_perf_event_open 5
585 sys sys_accept4 4 585 sys sys_accept4 4
586 .endm 586 .endm
587 587
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index b97b993846d6..18bf7f32c5e4 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -418,6 +418,6 @@ sys_call_table:
418 PTR sys_preadv 418 PTR sys_preadv
419 PTR sys_pwritev /* 5390 */ 419 PTR sys_pwritev /* 5390 */
420 PTR sys_rt_tgsigqueueinfo 420 PTR sys_rt_tgsigqueueinfo
421 PTR sys_perf_counter_open 421 PTR sys_perf_event_open
422 PTR sys_accept4 422 PTR sys_accept4
423 .size sys_call_table,.-sys_call_table 423 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 1a6ae124635b..6ebc07976694 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -416,6 +416,6 @@ EXPORT(sysn32_call_table)
416 PTR sys_preadv 416 PTR sys_preadv
417 PTR sys_pwritev 417 PTR sys_pwritev
418 PTR compat_sys_rt_tgsigqueueinfo /* 5295 */ 418 PTR compat_sys_rt_tgsigqueueinfo /* 5295 */
419 PTR sys_perf_counter_open 419 PTR sys_perf_event_open
420 PTR sys_accept4 420 PTR sys_accept4
421 .size sysn32_call_table,.-sysn32_call_table 421 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index cd31087a651f..9bbf9775e0bd 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -536,6 +536,6 @@ sys_call_table:
536 PTR compat_sys_preadv /* 4330 */ 536 PTR compat_sys_preadv /* 4330 */
537 PTR compat_sys_pwritev 537 PTR compat_sys_pwritev
538 PTR compat_sys_rt_tgsigqueueinfo 538 PTR compat_sys_rt_tgsigqueueinfo
539 PTR sys_perf_counter_open 539 PTR sys_perf_event_open
540 PTR sys_accept4 540 PTR sys_accept4
541 .size sys_call_table,.-sys_call_table 541 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 38c79c55b060..15aa1902a788 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -352,7 +352,6 @@ void __init paging_init(void)
352 free_area_init_nodes(max_zone_pfns); 352 free_area_init_nodes(max_zone_pfns);
353} 353}
354 354
355static struct kcore_list kcore_mem, kcore_vmalloc;
356#ifdef CONFIG_64BIT 355#ifdef CONFIG_64BIT
357static struct kcore_list kcore_kseg0; 356static struct kcore_list kcore_kseg0;
358#endif 357#endif
@@ -409,15 +408,13 @@ void __init mem_init(void)
409 if ((unsigned long) &_text > (unsigned long) CKSEG0) 408 if ((unsigned long) &_text > (unsigned long) CKSEG0)
410 /* The -4 is a hack so that user tools don't have to handle 409 /* The -4 is a hack so that user tools don't have to handle
411 the overflow. */ 410 the overflow. */
412 kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4); 411 kclist_add(&kcore_kseg0, (void *) CKSEG0,
412 0x80000000 - 4, KCORE_TEXT);
413#endif 413#endif
414 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
415 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
416 VMALLOC_END-VMALLOC_START);
417 414
418 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 415 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
419 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", 416 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
420 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 417 nr_free_pages() << (PAGE_SHIFT-10),
421 ram << (PAGE_SHIFT-10), 418 ram << (PAGE_SHIFT-10),
422 codesize >> 10, 419 codesize >> 10,
423 reservedpages << (PAGE_SHIFT-10), 420 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/mn10300/include/asm/cacheflush.h b/arch/mn10300/include/asm/cacheflush.h
index 2db746a251f8..1a55d61f0d06 100644
--- a/arch/mn10300/include/asm/cacheflush.h
+++ b/arch/mn10300/include/asm/cacheflush.h
@@ -17,7 +17,7 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18 18
19/* 19/*
20 * virtually-indexed cache managment (our cache is physically indexed) 20 * virtually-indexed cache management (our cache is physically indexed)
21 */ 21 */
22#define flush_cache_all() do {} while (0) 22#define flush_cache_all() do {} while (0)
23#define flush_cache_mm(mm) do {} while (0) 23#define flush_cache_mm(mm) do {} while (0)
@@ -31,7 +31,7 @@
31#define flush_dcache_mmap_unlock(mapping) do {} while (0) 31#define flush_dcache_mmap_unlock(mapping) do {} while (0)
32 32
33/* 33/*
34 * physically-indexed cache managment 34 * physically-indexed cache management
35 */ 35 */
36#ifndef CONFIG_MN10300_CACHE_DISABLED 36#ifndef CONFIG_MN10300_CACHE_DISABLED
37 37
diff --git a/arch/mn10300/include/asm/gdb-stub.h b/arch/mn10300/include/asm/gdb-stub.h
index e5a6368559af..556cce992548 100644
--- a/arch/mn10300/include/asm/gdb-stub.h
+++ b/arch/mn10300/include/asm/gdb-stub.h
@@ -109,7 +109,6 @@ extern asmlinkage int gdbstub_intercept(struct pt_regs *, enum exception_code);
109extern asmlinkage void gdbstub_exception(struct pt_regs *, enum exception_code); 109extern asmlinkage void gdbstub_exception(struct pt_regs *, enum exception_code);
110extern asmlinkage void __gdbstub_bug_trap(void); 110extern asmlinkage void __gdbstub_bug_trap(void);
111extern asmlinkage void __gdbstub_pause(void); 111extern asmlinkage void __gdbstub_pause(void);
112extern asmlinkage void start_kernel(void);
113 112
114#ifndef CONFIG_MN10300_CACHE_DISABLED 113#ifndef CONFIG_MN10300_CACHE_DISABLED
115extern asmlinkage void gdbstub_purge_cache(void); 114extern asmlinkage void gdbstub_purge_cache(void);
diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h
index d04fac1da5aa..8eebf89f5ab1 100644
--- a/arch/mn10300/include/asm/mman.h
+++ b/arch/mn10300/include/asm/mman.h
@@ -1,28 +1 @@
1/* MN10300 Constants for mmap and co. #include <asm-generic/mman.h>
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * - Derived from asm-x86/mman.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_MMAN_H
13#define _ASM_MMAN_H
14
15#include <asm-generic/mman-common.h>
16
17#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
18#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
19#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
20#define MAP_LOCKED 0x2000 /* pages are locked */
21#define MAP_NORESERVE 0x4000 /* don't check for reservations */
22#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
23#define MAP_NONBLOCK 0x10000 /* do not block on IO */
24
25#define MCL_CURRENT 1 /* lock all current mappings */
26#define MCL_FUTURE 2 /* lock all future mappings */
27
28#endif /* _ASM_MMAN_H */
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index fad68616af32..2a983931c11f 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -347,7 +347,7 @@
347#define __NR_preadv 334 347#define __NR_preadv 334
348#define __NR_pwritev 335 348#define __NR_pwritev 335
349#define __NR_rt_tgsigqueueinfo 336 349#define __NR_rt_tgsigqueueinfo 336
350#define __NR_perf_counter_open 337 350#define __NR_perf_event_open 337
351 351
352#ifdef __KERNEL__ 352#ifdef __KERNEL__
353 353
diff --git a/arch/mn10300/kernel/asm-offsets.c b/arch/mn10300/kernel/asm-offsets.c
index 82b40079ad76..02dc7e461fef 100644
--- a/arch/mn10300/kernel/asm-offsets.c
+++ b/arch/mn10300/kernel/asm-offsets.c
@@ -85,7 +85,7 @@ void foo(void)
85 OFFSET(__rx_buffer, mn10300_serial_port, rx_buffer); 85 OFFSET(__rx_buffer, mn10300_serial_port, rx_buffer);
86 OFFSET(__rx_inp, mn10300_serial_port, rx_inp); 86 OFFSET(__rx_inp, mn10300_serial_port, rx_inp);
87 OFFSET(__rx_outp, mn10300_serial_port, rx_outp); 87 OFFSET(__rx_outp, mn10300_serial_port, rx_outp);
88 OFFSET(__tx_info_buffer, mn10300_serial_port, uart.info); 88 OFFSET(__uart_state, mn10300_serial_port, uart.state);
89 OFFSET(__tx_xchar, mn10300_serial_port, tx_xchar); 89 OFFSET(__tx_xchar, mn10300_serial_port, tx_xchar);
90 OFFSET(__tx_break, mn10300_serial_port, tx_break); 90 OFFSET(__tx_break, mn10300_serial_port, tx_break);
91 OFFSET(__intr_flags, mn10300_serial_port, intr_flags); 91 OFFSET(__intr_flags, mn10300_serial_port, intr_flags);
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index e0d2563af4f2..a94e7ea3faa6 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -723,7 +723,7 @@ ENTRY(sys_call_table)
723 .long sys_preadv 723 .long sys_preadv
724 .long sys_pwritev /* 335 */ 724 .long sys_pwritev /* 335 */
725 .long sys_rt_tgsigqueueinfo 725 .long sys_rt_tgsigqueueinfo
726 .long sys_perf_counter_open 726 .long sys_perf_event_open
727 727
728 728
729nr_syscalls=(.-sys_call_table)/4 729nr_syscalls=(.-sys_call_table)/4
diff --git a/arch/mn10300/kernel/mn10300-serial-low.S b/arch/mn10300/kernel/mn10300-serial-low.S
index 224485388228..66702d256610 100644
--- a/arch/mn10300/kernel/mn10300-serial-low.S
+++ b/arch/mn10300/kernel/mn10300-serial-low.S
@@ -130,7 +130,7 @@ ENTRY(mn10300_serial_vdma_tx_handler)
130 or d2,d2 130 or d2,d2
131 bne mnsc_vdma_tx_xchar 131 bne mnsc_vdma_tx_xchar
132 132
133 mov (__tx_info_buffer,a3),a2 # get the uart_info struct for Tx 133 mov (__uart_state,a3),a2 # see if the TTY Tx queue has anything in it
134 mov (__xmit_tail,a2),d3 134 mov (__xmit_tail,a2),d3
135 mov (__xmit_head,a2),d2 135 mov (__xmit_head,a2),d2
136 cmp d3,d2 136 cmp d3,d2
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index 2fd59664d00a..229b710fc5d5 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -391,7 +391,7 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask)
391static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) 391static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
392{ 392{
393 struct uart_icount *icount = &port->uart.icount; 393 struct uart_icount *icount = &port->uart.icount;
394 struct tty_struct *tty = port->uart.info->port.tty; 394 struct tty_struct *tty = port->uart.state->port.tty;
395 unsigned ix; 395 unsigned ix;
396 int count; 396 int count;
397 u8 st, ch, push, status, overrun; 397 u8 st, ch, push, status, overrun;
@@ -566,16 +566,16 @@ static void mn10300_serial_transmit_interrupt(struct mn10300_serial_port *port)
566{ 566{
567 _enter("%s", port->name); 567 _enter("%s", port->name);
568 568
569 if (!port->uart.info || !port->uart.info->port.tty) { 569 if (!port->uart.state || !port->uart.state->port.tty) {
570 mn10300_serial_dis_tx_intr(port); 570 mn10300_serial_dis_tx_intr(port);
571 return; 571 return;
572 } 572 }
573 573
574 if (uart_tx_stopped(&port->uart) || 574 if (uart_tx_stopped(&port->uart) ||
575 uart_circ_empty(&port->uart.info->xmit)) 575 uart_circ_empty(&port->uart.state->xmit))
576 mn10300_serial_dis_tx_intr(port); 576 mn10300_serial_dis_tx_intr(port);
577 577
578 if (uart_circ_chars_pending(&port->uart.info->xmit) < WAKEUP_CHARS) 578 if (uart_circ_chars_pending(&port->uart.state->xmit) < WAKEUP_CHARS)
579 uart_write_wakeup(&port->uart); 579 uart_write_wakeup(&port->uart);
580} 580}
581 581
@@ -596,7 +596,7 @@ static void mn10300_serial_cts_changed(struct mn10300_serial_port *port, u8 st)
596 *port->_control = ctr; 596 *port->_control = ctr;
597 597
598 uart_handle_cts_change(&port->uart, st & SC2STR_CTS); 598 uart_handle_cts_change(&port->uart, st & SC2STR_CTS);
599 wake_up_interruptible(&port->uart.info->delta_msr_wait); 599 wake_up_interruptible(&port->uart.state->port.delta_msr_wait);
600} 600}
601 601
602/* 602/*
@@ -705,8 +705,8 @@ static void mn10300_serial_start_tx(struct uart_port *_port)
705 705
706 _enter("%s{%lu}", 706 _enter("%s{%lu}",
707 port->name, 707 port->name,
708 CIRC_CNT(&port->uart.info->xmit.head, 708 CIRC_CNT(&port->uart.state->xmit.head,
709 &port->uart.info->xmit.tail, 709 &port->uart.state->xmit.tail,
710 UART_XMIT_SIZE)); 710 UART_XMIT_SIZE));
711 711
712 /* kick the virtual DMA controller */ 712 /* kick the virtual DMA controller */
diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index 79890edfd67a..3f24c298a3af 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -285,7 +285,7 @@ static void c_stop(struct seq_file *m, void *v)
285{ 285{
286} 286}
287 287
288struct seq_operations cpuinfo_op = { 288const struct seq_operations cpuinfo_op = {
289 .start = c_start, 289 .start = c_start,
290 .next = c_next, 290 .next = c_next,
291 .stop = c_stop, 291 .stop = c_stop,
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index 8cee387a24fd..ec1420562dc7 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -112,7 +112,7 @@ void __init mem_init(void)
112 "Memory: %luk/%luk available" 112 "Memory: %luk/%luk available"
113 " (%dk kernel code, %dk reserved, %dk data, %dk init," 113 " (%dk kernel code, %dk reserved, %dk data, %dk init,"
114 " %ldk highmem)\n", 114 " %ldk highmem)\n",
115 (unsigned long) nr_free_pages() << (PAGE_SHIFT - 10), 115 nr_free_pages() << (PAGE_SHIFT - 10),
116 max_mapnr << (PAGE_SHIFT - 10), 116 max_mapnr << (PAGE_SHIFT - 10),
117 codesize >> 10, 117 codesize >> 10,
118 reservedpages << (PAGE_SHIFT - 10), 118 reservedpages << (PAGE_SHIFT - 10),
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 06f8d5b5b0f9..f388dc68f605 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -16,7 +16,7 @@ config PARISC
16 select RTC_DRV_GENERIC 16 select RTC_DRV_GENERIC
17 select INIT_ALL_POSSIBLE 17 select INIT_ALL_POSSIBLE
18 select BUG 18 select BUG
19 select HAVE_PERF_COUNTERS 19 select HAVE_PERF_EVENTS
20 select GENERIC_ATOMIC64 if !64BIT 20 select GENERIC_ATOMIC64 if !64BIT
21 help 21 help
22 The PA-RISC microprocessor is designed by Hewlett-Packard and used 22 The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/asm/mman.h
index defe752cc996..9749c8afe83a 100644
--- a/arch/parisc/include/asm/mman.h
+++ b/arch/parisc/include/asm/mman.h
@@ -22,6 +22,8 @@
22#define MAP_GROWSDOWN 0x8000 /* stack-like segment */ 22#define MAP_GROWSDOWN 0x8000 /* stack-like segment */
23#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 23#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
24#define MAP_NONBLOCK 0x20000 /* do not block on IO */ 24#define MAP_NONBLOCK 0x20000 /* do not block on IO */
25#define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */
26#define MAP_HUGETLB 0x80000 /* create a huge page mapping */
25 27
26#define MS_SYNC 1 /* synchronous memory sync */ 28#define MS_SYNC 1 /* synchronous memory sync */
27#define MS_ASYNC 2 /* sync memory asynchronously */ 29#define MS_ASYNC 2 /* sync memory asynchronously */
@@ -54,6 +56,9 @@
54#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */ 56#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */
55#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ 57#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */
56 58
59#define MADV_MERGEABLE 65 /* KSM may merge identical pages */
60#define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */
61
57/* compatibility flags */ 62/* compatibility flags */
58#define MAP_FILE 0 63#define MAP_FILE 0
59#define MAP_VARIABLE 0 64#define MAP_VARIABLE 0
diff --git a/arch/parisc/include/asm/perf_counter.h b/arch/parisc/include/asm/perf_counter.h
deleted file mode 100644
index dc9e829f7013..000000000000
--- a/arch/parisc/include/asm/perf_counter.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_PARISC_PERF_COUNTER_H
2#define __ASM_PARISC_PERF_COUNTER_H
3
4/* parisc only supports software counters through this interface. */
5static inline void set_perf_counter_pending(void) { }
6
7#endif /* __ASM_PARISC_PERF_COUNTER_H */
diff --git a/arch/parisc/include/asm/perf_event.h b/arch/parisc/include/asm/perf_event.h
new file mode 100644
index 000000000000..cc146427d8f9
--- /dev/null
+++ b/arch/parisc/include/asm/perf_event.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_PARISC_PERF_EVENT_H
2#define __ASM_PARISC_PERF_EVENT_H
3
4/* parisc only supports software events through this interface. */
5static inline void set_perf_event_pending(void) { }
6
7#endif /* __ASM_PARISC_PERF_EVENT_H */
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index f3d3b8b012c4..cda158318c62 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -810,9 +810,9 @@
810#define __NR_preadv (__NR_Linux + 315) 810#define __NR_preadv (__NR_Linux + 315)
811#define __NR_pwritev (__NR_Linux + 316) 811#define __NR_pwritev (__NR_Linux + 316)
812#define __NR_rt_tgsigqueueinfo (__NR_Linux + 317) 812#define __NR_rt_tgsigqueueinfo (__NR_Linux + 317)
813#define __NR_perf_counter_open (__NR_Linux + 318) 813#define __NR_perf_event_open (__NR_Linux + 318)
814 814
815#define __NR_Linux_syscalls (__NR_perf_counter_open + 1) 815#define __NR_Linux_syscalls (__NR_perf_event_open + 1)
816 816
817 817
818#define __IGNORE_select /* newselect */ 818#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index cf145eb026b3..843f423dec67 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -416,7 +416,7 @@
416 ENTRY_COMP(preadv) /* 315 */ 416 ENTRY_COMP(preadv) /* 315 */
417 ENTRY_COMP(pwritev) 417 ENTRY_COMP(pwritev)
418 ENTRY_COMP(rt_tgsigqueueinfo) 418 ENTRY_COMP(rt_tgsigqueueinfo)
419 ENTRY_SAME(perf_counter_open) 419 ENTRY_SAME(perf_event_open)
420 420
421 /* Nothing yet */ 421 /* Nothing yet */
422 422
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index b0831d9e35cb..d5aca31fddbb 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -506,7 +506,7 @@ void __init mem_init(void)
506#endif 506#endif
507 507
508 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", 508 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
509 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), 509 nr_free_pages() << (PAGE_SHIFT-10),
510 num_physpages << (PAGE_SHIFT-10), 510 num_physpages << (PAGE_SHIFT-10),
511 codesize >> 10, 511 codesize >> 10,
512 reservedpages << (PAGE_SHIFT-10), 512 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8250902265c6..4fd479059d65 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -129,7 +129,7 @@ config PPC
129 select HAVE_OPROFILE 129 select HAVE_OPROFILE
130 select HAVE_SYSCALL_WRAPPERS if PPC64 130 select HAVE_SYSCALL_WRAPPERS if PPC64
131 select GENERIC_ATOMIC64 if PPC32 131 select GENERIC_ATOMIC64 if PPC32
132 select HAVE_PERF_COUNTERS 132 select HAVE_PERF_EVENTS
133 133
134config EARLY_PRINTK 134config EARLY_PRINTK
135 bool 135 bool
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index f32c2811c6d9..855782c5e5ec 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -159,6 +159,7 @@
159 reg = <0x2e000 0x1000>; 159 reg = <0x2e000 0x1000>;
160 interrupts = <42 0x8>; 160 interrupts = <42 0x8>;
161 interrupt-parent = <&ipic>; 161 interrupt-parent = <&ipic>;
162 sdhci,wp-inverted;
162 /* Filled in by U-Boot */ 163 /* Filled in by U-Boot */
163 clock-frequency = <0>; 164 clock-frequency = <0>;
164 }; 165 };
diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
index 28e022ac4179..9e2264b10008 100644
--- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
@@ -173,6 +173,7 @@
173 reg = <0x2e000 0x1000>; 173 reg = <0x2e000 0x1000>;
174 interrupts = <42 0x8>; 174 interrupts = <42 0x8>;
175 interrupt-parent = <&ipic>; 175 interrupt-parent = <&ipic>;
176 sdhci,wp-inverted;
176 /* Filled in by U-Boot */ 177 /* Filled in by U-Boot */
177 clock-frequency = <111111111>; 178 clock-frequency = <111111111>;
178 }; 179 };
diff --git a/arch/powerpc/boot/dts/mpc8377_wlan.dts b/arch/powerpc/boot/dts/mpc8377_wlan.dts
index 3febc4e91b10..9a603695723b 100644
--- a/arch/powerpc/boot/dts/mpc8377_wlan.dts
+++ b/arch/powerpc/boot/dts/mpc8377_wlan.dts
@@ -150,6 +150,7 @@
150 reg = <0x2e000 0x1000>; 150 reg = <0x2e000 0x1000>;
151 interrupts = <42 0x8>; 151 interrupts = <42 0x8>;
152 interrupt-parent = <&ipic>; 152 interrupt-parent = <&ipic>;
153 sdhci,wp-inverted;
153 clock-frequency = <133333333>; 154 clock-frequency = <133333333>;
154 }; 155 };
155 }; 156 };
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
index f720ab9af30d..f70cf6000839 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -159,6 +159,7 @@
159 reg = <0x2e000 0x1000>; 159 reg = <0x2e000 0x1000>;
160 interrupts = <42 0x8>; 160 interrupts = <42 0x8>;
161 interrupt-parent = <&ipic>; 161 interrupt-parent = <&ipic>;
162 sdhci,wp-inverted;
162 /* Filled in by U-Boot */ 163 /* Filled in by U-Boot */
163 clock-frequency = <0>; 164 clock-frequency = <0>;
164 }; 165 };
diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
index a11ead8214b4..4e6a1a407bbd 100644
--- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
@@ -173,6 +173,7 @@
173 reg = <0x2e000 0x1000>; 173 reg = <0x2e000 0x1000>;
174 interrupts = <42 0x8>; 174 interrupts = <42 0x8>;
175 interrupt-parent = <&ipic>; 175 interrupt-parent = <&ipic>;
176 sdhci,wp-inverted;
176 /* Filled in by U-Boot */ 177 /* Filled in by U-Boot */
177 clock-frequency = <111111111>; 178 clock-frequency = <111111111>;
178 }; 179 };
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
index 4fa221fd9bdc..645ec51cc6e1 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -157,6 +157,7 @@
157 reg = <0x2e000 0x1000>; 157 reg = <0x2e000 0x1000>;
158 interrupts = <42 0x8>; 158 interrupts = <42 0x8>;
159 interrupt-parent = <&ipic>; 159 interrupt-parent = <&ipic>;
160 sdhci,wp-inverted;
160 /* Filled in by U-Boot */ 161 /* Filled in by U-Boot */
161 clock-frequency = <0>; 162 clock-frequency = <0>;
162 }; 163 };
diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
index e35dfba587c8..72336d504528 100644
--- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
@@ -171,6 +171,7 @@
171 reg = <0x2e000 0x1000>; 171 reg = <0x2e000 0x1000>;
172 interrupts = <42 0x8>; 172 interrupts = <42 0x8>;
173 interrupt-parent = <&ipic>; 173 interrupt-parent = <&ipic>;
174 sdhci,wp-inverted;
174 /* Filled in by U-Boot */ 175 /* Filled in by U-Boot */
175 clock-frequency = <111111111>; 176 clock-frequency = <111111111>;
176 }; 177 };
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index f42e623030ee..fa19f3fe05ff 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -18,6 +18,9 @@
18 18
19#ifndef CONFIG_VIRT_CPU_ACCOUNTING 19#ifndef CONFIG_VIRT_CPU_ACCOUNTING
20#include <asm-generic/cputime.h> 20#include <asm-generic/cputime.h>
21#ifdef __KERNEL__
22static inline void setup_cputime_one_jiffy(void) { }
23#endif
21#else 24#else
22 25
23#include <linux/types.h> 26#include <linux/types.h>
@@ -49,6 +52,11 @@ typedef u64 cputime64_t;
49#ifdef __KERNEL__ 52#ifdef __KERNEL__
50 53
51/* 54/*
55 * One jiffy in timebase units computed during initialization
56 */
57extern cputime_t cputime_one_jiffy;
58
59/*
52 * Convert cputime <-> jiffies 60 * Convert cputime <-> jiffies
53 */ 61 */
54extern u64 __cputime_jiffies_factor; 62extern u64 __cputime_jiffies_factor;
@@ -89,6 +97,11 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif)
89 return ct; 97 return ct;
90} 98}
91 99
100static inline void setup_cputime_one_jiffy(void)
101{
102 cputime_one_jiffy = jiffies_to_cputime(1);
103}
104
92static inline cputime64_t jiffies64_to_cputime64(const u64 jif) 105static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
93{ 106{
94 cputime_t ct; 107 cputime_t ct;
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index e73d554538dd..abbc2aaaced5 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -135,43 +135,43 @@ static inline int irqs_disabled_flags(unsigned long flags)
135 */ 135 */
136struct irq_chip; 136struct irq_chip;
137 137
138#ifdef CONFIG_PERF_COUNTERS 138#ifdef CONFIG_PERF_EVENTS
139 139
140#ifdef CONFIG_PPC64 140#ifdef CONFIG_PPC64
141static inline unsigned long test_perf_counter_pending(void) 141static inline unsigned long test_perf_event_pending(void)
142{ 142{
143 unsigned long x; 143 unsigned long x;
144 144
145 asm volatile("lbz %0,%1(13)" 145 asm volatile("lbz %0,%1(13)"
146 : "=r" (x) 146 : "=r" (x)
147 : "i" (offsetof(struct paca_struct, perf_counter_pending))); 147 : "i" (offsetof(struct paca_struct, perf_event_pending)));
148 return x; 148 return x;
149} 149}
150 150
151static inline void set_perf_counter_pending(void) 151static inline void set_perf_event_pending(void)
152{ 152{
153 asm volatile("stb %0,%1(13)" : : 153 asm volatile("stb %0,%1(13)" : :
154 "r" (1), 154 "r" (1),
155 "i" (offsetof(struct paca_struct, perf_counter_pending))); 155 "i" (offsetof(struct paca_struct, perf_event_pending)));
156} 156}
157 157
158static inline void clear_perf_counter_pending(void) 158static inline void clear_perf_event_pending(void)
159{ 159{
160 asm volatile("stb %0,%1(13)" : : 160 asm volatile("stb %0,%1(13)" : :
161 "r" (0), 161 "r" (0),
162 "i" (offsetof(struct paca_struct, perf_counter_pending))); 162 "i" (offsetof(struct paca_struct, perf_event_pending)));
163} 163}
164#endif /* CONFIG_PPC64 */ 164#endif /* CONFIG_PPC64 */
165 165
166#else /* CONFIG_PERF_COUNTERS */ 166#else /* CONFIG_PERF_EVENTS */
167 167
168static inline unsigned long test_perf_counter_pending(void) 168static inline unsigned long test_perf_event_pending(void)
169{ 169{
170 return 0; 170 return 0;
171} 171}
172 172
173static inline void clear_perf_counter_pending(void) {} 173static inline void clear_perf_event_pending(void) {}
174#endif /* CONFIG_PERF_COUNTERS */ 174#endif /* CONFIG_PERF_EVENTS */
175 175
176#endif /* __KERNEL__ */ 176#endif /* __KERNEL__ */
177#endif /* _ASM_POWERPC_HW_IRQ_H */ 177#endif /* _ASM_POWERPC_HW_IRQ_H */
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index 7b1c49811a24..d4a7f645c5db 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -25,6 +25,8 @@
25 25
26#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 26#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
27#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 27#define MAP_NONBLOCK 0x10000 /* do not block on IO */
28#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
29#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
28 30
29#ifdef __KERNEL__ 31#ifdef __KERNEL__
30#ifdef CONFIG_PPC64 32#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index b634456ea893..7d8514ceceae 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -122,7 +122,7 @@ struct paca_struct {
122 u8 soft_enabled; /* irq soft-enable flag */ 122 u8 soft_enabled; /* irq soft-enable flag */
123 u8 hard_enabled; /* set if irqs are enabled in MSR */ 123 u8 hard_enabled; /* set if irqs are enabled in MSR */
124 u8 io_sync; /* writel() needs spin_unlock sync */ 124 u8 io_sync; /* writel() needs spin_unlock sync */
125 u8 perf_counter_pending; /* PM interrupt while soft-disabled */ 125 u8 perf_event_pending; /* PM interrupt while soft-disabled */
126 126
127 /* Stuff for accurate time accounting */ 127 /* Stuff for accurate time accounting */
128 u64 user_time; /* accumulated usermode TB ticks */ 128 u64 user_time; /* accumulated usermode TB ticks */
diff --git a/arch/powerpc/include/asm/perf_counter.h b/arch/powerpc/include/asm/perf_event.h
index 0ea0639fcf75..3288ce3997e0 100644
--- a/arch/powerpc/include/asm/perf_counter.h
+++ b/arch/powerpc/include/asm/perf_event.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Performance counter support - PowerPC-specific definitions. 2 * Performance event support - PowerPC-specific definitions.
3 * 3 *
4 * Copyright 2008-2009 Paul Mackerras, IBM Corporation. 4 * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
5 * 5 *
@@ -12,7 +12,7 @@
12 12
13#include <asm/hw_irq.h> 13#include <asm/hw_irq.h>
14 14
15#define MAX_HWCOUNTERS 8 15#define MAX_HWEVENTS 8
16#define MAX_EVENT_ALTERNATIVES 8 16#define MAX_EVENT_ALTERNATIVES 8
17#define MAX_LIMITED_HWCOUNTERS 2 17#define MAX_LIMITED_HWCOUNTERS 2
18 18
@@ -28,12 +28,12 @@ struct power_pmu {
28 unsigned long test_adder; 28 unsigned long test_adder;
29 int (*compute_mmcr)(u64 events[], int n_ev, 29 int (*compute_mmcr)(u64 events[], int n_ev,
30 unsigned int hwc[], unsigned long mmcr[]); 30 unsigned int hwc[], unsigned long mmcr[]);
31 int (*get_constraint)(u64 event, unsigned long *mskp, 31 int (*get_constraint)(u64 event_id, unsigned long *mskp,
32 unsigned long *valp); 32 unsigned long *valp);
33 int (*get_alternatives)(u64 event, unsigned int flags, 33 int (*get_alternatives)(u64 event_id, unsigned int flags,
34 u64 alt[]); 34 u64 alt[]);
35 void (*disable_pmc)(unsigned int pmc, unsigned long mmcr[]); 35 void (*disable_pmc)(unsigned int pmc, unsigned long mmcr[]);
36 int (*limited_pmc_event)(u64 event); 36 int (*limited_pmc_event)(u64 event_id);
37 u32 flags; 37 u32 flags;
38 int n_generic; 38 int n_generic;
39 int *generic_events; 39 int *generic_events;
@@ -61,10 +61,10 @@ struct pt_regs;
61extern unsigned long perf_misc_flags(struct pt_regs *regs); 61extern unsigned long perf_misc_flags(struct pt_regs *regs);
62extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 62extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
63 63
64#define PERF_COUNTER_INDEX_OFFSET 1 64#define PERF_EVENT_INDEX_OFFSET 1
65 65
66/* 66/*
67 * Only override the default definitions in include/linux/perf_counter.h 67 * Only override the default definitions in include/linux/perf_event.h
68 * if we have hardware PMU support. 68 * if we have hardware PMU support.
69 */ 69 */
70#ifdef CONFIG_PPC_PERF_CTRS 70#ifdef CONFIG_PPC_PERF_CTRS
@@ -73,14 +73,14 @@ extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
73 73
74/* 74/*
75 * The power_pmu.get_constraint function returns a 32/64-bit value and 75 * The power_pmu.get_constraint function returns a 32/64-bit value and
76 * a 32/64-bit mask that express the constraints between this event and 76 * a 32/64-bit mask that express the constraints between this event_id and
77 * other events. 77 * other events.
78 * 78 *
79 * The value and mask are divided up into (non-overlapping) bitfields 79 * The value and mask are divided up into (non-overlapping) bitfields
80 * of three different types: 80 * of three different types:
81 * 81 *
82 * Select field: this expresses the constraint that some set of bits 82 * Select field: this expresses the constraint that some set of bits
83 * in MMCR* needs to be set to a specific value for this event. For a 83 * in MMCR* needs to be set to a specific value for this event_id. For a
84 * select field, the mask contains 1s in every bit of the field, and 84 * select field, the mask contains 1s in every bit of the field, and
85 * the value contains a unique value for each possible setting of the 85 * the value contains a unique value for each possible setting of the
86 * MMCR* bits. The constraint checking code will ensure that two events 86 * MMCR* bits. The constraint checking code will ensure that two events
@@ -102,9 +102,9 @@ extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
102 * possible.) For N classes, the field is N+1 bits wide, and each class 102 * possible.) For N classes, the field is N+1 bits wide, and each class
103 * is assigned one bit from the least-significant N bits. The mask has 103 * is assigned one bit from the least-significant N bits. The mask has
104 * only the most-significant bit set, and the value has only the bit 104 * only the most-significant bit set, and the value has only the bit
105 * for the event's class set. The test_adder has the least significant 105 * for the event_id's class set. The test_adder has the least significant
106 * bit set in the field. 106 * bit set in the field.
107 * 107 *
108 * If an event is not subject to the constraint expressed by a particular 108 * If an event_id is not subject to the constraint expressed by a particular
109 * field, then it will have 0 in both the mask and value for that field. 109 * field, then it will have 0 in both the mask and value for that field.
110 */ 110 */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index ed24bd92fe49..c7d671a7d9a1 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -322,7 +322,7 @@ SYSCALL_SPU(epoll_create1)
322SYSCALL_SPU(dup3) 322SYSCALL_SPU(dup3)
323SYSCALL_SPU(pipe2) 323SYSCALL_SPU(pipe2)
324SYSCALL(inotify_init1) 324SYSCALL(inotify_init1)
325SYSCALL_SPU(perf_counter_open) 325SYSCALL_SPU(perf_event_open)
326COMPAT_SYS_SPU(preadv) 326COMPAT_SYS_SPU(preadv)
327COMPAT_SYS_SPU(pwritev) 327COMPAT_SYS_SPU(pwritev)
328COMPAT_SYS(rt_tgsigqueueinfo) 328COMPAT_SYS(rt_tgsigqueueinfo)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index cef080bfc607..f6ca76176766 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -341,7 +341,7 @@
341#define __NR_dup3 316 341#define __NR_dup3 316
342#define __NR_pipe2 317 342#define __NR_pipe2 317
343#define __NR_inotify_init1 318 343#define __NR_inotify_init1 318
344#define __NR_perf_counter_open 319 344#define __NR_perf_event_open 319
345#define __NR_preadv 320 345#define __NR_preadv 320
346#define __NR_pwritev 321 346#define __NR_pwritev 321
347#define __NR_rt_tgsigqueueinfo 322 347#define __NR_rt_tgsigqueueinfo 322
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 569f79ccd310..b23664a0b86c 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -97,7 +97,7 @@ obj64-$(CONFIG_AUDIT) += compat_audit.o
97 97
98obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 98obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
99obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 99obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
100obj-$(CONFIG_PPC_PERF_CTRS) += perf_counter.o perf_callchain.o 100obj-$(CONFIG_PPC_PERF_CTRS) += perf_event.o perf_callchain.o
101obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \ 101obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \
102 power5+-pmu.o power6-pmu.o power7-pmu.o 102 power5+-pmu.o power6-pmu.o power7-pmu.o
103obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o 103obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index f0df285f0f87..0812b0f414bb 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -133,7 +133,7 @@ int main(void)
133 DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); 133 DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
134 DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); 134 DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
135 DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); 135 DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled));
136 DEFINE(PACAPERFPEND, offsetof(struct paca_struct, perf_counter_pending)); 136 DEFINE(PACAPERFPEND, offsetof(struct paca_struct, perf_event_pending));
137 DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); 137 DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
138#ifdef CONFIG_PPC_MM_SLICES 138#ifdef CONFIG_PPC_MM_SLICES
139 DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, 139 DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct,
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 66bcda34a6bb..900e0eea0099 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -556,14 +556,14 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)
5562: 5562:
557 TRACE_AND_RESTORE_IRQ(r5); 557 TRACE_AND_RESTORE_IRQ(r5);
558 558
559#ifdef CONFIG_PERF_COUNTERS 559#ifdef CONFIG_PERF_EVENTS
560 /* check paca->perf_counter_pending if we're enabling ints */ 560 /* check paca->perf_event_pending if we're enabling ints */
561 lbz r3,PACAPERFPEND(r13) 561 lbz r3,PACAPERFPEND(r13)
562 and. r3,r3,r5 562 and. r3,r3,r5
563 beq 27f 563 beq 27f
564 bl .perf_counter_do_pending 564 bl .perf_event_do_pending
56527: 56527:
566#endif /* CONFIG_PERF_COUNTERS */ 566#endif /* CONFIG_PERF_EVENTS */
567 567
568 /* extract EE bit and use it to restore paca->hard_enabled */ 568 /* extract EE bit and use it to restore paca->hard_enabled */
569 ld r3,_MSR(r1) 569 ld r3,_MSR(r1)
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index f7f376ea7b17..e5d121177984 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -53,7 +53,7 @@
53#include <linux/bootmem.h> 53#include <linux/bootmem.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/debugfs.h> 55#include <linux/debugfs.h>
56#include <linux/perf_counter.h> 56#include <linux/perf_event.h>
57 57
58#include <asm/uaccess.h> 58#include <asm/uaccess.h>
59#include <asm/system.h> 59#include <asm/system.h>
@@ -138,9 +138,9 @@ notrace void raw_local_irq_restore(unsigned long en)
138 } 138 }
139#endif /* CONFIG_PPC_STD_MMU_64 */ 139#endif /* CONFIG_PPC_STD_MMU_64 */
140 140
141 if (test_perf_counter_pending()) { 141 if (test_perf_event_pending()) {
142 clear_perf_counter_pending(); 142 clear_perf_event_pending();
143 perf_counter_do_pending(); 143 perf_event_do_pending();
144 } 144 }
145 145
146 /* 146 /*
diff --git a/arch/powerpc/kernel/mpc7450-pmu.c b/arch/powerpc/kernel/mpc7450-pmu.c
index cc466d039af6..09d72028f317 100644
--- a/arch/powerpc/kernel/mpc7450-pmu.c
+++ b/arch/powerpc/kernel/mpc7450-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <asm/reg.h> 13#include <asm/reg.h>
14#include <asm/cputable.h> 14#include <asm/cputable.h>
15 15
diff --git a/arch/powerpc/kernel/perf_callchain.c b/arch/powerpc/kernel/perf_callchain.c
index f74b62c67511..0a03cf70d247 100644
--- a/arch/powerpc/kernel/perf_callchain.c
+++ b/arch/powerpc/kernel/perf_callchain.c
@@ -10,7 +10,7 @@
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/perf_counter.h> 13#include <linux/perf_event.h>
14#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/uaccess.h> 15#include <linux/uaccess.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_event.c
index 5ccf9bca96c0..bbcbae183e92 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Performance counter support - powerpc architecture code 2 * Performance event support - powerpc architecture code
3 * 3 *
4 * Copyright 2008-2009 Paul Mackerras, IBM Corporation. 4 * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
5 * 5 *
@@ -10,7 +10,7 @@
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/perf_counter.h> 13#include <linux/perf_event.h>
14#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/hardirq.h> 15#include <linux/hardirq.h>
16#include <asm/reg.h> 16#include <asm/reg.h>
@@ -19,24 +19,24 @@
19#include <asm/firmware.h> 19#include <asm/firmware.h>
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21 21
22struct cpu_hw_counters { 22struct cpu_hw_events {
23 int n_counters; 23 int n_events;
24 int n_percpu; 24 int n_percpu;
25 int disabled; 25 int disabled;
26 int n_added; 26 int n_added;
27 int n_limited; 27 int n_limited;
28 u8 pmcs_enabled; 28 u8 pmcs_enabled;
29 struct perf_counter *counter[MAX_HWCOUNTERS]; 29 struct perf_event *event[MAX_HWEVENTS];
30 u64 events[MAX_HWCOUNTERS]; 30 u64 events[MAX_HWEVENTS];
31 unsigned int flags[MAX_HWCOUNTERS]; 31 unsigned int flags[MAX_HWEVENTS];
32 unsigned long mmcr[3]; 32 unsigned long mmcr[3];
33 struct perf_counter *limited_counter[MAX_LIMITED_HWCOUNTERS]; 33 struct perf_event *limited_counter[MAX_LIMITED_HWCOUNTERS];
34 u8 limited_hwidx[MAX_LIMITED_HWCOUNTERS]; 34 u8 limited_hwidx[MAX_LIMITED_HWCOUNTERS];
35 u64 alternatives[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES]; 35 u64 alternatives[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
36 unsigned long amasks[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES]; 36 unsigned long amasks[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
37 unsigned long avalues[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES]; 37 unsigned long avalues[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
38}; 38};
39DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters); 39DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
40 40
41struct power_pmu *ppmu; 41struct power_pmu *ppmu;
42 42
@@ -47,7 +47,7 @@ struct power_pmu *ppmu;
47 * where the hypervisor bit is forced to 1 (as on Apple G5 processors), 47 * where the hypervisor bit is forced to 1 (as on Apple G5 processors),
48 * then we need to use the FCHV bit to ignore kernel events. 48 * then we need to use the FCHV bit to ignore kernel events.
49 */ 49 */
50static unsigned int freeze_counters_kernel = MMCR0_FCS; 50static unsigned int freeze_events_kernel = MMCR0_FCS;
51 51
52/* 52/*
53 * 32-bit doesn't have MMCRA but does have an MMCR2, 53 * 32-bit doesn't have MMCRA but does have an MMCR2,
@@ -122,14 +122,14 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
122 122
123 if (ppmu->flags & PPMU_ALT_SIPR) { 123 if (ppmu->flags & PPMU_ALT_SIPR) {
124 if (mmcra & POWER6_MMCRA_SIHV) 124 if (mmcra & POWER6_MMCRA_SIHV)
125 return PERF_EVENT_MISC_HYPERVISOR; 125 return PERF_RECORD_MISC_HYPERVISOR;
126 return (mmcra & POWER6_MMCRA_SIPR) ? 126 return (mmcra & POWER6_MMCRA_SIPR) ?
127 PERF_EVENT_MISC_USER : PERF_EVENT_MISC_KERNEL; 127 PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL;
128 } 128 }
129 if (mmcra & MMCRA_SIHV) 129 if (mmcra & MMCRA_SIHV)
130 return PERF_EVENT_MISC_HYPERVISOR; 130 return PERF_RECORD_MISC_HYPERVISOR;
131 return (mmcra & MMCRA_SIPR) ? PERF_EVENT_MISC_USER : 131 return (mmcra & MMCRA_SIPR) ? PERF_RECORD_MISC_USER :
132 PERF_EVENT_MISC_KERNEL; 132 PERF_RECORD_MISC_KERNEL;
133} 133}
134 134
135/* 135/*
@@ -152,9 +152,9 @@ static inline int perf_intr_is_nmi(struct pt_regs *regs)
152 152
153#endif /* CONFIG_PPC64 */ 153#endif /* CONFIG_PPC64 */
154 154
155static void perf_counter_interrupt(struct pt_regs *regs); 155static void perf_event_interrupt(struct pt_regs *regs);
156 156
157void perf_counter_print_debug(void) 157void perf_event_print_debug(void)
158{ 158{
159} 159}
160 160
@@ -240,15 +240,15 @@ static void write_pmc(int idx, unsigned long val)
240 * Check if a set of events can all go on the PMU at once. 240 * Check if a set of events can all go on the PMU at once.
241 * If they can't, this will look at alternative codes for the events 241 * If they can't, this will look at alternative codes for the events
242 * and see if any combination of alternative codes is feasible. 242 * and see if any combination of alternative codes is feasible.
243 * The feasible set is returned in event[]. 243 * The feasible set is returned in event_id[].
244 */ 244 */
245static int power_check_constraints(struct cpu_hw_counters *cpuhw, 245static int power_check_constraints(struct cpu_hw_events *cpuhw,
246 u64 event[], unsigned int cflags[], 246 u64 event_id[], unsigned int cflags[],
247 int n_ev) 247 int n_ev)
248{ 248{
249 unsigned long mask, value, nv; 249 unsigned long mask, value, nv;
250 unsigned long smasks[MAX_HWCOUNTERS], svalues[MAX_HWCOUNTERS]; 250 unsigned long smasks[MAX_HWEVENTS], svalues[MAX_HWEVENTS];
251 int n_alt[MAX_HWCOUNTERS], choice[MAX_HWCOUNTERS]; 251 int n_alt[MAX_HWEVENTS], choice[MAX_HWEVENTS];
252 int i, j; 252 int i, j;
253 unsigned long addf = ppmu->add_fields; 253 unsigned long addf = ppmu->add_fields;
254 unsigned long tadd = ppmu->test_adder; 254 unsigned long tadd = ppmu->test_adder;
@@ -259,12 +259,12 @@ static int power_check_constraints(struct cpu_hw_counters *cpuhw,
259 /* First see if the events will go on as-is */ 259 /* First see if the events will go on as-is */
260 for (i = 0; i < n_ev; ++i) { 260 for (i = 0; i < n_ev; ++i) {
261 if ((cflags[i] & PPMU_LIMITED_PMC_REQD) 261 if ((cflags[i] & PPMU_LIMITED_PMC_REQD)
262 && !ppmu->limited_pmc_event(event[i])) { 262 && !ppmu->limited_pmc_event(event_id[i])) {
263 ppmu->get_alternatives(event[i], cflags[i], 263 ppmu->get_alternatives(event_id[i], cflags[i],
264 cpuhw->alternatives[i]); 264 cpuhw->alternatives[i]);
265 event[i] = cpuhw->alternatives[i][0]; 265 event_id[i] = cpuhw->alternatives[i][0];
266 } 266 }
267 if (ppmu->get_constraint(event[i], &cpuhw->amasks[i][0], 267 if (ppmu->get_constraint(event_id[i], &cpuhw->amasks[i][0],
268 &cpuhw->avalues[i][0])) 268 &cpuhw->avalues[i][0]))
269 return -1; 269 return -1;
270 } 270 }
@@ -287,7 +287,7 @@ static int power_check_constraints(struct cpu_hw_counters *cpuhw,
287 return -1; 287 return -1;
288 for (i = 0; i < n_ev; ++i) { 288 for (i = 0; i < n_ev; ++i) {
289 choice[i] = 0; 289 choice[i] = 0;
290 n_alt[i] = ppmu->get_alternatives(event[i], cflags[i], 290 n_alt[i] = ppmu->get_alternatives(event_id[i], cflags[i],
291 cpuhw->alternatives[i]); 291 cpuhw->alternatives[i]);
292 for (j = 1; j < n_alt[i]; ++j) 292 for (j = 1; j < n_alt[i]; ++j)
293 ppmu->get_constraint(cpuhw->alternatives[i][j], 293 ppmu->get_constraint(cpuhw->alternatives[i][j],
@@ -307,7 +307,7 @@ static int power_check_constraints(struct cpu_hw_counters *cpuhw,
307 j = choice[i]; 307 j = choice[i];
308 } 308 }
309 /* 309 /*
310 * See if any alternative k for event i, 310 * See if any alternative k for event_id i,
311 * where k > j, will satisfy the constraints. 311 * where k > j, will satisfy the constraints.
312 */ 312 */
313 while (++j < n_alt[i]) { 313 while (++j < n_alt[i]) {
@@ -321,16 +321,16 @@ static int power_check_constraints(struct cpu_hw_counters *cpuhw,
321 if (j >= n_alt[i]) { 321 if (j >= n_alt[i]) {
322 /* 322 /*
323 * No feasible alternative, backtrack 323 * No feasible alternative, backtrack
324 * to event i-1 and continue enumerating its 324 * to event_id i-1 and continue enumerating its
325 * alternatives from where we got up to. 325 * alternatives from where we got up to.
326 */ 326 */
327 if (--i < 0) 327 if (--i < 0)
328 return -1; 328 return -1;
329 } else { 329 } else {
330 /* 330 /*
331 * Found a feasible alternative for event i, 331 * Found a feasible alternative for event_id i,
332 * remember where we got up to with this event, 332 * remember where we got up to with this event_id,
333 * go on to the next event, and start with 333 * go on to the next event_id, and start with
334 * the first alternative for it. 334 * the first alternative for it.
335 */ 335 */
336 choice[i] = j; 336 choice[i] = j;
@@ -345,21 +345,21 @@ static int power_check_constraints(struct cpu_hw_counters *cpuhw,
345 345
346 /* OK, we have a feasible combination, tell the caller the solution */ 346 /* OK, we have a feasible combination, tell the caller the solution */
347 for (i = 0; i < n_ev; ++i) 347 for (i = 0; i < n_ev; ++i)
348 event[i] = cpuhw->alternatives[i][choice[i]]; 348 event_id[i] = cpuhw->alternatives[i][choice[i]];
349 return 0; 349 return 0;
350} 350}
351 351
352/* 352/*
353 * Check if newly-added counters have consistent settings for 353 * Check if newly-added events have consistent settings for
354 * exclude_{user,kernel,hv} with each other and any previously 354 * exclude_{user,kernel,hv} with each other and any previously
355 * added counters. 355 * added events.
356 */ 356 */
357static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[], 357static int check_excludes(struct perf_event **ctrs, unsigned int cflags[],
358 int n_prev, int n_new) 358 int n_prev, int n_new)
359{ 359{
360 int eu = 0, ek = 0, eh = 0; 360 int eu = 0, ek = 0, eh = 0;
361 int i, n, first; 361 int i, n, first;
362 struct perf_counter *counter; 362 struct perf_event *event;
363 363
364 n = n_prev + n_new; 364 n = n_prev + n_new;
365 if (n <= 1) 365 if (n <= 1)
@@ -371,15 +371,15 @@ static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[],
371 cflags[i] &= ~PPMU_LIMITED_PMC_REQD; 371 cflags[i] &= ~PPMU_LIMITED_PMC_REQD;
372 continue; 372 continue;
373 } 373 }
374 counter = ctrs[i]; 374 event = ctrs[i];
375 if (first) { 375 if (first) {
376 eu = counter->attr.exclude_user; 376 eu = event->attr.exclude_user;
377 ek = counter->attr.exclude_kernel; 377 ek = event->attr.exclude_kernel;
378 eh = counter->attr.exclude_hv; 378 eh = event->attr.exclude_hv;
379 first = 0; 379 first = 0;
380 } else if (counter->attr.exclude_user != eu || 380 } else if (event->attr.exclude_user != eu ||
381 counter->attr.exclude_kernel != ek || 381 event->attr.exclude_kernel != ek ||
382 counter->attr.exclude_hv != eh) { 382 event->attr.exclude_hv != eh) {
383 return -EAGAIN; 383 return -EAGAIN;
384 } 384 }
385 } 385 }
@@ -392,11 +392,11 @@ static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[],
392 return 0; 392 return 0;
393} 393}
394 394
395static void power_pmu_read(struct perf_counter *counter) 395static void power_pmu_read(struct perf_event *event)
396{ 396{
397 s64 val, delta, prev; 397 s64 val, delta, prev;
398 398
399 if (!counter->hw.idx) 399 if (!event->hw.idx)
400 return; 400 return;
401 /* 401 /*
402 * Performance monitor interrupts come even when interrupts 402 * Performance monitor interrupts come even when interrupts
@@ -404,21 +404,21 @@ static void power_pmu_read(struct perf_counter *counter)
404 * Therefore we treat them like NMIs. 404 * Therefore we treat them like NMIs.
405 */ 405 */
406 do { 406 do {
407 prev = atomic64_read(&counter->hw.prev_count); 407 prev = atomic64_read(&event->hw.prev_count);
408 barrier(); 408 barrier();
409 val = read_pmc(counter->hw.idx); 409 val = read_pmc(event->hw.idx);
410 } while (atomic64_cmpxchg(&counter->hw.prev_count, prev, val) != prev); 410 } while (atomic64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
411 411
412 /* The counters are only 32 bits wide */ 412 /* The counters are only 32 bits wide */
413 delta = (val - prev) & 0xfffffffful; 413 delta = (val - prev) & 0xfffffffful;
414 atomic64_add(delta, &counter->count); 414 atomic64_add(delta, &event->count);
415 atomic64_sub(delta, &counter->hw.period_left); 415 atomic64_sub(delta, &event->hw.period_left);
416} 416}
417 417
418/* 418/*
419 * On some machines, PMC5 and PMC6 can't be written, don't respect 419 * On some machines, PMC5 and PMC6 can't be written, don't respect
420 * the freeze conditions, and don't generate interrupts. This tells 420 * the freeze conditions, and don't generate interrupts. This tells
421 * us if `counter' is using such a PMC. 421 * us if `event' is using such a PMC.
422 */ 422 */
423static int is_limited_pmc(int pmcnum) 423static int is_limited_pmc(int pmcnum)
424{ 424{
@@ -426,53 +426,53 @@ static int is_limited_pmc(int pmcnum)
426 && (pmcnum == 5 || pmcnum == 6); 426 && (pmcnum == 5 || pmcnum == 6);
427} 427}
428 428
429static void freeze_limited_counters(struct cpu_hw_counters *cpuhw, 429static void freeze_limited_counters(struct cpu_hw_events *cpuhw,
430 unsigned long pmc5, unsigned long pmc6) 430 unsigned long pmc5, unsigned long pmc6)
431{ 431{
432 struct perf_counter *counter; 432 struct perf_event *event;
433 u64 val, prev, delta; 433 u64 val, prev, delta;
434 int i; 434 int i;
435 435
436 for (i = 0; i < cpuhw->n_limited; ++i) { 436 for (i = 0; i < cpuhw->n_limited; ++i) {
437 counter = cpuhw->limited_counter[i]; 437 event = cpuhw->limited_counter[i];
438 if (!counter->hw.idx) 438 if (!event->hw.idx)
439 continue; 439 continue;
440 val = (counter->hw.idx == 5) ? pmc5 : pmc6; 440 val = (event->hw.idx == 5) ? pmc5 : pmc6;
441 prev = atomic64_read(&counter->hw.prev_count); 441 prev = atomic64_read(&event->hw.prev_count);
442 counter->hw.idx = 0; 442 event->hw.idx = 0;
443 delta = (val - prev) & 0xfffffffful; 443 delta = (val - prev) & 0xfffffffful;
444 atomic64_add(delta, &counter->count); 444 atomic64_add(delta, &event->count);
445 } 445 }
446} 446}
447 447
448static void thaw_limited_counters(struct cpu_hw_counters *cpuhw, 448static void thaw_limited_counters(struct cpu_hw_events *cpuhw,
449 unsigned long pmc5, unsigned long pmc6) 449 unsigned long pmc5, unsigned long pmc6)
450{ 450{
451 struct perf_counter *counter; 451 struct perf_event *event;
452 u64 val; 452 u64 val;
453 int i; 453 int i;
454 454
455 for (i = 0; i < cpuhw->n_limited; ++i) { 455 for (i = 0; i < cpuhw->n_limited; ++i) {
456 counter = cpuhw->limited_counter[i]; 456 event = cpuhw->limited_counter[i];
457 counter->hw.idx = cpuhw->limited_hwidx[i]; 457 event->hw.idx = cpuhw->limited_hwidx[i];
458 val = (counter->hw.idx == 5) ? pmc5 : pmc6; 458 val = (event->hw.idx == 5) ? pmc5 : pmc6;
459 atomic64_set(&counter->hw.prev_count, val); 459 atomic64_set(&event->hw.prev_count, val);
460 perf_counter_update_userpage(counter); 460 perf_event_update_userpage(event);
461 } 461 }
462} 462}
463 463
464/* 464/*
465 * Since limited counters don't respect the freeze conditions, we 465 * Since limited events don't respect the freeze conditions, we
466 * have to read them immediately after freezing or unfreezing the 466 * have to read them immediately after freezing or unfreezing the
467 * other counters. We try to keep the values from the limited 467 * other events. We try to keep the values from the limited
468 * counters as consistent as possible by keeping the delay (in 468 * events as consistent as possible by keeping the delay (in
469 * cycles and instructions) between freezing/unfreezing and reading 469 * cycles and instructions) between freezing/unfreezing and reading
470 * the limited counters as small and consistent as possible. 470 * the limited events as small and consistent as possible.
471 * Therefore, if any limited counters are in use, we read them 471 * Therefore, if any limited events are in use, we read them
472 * both, and always in the same order, to minimize variability, 472 * both, and always in the same order, to minimize variability,
473 * and do it inside the same asm that writes MMCR0. 473 * and do it inside the same asm that writes MMCR0.
474 */ 474 */
475static void write_mmcr0(struct cpu_hw_counters *cpuhw, unsigned long mmcr0) 475static void write_mmcr0(struct cpu_hw_events *cpuhw, unsigned long mmcr0)
476{ 476{
477 unsigned long pmc5, pmc6; 477 unsigned long pmc5, pmc6;
478 478
@@ -485,7 +485,7 @@ static void write_mmcr0(struct cpu_hw_counters *cpuhw, unsigned long mmcr0)
485 * Write MMCR0, then read PMC5 and PMC6 immediately. 485 * Write MMCR0, then read PMC5 and PMC6 immediately.
486 * To ensure we don't get a performance monitor interrupt 486 * To ensure we don't get a performance monitor interrupt
487 * between writing MMCR0 and freezing/thawing the limited 487 * between writing MMCR0 and freezing/thawing the limited
488 * counters, we first write MMCR0 with the counter overflow 488 * events, we first write MMCR0 with the event overflow
489 * interrupt enable bits turned off. 489 * interrupt enable bits turned off.
490 */ 490 */
491 asm volatile("mtspr %3,%2; mfspr %0,%4; mfspr %1,%5" 491 asm volatile("mtspr %3,%2; mfspr %0,%4; mfspr %1,%5"
@@ -500,7 +500,7 @@ static void write_mmcr0(struct cpu_hw_counters *cpuhw, unsigned long mmcr0)
500 thaw_limited_counters(cpuhw, pmc5, pmc6); 500 thaw_limited_counters(cpuhw, pmc5, pmc6);
501 501
502 /* 502 /*
503 * Write the full MMCR0 including the counter overflow interrupt 503 * Write the full MMCR0 including the event overflow interrupt
504 * enable bits, if necessary. 504 * enable bits, if necessary.
505 */ 505 */
506 if (mmcr0 & (MMCR0_PMC1CE | MMCR0_PMCjCE)) 506 if (mmcr0 & (MMCR0_PMC1CE | MMCR0_PMCjCE))
@@ -508,18 +508,18 @@ static void write_mmcr0(struct cpu_hw_counters *cpuhw, unsigned long mmcr0)
508} 508}
509 509
510/* 510/*
511 * Disable all counters to prevent PMU interrupts and to allow 511 * Disable all events to prevent PMU interrupts and to allow
512 * counters to be added or removed. 512 * events to be added or removed.
513 */ 513 */
514void hw_perf_disable(void) 514void hw_perf_disable(void)
515{ 515{
516 struct cpu_hw_counters *cpuhw; 516 struct cpu_hw_events *cpuhw;
517 unsigned long flags; 517 unsigned long flags;
518 518
519 if (!ppmu) 519 if (!ppmu)
520 return; 520 return;
521 local_irq_save(flags); 521 local_irq_save(flags);
522 cpuhw = &__get_cpu_var(cpu_hw_counters); 522 cpuhw = &__get_cpu_var(cpu_hw_events);
523 523
524 if (!cpuhw->disabled) { 524 if (!cpuhw->disabled) {
525 cpuhw->disabled = 1; 525 cpuhw->disabled = 1;
@@ -545,7 +545,7 @@ void hw_perf_disable(void)
545 /* 545 /*
546 * Set the 'freeze counters' bit. 546 * Set the 'freeze counters' bit.
547 * The barrier is to make sure the mtspr has been 547 * The barrier is to make sure the mtspr has been
548 * executed and the PMU has frozen the counters 548 * executed and the PMU has frozen the events
549 * before we return. 549 * before we return.
550 */ 550 */
551 write_mmcr0(cpuhw, mfspr(SPRN_MMCR0) | MMCR0_FC); 551 write_mmcr0(cpuhw, mfspr(SPRN_MMCR0) | MMCR0_FC);
@@ -555,26 +555,26 @@ void hw_perf_disable(void)
555} 555}
556 556
557/* 557/*
558 * Re-enable all counters if disable == 0. 558 * Re-enable all events if disable == 0.
559 * If we were previously disabled and counters were added, then 559 * If we were previously disabled and events were added, then
560 * put the new config on the PMU. 560 * put the new config on the PMU.
561 */ 561 */
562void hw_perf_enable(void) 562void hw_perf_enable(void)
563{ 563{
564 struct perf_counter *counter; 564 struct perf_event *event;
565 struct cpu_hw_counters *cpuhw; 565 struct cpu_hw_events *cpuhw;
566 unsigned long flags; 566 unsigned long flags;
567 long i; 567 long i;
568 unsigned long val; 568 unsigned long val;
569 s64 left; 569 s64 left;
570 unsigned int hwc_index[MAX_HWCOUNTERS]; 570 unsigned int hwc_index[MAX_HWEVENTS];
571 int n_lim; 571 int n_lim;
572 int idx; 572 int idx;
573 573
574 if (!ppmu) 574 if (!ppmu)
575 return; 575 return;
576 local_irq_save(flags); 576 local_irq_save(flags);
577 cpuhw = &__get_cpu_var(cpu_hw_counters); 577 cpuhw = &__get_cpu_var(cpu_hw_events);
578 if (!cpuhw->disabled) { 578 if (!cpuhw->disabled) {
579 local_irq_restore(flags); 579 local_irq_restore(flags);
580 return; 580 return;
@@ -582,23 +582,23 @@ void hw_perf_enable(void)
582 cpuhw->disabled = 0; 582 cpuhw->disabled = 0;
583 583
584 /* 584 /*
585 * If we didn't change anything, or only removed counters, 585 * If we didn't change anything, or only removed events,
586 * no need to recalculate MMCR* settings and reset the PMCs. 586 * no need to recalculate MMCR* settings and reset the PMCs.
587 * Just reenable the PMU with the current MMCR* settings 587 * Just reenable the PMU with the current MMCR* settings
588 * (possibly updated for removal of counters). 588 * (possibly updated for removal of events).
589 */ 589 */
590 if (!cpuhw->n_added) { 590 if (!cpuhw->n_added) {
591 mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE); 591 mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
592 mtspr(SPRN_MMCR1, cpuhw->mmcr[1]); 592 mtspr(SPRN_MMCR1, cpuhw->mmcr[1]);
593 if (cpuhw->n_counters == 0) 593 if (cpuhw->n_events == 0)
594 ppc_set_pmu_inuse(0); 594 ppc_set_pmu_inuse(0);
595 goto out_enable; 595 goto out_enable;
596 } 596 }
597 597
598 /* 598 /*
599 * Compute MMCR* values for the new set of counters 599 * Compute MMCR* values for the new set of events
600 */ 600 */
601 if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_counters, hwc_index, 601 if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index,
602 cpuhw->mmcr)) { 602 cpuhw->mmcr)) {
603 /* shouldn't ever get here */ 603 /* shouldn't ever get here */
604 printk(KERN_ERR "oops compute_mmcr failed\n"); 604 printk(KERN_ERR "oops compute_mmcr failed\n");
@@ -607,22 +607,22 @@ void hw_perf_enable(void)
607 607
608 /* 608 /*
609 * Add in MMCR0 freeze bits corresponding to the 609 * Add in MMCR0 freeze bits corresponding to the
610 * attr.exclude_* bits for the first counter. 610 * attr.exclude_* bits for the first event.
611 * We have already checked that all counters have the 611 * We have already checked that all events have the
612 * same values for these bits as the first counter. 612 * same values for these bits as the first event.
613 */ 613 */
614 counter = cpuhw->counter[0]; 614 event = cpuhw->event[0];
615 if (counter->attr.exclude_user) 615 if (event->attr.exclude_user)
616 cpuhw->mmcr[0] |= MMCR0_FCP; 616 cpuhw->mmcr[0] |= MMCR0_FCP;
617 if (counter->attr.exclude_kernel) 617 if (event->attr.exclude_kernel)
618 cpuhw->mmcr[0] |= freeze_counters_kernel; 618 cpuhw->mmcr[0] |= freeze_events_kernel;
619 if (counter->attr.exclude_hv) 619 if (event->attr.exclude_hv)
620 cpuhw->mmcr[0] |= MMCR0_FCHV; 620 cpuhw->mmcr[0] |= MMCR0_FCHV;
621 621
622 /* 622 /*
623 * Write the new configuration to MMCR* with the freeze 623 * Write the new configuration to MMCR* with the freeze
624 * bit set and set the hardware counters to their initial values. 624 * bit set and set the hardware events to their initial values.
625 * Then unfreeze the counters. 625 * Then unfreeze the events.
626 */ 626 */
627 ppc_set_pmu_inuse(1); 627 ppc_set_pmu_inuse(1);
628 mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE); 628 mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
@@ -631,43 +631,43 @@ void hw_perf_enable(void)
631 | MMCR0_FC); 631 | MMCR0_FC);
632 632
633 /* 633 /*
634 * Read off any pre-existing counters that need to move 634 * Read off any pre-existing events that need to move
635 * to another PMC. 635 * to another PMC.
636 */ 636 */
637 for (i = 0; i < cpuhw->n_counters; ++i) { 637 for (i = 0; i < cpuhw->n_events; ++i) {
638 counter = cpuhw->counter[i]; 638 event = cpuhw->event[i];
639 if (counter->hw.idx && counter->hw.idx != hwc_index[i] + 1) { 639 if (event->hw.idx && event->hw.idx != hwc_index[i] + 1) {
640 power_pmu_read(counter); 640 power_pmu_read(event);
641 write_pmc(counter->hw.idx, 0); 641 write_pmc(event->hw.idx, 0);
642 counter->hw.idx = 0; 642 event->hw.idx = 0;
643 } 643 }
644 } 644 }
645 645
646 /* 646 /*
647 * Initialize the PMCs for all the new and moved counters. 647 * Initialize the PMCs for all the new and moved events.
648 */ 648 */
649 cpuhw->n_limited = n_lim = 0; 649 cpuhw->n_limited = n_lim = 0;
650 for (i = 0; i < cpuhw->n_counters; ++i) { 650 for (i = 0; i < cpuhw->n_events; ++i) {
651 counter = cpuhw->counter[i]; 651 event = cpuhw->event[i];
652 if (counter->hw.idx) 652 if (event->hw.idx)
653 continue; 653 continue;
654 idx = hwc_index[i] + 1; 654 idx = hwc_index[i] + 1;
655 if (is_limited_pmc(idx)) { 655 if (is_limited_pmc(idx)) {
656 cpuhw->limited_counter[n_lim] = counter; 656 cpuhw->limited_counter[n_lim] = event;
657 cpuhw->limited_hwidx[n_lim] = idx; 657 cpuhw->limited_hwidx[n_lim] = idx;
658 ++n_lim; 658 ++n_lim;
659 continue; 659 continue;
660 } 660 }
661 val = 0; 661 val = 0;
662 if (counter->hw.sample_period) { 662 if (event->hw.sample_period) {
663 left = atomic64_read(&counter->hw.period_left); 663 left = atomic64_read(&event->hw.period_left);
664 if (left < 0x80000000L) 664 if (left < 0x80000000L)
665 val = 0x80000000L - left; 665 val = 0x80000000L - left;
666 } 666 }
667 atomic64_set(&counter->hw.prev_count, val); 667 atomic64_set(&event->hw.prev_count, val);
668 counter->hw.idx = idx; 668 event->hw.idx = idx;
669 write_pmc(idx, val); 669 write_pmc(idx, val);
670 perf_counter_update_userpage(counter); 670 perf_event_update_userpage(event);
671 } 671 }
672 cpuhw->n_limited = n_lim; 672 cpuhw->n_limited = n_lim;
673 cpuhw->mmcr[0] |= MMCR0_PMXE | MMCR0_FCECE; 673 cpuhw->mmcr[0] |= MMCR0_PMXE | MMCR0_FCECE;
@@ -688,85 +688,85 @@ void hw_perf_enable(void)
688 local_irq_restore(flags); 688 local_irq_restore(flags);
689} 689}
690 690
691static int collect_events(struct perf_counter *group, int max_count, 691static int collect_events(struct perf_event *group, int max_count,
692 struct perf_counter *ctrs[], u64 *events, 692 struct perf_event *ctrs[], u64 *events,
693 unsigned int *flags) 693 unsigned int *flags)
694{ 694{
695 int n = 0; 695 int n = 0;
696 struct perf_counter *counter; 696 struct perf_event *event;
697 697
698 if (!is_software_counter(group)) { 698 if (!is_software_event(group)) {
699 if (n >= max_count) 699 if (n >= max_count)
700 return -1; 700 return -1;
701 ctrs[n] = group; 701 ctrs[n] = group;
702 flags[n] = group->hw.counter_base; 702 flags[n] = group->hw.event_base;
703 events[n++] = group->hw.config; 703 events[n++] = group->hw.config;
704 } 704 }
705 list_for_each_entry(counter, &group->sibling_list, list_entry) { 705 list_for_each_entry(event, &group->sibling_list, group_entry) {
706 if (!is_software_counter(counter) && 706 if (!is_software_event(event) &&
707 counter->state != PERF_COUNTER_STATE_OFF) { 707 event->state != PERF_EVENT_STATE_OFF) {
708 if (n >= max_count) 708 if (n >= max_count)
709 return -1; 709 return -1;
710 ctrs[n] = counter; 710 ctrs[n] = event;
711 flags[n] = counter->hw.counter_base; 711 flags[n] = event->hw.event_base;
712 events[n++] = counter->hw.config; 712 events[n++] = event->hw.config;
713 } 713 }
714 } 714 }
715 return n; 715 return n;
716} 716}
717 717
718static void counter_sched_in(struct perf_counter *counter, int cpu) 718static void event_sched_in(struct perf_event *event, int cpu)
719{ 719{
720 counter->state = PERF_COUNTER_STATE_ACTIVE; 720 event->state = PERF_EVENT_STATE_ACTIVE;
721 counter->oncpu = cpu; 721 event->oncpu = cpu;
722 counter->tstamp_running += counter->ctx->time - counter->tstamp_stopped; 722 event->tstamp_running += event->ctx->time - event->tstamp_stopped;
723 if (is_software_counter(counter)) 723 if (is_software_event(event))
724 counter->pmu->enable(counter); 724 event->pmu->enable(event);
725} 725}
726 726
727/* 727/*
728 * Called to enable a whole group of counters. 728 * Called to enable a whole group of events.
729 * Returns 1 if the group was enabled, or -EAGAIN if it could not be. 729 * Returns 1 if the group was enabled, or -EAGAIN if it could not be.
730 * Assumes the caller has disabled interrupts and has 730 * Assumes the caller has disabled interrupts and has
731 * frozen the PMU with hw_perf_save_disable. 731 * frozen the PMU with hw_perf_save_disable.
732 */ 732 */
733int hw_perf_group_sched_in(struct perf_counter *group_leader, 733int hw_perf_group_sched_in(struct perf_event *group_leader,
734 struct perf_cpu_context *cpuctx, 734 struct perf_cpu_context *cpuctx,
735 struct perf_counter_context *ctx, int cpu) 735 struct perf_event_context *ctx, int cpu)
736{ 736{
737 struct cpu_hw_counters *cpuhw; 737 struct cpu_hw_events *cpuhw;
738 long i, n, n0; 738 long i, n, n0;
739 struct perf_counter *sub; 739 struct perf_event *sub;
740 740
741 if (!ppmu) 741 if (!ppmu)
742 return 0; 742 return 0;
743 cpuhw = &__get_cpu_var(cpu_hw_counters); 743 cpuhw = &__get_cpu_var(cpu_hw_events);
744 n0 = cpuhw->n_counters; 744 n0 = cpuhw->n_events;
745 n = collect_events(group_leader, ppmu->n_counter - n0, 745 n = collect_events(group_leader, ppmu->n_counter - n0,
746 &cpuhw->counter[n0], &cpuhw->events[n0], 746 &cpuhw->event[n0], &cpuhw->events[n0],
747 &cpuhw->flags[n0]); 747 &cpuhw->flags[n0]);
748 if (n < 0) 748 if (n < 0)
749 return -EAGAIN; 749 return -EAGAIN;
750 if (check_excludes(cpuhw->counter, cpuhw->flags, n0, n)) 750 if (check_excludes(cpuhw->event, cpuhw->flags, n0, n))
751 return -EAGAIN; 751 return -EAGAIN;
752 i = power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n + n0); 752 i = power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n + n0);
753 if (i < 0) 753 if (i < 0)
754 return -EAGAIN; 754 return -EAGAIN;
755 cpuhw->n_counters = n0 + n; 755 cpuhw->n_events = n0 + n;
756 cpuhw->n_added += n; 756 cpuhw->n_added += n;
757 757
758 /* 758 /*
759 * OK, this group can go on; update counter states etc., 759 * OK, this group can go on; update event states etc.,
760 * and enable any software counters 760 * and enable any software events
761 */ 761 */
762 for (i = n0; i < n0 + n; ++i) 762 for (i = n0; i < n0 + n; ++i)
763 cpuhw->counter[i]->hw.config = cpuhw->events[i]; 763 cpuhw->event[i]->hw.config = cpuhw->events[i];
764 cpuctx->active_oncpu += n; 764 cpuctx->active_oncpu += n;
765 n = 1; 765 n = 1;
766 counter_sched_in(group_leader, cpu); 766 event_sched_in(group_leader, cpu);
767 list_for_each_entry(sub, &group_leader->sibling_list, list_entry) { 767 list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
768 if (sub->state != PERF_COUNTER_STATE_OFF) { 768 if (sub->state != PERF_EVENT_STATE_OFF) {
769 counter_sched_in(sub, cpu); 769 event_sched_in(sub, cpu);
770 ++n; 770 ++n;
771 } 771 }
772 } 772 }
@@ -776,14 +776,14 @@ int hw_perf_group_sched_in(struct perf_counter *group_leader,
776} 776}
777 777
778/* 778/*
779 * Add a counter to the PMU. 779 * Add a event to the PMU.
780 * If all counters are not already frozen, then we disable and 780 * If all events are not already frozen, then we disable and
781 * re-enable the PMU in order to get hw_perf_enable to do the 781 * re-enable the PMU in order to get hw_perf_enable to do the
782 * actual work of reconfiguring the PMU. 782 * actual work of reconfiguring the PMU.
783 */ 783 */
784static int power_pmu_enable(struct perf_counter *counter) 784static int power_pmu_enable(struct perf_event *event)
785{ 785{
786 struct cpu_hw_counters *cpuhw; 786 struct cpu_hw_events *cpuhw;
787 unsigned long flags; 787 unsigned long flags;
788 int n0; 788 int n0;
789 int ret = -EAGAIN; 789 int ret = -EAGAIN;
@@ -792,23 +792,23 @@ static int power_pmu_enable(struct perf_counter *counter)
792 perf_disable(); 792 perf_disable();
793 793
794 /* 794 /*
795 * Add the counter to the list (if there is room) 795 * Add the event to the list (if there is room)
796 * and check whether the total set is still feasible. 796 * and check whether the total set is still feasible.
797 */ 797 */
798 cpuhw = &__get_cpu_var(cpu_hw_counters); 798 cpuhw = &__get_cpu_var(cpu_hw_events);
799 n0 = cpuhw->n_counters; 799 n0 = cpuhw->n_events;
800 if (n0 >= ppmu->n_counter) 800 if (n0 >= ppmu->n_counter)
801 goto out; 801 goto out;
802 cpuhw->counter[n0] = counter; 802 cpuhw->event[n0] = event;
803 cpuhw->events[n0] = counter->hw.config; 803 cpuhw->events[n0] = event->hw.config;
804 cpuhw->flags[n0] = counter->hw.counter_base; 804 cpuhw->flags[n0] = event->hw.event_base;
805 if (check_excludes(cpuhw->counter, cpuhw->flags, n0, 1)) 805 if (check_excludes(cpuhw->event, cpuhw->flags, n0, 1))
806 goto out; 806 goto out;
807 if (power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n0 + 1)) 807 if (power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n0 + 1))
808 goto out; 808 goto out;
809 809
810 counter->hw.config = cpuhw->events[n0]; 810 event->hw.config = cpuhw->events[n0];
811 ++cpuhw->n_counters; 811 ++cpuhw->n_events;
812 ++cpuhw->n_added; 812 ++cpuhw->n_added;
813 813
814 ret = 0; 814 ret = 0;
@@ -819,36 +819,36 @@ static int power_pmu_enable(struct perf_counter *counter)
819} 819}
820 820
821/* 821/*
822 * Remove a counter from the PMU. 822 * Remove a event from the PMU.
823 */ 823 */
824static void power_pmu_disable(struct perf_counter *counter) 824static void power_pmu_disable(struct perf_event *event)
825{ 825{
826 struct cpu_hw_counters *cpuhw; 826 struct cpu_hw_events *cpuhw;
827 long i; 827 long i;
828 unsigned long flags; 828 unsigned long flags;
829 829
830 local_irq_save(flags); 830 local_irq_save(flags);
831 perf_disable(); 831 perf_disable();
832 832
833 power_pmu_read(counter); 833 power_pmu_read(event);
834 834
835 cpuhw = &__get_cpu_var(cpu_hw_counters); 835 cpuhw = &__get_cpu_var(cpu_hw_events);
836 for (i = 0; i < cpuhw->n_counters; ++i) { 836 for (i = 0; i < cpuhw->n_events; ++i) {
837 if (counter == cpuhw->counter[i]) { 837 if (event == cpuhw->event[i]) {
838 while (++i < cpuhw->n_counters) 838 while (++i < cpuhw->n_events)
839 cpuhw->counter[i-1] = cpuhw->counter[i]; 839 cpuhw->event[i-1] = cpuhw->event[i];
840 --cpuhw->n_counters; 840 --cpuhw->n_events;
841 ppmu->disable_pmc(counter->hw.idx - 1, cpuhw->mmcr); 841 ppmu->disable_pmc(event->hw.idx - 1, cpuhw->mmcr);
842 if (counter->hw.idx) { 842 if (event->hw.idx) {
843 write_pmc(counter->hw.idx, 0); 843 write_pmc(event->hw.idx, 0);
844 counter->hw.idx = 0; 844 event->hw.idx = 0;
845 } 845 }
846 perf_counter_update_userpage(counter); 846 perf_event_update_userpage(event);
847 break; 847 break;
848 } 848 }
849 } 849 }
850 for (i = 0; i < cpuhw->n_limited; ++i) 850 for (i = 0; i < cpuhw->n_limited; ++i)
851 if (counter == cpuhw->limited_counter[i]) 851 if (event == cpuhw->limited_counter[i])
852 break; 852 break;
853 if (i < cpuhw->n_limited) { 853 if (i < cpuhw->n_limited) {
854 while (++i < cpuhw->n_limited) { 854 while (++i < cpuhw->n_limited) {
@@ -857,8 +857,8 @@ static void power_pmu_disable(struct perf_counter *counter)
857 } 857 }
858 --cpuhw->n_limited; 858 --cpuhw->n_limited;
859 } 859 }
860 if (cpuhw->n_counters == 0) { 860 if (cpuhw->n_events == 0) {
861 /* disable exceptions if no counters are running */ 861 /* disable exceptions if no events are running */
862 cpuhw->mmcr[0] &= ~(MMCR0_PMXE | MMCR0_FCECE); 862 cpuhw->mmcr[0] &= ~(MMCR0_PMXE | MMCR0_FCECE);
863 } 863 }
864 864
@@ -867,28 +867,28 @@ static void power_pmu_disable(struct perf_counter *counter)
867} 867}
868 868
869/* 869/*
870 * Re-enable interrupts on a counter after they were throttled 870 * Re-enable interrupts on a event after they were throttled
871 * because they were coming too fast. 871 * because they were coming too fast.
872 */ 872 */
873static void power_pmu_unthrottle(struct perf_counter *counter) 873static void power_pmu_unthrottle(struct perf_event *event)
874{ 874{
875 s64 val, left; 875 s64 val, left;
876 unsigned long flags; 876 unsigned long flags;
877 877
878 if (!counter->hw.idx || !counter->hw.sample_period) 878 if (!event->hw.idx || !event->hw.sample_period)
879 return; 879 return;
880 local_irq_save(flags); 880 local_irq_save(flags);
881 perf_disable(); 881 perf_disable();
882 power_pmu_read(counter); 882 power_pmu_read(event);
883 left = counter->hw.sample_period; 883 left = event->hw.sample_period;
884 counter->hw.last_period = left; 884 event->hw.last_period = left;
885 val = 0; 885 val = 0;
886 if (left < 0x80000000L) 886 if (left < 0x80000000L)
887 val = 0x80000000L - left; 887 val = 0x80000000L - left;
888 write_pmc(counter->hw.idx, val); 888 write_pmc(event->hw.idx, val);
889 atomic64_set(&counter->hw.prev_count, val); 889 atomic64_set(&event->hw.prev_count, val);
890 atomic64_set(&counter->hw.period_left, left); 890 atomic64_set(&event->hw.period_left, left);
891 perf_counter_update_userpage(counter); 891 perf_event_update_userpage(event);
892 perf_enable(); 892 perf_enable();
893 local_irq_restore(flags); 893 local_irq_restore(flags);
894} 894}
@@ -901,29 +901,29 @@ struct pmu power_pmu = {
901}; 901};
902 902
903/* 903/*
904 * Return 1 if we might be able to put counter on a limited PMC, 904 * Return 1 if we might be able to put event on a limited PMC,
905 * or 0 if not. 905 * or 0 if not.
906 * A counter can only go on a limited PMC if it counts something 906 * A event can only go on a limited PMC if it counts something
907 * that a limited PMC can count, doesn't require interrupts, and 907 * that a limited PMC can count, doesn't require interrupts, and
908 * doesn't exclude any processor mode. 908 * doesn't exclude any processor mode.
909 */ 909 */
910static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev, 910static int can_go_on_limited_pmc(struct perf_event *event, u64 ev,
911 unsigned int flags) 911 unsigned int flags)
912{ 912{
913 int n; 913 int n;
914 u64 alt[MAX_EVENT_ALTERNATIVES]; 914 u64 alt[MAX_EVENT_ALTERNATIVES];
915 915
916 if (counter->attr.exclude_user 916 if (event->attr.exclude_user
917 || counter->attr.exclude_kernel 917 || event->attr.exclude_kernel
918 || counter->attr.exclude_hv 918 || event->attr.exclude_hv
919 || counter->attr.sample_period) 919 || event->attr.sample_period)
920 return 0; 920 return 0;
921 921
922 if (ppmu->limited_pmc_event(ev)) 922 if (ppmu->limited_pmc_event(ev))
923 return 1; 923 return 1;
924 924
925 /* 925 /*
926 * The requested event isn't on a limited PMC already; 926 * The requested event_id isn't on a limited PMC already;
927 * see if any alternative code goes on a limited PMC. 927 * see if any alternative code goes on a limited PMC.
928 */ 928 */
929 if (!ppmu->get_alternatives) 929 if (!ppmu->get_alternatives)
@@ -936,9 +936,9 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev,
936} 936}
937 937
938/* 938/*
939 * Find an alternative event that goes on a normal PMC, if possible, 939 * Find an alternative event_id that goes on a normal PMC, if possible,
940 * and return the event code, or 0 if there is no such alternative. 940 * and return the event_id code, or 0 if there is no such alternative.
941 * (Note: event code 0 is "don't count" on all machines.) 941 * (Note: event_id code 0 is "don't count" on all machines.)
942 */ 942 */
943static u64 normal_pmc_alternative(u64 ev, unsigned long flags) 943static u64 normal_pmc_alternative(u64 ev, unsigned long flags)
944{ 944{
@@ -952,26 +952,26 @@ static u64 normal_pmc_alternative(u64 ev, unsigned long flags)
952 return alt[0]; 952 return alt[0];
953} 953}
954 954
955/* Number of perf_counters counting hardware events */ 955/* Number of perf_events counting hardware events */
956static atomic_t num_counters; 956static atomic_t num_events;
957/* Used to avoid races in calling reserve/release_pmc_hardware */ 957/* Used to avoid races in calling reserve/release_pmc_hardware */
958static DEFINE_MUTEX(pmc_reserve_mutex); 958static DEFINE_MUTEX(pmc_reserve_mutex);
959 959
960/* 960/*
961 * Release the PMU if this is the last perf_counter. 961 * Release the PMU if this is the last perf_event.
962 */ 962 */
963static void hw_perf_counter_destroy(struct perf_counter *counter) 963static void hw_perf_event_destroy(struct perf_event *event)
964{ 964{
965 if (!atomic_add_unless(&num_counters, -1, 1)) { 965 if (!atomic_add_unless(&num_events, -1, 1)) {
966 mutex_lock(&pmc_reserve_mutex); 966 mutex_lock(&pmc_reserve_mutex);
967 if (atomic_dec_return(&num_counters) == 0) 967 if (atomic_dec_return(&num_events) == 0)
968 release_pmc_hardware(); 968 release_pmc_hardware();
969 mutex_unlock(&pmc_reserve_mutex); 969 mutex_unlock(&pmc_reserve_mutex);
970 } 970 }
971} 971}
972 972
973/* 973/*
974 * Translate a generic cache event config to a raw event code. 974 * Translate a generic cache event_id config to a raw event_id code.
975 */ 975 */
976static int hw_perf_cache_event(u64 config, u64 *eventp) 976static int hw_perf_cache_event(u64 config, u64 *eventp)
977{ 977{
@@ -1000,39 +1000,39 @@ static int hw_perf_cache_event(u64 config, u64 *eventp)
1000 return 0; 1000 return 0;
1001} 1001}
1002 1002
1003const struct pmu *hw_perf_counter_init(struct perf_counter *counter) 1003const struct pmu *hw_perf_event_init(struct perf_event *event)
1004{ 1004{
1005 u64 ev; 1005 u64 ev;
1006 unsigned long flags; 1006 unsigned long flags;
1007 struct perf_counter *ctrs[MAX_HWCOUNTERS]; 1007 struct perf_event *ctrs[MAX_HWEVENTS];
1008 u64 events[MAX_HWCOUNTERS]; 1008 u64 events[MAX_HWEVENTS];
1009 unsigned int cflags[MAX_HWCOUNTERS]; 1009 unsigned int cflags[MAX_HWEVENTS];
1010 int n; 1010 int n;
1011 int err; 1011 int err;
1012 struct cpu_hw_counters *cpuhw; 1012 struct cpu_hw_events *cpuhw;
1013 1013
1014 if (!ppmu) 1014 if (!ppmu)
1015 return ERR_PTR(-ENXIO); 1015 return ERR_PTR(-ENXIO);
1016 switch (counter->attr.type) { 1016 switch (event->attr.type) {
1017 case PERF_TYPE_HARDWARE: 1017 case PERF_TYPE_HARDWARE:
1018 ev = counter->attr.config; 1018 ev = event->attr.config;
1019 if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0) 1019 if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
1020 return ERR_PTR(-EOPNOTSUPP); 1020 return ERR_PTR(-EOPNOTSUPP);
1021 ev = ppmu->generic_events[ev]; 1021 ev = ppmu->generic_events[ev];
1022 break; 1022 break;
1023 case PERF_TYPE_HW_CACHE: 1023 case PERF_TYPE_HW_CACHE:
1024 err = hw_perf_cache_event(counter->attr.config, &ev); 1024 err = hw_perf_cache_event(event->attr.config, &ev);
1025 if (err) 1025 if (err)
1026 return ERR_PTR(err); 1026 return ERR_PTR(err);
1027 break; 1027 break;
1028 case PERF_TYPE_RAW: 1028 case PERF_TYPE_RAW:
1029 ev = counter->attr.config; 1029 ev = event->attr.config;
1030 break; 1030 break;
1031 default: 1031 default:
1032 return ERR_PTR(-EINVAL); 1032 return ERR_PTR(-EINVAL);
1033 } 1033 }
1034 counter->hw.config_base = ev; 1034 event->hw.config_base = ev;
1035 counter->hw.idx = 0; 1035 event->hw.idx = 0;
1036 1036
1037 /* 1037 /*
1038 * If we are not running on a hypervisor, force the 1038 * If we are not running on a hypervisor, force the
@@ -1040,28 +1040,28 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
1040 * the user set it to. 1040 * the user set it to.
1041 */ 1041 */
1042 if (!firmware_has_feature(FW_FEATURE_LPAR)) 1042 if (!firmware_has_feature(FW_FEATURE_LPAR))
1043 counter->attr.exclude_hv = 0; 1043 event->attr.exclude_hv = 0;
1044 1044
1045 /* 1045 /*
1046 * If this is a per-task counter, then we can use 1046 * If this is a per-task event, then we can use
1047 * PM_RUN_* events interchangeably with their non RUN_* 1047 * PM_RUN_* events interchangeably with their non RUN_*
1048 * equivalents, e.g. PM_RUN_CYC instead of PM_CYC. 1048 * equivalents, e.g. PM_RUN_CYC instead of PM_CYC.
1049 * XXX we should check if the task is an idle task. 1049 * XXX we should check if the task is an idle task.
1050 */ 1050 */
1051 flags = 0; 1051 flags = 0;
1052 if (counter->ctx->task) 1052 if (event->ctx->task)
1053 flags |= PPMU_ONLY_COUNT_RUN; 1053 flags |= PPMU_ONLY_COUNT_RUN;
1054 1054
1055 /* 1055 /*
1056 * If this machine has limited counters, check whether this 1056 * If this machine has limited events, check whether this
1057 * event could go on a limited counter. 1057 * event_id could go on a limited event.
1058 */ 1058 */
1059 if (ppmu->flags & PPMU_LIMITED_PMC5_6) { 1059 if (ppmu->flags & PPMU_LIMITED_PMC5_6) {
1060 if (can_go_on_limited_pmc(counter, ev, flags)) { 1060 if (can_go_on_limited_pmc(event, ev, flags)) {
1061 flags |= PPMU_LIMITED_PMC_OK; 1061 flags |= PPMU_LIMITED_PMC_OK;
1062 } else if (ppmu->limited_pmc_event(ev)) { 1062 } else if (ppmu->limited_pmc_event(ev)) {
1063 /* 1063 /*
1064 * The requested event is on a limited PMC, 1064 * The requested event_id is on a limited PMC,
1065 * but we can't use a limited PMC; see if any 1065 * but we can't use a limited PMC; see if any
1066 * alternative goes on a normal PMC. 1066 * alternative goes on a normal PMC.
1067 */ 1067 */
@@ -1073,50 +1073,50 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
1073 1073
1074 /* 1074 /*
1075 * If this is in a group, check if it can go on with all the 1075 * If this is in a group, check if it can go on with all the
1076 * other hardware counters in the group. We assume the counter 1076 * other hardware events in the group. We assume the event
1077 * hasn't been linked into its leader's sibling list at this point. 1077 * hasn't been linked into its leader's sibling list at this point.
1078 */ 1078 */
1079 n = 0; 1079 n = 0;
1080 if (counter->group_leader != counter) { 1080 if (event->group_leader != event) {
1081 n = collect_events(counter->group_leader, ppmu->n_counter - 1, 1081 n = collect_events(event->group_leader, ppmu->n_counter - 1,
1082 ctrs, events, cflags); 1082 ctrs, events, cflags);
1083 if (n < 0) 1083 if (n < 0)
1084 return ERR_PTR(-EINVAL); 1084 return ERR_PTR(-EINVAL);
1085 } 1085 }
1086 events[n] = ev; 1086 events[n] = ev;
1087 ctrs[n] = counter; 1087 ctrs[n] = event;
1088 cflags[n] = flags; 1088 cflags[n] = flags;
1089 if (check_excludes(ctrs, cflags, n, 1)) 1089 if (check_excludes(ctrs, cflags, n, 1))
1090 return ERR_PTR(-EINVAL); 1090 return ERR_PTR(-EINVAL);
1091 1091
1092 cpuhw = &get_cpu_var(cpu_hw_counters); 1092 cpuhw = &get_cpu_var(cpu_hw_events);
1093 err = power_check_constraints(cpuhw, events, cflags, n + 1); 1093 err = power_check_constraints(cpuhw, events, cflags, n + 1);
1094 put_cpu_var(cpu_hw_counters); 1094 put_cpu_var(cpu_hw_events);
1095 if (err) 1095 if (err)
1096 return ERR_PTR(-EINVAL); 1096 return ERR_PTR(-EINVAL);
1097 1097
1098 counter->hw.config = events[n]; 1098 event->hw.config = events[n];
1099 counter->hw.counter_base = cflags[n]; 1099 event->hw.event_base = cflags[n];
1100 counter->hw.last_period = counter->hw.sample_period; 1100 event->hw.last_period = event->hw.sample_period;
1101 atomic64_set(&counter->hw.period_left, counter->hw.last_period); 1101 atomic64_set(&event->hw.period_left, event->hw.last_period);
1102 1102
1103 /* 1103 /*
1104 * See if we need to reserve the PMU. 1104 * See if we need to reserve the PMU.
1105 * If no counters are currently in use, then we have to take a 1105 * If no events are currently in use, then we have to take a
1106 * mutex to ensure that we don't race with another task doing 1106 * mutex to ensure that we don't race with another task doing
1107 * reserve_pmc_hardware or release_pmc_hardware. 1107 * reserve_pmc_hardware or release_pmc_hardware.
1108 */ 1108 */
1109 err = 0; 1109 err = 0;
1110 if (!atomic_inc_not_zero(&num_counters)) { 1110 if (!atomic_inc_not_zero(&num_events)) {
1111 mutex_lock(&pmc_reserve_mutex); 1111 mutex_lock(&pmc_reserve_mutex);
1112 if (atomic_read(&num_counters) == 0 && 1112 if (atomic_read(&num_events) == 0 &&
1113 reserve_pmc_hardware(perf_counter_interrupt)) 1113 reserve_pmc_hardware(perf_event_interrupt))
1114 err = -EBUSY; 1114 err = -EBUSY;
1115 else 1115 else
1116 atomic_inc(&num_counters); 1116 atomic_inc(&num_events);
1117 mutex_unlock(&pmc_reserve_mutex); 1117 mutex_unlock(&pmc_reserve_mutex);
1118 } 1118 }
1119 counter->destroy = hw_perf_counter_destroy; 1119 event->destroy = hw_perf_event_destroy;
1120 1120
1121 if (err) 1121 if (err)
1122 return ERR_PTR(err); 1122 return ERR_PTR(err);
@@ -1128,24 +1128,24 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
1128 * things if requested. Note that interrupts are hard-disabled 1128 * things if requested. Note that interrupts are hard-disabled
1129 * here so there is no possibility of being interrupted. 1129 * here so there is no possibility of being interrupted.
1130 */ 1130 */
1131static void record_and_restart(struct perf_counter *counter, unsigned long val, 1131static void record_and_restart(struct perf_event *event, unsigned long val,
1132 struct pt_regs *regs, int nmi) 1132 struct pt_regs *regs, int nmi)
1133{ 1133{
1134 u64 period = counter->hw.sample_period; 1134 u64 period = event->hw.sample_period;
1135 s64 prev, delta, left; 1135 s64 prev, delta, left;
1136 int record = 0; 1136 int record = 0;
1137 1137
1138 /* we don't have to worry about interrupts here */ 1138 /* we don't have to worry about interrupts here */
1139 prev = atomic64_read(&counter->hw.prev_count); 1139 prev = atomic64_read(&event->hw.prev_count);
1140 delta = (val - prev) & 0xfffffffful; 1140 delta = (val - prev) & 0xfffffffful;
1141 atomic64_add(delta, &counter->count); 1141 atomic64_add(delta, &event->count);
1142 1142
1143 /* 1143 /*
1144 * See if the total period for this counter has expired, 1144 * See if the total period for this event has expired,
1145 * and update for the next period. 1145 * and update for the next period.
1146 */ 1146 */
1147 val = 0; 1147 val = 0;
1148 left = atomic64_read(&counter->hw.period_left) - delta; 1148 left = atomic64_read(&event->hw.period_left) - delta;
1149 if (period) { 1149 if (period) {
1150 if (left <= 0) { 1150 if (left <= 0) {
1151 left += period; 1151 left += period;
@@ -1163,18 +1163,18 @@ static void record_and_restart(struct perf_counter *counter, unsigned long val,
1163 if (record) { 1163 if (record) {
1164 struct perf_sample_data data = { 1164 struct perf_sample_data data = {
1165 .addr = 0, 1165 .addr = 0,
1166 .period = counter->hw.last_period, 1166 .period = event->hw.last_period,
1167 }; 1167 };
1168 1168
1169 if (counter->attr.sample_type & PERF_SAMPLE_ADDR) 1169 if (event->attr.sample_type & PERF_SAMPLE_ADDR)
1170 perf_get_data_addr(regs, &data.addr); 1170 perf_get_data_addr(regs, &data.addr);
1171 1171
1172 if (perf_counter_overflow(counter, nmi, &data, regs)) { 1172 if (perf_event_overflow(event, nmi, &data, regs)) {
1173 /* 1173 /*
1174 * Interrupts are coming too fast - throttle them 1174 * Interrupts are coming too fast - throttle them
1175 * by setting the counter to 0, so it will be 1175 * by setting the event to 0, so it will be
1176 * at least 2^30 cycles until the next interrupt 1176 * at least 2^30 cycles until the next interrupt
1177 * (assuming each counter counts at most 2 counts 1177 * (assuming each event counts at most 2 counts
1178 * per cycle). 1178 * per cycle).
1179 */ 1179 */
1180 val = 0; 1180 val = 0;
@@ -1182,15 +1182,15 @@ static void record_and_restart(struct perf_counter *counter, unsigned long val,
1182 } 1182 }
1183 } 1183 }
1184 1184
1185 write_pmc(counter->hw.idx, val); 1185 write_pmc(event->hw.idx, val);
1186 atomic64_set(&counter->hw.prev_count, val); 1186 atomic64_set(&event->hw.prev_count, val);
1187 atomic64_set(&counter->hw.period_left, left); 1187 atomic64_set(&event->hw.period_left, left);
1188 perf_counter_update_userpage(counter); 1188 perf_event_update_userpage(event);
1189} 1189}
1190 1190
1191/* 1191/*
1192 * Called from generic code to get the misc flags (i.e. processor mode) 1192 * Called from generic code to get the misc flags (i.e. processor mode)
1193 * for an event. 1193 * for an event_id.
1194 */ 1194 */
1195unsigned long perf_misc_flags(struct pt_regs *regs) 1195unsigned long perf_misc_flags(struct pt_regs *regs)
1196{ 1196{
@@ -1198,13 +1198,13 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
1198 1198
1199 if (flags) 1199 if (flags)
1200 return flags; 1200 return flags;
1201 return user_mode(regs) ? PERF_EVENT_MISC_USER : 1201 return user_mode(regs) ? PERF_RECORD_MISC_USER :
1202 PERF_EVENT_MISC_KERNEL; 1202 PERF_RECORD_MISC_KERNEL;
1203} 1203}
1204 1204
1205/* 1205/*
1206 * Called from generic code to get the instruction pointer 1206 * Called from generic code to get the instruction pointer
1207 * for an event. 1207 * for an event_id.
1208 */ 1208 */
1209unsigned long perf_instruction_pointer(struct pt_regs *regs) 1209unsigned long perf_instruction_pointer(struct pt_regs *regs)
1210{ 1210{
@@ -1220,11 +1220,11 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
1220/* 1220/*
1221 * Performance monitor interrupt stuff 1221 * Performance monitor interrupt stuff
1222 */ 1222 */
1223static void perf_counter_interrupt(struct pt_regs *regs) 1223static void perf_event_interrupt(struct pt_regs *regs)
1224{ 1224{
1225 int i; 1225 int i;
1226 struct cpu_hw_counters *cpuhw = &__get_cpu_var(cpu_hw_counters); 1226 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1227 struct perf_counter *counter; 1227 struct perf_event *event;
1228 unsigned long val; 1228 unsigned long val;
1229 int found = 0; 1229 int found = 0;
1230 int nmi; 1230 int nmi;
@@ -1241,21 +1241,21 @@ static void perf_counter_interrupt(struct pt_regs *regs)
1241 else 1241 else
1242 irq_enter(); 1242 irq_enter();
1243 1243
1244 for (i = 0; i < cpuhw->n_counters; ++i) { 1244 for (i = 0; i < cpuhw->n_events; ++i) {
1245 counter = cpuhw->counter[i]; 1245 event = cpuhw->event[i];
1246 if (!counter->hw.idx || is_limited_pmc(counter->hw.idx)) 1246 if (!event->hw.idx || is_limited_pmc(event->hw.idx))
1247 continue; 1247 continue;
1248 val = read_pmc(counter->hw.idx); 1248 val = read_pmc(event->hw.idx);
1249 if ((int)val < 0) { 1249 if ((int)val < 0) {
1250 /* counter has overflowed */ 1250 /* event has overflowed */
1251 found = 1; 1251 found = 1;
1252 record_and_restart(counter, val, regs, nmi); 1252 record_and_restart(event, val, regs, nmi);
1253 } 1253 }
1254 } 1254 }
1255 1255
1256 /* 1256 /*
1257 * In case we didn't find and reset the counter that caused 1257 * In case we didn't find and reset the event that caused
1258 * the interrupt, scan all counters and reset any that are 1258 * the interrupt, scan all events and reset any that are
1259 * negative, to avoid getting continual interrupts. 1259 * negative, to avoid getting continual interrupts.
1260 * Any that we processed in the previous loop will not be negative. 1260 * Any that we processed in the previous loop will not be negative.
1261 */ 1261 */
@@ -1273,7 +1273,7 @@ static void perf_counter_interrupt(struct pt_regs *regs)
1273 * Reset MMCR0 to its normal value. This will set PMXE and 1273 * Reset MMCR0 to its normal value. This will set PMXE and
1274 * clear FC (freeze counters) and PMAO (perf mon alert occurred) 1274 * clear FC (freeze counters) and PMAO (perf mon alert occurred)
1275 * and thus allow interrupts to occur again. 1275 * and thus allow interrupts to occur again.
1276 * XXX might want to use MSR.PM to keep the counters frozen until 1276 * XXX might want to use MSR.PM to keep the events frozen until
1277 * we get back out of this interrupt. 1277 * we get back out of this interrupt.
1278 */ 1278 */
1279 write_mmcr0(cpuhw, cpuhw->mmcr[0]); 1279 write_mmcr0(cpuhw, cpuhw->mmcr[0]);
@@ -1284,9 +1284,9 @@ static void perf_counter_interrupt(struct pt_regs *regs)
1284 irq_exit(); 1284 irq_exit();
1285} 1285}
1286 1286
1287void hw_perf_counter_setup(int cpu) 1287void hw_perf_event_setup(int cpu)
1288{ 1288{
1289 struct cpu_hw_counters *cpuhw = &per_cpu(cpu_hw_counters, cpu); 1289 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
1290 1290
1291 if (!ppmu) 1291 if (!ppmu)
1292 return; 1292 return;
@@ -1308,7 +1308,7 @@ int register_power_pmu(struct power_pmu *pmu)
1308 * Use FCHV to ignore kernel events if MSR.HV is set. 1308 * Use FCHV to ignore kernel events if MSR.HV is set.
1309 */ 1309 */
1310 if (mfmsr() & MSR_HV) 1310 if (mfmsr() & MSR_HV)
1311 freeze_counters_kernel = MMCR0_FCHV; 1311 freeze_events_kernel = MMCR0_FCHV;
1312#endif /* CONFIG_PPC64 */ 1312#endif /* CONFIG_PPC64 */
1313 1313
1314 return 0; 1314 return 0;
diff --git a/arch/powerpc/kernel/power4-pmu.c b/arch/powerpc/kernel/power4-pmu.c
index 3c90a3d9173e..2a361cdda635 100644
--- a/arch/powerpc/kernel/power4-pmu.c
+++ b/arch/powerpc/kernel/power4-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <asm/reg.h> 14#include <asm/reg.h>
15#include <asm/cputable.h> 15#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/power5+-pmu.c b/arch/powerpc/kernel/power5+-pmu.c
index 31918af3e355..0f4c1c73a6ad 100644
--- a/arch/powerpc/kernel/power5+-pmu.c
+++ b/arch/powerpc/kernel/power5+-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <asm/reg.h> 14#include <asm/reg.h>
15#include <asm/cputable.h> 15#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/power5-pmu.c b/arch/powerpc/kernel/power5-pmu.c
index 867f6f663963..c351b3a57fbb 100644
--- a/arch/powerpc/kernel/power5-pmu.c
+++ b/arch/powerpc/kernel/power5-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <asm/reg.h> 14#include <asm/reg.h>
15#include <asm/cputable.h> 15#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/power6-pmu.c b/arch/powerpc/kernel/power6-pmu.c
index fa21890531da..ca399ba5034c 100644
--- a/arch/powerpc/kernel/power6-pmu.c
+++ b/arch/powerpc/kernel/power6-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <asm/reg.h> 14#include <asm/reg.h>
15#include <asm/cputable.h> 15#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/power7-pmu.c b/arch/powerpc/kernel/power7-pmu.c
index 018d094d92f9..28a4daacdc02 100644
--- a/arch/powerpc/kernel/power7-pmu.c
+++ b/arch/powerpc/kernel/power7-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <asm/reg.h> 14#include <asm/reg.h>
15#include <asm/cputable.h> 15#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/kernel/ppc970-pmu.c
index 75dccb71a043..479574413a93 100644
--- a/arch/powerpc/kernel/ppc970-pmu.c
+++ b/arch/powerpc/kernel/ppc970-pmu.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/perf_counter.h> 12#include <linux/perf_event.h>
13#include <asm/reg.h> 13#include <asm/reg.h>
14#include <asm/cputable.h> 14#include <asm/cputable.h>
15 15
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 02fed27af7f6..1d5570a1e456 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -328,7 +328,7 @@ static void c_stop(struct seq_file *m, void *v)
328{ 328{
329} 329}
330 330
331struct seq_operations cpuinfo_op = { 331const struct seq_operations cpuinfo_op = {
332 .start =c_start, 332 .start =c_start,
333 .next = c_next, 333 .next = c_next,
334 .stop = c_stop, 334 .stop = c_stop,
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 465e498bcb33..92dc844299b6 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -53,7 +53,7 @@
53#include <linux/posix-timers.h> 53#include <linux/posix-timers.h>
54#include <linux/irq.h> 54#include <linux/irq.h>
55#include <linux/delay.h> 55#include <linux/delay.h>
56#include <linux/perf_counter.h> 56#include <linux/perf_event.h>
57 57
58#include <asm/io.h> 58#include <asm/io.h>
59#include <asm/processor.h> 59#include <asm/processor.h>
@@ -193,6 +193,8 @@ EXPORT_SYMBOL(__cputime_clockt_factor);
193DEFINE_PER_CPU(unsigned long, cputime_last_delta); 193DEFINE_PER_CPU(unsigned long, cputime_last_delta);
194DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta); 194DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta);
195 195
196cputime_t cputime_one_jiffy;
197
196static void calc_cputime_factors(void) 198static void calc_cputime_factors(void)
197{ 199{
198 struct div_result res; 200 struct div_result res;
@@ -501,6 +503,7 @@ static int __init iSeries_tb_recal(void)
501 tb_to_xs = divres.result_low; 503 tb_to_xs = divres.result_low;
502 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; 504 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
503 vdso_data->tb_to_xs = tb_to_xs; 505 vdso_data->tb_to_xs = tb_to_xs;
506 setup_cputime_one_jiffy();
504 } 507 }
505 else { 508 else {
506 printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" 509 printk( "Titan recalibrate: FAILED (difference > 4 percent)\n"
@@ -527,25 +530,25 @@ void __init iSeries_time_init_early(void)
527} 530}
528#endif /* CONFIG_PPC_ISERIES */ 531#endif /* CONFIG_PPC_ISERIES */
529 532
530#if defined(CONFIG_PERF_COUNTERS) && defined(CONFIG_PPC32) 533#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_PPC32)
531DEFINE_PER_CPU(u8, perf_counter_pending); 534DEFINE_PER_CPU(u8, perf_event_pending);
532 535
533void set_perf_counter_pending(void) 536void set_perf_event_pending(void)
534{ 537{
535 get_cpu_var(perf_counter_pending) = 1; 538 get_cpu_var(perf_event_pending) = 1;
536 set_dec(1); 539 set_dec(1);
537 put_cpu_var(perf_counter_pending); 540 put_cpu_var(perf_event_pending);
538} 541}
539 542
540#define test_perf_counter_pending() __get_cpu_var(perf_counter_pending) 543#define test_perf_event_pending() __get_cpu_var(perf_event_pending)
541#define clear_perf_counter_pending() __get_cpu_var(perf_counter_pending) = 0 544#define clear_perf_event_pending() __get_cpu_var(perf_event_pending) = 0
542 545
543#else /* CONFIG_PERF_COUNTERS && CONFIG_PPC32 */ 546#else /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */
544 547
545#define test_perf_counter_pending() 0 548#define test_perf_event_pending() 0
546#define clear_perf_counter_pending() 549#define clear_perf_event_pending()
547 550
548#endif /* CONFIG_PERF_COUNTERS && CONFIG_PPC32 */ 551#endif /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */
549 552
550/* 553/*
551 * For iSeries shared processors, we have to let the hypervisor 554 * For iSeries shared processors, we have to let the hypervisor
@@ -573,9 +576,9 @@ void timer_interrupt(struct pt_regs * regs)
573 set_dec(DECREMENTER_MAX); 576 set_dec(DECREMENTER_MAX);
574 577
575#ifdef CONFIG_PPC32 578#ifdef CONFIG_PPC32
576 if (test_perf_counter_pending()) { 579 if (test_perf_event_pending()) {
577 clear_perf_counter_pending(); 580 clear_perf_event_pending();
578 perf_counter_do_pending(); 581 perf_event_do_pending();
579 } 582 }
580 if (atomic_read(&ppc_n_lost_interrupts) != 0) 583 if (atomic_read(&ppc_n_lost_interrupts) != 0)
581 do_IRQ(regs); 584 do_IRQ(regs);
@@ -960,6 +963,7 @@ void __init time_init(void)
960 tb_ticks_per_usec = ppc_tb_freq / 1000000; 963 tb_ticks_per_usec = ppc_tb_freq / 1000000;
961 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); 964 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
962 calc_cputime_factors(); 965 calc_cputime_factors();
966 setup_cputime_one_jiffy();
963 967
964 /* 968 /*
965 * Calculate the length of each tick in ns. It will not be 969 * Calculate the length of each tick in ns. It will not be
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index acb74a17bbbf..b4b167b33643 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * udbg for for NS16550 compatable serial ports 2 * udbg for NS16550 compatable serial ports
3 * 3 *
4 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp 4 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
5 * 5 *
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 830bef0a1131..e7dae82c1285 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -29,7 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/kprobes.h> 30#include <linux/kprobes.h>
31#include <linux/kdebug.h> 31#include <linux/kdebug.h>
32#include <linux/perf_counter.h> 32#include <linux/perf_event.h>
33 33
34#include <asm/firmware.h> 34#include <asm/firmware.h>
35#include <asm/page.h> 35#include <asm/page.h>
@@ -171,7 +171,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
171 die("Weird page fault", regs, SIGSEGV); 171 die("Weird page fault", regs, SIGSEGV);
172 } 172 }
173 173
174 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 174 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
175 175
176 /* When running in the kernel we expect faults to occur only to 176 /* When running in the kernel we expect faults to occur only to
177 * addresses in user space. All other faults represent errors in the 177 * addresses in user space. All other faults represent errors in the
@@ -312,7 +312,7 @@ good_area:
312 } 312 }
313 if (ret & VM_FAULT_MAJOR) { 313 if (ret & VM_FAULT_MAJOR) {
314 current->maj_flt++; 314 current->maj_flt++;
315 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 315 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
316 regs, address); 316 regs, address);
317#ifdef CONFIG_PPC_SMLPAR 317#ifdef CONFIG_PPC_SMLPAR
318 if (firmware_has_feature(FW_FEATURE_CMO)) { 318 if (firmware_has_feature(FW_FEATURE_CMO)) {
@@ -323,7 +323,7 @@ good_area:
323#endif 323#endif
324 } else { 324 } else {
325 current->min_flt++; 325 current->min_flt++;
326 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 326 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
327 regs, address); 327 regs, address);
328 } 328 }
329 up_read(&mm->mmap_sem); 329 up_read(&mm->mmap_sem);
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 3ef5084b90ca..9ddcfb4dc139 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -242,39 +242,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
242} 242}
243#endif 243#endif
244 244
245#ifdef CONFIG_PROC_KCORE
246static struct kcore_list kcore_vmem;
247
248static int __init setup_kcore(void)
249{
250 int i;
251
252 for (i = 0; i < lmb.memory.cnt; i++) {
253 unsigned long base;
254 unsigned long size;
255 struct kcore_list *kcore_mem;
256
257 base = lmb.memory.region[i].base;
258 size = lmb.memory.region[i].size;
259
260 kcore_mem = kmalloc(sizeof(struct kcore_list), GFP_ATOMIC);
261 if (!kcore_mem)
262 panic("%s: kmalloc failed\n", __func__);
263
264 /* must stay under 32 bits */
265 if ( 0xfffffffful - (unsigned long)__va(base) < size) {
266 size = 0xfffffffful - (unsigned long)(__va(base));
267 printk(KERN_DEBUG "setup_kcore: restrict size=%lx\n",
268 size);
269 }
270
271 kclist_add(kcore_mem, __va(base), size);
272 }
273
274 kclist_add(&kcore_vmem, (void *)VMALLOC_START,
275 VMALLOC_END-VMALLOC_START);
276
277 return 0;
278}
279module_init(setup_kcore);
280#endif
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 31582329cd67..335c578b9cc3 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -109,35 +109,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
109} 109}
110#endif 110#endif
111 111
112#ifdef CONFIG_PROC_KCORE
113static struct kcore_list kcore_vmem;
114
115static int __init setup_kcore(void)
116{
117 int i;
118
119 for (i=0; i < lmb.memory.cnt; i++) {
120 unsigned long base, size;
121 struct kcore_list *kcore_mem;
122
123 base = lmb.memory.region[i].base;
124 size = lmb.memory.region[i].size;
125
126 /* GFP_ATOMIC to avoid might_sleep warnings during boot */
127 kcore_mem = kmalloc(sizeof(struct kcore_list), GFP_ATOMIC);
128 if (!kcore_mem)
129 panic("%s: kmalloc failed\n", __func__);
130
131 kclist_add(kcore_mem, __va(base), size);
132 }
133
134 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
135
136 return 0;
137}
138module_init(setup_kcore);
139#endif
140
141static void pgd_ctor(void *addr) 112static void pgd_ctor(void *addr)
142{ 113{
143 memset(addr, 0, PGD_TABLE_SIZE); 114 memset(addr, 0, PGD_TABLE_SIZE);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 579382c163a9..59736317bf0e 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -143,8 +143,8 @@ int arch_add_memory(int nid, u64 start, u64 size)
143 * memory regions, find holes and callback for contiguous regions. 143 * memory regions, find holes and callback for contiguous regions.
144 */ 144 */
145int 145int
146walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg, 146walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
147 int (*func)(unsigned long, unsigned long, void *)) 147 void *arg, int (*func)(unsigned long, unsigned long, void *))
148{ 148{
149 struct lmb_property res; 149 struct lmb_property res;
150 unsigned long pfn, len; 150 unsigned long pfn, len;
@@ -166,7 +166,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
166 } 166 }
167 return ret; 167 return ret;
168} 168}
169EXPORT_SYMBOL_GPL(walk_memory_resource); 169EXPORT_SYMBOL_GPL(walk_system_ram_range);
170 170
171/* 171/*
172 * Initialize the bootmem system and give it all the memory we 172 * Initialize the bootmem system and give it all the memory we
@@ -372,7 +372,7 @@ void __init mem_init(void)
372 372
373 printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, " 373 printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, "
374 "%luk reserved, %luk data, %luk bss, %luk init)\n", 374 "%luk reserved, %luk data, %luk bss, %luk init)\n",
375 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), 375 nr_free_pages() << (PAGE_SHIFT-10),
376 num_physpages << (PAGE_SHIFT-10), 376 num_physpages << (PAGE_SHIFT-10),
377 codesize >> 10, 377 codesize >> 10,
378 reservedpages << (PAGE_SHIFT-10), 378 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 9efc8bda01b4..e382cae678b8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -280,9 +280,9 @@ config PPC_HAVE_PMU_SUPPORT
280 280
281config PPC_PERF_CTRS 281config PPC_PERF_CTRS
282 def_bool y 282 def_bool y
283 depends on PERF_COUNTERS && PPC_HAVE_PMU_SUPPORT 283 depends on PERF_EVENTS && PPC_HAVE_PMU_SUPPORT
284 help 284 help
285 This enables the powerpc-specific perf_counter back-end. 285 This enables the powerpc-specific perf_event back-end.
286 286
287config SMP 287config SMP
288 depends on PPC_BOOK3S || PPC_BOOK3E || FSL_BOOKE 288 depends on PPC_BOOK3S || PPC_BOOK3E || FSL_BOOKE
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 24b30b6909c4..fc1b1c42b1dc 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -119,7 +119,7 @@ spufs_new_file(struct super_block *sb, struct dentry *dentry,
119 const struct file_operations *fops, int mode, 119 const struct file_operations *fops, int mode,
120 size_t size, struct spu_context *ctx) 120 size_t size, struct spu_context *ctx)
121{ 121{
122 static struct inode_operations spufs_file_iops = { 122 static const struct inode_operations spufs_file_iops = {
123 .setattr = spufs_setattr, 123 .setattr = spufs_setattr,
124 }; 124 };
125 struct inode *inode; 125 struct inode *inode;
@@ -773,7 +773,7 @@ static int
773spufs_fill_super(struct super_block *sb, void *data, int silent) 773spufs_fill_super(struct super_block *sb, void *data, int silent)
774{ 774{
775 struct spufs_sb_info *info; 775 struct spufs_sb_info *info;
776 static struct super_operations s_ops = { 776 static const struct super_operations s_ops = {
777 .alloc_inode = spufs_alloc_inode, 777 .alloc_inode = spufs_alloc_inode,
778 .destroy_inode = spufs_destroy_inode, 778 .destroy_inode = spufs_destroy_inode,
779 .statfs = simple_statfs, 779 .statfs = simple_statfs,
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index 572771fd8463..9490157da62e 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * udbg for for zilog scc ports as found on Apple PowerMacs 2 * udbg for zilog scc ports as found on Apple PowerMacs
3 * 3 *
4 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp 4 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
5 * 5 *
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index eae51ef9af24..3631a4f277eb 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -71,7 +71,7 @@ static int hc_show(struct seq_file *m, void *p)
71 return 0; 71 return 0;
72} 72}
73 73
74static struct seq_operations hcall_inst_seq_ops = { 74static const struct seq_operations hcall_inst_seq_ops = {
75 .start = hc_start, 75 .start = hc_start,
76 .next = hc_next, 76 .next = hc_next,
77 .stop = hc_stop, 77 .stop = hc_stop,
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index a4779912a5ca..88f4ae787832 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -165,7 +165,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector,
165 return 0; 165 return 0;
166} 166}
167 167
168static struct block_device_operations axon_ram_devops = { 168static const struct block_device_operations axon_ram_devops = {
169 .owner = THIS_MODULE, 169 .owner = THIS_MODULE,
170 .direct_access = axon_ram_direct_access 170 .direct_access = axon_ram_direct_access
171}; 171};
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 1c866efd217d..43c0acad7160 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -94,7 +94,7 @@ config S390
94 select HAVE_KVM if 64BIT 94 select HAVE_KVM if 64BIT
95 select HAVE_ARCH_TRACEHOOK 95 select HAVE_ARCH_TRACEHOOK
96 select INIT_ALL_POSSIBLE 96 select INIT_ALL_POSSIBLE
97 select HAVE_PERF_COUNTERS 97 select HAVE_PERF_EVENTS
98 98
99config SCHED_OMIT_FRAME_POINTER 99config SCHED_OMIT_FRAME_POINTER
100 bool 100 bool
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 4e91a2573cc4..ab4464486b7a 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/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.30 3# Linux kernel version: 2.6.31
4# Mon Jun 22 11:08:16 2009 4# Tue Sep 22 17:43:13 2009
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -24,6 +24,7 @@ CONFIG_PGSTE=y
24CONFIG_VIRT_CPU_ACCOUNTING=y 24CONFIG_VIRT_CPU_ACCOUNTING=y
25CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 25CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
26CONFIG_S390=y 26CONFIG_S390=y
27CONFIG_SCHED_OMIT_FRAME_POINTER=y
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28CONFIG_CONSTRUCTORS=y 29CONFIG_CONSTRUCTORS=y
29 30
@@ -48,11 +49,12 @@ CONFIG_AUDIT=y
48# 49#
49# RCU Subsystem 50# RCU Subsystem
50# 51#
51CONFIG_CLASSIC_RCU=y 52CONFIG_TREE_RCU=y
52# CONFIG_TREE_RCU is not set 53# CONFIG_TREE_PREEMPT_RCU is not set
53# CONFIG_PREEMPT_RCU is not set 54# CONFIG_RCU_TRACE is not set
55CONFIG_RCU_FANOUT=64
56# CONFIG_RCU_FANOUT_EXACT is not set
54# CONFIG_TREE_RCU_TRACE is not set 57# CONFIG_TREE_RCU_TRACE is not set
55# CONFIG_PREEMPT_RCU_TRACE is not set
56CONFIG_IKCONFIG=y 58CONFIG_IKCONFIG=y
57CONFIG_IKCONFIG_PROC=y 59CONFIG_IKCONFIG_PROC=y
58CONFIG_LOG_BUF_SHIFT=17 60CONFIG_LOG_BUF_SHIFT=17
@@ -103,11 +105,12 @@ CONFIG_TIMERFD=y
103CONFIG_EVENTFD=y 105CONFIG_EVENTFD=y
104CONFIG_SHMEM=y 106CONFIG_SHMEM=y
105CONFIG_AIO=y 107CONFIG_AIO=y
106CONFIG_HAVE_PERF_COUNTERS=y 108CONFIG_HAVE_PERF_EVENTS=y
107 109
108# 110#
109# Performance Counters 111# Kernel Performance Events And Counters
110# 112#
113# CONFIG_PERF_EVENTS is not set
111# CONFIG_PERF_COUNTERS is not set 114# CONFIG_PERF_COUNTERS is not set
112CONFIG_VM_EVENT_COUNTERS=y 115CONFIG_VM_EVENT_COUNTERS=y
113# CONFIG_STRIP_ASM_SYMS is not set 116# CONFIG_STRIP_ASM_SYMS is not set
@@ -116,7 +119,6 @@ CONFIG_SLAB=y
116# CONFIG_SLUB is not set 119# CONFIG_SLUB is not set
117# CONFIG_SLOB is not set 120# CONFIG_SLOB is not set
118# CONFIG_PROFILING is not set 121# CONFIG_PROFILING is not set
119# CONFIG_MARKERS is not set
120CONFIG_HAVE_OPROFILE=y 122CONFIG_HAVE_OPROFILE=y
121CONFIG_KPROBES=y 123CONFIG_KPROBES=y
122CONFIG_HAVE_SYSCALL_WRAPPERS=y 124CONFIG_HAVE_SYSCALL_WRAPPERS=y
@@ -176,6 +178,7 @@ CONFIG_NO_HZ=y
176CONFIG_HIGH_RES_TIMERS=y 178CONFIG_HIGH_RES_TIMERS=y
177CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 179CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
178CONFIG_64BIT=y 180CONFIG_64BIT=y
181# CONFIG_KTIME_SCALAR is not set
179CONFIG_SMP=y 182CONFIG_SMP=y
180CONFIG_NR_CPUS=32 183CONFIG_NR_CPUS=32
181CONFIG_HOTPLUG_CPU=y 184CONFIG_HOTPLUG_CPU=y
@@ -257,7 +260,6 @@ CONFIG_FORCE_MAX_ZONEORDER=9
257CONFIG_PFAULT=y 260CONFIG_PFAULT=y
258# CONFIG_SHARED_KERNEL is not set 261# CONFIG_SHARED_KERNEL is not set
259# CONFIG_CMM is not set 262# CONFIG_CMM is not set
260# CONFIG_PAGE_STATES is not set
261# CONFIG_APPLDATA_BASE is not set 263# CONFIG_APPLDATA_BASE is not set
262CONFIG_HZ_100=y 264CONFIG_HZ_100=y
263# CONFIG_HZ_250 is not set 265# CONFIG_HZ_250 is not set
@@ -280,6 +282,7 @@ CONFIG_PM_SLEEP_SMP=y
280CONFIG_PM_SLEEP=y 282CONFIG_PM_SLEEP=y
281CONFIG_HIBERNATION=y 283CONFIG_HIBERNATION=y
282CONFIG_PM_STD_PARTITION="" 284CONFIG_PM_STD_PARTITION=""
285# CONFIG_PM_RUNTIME is not set
283CONFIG_NET=y 286CONFIG_NET=y
284 287
285# 288#
@@ -394,6 +397,7 @@ CONFIG_IP_SCTP=m
394# CONFIG_SCTP_HMAC_NONE is not set 397# CONFIG_SCTP_HMAC_NONE is not set
395# CONFIG_SCTP_HMAC_SHA1 is not set 398# CONFIG_SCTP_HMAC_SHA1 is not set
396CONFIG_SCTP_HMAC_MD5=y 399CONFIG_SCTP_HMAC_MD5=y
400# CONFIG_RDS is not set
397# CONFIG_TIPC is not set 401# CONFIG_TIPC is not set
398# CONFIG_ATM is not set 402# CONFIG_ATM is not set
399# CONFIG_BRIDGE is not set 403# CONFIG_BRIDGE is not set
@@ -487,6 +491,7 @@ CONFIG_CCW=y
487# Generic Driver Options 491# Generic Driver Options
488# 492#
489CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 493CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
494# CONFIG_DEVTMPFS is not set
490CONFIG_STANDALONE=y 495CONFIG_STANDALONE=y
491CONFIG_PREVENT_FIRMWARE_BUILD=y 496CONFIG_PREVENT_FIRMWARE_BUILD=y
492CONFIG_FW_LOADER=y 497CONFIG_FW_LOADER=y
@@ -501,6 +506,7 @@ CONFIG_BLK_DEV=y
501CONFIG_BLK_DEV_LOOP=m 506CONFIG_BLK_DEV_LOOP=m
502# CONFIG_BLK_DEV_CRYPTOLOOP is not set 507# CONFIG_BLK_DEV_CRYPTOLOOP is not set
503CONFIG_BLK_DEV_NBD=m 508CONFIG_BLK_DEV_NBD=m
509# CONFIG_BLK_DEV_OSD is not set
504CONFIG_BLK_DEV_RAM=y 510CONFIG_BLK_DEV_RAM=y
505CONFIG_BLK_DEV_RAM_COUNT=16 511CONFIG_BLK_DEV_RAM_COUNT=16
506CONFIG_BLK_DEV_RAM_SIZE=4096 512CONFIG_BLK_DEV_RAM_SIZE=4096
@@ -594,8 +600,11 @@ CONFIG_BLK_DEV_DM=y
594CONFIG_DM_CRYPT=y 600CONFIG_DM_CRYPT=y
595CONFIG_DM_SNAPSHOT=y 601CONFIG_DM_SNAPSHOT=y
596CONFIG_DM_MIRROR=y 602CONFIG_DM_MIRROR=y
603# CONFIG_DM_LOG_USERSPACE is not set
597CONFIG_DM_ZERO=y 604CONFIG_DM_ZERO=y
598CONFIG_DM_MULTIPATH=m 605CONFIG_DM_MULTIPATH=m
606# CONFIG_DM_MULTIPATH_QL is not set
607# CONFIG_DM_MULTIPATH_ST is not set
599# CONFIG_DM_DELAY is not set 608# CONFIG_DM_DELAY is not set
600# CONFIG_DM_UEVENT is not set 609# CONFIG_DM_UEVENT is not set
601CONFIG_NETDEVICES=y 610CONFIG_NETDEVICES=y
@@ -615,7 +624,6 @@ CONFIG_NET_ETHERNET=y
615# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set 624# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
616# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 625# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
617# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 626# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
618# CONFIG_KS8842 is not set
619CONFIG_NETDEV_1000=y 627CONFIG_NETDEV_1000=y
620CONFIG_NETDEV_10000=y 628CONFIG_NETDEV_10000=y
621# CONFIG_TR is not set 629# CONFIG_TR is not set
@@ -678,6 +686,7 @@ CONFIG_SCLP_CONSOLE=y
678CONFIG_SCLP_VT220_TTY=y 686CONFIG_SCLP_VT220_TTY=y
679CONFIG_SCLP_VT220_CONSOLE=y 687CONFIG_SCLP_VT220_CONSOLE=y
680CONFIG_SCLP_CPI=m 688CONFIG_SCLP_CPI=m
689CONFIG_SCLP_ASYNC=m
681CONFIG_S390_TAPE=m 690CONFIG_S390_TAPE=m
682 691
683# 692#
@@ -737,6 +746,7 @@ CONFIG_FS_POSIX_ACL=y
737# CONFIG_GFS2_FS is not set 746# CONFIG_GFS2_FS is not set
738# CONFIG_OCFS2_FS is not set 747# CONFIG_OCFS2_FS is not set
739# CONFIG_BTRFS_FS is not set 748# CONFIG_BTRFS_FS is not set
749# CONFIG_NILFS2_FS is not set
740CONFIG_FILE_LOCKING=y 750CONFIG_FILE_LOCKING=y
741CONFIG_FSNOTIFY=y 751CONFIG_FSNOTIFY=y
742CONFIG_DNOTIFY=y 752CONFIG_DNOTIFY=y
@@ -798,7 +808,6 @@ CONFIG_MISC_FILESYSTEMS=y
798# CONFIG_SYSV_FS is not set 808# CONFIG_SYSV_FS is not set
799# CONFIG_UFS_FS is not set 809# CONFIG_UFS_FS is not set
800# CONFIG_EXOFS_FS is not set 810# CONFIG_EXOFS_FS is not set
801# CONFIG_NILFS2_FS is not set
802CONFIG_NETWORK_FILESYSTEMS=y 811CONFIG_NETWORK_FILESYSTEMS=y
803CONFIG_NFS_FS=y 812CONFIG_NFS_FS=y
804CONFIG_NFS_V3=y 813CONFIG_NFS_V3=y
@@ -885,11 +894,13 @@ CONFIG_DEBUG_MEMORY_INIT=y
885# CONFIG_DEBUG_LIST is not set 894# CONFIG_DEBUG_LIST is not set
886# CONFIG_DEBUG_SG is not set 895# CONFIG_DEBUG_SG is not set
887# CONFIG_DEBUG_NOTIFIERS is not set 896# CONFIG_DEBUG_NOTIFIERS is not set
897# CONFIG_DEBUG_CREDENTIALS is not set
888# CONFIG_RCU_TORTURE_TEST is not set 898# CONFIG_RCU_TORTURE_TEST is not set
889# CONFIG_RCU_CPU_STALL_DETECTOR is not set 899# CONFIG_RCU_CPU_STALL_DETECTOR is not set
890# CONFIG_KPROBES_SANITY_TEST is not set 900# CONFIG_KPROBES_SANITY_TEST is not set
891# CONFIG_BACKTRACE_SELF_TEST is not set 901# CONFIG_BACKTRACE_SELF_TEST is not set
892# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 902# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
903CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
893# CONFIG_LKDTM is not set 904# CONFIG_LKDTM is not set
894# CONFIG_FAULT_INJECTION is not set 905# CONFIG_FAULT_INJECTION is not set
895# CONFIG_LATENCYTOP is not set 906# CONFIG_LATENCYTOP is not set
@@ -979,11 +990,13 @@ CONFIG_CRYPTO_PCBC=m
979# 990#
980CONFIG_CRYPTO_HMAC=m 991CONFIG_CRYPTO_HMAC=m
981# CONFIG_CRYPTO_XCBC is not set 992# CONFIG_CRYPTO_XCBC is not set
993CONFIG_CRYPTO_VMAC=m
982 994
983# 995#
984# Digest 996# Digest
985# 997#
986CONFIG_CRYPTO_CRC32C=m 998CONFIG_CRYPTO_CRC32C=m
999CONFIG_CRYPTO_GHASH=m
987# CONFIG_CRYPTO_MD4 is not set 1000# CONFIG_CRYPTO_MD4 is not set
988CONFIG_CRYPTO_MD5=m 1001CONFIG_CRYPTO_MD5=m
989# CONFIG_CRYPTO_MICHAEL_MIC is not set 1002# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index bd9914b89488..341aff2687a5 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -41,7 +41,7 @@ struct hypfs_sb_info {
41 41
42static const struct file_operations hypfs_file_ops; 42static const struct file_operations hypfs_file_ops;
43static struct file_system_type hypfs_type; 43static struct file_system_type hypfs_type;
44static struct super_operations hypfs_s_ops; 44static const struct super_operations hypfs_s_ops;
45 45
46/* start of list of all dentries, which have to be deleted on update */ 46/* start of list of all dentries, which have to be deleted on update */
47static struct dentry *hypfs_last_dentry; 47static struct dentry *hypfs_last_dentry;
@@ -472,7 +472,7 @@ static struct file_system_type hypfs_type = {
472 .kill_sb = hypfs_kill_super 472 .kill_sb = hypfs_kill_super
473}; 473};
474 474
475static struct super_operations hypfs_s_ops = { 475static const struct super_operations hypfs_s_ops = {
476 .statfs = simple_statfs, 476 .statfs = simple_statfs,
477 .drop_inode = hypfs_drop_inode, 477 .drop_inode = hypfs_drop_inode,
478 .show_options = hypfs_show_options, 478 .show_options = hypfs_show_options,
@@ -496,7 +496,7 @@ static int __init hypfs_init(void)
496 } 496 }
497 s390_kobj = kobject_create_and_add("s390", hypervisor_kobj); 497 s390_kobj = kobject_create_and_add("s390", hypervisor_kobj);
498 if (!s390_kobj) { 498 if (!s390_kobj) {
499 rc = -ENOMEM;; 499 rc = -ENOMEM;
500 goto fail_sysfs; 500 goto fail_sysfs;
501 } 501 }
502 rc = register_filesystem(&hypfs_type); 502 rc = register_filesystem(&hypfs_type);
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 7a3817a656df..24b1244aadb9 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -42,6 +42,7 @@ __div(unsigned long long n, unsigned int base)
42#endif /* __s390x__ */ 42#endif /* __s390x__ */
43 43
44#define cputime_zero (0ULL) 44#define cputime_zero (0ULL)
45#define cputime_one_jiffy jiffies_to_cputime(1)
45#define cputime_max ((~0UL >> 1) - 1) 46#define cputime_max ((~0UL >> 1) - 1)
46#define cputime_add(__a, __b) ((__a) + (__b)) 47#define cputime_add(__a, __b) ((__a) + (__b))
47#define cputime_sub(__a, __b) ((__a) - (__b)) 48#define cputime_sub(__a, __b) ((__a) - (__b))
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index 6bc9426a6fbf..f2ef4b619ce1 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -86,6 +86,7 @@
86#define __LC_PGM_OLD_PSW 0x0150 86#define __LC_PGM_OLD_PSW 0x0150
87#define __LC_MCK_OLD_PSW 0x0160 87#define __LC_MCK_OLD_PSW 0x0160
88#define __LC_IO_OLD_PSW 0x0170 88#define __LC_IO_OLD_PSW 0x0170
89#define __LC_RESTART_PSW 0x01a0
89#define __LC_EXT_NEW_PSW 0x01b0 90#define __LC_EXT_NEW_PSW 0x01b0
90#define __LC_SVC_NEW_PSW 0x01c0 91#define __LC_SVC_NEW_PSW 0x01c0
91#define __LC_PGM_NEW_PSW 0x01d0 92#define __LC_PGM_NEW_PSW 0x01d0
@@ -189,6 +190,14 @@ union save_area {
189#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X 190#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
190#endif 191#endif
191 192
193#ifndef __s390x__
194#define LC_ORDER 0
195#else
196#define LC_ORDER 1
197#endif
198
199#define LC_PAGES (1UL << LC_ORDER)
200
192struct _lowcore 201struct _lowcore
193{ 202{
194#ifndef __s390x__ 203#ifndef __s390x__
diff --git a/arch/s390/include/asm/mman.h b/arch/s390/include/asm/mman.h
index f63fe7b431ed..4e9c8ae0a637 100644
--- a/arch/s390/include/asm/mman.h
+++ b/arch/s390/include/asm/mman.h
@@ -9,18 +9,7 @@
9#ifndef __S390_MMAN_H__ 9#ifndef __S390_MMAN_H__
10#define __S390_MMAN_H__ 10#define __S390_MMAN_H__
11 11
12#include <asm-generic/mman-common.h> 12#include <asm-generic/mman.h>
13
14#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
15#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
16#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
17#define MAP_LOCKED 0x2000 /* pages are locked */
18#define MAP_NORESERVE 0x4000 /* don't check for reservations */
19#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
20#define MAP_NONBLOCK 0x10000 /* do not block on IO */
21
22#define MCL_CURRENT 1 /* lock all current mappings */
23#define MCL_FUTURE 2 /* lock all future mappings */
24 13
25#if defined(__KERNEL__) && !defined(__ASSEMBLY__) && defined(CONFIG_64BIT) 14#if defined(__KERNEL__) && !defined(__ASSEMBLY__) && defined(CONFIG_64BIT)
26int s390_mmap_check(unsigned long addr, unsigned long len); 15int s390_mmap_check(unsigned long addr, unsigned long len);
diff --git a/arch/s390/include/asm/perf_counter.h b/arch/s390/include/asm/perf_counter.h
deleted file mode 100644
index 7015188c2cc2..000000000000
--- a/arch/s390/include/asm/perf_counter.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * Performance counter support - s390 specific definitions.
3 *
4 * Copyright 2009 Martin Schwidefsky, IBM Corporation.
5 */
6
7static inline void set_perf_counter_pending(void) {}
8static inline void clear_perf_counter_pending(void) {}
9
10#define PERF_COUNTER_INDEX_OFFSET 0
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h
new file mode 100644
index 000000000000..3840cbe77637
--- /dev/null
+++ b/arch/s390/include/asm/perf_event.h
@@ -0,0 +1,10 @@
1/*
2 * Performance event support - s390 specific definitions.
3 *
4 * Copyright 2009 Martin Schwidefsky, IBM Corporation.
5 */
6
7static inline void set_perf_event_pending(void) {}
8static inline void clear_perf_event_pending(void) {}
9
10#define PERF_EVENT_INDEX_OFFSET 0
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index cf8eed3fa779..b42715458312 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -295,7 +295,7 @@ static inline void ATTRIB_NORET disabled_wait(unsigned long code)
295 " oi 0x384(1),0x10\n"/* fake protection bit */ 295 " oi 0x384(1),0x10\n"/* fake protection bit */
296 " lpswe 0(%1)" 296 " lpswe 0(%1)"
297 : "=m" (ctl_buf) 297 : "=m" (ctl_buf)
298 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0"); 298 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0", "1");
299#endif /* __s390x__ */ 299#endif /* __s390x__ */
300 while (1); 300 while (1);
301} 301}
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index c80602d7c880..cb5232df151e 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -268,7 +268,7 @@
268#define __NR_preadv 328 268#define __NR_preadv 328
269#define __NR_pwritev 329 269#define __NR_pwritev 329
270#define __NR_rt_tgsigqueueinfo 330 270#define __NR_rt_tgsigqueueinfo 330
271#define __NR_perf_counter_open 331 271#define __NR_perf_event_open 331
272#define NR_syscalls 332 272#define NR_syscalls 332
273 273
274/* 274/*
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index fa9905ce7d0b..63e46433e81d 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -7,6 +7,7 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/kbuild.h> 8#include <linux/kbuild.h>
9#include <asm/vdso.h> 9#include <asm/vdso.h>
10#include <asm/sigp.h>
10 11
11int main(void) 12int main(void)
12{ 13{
@@ -59,6 +60,10 @@ int main(void)
59 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); 60 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
60 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); 61 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
61 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 62 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
62 63 /* constants for SIGP */
64 DEFINE(__SIGP_STOP, sigp_stop);
65 DEFINE(__SIGP_RESTART, sigp_restart);
66 DEFINE(__SIGP_SENSE, sigp_sense);
67 DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset);
63 return 0; 68 return 0;
64} 69}
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 9ab188d67a3d..5519cb745106 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -443,66 +443,28 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
443 * sys32_execve() executes a new program after the asm stub has set 443 * sys32_execve() executes a new program after the asm stub has set
444 * things up for us. This should basically do what I want it to. 444 * things up for us. This should basically do what I want it to.
445 */ 445 */
446asmlinkage long sys32_execve(void) 446asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
447 compat_uptr_t __user *envp)
447{ 448{
448 struct pt_regs *regs = task_pt_regs(current); 449 struct pt_regs *regs = task_pt_regs(current);
449 char *filename; 450 char *filename;
450 unsigned long result; 451 long rc;
451 int rc; 452
452 453 filename = getname(name);
453 filename = getname(compat_ptr(regs->orig_gpr2)); 454 rc = PTR_ERR(filename);
454 if (IS_ERR(filename)) { 455 if (IS_ERR(filename))
455 result = PTR_ERR(filename); 456 return rc;
456 goto out; 457 rc = compat_do_execve(filename, argv, envp, regs);
457 } 458 if (rc)
458 rc = compat_do_execve(filename, compat_ptr(regs->gprs[3]), 459 goto out;
459 compat_ptr(regs->gprs[4]), regs);
460 if (rc) {
461 result = rc;
462 goto out_putname;
463 }
464 current->thread.fp_regs.fpc=0; 460 current->thread.fp_regs.fpc=0;
465 asm volatile("sfpc %0,0" : : "d" (0)); 461 asm volatile("sfpc %0,0" : : "d" (0));
466 result = regs->gprs[2]; 462 rc = regs->gprs[2];
467out_putname:
468 putname(filename);
469out: 463out:
470 return result; 464 putname(filename);
471} 465 return rc;
472
473
474#ifdef CONFIG_MODULES
475
476asmlinkage long
477sys32_init_module(void __user *umod, unsigned long len,
478 const char __user *uargs)
479{
480 return sys_init_module(umod, len, uargs);
481}
482
483asmlinkage long
484sys32_delete_module(const char __user *name_user, unsigned int flags)
485{
486 return sys_delete_module(name_user, flags);
487}
488
489#else /* CONFIG_MODULES */
490
491asmlinkage long
492sys32_init_module(void __user *umod, unsigned long len,
493 const char __user *uargs)
494{
495 return -ENOSYS;
496} 466}
497 467
498asmlinkage long
499sys32_delete_module(const char __user *name_user, unsigned int flags)
500{
501 return -ENOSYS;
502}
503
504#endif /* CONFIG_MODULES */
505
506asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 468asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
507 size_t count, u32 poshi, u32 poslo) 469 size_t count, u32 poshi, u32 poslo)
508{ 470{
@@ -801,23 +763,6 @@ asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
801 return sys_write(fd, buf, count); 763 return sys_write(fd, buf, count);
802} 764}
803 765
804asmlinkage long sys32_clone(void)
805{
806 struct pt_regs *regs = task_pt_regs(current);
807 unsigned long clone_flags;
808 unsigned long newsp;
809 int __user *parent_tidptr, *child_tidptr;
810
811 clone_flags = regs->gprs[3] & 0xffffffffUL;
812 newsp = regs->orig_gpr2 & 0x7fffffffUL;
813 parent_tidptr = compat_ptr(regs->gprs[4]);
814 child_tidptr = compat_ptr(regs->gprs[5]);
815 if (!newsp)
816 newsp = regs->gprs[15];
817 return do_fork(clone_flags, newsp, regs, 0,
818 parent_tidptr, child_tidptr);
819}
820
821/* 766/*
822 * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. 767 * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64.
823 * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} 768 * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE}
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 836a28842900..c07f9ca05ade 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -198,7 +198,8 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
198 compat_sigset_t __user *oset, size_t sigsetsize); 198 compat_sigset_t __user *oset, size_t sigsetsize);
199long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize); 199long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
200long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo); 200long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
201long sys32_execve(void); 201long sys32_execve(char __user *name, compat_uptr_t __user *argv,
202 compat_uptr_t __user *envp);
202long sys32_init_module(void __user *umod, unsigned long len, 203long sys32_init_module(void __user *umod, unsigned long len,
203 const char __user *uargs); 204 const char __user *uargs);
204long sys32_delete_module(const char __user *name_user, unsigned int flags); 205long sys32_delete_module(const char __user *name_user, unsigned int flags);
@@ -222,7 +223,6 @@ unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg);
222long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg); 223long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg);
223long sys32_read(unsigned int fd, char __user * buf, size_t count); 224long sys32_read(unsigned int fd, char __user * buf, size_t count);
224long sys32_write(unsigned int fd, char __user * buf, size_t count); 225long sys32_write(unsigned int fd, char __user * buf, size_t count);
225long sys32_clone(void);
226long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise); 226long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
227long sys32_fadvise64_64(struct fadvise64_64_args __user *args); 227long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
228long sys32_sigaction(int sig, const struct old_sigaction32 __user *act, 228long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 88a83366819f..682fb69dba21 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -568,18 +568,18 @@ compat_sys_sigprocmask_wrapper:
568 llgtr %r4,%r4 # compat_old_sigset_t * 568 llgtr %r4,%r4 # compat_old_sigset_t *
569 jg compat_sys_sigprocmask # branch to system call 569 jg compat_sys_sigprocmask # branch to system call
570 570
571 .globl sys32_init_module_wrapper 571 .globl sys_init_module_wrapper
572sys32_init_module_wrapper: 572sys_init_module_wrapper:
573 llgtr %r2,%r2 # void * 573 llgtr %r2,%r2 # void *
574 llgfr %r3,%r3 # unsigned long 574 llgfr %r3,%r3 # unsigned long
575 llgtr %r4,%r4 # char * 575 llgtr %r4,%r4 # char *
576 jg sys32_init_module # branch to system call 576 jg sys_init_module # branch to system call
577 577
578 .globl sys32_delete_module_wrapper 578 .globl sys_delete_module_wrapper
579sys32_delete_module_wrapper: 579sys_delete_module_wrapper:
580 llgtr %r2,%r2 # const char * 580 llgtr %r2,%r2 # const char *
581 llgfr %r3,%r3 # unsigned int 581 llgfr %r3,%r3 # unsigned int
582 jg sys32_delete_module # branch to system call 582 jg sys_delete_module # branch to system call
583 583
584 .globl sys32_quotactl_wrapper 584 .globl sys32_quotactl_wrapper
585sys32_quotactl_wrapper: 585sys32_quotactl_wrapper:
@@ -1832,11 +1832,26 @@ compat_sys_rt_tgsigqueueinfo_wrapper:
1832 llgtr %r5,%r5 # struct compat_siginfo * 1832 llgtr %r5,%r5 # struct compat_siginfo *
1833 jg compat_sys_rt_tgsigqueueinfo_wrapper # branch to system call 1833 jg compat_sys_rt_tgsigqueueinfo_wrapper # branch to system call
1834 1834
1835 .globl sys_perf_counter_open_wrapper 1835 .globl sys_perf_event_open_wrapper
1836sys_perf_counter_open_wrapper: 1836sys_perf_event_open_wrapper:
1837 llgtr %r2,%r2 # const struct perf_counter_attr * 1837 llgtr %r2,%r2 # const struct perf_event_attr *
1838 lgfr %r3,%r3 # pid_t 1838 lgfr %r3,%r3 # pid_t
1839 lgfr %r4,%r4 # int 1839 lgfr %r4,%r4 # int
1840 lgfr %r5,%r5 # int 1840 lgfr %r5,%r5 # int
1841 llgfr %r6,%r6 # unsigned long 1841 llgfr %r6,%r6 # unsigned long
1842 jg sys_perf_counter_open # branch to system call 1842 jg sys_perf_event_open # branch to system call
1843
1844 .globl sys_clone_wrapper
1845sys_clone_wrapper:
1846 llgfr %r2,%r2 # unsigned long
1847 llgfr %r3,%r3 # unsigned long
1848 llgtr %r4,%r4 # int *
1849 llgtr %r5,%r5 # int *
1850 jg sys_clone # branch to system call
1851
1852 .globl sys32_execve_wrapper
1853sys32_execve_wrapper:
1854 llgtr %r2,%r2 # char *
1855 llgtr %r3,%r3 # compat_uptr_t *
1856 llgtr %r4,%r4 # compat_uptr_t *
1857 jg sys32_execve # branch to system call
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index 950c59c6688b..e1e5e767ab56 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -42,10 +42,12 @@ long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
42long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, 42long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
43 u32 len_low); 43 u32 len_low);
44long sys_fork(void); 44long sys_fork(void);
45long sys_clone(void); 45long sys_clone(unsigned long newsp, unsigned long clone_flags,
46 int __user *parent_tidptr, int __user *child_tidptr);
46long sys_vfork(void); 47long sys_vfork(void);
47void execve_tail(void); 48void execve_tail(void);
48long sys_execve(void); 49long sys_execve(char __user *name, char __user * __user *argv,
50 char __user * __user *envp);
49long sys_sigsuspend(int history0, int history1, old_sigset_t mask); 51long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
50long sys_sigaction(int sig, const struct old_sigaction __user *act, 52long sys_sigaction(int sig, const struct old_sigaction __user *act,
51 struct old_sigaction __user *oact); 53 struct old_sigaction __user *oact);
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 5a43f27eec13..59fe6ecc6ed3 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -32,6 +32,7 @@
32#include <linux/elfcore.h> 32#include <linux/elfcore.h>
33#include <linux/kernel_stat.h> 33#include <linux/kernel_stat.h>
34#include <linux/syscalls.h> 34#include <linux/syscalls.h>
35#include <linux/compat.h>
35#include <asm/compat.h> 36#include <asm/compat.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37#include <asm/pgtable.h> 38#include <asm/pgtable.h>
@@ -230,17 +231,11 @@ SYSCALL_DEFINE0(fork)
230 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL); 231 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL);
231} 232}
232 233
233SYSCALL_DEFINE0(clone) 234SYSCALL_DEFINE4(clone, unsigned long, newsp, unsigned long, clone_flags,
235 int __user *, parent_tidptr, int __user *, child_tidptr)
234{ 236{
235 struct pt_regs *regs = task_pt_regs(current); 237 struct pt_regs *regs = task_pt_regs(current);
236 unsigned long clone_flags;
237 unsigned long newsp;
238 int __user *parent_tidptr, *child_tidptr;
239 238
240 clone_flags = regs->gprs[3];
241 newsp = regs->orig_gpr2;
242 parent_tidptr = (int __user *) regs->gprs[4];
243 child_tidptr = (int __user *) regs->gprs[5];
244 if (!newsp) 239 if (!newsp)
245 newsp = regs->gprs[15]; 240 newsp = regs->gprs[15];
246 return do_fork(clone_flags, newsp, regs, 0, 241 return do_fork(clone_flags, newsp, regs, 0,
@@ -274,30 +269,25 @@ asmlinkage void execve_tail(void)
274/* 269/*
275 * sys_execve() executes a new program. 270 * sys_execve() executes a new program.
276 */ 271 */
277SYSCALL_DEFINE0(execve) 272SYSCALL_DEFINE3(execve, char __user *, name, char __user * __user *, argv,
273 char __user * __user *, envp)
278{ 274{
279 struct pt_regs *regs = task_pt_regs(current); 275 struct pt_regs *regs = task_pt_regs(current);
280 char *filename; 276 char *filename;
281 unsigned long result; 277 long rc;
282 int rc;
283 278
284 filename = getname((char __user *) regs->orig_gpr2); 279 filename = getname(name);
285 if (IS_ERR(filename)) { 280 rc = PTR_ERR(filename);
286 result = PTR_ERR(filename); 281 if (IS_ERR(filename))
282 return rc;
283 rc = do_execve(filename, argv, envp, regs);
284 if (rc)
287 goto out; 285 goto out;
288 }
289 rc = do_execve(filename, (char __user * __user *) regs->gprs[3],
290 (char __user * __user *) regs->gprs[4], regs);
291 if (rc) {
292 result = rc;
293 goto out_putname;
294 }
295 execve_tail(); 286 execve_tail();
296 result = regs->gprs[2]; 287 rc = regs->gprs[2];
297out_putname:
298 putname(filename);
299out: 288out:
300 return result; 289 putname(filename);
290 return rc;
301} 291}
302 292
303/* 293/*
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f3ddd7ac06c5..a8738676b26c 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -339,24 +339,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
339 int copied, ret; 339 int copied, ret;
340 340
341 switch (request) { 341 switch (request) {
342 case PTRACE_PEEKTEXT:
343 case PTRACE_PEEKDATA:
344 /* Remove high order bit from address (only for 31 bit). */
345 addr &= PSW_ADDR_INSN;
346 /* read word at location addr. */
347 return generic_ptrace_peekdata(child, addr, data);
348
349 case PTRACE_PEEKUSR: 342 case PTRACE_PEEKUSR:
350 /* read the word at location addr in the USER area. */ 343 /* read the word at location addr in the USER area. */
351 return peek_user(child, addr, data); 344 return peek_user(child, addr, data);
352 345
353 case PTRACE_POKETEXT:
354 case PTRACE_POKEDATA:
355 /* Remove high order bit from address (only for 31 bit). */
356 addr &= PSW_ADDR_INSN;
357 /* write the word at location addr. */
358 return generic_ptrace_pokedata(child, addr, data);
359
360 case PTRACE_POKEUSR: 346 case PTRACE_POKEUSR:
361 /* write the word at location addr in the USER area */ 347 /* write the word at location addr in the USER area */
362 return poke_user(child, addr, data); 348 return poke_user(child, addr, data);
@@ -386,8 +372,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
386 copied += sizeof(unsigned long); 372 copied += sizeof(unsigned long);
387 } 373 }
388 return 0; 374 return 0;
375 default:
376 /* Removing high order bit from addr (only for 31 bit). */
377 addr &= PSW_ADDR_INSN;
378 return ptrace_request(child, request, addr, data);
389 } 379 }
390 return ptrace_request(child, request, addr, data);
391} 380}
392 381
393#ifdef CONFIG_COMPAT 382#ifdef CONFIG_COMPAT
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index 20639dfe0c42..e27ca63076d1 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -24,8 +24,6 @@ LC_EXT_INT_CODE = 0x86 # addr of ext int code
24# R3 = external interruption parameter if R2=0 24# R3 = external interruption parameter if R2=0
25# 25#
26 26
27.section ".init.text","ax"
28
29_sclp_wait_int: 27_sclp_wait_int:
30 stm %r6,%r15,24(%r15) # save registers 28 stm %r6,%r15,24(%r15) # save registers
31 basr %r13,0 # get base register 29 basr %r13,0 # get base register
@@ -318,9 +316,8 @@ _sclp_print_early:
318 .long _sclp_work_area 316 .long _sclp_work_area
319.Lascebc: 317.Lascebc:
320 .long _ascebc 318 .long _ascebc
321.previous
322 319
323.section ".init.data","a" 320.section .data,"aw",@progbits
324 .balign 4096 321 .balign 4096
325_sclp_work_area: 322_sclp_work_area:
326 .fill 4096 323 .fill 4096
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 56c16876b919..b4b6396e6cf0 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -475,10 +475,8 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
475{ 475{
476 unsigned long async_stack, panic_stack; 476 unsigned long async_stack, panic_stack;
477 struct _lowcore *lowcore; 477 struct _lowcore *lowcore;
478 int lc_order;
479 478
480 lc_order = sizeof(long) == 8 ? 1 : 0; 479 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
481 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
482 if (!lowcore) 480 if (!lowcore)
483 return -ENOMEM; 481 return -ENOMEM;
484 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); 482 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
@@ -509,16 +507,14 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
509out: 507out:
510 free_page(panic_stack); 508 free_page(panic_stack);
511 free_pages(async_stack, ASYNC_ORDER); 509 free_pages(async_stack, ASYNC_ORDER);
512 free_pages((unsigned long) lowcore, lc_order); 510 free_pages((unsigned long) lowcore, LC_ORDER);
513 return -ENOMEM; 511 return -ENOMEM;
514} 512}
515 513
516static void smp_free_lowcore(int cpu) 514static void smp_free_lowcore(int cpu)
517{ 515{
518 struct _lowcore *lowcore; 516 struct _lowcore *lowcore;
519 int lc_order;
520 517
521 lc_order = sizeof(long) == 8 ? 1 : 0;
522 lowcore = lowcore_ptr[cpu]; 518 lowcore = lowcore_ptr[cpu];
523#ifndef CONFIG_64BIT 519#ifndef CONFIG_64BIT
524 if (MACHINE_HAS_IEEE) 520 if (MACHINE_HAS_IEEE)
@@ -528,7 +524,7 @@ static void smp_free_lowcore(int cpu)
528#endif 524#endif
529 free_page(lowcore->panic_stack - PAGE_SIZE); 525 free_page(lowcore->panic_stack - PAGE_SIZE);
530 free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER); 526 free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER);
531 free_pages((unsigned long) lowcore, lc_order); 527 free_pages((unsigned long) lowcore, LC_ORDER);
532 lowcore_ptr[cpu] = NULL; 528 lowcore_ptr[cpu] = NULL;
533} 529}
534 530
@@ -664,7 +660,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
664 unsigned long async_stack, panic_stack; 660 unsigned long async_stack, panic_stack;
665 struct _lowcore *lowcore; 661 struct _lowcore *lowcore;
666 unsigned int cpu; 662 unsigned int cpu;
667 int lc_order;
668 663
669 smp_detect_cpus(); 664 smp_detect_cpus();
670 665
@@ -674,8 +669,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
674 print_cpu_info(); 669 print_cpu_info();
675 670
676 /* Reallocate current lowcore, but keep its contents. */ 671 /* Reallocate current lowcore, but keep its contents. */
677 lc_order = sizeof(long) == 8 ? 1 : 0; 672 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
678 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
679 panic_stack = __get_free_page(GFP_KERNEL); 673 panic_stack = __get_free_page(GFP_KERNEL);
680 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); 674 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
681 BUG_ON(!lowcore || !panic_stack || !async_stack); 675 BUG_ON(!lowcore || !panic_stack || !async_stack);
@@ -1047,42 +1041,6 @@ out:
1047static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, 1041static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show,
1048 dispatching_store); 1042 dispatching_store);
1049 1043
1050/*
1051 * If the resume kernel runs on another cpu than the suspended kernel,
1052 * we have to switch the cpu IDs in the logical map.
1053 */
1054void smp_switch_boot_cpu_in_resume(u32 resume_phys_cpu_id,
1055 struct _lowcore *suspend_lowcore)
1056{
1057 int cpu, suspend_cpu_id, resume_cpu_id;
1058 u32 suspend_phys_cpu_id;
1059
1060 suspend_phys_cpu_id = __cpu_logical_map[suspend_lowcore->cpu_nr];
1061 suspend_cpu_id = suspend_lowcore->cpu_nr;
1062
1063 for_each_present_cpu(cpu) {
1064 if (__cpu_logical_map[cpu] == resume_phys_cpu_id) {
1065 resume_cpu_id = cpu;
1066 goto found;
1067 }
1068 }
1069 panic("Could not find resume cpu in logical map.\n");
1070
1071found:
1072 printk("Resume cpu ID: %i/%i\n", resume_phys_cpu_id, resume_cpu_id);
1073 printk("Suspend cpu ID: %i/%i\n", suspend_phys_cpu_id, suspend_cpu_id);
1074
1075 __cpu_logical_map[resume_cpu_id] = suspend_phys_cpu_id;
1076 __cpu_logical_map[suspend_cpu_id] = resume_phys_cpu_id;
1077
1078 lowcore_ptr[suspend_cpu_id]->cpu_addr = resume_phys_cpu_id;
1079}
1080
1081u32 smp_get_phys_cpu_id(void)
1082{
1083 return __cpu_logical_map[smp_processor_id()];
1084}
1085
1086static int __init topology_init(void) 1044static int __init topology_init(void)
1087{ 1045{
1088 int cpu; 1046 int cpu;
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index 086bee970cae..cf9e5c6d5527 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -6,36 +6,26 @@
6 * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com> 6 * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com>
7 */ 7 */
8 8
9#include <linux/suspend.h>
10#include <linux/reboot.h>
11#include <linux/pfn.h> 9#include <linux/pfn.h>
12#include <linux/mm.h>
13#include <asm/sections.h>
14#include <asm/system.h> 10#include <asm/system.h>
15#include <asm/ipl.h>
16 11
17/* 12/*
18 * References to section boundaries 13 * References to section boundaries
19 */ 14 */
20extern const void __nosave_begin, __nosave_end; 15extern const void __nosave_begin, __nosave_end;
21 16
22/*
23 * check if given pfn is in the 'nosave' or in the read only NSS section
24 */
25int pfn_is_nosave(unsigned long pfn) 17int pfn_is_nosave(unsigned long pfn)
26{ 18{
27 unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT; 19 unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
28 unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) 20 unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end));
29 >> PAGE_SHIFT;
30 unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1;
31 unsigned long stext_pfn = PFN_DOWN(__pa(&_stext));
32 21
22 /* Always save lowcore pages (LC protection might be enabled). */
23 if (pfn <= LC_PAGES)
24 return 0;
33 if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn) 25 if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn)
34 return 1; 26 return 1;
35 if (pfn >= stext_pfn && pfn <= eshared_pfn) { 27 /* Skip memory holes and read-only pages (NSS, DCSS, ...). */
36 if (ipl_info.type == IPL_TYPE_NSS) 28 if (tprot(PFN_PHYS(pfn)))
37 return 1;
38 } else if ((tprot(pfn * PAGE_SIZE) && pfn > 0))
39 return 1; 29 return 1;
40 return 0; 30 return 0;
41} 31}
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index 7cd6b096f0d1..fe927d0bc20b 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -9,6 +9,7 @@
9 9
10#include <asm/page.h> 10#include <asm/page.h>
11#include <asm/ptrace.h> 11#include <asm/ptrace.h>
12#include <asm/thread_info.h>
12#include <asm/asm-offsets.h> 13#include <asm/asm-offsets.h>
13 14
14/* 15/*
@@ -41,6 +42,9 @@ swsusp_arch_suspend:
41 /* Get pointer to save area */ 42 /* Get pointer to save area */
42 lghi %r1,0x1000 43 lghi %r1,0x1000
43 44
45 /* Save CPU address */
46 stap __LC_CPU_ADDRESS(%r1)
47
44 /* Store registers */ 48 /* Store registers */
45 mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */ 49 mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */
46 stfpc 0x31c(%r1) /* store fpu control */ 50 stfpc 0x31c(%r1) /* store fpu control */
@@ -102,11 +106,10 @@ swsusp_arch_resume:
102 aghi %r15,-STACK_FRAME_OVERHEAD 106 aghi %r15,-STACK_FRAME_OVERHEAD
103 stg %r1,__SF_BACKCHAIN(%r15) 107 stg %r1,__SF_BACKCHAIN(%r15)
104 108
105#ifdef CONFIG_SMP 109 /* Make all free pages stable */
106 /* Save boot cpu number */ 110 lghi %r2,1
107 brasl %r14,smp_get_phys_cpu_id 111 brasl %r14,arch_set_page_states
108 lgr %r10,%r2 112
109#endif
110 /* Deactivate DAT */ 113 /* Deactivate DAT */
111 stnsm __SF_EMPTY(%r15),0xfb 114 stnsm __SF_EMPTY(%r15),0xfb
112 115
@@ -133,6 +136,69 @@ swsusp_arch_resume:
1332: 1362:
134 ptlb /* flush tlb */ 137 ptlb /* flush tlb */
135 138
139 /* Reset System */
140 larl %r1,restart_entry
141 larl %r2,.Lrestart_diag308_psw
142 og %r1,0(%r2)
143 stg %r1,0(%r0)
144 larl %r1,.Lnew_pgm_check_psw
145 epsw %r2,%r3
146 stm %r2,%r3,0(%r1)
147 mvc __LC_PGM_NEW_PSW(16,%r0),0(%r1)
148 lghi %r0,0
149 diag %r0,%r0,0x308
150restart_entry:
151 lhi %r1,1
152 sigp %r1,%r0,0x12
153 sam64
154 larl %r1,.Lnew_pgm_check_psw
155 lpswe 0(%r1)
156pgm_check_entry:
157
158 /* Switch to original suspend CPU */
159 larl %r1,.Lresume_cpu /* Resume CPU address: r2 */
160 stap 0(%r1)
161 llgh %r2,0(%r1)
162 lghi %r3,0x1000
163 llgh %r1,__LC_CPU_ADDRESS(%r3) /* Suspend CPU address: r1 */
164 cgr %r1,%r2
165 je restore_registers /* r1 = r2 -> nothing to do */
166 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
167 mvc __LC_RESTART_PSW(16,%r0),0(%r4)
1683:
169 sigp %r9,%r1,__SIGP_INITIAL_CPU_RESET
170 brc 8,4f /* accepted */
171 brc 2,3b /* busy, try again */
172
173 /* Suspend CPU not available -> panic */
174 larl %r15,init_thread_union
175 ahi %r15,1<<(PAGE_SHIFT+THREAD_ORDER)
176 larl %r2,.Lpanic_string
177 larl %r3,_sclp_print_early
178 lghi %r1,0
179 sam31
180 sigp %r1,%r0,0x12
181 basr %r14,%r3
182 larl %r3,.Ldisabled_wait_31
183 lpsw 0(%r3)
1844:
185 /* Switch to suspend CPU */
186 sigp %r9,%r1,__SIGP_RESTART /* start suspend CPU */
187 brc 2,4b /* busy, try again */
1885:
189 sigp %r9,%r2,__SIGP_STOP /* stop resume (current) CPU */
1906: j 6b
191
192restart_suspend:
193 larl %r1,.Lresume_cpu
194 llgh %r2,0(%r1)
1957:
196 sigp %r9,%r2,__SIGP_SENSE /* Wait for resume CPU */
197 brc 2,7b /* busy, try again */
198 tmll %r9,0x40 /* Test if resume CPU is stopped */
199 jz 7b
200
201restore_registers:
136 /* Restore registers */ 202 /* Restore registers */
137 lghi %r13,0x1000 /* %r1 = pointer to save arae */ 203 lghi %r13,0x1000 /* %r1 = pointer to save arae */
138 204
@@ -166,19 +232,33 @@ swsusp_arch_resume:
166 /* Pointer to save area */ 232 /* Pointer to save area */
167 lghi %r13,0x1000 233 lghi %r13,0x1000
168 234
169#ifdef CONFIG_SMP
170 /* Switch CPUs */
171 lgr %r2,%r10 /* get cpu id */
172 llgf %r3,0x318(%r13)
173 brasl %r14,smp_switch_boot_cpu_in_resume
174#endif
175 /* Restore prefix register */ 235 /* Restore prefix register */
176 spx 0x318(%r13) 236 spx 0x318(%r13)
177 237
178 /* Activate DAT */ 238 /* Activate DAT */
179 stosm __SF_EMPTY(%r15),0x04 239 stosm __SF_EMPTY(%r15),0x04
180 240
241 /* Make all free pages unstable */
242 lghi %r2,0
243 brasl %r14,arch_set_page_states
244
181 /* Return 0 */ 245 /* Return 0 */
182 lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15) 246 lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15)
183 lghi %r2,0 247 lghi %r2,0
184 br %r14 248 br %r14
249
250 .section .data.nosave,"aw",@progbits
251 .align 8
252.Ldisabled_wait_31:
253 .long 0x000a0000,0x00000000
254.Lpanic_string:
255 .asciz "Resume not possible because suspend CPU is no longer available"
256 .align 8
257.Lrestart_diag308_psw:
258 .long 0x00080000,0x80000000
259.Lrestart_suspend_psw:
260 .quad 0x0000000180000000,restart_suspend
261.Lnew_pgm_check_psw:
262 .quad 0,pgm_check_entry
263.Lresume_cpu:
264 .byte 0,0
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index ad1acd200385..30eca070d426 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -19,7 +19,7 @@ SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall)
19SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper) 19SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper)
20SYSCALL(sys_link,sys_link,sys32_link_wrapper) 20SYSCALL(sys_link,sys_link,sys32_link_wrapper)
21SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */ 21SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */
22SYSCALL(sys_execve,sys_execve,sys32_execve) 22SYSCALL(sys_execve,sys_execve,sys32_execve_wrapper)
23SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper) 23SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper)
24SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */ 24SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */
25SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper) 25SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper)
@@ -128,7 +128,7 @@ SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
133SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
@@ -136,8 +136,8 @@ SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper) 137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper)
138NI_SYSCALL /* old "create module" */ 138NI_SYSCALL /* old "create module" */
139SYSCALL(sys_init_module,sys_init_module,sys32_init_module_wrapper) 139SYSCALL(sys_init_module,sys_init_module,sys_init_module_wrapper)
140SYSCALL(sys_delete_module,sys_delete_module,sys32_delete_module_wrapper) 140SYSCALL(sys_delete_module,sys_delete_module,sys_delete_module_wrapper)
141NI_SYSCALL /* 130: old get_kernel_syms */ 141NI_SYSCALL /* 130: old get_kernel_syms */
142SYSCALL(sys_quotactl,sys_quotactl,sys32_quotactl_wrapper) 142SYSCALL(sys_quotactl,sys_quotactl,sys32_quotactl_wrapper)
143SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper) 143SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper)
@@ -339,4 +339,4 @@ SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper) 339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ 341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */
342SYSCALL(sys_perf_counter_open,sys_perf_counter_open,sys_perf_counter_open_wrapper) 342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 2c2f98353415..43486c2408e1 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -478,7 +478,7 @@ int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
478 if (!inti) 478 if (!inti)
479 return -ENOMEM; 479 return -ENOMEM;
480 480
481 inti->type = KVM_S390_PROGRAM_INT;; 481 inti->type = KVM_S390_PROGRAM_INT;
482 inti->pgm.code = code; 482 inti->pgm.code = code;
483 483
484 VCPU_EVENT(vcpu, 3, "inject: program check %d (from kernel)", code); 484 VCPU_EVENT(vcpu, 3, "inject: program check %d (from kernel)", code);
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 1abbadd497e1..6d507462967a 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -10,7 +10,7 @@
10 * Copyright (C) 1995 Linus Torvalds 10 * Copyright (C) 1995 Linus Torvalds
11 */ 11 */
12 12
13#include <linux/perf_counter.h> 13#include <linux/perf_event.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -306,7 +306,7 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int write)
306 * interrupts again and then search the VMAs 306 * interrupts again and then search the VMAs
307 */ 307 */
308 local_irq_enable(); 308 local_irq_enable();
309 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 309 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
310 down_read(&mm->mmap_sem); 310 down_read(&mm->mmap_sem);
311 311
312 si_code = SEGV_MAPERR; 312 si_code = SEGV_MAPERR;
@@ -366,11 +366,11 @@ good_area:
366 } 366 }
367 if (fault & VM_FAULT_MAJOR) { 367 if (fault & VM_FAULT_MAJOR) {
368 tsk->maj_flt++; 368 tsk->maj_flt++;
369 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 369 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
370 regs, address); 370 regs, address);
371 } else { 371 } else {
372 tsk->min_flt++; 372 tsk->min_flt++;
373 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 373 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
374 regs, address); 374 regs, address);
375 } 375 }
376 up_read(&mm->mmap_sem); 376 up_read(&mm->mmap_sem);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index c634dfbe92e9..765647952221 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -105,7 +105,7 @@ void __init mem_init(void)
105 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 105 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
106 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 106 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
107 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n", 107 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n",
108 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 108 nr_free_pages() << (PAGE_SHIFT-10),
109 max_mapnr << (PAGE_SHIFT-10), 109 max_mapnr << (PAGE_SHIFT-10),
110 codesize >> 10, 110 codesize >> 10,
111 reservedpages << (PAGE_SHIFT-10), 111 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c
index f92ec203ad92..098923ae458f 100644
--- a/arch/s390/mm/page-states.c
+++ b/arch/s390/mm/page-states.c
@@ -50,28 +50,64 @@ void __init cmma_init(void)
50 cmma_flag = 0; 50 cmma_flag = 0;
51} 51}
52 52
53void arch_free_page(struct page *page, int order) 53static inline void set_page_unstable(struct page *page, int order)
54{ 54{
55 int i, rc; 55 int i, rc;
56 56
57 if (!cmma_flag)
58 return;
59 for (i = 0; i < (1 << order); i++) 57 for (i = 0; i < (1 << order); i++)
60 asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0" 58 asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
61 : "=&d" (rc) 59 : "=&d" (rc)
62 : "a" ((page_to_pfn(page) + i) << PAGE_SHIFT), 60 : "a" (page_to_phys(page + i)),
63 "i" (ESSA_SET_UNUSED)); 61 "i" (ESSA_SET_UNUSED));
64} 62}
65 63
66void arch_alloc_page(struct page *page, int order) 64void arch_free_page(struct page *page, int order)
67{ 65{
68 int i, rc;
69
70 if (!cmma_flag) 66 if (!cmma_flag)
71 return; 67 return;
68 set_page_unstable(page, order);
69}
70
71static inline void set_page_stable(struct page *page, int order)
72{
73 int i, rc;
74
72 for (i = 0; i < (1 << order); i++) 75 for (i = 0; i < (1 << order); i++)
73 asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0" 76 asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
74 : "=&d" (rc) 77 : "=&d" (rc)
75 : "a" ((page_to_pfn(page) + i) << PAGE_SHIFT), 78 : "a" (page_to_phys(page + i)),
76 "i" (ESSA_SET_STABLE)); 79 "i" (ESSA_SET_STABLE));
77} 80}
81
82void arch_alloc_page(struct page *page, int order)
83{
84 if (!cmma_flag)
85 return;
86 set_page_stable(page, order);
87}
88
89void arch_set_page_states(int make_stable)
90{
91 unsigned long flags, order, t;
92 struct list_head *l;
93 struct page *page;
94 struct zone *zone;
95
96 if (!cmma_flag)
97 return;
98 if (make_stable)
99 drain_local_pages(NULL);
100 for_each_populated_zone(zone) {
101 spin_lock_irqsave(&zone->lock, flags);
102 for_each_migratetype_order(order, t) {
103 list_for_each(l, &zone->free_area[order].free_list[t]) {
104 page = list_entry(l, struct page, lru);
105 if (make_stable)
106 set_page_stable(page, order);
107 else
108 set_page_unstable(page, order);
109 }
110 }
111 spin_unlock_irqrestore(&zone->lock, flags);
112 }
113}
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index c70215247071..c60bfb309ce6 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -314,21 +314,18 @@ int s390_enable_sie(void)
314} 314}
315EXPORT_SYMBOL_GPL(s390_enable_sie); 315EXPORT_SYMBOL_GPL(s390_enable_sie);
316 316
317#ifdef CONFIG_DEBUG_PAGEALLOC 317#if defined(CONFIG_DEBUG_PAGEALLOC) && defined(CONFIG_HIBERNATION)
318#ifdef CONFIG_HIBERNATION
319bool kernel_page_present(struct page *page) 318bool kernel_page_present(struct page *page)
320{ 319{
321 unsigned long addr; 320 unsigned long addr;
322 int cc; 321 int cc;
323 322
324 addr = page_to_phys(page); 323 addr = page_to_phys(page);
325 asm("lra %1,0(%1)\n" 324 asm volatile(
326 "ipm %0\n" 325 " lra %1,0(%1)\n"
327 "srl %0,28" 326 " ipm %0\n"
328 :"=d"(cc),"+a"(addr)::"cc"); 327 " srl %0,28"
328 : "=d" (cc), "+a" (addr) : : "cc");
329 return cc == 0; 329 return cc == 0;
330} 330}
331 331#endif /* CONFIG_HIBERNATION && CONFIG_DEBUG_PAGEALLOC */
332#endif /* CONFIG_HIBERNATION */
333#endif /* CONFIG_DEBUG_PAGEALLOC */
334
diff --git a/arch/score/include/asm/page.h b/arch/score/include/asm/page.h
index ee5821042fcc..d92a5a2d36d4 100644
--- a/arch/score/include/asm/page.h
+++ b/arch/score/include/asm/page.h
@@ -2,10 +2,11 @@
2#define _ASM_SCORE_PAGE_H 2#define _ASM_SCORE_PAGE_H
3 3
4#include <linux/pfn.h> 4#include <linux/pfn.h>
5#include <linux/const.h>
5 6
6/* PAGE_SHIFT determines the page size */ 7/* PAGE_SHIFT determines the page size */
7#define PAGE_SHIFT (12) 8#define PAGE_SHIFT (12)
8#define PAGE_SIZE (1UL << PAGE_SHIFT) 9#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1)) 10#define PAGE_MASK (~(PAGE_SIZE-1))
10 11
11#ifdef __KERNEL__ 12#ifdef __KERNEL__
diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h
index 3a1122885528..55939992c27d 100644
--- a/arch/score/include/asm/thread_info.h
+++ b/arch/score/include/asm/thread_info.h
@@ -7,6 +7,15 @@
7#define KU_USER 0x08 7#define KU_USER 0x08
8#define KU_KERN 0x00 8#define KU_KERN 0x00
9 9
10#include <asm/page.h>
11#include <linux/const.h>
12
13/* thread information allocation */
14#define THREAD_SIZE_ORDER (1)
15#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
16#define THREAD_MASK (THREAD_SIZE - _AC(1,UL))
17#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
18
10#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
11 20
12#include <asm/processor.h> 21#include <asm/processor.h>
@@ -62,12 +71,6 @@ struct thread_info {
62register struct thread_info *__current_thread_info __asm__("r28"); 71register struct thread_info *__current_thread_info __asm__("r28");
63#define current_thread_info() __current_thread_info 72#define current_thread_info() __current_thread_info
64 73
65/* thread information allocation */
66#define THREAD_SIZE_ORDER (1)
67#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
68#define THREAD_MASK (THREAD_SIZE - 1UL)
69#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
70
71#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) 74#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
72#define free_thread_info(info) kfree(info) 75#define free_thread_info(info) kfree(info)
73 76
diff --git a/arch/score/kernel/vmlinux.lds.S b/arch/score/kernel/vmlinux.lds.S
index f85569831d5c..eebcbaa4e978 100644
--- a/arch/score/kernel/vmlinux.lds.S
+++ b/arch/score/kernel/vmlinux.lds.S
@@ -24,6 +24,8 @@
24 */ 24 */
25 25
26#include <asm-generic/vmlinux.lds.h> 26#include <asm-generic/vmlinux.lds.h>
27#include <asm/thread_info.h>
28#include <asm/page.h>
27 29
28OUTPUT_ARCH(score) 30OUTPUT_ARCH(score)
29ENTRY(_stext) 31ENTRY(_stext)
@@ -49,21 +51,9 @@ SECTIONS
49 . = ALIGN(16); 51 . = ALIGN(16);
50 RODATA 52 RODATA
51 53
52 /* Exception table */ 54 EXCEPTION_TABLE(16)
53 . = ALIGN(16);
54 __ex_table : {
55 __start___ex_table = .;
56 *(__ex_table)
57 __stop___ex_table = .;
58 }
59 55
60 /* writeable */ 56 RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE)
61 .data ALIGN (4096): {
62 *(.data.init_task)
63
64 DATA_DATA
65 CONSTRUCTORS
66 }
67 57
68 /* We want the small data sections together, so single-instruction offsets 58 /* We want the small data sections together, so single-instruction offsets
69 can access them all, and initialized data all before uninitialized, so 59 can access them all, and initialized data all before uninitialized, so
@@ -72,45 +62,14 @@ SECTIONS
72 .sdata : { 62 .sdata : {
73 *(.sdata) 63 *(.sdata)
74 } 64 }
75
76 . = ALIGN(32);
77 .data.cacheline_aligned : {
78 *(.data.cacheline_aligned)
79 }
80 _edata = .; /* End of data section */ 65 _edata = .; /* End of data section */
81 66
82 /* will be freed after init */ 67 /* will be freed after init */
83 . = ALIGN(4096); /* Init code and data */ 68 . = ALIGN(PAGE_SIZE); /* Init code and data */
84 __init_begin = .; 69 __init_begin = .;
85 70
86 . = ALIGN(4096); 71 INIT_TEXT_SECTION(PAGE_SIZE)
87 .init.text : { 72 INIT_DATA_SECTION(16)
88 _sinittext = .;
89 INIT_TEXT
90 _einittext = .;
91 }
92 .init.data : {
93 INIT_DATA
94 }
95 . = ALIGN(16);
96 .init.setup : {
97 __setup_start = .;
98 *(.init.setup)
99 __setup_end = .;
100 }
101
102 .initcall.init : {
103 __initcall_start = .;
104 INITCALLS
105 __initcall_end = .;
106 }
107
108 .con_initcall.init : {
109 __con_initcall_start = .;
110 *(.con_initcall.init)
111 __con_initcall_end = .;
112 }
113 SECURITY_INIT
114 73
115 /* .exit.text is discarded at runtime, not link time, to deal with 74 /* .exit.text is discarded at runtime, not link time, to deal with
116 * references from .rodata 75 * references from .rodata
@@ -121,28 +80,10 @@ SECTIONS
121 .exit.data : { 80 .exit.data : {
122 EXIT_DATA 81 EXIT_DATA
123 } 82 }
124#if defined(CONFIG_BLK_DEV_INITRD) 83 . = ALIGN(PAGE_SIZE);
125 .init.ramfs ALIGN(4096): {
126 __initramfs_start = .;
127 *(.init.ramfs)
128 __initramfs_end = .;
129 . = ALIGN(4);
130 LONG(0);
131 }
132#endif
133 . = ALIGN(4096);
134 __init_end = .; 84 __init_end = .;
135 /* freed after init ends here */ 85 /* freed after init ends here */
136 86
137 __bss_start = .; /* BSS */ 87 BSS_SECTION(0, 0, 0)
138 .sbss : {
139 *(.sbss)
140 *(.scommon)
141 }
142 .bss : {
143 *(.bss)
144 *(COMMON)
145 }
146 __bss_stop = .;
147 _end = .; 88 _end = .;
148} 89}
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 4df3570fe511..b940424f8ccc 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -16,7 +16,7 @@ config SUPERH
16 select HAVE_IOREMAP_PROT if MMU 16 select HAVE_IOREMAP_PROT if MMU
17 select HAVE_ARCH_TRACEHOOK 17 select HAVE_ARCH_TRACEHOOK
18 select HAVE_DMA_API_DEBUG 18 select HAVE_DMA_API_DEBUG
19 select HAVE_PERF_COUNTERS 19 select HAVE_PERF_EVENTS
20 select HAVE_KERNEL_GZIP 20 select HAVE_KERNEL_GZIP
21 select HAVE_KERNEL_BZIP2 21 select HAVE_KERNEL_BZIP2
22 select HAVE_KERNEL_LZMA 22 select HAVE_KERNEL_LZMA
diff --git a/arch/sh/include/asm/perf_counter.h b/arch/sh/include/asm/perf_counter.h
deleted file mode 100644
index d8e6bb9c0ccc..000000000000
--- a/arch/sh/include/asm/perf_counter.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_SH_PERF_COUNTER_H
2#define __ASM_SH_PERF_COUNTER_H
3
4/* SH only supports software counters through this interface. */
5static inline void set_perf_counter_pending(void) {}
6
7#define PERF_COUNTER_INDEX_OFFSET 0
8
9#endif /* __ASM_SH_PERF_COUNTER_H */
diff --git a/arch/sh/include/asm/perf_event.h b/arch/sh/include/asm/perf_event.h
new file mode 100644
index 000000000000..11a302297ab7
--- /dev/null
+++ b/arch/sh/include/asm/perf_event.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_SH_PERF_EVENT_H
2#define __ASM_SH_PERF_EVENT_H
3
4/* SH only supports software events through this interface. */
5static inline void set_perf_event_pending(void) {}
6
7#define PERF_EVENT_INDEX_OFFSET 0
8
9#endif /* __ASM_SH_PERF_EVENT_H */
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 925dd40d9d55..f3fd1b9eb6b1 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -344,7 +344,7 @@
344#define __NR_preadv 333 344#define __NR_preadv 333
345#define __NR_pwritev 334 345#define __NR_pwritev 334
346#define __NR_rt_tgsigqueueinfo 335 346#define __NR_rt_tgsigqueueinfo 335
347#define __NR_perf_counter_open 336 347#define __NR_perf_event_open 336
348 348
349#define NR_syscalls 337 349#define NR_syscalls 337
350 350
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index 2b84bc916bc5..343ce8f073ea 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -384,7 +384,7 @@
384#define __NR_preadv 361 384#define __NR_preadv 361
385#define __NR_pwritev 362 385#define __NR_pwritev 362
386#define __NR_rt_tgsigqueueinfo 363 386#define __NR_rt_tgsigqueueinfo 363
387#define __NR_perf_counter_open 364 387#define __NR_perf_event_open 364
388 388
389#ifdef __KERNEL__ 389#ifdef __KERNEL__
390 390
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 16ba225ede89..19fd11dd9871 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -352,4 +352,4 @@ ENTRY(sys_call_table)
352 .long sys_preadv 352 .long sys_preadv
353 .long sys_pwritev 353 .long sys_pwritev
354 .long sys_rt_tgsigqueueinfo /* 335 */ 354 .long sys_rt_tgsigqueueinfo /* 335 */
355 .long sys_perf_counter_open 355 .long sys_perf_event_open
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index af6fb7410c21..5bfde6c77498 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -390,4 +390,4 @@ sys_call_table:
390 .long sys_preadv 390 .long sys_preadv
391 .long sys_pwritev 391 .long sys_pwritev
392 .long sys_rt_tgsigqueueinfo 392 .long sys_rt_tgsigqueueinfo
393 .long sys_perf_counter_open 393 .long sys_perf_event_open
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c
index 781b413ff82d..47530104e0ad 100644
--- a/arch/sh/mm/fault_32.c
+++ b/arch/sh/mm/fault_32.c
@@ -15,7 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/hardirq.h> 16#include <linux/hardirq.h>
17#include <linux/kprobes.h> 17#include <linux/kprobes.h>
18#include <linux/perf_counter.h> 18#include <linux/perf_event.h>
19#include <asm/io_trapped.h> 19#include <asm/io_trapped.h>
20#include <asm/system.h> 20#include <asm/system.h>
21#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
@@ -157,7 +157,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
157 if ((regs->sr & SR_IMASK) != SR_IMASK) 157 if ((regs->sr & SR_IMASK) != SR_IMASK)
158 local_irq_enable(); 158 local_irq_enable();
159 159
160 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 160 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
161 161
162 /* 162 /*
163 * If we're in an interrupt, have no user context or are running 163 * If we're in an interrupt, have no user context or are running
@@ -208,11 +208,11 @@ survive:
208 } 208 }
209 if (fault & VM_FAULT_MAJOR) { 209 if (fault & VM_FAULT_MAJOR) {
210 tsk->maj_flt++; 210 tsk->maj_flt++;
211 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 211 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
212 regs, address); 212 regs, address);
213 } else { 213 } else {
214 tsk->min_flt++; 214 tsk->min_flt++;
215 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 215 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
216 regs, address); 216 regs, address);
217 } 217 }
218 218
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index edc842ff61ed..8173e38afd38 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -186,8 +186,6 @@ void __init paging_init(void)
186 set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start)); 186 set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start));
187} 187}
188 188
189static struct kcore_list kcore_mem, kcore_vmalloc;
190
191void __init mem_init(void) 189void __init mem_init(void)
192{ 190{
193 int codesize, datasize, initsize; 191 int codesize, datasize, initsize;
@@ -226,13 +224,9 @@ void __init mem_init(void)
226 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 224 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
227 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 225 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
228 226
229 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
230 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
231 VMALLOC_END - VMALLOC_START);
232
233 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " 227 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
234 "%dk data, %dk init)\n", 228 "%dk data, %dk init)\n",
235 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 229 nr_free_pages() << (PAGE_SHIFT-10),
236 num_physpages << (PAGE_SHIFT-10), 230 num_physpages << (PAGE_SHIFT-10),
237 codesize >> 10, 231 codesize >> 10,
238 datasize >> 10, 232 datasize >> 10,
diff --git a/arch/sh/mm/tlbflush_64.c b/arch/sh/mm/tlbflush_64.c
index 2dcc48528f7a..de0b0e881823 100644
--- a/arch/sh/mm/tlbflush_64.c
+++ b/arch/sh/mm/tlbflush_64.c
@@ -20,7 +20,7 @@
20#include <linux/mman.h> 20#include <linux/mman.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/perf_counter.h> 23#include <linux/perf_event.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/io.h> 26#include <asm/io.h>
@@ -116,7 +116,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
116 /* Not an IO address, so reenable interrupts */ 116 /* Not an IO address, so reenable interrupts */
117 local_irq_enable(); 117 local_irq_enable();
118 118
119 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 119 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
120 120
121 /* 121 /*
122 * If we're in an interrupt or have no user 122 * If we're in an interrupt or have no user
@@ -201,11 +201,11 @@ survive:
201 201
202 if (fault & VM_FAULT_MAJOR) { 202 if (fault & VM_FAULT_MAJOR) {
203 tsk->maj_flt++; 203 tsk->maj_flt++;
204 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 204 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
205 regs, address); 205 regs, address);
206 } else { 206 } else {
207 tsk->min_flt++; 207 tsk->min_flt++;
208 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 208 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
209 regs, address); 209 regs, address);
210 } 210 }
211 211
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 86b82348b97c..97fca4695e0b 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -25,7 +25,7 @@ config SPARC
25 select ARCH_WANT_OPTIONAL_GPIOLIB 25 select ARCH_WANT_OPTIONAL_GPIOLIB
26 select RTC_CLASS 26 select RTC_CLASS
27 select RTC_DRV_M48T59 27 select RTC_DRV_M48T59
28 select HAVE_PERF_COUNTERS 28 select HAVE_PERF_EVENTS
29 select HAVE_DMA_ATTRS 29 select HAVE_DMA_ATTRS
30 select HAVE_DMA_API_DEBUG 30 select HAVE_DMA_API_DEBUG
31 31
@@ -47,7 +47,7 @@ config SPARC64
47 select RTC_DRV_BQ4802 47 select RTC_DRV_BQ4802
48 select RTC_DRV_SUN4V 48 select RTC_DRV_SUN4V
49 select RTC_DRV_STARFIRE 49 select RTC_DRV_STARFIRE
50 select HAVE_PERF_COUNTERS 50 select HAVE_PERF_EVENTS
51 51
52config ARCH_DEFCONFIG 52config ARCH_DEFCONFIG
53 string 53 string
diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
index 988192e8e956..c3029ad6619a 100644
--- a/arch/sparc/include/asm/mman.h
+++ b/arch/sparc/include/asm/mman.h
@@ -20,6 +20,8 @@
20 20
21#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 21#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
22#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 22#define MAP_NONBLOCK 0x10000 /* do not block on IO */
23#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
24#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
23 25
24#ifdef __KERNEL__ 26#ifdef __KERNEL__
25#ifndef __ASSEMBLY__ 27#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/perf_counter.h b/arch/sparc/include/asm/perf_counter.h
deleted file mode 100644
index 5d7a8ca0e491..000000000000
--- a/arch/sparc/include/asm/perf_counter.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __ASM_SPARC_PERF_COUNTER_H
2#define __ASM_SPARC_PERF_COUNTER_H
3
4extern void set_perf_counter_pending(void);
5
6#define PERF_COUNTER_INDEX_OFFSET 0
7
8#ifdef CONFIG_PERF_COUNTERS
9extern void init_hw_perf_counters(void);
10#else
11static inline void init_hw_perf_counters(void) { }
12#endif
13
14#endif
diff --git a/arch/sparc/include/asm/perf_event.h b/arch/sparc/include/asm/perf_event.h
new file mode 100644
index 000000000000..7e2669894ce8
--- /dev/null
+++ b/arch/sparc/include/asm/perf_event.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_SPARC_PERF_EVENT_H
2#define __ASM_SPARC_PERF_EVENT_H
3
4extern void set_perf_event_pending(void);
5
6#define PERF_EVENT_INDEX_OFFSET 0
7
8#ifdef CONFIG_PERF_EVENTS
9extern void init_hw_perf_events(void);
10#else
11static inline void init_hw_perf_events(void) { }
12#endif
13
14#endif
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 706df669f3b8..42f2316c3eaa 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -395,7 +395,7 @@
395#define __NR_preadv 324 395#define __NR_preadv 324
396#define __NR_pwritev 325 396#define __NR_pwritev 325
397#define __NR_rt_tgsigqueueinfo 326 397#define __NR_rt_tgsigqueueinfo 326
398#define __NR_perf_counter_open 327 398#define __NR_perf_event_open 327
399 399
400#define NR_SYSCALLS 328 400#define NR_SYSCALLS 328
401 401
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index d4de32f0f8af..6cdbf7e7351d 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -258,7 +258,7 @@ static inline void *vio_dring_entry(struct vio_dring_state *dr,
258static inline u32 vio_dring_avail(struct vio_dring_state *dr, 258static inline u32 vio_dring_avail(struct vio_dring_state *dr,
259 unsigned int ring_size) 259 unsigned int ring_size)
260{ 260{
261 BUILD_BUG_ON(!is_power_of_2(ring_size)); 261 MAYBE_BUILD_BUG_ON(!is_power_of_2(ring_size));
262 262
263 return (dr->pending - 263 return (dr->pending -
264 ((dr->prod - dr->cons) & (ring_size - 1))); 264 ((dr->prod - dr->cons) & (ring_size - 1)));
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 247cc620cee5..3a048fad7ee2 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -104,5 +104,5 @@ obj-$(CONFIG_AUDIT) += audit.o
104audit--$(CONFIG_AUDIT) := compat_audit.o 104audit--$(CONFIG_AUDIT) := compat_audit.o
105obj-$(CONFIG_COMPAT) += $(audit--y) 105obj-$(CONFIG_COMPAT) += $(audit--y)
106 106
107pc--$(CONFIG_PERF_COUNTERS) := perf_counter.o 107pc--$(CONFIG_PERF_EVENTS) := perf_event.o
108obj-$(CONFIG_SPARC64) += $(pc--y) 108obj-$(CONFIG_SPARC64) += $(pc--y)
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 8daab33fc17d..8ab1d4728a4b 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -229,7 +229,7 @@ static unsigned int sun4u_compute_tid(unsigned long imap, unsigned long cpuid)
229 tid = ((a << IMAP_AID_SHIFT) | 229 tid = ((a << IMAP_AID_SHIFT) |
230 (n << IMAP_NID_SHIFT)); 230 (n << IMAP_NID_SHIFT));
231 tid &= (IMAP_AID_SAFARI | 231 tid &= (IMAP_AID_SAFARI |
232 IMAP_NID_SAFARI);; 232 IMAP_NID_SAFARI);
233 } 233 }
234 } else { 234 } else {
235 tid = cpuid << IMAP_TID_SHIFT; 235 tid = cpuid << IMAP_TID_SHIFT;
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index 378eb53e0776..b129611590a4 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -19,7 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
21 21
22#include <asm/perf_counter.h> 22#include <asm/perf_event.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/local.h> 24#include <asm/local.h>
25#include <asm/pcr.h> 25#include <asm/pcr.h>
@@ -265,7 +265,7 @@ int __init nmi_init(void)
265 } 265 }
266 } 266 }
267 if (!err) 267 if (!err)
268 init_hw_perf_counters(); 268 init_hw_perf_events();
269 269
270 return err; 270 return err;
271} 271}
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
index 68ff00107073..2d94e7a03af5 100644
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -7,7 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/irq.h> 8#include <linux/irq.h>
9 9
10#include <linux/perf_counter.h> 10#include <linux/perf_event.h>
11 11
12#include <asm/pil.h> 12#include <asm/pil.h>
13#include <asm/pcr.h> 13#include <asm/pcr.h>
@@ -15,7 +15,7 @@
15 15
16/* This code is shared between various users of the performance 16/* This code is shared between various users of the performance
17 * counters. Users will be oprofile, pseudo-NMI watchdog, and the 17 * counters. Users will be oprofile, pseudo-NMI watchdog, and the
18 * perf_counter support layer. 18 * perf_event support layer.
19 */ 19 */
20 20
21#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE) 21#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
@@ -42,14 +42,14 @@ void deferred_pcr_work_irq(int irq, struct pt_regs *regs)
42 42
43 old_regs = set_irq_regs(regs); 43 old_regs = set_irq_regs(regs);
44 irq_enter(); 44 irq_enter();
45#ifdef CONFIG_PERF_COUNTERS 45#ifdef CONFIG_PERF_EVENTS
46 perf_counter_do_pending(); 46 perf_event_do_pending();
47#endif 47#endif
48 irq_exit(); 48 irq_exit();
49 set_irq_regs(old_regs); 49 set_irq_regs(old_regs);
50} 50}
51 51
52void set_perf_counter_pending(void) 52void set_perf_event_pending(void)
53{ 53{
54 set_softint(1 << PIL_DEFERRED_PCR_WORK); 54 set_softint(1 << PIL_DEFERRED_PCR_WORK);
55} 55}
diff --git a/arch/sparc/kernel/perf_counter.c b/arch/sparc/kernel/perf_event.c
index b1265ce8a053..2d6a1b10c81d 100644
--- a/arch/sparc/kernel/perf_counter.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1,8 +1,8 @@
1/* Performance counter support for sparc64. 1/* Performance event support for sparc64.
2 * 2 *
3 * Copyright (C) 2009 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
4 * 4 *
5 * This code is based almost entirely upon the x86 perf counter 5 * This code is based almost entirely upon the x86 perf event
6 * code, which is: 6 * code, which is:
7 * 7 *
8 * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> 8 * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de>
@@ -12,7 +12,7 @@
12 * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> 12 * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
13 */ 13 */
14 14
15#include <linux/perf_counter.h> 15#include <linux/perf_event.h>
16#include <linux/kprobes.h> 16#include <linux/kprobes.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/kdebug.h> 18#include <linux/kdebug.h>
@@ -46,19 +46,19 @@
46 * normal code. 46 * normal code.
47 */ 47 */
48 48
49#define MAX_HWCOUNTERS 2 49#define MAX_HWEVENTS 2
50#define MAX_PERIOD ((1UL << 32) - 1) 50#define MAX_PERIOD ((1UL << 32) - 1)
51 51
52#define PIC_UPPER_INDEX 0 52#define PIC_UPPER_INDEX 0
53#define PIC_LOWER_INDEX 1 53#define PIC_LOWER_INDEX 1
54 54
55struct cpu_hw_counters { 55struct cpu_hw_events {
56 struct perf_counter *counters[MAX_HWCOUNTERS]; 56 struct perf_event *events[MAX_HWEVENTS];
57 unsigned long used_mask[BITS_TO_LONGS(MAX_HWCOUNTERS)]; 57 unsigned long used_mask[BITS_TO_LONGS(MAX_HWEVENTS)];
58 unsigned long active_mask[BITS_TO_LONGS(MAX_HWCOUNTERS)]; 58 unsigned long active_mask[BITS_TO_LONGS(MAX_HWEVENTS)];
59 int enabled; 59 int enabled;
60}; 60};
61DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = { .enabled = 1, }; 61DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
62 62
63struct perf_event_map { 63struct perf_event_map {
64 u16 encoding; 64 u16 encoding;
@@ -87,9 +87,9 @@ static const struct perf_event_map ultra3i_perfmon_event_map[] = {
87 [PERF_COUNT_HW_CACHE_MISSES] = { 0x0009, PIC_UPPER }, 87 [PERF_COUNT_HW_CACHE_MISSES] = { 0x0009, PIC_UPPER },
88}; 88};
89 89
90static const struct perf_event_map *ultra3i_event_map(int event) 90static const struct perf_event_map *ultra3i_event_map(int event_id)
91{ 91{
92 return &ultra3i_perfmon_event_map[event]; 92 return &ultra3i_perfmon_event_map[event_id];
93} 93}
94 94
95static const struct sparc_pmu ultra3i_pmu = { 95static const struct sparc_pmu ultra3i_pmu = {
@@ -111,9 +111,9 @@ static const struct perf_event_map niagara2_perfmon_event_map[] = {
111 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x0202, PIC_UPPER | PIC_LOWER }, 111 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x0202, PIC_UPPER | PIC_LOWER },
112}; 112};
113 113
114static const struct perf_event_map *niagara2_event_map(int event) 114static const struct perf_event_map *niagara2_event_map(int event_id)
115{ 115{
116 return &niagara2_perfmon_event_map[event]; 116 return &niagara2_perfmon_event_map[event_id];
117} 117}
118 118
119static const struct sparc_pmu niagara2_pmu = { 119static const struct sparc_pmu niagara2_pmu = {
@@ -130,13 +130,13 @@ static const struct sparc_pmu niagara2_pmu = {
130 130
131static const struct sparc_pmu *sparc_pmu __read_mostly; 131static const struct sparc_pmu *sparc_pmu __read_mostly;
132 132
133static u64 event_encoding(u64 event, int idx) 133static u64 event_encoding(u64 event_id, int idx)
134{ 134{
135 if (idx == PIC_UPPER_INDEX) 135 if (idx == PIC_UPPER_INDEX)
136 event <<= sparc_pmu->upper_shift; 136 event_id <<= sparc_pmu->upper_shift;
137 else 137 else
138 event <<= sparc_pmu->lower_shift; 138 event_id <<= sparc_pmu->lower_shift;
139 return event; 139 return event_id;
140} 140}
141 141
142static u64 mask_for_index(int idx) 142static u64 mask_for_index(int idx)
@@ -151,7 +151,7 @@ static u64 nop_for_index(int idx)
151 sparc_pmu->lower_nop, idx); 151 sparc_pmu->lower_nop, idx);
152} 152}
153 153
154static inline void sparc_pmu_enable_counter(struct hw_perf_counter *hwc, 154static inline void sparc_pmu_enable_event(struct hw_perf_event *hwc,
155 int idx) 155 int idx)
156{ 156{
157 u64 val, mask = mask_for_index(idx); 157 u64 val, mask = mask_for_index(idx);
@@ -160,7 +160,7 @@ static inline void sparc_pmu_enable_counter(struct hw_perf_counter *hwc,
160 pcr_ops->write((val & ~mask) | hwc->config); 160 pcr_ops->write((val & ~mask) | hwc->config);
161} 161}
162 162
163static inline void sparc_pmu_disable_counter(struct hw_perf_counter *hwc, 163static inline void sparc_pmu_disable_event(struct hw_perf_event *hwc,
164 int idx) 164 int idx)
165{ 165{
166 u64 mask = mask_for_index(idx); 166 u64 mask = mask_for_index(idx);
@@ -172,7 +172,7 @@ static inline void sparc_pmu_disable_counter(struct hw_perf_counter *hwc,
172 172
173void hw_perf_enable(void) 173void hw_perf_enable(void)
174{ 174{
175 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 175 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
176 u64 val; 176 u64 val;
177 int i; 177 int i;
178 178
@@ -184,9 +184,9 @@ void hw_perf_enable(void)
184 184
185 val = pcr_ops->read(); 185 val = pcr_ops->read();
186 186
187 for (i = 0; i < MAX_HWCOUNTERS; i++) { 187 for (i = 0; i < MAX_HWEVENTS; i++) {
188 struct perf_counter *cp = cpuc->counters[i]; 188 struct perf_event *cp = cpuc->events[i];
189 struct hw_perf_counter *hwc; 189 struct hw_perf_event *hwc;
190 190
191 if (!cp) 191 if (!cp)
192 continue; 192 continue;
@@ -199,7 +199,7 @@ void hw_perf_enable(void)
199 199
200void hw_perf_disable(void) 200void hw_perf_disable(void)
201{ 201{
202 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 202 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
203 u64 val; 203 u64 val;
204 204
205 if (!cpuc->enabled) 205 if (!cpuc->enabled)
@@ -241,8 +241,8 @@ static void write_pmc(int idx, u64 val)
241 write_pic(pic); 241 write_pic(pic);
242} 242}
243 243
244static int sparc_perf_counter_set_period(struct perf_counter *counter, 244static int sparc_perf_event_set_period(struct perf_event *event,
245 struct hw_perf_counter *hwc, int idx) 245 struct hw_perf_event *hwc, int idx)
246{ 246{
247 s64 left = atomic64_read(&hwc->period_left); 247 s64 left = atomic64_read(&hwc->period_left);
248 s64 period = hwc->sample_period; 248 s64 period = hwc->sample_period;
@@ -268,33 +268,33 @@ static int sparc_perf_counter_set_period(struct perf_counter *counter,
268 268
269 write_pmc(idx, (u64)(-left) & 0xffffffff); 269 write_pmc(idx, (u64)(-left) & 0xffffffff);
270 270
271 perf_counter_update_userpage(counter); 271 perf_event_update_userpage(event);
272 272
273 return ret; 273 return ret;
274} 274}
275 275
276static int sparc_pmu_enable(struct perf_counter *counter) 276static int sparc_pmu_enable(struct perf_event *event)
277{ 277{
278 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 278 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
279 struct hw_perf_counter *hwc = &counter->hw; 279 struct hw_perf_event *hwc = &event->hw;
280 int idx = hwc->idx; 280 int idx = hwc->idx;
281 281
282 if (test_and_set_bit(idx, cpuc->used_mask)) 282 if (test_and_set_bit(idx, cpuc->used_mask))
283 return -EAGAIN; 283 return -EAGAIN;
284 284
285 sparc_pmu_disable_counter(hwc, idx); 285 sparc_pmu_disable_event(hwc, idx);
286 286
287 cpuc->counters[idx] = counter; 287 cpuc->events[idx] = event;
288 set_bit(idx, cpuc->active_mask); 288 set_bit(idx, cpuc->active_mask);
289 289
290 sparc_perf_counter_set_period(counter, hwc, idx); 290 sparc_perf_event_set_period(event, hwc, idx);
291 sparc_pmu_enable_counter(hwc, idx); 291 sparc_pmu_enable_event(hwc, idx);
292 perf_counter_update_userpage(counter); 292 perf_event_update_userpage(event);
293 return 0; 293 return 0;
294} 294}
295 295
296static u64 sparc_perf_counter_update(struct perf_counter *counter, 296static u64 sparc_perf_event_update(struct perf_event *event,
297 struct hw_perf_counter *hwc, int idx) 297 struct hw_perf_event *hwc, int idx)
298{ 298{
299 int shift = 64 - 32; 299 int shift = 64 - 32;
300 u64 prev_raw_count, new_raw_count; 300 u64 prev_raw_count, new_raw_count;
@@ -311,79 +311,79 @@ again:
311 delta = (new_raw_count << shift) - (prev_raw_count << shift); 311 delta = (new_raw_count << shift) - (prev_raw_count << shift);
312 delta >>= shift; 312 delta >>= shift;
313 313
314 atomic64_add(delta, &counter->count); 314 atomic64_add(delta, &event->count);
315 atomic64_sub(delta, &hwc->period_left); 315 atomic64_sub(delta, &hwc->period_left);
316 316
317 return new_raw_count; 317 return new_raw_count;
318} 318}
319 319
320static void sparc_pmu_disable(struct perf_counter *counter) 320static void sparc_pmu_disable(struct perf_event *event)
321{ 321{
322 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 322 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
323 struct hw_perf_counter *hwc = &counter->hw; 323 struct hw_perf_event *hwc = &event->hw;
324 int idx = hwc->idx; 324 int idx = hwc->idx;
325 325
326 clear_bit(idx, cpuc->active_mask); 326 clear_bit(idx, cpuc->active_mask);
327 sparc_pmu_disable_counter(hwc, idx); 327 sparc_pmu_disable_event(hwc, idx);
328 328
329 barrier(); 329 barrier();
330 330
331 sparc_perf_counter_update(counter, hwc, idx); 331 sparc_perf_event_update(event, hwc, idx);
332 cpuc->counters[idx] = NULL; 332 cpuc->events[idx] = NULL;
333 clear_bit(idx, cpuc->used_mask); 333 clear_bit(idx, cpuc->used_mask);
334 334
335 perf_counter_update_userpage(counter); 335 perf_event_update_userpage(event);
336} 336}
337 337
338static void sparc_pmu_read(struct perf_counter *counter) 338static void sparc_pmu_read(struct perf_event *event)
339{ 339{
340 struct hw_perf_counter *hwc = &counter->hw; 340 struct hw_perf_event *hwc = &event->hw;
341 sparc_perf_counter_update(counter, hwc, hwc->idx); 341 sparc_perf_event_update(event, hwc, hwc->idx);
342} 342}
343 343
344static void sparc_pmu_unthrottle(struct perf_counter *counter) 344static void sparc_pmu_unthrottle(struct perf_event *event)
345{ 345{
346 struct hw_perf_counter *hwc = &counter->hw; 346 struct hw_perf_event *hwc = &event->hw;
347 sparc_pmu_enable_counter(hwc, hwc->idx); 347 sparc_pmu_enable_event(hwc, hwc->idx);
348} 348}
349 349
350static atomic_t active_counters = ATOMIC_INIT(0); 350static atomic_t active_events = ATOMIC_INIT(0);
351static DEFINE_MUTEX(pmc_grab_mutex); 351static DEFINE_MUTEX(pmc_grab_mutex);
352 352
353void perf_counter_grab_pmc(void) 353void perf_event_grab_pmc(void)
354{ 354{
355 if (atomic_inc_not_zero(&active_counters)) 355 if (atomic_inc_not_zero(&active_events))
356 return; 356 return;
357 357
358 mutex_lock(&pmc_grab_mutex); 358 mutex_lock(&pmc_grab_mutex);
359 if (atomic_read(&active_counters) == 0) { 359 if (atomic_read(&active_events) == 0) {
360 if (atomic_read(&nmi_active) > 0) { 360 if (atomic_read(&nmi_active) > 0) {
361 on_each_cpu(stop_nmi_watchdog, NULL, 1); 361 on_each_cpu(stop_nmi_watchdog, NULL, 1);
362 BUG_ON(atomic_read(&nmi_active) != 0); 362 BUG_ON(atomic_read(&nmi_active) != 0);
363 } 363 }
364 atomic_inc(&active_counters); 364 atomic_inc(&active_events);
365 } 365 }
366 mutex_unlock(&pmc_grab_mutex); 366 mutex_unlock(&pmc_grab_mutex);
367} 367}
368 368
369void perf_counter_release_pmc(void) 369void perf_event_release_pmc(void)
370{ 370{
371 if (atomic_dec_and_mutex_lock(&active_counters, &pmc_grab_mutex)) { 371 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) {
372 if (atomic_read(&nmi_active) == 0) 372 if (atomic_read(&nmi_active) == 0)
373 on_each_cpu(start_nmi_watchdog, NULL, 1); 373 on_each_cpu(start_nmi_watchdog, NULL, 1);
374 mutex_unlock(&pmc_grab_mutex); 374 mutex_unlock(&pmc_grab_mutex);
375 } 375 }
376} 376}
377 377
378static void hw_perf_counter_destroy(struct perf_counter *counter) 378static void hw_perf_event_destroy(struct perf_event *event)
379{ 379{
380 perf_counter_release_pmc(); 380 perf_event_release_pmc();
381} 381}
382 382
383static int __hw_perf_counter_init(struct perf_counter *counter) 383static int __hw_perf_event_init(struct perf_event *event)
384{ 384{
385 struct perf_counter_attr *attr = &counter->attr; 385 struct perf_event_attr *attr = &event->attr;
386 struct hw_perf_counter *hwc = &counter->hw; 386 struct hw_perf_event *hwc = &event->hw;
387 const struct perf_event_map *pmap; 387 const struct perf_event_map *pmap;
388 u64 enc; 388 u64 enc;
389 389
@@ -396,8 +396,8 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
396 if (attr->config >= sparc_pmu->max_events) 396 if (attr->config >= sparc_pmu->max_events)
397 return -EINVAL; 397 return -EINVAL;
398 398
399 perf_counter_grab_pmc(); 399 perf_event_grab_pmc();
400 counter->destroy = hw_perf_counter_destroy; 400 event->destroy = hw_perf_event_destroy;
401 401
402 /* We save the enable bits in the config_base. So to 402 /* We save the enable bits in the config_base. So to
403 * turn off sampling just write 'config', and to enable 403 * turn off sampling just write 'config', and to enable
@@ -439,16 +439,16 @@ static const struct pmu pmu = {
439 .unthrottle = sparc_pmu_unthrottle, 439 .unthrottle = sparc_pmu_unthrottle,
440}; 440};
441 441
442const struct pmu *hw_perf_counter_init(struct perf_counter *counter) 442const struct pmu *hw_perf_event_init(struct perf_event *event)
443{ 443{
444 int err = __hw_perf_counter_init(counter); 444 int err = __hw_perf_event_init(event);
445 445
446 if (err) 446 if (err)
447 return ERR_PTR(err); 447 return ERR_PTR(err);
448 return &pmu; 448 return &pmu;
449} 449}
450 450
451void perf_counter_print_debug(void) 451void perf_event_print_debug(void)
452{ 452{
453 unsigned long flags; 453 unsigned long flags;
454 u64 pcr, pic; 454 u64 pcr, pic;
@@ -471,16 +471,16 @@ void perf_counter_print_debug(void)
471 local_irq_restore(flags); 471 local_irq_restore(flags);
472} 472}
473 473
474static int __kprobes perf_counter_nmi_handler(struct notifier_block *self, 474static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
475 unsigned long cmd, void *__args) 475 unsigned long cmd, void *__args)
476{ 476{
477 struct die_args *args = __args; 477 struct die_args *args = __args;
478 struct perf_sample_data data; 478 struct perf_sample_data data;
479 struct cpu_hw_counters *cpuc; 479 struct cpu_hw_events *cpuc;
480 struct pt_regs *regs; 480 struct pt_regs *regs;
481 int idx; 481 int idx;
482 482
483 if (!atomic_read(&active_counters)) 483 if (!atomic_read(&active_events))
484 return NOTIFY_DONE; 484 return NOTIFY_DONE;
485 485
486 switch (cmd) { 486 switch (cmd) {
@@ -495,32 +495,32 @@ static int __kprobes perf_counter_nmi_handler(struct notifier_block *self,
495 495
496 data.addr = 0; 496 data.addr = 0;
497 497
498 cpuc = &__get_cpu_var(cpu_hw_counters); 498 cpuc = &__get_cpu_var(cpu_hw_events);
499 for (idx = 0; idx < MAX_HWCOUNTERS; idx++) { 499 for (idx = 0; idx < MAX_HWEVENTS; idx++) {
500 struct perf_counter *counter = cpuc->counters[idx]; 500 struct perf_event *event = cpuc->events[idx];
501 struct hw_perf_counter *hwc; 501 struct hw_perf_event *hwc;
502 u64 val; 502 u64 val;
503 503
504 if (!test_bit(idx, cpuc->active_mask)) 504 if (!test_bit(idx, cpuc->active_mask))
505 continue; 505 continue;
506 hwc = &counter->hw; 506 hwc = &event->hw;
507 val = sparc_perf_counter_update(counter, hwc, idx); 507 val = sparc_perf_event_update(event, hwc, idx);
508 if (val & (1ULL << 31)) 508 if (val & (1ULL << 31))
509 continue; 509 continue;
510 510
511 data.period = counter->hw.last_period; 511 data.period = event->hw.last_period;
512 if (!sparc_perf_counter_set_period(counter, hwc, idx)) 512 if (!sparc_perf_event_set_period(event, hwc, idx))
513 continue; 513 continue;
514 514
515 if (perf_counter_overflow(counter, 1, &data, regs)) 515 if (perf_event_overflow(event, 1, &data, regs))
516 sparc_pmu_disable_counter(hwc, idx); 516 sparc_pmu_disable_event(hwc, idx);
517 } 517 }
518 518
519 return NOTIFY_STOP; 519 return NOTIFY_STOP;
520} 520}
521 521
522static __read_mostly struct notifier_block perf_counter_nmi_notifier = { 522static __read_mostly struct notifier_block perf_event_nmi_notifier = {
523 .notifier_call = perf_counter_nmi_handler, 523 .notifier_call = perf_event_nmi_handler,
524}; 524};
525 525
526static bool __init supported_pmu(void) 526static bool __init supported_pmu(void)
@@ -536,9 +536,9 @@ static bool __init supported_pmu(void)
536 return false; 536 return false;
537} 537}
538 538
539void __init init_hw_perf_counters(void) 539void __init init_hw_perf_events(void)
540{ 540{
541 pr_info("Performance counters: "); 541 pr_info("Performance events: ");
542 542
543 if (!supported_pmu()) { 543 if (!supported_pmu()) {
544 pr_cont("No support for PMU type '%s'\n", sparc_pmu_type); 544 pr_cont("No support for PMU type '%s'\n", sparc_pmu_type);
@@ -547,10 +547,10 @@ void __init init_hw_perf_counters(void)
547 547
548 pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type); 548 pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type);
549 549
550 /* All sparc64 PMUs currently have 2 counters. But this simple 550 /* All sparc64 PMUs currently have 2 events. But this simple
551 * driver only supports one active counter at a time. 551 * driver only supports one active event at a time.
552 */ 552 */
553 perf_max_counters = 1; 553 perf_max_events = 1;
554 554
555 register_die_notifier(&perf_counter_nmi_notifier); 555 register_die_notifier(&perf_event_nmi_notifier);
556} 556}
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 04181577cb65..0f1658d37490 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -82,5 +82,5 @@ sys_call_table:
82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
84/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 84/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_counter_open 85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open
86 86
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 91b06b7f7acf..009825f6e73c 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -83,7 +83,7 @@ sys_call_table32:
83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate 83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate
84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1 84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1
85/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv 85/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv
86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_counter_open 86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open
87 87
88#endif /* CONFIG_COMPAT */ 88#endif /* CONFIG_COMPAT */
89 89
@@ -158,4 +158,4 @@ sys_call_table:
158/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 158/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
159 .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 159 .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
160/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 160/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
161 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_counter_open 161 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 54114ad0bdee..dc7c3b17a15f 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -472,7 +472,7 @@ void __init mem_init(void)
472 reservedpages++; 472 reservedpages++;
473 473
474 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", 474 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
475 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 475 nr_free_pages() << (PAGE_SHIFT-10),
476 num_physpages << (PAGE_SHIFT - 10), 476 num_physpages << (PAGE_SHIFT - 10),
477 codepages << (PAGE_SHIFT-10), 477 codepages << (PAGE_SHIFT-10),
478 reservedpages << (PAGE_SHIFT - 10), 478 reservedpages << (PAGE_SHIFT - 10),
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index f114813ae258..a74245ae3a84 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -533,7 +533,7 @@ static int eth_parse(char *str, int *index_out, char **str_out,
533 char **error_out) 533 char **error_out)
534{ 534{
535 char *end; 535 char *end;
536 int n, err = -EINVAL;; 536 int n, err = -EINVAL;
537 537
538 n = simple_strtoul(str, &end, 0); 538 n = simple_strtoul(str, &end, 0);
539 if (end == str) { 539 if (end == str) {
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 8f05d4d9da12..635d16d90a80 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -106,7 +106,7 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
106 106
107#define MAX_DEV (16) 107#define MAX_DEV (16)
108 108
109static struct block_device_operations ubd_blops = { 109static const struct block_device_operations ubd_blops = {
110 .owner = THIS_MODULE, 110 .owner = THIS_MODULE,
111 .open = ubd_open, 111 .open = ubd_open,
112 .release = ubd_release, 112 .release = ubd_release,
diff --git a/arch/um/include/asm/hardirq.h b/arch/um/include/asm/hardirq.h
index 313ebb8a2566..fb3c05a0cbbf 100644
--- a/arch/um/include/asm/hardirq.h
+++ b/arch/um/include/asm/hardirq.h
@@ -1,25 +1 @@
1/* (c) 2004 cw@f00f.org, GPLv2 blah blah */ #include <asm-generic/hardirq.h>
2
3#ifndef __ASM_UM_HARDIRQ_H
4#define __ASM_UM_HARDIRQ_H
5
6#include <linux/threads.h>
7#include <linux/irq.h>
8
9/* NOTE: When SMP works again we might want to make this
10 * ____cacheline_aligned or maybe use per_cpu state? --cw */
11typedef struct {
12 unsigned int __softirq_pending;
13} irq_cpustat_t;
14
15#include <linux/irq_cpustat.h>
16
17/* As this would be very strange for UML to get we BUG() after the
18 * printk. */
19static inline void ack_bad_irq(unsigned int irq)
20{
21 printk(KERN_ERR "unexpected IRQ %02x\n", irq);
22 BUG();
23}
24
25#endif /* __ASM_UM_HARDIRQ_H */
diff --git a/arch/um/include/shared/ptrace_user.h b/arch/um/include/shared/ptrace_user.h
index 4bce6e012889..7fd8539bc19a 100644
--- a/arch/um/include/shared/ptrace_user.h
+++ b/arch/um/include/shared/ptrace_user.h
@@ -29,7 +29,7 @@ extern int ptrace_setregs(long pid, unsigned long *regs_in);
29 * recompilation. So, we use PTRACE_OLDSETOPTIONS in UML. 29 * recompilation. So, we use PTRACE_OLDSETOPTIONS in UML.
30 * We also want to be able to build the kernel on 2.4, which doesn't 30 * We also want to be able to build the kernel on 2.4, which doesn't
31 * have PTRACE_OLDSETOPTIONS. So, if it is missing, we declare 31 * have PTRACE_OLDSETOPTIONS. So, if it is missing, we declare
32 * PTRACE_OLDSETOPTIONS to to be the same as PTRACE_SETOPTIONS. 32 * PTRACE_OLDSETOPTIONS to be the same as PTRACE_SETOPTIONS.
33 * 33 *
34 * On architectures, that start to support PTRACE_O_TRACESYSGOOD on 34 * On architectures, that start to support PTRACE_O_TRACESYSGOOD on
35 * linux 2.6, PTRACE_OLDSETOPTIONS never is defined, and also isn't 35 * linux 2.6, PTRACE_OLDSETOPTIONS never is defined, and also isn't
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 61d7e6138ff5..a5d5e70cf6f5 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -77,7 +77,7 @@ void __init mem_init(void)
77 num_physpages = totalram_pages; 77 num_physpages = totalram_pages;
78 max_pfn = totalram_pages; 78 max_pfn = totalram_pages;
79 printk(KERN_INFO "Memory: %luk available\n", 79 printk(KERN_INFO "Memory: %luk available\n",
80 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10)); 80 nr_free_pages() << (PAGE_SHIFT-10));
81 kmalloc_ok = 1; 81 kmalloc_ok = 1;
82 82
83#ifdef CONFIG_HIGHMEM 83#ifdef CONFIG_HIGHMEM
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 0cd9a7a05e77..8bfd1e905812 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -38,10 +38,10 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
38 *pte = pte_mkread(*pte); 38 *pte = pte_mkread(*pte);
39 return 0; 39 return 0;
40 40
41 out_pmd:
42 pud_free(mm, pud);
43 out_pte: 41 out_pte:
44 pmd_free(mm, pmd); 42 pmd_free(mm, pmd);
43 out_pmd:
44 pud_free(mm, pud);
45 out: 45 out:
46 return -ENOMEM; 46 return -ENOMEM;
47} 47}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 51c59015b280..93698794aa3a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,7 +24,7 @@ config X86
24 select HAVE_UNSTABLE_SCHED_CLOCK 24 select HAVE_UNSTABLE_SCHED_CLOCK
25 select HAVE_IDE 25 select HAVE_IDE
26 select HAVE_OPROFILE 26 select HAVE_OPROFILE
27 select HAVE_PERF_COUNTERS if (!M386 && !M486) 27 select HAVE_PERF_EVENTS if (!M386 && !M486)
28 select HAVE_IOREMAP_PROT 28 select HAVE_IOREMAP_PROT
29 select HAVE_KPROBES 29 select HAVE_KPROBES
30 select ARCH_WANT_OPTIONAL_GPIOLIB 30 select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -1204,6 +1204,10 @@ config ARCH_DISCONTIGMEM_DEFAULT
1204 def_bool y 1204 def_bool y
1205 depends on NUMA && X86_32 1205 depends on NUMA && X86_32
1206 1206
1207config ARCH_PROC_KCORE_TEXT
1208 def_bool y
1209 depends on X86_64 && PROC_KCORE
1210
1207config ARCH_SPARSEMEM_DEFAULT 1211config ARCH_SPARSEMEM_DEFAULT
1208 def_bool y 1212 def_bool y
1209 depends on X86_64 1213 depends on X86_64
@@ -1662,6 +1666,8 @@ source "kernel/power/Kconfig"
1662 1666
1663source "drivers/acpi/Kconfig" 1667source "drivers/acpi/Kconfig"
1664 1668
1669source "drivers/sfi/Kconfig"
1670
1665config X86_APM_BOOT 1671config X86_APM_BOOT
1666 bool 1672 bool
1667 default y 1673 default y
@@ -1857,7 +1863,7 @@ config PCI_DIRECT
1857 1863
1858config PCI_MMCONFIG 1864config PCI_MMCONFIG
1859 def_bool y 1865 def_bool y
1860 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1866 depends on X86_32 && PCI && (ACPI || SFI) && (PCI_GOMMCONFIG || PCI_GOANY)
1861 1867
1862config PCI_OLPC 1868config PCI_OLPC
1863 def_bool y 1869 def_bool y
@@ -1895,7 +1901,7 @@ config DMAR_DEFAULT_ON
1895config DMAR_BROKEN_GFX_WA 1901config DMAR_BROKEN_GFX_WA
1896 def_bool n 1902 def_bool n
1897 prompt "Workaround broken graphics drivers (going away soon)" 1903 prompt "Workaround broken graphics drivers (going away soon)"
1898 depends on DMAR 1904 depends on DMAR && BROKEN
1899 ---help--- 1905 ---help---
1900 Current Graphics drivers tend to use physical address 1906 Current Graphics drivers tend to use physical address
1901 for DMA and avoid using DMA APIs. Setting this config 1907 for DMA and avoid using DMA APIs. Setting this config
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index ba331bfd1112..74619c4f9fda 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -831,5 +831,5 @@ ia32_sys_call_table:
831 .quad compat_sys_preadv 831 .quad compat_sys_preadv
832 .quad compat_sys_pwritev 832 .quad compat_sys_pwritev
833 .quad compat_sys_rt_tgsigqueueinfo /* 335 */ 833 .quad compat_sys_rt_tgsigqueueinfo /* 335 */
834 .quad sys_perf_counter_open 834 .quad sys_perf_event_open
835ia32_syscall_end: 835ia32_syscall_end:
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 20d1465a2ab0..4518dc500903 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -144,7 +144,6 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
144 144
145#else /* !CONFIG_ACPI */ 145#else /* !CONFIG_ACPI */
146 146
147#define acpi_disabled 1
148#define acpi_lapic 0 147#define acpi_lapic 0
149#define acpi_ioapic 0 148#define acpi_ioapic 0
150static inline void acpi_noirq_set(void) { } 149static inline void acpi_noirq_set(void) { }
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index 5e3f2044f0d3..f5693c81a1db 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -49,7 +49,7 @@ BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR)
49BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR) 49BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR)
50BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR) 50BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR)
51 51
52#ifdef CONFIG_PERF_COUNTERS 52#ifdef CONFIG_PERF_EVENTS
53BUILD_INTERRUPT(perf_pending_interrupt, LOCAL_PENDING_VECTOR) 53BUILD_INTERRUPT(perf_pending_interrupt, LOCAL_PENDING_VECTOR)
54#endif 54#endif
55 55
diff --git a/arch/x86/include/asm/perf_counter.h b/arch/x86/include/asm/perf_event.h
index e7b7c938ae27..ad7ce3fd5065 100644
--- a/arch/x86/include/asm/perf_counter.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -1,8 +1,8 @@
1#ifndef _ASM_X86_PERF_COUNTER_H 1#ifndef _ASM_X86_PERF_EVENT_H
2#define _ASM_X86_PERF_COUNTER_H 2#define _ASM_X86_PERF_EVENT_H
3 3
4/* 4/*
5 * Performance counter hw details: 5 * Performance event hw details:
6 */ 6 */
7 7
8#define X86_PMC_MAX_GENERIC 8 8#define X86_PMC_MAX_GENERIC 8
@@ -43,7 +43,7 @@
43union cpuid10_eax { 43union cpuid10_eax {
44 struct { 44 struct {
45 unsigned int version_id:8; 45 unsigned int version_id:8;
46 unsigned int num_counters:8; 46 unsigned int num_events:8;
47 unsigned int bit_width:8; 47 unsigned int bit_width:8;
48 unsigned int mask_length:8; 48 unsigned int mask_length:8;
49 } split; 49 } split;
@@ -52,7 +52,7 @@ union cpuid10_eax {
52 52
53union cpuid10_edx { 53union cpuid10_edx {
54 struct { 54 struct {
55 unsigned int num_counters_fixed:4; 55 unsigned int num_events_fixed:4;
56 unsigned int reserved:28; 56 unsigned int reserved:28;
57 } split; 57 } split;
58 unsigned int full; 58 unsigned int full;
@@ -60,7 +60,7 @@ union cpuid10_edx {
60 60
61 61
62/* 62/*
63 * Fixed-purpose performance counters: 63 * Fixed-purpose performance events:
64 */ 64 */
65 65
66/* 66/*
@@ -87,22 +87,22 @@ union cpuid10_edx {
87/* 87/*
88 * We model BTS tracing as another fixed-mode PMC. 88 * We model BTS tracing as another fixed-mode PMC.
89 * 89 *
90 * We choose a value in the middle of the fixed counter range, since lower 90 * We choose a value in the middle of the fixed event range, since lower
91 * values are used by actual fixed counters and higher values are used 91 * values are used by actual fixed events and higher values are used
92 * to indicate other overflow conditions in the PERF_GLOBAL_STATUS msr. 92 * to indicate other overflow conditions in the PERF_GLOBAL_STATUS msr.
93 */ 93 */
94#define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) 94#define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16)
95 95
96 96
97#ifdef CONFIG_PERF_COUNTERS 97#ifdef CONFIG_PERF_EVENTS
98extern void init_hw_perf_counters(void); 98extern void init_hw_perf_events(void);
99extern void perf_counters_lapic_init(void); 99extern void perf_events_lapic_init(void);
100 100
101#define PERF_COUNTER_INDEX_OFFSET 0 101#define PERF_EVENT_INDEX_OFFSET 0
102 102
103#else 103#else
104static inline void init_hw_perf_counters(void) { } 104static inline void init_hw_perf_events(void) { }
105static inline void perf_counters_lapic_init(void) { } 105static inline void perf_events_lapic_init(void) { }
106#endif 106#endif
107 107
108#endif /* _ASM_X86_PERF_COUNTER_H */ 108#endif /* _ASM_X86_PERF_EVENT_H */
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index d82f39bb7905..8d33bc5462d1 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Access to user system call parameters and results 2 * Access to user system call parameters and results
3 * 3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved. 4 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5 * 5 *
6 * This copyrighted material is made available to anyone wishing to use, 6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions 7 * modify, copy, or redistribute it subject to the terms and conditions
@@ -16,13 +16,13 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/err.h> 17#include <linux/err.h>
18 18
19static inline long syscall_get_nr(struct task_struct *task, 19/*
20 struct pt_regs *regs) 20 * Only the low 32 bits of orig_ax are meaningful, so we return int.
21 * This importantly ignores the high bits on 64-bit, so comparisons
22 * sign-extend the low 32 bits.
23 */
24static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
21{ 25{
22 /*
23 * We always sign-extend a -1 value being set here,
24 * so this is always either -1L or a syscall number.
25 */
26 return regs->orig_ax; 26 return regs->orig_ax;
27} 27}
28 28
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h
index 8deaada61bc8..6fb3c209a7e3 100644
--- a/arch/x86/include/asm/unistd_32.h
+++ b/arch/x86/include/asm/unistd_32.h
@@ -341,7 +341,7 @@
341#define __NR_preadv 333 341#define __NR_preadv 333
342#define __NR_pwritev 334 342#define __NR_pwritev 334
343#define __NR_rt_tgsigqueueinfo 335 343#define __NR_rt_tgsigqueueinfo 335
344#define __NR_perf_counter_open 336 344#define __NR_perf_event_open 336
345 345
346#ifdef __KERNEL__ 346#ifdef __KERNEL__
347 347
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index b9f3c60de5f7..8d3ad0adbc68 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -659,8 +659,8 @@ __SYSCALL(__NR_preadv, sys_preadv)
659__SYSCALL(__NR_pwritev, sys_pwritev) 659__SYSCALL(__NR_pwritev, sys_pwritev)
660#define __NR_rt_tgsigqueueinfo 297 660#define __NR_rt_tgsigqueueinfo 297
661__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) 661__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
662#define __NR_perf_counter_open 298 662#define __NR_perf_event_open 298
663__SYSCALL(__NR_perf_counter_open, sys_perf_counter_open) 663__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
664 664
665#ifndef __NO_STUBS 665#ifndef __NO_STUBS
666#define __ARCH_WANT_OLD_READDIR 666#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 4ba419b668a5..d8e5d0cdd678 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_INTEL_TXT) += tboot.o
56obj-$(CONFIG_STACKTRACE) += stacktrace.o 56obj-$(CONFIG_STACKTRACE) += stacktrace.o
57obj-y += cpu/ 57obj-y += cpu/
58obj-y += acpi/ 58obj-y += acpi/
59obj-$(CONFIG_SFI) += sfi.o
59obj-y += reboot.o 60obj-y += reboot.o
60obj-$(CONFIG_MCA) += mca_32.o 61obj-$(CONFIG_MCA) += mca_32.o
61obj-$(CONFIG_X86_MSR) += msr.o 62obj-$(CONFIG_X86_MSR) += msr.o
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a58ef98be155..894aa97f0717 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -14,7 +14,7 @@
14 * Mikael Pettersson : PM converted to driver model. 14 * Mikael Pettersson : PM converted to driver model.
15 */ 15 */
16 16
17#include <linux/perf_counter.h> 17#include <linux/perf_event.h>
18#include <linux/kernel_stat.h> 18#include <linux/kernel_stat.h>
19#include <linux/mc146818rtc.h> 19#include <linux/mc146818rtc.h>
20#include <linux/acpi_pmtmr.h> 20#include <linux/acpi_pmtmr.h>
@@ -35,7 +35,7 @@
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/mm.h> 36#include <linux/mm.h>
37 37
38#include <asm/perf_counter.h> 38#include <asm/perf_event.h>
39#include <asm/x86_init.h> 39#include <asm/x86_init.h>
40#include <asm/pgalloc.h> 40#include <asm/pgalloc.h>
41#include <asm/atomic.h> 41#include <asm/atomic.h>
@@ -1189,7 +1189,7 @@ void __cpuinit setup_local_APIC(void)
1189 apic_write(APIC_ESR, 0); 1189 apic_write(APIC_ESR, 0);
1190 } 1190 }
1191#endif 1191#endif
1192 perf_counters_lapic_init(); 1192 perf_events_lapic_init();
1193 1193
1194 preempt_disable(); 1194 preempt_disable();
1195 1195
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 8dd30638fe44..68537e957a9b 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -27,7 +27,7 @@ obj-$(CONFIG_CPU_SUP_CENTAUR) += centaur.o
27obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o 27obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o
28obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o 28obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
29 29
30obj-$(CONFIG_PERF_COUNTERS) += perf_counter.o 30obj-$(CONFIG_PERF_EVENTS) += perf_event.o
31 31
32obj-$(CONFIG_X86_MCE) += mcheck/ 32obj-$(CONFIG_X86_MCE) += mcheck/
33obj-$(CONFIG_MTRR) += mtrr/ 33obj-$(CONFIG_MTRR) += mtrr/
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f32fa71ccf97..c910a716a71c 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -184,7 +184,7 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
184 * approved Athlon 184 * approved Athlon
185 */ 185 */
186 WARN_ONCE(1, "WARNING: This combination of AMD" 186 WARN_ONCE(1, "WARNING: This combination of AMD"
187 "processors is not suitable for SMP.\n"); 187 " processors is not suitable for SMP.\n");
188 if (!test_taint(TAINT_UNSAFE_SMP)) 188 if (!test_taint(TAINT_UNSAFE_SMP))
189 add_taint(TAINT_UNSAFE_SMP); 189 add_taint(TAINT_UNSAFE_SMP);
190 190
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 2fea97eccf77..cc25c2b4a567 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -13,7 +13,7 @@
13#include <linux/io.h> 13#include <linux/io.h>
14 14
15#include <asm/stackprotector.h> 15#include <asm/stackprotector.h>
16#include <asm/perf_counter.h> 16#include <asm/perf_event.h>
17#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
18#include <asm/hypervisor.h> 18#include <asm/hypervisor.h>
19#include <asm/processor.h> 19#include <asm/processor.h>
@@ -869,7 +869,7 @@ void __init identify_boot_cpu(void)
869#else 869#else
870 vgetcpu_set_mode(); 870 vgetcpu_set_mode();
871#endif 871#endif
872 init_hw_perf_counters(); 872 init_hw_perf_events();
873} 873}
874 874
875void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c) 875void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_event.c
index a6c8b27553cd..a3c7adb06b78 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Performance counter x86 architecture code 2 * Performance events x86 architecture code
3 * 3 *
4 * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> 4 * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar 5 * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
@@ -11,7 +11,7 @@
11 * For licencing details see kernel-base/COPYING 11 * For licencing details see kernel-base/COPYING
12 */ 12 */
13 13
14#include <linux/perf_counter.h> 14#include <linux/perf_event.h>
15#include <linux/capability.h> 15#include <linux/capability.h>
16#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
@@ -27,10 +27,10 @@
27#include <asm/stacktrace.h> 27#include <asm/stacktrace.h>
28#include <asm/nmi.h> 28#include <asm/nmi.h>
29 29
30static u64 perf_counter_mask __read_mostly; 30static u64 perf_event_mask __read_mostly;
31 31
32/* The maximal number of PEBS counters: */ 32/* The maximal number of PEBS events: */
33#define MAX_PEBS_COUNTERS 4 33#define MAX_PEBS_EVENTS 4
34 34
35/* The size of a BTS record in bytes: */ 35/* The size of a BTS record in bytes: */
36#define BTS_RECORD_SIZE 24 36#define BTS_RECORD_SIZE 24
@@ -65,11 +65,11 @@ struct debug_store {
65 u64 pebs_index; 65 u64 pebs_index;
66 u64 pebs_absolute_maximum; 66 u64 pebs_absolute_maximum;
67 u64 pebs_interrupt_threshold; 67 u64 pebs_interrupt_threshold;
68 u64 pebs_counter_reset[MAX_PEBS_COUNTERS]; 68 u64 pebs_event_reset[MAX_PEBS_EVENTS];
69}; 69};
70 70
71struct cpu_hw_counters { 71struct cpu_hw_events {
72 struct perf_counter *counters[X86_PMC_IDX_MAX]; 72 struct perf_event *events[X86_PMC_IDX_MAX];
73 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 73 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
74 unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 74 unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
75 unsigned long interrupts; 75 unsigned long interrupts;
@@ -86,17 +86,17 @@ struct x86_pmu {
86 int (*handle_irq)(struct pt_regs *); 86 int (*handle_irq)(struct pt_regs *);
87 void (*disable_all)(void); 87 void (*disable_all)(void);
88 void (*enable_all)(void); 88 void (*enable_all)(void);
89 void (*enable)(struct hw_perf_counter *, int); 89 void (*enable)(struct hw_perf_event *, int);
90 void (*disable)(struct hw_perf_counter *, int); 90 void (*disable)(struct hw_perf_event *, int);
91 unsigned eventsel; 91 unsigned eventsel;
92 unsigned perfctr; 92 unsigned perfctr;
93 u64 (*event_map)(int); 93 u64 (*event_map)(int);
94 u64 (*raw_event)(u64); 94 u64 (*raw_event)(u64);
95 int max_events; 95 int max_events;
96 int num_counters; 96 int num_events;
97 int num_counters_fixed; 97 int num_events_fixed;
98 int counter_bits; 98 int event_bits;
99 u64 counter_mask; 99 u64 event_mask;
100 int apic; 100 int apic;
101 u64 max_period; 101 u64 max_period;
102 u64 intel_ctrl; 102 u64 intel_ctrl;
@@ -106,7 +106,7 @@ struct x86_pmu {
106 106
107static struct x86_pmu x86_pmu __read_mostly; 107static struct x86_pmu x86_pmu __read_mostly;
108 108
109static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = { 109static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
110 .enabled = 1, 110 .enabled = 1,
111}; 111};
112 112
@@ -124,35 +124,35 @@ static const u64 p6_perfmon_event_map[] =
124 [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, 124 [PERF_COUNT_HW_BUS_CYCLES] = 0x0062,
125}; 125};
126 126
127static u64 p6_pmu_event_map(int event) 127static u64 p6_pmu_event_map(int hw_event)
128{ 128{
129 return p6_perfmon_event_map[event]; 129 return p6_perfmon_event_map[hw_event];
130} 130}
131 131
132/* 132/*
133 * Counter setting that is specified not to count anything. 133 * Event setting that is specified not to count anything.
134 * We use this to effectively disable a counter. 134 * We use this to effectively disable a counter.
135 * 135 *
136 * L2_RQSTS with 0 MESI unit mask. 136 * L2_RQSTS with 0 MESI unit mask.
137 */ 137 */
138#define P6_NOP_COUNTER 0x0000002EULL 138#define P6_NOP_EVENT 0x0000002EULL
139 139
140static u64 p6_pmu_raw_event(u64 event) 140static u64 p6_pmu_raw_event(u64 hw_event)
141{ 141{
142#define P6_EVNTSEL_EVENT_MASK 0x000000FFULL 142#define P6_EVNTSEL_EVENT_MASK 0x000000FFULL
143#define P6_EVNTSEL_UNIT_MASK 0x0000FF00ULL 143#define P6_EVNTSEL_UNIT_MASK 0x0000FF00ULL
144#define P6_EVNTSEL_EDGE_MASK 0x00040000ULL 144#define P6_EVNTSEL_EDGE_MASK 0x00040000ULL
145#define P6_EVNTSEL_INV_MASK 0x00800000ULL 145#define P6_EVNTSEL_INV_MASK 0x00800000ULL
146#define P6_EVNTSEL_COUNTER_MASK 0xFF000000ULL 146#define P6_EVNTSEL_REG_MASK 0xFF000000ULL
147 147
148#define P6_EVNTSEL_MASK \ 148#define P6_EVNTSEL_MASK \
149 (P6_EVNTSEL_EVENT_MASK | \ 149 (P6_EVNTSEL_EVENT_MASK | \
150 P6_EVNTSEL_UNIT_MASK | \ 150 P6_EVNTSEL_UNIT_MASK | \
151 P6_EVNTSEL_EDGE_MASK | \ 151 P6_EVNTSEL_EDGE_MASK | \
152 P6_EVNTSEL_INV_MASK | \ 152 P6_EVNTSEL_INV_MASK | \
153 P6_EVNTSEL_COUNTER_MASK) 153 P6_EVNTSEL_REG_MASK)
154 154
155 return event & P6_EVNTSEL_MASK; 155 return hw_event & P6_EVNTSEL_MASK;
156} 156}
157 157
158 158
@@ -170,16 +170,16 @@ static const u64 intel_perfmon_event_map[] =
170 [PERF_COUNT_HW_BUS_CYCLES] = 0x013c, 170 [PERF_COUNT_HW_BUS_CYCLES] = 0x013c,
171}; 171};
172 172
173static u64 intel_pmu_event_map(int event) 173static u64 intel_pmu_event_map(int hw_event)
174{ 174{
175 return intel_perfmon_event_map[event]; 175 return intel_perfmon_event_map[hw_event];
176} 176}
177 177
178/* 178/*
179 * Generalized hw caching related event table, filled 179 * Generalized hw caching related hw_event table, filled
180 * in on a per model basis. A value of 0 means 180 * in on a per model basis. A value of 0 means
181 * 'not supported', -1 means 'event makes no sense on 181 * 'not supported', -1 means 'hw_event makes no sense on
182 * this CPU', any other value means the raw event 182 * this CPU', any other value means the raw hw_event
183 * ID. 183 * ID.
184 */ 184 */
185 185
@@ -463,22 +463,22 @@ static const u64 atom_hw_cache_event_ids
463 }, 463 },
464}; 464};
465 465
466static u64 intel_pmu_raw_event(u64 event) 466static u64 intel_pmu_raw_event(u64 hw_event)
467{ 467{
468#define CORE_EVNTSEL_EVENT_MASK 0x000000FFULL 468#define CORE_EVNTSEL_EVENT_MASK 0x000000FFULL
469#define CORE_EVNTSEL_UNIT_MASK 0x0000FF00ULL 469#define CORE_EVNTSEL_UNIT_MASK 0x0000FF00ULL
470#define CORE_EVNTSEL_EDGE_MASK 0x00040000ULL 470#define CORE_EVNTSEL_EDGE_MASK 0x00040000ULL
471#define CORE_EVNTSEL_INV_MASK 0x00800000ULL 471#define CORE_EVNTSEL_INV_MASK 0x00800000ULL
472#define CORE_EVNTSEL_COUNTER_MASK 0xFF000000ULL 472#define CORE_EVNTSEL_REG_MASK 0xFF000000ULL
473 473
474#define CORE_EVNTSEL_MASK \ 474#define CORE_EVNTSEL_MASK \
475 (CORE_EVNTSEL_EVENT_MASK | \ 475 (CORE_EVNTSEL_EVENT_MASK | \
476 CORE_EVNTSEL_UNIT_MASK | \ 476 CORE_EVNTSEL_UNIT_MASK | \
477 CORE_EVNTSEL_EDGE_MASK | \ 477 CORE_EVNTSEL_EDGE_MASK | \
478 CORE_EVNTSEL_INV_MASK | \ 478 CORE_EVNTSEL_INV_MASK | \
479 CORE_EVNTSEL_COUNTER_MASK) 479 CORE_EVNTSEL_REG_MASK)
480 480
481 return event & CORE_EVNTSEL_MASK; 481 return hw_event & CORE_EVNTSEL_MASK;
482} 482}
483 483
484static const u64 amd_hw_cache_event_ids 484static const u64 amd_hw_cache_event_ids
@@ -585,39 +585,39 @@ static const u64 amd_perfmon_event_map[] =
585 [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, 585 [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5,
586}; 586};
587 587
588static u64 amd_pmu_event_map(int event) 588static u64 amd_pmu_event_map(int hw_event)
589{ 589{
590 return amd_perfmon_event_map[event]; 590 return amd_perfmon_event_map[hw_event];
591} 591}
592 592
593static u64 amd_pmu_raw_event(u64 event) 593static u64 amd_pmu_raw_event(u64 hw_event)
594{ 594{
595#define K7_EVNTSEL_EVENT_MASK 0x7000000FFULL 595#define K7_EVNTSEL_EVENT_MASK 0x7000000FFULL
596#define K7_EVNTSEL_UNIT_MASK 0x00000FF00ULL 596#define K7_EVNTSEL_UNIT_MASK 0x00000FF00ULL
597#define K7_EVNTSEL_EDGE_MASK 0x000040000ULL 597#define K7_EVNTSEL_EDGE_MASK 0x000040000ULL
598#define K7_EVNTSEL_INV_MASK 0x000800000ULL 598#define K7_EVNTSEL_INV_MASK 0x000800000ULL
599#define K7_EVNTSEL_COUNTER_MASK 0x0FF000000ULL 599#define K7_EVNTSEL_REG_MASK 0x0FF000000ULL
600 600
601#define K7_EVNTSEL_MASK \ 601#define K7_EVNTSEL_MASK \
602 (K7_EVNTSEL_EVENT_MASK | \ 602 (K7_EVNTSEL_EVENT_MASK | \
603 K7_EVNTSEL_UNIT_MASK | \ 603 K7_EVNTSEL_UNIT_MASK | \
604 K7_EVNTSEL_EDGE_MASK | \ 604 K7_EVNTSEL_EDGE_MASK | \
605 K7_EVNTSEL_INV_MASK | \ 605 K7_EVNTSEL_INV_MASK | \
606 K7_EVNTSEL_COUNTER_MASK) 606 K7_EVNTSEL_REG_MASK)
607 607
608 return event & K7_EVNTSEL_MASK; 608 return hw_event & K7_EVNTSEL_MASK;
609} 609}
610 610
611/* 611/*
612 * Propagate counter elapsed time into the generic counter. 612 * Propagate event elapsed time into the generic event.
613 * Can only be executed on the CPU where the counter is active. 613 * Can only be executed on the CPU where the event is active.
614 * Returns the delta events processed. 614 * Returns the delta events processed.
615 */ 615 */
616static u64 616static u64
617x86_perf_counter_update(struct perf_counter *counter, 617x86_perf_event_update(struct perf_event *event,
618 struct hw_perf_counter *hwc, int idx) 618 struct hw_perf_event *hwc, int idx)
619{ 619{
620 int shift = 64 - x86_pmu.counter_bits; 620 int shift = 64 - x86_pmu.event_bits;
621 u64 prev_raw_count, new_raw_count; 621 u64 prev_raw_count, new_raw_count;
622 s64 delta; 622 s64 delta;
623 623
@@ -625,15 +625,15 @@ x86_perf_counter_update(struct perf_counter *counter,
625 return 0; 625 return 0;
626 626
627 /* 627 /*
628 * Careful: an NMI might modify the previous counter value. 628 * Careful: an NMI might modify the previous event value.
629 * 629 *
630 * Our tactic to handle this is to first atomically read and 630 * Our tactic to handle this is to first atomically read and
631 * exchange a new raw count - then add that new-prev delta 631 * exchange a new raw count - then add that new-prev delta
632 * count to the generic counter atomically: 632 * count to the generic event atomically:
633 */ 633 */
634again: 634again:
635 prev_raw_count = atomic64_read(&hwc->prev_count); 635 prev_raw_count = atomic64_read(&hwc->prev_count);
636 rdmsrl(hwc->counter_base + idx, new_raw_count); 636 rdmsrl(hwc->event_base + idx, new_raw_count);
637 637
638 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, 638 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
639 new_raw_count) != prev_raw_count) 639 new_raw_count) != prev_raw_count)
@@ -642,7 +642,7 @@ again:
642 /* 642 /*
643 * Now we have the new raw value and have updated the prev 643 * Now we have the new raw value and have updated the prev
644 * timestamp already. We can now calculate the elapsed delta 644 * timestamp already. We can now calculate the elapsed delta
645 * (counter-)time and add that to the generic counter. 645 * (event-)time and add that to the generic event.
646 * 646 *
647 * Careful, not all hw sign-extends above the physical width 647 * Careful, not all hw sign-extends above the physical width
648 * of the count. 648 * of the count.
@@ -650,13 +650,13 @@ again:
650 delta = (new_raw_count << shift) - (prev_raw_count << shift); 650 delta = (new_raw_count << shift) - (prev_raw_count << shift);
651 delta >>= shift; 651 delta >>= shift;
652 652
653 atomic64_add(delta, &counter->count); 653 atomic64_add(delta, &event->count);
654 atomic64_sub(delta, &hwc->period_left); 654 atomic64_sub(delta, &hwc->period_left);
655 655
656 return new_raw_count; 656 return new_raw_count;
657} 657}
658 658
659static atomic_t active_counters; 659static atomic_t active_events;
660static DEFINE_MUTEX(pmc_reserve_mutex); 660static DEFINE_MUTEX(pmc_reserve_mutex);
661 661
662static bool reserve_pmc_hardware(void) 662static bool reserve_pmc_hardware(void)
@@ -667,12 +667,12 @@ static bool reserve_pmc_hardware(void)
667 if (nmi_watchdog == NMI_LOCAL_APIC) 667 if (nmi_watchdog == NMI_LOCAL_APIC)
668 disable_lapic_nmi_watchdog(); 668 disable_lapic_nmi_watchdog();
669 669
670 for (i = 0; i < x86_pmu.num_counters; i++) { 670 for (i = 0; i < x86_pmu.num_events; i++) {
671 if (!reserve_perfctr_nmi(x86_pmu.perfctr + i)) 671 if (!reserve_perfctr_nmi(x86_pmu.perfctr + i))
672 goto perfctr_fail; 672 goto perfctr_fail;
673 } 673 }
674 674
675 for (i = 0; i < x86_pmu.num_counters; i++) { 675 for (i = 0; i < x86_pmu.num_events; i++) {
676 if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) 676 if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
677 goto eventsel_fail; 677 goto eventsel_fail;
678 } 678 }
@@ -685,7 +685,7 @@ eventsel_fail:
685 for (i--; i >= 0; i--) 685 for (i--; i >= 0; i--)
686 release_evntsel_nmi(x86_pmu.eventsel + i); 686 release_evntsel_nmi(x86_pmu.eventsel + i);
687 687
688 i = x86_pmu.num_counters; 688 i = x86_pmu.num_events;
689 689
690perfctr_fail: 690perfctr_fail:
691 for (i--; i >= 0; i--) 691 for (i--; i >= 0; i--)
@@ -703,7 +703,7 @@ static void release_pmc_hardware(void)
703#ifdef CONFIG_X86_LOCAL_APIC 703#ifdef CONFIG_X86_LOCAL_APIC
704 int i; 704 int i;
705 705
706 for (i = 0; i < x86_pmu.num_counters; i++) { 706 for (i = 0; i < x86_pmu.num_events; i++) {
707 release_perfctr_nmi(x86_pmu.perfctr + i); 707 release_perfctr_nmi(x86_pmu.perfctr + i);
708 release_evntsel_nmi(x86_pmu.eventsel + i); 708 release_evntsel_nmi(x86_pmu.eventsel + i);
709 } 709 }
@@ -720,7 +720,7 @@ static inline bool bts_available(void)
720 720
721static inline void init_debug_store_on_cpu(int cpu) 721static inline void init_debug_store_on_cpu(int cpu)
722{ 722{
723 struct debug_store *ds = per_cpu(cpu_hw_counters, cpu).ds; 723 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
724 724
725 if (!ds) 725 if (!ds)
726 return; 726 return;
@@ -732,7 +732,7 @@ static inline void init_debug_store_on_cpu(int cpu)
732 732
733static inline void fini_debug_store_on_cpu(int cpu) 733static inline void fini_debug_store_on_cpu(int cpu)
734{ 734{
735 if (!per_cpu(cpu_hw_counters, cpu).ds) 735 if (!per_cpu(cpu_hw_events, cpu).ds)
736 return; 736 return;
737 737
738 wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0); 738 wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
@@ -751,12 +751,12 @@ static void release_bts_hardware(void)
751 fini_debug_store_on_cpu(cpu); 751 fini_debug_store_on_cpu(cpu);
752 752
753 for_each_possible_cpu(cpu) { 753 for_each_possible_cpu(cpu) {
754 struct debug_store *ds = per_cpu(cpu_hw_counters, cpu).ds; 754 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
755 755
756 if (!ds) 756 if (!ds)
757 continue; 757 continue;
758 758
759 per_cpu(cpu_hw_counters, cpu).ds = NULL; 759 per_cpu(cpu_hw_events, cpu).ds = NULL;
760 760
761 kfree((void *)(unsigned long)ds->bts_buffer_base); 761 kfree((void *)(unsigned long)ds->bts_buffer_base);
762 kfree(ds); 762 kfree(ds);
@@ -796,7 +796,7 @@ static int reserve_bts_hardware(void)
796 ds->bts_interrupt_threshold = 796 ds->bts_interrupt_threshold =
797 ds->bts_absolute_maximum - BTS_OVFL_TH; 797 ds->bts_absolute_maximum - BTS_OVFL_TH;
798 798
799 per_cpu(cpu_hw_counters, cpu).ds = ds; 799 per_cpu(cpu_hw_events, cpu).ds = ds;
800 err = 0; 800 err = 0;
801 } 801 }
802 802
@@ -812,9 +812,9 @@ static int reserve_bts_hardware(void)
812 return err; 812 return err;
813} 813}
814 814
815static void hw_perf_counter_destroy(struct perf_counter *counter) 815static void hw_perf_event_destroy(struct perf_event *event)
816{ 816{
817 if (atomic_dec_and_mutex_lock(&active_counters, &pmc_reserve_mutex)) { 817 if (atomic_dec_and_mutex_lock(&active_events, &pmc_reserve_mutex)) {
818 release_pmc_hardware(); 818 release_pmc_hardware();
819 release_bts_hardware(); 819 release_bts_hardware();
820 mutex_unlock(&pmc_reserve_mutex); 820 mutex_unlock(&pmc_reserve_mutex);
@@ -827,7 +827,7 @@ static inline int x86_pmu_initialized(void)
827} 827}
828 828
829static inline int 829static inline int
830set_ext_hw_attr(struct hw_perf_counter *hwc, struct perf_counter_attr *attr) 830set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event_attr *attr)
831{ 831{
832 unsigned int cache_type, cache_op, cache_result; 832 unsigned int cache_type, cache_op, cache_result;
833 u64 config, val; 833 u64 config, val;
@@ -880,7 +880,7 @@ static void intel_pmu_enable_bts(u64 config)
880 880
881static void intel_pmu_disable_bts(void) 881static void intel_pmu_disable_bts(void)
882{ 882{
883 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 883 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
884 unsigned long debugctlmsr; 884 unsigned long debugctlmsr;
885 885
886 if (!cpuc->ds) 886 if (!cpuc->ds)
@@ -898,10 +898,10 @@ static void intel_pmu_disable_bts(void)
898/* 898/*
899 * Setup the hardware configuration for a given attr_type 899 * Setup the hardware configuration for a given attr_type
900 */ 900 */
901static int __hw_perf_counter_init(struct perf_counter *counter) 901static int __hw_perf_event_init(struct perf_event *event)
902{ 902{
903 struct perf_counter_attr *attr = &counter->attr; 903 struct perf_event_attr *attr = &event->attr;
904 struct hw_perf_counter *hwc = &counter->hw; 904 struct hw_perf_event *hwc = &event->hw;
905 u64 config; 905 u64 config;
906 int err; 906 int err;
907 907
@@ -909,22 +909,22 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
909 return -ENODEV; 909 return -ENODEV;
910 910
911 err = 0; 911 err = 0;
912 if (!atomic_inc_not_zero(&active_counters)) { 912 if (!atomic_inc_not_zero(&active_events)) {
913 mutex_lock(&pmc_reserve_mutex); 913 mutex_lock(&pmc_reserve_mutex);
914 if (atomic_read(&active_counters) == 0) { 914 if (atomic_read(&active_events) == 0) {
915 if (!reserve_pmc_hardware()) 915 if (!reserve_pmc_hardware())
916 err = -EBUSY; 916 err = -EBUSY;
917 else 917 else
918 err = reserve_bts_hardware(); 918 err = reserve_bts_hardware();
919 } 919 }
920 if (!err) 920 if (!err)
921 atomic_inc(&active_counters); 921 atomic_inc(&active_events);
922 mutex_unlock(&pmc_reserve_mutex); 922 mutex_unlock(&pmc_reserve_mutex);
923 } 923 }
924 if (err) 924 if (err)
925 return err; 925 return err;
926 926
927 counter->destroy = hw_perf_counter_destroy; 927 event->destroy = hw_perf_event_destroy;
928 928
929 /* 929 /*
930 * Generate PMC IRQs: 930 * Generate PMC IRQs:
@@ -948,15 +948,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
948 /* 948 /*
949 * If we have a PMU initialized but no APIC 949 * If we have a PMU initialized but no APIC
950 * interrupts, we cannot sample hardware 950 * interrupts, we cannot sample hardware
951 * counters (user-space has to fall back and 951 * events (user-space has to fall back and
952 * sample via a hrtimer based software counter): 952 * sample via a hrtimer based software event):
953 */ 953 */
954 if (!x86_pmu.apic) 954 if (!x86_pmu.apic)
955 return -EOPNOTSUPP; 955 return -EOPNOTSUPP;
956 } 956 }
957 957
958 /* 958 /*
959 * Raw event type provide the config in the event structure 959 * Raw hw_event type provide the config in the hw_event structure
960 */ 960 */
961 if (attr->type == PERF_TYPE_RAW) { 961 if (attr->type == PERF_TYPE_RAW) {
962 hwc->config |= x86_pmu.raw_event(attr->config); 962 hwc->config |= x86_pmu.raw_event(attr->config);
@@ -1001,7 +1001,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
1001 1001
1002static void p6_pmu_disable_all(void) 1002static void p6_pmu_disable_all(void)
1003{ 1003{
1004 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1004 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1005 u64 val; 1005 u64 val;
1006 1006
1007 if (!cpuc->enabled) 1007 if (!cpuc->enabled)
@@ -1018,7 +1018,7 @@ static void p6_pmu_disable_all(void)
1018 1018
1019static void intel_pmu_disable_all(void) 1019static void intel_pmu_disable_all(void)
1020{ 1020{
1021 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1021 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1022 1022
1023 if (!cpuc->enabled) 1023 if (!cpuc->enabled)
1024 return; 1024 return;
@@ -1034,7 +1034,7 @@ static void intel_pmu_disable_all(void)
1034 1034
1035static void amd_pmu_disable_all(void) 1035static void amd_pmu_disable_all(void)
1036{ 1036{
1037 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1037 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1038 int idx; 1038 int idx;
1039 1039
1040 if (!cpuc->enabled) 1040 if (!cpuc->enabled)
@@ -1043,12 +1043,12 @@ static void amd_pmu_disable_all(void)
1043 cpuc->enabled = 0; 1043 cpuc->enabled = 0;
1044 /* 1044 /*
1045 * ensure we write the disable before we start disabling the 1045 * ensure we write the disable before we start disabling the
1046 * counters proper, so that amd_pmu_enable_counter() does the 1046 * events proper, so that amd_pmu_enable_event() does the
1047 * right thing. 1047 * right thing.
1048 */ 1048 */
1049 barrier(); 1049 barrier();
1050 1050
1051 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1051 for (idx = 0; idx < x86_pmu.num_events; idx++) {
1052 u64 val; 1052 u64 val;
1053 1053
1054 if (!test_bit(idx, cpuc->active_mask)) 1054 if (!test_bit(idx, cpuc->active_mask))
@@ -1070,7 +1070,7 @@ void hw_perf_disable(void)
1070 1070
1071static void p6_pmu_enable_all(void) 1071static void p6_pmu_enable_all(void)
1072{ 1072{
1073 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1073 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1074 unsigned long val; 1074 unsigned long val;
1075 1075
1076 if (cpuc->enabled) 1076 if (cpuc->enabled)
@@ -1087,7 +1087,7 @@ static void p6_pmu_enable_all(void)
1087 1087
1088static void intel_pmu_enable_all(void) 1088static void intel_pmu_enable_all(void)
1089{ 1089{
1090 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1090 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1091 1091
1092 if (cpuc->enabled) 1092 if (cpuc->enabled)
1093 return; 1093 return;
@@ -1098,19 +1098,19 @@ static void intel_pmu_enable_all(void)
1098 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl); 1098 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
1099 1099
1100 if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) { 1100 if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
1101 struct perf_counter *counter = 1101 struct perf_event *event =
1102 cpuc->counters[X86_PMC_IDX_FIXED_BTS]; 1102 cpuc->events[X86_PMC_IDX_FIXED_BTS];
1103 1103
1104 if (WARN_ON_ONCE(!counter)) 1104 if (WARN_ON_ONCE(!event))
1105 return; 1105 return;
1106 1106
1107 intel_pmu_enable_bts(counter->hw.config); 1107 intel_pmu_enable_bts(event->hw.config);
1108 } 1108 }
1109} 1109}
1110 1110
1111static void amd_pmu_enable_all(void) 1111static void amd_pmu_enable_all(void)
1112{ 1112{
1113 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1113 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1114 int idx; 1114 int idx;
1115 1115
1116 if (cpuc->enabled) 1116 if (cpuc->enabled)
@@ -1119,14 +1119,14 @@ static void amd_pmu_enable_all(void)
1119 cpuc->enabled = 1; 1119 cpuc->enabled = 1;
1120 barrier(); 1120 barrier();
1121 1121
1122 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1122 for (idx = 0; idx < x86_pmu.num_events; idx++) {
1123 struct perf_counter *counter = cpuc->counters[idx]; 1123 struct perf_event *event = cpuc->events[idx];
1124 u64 val; 1124 u64 val;
1125 1125
1126 if (!test_bit(idx, cpuc->active_mask)) 1126 if (!test_bit(idx, cpuc->active_mask))
1127 continue; 1127 continue;
1128 1128
1129 val = counter->hw.config; 1129 val = event->hw.config;
1130 val |= ARCH_PERFMON_EVENTSEL0_ENABLE; 1130 val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
1131 wrmsrl(MSR_K7_EVNTSEL0 + idx, val); 1131 wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
1132 } 1132 }
@@ -1153,19 +1153,19 @@ static inline void intel_pmu_ack_status(u64 ack)
1153 wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack); 1153 wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack);
1154} 1154}
1155 1155
1156static inline void x86_pmu_enable_counter(struct hw_perf_counter *hwc, int idx) 1156static inline void x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
1157{ 1157{
1158 (void)checking_wrmsrl(hwc->config_base + idx, 1158 (void)checking_wrmsrl(hwc->config_base + idx,
1159 hwc->config | ARCH_PERFMON_EVENTSEL0_ENABLE); 1159 hwc->config | ARCH_PERFMON_EVENTSEL0_ENABLE);
1160} 1160}
1161 1161
1162static inline void x86_pmu_disable_counter(struct hw_perf_counter *hwc, int idx) 1162static inline void x86_pmu_disable_event(struct hw_perf_event *hwc, int idx)
1163{ 1163{
1164 (void)checking_wrmsrl(hwc->config_base + idx, hwc->config); 1164 (void)checking_wrmsrl(hwc->config_base + idx, hwc->config);
1165} 1165}
1166 1166
1167static inline void 1167static inline void
1168intel_pmu_disable_fixed(struct hw_perf_counter *hwc, int __idx) 1168intel_pmu_disable_fixed(struct hw_perf_event *hwc, int __idx)
1169{ 1169{
1170 int idx = __idx - X86_PMC_IDX_FIXED; 1170 int idx = __idx - X86_PMC_IDX_FIXED;
1171 u64 ctrl_val, mask; 1171 u64 ctrl_val, mask;
@@ -1178,10 +1178,10 @@ intel_pmu_disable_fixed(struct hw_perf_counter *hwc, int __idx)
1178} 1178}
1179 1179
1180static inline void 1180static inline void
1181p6_pmu_disable_counter(struct hw_perf_counter *hwc, int idx) 1181p6_pmu_disable_event(struct hw_perf_event *hwc, int idx)
1182{ 1182{
1183 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1183 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1184 u64 val = P6_NOP_COUNTER; 1184 u64 val = P6_NOP_EVENT;
1185 1185
1186 if (cpuc->enabled) 1186 if (cpuc->enabled)
1187 val |= ARCH_PERFMON_EVENTSEL0_ENABLE; 1187 val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
@@ -1190,7 +1190,7 @@ p6_pmu_disable_counter(struct hw_perf_counter *hwc, int idx)
1190} 1190}
1191 1191
1192static inline void 1192static inline void
1193intel_pmu_disable_counter(struct hw_perf_counter *hwc, int idx) 1193intel_pmu_disable_event(struct hw_perf_event *hwc, int idx)
1194{ 1194{
1195 if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) { 1195 if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
1196 intel_pmu_disable_bts(); 1196 intel_pmu_disable_bts();
@@ -1202,24 +1202,24 @@ intel_pmu_disable_counter(struct hw_perf_counter *hwc, int idx)
1202 return; 1202 return;
1203 } 1203 }
1204 1204
1205 x86_pmu_disable_counter(hwc, idx); 1205 x86_pmu_disable_event(hwc, idx);
1206} 1206}
1207 1207
1208static inline void 1208static inline void
1209amd_pmu_disable_counter(struct hw_perf_counter *hwc, int idx) 1209amd_pmu_disable_event(struct hw_perf_event *hwc, int idx)
1210{ 1210{
1211 x86_pmu_disable_counter(hwc, idx); 1211 x86_pmu_disable_event(hwc, idx);
1212} 1212}
1213 1213
1214static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left); 1214static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
1215 1215
1216/* 1216/*
1217 * Set the next IRQ period, based on the hwc->period_left value. 1217 * Set the next IRQ period, based on the hwc->period_left value.
1218 * To be called with the counter disabled in hw: 1218 * To be called with the event disabled in hw:
1219 */ 1219 */
1220static int 1220static int
1221x86_perf_counter_set_period(struct perf_counter *counter, 1221x86_perf_event_set_period(struct perf_event *event,
1222 struct hw_perf_counter *hwc, int idx) 1222 struct hw_perf_event *hwc, int idx)
1223{ 1223{
1224 s64 left = atomic64_read(&hwc->period_left); 1224 s64 left = atomic64_read(&hwc->period_left);
1225 s64 period = hwc->sample_period; 1225 s64 period = hwc->sample_period;
@@ -1245,7 +1245,7 @@ x86_perf_counter_set_period(struct perf_counter *counter,
1245 ret = 1; 1245 ret = 1;
1246 } 1246 }
1247 /* 1247 /*
1248 * Quirk: certain CPUs dont like it if just 1 event is left: 1248 * Quirk: certain CPUs dont like it if just 1 hw_event is left:
1249 */ 1249 */
1250 if (unlikely(left < 2)) 1250 if (unlikely(left < 2))
1251 left = 2; 1251 left = 2;
@@ -1256,21 +1256,21 @@ x86_perf_counter_set_period(struct perf_counter *counter,
1256 per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; 1256 per_cpu(pmc_prev_left[idx], smp_processor_id()) = left;
1257 1257
1258 /* 1258 /*
1259 * The hw counter starts counting from this counter offset, 1259 * The hw event starts counting from this event offset,
1260 * mark it to be able to extra future deltas: 1260 * mark it to be able to extra future deltas:
1261 */ 1261 */
1262 atomic64_set(&hwc->prev_count, (u64)-left); 1262 atomic64_set(&hwc->prev_count, (u64)-left);
1263 1263
1264 err = checking_wrmsrl(hwc->counter_base + idx, 1264 err = checking_wrmsrl(hwc->event_base + idx,
1265 (u64)(-left) & x86_pmu.counter_mask); 1265 (u64)(-left) & x86_pmu.event_mask);
1266 1266
1267 perf_counter_update_userpage(counter); 1267 perf_event_update_userpage(event);
1268 1268
1269 return ret; 1269 return ret;
1270} 1270}
1271 1271
1272static inline void 1272static inline void
1273intel_pmu_enable_fixed(struct hw_perf_counter *hwc, int __idx) 1273intel_pmu_enable_fixed(struct hw_perf_event *hwc, int __idx)
1274{ 1274{
1275 int idx = __idx - X86_PMC_IDX_FIXED; 1275 int idx = __idx - X86_PMC_IDX_FIXED;
1276 u64 ctrl_val, bits, mask; 1276 u64 ctrl_val, bits, mask;
@@ -1295,9 +1295,9 @@ intel_pmu_enable_fixed(struct hw_perf_counter *hwc, int __idx)
1295 err = checking_wrmsrl(hwc->config_base, ctrl_val); 1295 err = checking_wrmsrl(hwc->config_base, ctrl_val);
1296} 1296}
1297 1297
1298static void p6_pmu_enable_counter(struct hw_perf_counter *hwc, int idx) 1298static void p6_pmu_enable_event(struct hw_perf_event *hwc, int idx)
1299{ 1299{
1300 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1300 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1301 u64 val; 1301 u64 val;
1302 1302
1303 val = hwc->config; 1303 val = hwc->config;
@@ -1308,10 +1308,10 @@ static void p6_pmu_enable_counter(struct hw_perf_counter *hwc, int idx)
1308} 1308}
1309 1309
1310 1310
1311static void intel_pmu_enable_counter(struct hw_perf_counter *hwc, int idx) 1311static void intel_pmu_enable_event(struct hw_perf_event *hwc, int idx)
1312{ 1312{
1313 if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) { 1313 if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
1314 if (!__get_cpu_var(cpu_hw_counters).enabled) 1314 if (!__get_cpu_var(cpu_hw_events).enabled)
1315 return; 1315 return;
1316 1316
1317 intel_pmu_enable_bts(hwc->config); 1317 intel_pmu_enable_bts(hwc->config);
@@ -1323,134 +1323,134 @@ static void intel_pmu_enable_counter(struct hw_perf_counter *hwc, int idx)
1323 return; 1323 return;
1324 } 1324 }
1325 1325
1326 x86_pmu_enable_counter(hwc, idx); 1326 x86_pmu_enable_event(hwc, idx);
1327} 1327}
1328 1328
1329static void amd_pmu_enable_counter(struct hw_perf_counter *hwc, int idx) 1329static void amd_pmu_enable_event(struct hw_perf_event *hwc, int idx)
1330{ 1330{
1331 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1331 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1332 1332
1333 if (cpuc->enabled) 1333 if (cpuc->enabled)
1334 x86_pmu_enable_counter(hwc, idx); 1334 x86_pmu_enable_event(hwc, idx);
1335} 1335}
1336 1336
1337static int 1337static int
1338fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc) 1338fixed_mode_idx(struct perf_event *event, struct hw_perf_event *hwc)
1339{ 1339{
1340 unsigned int event; 1340 unsigned int hw_event;
1341 1341
1342 event = hwc->config & ARCH_PERFMON_EVENT_MASK; 1342 hw_event = hwc->config & ARCH_PERFMON_EVENT_MASK;
1343 1343
1344 if (unlikely((event == 1344 if (unlikely((hw_event ==
1345 x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) && 1345 x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) &&
1346 (hwc->sample_period == 1))) 1346 (hwc->sample_period == 1)))
1347 return X86_PMC_IDX_FIXED_BTS; 1347 return X86_PMC_IDX_FIXED_BTS;
1348 1348
1349 if (!x86_pmu.num_counters_fixed) 1349 if (!x86_pmu.num_events_fixed)
1350 return -1; 1350 return -1;
1351 1351
1352 if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS))) 1352 if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
1353 return X86_PMC_IDX_FIXED_INSTRUCTIONS; 1353 return X86_PMC_IDX_FIXED_INSTRUCTIONS;
1354 if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES))) 1354 if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
1355 return X86_PMC_IDX_FIXED_CPU_CYCLES; 1355 return X86_PMC_IDX_FIXED_CPU_CYCLES;
1356 if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES))) 1356 if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES)))
1357 return X86_PMC_IDX_FIXED_BUS_CYCLES; 1357 return X86_PMC_IDX_FIXED_BUS_CYCLES;
1358 1358
1359 return -1; 1359 return -1;
1360} 1360}
1361 1361
1362/* 1362/*
1363 * Find a PMC slot for the freshly enabled / scheduled in counter: 1363 * Find a PMC slot for the freshly enabled / scheduled in event:
1364 */ 1364 */
1365static int x86_pmu_enable(struct perf_counter *counter) 1365static int x86_pmu_enable(struct perf_event *event)
1366{ 1366{
1367 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1367 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1368 struct hw_perf_counter *hwc = &counter->hw; 1368 struct hw_perf_event *hwc = &event->hw;
1369 int idx; 1369 int idx;
1370 1370
1371 idx = fixed_mode_idx(counter, hwc); 1371 idx = fixed_mode_idx(event, hwc);
1372 if (idx == X86_PMC_IDX_FIXED_BTS) { 1372 if (idx == X86_PMC_IDX_FIXED_BTS) {
1373 /* BTS is already occupied. */ 1373 /* BTS is already occupied. */
1374 if (test_and_set_bit(idx, cpuc->used_mask)) 1374 if (test_and_set_bit(idx, cpuc->used_mask))
1375 return -EAGAIN; 1375 return -EAGAIN;
1376 1376
1377 hwc->config_base = 0; 1377 hwc->config_base = 0;
1378 hwc->counter_base = 0; 1378 hwc->event_base = 0;
1379 hwc->idx = idx; 1379 hwc->idx = idx;
1380 } else if (idx >= 0) { 1380 } else if (idx >= 0) {
1381 /* 1381 /*
1382 * Try to get the fixed counter, if that is already taken 1382 * Try to get the fixed event, if that is already taken
1383 * then try to get a generic counter: 1383 * then try to get a generic event:
1384 */ 1384 */
1385 if (test_and_set_bit(idx, cpuc->used_mask)) 1385 if (test_and_set_bit(idx, cpuc->used_mask))
1386 goto try_generic; 1386 goto try_generic;
1387 1387
1388 hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL; 1388 hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
1389 /* 1389 /*
1390 * We set it so that counter_base + idx in wrmsr/rdmsr maps to 1390 * We set it so that event_base + idx in wrmsr/rdmsr maps to
1391 * MSR_ARCH_PERFMON_FIXED_CTR0 ... CTR2: 1391 * MSR_ARCH_PERFMON_FIXED_CTR0 ... CTR2:
1392 */ 1392 */
1393 hwc->counter_base = 1393 hwc->event_base =
1394 MSR_ARCH_PERFMON_FIXED_CTR0 - X86_PMC_IDX_FIXED; 1394 MSR_ARCH_PERFMON_FIXED_CTR0 - X86_PMC_IDX_FIXED;
1395 hwc->idx = idx; 1395 hwc->idx = idx;
1396 } else { 1396 } else {
1397 idx = hwc->idx; 1397 idx = hwc->idx;
1398 /* Try to get the previous generic counter again */ 1398 /* Try to get the previous generic event again */
1399 if (test_and_set_bit(idx, cpuc->used_mask)) { 1399 if (test_and_set_bit(idx, cpuc->used_mask)) {
1400try_generic: 1400try_generic:
1401 idx = find_first_zero_bit(cpuc->used_mask, 1401 idx = find_first_zero_bit(cpuc->used_mask,
1402 x86_pmu.num_counters); 1402 x86_pmu.num_events);
1403 if (idx == x86_pmu.num_counters) 1403 if (idx == x86_pmu.num_events)
1404 return -EAGAIN; 1404 return -EAGAIN;
1405 1405
1406 set_bit(idx, cpuc->used_mask); 1406 set_bit(idx, cpuc->used_mask);
1407 hwc->idx = idx; 1407 hwc->idx = idx;
1408 } 1408 }
1409 hwc->config_base = x86_pmu.eventsel; 1409 hwc->config_base = x86_pmu.eventsel;
1410 hwc->counter_base = x86_pmu.perfctr; 1410 hwc->event_base = x86_pmu.perfctr;
1411 } 1411 }
1412 1412
1413 perf_counters_lapic_init(); 1413 perf_events_lapic_init();
1414 1414
1415 x86_pmu.disable(hwc, idx); 1415 x86_pmu.disable(hwc, idx);
1416 1416
1417 cpuc->counters[idx] = counter; 1417 cpuc->events[idx] = event;
1418 set_bit(idx, cpuc->active_mask); 1418 set_bit(idx, cpuc->active_mask);
1419 1419
1420 x86_perf_counter_set_period(counter, hwc, idx); 1420 x86_perf_event_set_period(event, hwc, idx);
1421 x86_pmu.enable(hwc, idx); 1421 x86_pmu.enable(hwc, idx);
1422 1422
1423 perf_counter_update_userpage(counter); 1423 perf_event_update_userpage(event);
1424 1424
1425 return 0; 1425 return 0;
1426} 1426}
1427 1427
1428static void x86_pmu_unthrottle(struct perf_counter *counter) 1428static void x86_pmu_unthrottle(struct perf_event *event)
1429{ 1429{
1430 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1430 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1431 struct hw_perf_counter *hwc = &counter->hw; 1431 struct hw_perf_event *hwc = &event->hw;
1432 1432
1433 if (WARN_ON_ONCE(hwc->idx >= X86_PMC_IDX_MAX || 1433 if (WARN_ON_ONCE(hwc->idx >= X86_PMC_IDX_MAX ||
1434 cpuc->counters[hwc->idx] != counter)) 1434 cpuc->events[hwc->idx] != event))
1435 return; 1435 return;
1436 1436
1437 x86_pmu.enable(hwc, hwc->idx); 1437 x86_pmu.enable(hwc, hwc->idx);
1438} 1438}
1439 1439
1440void perf_counter_print_debug(void) 1440void perf_event_print_debug(void)
1441{ 1441{
1442 u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed; 1442 u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
1443 struct cpu_hw_counters *cpuc; 1443 struct cpu_hw_events *cpuc;
1444 unsigned long flags; 1444 unsigned long flags;
1445 int cpu, idx; 1445 int cpu, idx;
1446 1446
1447 if (!x86_pmu.num_counters) 1447 if (!x86_pmu.num_events)
1448 return; 1448 return;
1449 1449
1450 local_irq_save(flags); 1450 local_irq_save(flags);
1451 1451
1452 cpu = smp_processor_id(); 1452 cpu = smp_processor_id();
1453 cpuc = &per_cpu(cpu_hw_counters, cpu); 1453 cpuc = &per_cpu(cpu_hw_events, cpu);
1454 1454
1455 if (x86_pmu.version >= 2) { 1455 if (x86_pmu.version >= 2) {
1456 rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl); 1456 rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);
@@ -1466,7 +1466,7 @@ void perf_counter_print_debug(void)
1466 } 1466 }
1467 pr_info("CPU#%d: used: %016llx\n", cpu, *(u64 *)cpuc->used_mask); 1467 pr_info("CPU#%d: used: %016llx\n", cpu, *(u64 *)cpuc->used_mask);
1468 1468
1469 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1469 for (idx = 0; idx < x86_pmu.num_events; idx++) {
1470 rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl); 1470 rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl);
1471 rdmsrl(x86_pmu.perfctr + idx, pmc_count); 1471 rdmsrl(x86_pmu.perfctr + idx, pmc_count);
1472 1472
@@ -1479,7 +1479,7 @@ void perf_counter_print_debug(void)
1479 pr_info("CPU#%d: gen-PMC%d left: %016llx\n", 1479 pr_info("CPU#%d: gen-PMC%d left: %016llx\n",
1480 cpu, idx, prev_left); 1480 cpu, idx, prev_left);
1481 } 1481 }
1482 for (idx = 0; idx < x86_pmu.num_counters_fixed; idx++) { 1482 for (idx = 0; idx < x86_pmu.num_events_fixed; idx++) {
1483 rdmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, pmc_count); 1483 rdmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, pmc_count);
1484 1484
1485 pr_info("CPU#%d: fixed-PMC%d count: %016llx\n", 1485 pr_info("CPU#%d: fixed-PMC%d count: %016llx\n",
@@ -1488,7 +1488,7 @@ void perf_counter_print_debug(void)
1488 local_irq_restore(flags); 1488 local_irq_restore(flags);
1489} 1489}
1490 1490
1491static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc) 1491static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
1492{ 1492{
1493 struct debug_store *ds = cpuc->ds; 1493 struct debug_store *ds = cpuc->ds;
1494 struct bts_record { 1494 struct bts_record {
@@ -1496,14 +1496,14 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc)
1496 u64 to; 1496 u64 to;
1497 u64 flags; 1497 u64 flags;
1498 }; 1498 };
1499 struct perf_counter *counter = cpuc->counters[X86_PMC_IDX_FIXED_BTS]; 1499 struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];
1500 struct bts_record *at, *top; 1500 struct bts_record *at, *top;
1501 struct perf_output_handle handle; 1501 struct perf_output_handle handle;
1502 struct perf_event_header header; 1502 struct perf_event_header header;
1503 struct perf_sample_data data; 1503 struct perf_sample_data data;
1504 struct pt_regs regs; 1504 struct pt_regs regs;
1505 1505
1506 if (!counter) 1506 if (!event)
1507 return; 1507 return;
1508 1508
1509 if (!ds) 1509 if (!ds)
@@ -1518,7 +1518,7 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc)
1518 ds->bts_index = ds->bts_buffer_base; 1518 ds->bts_index = ds->bts_buffer_base;
1519 1519
1520 1520
1521 data.period = counter->hw.last_period; 1521 data.period = event->hw.last_period;
1522 data.addr = 0; 1522 data.addr = 0;
1523 regs.ip = 0; 1523 regs.ip = 0;
1524 1524
@@ -1527,9 +1527,9 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc)
1527 * We will overwrite the from and to address before we output 1527 * We will overwrite the from and to address before we output
1528 * the sample. 1528 * the sample.
1529 */ 1529 */
1530 perf_prepare_sample(&header, &data, counter, &regs); 1530 perf_prepare_sample(&header, &data, event, &regs);
1531 1531
1532 if (perf_output_begin(&handle, counter, 1532 if (perf_output_begin(&handle, event,
1533 header.size * (top - at), 1, 1)) 1533 header.size * (top - at), 1, 1))
1534 return; 1534 return;
1535 1535
@@ -1537,20 +1537,20 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc)
1537 data.ip = at->from; 1537 data.ip = at->from;
1538 data.addr = at->to; 1538 data.addr = at->to;
1539 1539
1540 perf_output_sample(&handle, &header, &data, counter); 1540 perf_output_sample(&handle, &header, &data, event);
1541 } 1541 }
1542 1542
1543 perf_output_end(&handle); 1543 perf_output_end(&handle);
1544 1544
1545 /* There's new data available. */ 1545 /* There's new data available. */
1546 counter->hw.interrupts++; 1546 event->hw.interrupts++;
1547 counter->pending_kill = POLL_IN; 1547 event->pending_kill = POLL_IN;
1548} 1548}
1549 1549
1550static void x86_pmu_disable(struct perf_counter *counter) 1550static void x86_pmu_disable(struct perf_event *event)
1551{ 1551{
1552 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters); 1552 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1553 struct hw_perf_counter *hwc = &counter->hw; 1553 struct hw_perf_event *hwc = &event->hw;
1554 int idx = hwc->idx; 1554 int idx = hwc->idx;
1555 1555
1556 /* 1556 /*
@@ -1562,63 +1562,63 @@ static void x86_pmu_disable(struct perf_counter *counter)
1562 1562
1563 /* 1563 /*
1564 * Make sure the cleared pointer becomes visible before we 1564 * Make sure the cleared pointer becomes visible before we
1565 * (potentially) free the counter: 1565 * (potentially) free the event:
1566 */ 1566 */
1567 barrier(); 1567 barrier();
1568 1568
1569 /* 1569 /*
1570 * Drain the remaining delta count out of a counter 1570 * Drain the remaining delta count out of a event
1571 * that we are disabling: 1571 * that we are disabling:
1572 */ 1572 */
1573 x86_perf_counter_update(counter, hwc, idx); 1573 x86_perf_event_update(event, hwc, idx);
1574 1574
1575 /* Drain the remaining BTS records. */ 1575 /* Drain the remaining BTS records. */
1576 if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) 1576 if (unlikely(idx == X86_PMC_IDX_FIXED_BTS))
1577 intel_pmu_drain_bts_buffer(cpuc); 1577 intel_pmu_drain_bts_buffer(cpuc);
1578 1578
1579 cpuc->counters[idx] = NULL; 1579 cpuc->events[idx] = NULL;
1580 clear_bit(idx, cpuc->used_mask); 1580 clear_bit(idx, cpuc->used_mask);
1581 1581
1582 perf_counter_update_userpage(counter); 1582 perf_event_update_userpage(event);
1583} 1583}
1584 1584
1585/* 1585/*
1586 * Save and restart an expired counter. Called by NMI contexts, 1586 * Save and restart an expired event. Called by NMI contexts,
1587 * so it has to be careful about preempting normal counter ops: 1587 * so it has to be careful about preempting normal event ops:
1588 */ 1588 */
1589static int intel_pmu_save_and_restart(struct perf_counter *counter) 1589static int intel_pmu_save_and_restart(struct perf_event *event)
1590{ 1590{
1591 struct hw_perf_counter *hwc = &counter->hw; 1591 struct hw_perf_event *hwc = &event->hw;
1592 int idx = hwc->idx; 1592 int idx = hwc->idx;
1593 int ret; 1593 int ret;
1594 1594
1595 x86_perf_counter_update(counter, hwc, idx); 1595 x86_perf_event_update(event, hwc, idx);
1596 ret = x86_perf_counter_set_period(counter, hwc, idx); 1596 ret = x86_perf_event_set_period(event, hwc, idx);
1597 1597
1598 if (counter->state == PERF_COUNTER_STATE_ACTIVE) 1598 if (event->state == PERF_EVENT_STATE_ACTIVE)
1599 intel_pmu_enable_counter(hwc, idx); 1599 intel_pmu_enable_event(hwc, idx);
1600 1600
1601 return ret; 1601 return ret;
1602} 1602}
1603 1603
1604static void intel_pmu_reset(void) 1604static void intel_pmu_reset(void)
1605{ 1605{
1606 struct debug_store *ds = __get_cpu_var(cpu_hw_counters).ds; 1606 struct debug_store *ds = __get_cpu_var(cpu_hw_events).ds;
1607 unsigned long flags; 1607 unsigned long flags;
1608 int idx; 1608 int idx;
1609 1609
1610 if (!x86_pmu.num_counters) 1610 if (!x86_pmu.num_events)
1611 return; 1611 return;
1612 1612
1613 local_irq_save(flags); 1613 local_irq_save(flags);
1614 1614
1615 printk("clearing PMU state on CPU#%d\n", smp_processor_id()); 1615 printk("clearing PMU state on CPU#%d\n", smp_processor_id());
1616 1616
1617 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1617 for (idx = 0; idx < x86_pmu.num_events; idx++) {
1618 checking_wrmsrl(x86_pmu.eventsel + idx, 0ull); 1618 checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
1619 checking_wrmsrl(x86_pmu.perfctr + idx, 0ull); 1619 checking_wrmsrl(x86_pmu.perfctr + idx, 0ull);
1620 } 1620 }
1621 for (idx = 0; idx < x86_pmu.num_counters_fixed; idx++) { 1621 for (idx = 0; idx < x86_pmu.num_events_fixed; idx++) {
1622 checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull); 1622 checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
1623 } 1623 }
1624 if (ds) 1624 if (ds)
@@ -1630,38 +1630,38 @@ static void intel_pmu_reset(void)
1630static int p6_pmu_handle_irq(struct pt_regs *regs) 1630static int p6_pmu_handle_irq(struct pt_regs *regs)
1631{ 1631{
1632 struct perf_sample_data data; 1632 struct perf_sample_data data;
1633 struct cpu_hw_counters *cpuc; 1633 struct cpu_hw_events *cpuc;
1634 struct perf_counter *counter; 1634 struct perf_event *event;
1635 struct hw_perf_counter *hwc; 1635 struct hw_perf_event *hwc;
1636 int idx, handled = 0; 1636 int idx, handled = 0;
1637 u64 val; 1637 u64 val;
1638 1638
1639 data.addr = 0; 1639 data.addr = 0;
1640 1640
1641 cpuc = &__get_cpu_var(cpu_hw_counters); 1641 cpuc = &__get_cpu_var(cpu_hw_events);
1642 1642
1643 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1643 for (idx = 0; idx < x86_pmu.num_events; idx++) {
1644 if (!test_bit(idx, cpuc->active_mask)) 1644 if (!test_bit(idx, cpuc->active_mask))
1645 continue; 1645 continue;
1646 1646
1647 counter = cpuc->counters[idx]; 1647 event = cpuc->events[idx];
1648 hwc = &counter->hw; 1648 hwc = &event->hw;
1649 1649
1650 val = x86_perf_counter_update(counter, hwc, idx); 1650 val = x86_perf_event_update(event, hwc, idx);
1651 if (val & (1ULL << (x86_pmu.counter_bits - 1))) 1651 if (val & (1ULL << (x86_pmu.event_bits - 1)))
1652 continue; 1652 continue;
1653 1653
1654 /* 1654 /*
1655 * counter overflow 1655 * event overflow
1656 */ 1656 */
1657 handled = 1; 1657 handled = 1;
1658 data.period = counter->hw.last_period; 1658 data.period = event->hw.last_period;
1659 1659
1660 if (!x86_perf_counter_set_period(counter, hwc, idx)) 1660 if (!x86_perf_event_set_period(event, hwc, idx))
1661 continue; 1661 continue;
1662 1662
1663 if (perf_counter_overflow(counter, 1, &data, regs)) 1663 if (perf_event_overflow(event, 1, &data, regs))
1664 p6_pmu_disable_counter(hwc, idx); 1664 p6_pmu_disable_event(hwc, idx);
1665 } 1665 }
1666 1666
1667 if (handled) 1667 if (handled)
@@ -1677,13 +1677,13 @@ static int p6_pmu_handle_irq(struct pt_regs *regs)
1677static int intel_pmu_handle_irq(struct pt_regs *regs) 1677static int intel_pmu_handle_irq(struct pt_regs *regs)
1678{ 1678{
1679 struct perf_sample_data data; 1679 struct perf_sample_data data;
1680 struct cpu_hw_counters *cpuc; 1680 struct cpu_hw_events *cpuc;
1681 int bit, loops; 1681 int bit, loops;
1682 u64 ack, status; 1682 u64 ack, status;
1683 1683
1684 data.addr = 0; 1684 data.addr = 0;
1685 1685
1686 cpuc = &__get_cpu_var(cpu_hw_counters); 1686 cpuc = &__get_cpu_var(cpu_hw_events);
1687 1687
1688 perf_disable(); 1688 perf_disable();
1689 intel_pmu_drain_bts_buffer(cpuc); 1689 intel_pmu_drain_bts_buffer(cpuc);
@@ -1696,8 +1696,8 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
1696 loops = 0; 1696 loops = 0;
1697again: 1697again:
1698 if (++loops > 100) { 1698 if (++loops > 100) {
1699 WARN_ONCE(1, "perfcounters: irq loop stuck!\n"); 1699 WARN_ONCE(1, "perfevents: irq loop stuck!\n");
1700 perf_counter_print_debug(); 1700 perf_event_print_debug();
1701 intel_pmu_reset(); 1701 intel_pmu_reset();
1702 perf_enable(); 1702 perf_enable();
1703 return 1; 1703 return 1;
@@ -1706,19 +1706,19 @@ again:
1706 inc_irq_stat(apic_perf_irqs); 1706 inc_irq_stat(apic_perf_irqs);
1707 ack = status; 1707 ack = status;
1708 for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) { 1708 for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
1709 struct perf_counter *counter = cpuc->counters[bit]; 1709 struct perf_event *event = cpuc->events[bit];
1710 1710
1711 clear_bit(bit, (unsigned long *) &status); 1711 clear_bit(bit, (unsigned long *) &status);
1712 if (!test_bit(bit, cpuc->active_mask)) 1712 if (!test_bit(bit, cpuc->active_mask))
1713 continue; 1713 continue;
1714 1714
1715 if (!intel_pmu_save_and_restart(counter)) 1715 if (!intel_pmu_save_and_restart(event))
1716 continue; 1716 continue;
1717 1717
1718 data.period = counter->hw.last_period; 1718 data.period = event->hw.last_period;
1719 1719
1720 if (perf_counter_overflow(counter, 1, &data, regs)) 1720 if (perf_event_overflow(event, 1, &data, regs))
1721 intel_pmu_disable_counter(&counter->hw, bit); 1721 intel_pmu_disable_event(&event->hw, bit);
1722 } 1722 }
1723 1723
1724 intel_pmu_ack_status(ack); 1724 intel_pmu_ack_status(ack);
@@ -1738,38 +1738,38 @@ again:
1738static int amd_pmu_handle_irq(struct pt_regs *regs) 1738static int amd_pmu_handle_irq(struct pt_regs *regs)
1739{ 1739{
1740 struct perf_sample_data data; 1740 struct perf_sample_data data;
1741 struct cpu_hw_counters *cpuc; 1741 struct cpu_hw_events *cpuc;
1742 struct perf_counter *counter; 1742 struct perf_event *event;
1743 struct hw_perf_counter *hwc; 1743 struct hw_perf_event *hwc;
1744 int idx, handled = 0; 1744 int idx, handled = 0;
1745 u64 val; 1745 u64 val;
1746 1746
1747 data.addr = 0; 1747 data.addr = 0;
1748 1748
1749 cpuc = &__get_cpu_var(cpu_hw_counters); 1749 cpuc = &__get_cpu_var(cpu_hw_events);
1750 1750
1751 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1751 for (idx = 0; idx < x86_pmu.num_events; idx++) {
1752 if (!test_bit(idx, cpuc->active_mask)) 1752 if (!test_bit(idx, cpuc->active_mask))
1753 continue; 1753 continue;
1754 1754
1755 counter = cpuc->counters[idx]; 1755 event = cpuc->events[idx];
1756 hwc = &counter->hw; 1756 hwc = &event->hw;
1757 1757
1758 val = x86_perf_counter_update(counter, hwc, idx); 1758 val = x86_perf_event_update(event, hwc, idx);
1759 if (val & (1ULL << (x86_pmu.counter_bits - 1))) 1759 if (val & (1ULL << (x86_pmu.event_bits - 1)))
1760 continue; 1760 continue;
1761 1761
1762 /* 1762 /*
1763 * counter overflow 1763 * event overflow
1764 */ 1764 */
1765 handled = 1; 1765 handled = 1;
1766 data.period = counter->hw.last_period; 1766 data.period = event->hw.last_period;
1767 1767
1768 if (!x86_perf_counter_set_period(counter, hwc, idx)) 1768 if (!x86_perf_event_set_period(event, hwc, idx))
1769 continue; 1769 continue;
1770 1770
1771 if (perf_counter_overflow(counter, 1, &data, regs)) 1771 if (perf_event_overflow(event, 1, &data, regs))
1772 amd_pmu_disable_counter(hwc, idx); 1772 amd_pmu_disable_event(hwc, idx);
1773 } 1773 }
1774 1774
1775 if (handled) 1775 if (handled)
@@ -1783,18 +1783,18 @@ void smp_perf_pending_interrupt(struct pt_regs *regs)
1783 irq_enter(); 1783 irq_enter();
1784 ack_APIC_irq(); 1784 ack_APIC_irq();
1785 inc_irq_stat(apic_pending_irqs); 1785 inc_irq_stat(apic_pending_irqs);
1786 perf_counter_do_pending(); 1786 perf_event_do_pending();
1787 irq_exit(); 1787 irq_exit();
1788} 1788}
1789 1789
1790void set_perf_counter_pending(void) 1790void set_perf_event_pending(void)
1791{ 1791{
1792#ifdef CONFIG_X86_LOCAL_APIC 1792#ifdef CONFIG_X86_LOCAL_APIC
1793 apic->send_IPI_self(LOCAL_PENDING_VECTOR); 1793 apic->send_IPI_self(LOCAL_PENDING_VECTOR);
1794#endif 1794#endif
1795} 1795}
1796 1796
1797void perf_counters_lapic_init(void) 1797void perf_events_lapic_init(void)
1798{ 1798{
1799#ifdef CONFIG_X86_LOCAL_APIC 1799#ifdef CONFIG_X86_LOCAL_APIC
1800 if (!x86_pmu.apic || !x86_pmu_initialized()) 1800 if (!x86_pmu.apic || !x86_pmu_initialized())
@@ -1808,13 +1808,13 @@ void perf_counters_lapic_init(void)
1808} 1808}
1809 1809
1810static int __kprobes 1810static int __kprobes
1811perf_counter_nmi_handler(struct notifier_block *self, 1811perf_event_nmi_handler(struct notifier_block *self,
1812 unsigned long cmd, void *__args) 1812 unsigned long cmd, void *__args)
1813{ 1813{
1814 struct die_args *args = __args; 1814 struct die_args *args = __args;
1815 struct pt_regs *regs; 1815 struct pt_regs *regs;
1816 1816
1817 if (!atomic_read(&active_counters)) 1817 if (!atomic_read(&active_events))
1818 return NOTIFY_DONE; 1818 return NOTIFY_DONE;
1819 1819
1820 switch (cmd) { 1820 switch (cmd) {
@@ -1833,7 +1833,7 @@ perf_counter_nmi_handler(struct notifier_block *self,
1833#endif 1833#endif
1834 /* 1834 /*
1835 * Can't rely on the handled return value to say it was our NMI, two 1835 * Can't rely on the handled return value to say it was our NMI, two
1836 * counters could trigger 'simultaneously' raising two back-to-back NMIs. 1836 * events could trigger 'simultaneously' raising two back-to-back NMIs.
1837 * 1837 *
1838 * If the first NMI handles both, the latter will be empty and daze 1838 * If the first NMI handles both, the latter will be empty and daze
1839 * the CPU. 1839 * the CPU.
@@ -1843,8 +1843,8 @@ perf_counter_nmi_handler(struct notifier_block *self,
1843 return NOTIFY_STOP; 1843 return NOTIFY_STOP;
1844} 1844}
1845 1845
1846static __read_mostly struct notifier_block perf_counter_nmi_notifier = { 1846static __read_mostly struct notifier_block perf_event_nmi_notifier = {
1847 .notifier_call = perf_counter_nmi_handler, 1847 .notifier_call = perf_event_nmi_handler,
1848 .next = NULL, 1848 .next = NULL,
1849 .priority = 1 1849 .priority = 1
1850}; 1850};
@@ -1854,8 +1854,8 @@ static struct x86_pmu p6_pmu = {
1854 .handle_irq = p6_pmu_handle_irq, 1854 .handle_irq = p6_pmu_handle_irq,
1855 .disable_all = p6_pmu_disable_all, 1855 .disable_all = p6_pmu_disable_all,
1856 .enable_all = p6_pmu_enable_all, 1856 .enable_all = p6_pmu_enable_all,
1857 .enable = p6_pmu_enable_counter, 1857 .enable = p6_pmu_enable_event,
1858 .disable = p6_pmu_disable_counter, 1858 .disable = p6_pmu_disable_event,
1859 .eventsel = MSR_P6_EVNTSEL0, 1859 .eventsel = MSR_P6_EVNTSEL0,
1860 .perfctr = MSR_P6_PERFCTR0, 1860 .perfctr = MSR_P6_PERFCTR0,
1861 .event_map = p6_pmu_event_map, 1861 .event_map = p6_pmu_event_map,
@@ -1864,16 +1864,16 @@ static struct x86_pmu p6_pmu = {
1864 .apic = 1, 1864 .apic = 1,
1865 .max_period = (1ULL << 31) - 1, 1865 .max_period = (1ULL << 31) - 1,
1866 .version = 0, 1866 .version = 0,
1867 .num_counters = 2, 1867 .num_events = 2,
1868 /* 1868 /*
1869 * Counters have 40 bits implemented. However they are designed such 1869 * Events have 40 bits implemented. However they are designed such
1870 * that bits [32-39] are sign extensions of bit 31. As such the 1870 * that bits [32-39] are sign extensions of bit 31. As such the
1871 * effective width of a counter for P6-like PMU is 32 bits only. 1871 * effective width of a event for P6-like PMU is 32 bits only.
1872 * 1872 *
1873 * See IA-32 Intel Architecture Software developer manual Vol 3B 1873 * See IA-32 Intel Architecture Software developer manual Vol 3B
1874 */ 1874 */
1875 .counter_bits = 32, 1875 .event_bits = 32,
1876 .counter_mask = (1ULL << 32) - 1, 1876 .event_mask = (1ULL << 32) - 1,
1877}; 1877};
1878 1878
1879static struct x86_pmu intel_pmu = { 1879static struct x86_pmu intel_pmu = {
@@ -1881,8 +1881,8 @@ static struct x86_pmu intel_pmu = {
1881 .handle_irq = intel_pmu_handle_irq, 1881 .handle_irq = intel_pmu_handle_irq,
1882 .disable_all = intel_pmu_disable_all, 1882 .disable_all = intel_pmu_disable_all,
1883 .enable_all = intel_pmu_enable_all, 1883 .enable_all = intel_pmu_enable_all,
1884 .enable = intel_pmu_enable_counter, 1884 .enable = intel_pmu_enable_event,
1885 .disable = intel_pmu_disable_counter, 1885 .disable = intel_pmu_disable_event,
1886 .eventsel = MSR_ARCH_PERFMON_EVENTSEL0, 1886 .eventsel = MSR_ARCH_PERFMON_EVENTSEL0,
1887 .perfctr = MSR_ARCH_PERFMON_PERFCTR0, 1887 .perfctr = MSR_ARCH_PERFMON_PERFCTR0,
1888 .event_map = intel_pmu_event_map, 1888 .event_map = intel_pmu_event_map,
@@ -1892,7 +1892,7 @@ static struct x86_pmu intel_pmu = {
1892 /* 1892 /*
1893 * Intel PMCs cannot be accessed sanely above 32 bit width, 1893 * Intel PMCs cannot be accessed sanely above 32 bit width,
1894 * so we install an artificial 1<<31 period regardless of 1894 * so we install an artificial 1<<31 period regardless of
1895 * the generic counter period: 1895 * the generic event period:
1896 */ 1896 */
1897 .max_period = (1ULL << 31) - 1, 1897 .max_period = (1ULL << 31) - 1,
1898 .enable_bts = intel_pmu_enable_bts, 1898 .enable_bts = intel_pmu_enable_bts,
@@ -1904,16 +1904,16 @@ static struct x86_pmu amd_pmu = {
1904 .handle_irq = amd_pmu_handle_irq, 1904 .handle_irq = amd_pmu_handle_irq,
1905 .disable_all = amd_pmu_disable_all, 1905 .disable_all = amd_pmu_disable_all,
1906 .enable_all = amd_pmu_enable_all, 1906 .enable_all = amd_pmu_enable_all,
1907 .enable = amd_pmu_enable_counter, 1907 .enable = amd_pmu_enable_event,
1908 .disable = amd_pmu_disable_counter, 1908 .disable = amd_pmu_disable_event,
1909 .eventsel = MSR_K7_EVNTSEL0, 1909 .eventsel = MSR_K7_EVNTSEL0,
1910 .perfctr = MSR_K7_PERFCTR0, 1910 .perfctr = MSR_K7_PERFCTR0,
1911 .event_map = amd_pmu_event_map, 1911 .event_map = amd_pmu_event_map,
1912 .raw_event = amd_pmu_raw_event, 1912 .raw_event = amd_pmu_raw_event,
1913 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 1913 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
1914 .num_counters = 4, 1914 .num_events = 4,
1915 .counter_bits = 48, 1915 .event_bits = 48,
1916 .counter_mask = (1ULL << 48) - 1, 1916 .event_mask = (1ULL << 48) - 1,
1917 .apic = 1, 1917 .apic = 1,
1918 /* use highest bit to detect overflow */ 1918 /* use highest bit to detect overflow */
1919 .max_period = (1ULL << 47) - 1, 1919 .max_period = (1ULL << 47) - 1,
@@ -1970,7 +1970,7 @@ static int intel_pmu_init(void)
1970 1970
1971 /* 1971 /*
1972 * Check whether the Architectural PerfMon supports 1972 * Check whether the Architectural PerfMon supports
1973 * Branch Misses Retired Event or not. 1973 * Branch Misses Retired hw_event or not.
1974 */ 1974 */
1975 cpuid(10, &eax.full, &ebx, &unused, &edx.full); 1975 cpuid(10, &eax.full, &ebx, &unused, &edx.full);
1976 if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED) 1976 if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED)
@@ -1982,15 +1982,15 @@ static int intel_pmu_init(void)
1982 1982
1983 x86_pmu = intel_pmu; 1983 x86_pmu = intel_pmu;
1984 x86_pmu.version = version; 1984 x86_pmu.version = version;
1985 x86_pmu.num_counters = eax.split.num_counters; 1985 x86_pmu.num_events = eax.split.num_events;
1986 x86_pmu.counter_bits = eax.split.bit_width; 1986 x86_pmu.event_bits = eax.split.bit_width;
1987 x86_pmu.counter_mask = (1ULL << eax.split.bit_width) - 1; 1987 x86_pmu.event_mask = (1ULL << eax.split.bit_width) - 1;
1988 1988
1989 /* 1989 /*
1990 * Quirk: v2 perfmon does not report fixed-purpose counters, so 1990 * Quirk: v2 perfmon does not report fixed-purpose events, so
1991 * assume at least 3 counters: 1991 * assume at least 3 events:
1992 */ 1992 */
1993 x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3); 1993 x86_pmu.num_events_fixed = max((int)edx.split.num_events_fixed, 3);
1994 1994
1995 /* 1995 /*
1996 * Install the hw-cache-events table: 1996 * Install the hw-cache-events table:
@@ -2037,11 +2037,11 @@ static int amd_pmu_init(void)
2037 return 0; 2037 return 0;
2038} 2038}
2039 2039
2040void __init init_hw_perf_counters(void) 2040void __init init_hw_perf_events(void)
2041{ 2041{
2042 int err; 2042 int err;
2043 2043
2044 pr_info("Performance Counters: "); 2044 pr_info("Performance Events: ");
2045 2045
2046 switch (boot_cpu_data.x86_vendor) { 2046 switch (boot_cpu_data.x86_vendor) {
2047 case X86_VENDOR_INTEL: 2047 case X86_VENDOR_INTEL:
@@ -2054,45 +2054,45 @@ void __init init_hw_perf_counters(void)
2054 return; 2054 return;
2055 } 2055 }
2056 if (err != 0) { 2056 if (err != 0) {
2057 pr_cont("no PMU driver, software counters only.\n"); 2057 pr_cont("no PMU driver, software events only.\n");
2058 return; 2058 return;
2059 } 2059 }
2060 2060
2061 pr_cont("%s PMU driver.\n", x86_pmu.name); 2061 pr_cont("%s PMU driver.\n", x86_pmu.name);
2062 2062
2063 if (x86_pmu.num_counters > X86_PMC_MAX_GENERIC) { 2063 if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) {
2064 WARN(1, KERN_ERR "hw perf counters %d > max(%d), clipping!", 2064 WARN(1, KERN_ERR "hw perf events %d > max(%d), clipping!",
2065 x86_pmu.num_counters, X86_PMC_MAX_GENERIC); 2065 x86_pmu.num_events, X86_PMC_MAX_GENERIC);
2066 x86_pmu.num_counters = X86_PMC_MAX_GENERIC; 2066 x86_pmu.num_events = X86_PMC_MAX_GENERIC;
2067 } 2067 }
2068 perf_counter_mask = (1 << x86_pmu.num_counters) - 1; 2068 perf_event_mask = (1 << x86_pmu.num_events) - 1;
2069 perf_max_counters = x86_pmu.num_counters; 2069 perf_max_events = x86_pmu.num_events;
2070 2070
2071 if (x86_pmu.num_counters_fixed > X86_PMC_MAX_FIXED) { 2071 if (x86_pmu.num_events_fixed > X86_PMC_MAX_FIXED) {
2072 WARN(1, KERN_ERR "hw perf counters fixed %d > max(%d), clipping!", 2072 WARN(1, KERN_ERR "hw perf events fixed %d > max(%d), clipping!",
2073 x86_pmu.num_counters_fixed, X86_PMC_MAX_FIXED); 2073 x86_pmu.num_events_fixed, X86_PMC_MAX_FIXED);
2074 x86_pmu.num_counters_fixed = X86_PMC_MAX_FIXED; 2074 x86_pmu.num_events_fixed = X86_PMC_MAX_FIXED;
2075 } 2075 }
2076 2076
2077 perf_counter_mask |= 2077 perf_event_mask |=
2078 ((1LL << x86_pmu.num_counters_fixed)-1) << X86_PMC_IDX_FIXED; 2078 ((1LL << x86_pmu.num_events_fixed)-1) << X86_PMC_IDX_FIXED;
2079 x86_pmu.intel_ctrl = perf_counter_mask; 2079 x86_pmu.intel_ctrl = perf_event_mask;
2080 2080
2081 perf_counters_lapic_init(); 2081 perf_events_lapic_init();
2082 register_die_notifier(&perf_counter_nmi_notifier); 2082 register_die_notifier(&perf_event_nmi_notifier);
2083 2083
2084 pr_info("... version: %d\n", x86_pmu.version); 2084 pr_info("... version: %d\n", x86_pmu.version);
2085 pr_info("... bit width: %d\n", x86_pmu.counter_bits); 2085 pr_info("... bit width: %d\n", x86_pmu.event_bits);
2086 pr_info("... generic counters: %d\n", x86_pmu.num_counters); 2086 pr_info("... generic registers: %d\n", x86_pmu.num_events);
2087 pr_info("... value mask: %016Lx\n", x86_pmu.counter_mask); 2087 pr_info("... value mask: %016Lx\n", x86_pmu.event_mask);
2088 pr_info("... max period: %016Lx\n", x86_pmu.max_period); 2088 pr_info("... max period: %016Lx\n", x86_pmu.max_period);
2089 pr_info("... fixed-purpose counters: %d\n", x86_pmu.num_counters_fixed); 2089 pr_info("... fixed-purpose events: %d\n", x86_pmu.num_events_fixed);
2090 pr_info("... counter mask: %016Lx\n", perf_counter_mask); 2090 pr_info("... event mask: %016Lx\n", perf_event_mask);
2091} 2091}
2092 2092
2093static inline void x86_pmu_read(struct perf_counter *counter) 2093static inline void x86_pmu_read(struct perf_event *event)
2094{ 2094{
2095 x86_perf_counter_update(counter, &counter->hw, counter->hw.idx); 2095 x86_perf_event_update(event, &event->hw, event->hw.idx);
2096} 2096}
2097 2097
2098static const struct pmu pmu = { 2098static const struct pmu pmu = {
@@ -2102,14 +2102,14 @@ static const struct pmu pmu = {
2102 .unthrottle = x86_pmu_unthrottle, 2102 .unthrottle = x86_pmu_unthrottle,
2103}; 2103};
2104 2104
2105const struct pmu *hw_perf_counter_init(struct perf_counter *counter) 2105const struct pmu *hw_perf_event_init(struct perf_event *event)
2106{ 2106{
2107 int err; 2107 int err;
2108 2108
2109 err = __hw_perf_counter_init(counter); 2109 err = __hw_perf_event_init(event);
2110 if (err) { 2110 if (err) {
2111 if (counter->destroy) 2111 if (event->destroy)
2112 counter->destroy(counter); 2112 event->destroy(event);
2113 return ERR_PTR(err); 2113 return ERR_PTR(err);
2114 } 2114 }
2115 2115
@@ -2292,7 +2292,7 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
2292 return entry; 2292 return entry;
2293} 2293}
2294 2294
2295void hw_perf_counter_setup_online(int cpu) 2295void hw_perf_event_setup_online(int cpu)
2296{ 2296{
2297 init_debug_store_on_cpu(cpu); 2297 init_debug_store_on_cpu(cpu);
2298} 2298}
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 392bea43b890..fab786f60ed6 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -20,7 +20,7 @@
20#include <linux/kprobes.h> 20#include <linux/kprobes.h>
21 21
22#include <asm/apic.h> 22#include <asm/apic.h>
23#include <asm/perf_counter.h> 23#include <asm/perf_event.h>
24 24
25struct nmi_watchdog_ctlblk { 25struct nmi_watchdog_ctlblk {
26 unsigned int cccr_msr; 26 unsigned int cccr_msr;
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index a3210ce1eccd..85419bb7d4ab 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1331,7 +1331,7 @@ void __init e820_reserve_resources(void)
1331 struct resource *res; 1331 struct resource *res;
1332 u64 end; 1332 u64 end;
1333 1333
1334 res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map); 1334 res = alloc_bootmem(sizeof(struct resource) * e820.nr_map);
1335 e820_res = res; 1335 e820_res = res;
1336 for (i = 0; i < e820.nr_map; i++) { 1336 for (i = 0; i < e820.nr_map; i++) {
1337 end = e820.map[i].addr + e820.map[i].size - 1; 1337 end = e820.map[i].addr + e820.map[i].size - 1;
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index b11cab3c323a..2acfd3fdc0cc 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -160,721 +160,6 @@ static struct console early_serial_console = {
160 .index = -1, 160 .index = -1,
161}; 161};
162 162
163#ifdef CONFIG_EARLY_PRINTK_DBGP
164
165static struct ehci_caps __iomem *ehci_caps;
166static struct ehci_regs __iomem *ehci_regs;
167static struct ehci_dbg_port __iomem *ehci_debug;
168static unsigned int dbgp_endpoint_out;
169
170struct ehci_dev {
171 u32 bus;
172 u32 slot;
173 u32 func;
174};
175
176static struct ehci_dev ehci_dev;
177
178#define USB_DEBUG_DEVNUM 127
179
180#define DBGP_DATA_TOGGLE 0x8800
181
182static inline u32 dbgp_pid_update(u32 x, u32 tok)
183{
184 return ((x ^ DBGP_DATA_TOGGLE) & 0xffff00) | (tok & 0xff);
185}
186
187static inline u32 dbgp_len_update(u32 x, u32 len)
188{
189 return (x & ~0x0f) | (len & 0x0f);
190}
191
192/*
193 * USB Packet IDs (PIDs)
194 */
195
196/* token */
197#define USB_PID_OUT 0xe1
198#define USB_PID_IN 0x69
199#define USB_PID_SOF 0xa5
200#define USB_PID_SETUP 0x2d
201/* handshake */
202#define USB_PID_ACK 0xd2
203#define USB_PID_NAK 0x5a
204#define USB_PID_STALL 0x1e
205#define USB_PID_NYET 0x96
206/* data */
207#define USB_PID_DATA0 0xc3
208#define USB_PID_DATA1 0x4b
209#define USB_PID_DATA2 0x87
210#define USB_PID_MDATA 0x0f
211/* Special */
212#define USB_PID_PREAMBLE 0x3c
213#define USB_PID_ERR 0x3c
214#define USB_PID_SPLIT 0x78
215#define USB_PID_PING 0xb4
216#define USB_PID_UNDEF_0 0xf0
217
218#define USB_PID_DATA_TOGGLE 0x88
219#define DBGP_CLAIM (DBGP_OWNER | DBGP_ENABLED | DBGP_INUSE)
220
221#define PCI_CAP_ID_EHCI_DEBUG 0xa
222
223#define HUB_ROOT_RESET_TIME 50 /* times are in msec */
224#define HUB_SHORT_RESET_TIME 10
225#define HUB_LONG_RESET_TIME 200
226#define HUB_RESET_TIMEOUT 500
227
228#define DBGP_MAX_PACKET 8
229
230static int dbgp_wait_until_complete(void)
231{
232 u32 ctrl;
233 int loop = 0x100000;
234
235 do {
236 ctrl = readl(&ehci_debug->control);
237 /* Stop when the transaction is finished */
238 if (ctrl & DBGP_DONE)
239 break;
240 } while (--loop > 0);
241
242 if (!loop)
243 return -1;
244
245 /*
246 * Now that we have observed the completed transaction,
247 * clear the done bit.
248 */
249 writel(ctrl | DBGP_DONE, &ehci_debug->control);
250 return (ctrl & DBGP_ERROR) ? -DBGP_ERRCODE(ctrl) : DBGP_LEN(ctrl);
251}
252
253static void __init dbgp_mdelay(int ms)
254{
255 int i;
256
257 while (ms--) {
258 for (i = 0; i < 1000; i++)
259 outb(0x1, 0x80);
260 }
261}
262
263static void dbgp_breath(void)
264{
265 /* Sleep to give the debug port a chance to breathe */
266}
267
268static int dbgp_wait_until_done(unsigned ctrl)
269{
270 u32 pids, lpid;
271 int ret;
272 int loop = 3;
273
274retry:
275 writel(ctrl | DBGP_GO, &ehci_debug->control);
276 ret = dbgp_wait_until_complete();
277 pids = readl(&ehci_debug->pids);
278 lpid = DBGP_PID_GET(pids);
279
280 if (ret < 0)
281 return ret;
282
283 /*
284 * If the port is getting full or it has dropped data
285 * start pacing ourselves, not necessary but it's friendly.
286 */
287 if ((lpid == USB_PID_NAK) || (lpid == USB_PID_NYET))
288 dbgp_breath();
289
290 /* If I get a NACK reissue the transmission */
291 if (lpid == USB_PID_NAK) {
292 if (--loop > 0)
293 goto retry;
294 }
295
296 return ret;
297}
298
299static void dbgp_set_data(const void *buf, int size)
300{
301 const unsigned char *bytes = buf;
302 u32 lo, hi;
303 int i;
304
305 lo = hi = 0;
306 for (i = 0; i < 4 && i < size; i++)
307 lo |= bytes[i] << (8*i);
308 for (; i < 8 && i < size; i++)
309 hi |= bytes[i] << (8*(i - 4));
310 writel(lo, &ehci_debug->data03);
311 writel(hi, &ehci_debug->data47);
312}
313
314static void __init dbgp_get_data(void *buf, int size)
315{
316 unsigned char *bytes = buf;
317 u32 lo, hi;
318 int i;
319
320 lo = readl(&ehci_debug->data03);
321 hi = readl(&ehci_debug->data47);
322 for (i = 0; i < 4 && i < size; i++)
323 bytes[i] = (lo >> (8*i)) & 0xff;
324 for (; i < 8 && i < size; i++)
325 bytes[i] = (hi >> (8*(i - 4))) & 0xff;
326}
327
328static int dbgp_bulk_write(unsigned devnum, unsigned endpoint,
329 const char *bytes, int size)
330{
331 u32 pids, addr, ctrl;
332 int ret;
333
334 if (size > DBGP_MAX_PACKET)
335 return -1;
336
337 addr = DBGP_EPADDR(devnum, endpoint);
338
339 pids = readl(&ehci_debug->pids);
340 pids = dbgp_pid_update(pids, USB_PID_OUT);
341
342 ctrl = readl(&ehci_debug->control);
343 ctrl = dbgp_len_update(ctrl, size);
344 ctrl |= DBGP_OUT;
345 ctrl |= DBGP_GO;
346
347 dbgp_set_data(bytes, size);
348 writel(addr, &ehci_debug->address);
349 writel(pids, &ehci_debug->pids);
350
351 ret = dbgp_wait_until_done(ctrl);
352 if (ret < 0)
353 return ret;
354
355 return ret;
356}
357
358static int __init dbgp_bulk_read(unsigned devnum, unsigned endpoint, void *data,
359 int size)
360{
361 u32 pids, addr, ctrl;
362 int ret;
363
364 if (size > DBGP_MAX_PACKET)
365 return -1;
366
367 addr = DBGP_EPADDR(devnum, endpoint);
368
369 pids = readl(&ehci_debug->pids);
370 pids = dbgp_pid_update(pids, USB_PID_IN);
371
372 ctrl = readl(&ehci_debug->control);
373 ctrl = dbgp_len_update(ctrl, size);
374 ctrl &= ~DBGP_OUT;
375 ctrl |= DBGP_GO;
376
377 writel(addr, &ehci_debug->address);
378 writel(pids, &ehci_debug->pids);
379 ret = dbgp_wait_until_done(ctrl);
380 if (ret < 0)
381 return ret;
382
383 if (size > ret)
384 size = ret;
385 dbgp_get_data(data, size);
386 return ret;
387}
388
389static int __init dbgp_control_msg(unsigned devnum, int requesttype,
390 int request, int value, int index, void *data, int size)
391{
392 u32 pids, addr, ctrl;
393 struct usb_ctrlrequest req;
394 int read;
395 int ret;
396
397 read = (requesttype & USB_DIR_IN) != 0;
398 if (size > (read ? DBGP_MAX_PACKET:0))
399 return -1;
400
401 /* Compute the control message */
402 req.bRequestType = requesttype;
403 req.bRequest = request;
404 req.wValue = cpu_to_le16(value);
405 req.wIndex = cpu_to_le16(index);
406 req.wLength = cpu_to_le16(size);
407
408 pids = DBGP_PID_SET(USB_PID_DATA0, USB_PID_SETUP);
409 addr = DBGP_EPADDR(devnum, 0);
410
411 ctrl = readl(&ehci_debug->control);
412 ctrl = dbgp_len_update(ctrl, sizeof(req));
413 ctrl |= DBGP_OUT;
414 ctrl |= DBGP_GO;
415
416 /* Send the setup message */
417 dbgp_set_data(&req, sizeof(req));
418 writel(addr, &ehci_debug->address);
419 writel(pids, &ehci_debug->pids);
420 ret = dbgp_wait_until_done(ctrl);
421 if (ret < 0)
422 return ret;
423
424 /* Read the result */
425 return dbgp_bulk_read(devnum, 0, data, size);
426}
427
428
429/* Find a PCI capability */
430static u32 __init find_cap(u32 num, u32 slot, u32 func, int cap)
431{
432 u8 pos;
433 int bytes;
434
435 if (!(read_pci_config_16(num, slot, func, PCI_STATUS) &
436 PCI_STATUS_CAP_LIST))
437 return 0;
438
439 pos = read_pci_config_byte(num, slot, func, PCI_CAPABILITY_LIST);
440 for (bytes = 0; bytes < 48 && pos >= 0x40; bytes++) {
441 u8 id;
442
443 pos &= ~3;
444 id = read_pci_config_byte(num, slot, func, pos+PCI_CAP_LIST_ID);
445 if (id == 0xff)
446 break;
447 if (id == cap)
448 return pos;
449
450 pos = read_pci_config_byte(num, slot, func,
451 pos+PCI_CAP_LIST_NEXT);
452 }
453 return 0;
454}
455
456static u32 __init __find_dbgp(u32 bus, u32 slot, u32 func)
457{
458 u32 class;
459
460 class = read_pci_config(bus, slot, func, PCI_CLASS_REVISION);
461 if ((class >> 8) != PCI_CLASS_SERIAL_USB_EHCI)
462 return 0;
463
464 return find_cap(bus, slot, func, PCI_CAP_ID_EHCI_DEBUG);
465}
466
467static u32 __init find_dbgp(int ehci_num, u32 *rbus, u32 *rslot, u32 *rfunc)
468{
469 u32 bus, slot, func;
470
471 for (bus = 0; bus < 256; bus++) {
472 for (slot = 0; slot < 32; slot++) {
473 for (func = 0; func < 8; func++) {
474 unsigned cap;
475
476 cap = __find_dbgp(bus, slot, func);
477
478 if (!cap)
479 continue;
480 if (ehci_num-- != 0)
481 continue;
482 *rbus = bus;
483 *rslot = slot;
484 *rfunc = func;
485 return cap;
486 }
487 }
488 }
489 return 0;
490}
491
492static int __init ehci_reset_port(int port)
493{
494 u32 portsc;
495 u32 delay_time, delay;
496 int loop;
497
498 /* Reset the usb debug port */
499 portsc = readl(&ehci_regs->port_status[port - 1]);
500 portsc &= ~PORT_PE;
501 portsc |= PORT_RESET;
502 writel(portsc, &ehci_regs->port_status[port - 1]);
503
504 delay = HUB_ROOT_RESET_TIME;
505 for (delay_time = 0; delay_time < HUB_RESET_TIMEOUT;
506 delay_time += delay) {
507 dbgp_mdelay(delay);
508
509 portsc = readl(&ehci_regs->port_status[port - 1]);
510 if (portsc & PORT_RESET) {
511 /* force reset to complete */
512 loop = 2;
513 writel(portsc & ~(PORT_RWC_BITS | PORT_RESET),
514 &ehci_regs->port_status[port - 1]);
515 do {
516 portsc = readl(&ehci_regs->port_status[port-1]);
517 } while ((portsc & PORT_RESET) && (--loop > 0));
518 }
519
520 /* Device went away? */
521 if (!(portsc & PORT_CONNECT))
522 return -ENOTCONN;
523
524 /* bomb out completely if something weird happend */
525 if ((portsc & PORT_CSC))
526 return -EINVAL;
527
528 /* If we've finished resetting, then break out of the loop */
529 if (!(portsc & PORT_RESET) && (portsc & PORT_PE))
530 return 0;
531 }
532 return -EBUSY;
533}
534
535static int __init ehci_wait_for_port(int port)
536{
537 u32 status;
538 int ret, reps;
539
540 for (reps = 0; reps < 3; reps++) {
541 dbgp_mdelay(100);
542 status = readl(&ehci_regs->status);
543 if (status & STS_PCD) {
544 ret = ehci_reset_port(port);
545 if (ret == 0)
546 return 0;
547 }
548 }
549 return -ENOTCONN;
550}
551
552#ifdef DBGP_DEBUG
553# define dbgp_printk early_printk
554#else
555static inline void dbgp_printk(const char *fmt, ...) { }
556#endif
557
558typedef void (*set_debug_port_t)(int port);
559
560static void __init default_set_debug_port(int port)
561{
562}
563
564static set_debug_port_t __initdata set_debug_port = default_set_debug_port;
565
566static void __init nvidia_set_debug_port(int port)
567{
568 u32 dword;
569 dword = read_pci_config(ehci_dev.bus, ehci_dev.slot, ehci_dev.func,
570 0x74);
571 dword &= ~(0x0f<<12);
572 dword |= ((port & 0x0f)<<12);
573 write_pci_config(ehci_dev.bus, ehci_dev.slot, ehci_dev.func, 0x74,
574 dword);
575 dbgp_printk("set debug port to %d\n", port);
576}
577
578static void __init detect_set_debug_port(void)
579{
580 u32 vendorid;
581
582 vendorid = read_pci_config(ehci_dev.bus, ehci_dev.slot, ehci_dev.func,
583 0x00);
584
585 if ((vendorid & 0xffff) == 0x10de) {
586 dbgp_printk("using nvidia set_debug_port\n");
587 set_debug_port = nvidia_set_debug_port;
588 }
589}
590
591static int __init ehci_setup(void)
592{
593 struct usb_debug_descriptor dbgp_desc;
594 u32 cmd, ctrl, status, portsc, hcs_params;
595 u32 debug_port, new_debug_port = 0, n_ports;
596 u32 devnum;
597 int ret, i;
598 int loop;
599 int port_map_tried;
600 int playtimes = 3;
601
602try_next_time:
603 port_map_tried = 0;
604
605try_next_port:
606
607 hcs_params = readl(&ehci_caps->hcs_params);
608 debug_port = HCS_DEBUG_PORT(hcs_params);
609 n_ports = HCS_N_PORTS(hcs_params);
610
611 dbgp_printk("debug_port: %d\n", debug_port);
612 dbgp_printk("n_ports: %d\n", n_ports);
613
614 for (i = 1; i <= n_ports; i++) {
615 portsc = readl(&ehci_regs->port_status[i-1]);
616 dbgp_printk("portstatus%d: %08x\n", i, portsc);
617 }
618
619 if (port_map_tried && (new_debug_port != debug_port)) {
620 if (--playtimes) {
621 set_debug_port(new_debug_port);
622 goto try_next_time;
623 }
624 return -1;
625 }
626
627 loop = 100000;
628 /* Reset the EHCI controller */
629 cmd = readl(&ehci_regs->command);
630 cmd |= CMD_RESET;
631 writel(cmd, &ehci_regs->command);
632 do {
633 cmd = readl(&ehci_regs->command);
634 } while ((cmd & CMD_RESET) && (--loop > 0));
635
636 if (!loop) {
637 dbgp_printk("can not reset ehci\n");
638 return -1;
639 }
640 dbgp_printk("ehci reset done\n");
641
642 /* Claim ownership, but do not enable yet */
643 ctrl = readl(&ehci_debug->control);
644 ctrl |= DBGP_OWNER;
645 ctrl &= ~(DBGP_ENABLED | DBGP_INUSE);
646 writel(ctrl, &ehci_debug->control);
647
648 /* Start the ehci running */
649 cmd = readl(&ehci_regs->command);
650 cmd &= ~(CMD_LRESET | CMD_IAAD | CMD_PSE | CMD_ASE | CMD_RESET);
651 cmd |= CMD_RUN;
652 writel(cmd, &ehci_regs->command);
653
654 /* Ensure everything is routed to the EHCI */
655 writel(FLAG_CF, &ehci_regs->configured_flag);
656
657 /* Wait until the controller is no longer halted */
658 loop = 10;
659 do {
660 status = readl(&ehci_regs->status);
661 } while ((status & STS_HALT) && (--loop > 0));
662
663 if (!loop) {
664 dbgp_printk("ehci can be started\n");
665 return -1;
666 }
667 dbgp_printk("ehci started\n");
668
669 /* Wait for a device to show up in the debug port */
670 ret = ehci_wait_for_port(debug_port);
671 if (ret < 0) {
672 dbgp_printk("No device found in debug port\n");
673 goto next_debug_port;
674 }
675 dbgp_printk("ehci wait for port done\n");
676
677 /* Enable the debug port */
678 ctrl = readl(&ehci_debug->control);
679 ctrl |= DBGP_CLAIM;
680 writel(ctrl, &ehci_debug->control);
681 ctrl = readl(&ehci_debug->control);
682 if ((ctrl & DBGP_CLAIM) != DBGP_CLAIM) {
683 dbgp_printk("No device in debug port\n");
684 writel(ctrl & ~DBGP_CLAIM, &ehci_debug->control);
685 goto err;
686 }
687 dbgp_printk("debug ported enabled\n");
688
689 /* Completely transfer the debug device to the debug controller */
690 portsc = readl(&ehci_regs->port_status[debug_port - 1]);
691 portsc &= ~PORT_PE;
692 writel(portsc, &ehci_regs->port_status[debug_port - 1]);
693
694 dbgp_mdelay(100);
695
696 /* Find the debug device and make it device number 127 */
697 for (devnum = 0; devnum <= 127; devnum++) {
698 ret = dbgp_control_msg(devnum,
699 USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
700 USB_REQ_GET_DESCRIPTOR, (USB_DT_DEBUG << 8), 0,
701 &dbgp_desc, sizeof(dbgp_desc));
702 if (ret > 0)
703 break;
704 }
705 if (devnum > 127) {
706 dbgp_printk("Could not find attached debug device\n");
707 goto err;
708 }
709 if (ret < 0) {
710 dbgp_printk("Attached device is not a debug device\n");
711 goto err;
712 }
713 dbgp_endpoint_out = dbgp_desc.bDebugOutEndpoint;
714
715 /* Move the device to 127 if it isn't already there */
716 if (devnum != USB_DEBUG_DEVNUM) {
717 ret = dbgp_control_msg(devnum,
718 USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
719 USB_REQ_SET_ADDRESS, USB_DEBUG_DEVNUM, 0, NULL, 0);
720 if (ret < 0) {
721 dbgp_printk("Could not move attached device to %d\n",
722 USB_DEBUG_DEVNUM);
723 goto err;
724 }
725 devnum = USB_DEBUG_DEVNUM;
726 dbgp_printk("debug device renamed to 127\n");
727 }
728
729 /* Enable the debug interface */
730 ret = dbgp_control_msg(USB_DEBUG_DEVNUM,
731 USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
732 USB_REQ_SET_FEATURE, USB_DEVICE_DEBUG_MODE, 0, NULL, 0);
733 if (ret < 0) {
734 dbgp_printk(" Could not enable the debug device\n");
735 goto err;
736 }
737 dbgp_printk("debug interface enabled\n");
738
739 /* Perform a small write to get the even/odd data state in sync
740 */
741 ret = dbgp_bulk_write(USB_DEBUG_DEVNUM, dbgp_endpoint_out, " ", 1);
742 if (ret < 0) {
743 dbgp_printk("dbgp_bulk_write failed: %d\n", ret);
744 goto err;
745 }
746 dbgp_printk("small write doned\n");
747
748 return 0;
749err:
750 /* Things didn't work so remove my claim */
751 ctrl = readl(&ehci_debug->control);
752 ctrl &= ~(DBGP_CLAIM | DBGP_OUT);
753 writel(ctrl, &ehci_debug->control);
754 return -1;
755
756next_debug_port:
757 port_map_tried |= (1<<(debug_port - 1));
758 new_debug_port = ((debug_port-1+1)%n_ports) + 1;
759 if (port_map_tried != ((1<<n_ports) - 1)) {
760 set_debug_port(new_debug_port);
761 goto try_next_port;
762 }
763 if (--playtimes) {
764 set_debug_port(new_debug_port);
765 goto try_next_time;
766 }
767
768 return -1;
769}
770
771static int __init early_dbgp_init(char *s)
772{
773 u32 debug_port, bar, offset;
774 u32 bus, slot, func, cap;
775 void __iomem *ehci_bar;
776 u32 dbgp_num;
777 u32 bar_val;
778 char *e;
779 int ret;
780 u8 byte;
781
782 if (!early_pci_allowed())
783 return -1;
784
785 dbgp_num = 0;
786 if (*s)
787 dbgp_num = simple_strtoul(s, &e, 10);
788 dbgp_printk("dbgp_num: %d\n", dbgp_num);
789
790 cap = find_dbgp(dbgp_num, &bus, &slot, &func);
791 if (!cap)
792 return -1;
793
794 dbgp_printk("Found EHCI debug port on %02x:%02x.%1x\n", bus, slot,
795 func);
796
797 debug_port = read_pci_config(bus, slot, func, cap);
798 bar = (debug_port >> 29) & 0x7;
799 bar = (bar * 4) + 0xc;
800 offset = (debug_port >> 16) & 0xfff;
801 dbgp_printk("bar: %02x offset: %03x\n", bar, offset);
802 if (bar != PCI_BASE_ADDRESS_0) {
803 dbgp_printk("only debug ports on bar 1 handled.\n");
804
805 return -1;
806 }
807
808 bar_val = read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_0);
809 dbgp_printk("bar_val: %02x offset: %03x\n", bar_val, offset);
810 if (bar_val & ~PCI_BASE_ADDRESS_MEM_MASK) {
811 dbgp_printk("only simple 32bit mmio bars supported\n");
812
813 return -1;
814 }
815
816 /* double check if the mem space is enabled */
817 byte = read_pci_config_byte(bus, slot, func, 0x04);
818 if (!(byte & 0x2)) {
819 byte |= 0x02;
820 write_pci_config_byte(bus, slot, func, 0x04, byte);
821 dbgp_printk("mmio for ehci enabled\n");
822 }
823
824 /*
825 * FIXME I don't have the bar size so just guess PAGE_SIZE is more
826 * than enough. 1K is the biggest I have seen.
827 */
828 set_fixmap_nocache(FIX_DBGP_BASE, bar_val & PAGE_MASK);
829 ehci_bar = (void __iomem *)__fix_to_virt(FIX_DBGP_BASE);
830 ehci_bar += bar_val & ~PAGE_MASK;
831 dbgp_printk("ehci_bar: %p\n", ehci_bar);
832
833 ehci_caps = ehci_bar;
834 ehci_regs = ehci_bar + HC_LENGTH(readl(&ehci_caps->hc_capbase));
835 ehci_debug = ehci_bar + offset;
836 ehci_dev.bus = bus;
837 ehci_dev.slot = slot;
838 ehci_dev.func = func;
839
840 detect_set_debug_port();
841
842 ret = ehci_setup();
843 if (ret < 0) {
844 dbgp_printk("ehci_setup failed\n");
845 ehci_debug = NULL;
846
847 return -1;
848 }
849
850 return 0;
851}
852
853static void early_dbgp_write(struct console *con, const char *str, u32 n)
854{
855 int chunk, ret;
856
857 if (!ehci_debug)
858 return;
859 while (n > 0) {
860 chunk = n;
861 if (chunk > DBGP_MAX_PACKET)
862 chunk = DBGP_MAX_PACKET;
863 ret = dbgp_bulk_write(USB_DEBUG_DEVNUM,
864 dbgp_endpoint_out, str, chunk);
865 str += chunk;
866 n -= chunk;
867 }
868}
869
870static struct console early_dbgp_console = {
871 .name = "earlydbg",
872 .write = early_dbgp_write,
873 .flags = CON_PRINTBUFFER,
874 .index = -1,
875};
876#endif
877
878/* Direct interface for emergencies */ 163/* Direct interface for emergencies */
879static struct console *early_console = &early_vga_console; 164static struct console *early_console = &early_vga_console;
880static int __initdata early_console_initialized; 165static int __initdata early_console_initialized;
@@ -891,10 +176,19 @@ asmlinkage void early_printk(const char *fmt, ...)
891 va_end(ap); 176 va_end(ap);
892} 177}
893 178
179static inline void early_console_register(struct console *con, int keep_early)
180{
181 early_console = con;
182 if (keep_early)
183 early_console->flags &= ~CON_BOOT;
184 else
185 early_console->flags |= CON_BOOT;
186 register_console(early_console);
187}
894 188
895static int __init setup_early_printk(char *buf) 189static int __init setup_early_printk(char *buf)
896{ 190{
897 int keep_early; 191 int keep;
898 192
899 if (!buf) 193 if (!buf)
900 return 0; 194 return 0;
@@ -903,42 +197,34 @@ static int __init setup_early_printk(char *buf)
903 return 0; 197 return 0;
904 early_console_initialized = 1; 198 early_console_initialized = 1;
905 199
906 keep_early = (strstr(buf, "keep") != NULL); 200 keep = (strstr(buf, "keep") != NULL);
907 201
908 if (!strncmp(buf, "serial", 6)) { 202 while (*buf != '\0') {
909 early_serial_init(buf + 6); 203 if (!strncmp(buf, "serial", 6)) {
910 early_console = &early_serial_console; 204 early_serial_init(buf + 6);
911 } else if (!strncmp(buf, "ttyS", 4)) { 205 early_console_register(&early_serial_console, keep);
912 early_serial_init(buf); 206 }
913 early_console = &early_serial_console; 207 if (!strncmp(buf, "ttyS", 4)) {
914 } else if (!strncmp(buf, "vga", 3) 208 early_serial_init(buf + 4);
915 && boot_params.screen_info.orig_video_isVGA == 1) { 209 early_console_register(&early_serial_console, keep);
916 max_xpos = boot_params.screen_info.orig_video_cols; 210 }
917 max_ypos = boot_params.screen_info.orig_video_lines; 211 if (!strncmp(buf, "vga", 3) &&
918 current_ypos = boot_params.screen_info.orig_y; 212 boot_params.screen_info.orig_video_isVGA == 1) {
919 early_console = &early_vga_console; 213 max_xpos = boot_params.screen_info.orig_video_cols;
214 max_ypos = boot_params.screen_info.orig_video_lines;
215 current_ypos = boot_params.screen_info.orig_y;
216 early_console_register(&early_vga_console, keep);
217 }
920#ifdef CONFIG_EARLY_PRINTK_DBGP 218#ifdef CONFIG_EARLY_PRINTK_DBGP
921 } else if (!strncmp(buf, "dbgp", 4)) { 219 if (!strncmp(buf, "dbgp", 4) && !early_dbgp_init(buf + 4))
922 if (early_dbgp_init(buf+4) < 0) 220 early_console_register(&early_dbgp_console, keep);
923 return 0;
924 early_console = &early_dbgp_console;
925 /*
926 * usb subsys will reset ehci controller, so don't keep
927 * that early console
928 */
929 keep_early = 0;
930#endif 221#endif
931#ifdef CONFIG_HVC_XEN 222#ifdef CONFIG_HVC_XEN
932 } else if (!strncmp(buf, "xen", 3)) { 223 if (!strncmp(buf, "xen", 3))
933 early_console = &xenboot_console; 224 early_console_register(&xenboot_console, keep);
934#endif 225#endif
226 buf++;
935 } 227 }
936
937 if (keep_early)
938 early_console->flags &= ~CON_BOOT;
939 else
940 early_console->flags |= CON_BOOT;
941 register_console(early_console);
942 return 0; 228 return 0;
943} 229}
944 230
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index d59fe323807e..b5c061f8f358 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -536,20 +536,13 @@ sysret_signal:
536 bt $TIF_SYSCALL_AUDIT,%edx 536 bt $TIF_SYSCALL_AUDIT,%edx
537 jc sysret_audit 537 jc sysret_audit
538#endif 538#endif
539 /* edx: work flags (arg3) */ 539 /*
540 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1 540 * We have a signal, or exit tracing or single-step.
541 xorl %esi,%esi # oldset -> arg2 541 * These all wind up with the iret return path anyway,
542 SAVE_REST 542 * so just join that path right now.
543 FIXUP_TOP_OF_STACK %r11 543 */
544 call do_notify_resume 544 FIXUP_TOP_OF_STACK %r11, -ARGOFFSET
545 RESTORE_TOP_OF_STACK %r11 545 jmp int_check_syscall_exit_work
546 RESTORE_REST
547 movl $_TIF_WORK_MASK,%edi
548 /* Use IRET because user could have changed frame. This
549 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
550 DISABLE_INTERRUPTS(CLBR_NONE)
551 TRACE_IRQS_OFF
552 jmp int_with_check
553 546
554badsys: 547badsys:
555 movq $-ENOSYS,RAX-ARGOFFSET(%rsp) 548 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
@@ -654,6 +647,7 @@ int_careful:
654int_very_careful: 647int_very_careful:
655 TRACE_IRQS_ON 648 TRACE_IRQS_ON
656 ENABLE_INTERRUPTS(CLBR_NONE) 649 ENABLE_INTERRUPTS(CLBR_NONE)
650int_check_syscall_exit_work:
657 SAVE_REST 651 SAVE_REST
658 /* Check for syscall exit trace */ 652 /* Check for syscall exit trace */
659 testl $_TIF_WORK_SYSCALL_EXIT,%edx 653 testl $_TIF_WORK_SYSCALL_EXIT,%edx
@@ -1021,7 +1015,7 @@ apicinterrupt ERROR_APIC_VECTOR \
1021apicinterrupt SPURIOUS_APIC_VECTOR \ 1015apicinterrupt SPURIOUS_APIC_VECTOR \
1022 spurious_interrupt smp_spurious_interrupt 1016 spurious_interrupt smp_spurious_interrupt
1023 1017
1024#ifdef CONFIG_PERF_COUNTERS 1018#ifdef CONFIG_PERF_EVENTS
1025apicinterrupt LOCAL_PENDING_VECTOR \ 1019apicinterrupt LOCAL_PENDING_VECTOR \
1026 perf_pending_interrupt smp_perf_pending_interrupt 1020 perf_pending_interrupt smp_perf_pending_interrupt
1027#endif 1021#endif
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 300883112e3d..40f30773fb29 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -208,7 +208,7 @@ static void __init apic_intr_init(void)
208 alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt); 208 alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
209 209
210 /* Performance monitoring interrupts: */ 210 /* Performance monitoring interrupts: */
211# ifdef CONFIG_PERF_COUNTERS 211# ifdef CONFIG_PERF_EVENTS
212 alloc_intr_gate(LOCAL_PENDING_VECTOR, perf_pending_interrupt); 212 alloc_intr_gate(LOCAL_PENDING_VECTOR, perf_pending_interrupt);
213# endif 213# endif
214 214
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 0db7969b0dde..378e9a8f1bf8 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -210,8 +210,8 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
210{ 210{
211 ssize_t ret = -EINVAL; 211 ssize_t ret = -EINVAL;
212 212
213 if ((len >> PAGE_SHIFT) > num_physpages) { 213 if ((len >> PAGE_SHIFT) > totalram_pages) {
214 pr_err("microcode: too much data (max %ld pages)\n", num_physpages); 214 pr_err("microcode: too much data (max %ld pages)\n", totalram_pages);
215 return ret; 215 return ret;
216 } 216 }
217 217
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index e8a35016115f..aaa6b7839f1e 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -46,9 +46,8 @@ void __init pci_swiotlb_init(void)
46{ 46{
47 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 47 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
48#ifdef CONFIG_X86_64 48#ifdef CONFIG_X86_64
49 if ((!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) || 49 if ((!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN))
50 iommu_pass_through) 50 swiotlb = 1;
51 swiotlb = 1;
52#endif 51#endif
53 if (swiotlb_force) 52 if (swiotlb_force)
54 swiotlb = 1; 53 swiotlb = 1;
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 8d7d5c9c1be3..7b058a2dc66a 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -325,16 +325,6 @@ static int putreg(struct task_struct *child,
325 return set_flags(child, value); 325 return set_flags(child, value);
326 326
327#ifdef CONFIG_X86_64 327#ifdef CONFIG_X86_64
328 /*
329 * Orig_ax is really just a flag with small positive and
330 * negative values, so make sure to always sign-extend it
331 * from 32 bits so that it works correctly regardless of
332 * whether we come from a 32-bit environment or not.
333 */
334 case offsetof(struct user_regs_struct, orig_ax):
335 value = (long) (s32) value;
336 break;
337
338 case offsetof(struct user_regs_struct,fs_base): 328 case offsetof(struct user_regs_struct,fs_base):
339 if (value >= TASK_SIZE_OF(child)) 329 if (value >= TASK_SIZE_OF(child))
340 return -EIO; 330 return -EIO;
@@ -1126,10 +1116,15 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 value)
1126 1116
1127 case offsetof(struct user32, regs.orig_eax): 1117 case offsetof(struct user32, regs.orig_eax):
1128 /* 1118 /*
1129 * Sign-extend the value so that orig_eax = -1 1119 * A 32-bit debugger setting orig_eax means to restore
1130 * causes (long)orig_ax < 0 tests to fire correctly. 1120 * the state of the task restarting a 32-bit syscall.
1121 * Make sure we interpret the -ERESTART* codes correctly
1122 * in case the task is not actually still sitting at the
1123 * exit from a 32-bit syscall with TS_COMPAT still set.
1131 */ 1124 */
1132 regs->orig_ax = (long) (s32) value; 1125 regs->orig_ax = value;
1126 if (syscall_get_nr(child, regs) >= 0)
1127 task_thread_info(child)->status |= TS_COMPAT;
1133 break; 1128 break;
1134 1129
1135 case offsetof(struct user32, regs.eflags): 1130 case offsetof(struct user32, regs.eflags):
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f327bccf5089..e09f0e2c14b5 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -27,6 +27,7 @@
27#include <linux/screen_info.h> 27#include <linux/screen_info.h>
28#include <linux/ioport.h> 28#include <linux/ioport.h>
29#include <linux/acpi.h> 29#include <linux/acpi.h>
30#include <linux/sfi.h>
30#include <linux/apm_bios.h> 31#include <linux/apm_bios.h>
31#include <linux/initrd.h> 32#include <linux/initrd.h>
32#include <linux/bootmem.h> 33#include <linux/bootmem.h>
@@ -985,6 +986,8 @@ void __init setup_arch(char **cmdline_p)
985 */ 986 */
986 acpi_boot_init(); 987 acpi_boot_init();
987 988
989 sfi_init();
990
988 /* 991 /*
989 * get boot-time SMP configuration: 992 * get boot-time SMP configuration:
990 */ 993 */
diff --git a/arch/x86/kernel/sfi.c b/arch/x86/kernel/sfi.c
new file mode 100644
index 000000000000..34e099382651
--- /dev/null
+++ b/arch/x86/kernel/sfi.c
@@ -0,0 +1,122 @@
1/*
2 * sfi.c - x86 architecture SFI support.
3 *
4 * Copyright (c) 2009, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#define KMSG_COMPONENT "SFI"
22#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
23
24#include <linux/acpi.h>
25#include <linux/init.h>
26#include <linux/sfi.h>
27#include <linux/io.h>
28
29#include <asm/io_apic.h>
30#include <asm/mpspec.h>
31#include <asm/setup.h>
32#include <asm/apic.h>
33
34#ifdef CONFIG_X86_LOCAL_APIC
35static unsigned long sfi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
36
37void __init mp_sfi_register_lapic_address(unsigned long address)
38{
39 mp_lapic_addr = address;
40
41 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
42 if (boot_cpu_physical_apicid == -1U)
43 boot_cpu_physical_apicid = read_apic_id();
44
45 pr_info("Boot CPU = %d\n", boot_cpu_physical_apicid);
46}
47
48/* All CPUs enumerated by SFI must be present and enabled */
49void __cpuinit mp_sfi_register_lapic(u8 id)
50{
51 if (MAX_APICS - id <= 0) {
52 pr_warning("Processor #%d invalid (max %d)\n",
53 id, MAX_APICS);
54 return;
55 }
56
57 pr_info("registering lapic[%d]\n", id);
58
59 generic_processor_info(id, GET_APIC_VERSION(apic_read(APIC_LVR)));
60}
61
62static int __init sfi_parse_cpus(struct sfi_table_header *table)
63{
64 struct sfi_table_simple *sb;
65 struct sfi_cpu_table_entry *pentry;
66 int i;
67 int cpu_num;
68
69 sb = (struct sfi_table_simple *)table;
70 cpu_num = SFI_GET_NUM_ENTRIES(sb, struct sfi_cpu_table_entry);
71 pentry = (struct sfi_cpu_table_entry *)sb->pentry;
72
73 for (i = 0; i < cpu_num; i++) {
74 mp_sfi_register_lapic(pentry->apic_id);
75 pentry++;
76 }
77
78 smp_found_config = 1;
79 return 0;
80}
81#endif /* CONFIG_X86_LOCAL_APIC */
82
83#ifdef CONFIG_X86_IO_APIC
84static u32 gsi_base;
85
86static int __init sfi_parse_ioapic(struct sfi_table_header *table)
87{
88 struct sfi_table_simple *sb;
89 struct sfi_apic_table_entry *pentry;
90 int i, num;
91
92 sb = (struct sfi_table_simple *)table;
93 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry);
94 pentry = (struct sfi_apic_table_entry *)sb->pentry;
95
96 for (i = 0; i < num; i++) {
97 mp_register_ioapic(i, pentry->phys_addr, gsi_base);
98 gsi_base += io_apic_get_redir_entries(i);
99 pentry++;
100 }
101
102 WARN(pic_mode, KERN_WARNING
103 "SFI: pic_mod shouldn't be 1 when IOAPIC table is present\n");
104 pic_mode = 0;
105 return 0;
106}
107#endif /* CONFIG_X86_IO_APIC */
108
109/*
110 * sfi_platform_init(): register lapics & io-apics
111 */
112int __init sfi_platform_init(void)
113{
114#ifdef CONFIG_X86_LOCAL_APIC
115 mp_sfi_register_lapic_address(sfi_lapic_addr);
116 sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus);
117#endif
118#ifdef CONFIG_X86_IO_APIC
119 sfi_table_parse(SFI_SIG_APIC, NULL, NULL, sfi_parse_ioapic);
120#endif
121 return 0;
122}
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index d51321ddafda..0157cd26d7cc 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -335,4 +335,4 @@ ENTRY(sys_call_table)
335 .long sys_preadv 335 .long sys_preadv
336 .long sys_pwritev 336 .long sys_pwritev
337 .long sys_rt_tgsigqueueinfo /* 335 */ 337 .long sys_rt_tgsigqueueinfo /* 335 */
338 .long sys_perf_counter_open 338 .long sys_perf_event_open
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 4cb7d5d18b8e..7e59dc1d3fc2 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1135,11 +1135,6 @@ static struct notifier_block paniced = {
1135/* Setting up memory is fairly easy. */ 1135/* Setting up memory is fairly easy. */
1136static __init char *lguest_memory_setup(void) 1136static __init char *lguest_memory_setup(void)
1137{ 1137{
1138 /* We do this here and not earlier because lockcheck used to barf if we
1139 * did it before start_kernel(). I think we fixed that, so it'd be
1140 * nice to move it back to lguest_init. Patch welcome... */
1141 atomic_notifier_chain_register(&panic_notifier_list, &paniced);
1142
1143 /* 1138 /*
1144 *The Linux bootloader header contains an "e820" memory map: the 1139 *The Linux bootloader header contains an "e820" memory map: the
1145 * Launcher populated the first entry with our memory limit. 1140 * Launcher populated the first entry with our memory limit.
@@ -1364,10 +1359,13 @@ __init void lguest_init(void)
1364 1359
1365 /* 1360 /*
1366 * If we don't initialize the lock dependency checker now, it crashes 1361 * If we don't initialize the lock dependency checker now, it crashes
1367 * paravirt_disable_iospace. 1362 * atomic_notifier_chain_register, then paravirt_disable_iospace.
1368 */ 1363 */
1369 lockdep_init(); 1364 lockdep_init();
1370 1365
1366 /* Hook in our special panic hypercall code. */
1367 atomic_notifier_chain_register(&panic_notifier_list, &paniced);
1368
1371 /* 1369 /*
1372 * The IDE code spends about 3 seconds probing for disks: if we reserve 1370 * The IDE code spends about 3 seconds probing for disks: if we reserve
1373 * all the I/O ports up front it can't get them and so doesn't probe. 1371 * all the I/O ports up front it can't get them and so doesn't probe.
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 775a020990a5..82728f2c6d55 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -10,7 +10,7 @@
10#include <linux/bootmem.h> /* max_low_pfn */ 10#include <linux/bootmem.h> /* max_low_pfn */
11#include <linux/kprobes.h> /* __kprobes, ... */ 11#include <linux/kprobes.h> /* __kprobes, ... */
12#include <linux/mmiotrace.h> /* kmmio_handler, ... */ 12#include <linux/mmiotrace.h> /* kmmio_handler, ... */
13#include <linux/perf_counter.h> /* perf_swcounter_event */ 13#include <linux/perf_event.h> /* perf_sw_event */
14 14
15#include <asm/traps.h> /* dotraplinkage, ... */ 15#include <asm/traps.h> /* dotraplinkage, ... */
16#include <asm/pgalloc.h> /* pgd_*(), ... */ 16#include <asm/pgalloc.h> /* pgd_*(), ... */
@@ -1017,7 +1017,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
1017 if (unlikely(error_code & PF_RSVD)) 1017 if (unlikely(error_code & PF_RSVD))
1018 pgtable_bad(regs, error_code, address); 1018 pgtable_bad(regs, error_code, address);
1019 1019
1020 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 1020 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
1021 1021
1022 /* 1022 /*
1023 * If we're in an interrupt, have no user context or are running 1023 * If we're in an interrupt, have no user context or are running
@@ -1114,11 +1114,11 @@ good_area:
1114 1114
1115 if (fault & VM_FAULT_MAJOR) { 1115 if (fault & VM_FAULT_MAJOR) {
1116 tsk->maj_flt++; 1116 tsk->maj_flt++;
1117 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 1117 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
1118 regs, address); 1118 regs, address);
1119 } else { 1119 } else {
1120 tsk->min_flt++; 1120 tsk->min_flt++;
1121 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 1121 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
1122 regs, address); 1122 regs, address);
1123 } 1123 }
1124 1124
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 3cd7711bb949..30938c1d8d5d 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -84,7 +84,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
84#ifdef CONFIG_X86_PAE 84#ifdef CONFIG_X86_PAE
85 if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { 85 if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
86 if (after_bootmem) 86 if (after_bootmem)
87 pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); 87 pmd_table = (pmd_t *)alloc_bootmem_pages(PAGE_SIZE);
88 else 88 else
89 pmd_table = (pmd_t *)alloc_low_page(); 89 pmd_table = (pmd_t *)alloc_low_page();
90 paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); 90 paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
@@ -116,7 +116,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)
116#endif 116#endif
117 if (!page_table) 117 if (!page_table)
118 page_table = 118 page_table =
119 (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); 119 (pte_t *)alloc_bootmem_pages(PAGE_SIZE);
120 } else 120 } else
121 page_table = (pte_t *)alloc_low_page(); 121 page_table = (pte_t *)alloc_low_page();
122 122
@@ -857,8 +857,6 @@ static void __init test_wp_bit(void)
857 } 857 }
858} 858}
859 859
860static struct kcore_list kcore_mem, kcore_vmalloc;
861
862void __init mem_init(void) 860void __init mem_init(void)
863{ 861{
864 int codesize, reservedpages, datasize, initsize; 862 int codesize, reservedpages, datasize, initsize;
@@ -886,13 +884,9 @@ void __init mem_init(void)
886 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 884 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
887 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 885 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
888 886
889 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
890 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
891 VMALLOC_END-VMALLOC_START);
892
893 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " 887 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
894 "%dk reserved, %dk data, %dk init, %ldk highmem)\n", 888 "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
895 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 889 nr_free_pages() << (PAGE_SHIFT-10),
896 num_physpages << (PAGE_SHIFT-10), 890 num_physpages << (PAGE_SHIFT-10),
897 codesize >> 10, 891 codesize >> 10,
898 reservedpages << (PAGE_SHIFT-10), 892 reservedpages << (PAGE_SHIFT-10),
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ea56b8cbb6a6..5a4398a6006b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -647,8 +647,7 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
647 647
648#endif /* CONFIG_MEMORY_HOTPLUG */ 648#endif /* CONFIG_MEMORY_HOTPLUG */
649 649
650static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, 650static struct kcore_list kcore_vsyscall;
651 kcore_modules, kcore_vsyscall;
652 651
653void __init mem_init(void) 652void __init mem_init(void)
654{ 653{
@@ -677,17 +676,12 @@ void __init mem_init(void)
677 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 676 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
678 677
679 /* Register memory areas for /proc/kcore */ 678 /* Register memory areas for /proc/kcore */
680 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
681 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
682 VMALLOC_END-VMALLOC_START);
683 kclist_add(&kcore_kernel, &_stext, _end - _stext);
684 kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN);
685 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 679 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
686 VSYSCALL_END - VSYSCALL_START); 680 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
687 681
688 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 682 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
689 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n", 683 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
690 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 684 nr_free_pages() << (PAGE_SHIFT-10),
691 max_pfn << (PAGE_SHIFT-10), 685 max_pfn << (PAGE_SHIFT-10),
692 codesize >> 10, 686 codesize >> 10,
693 absent_pages << (PAGE_SHIFT-10), 687 absent_pages << (PAGE_SHIFT-10),
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index 528bf954eb74..8cc183344140 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -225,9 +225,6 @@ void kmemcheck_hide(struct pt_regs *regs)
225 225
226 BUG_ON(!irqs_disabled()); 226 BUG_ON(!irqs_disabled());
227 227
228 if (data->balance == 0)
229 return;
230
231 if (unlikely(data->balance != 1)) { 228 if (unlikely(data->balance != 1)) {
232 kmemcheck_show_all(); 229 kmemcheck_show_all();
233 kmemcheck_error_save_bug(regs); 230 kmemcheck_error_save_bug(regs);
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 4899215999de..8eb05878554c 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -234,11 +234,11 @@ static void arch_perfmon_setup_counters(void)
234 if (eax.split.version_id == 0 && current_cpu_data.x86 == 6 && 234 if (eax.split.version_id == 0 && current_cpu_data.x86 == 6 &&
235 current_cpu_data.x86_model == 15) { 235 current_cpu_data.x86_model == 15) {
236 eax.split.version_id = 2; 236 eax.split.version_id = 2;
237 eax.split.num_counters = 2; 237 eax.split.num_events = 2;
238 eax.split.bit_width = 40; 238 eax.split.bit_width = 40;
239 } 239 }
240 240
241 num_counters = eax.split.num_counters; 241 num_counters = eax.split.num_events;
242 242
243 op_arch_perfmon_spec.num_counters = num_counters; 243 op_arch_perfmon_spec.num_counters = num_counters;
244 op_arch_perfmon_spec.num_controls = num_counters; 244 op_arch_perfmon_spec.num_controls = num_counters;
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h
index b83776180c7f..7b8e75d16081 100644
--- a/arch/x86/oprofile/op_x86_model.h
+++ b/arch/x86/oprofile/op_x86_model.h
@@ -13,7 +13,7 @@
13#define OP_X86_MODEL_H 13#define OP_X86_MODEL_H
14 14
15#include <asm/types.h> 15#include <asm/types.h>
16#include <asm/perf_counter.h> 16#include <asm/perf_event.h>
17 17
18struct op_msr { 18struct op_msr {
19 unsigned long addr; 19 unsigned long addr;
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 712443ec6d43..602c172d3bd5 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -13,10 +13,14 @@
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/acpi.h> 15#include <linux/acpi.h>
16#include <linux/sfi_acpi.h>
16#include <linux/bitmap.h> 17#include <linux/bitmap.h>
17#include <linux/sort.h> 18#include <linux/sort.h>
18#include <asm/e820.h> 19#include <asm/e820.h>
19#include <asm/pci_x86.h> 20#include <asm/pci_x86.h>
21#include <asm/acpi.h>
22
23#define PREFIX "PCI: "
20 24
21/* aperture is up to 256MB but BIOS may reserve less */ 25/* aperture is up to 256MB but BIOS may reserve less */
22#define MMCONFIG_APER_MIN (2 * 1024*1024) 26#define MMCONFIG_APER_MIN (2 * 1024*1024)
@@ -491,7 +495,7 @@ static void __init pci_mmcfg_reject_broken(int early)
491 (unsigned int)cfg->start_bus_number, 495 (unsigned int)cfg->start_bus_number,
492 (unsigned int)cfg->end_bus_number); 496 (unsigned int)cfg->end_bus_number);
493 497
494 if (!early) 498 if (!early && !acpi_disabled)
495 valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0); 499 valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0);
496 500
497 if (valid) 501 if (valid)
@@ -606,7 +610,7 @@ static void __init __pci_mmcfg_init(int early)
606 } 610 }
607 611
608 if (!known_bridge) 612 if (!known_bridge)
609 acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); 613 acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
610 614
611 pci_mmcfg_reject_broken(early); 615 pci_mmcfg_reject_broken(early);
612 616
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
index 8b2d561046a3..f10a7e94a84c 100644
--- a/arch/x86/pci/mmconfig_32.c
+++ b/arch/x86/pci/mmconfig_32.c
@@ -11,9 +11,9 @@
11 11
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/acpi.h>
15#include <asm/e820.h> 14#include <asm/e820.h>
16#include <asm/pci_x86.h> 15#include <asm/pci_x86.h>
16#include <acpi/acpi.h>
17 17
18/* Assume systems with more busses have correct MCFG */ 18/* Assume systems with more busses have correct MCFG */
19#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) 19#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/asm/mman.h
index 9b92620c8a1e..fca4db425f6e 100644
--- a/arch/xtensa/include/asm/mman.h
+++ b/arch/xtensa/include/asm/mman.h
@@ -53,6 +53,8 @@
53#define MAP_LOCKED 0x8000 /* pages are locked */ 53#define MAP_LOCKED 0x8000 /* pages are locked */
54#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 54#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
55#define MAP_NONBLOCK 0x20000 /* do not block on IO */ 55#define MAP_NONBLOCK 0x20000 /* do not block on IO */
56#define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */
57#define MAP_HUGETLB 0x80000 /* create a huge page mapping */
56 58
57/* 59/*
58 * Flags for msync 60 * Flags for msync
@@ -78,6 +80,9 @@
78#define MADV_DONTFORK 10 /* don't inherit across fork */ 80#define MADV_DONTFORK 10 /* don't inherit across fork */
79#define MADV_DOFORK 11 /* do inherit across fork */ 81#define MADV_DOFORK 11 /* do inherit across fork */
80 82
83#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
84#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
85
81/* compatibility flags */ 86/* compatibility flags */
82#define MAP_FILE 0 87#define MAP_FILE 0
83 88
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 427e14fa43c5..cdbc27ca9665 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -203,7 +203,7 @@ void __init mem_init(void)
203 203
204 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, " 204 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, "
205 "%ldk data, %ldk init %ldk highmem)\n", 205 "%ldk data, %ldk init %ldk highmem)\n",
206 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 206 nr_free_pages() << (PAGE_SHIFT-10),
207 ram << (PAGE_SHIFT-10), 207 ram << (PAGE_SHIFT-10),
208 codesize >> 10, 208 codesize >> 10,
209 reservedpages << (PAGE_SHIFT-10), 209 reservedpages << (PAGE_SHIFT-10),