Commit f0218b3e authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

Merge branch 'perf/core' of...

Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-6

Conflicts:
	include/trace/ftrace.h
	kernel/trace/trace_kprobe.c
Acked-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parents 1eaa4787 9d192e11
...@@ -107,10 +107,6 @@ void (*dev_config) (struct ata_port *, struct ata_device *); ...@@ -107,10 +107,6 @@ void (*dev_config) (struct ata_port *, struct ata_device *);
issue of SET FEATURES - XFER MODE, and prior to operation. issue of SET FEATURES - XFER MODE, and prior to operation.
</para> </para>
<para> <para>
Called by ata_device_add() after ata_dev_identify() determines
a device is present.
</para>
<para>
This entry may be specified as NULL in ata_port_operations. This entry may be specified as NULL in ata_port_operations.
</para> </para>
...@@ -154,8 +150,8 @@ unsigned int (*mode_filter) (struct ata_port *, struct ata_device *, unsigned in ...@@ -154,8 +150,8 @@ unsigned int (*mode_filter) (struct ata_port *, struct ata_device *, unsigned in
<sect2><title>Taskfile read/write</title> <sect2><title>Taskfile read/write</title>
<programlisting> <programlisting>
void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf); void (*sff_tf_load) (struct ata_port *ap, struct ata_taskfile *tf);
void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); void (*sff_tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
</programlisting> </programlisting>
<para> <para>
...@@ -164,36 +160,35 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); ...@@ -164,36 +160,35 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
hardware registers / DMA buffers, to obtain the current set of hardware registers / DMA buffers, to obtain the current set of
taskfile register values. taskfile register values.
Most drivers for taskfile-based hardware (PIO or MMIO) use Most drivers for taskfile-based hardware (PIO or MMIO) use
ata_tf_load() and ata_tf_read() for these hooks. ata_sff_tf_load() and ata_sff_tf_read() for these hooks.
</para> </para>
</sect2> </sect2>
<sect2><title>PIO data read/write</title> <sect2><title>PIO data read/write</title>
<programlisting> <programlisting>
void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); void (*sff_data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
</programlisting> </programlisting>
<para> <para>
All bmdma-style drivers must implement this hook. This is the low-level All bmdma-style drivers must implement this hook. This is the low-level
operation that actually copies the data bytes during a PIO data operation that actually copies the data bytes during a PIO data
transfer. transfer.
Typically the driver Typically the driver will choose one of ata_sff_data_xfer_noirq(),
will choose one of ata_pio_data_xfer_noirq(), ata_pio_data_xfer(), or ata_sff_data_xfer(), or ata_sff_data_xfer32().
ata_mmio_data_xfer().
</para> </para>
</sect2> </sect2>
<sect2><title>ATA command execute</title> <sect2><title>ATA command execute</title>
<programlisting> <programlisting>
void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); void (*sff_exec_command)(struct ata_port *ap, struct ata_taskfile *tf);
</programlisting> </programlisting>
<para> <para>
causes an ATA command, previously loaded with causes an ATA command, previously loaded with
->tf_load(), to be initiated in hardware. ->tf_load(), to be initiated in hardware.
Most drivers for taskfile-based hardware use ata_exec_command() Most drivers for taskfile-based hardware use ata_sff_exec_command()
for this hook. for this hook.
</para> </para>
...@@ -218,8 +213,8 @@ command. ...@@ -218,8 +213,8 @@ command.
<sect2><title>Read specific ATA shadow registers</title> <sect2><title>Read specific ATA shadow registers</title>
<programlisting> <programlisting>
u8 (*check_status)(struct ata_port *ap); u8 (*sff_check_status)(struct ata_port *ap);
u8 (*check_altstatus)(struct ata_port *ap); u8 (*sff_check_altstatus)(struct ata_port *ap);
</programlisting> </programlisting>
<para> <para>
...@@ -227,20 +222,14 @@ u8 (*check_altstatus)(struct ata_port *ap); ...@@ -227,20 +222,14 @@ u8 (*check_altstatus)(struct ata_port *ap);
hardware. On some hardware, reading the Status register has hardware. On some hardware, reading the Status register has
the side effect of clearing the interrupt condition. the side effect of clearing the interrupt condition.
Most drivers for taskfile-based hardware use Most drivers for taskfile-based hardware use
ata_check_status() for this hook. ata_sff_check_status() for this hook.
</para>
<para>
Note that because this is called from ata_device_add(), at
least a dummy function that clears device interrupts must be
provided for all drivers, even if the controller doesn't
actually have a taskfile status register.
</para> </para>
</sect2> </sect2>
<sect2><title>Select ATA device on bus</title> <sect2><title>Select ATA device on bus</title>
<programlisting> <programlisting>
void (*dev_select)(struct ata_port *ap, unsigned int device); void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
</programlisting> </programlisting>
<para> <para>
...@@ -251,9 +240,7 @@ void (*dev_select)(struct ata_port *ap, unsigned int device); ...@@ -251,9 +240,7 @@ void (*dev_select)(struct ata_port *ap, unsigned int device);
</para> </para>
<para> <para>
Most drivers for taskfile-based hardware use Most drivers for taskfile-based hardware use
ata_std_dev_select() for this hook. Controllers which do not ata_sff_dev_select() for this hook.
support second drives on a port (such as SATA contollers) will
use ata_noop_dev_select().
</para> </para>
</sect2> </sect2>
...@@ -441,13 +428,13 @@ void (*irq_clear) (struct ata_port *); ...@@ -441,13 +428,13 @@ void (*irq_clear) (struct ata_port *);
to struct ata_host_set. to struct ata_host_set.
</para> </para>
<para> <para>
Most legacy IDE drivers use ata_interrupt() for the Most legacy IDE drivers use ata_sff_interrupt() for the
irq_handler hook, which scans all ports in the host_set, irq_handler hook, which scans all ports in the host_set,
determines which queued command was active (if any), and calls determines which queued command was active (if any), and calls
ata_host_intr(ap,qc). ata_sff_host_intr(ap,qc).
</para> </para>
<para> <para>
Most legacy IDE drivers use ata_bmdma_irq_clear() for the Most legacy IDE drivers use ata_sff_irq_clear() for the
irq_clear() hook, which simply clears the interrupt and error irq_clear() hook, which simply clears the interrupt and error
flags in the DMA status register. flags in the DMA status register.
</para> </para>
...@@ -496,10 +483,6 @@ void (*host_stop) (struct ata_host_set *host_set); ...@@ -496,10 +483,6 @@ void (*host_stop) (struct ata_host_set *host_set);
data from port at this time. data from port at this time.
</para> </para>
<para> <para>
Many drivers use ata_port_stop() as this hook, which frees the
PRD table.
</para>
<para>
->host_stop() is called after all ->port_stop() calls ->host_stop() is called after all ->port_stop() calls
have completed. The hook must finalize hardware shutdown, release DMA have completed. The hook must finalize hardware shutdown, release DMA
and other resources, etc. and other resources, etc.
......
...@@ -74,6 +74,11 @@ structure at all. You should use this to keep device-specific data. ...@@ -74,6 +74,11 @@ structure at all. You should use this to keep device-specific data.
/* retrieve the value */ /* retrieve the value */
void *i2c_get_clientdata(const struct i2c_client *client); void *i2c_get_clientdata(const struct i2c_client *client);
Note that starting with kernel 2.6.34, you don't have to set the `data' field
to NULL in remove() or if probe() failed anymore. The i2c-core does this
automatically on these occasions. Those are also the only times the core will
touch this field.
Accessing the client Accessing the client
==================== ====================
......
...@@ -333,14 +333,14 @@ byte 0: ...@@ -333,14 +333,14 @@ byte 0:
byte 1: byte 1:
bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0
x15 x14 x13 x12 x11 x10 x9 x8 . . . . . x10 x9 x8
byte 2: byte 2:
bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0
x7 x6 x5 x4 x4 x2 x1 x0 x7 x6 x5 x4 x4 x2 x1 x0
x15..x0 = absolute x value (horizontal) x10..x0 = absolute x value (horizontal)
byte 3: byte 3:
...@@ -350,14 +350,14 @@ byte 3: ...@@ -350,14 +350,14 @@ byte 3:
byte 4: byte 4:
bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0
y15 y14 y13 y12 y11 y10 y8 y8 . . . . . . y9 y8
byte 5: byte 5:
bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0
y7 y6 y5 y4 y3 y2 y1 y0 y7 y6 y5 y4 y3 y2 y1 y0
y15..y0 = absolute y value (vertical) y9..y0 = absolute y value (vertical)
4.2.2 Two finger touch 4.2.2 Two finger touch
......
...@@ -165,8 +165,8 @@ the user entry_handler invocation is also skipped. ...@@ -165,8 +165,8 @@ the user entry_handler invocation is also skipped.
1.4 How Does Jump Optimization Work? 1.4 How Does Jump Optimization Work?
If you configured your kernel with CONFIG_OPTPROBES=y (currently If your kernel is built with CONFIG_OPTPROBES=y (currently this flag
this option is supported on x86/x86-64, non-preemptive kernel) and is automatically set 'y' on x86/x86-64, non-preemptive kernel) and
the "debug.kprobes_optimization" kernel parameter is set to 1 (see the "debug.kprobes_optimization" kernel parameter is set to 1 (see
sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump
instruction instead of a breakpoint instruction at each probepoint. instruction instead of a breakpoint instruction at each probepoint.
...@@ -271,8 +271,6 @@ tweak the kernel's execution path, you need to suppress optimization, ...@@ -271,8 +271,6 @@ tweak the kernel's execution path, you need to suppress optimization,
using one of the following techniques: using one of the following techniques:
- Specify an empty function for the kprobe's post_handler or break_handler. - Specify an empty function for the kprobe's post_handler or break_handler.
or or
- Config CONFIG_OPTPROBES=n.
or
- Execute 'sysctl -w debug.kprobes_optimization=n' - Execute 'sysctl -w debug.kprobes_optimization=n'
2. Architectures Supported 2. Architectures Supported
...@@ -307,10 +305,6 @@ it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), ...@@ -307,10 +305,6 @@ it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO),
so you can use "objdump -d -l vmlinux" to see the source-to-object so you can use "objdump -d -l vmlinux" to see the source-to-object
code mapping. code mapping.
If you want to reduce probing overhead, set "Kprobes jump optimization
support" (CONFIG_OPTPROBES) to "y". You can find this option under the
"Kprobes" line.
4. API Reference 4. API Reference
The Kprobes API includes a "register" function and an "unregister" The Kprobes API includes a "register" function and an "unregister"
......
...@@ -58,7 +58,7 @@ static void transfer(int fd) ...@@ -58,7 +58,7 @@ static void transfer(int fd)
}; };
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
if (ret == 1) if (ret < 1)
pabort("can't send spi message"); pabort("can't send spi message");
for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
......
...@@ -40,7 +40,9 @@ Synopsis of kprobe_events ...@@ -40,7 +40,9 @@ Synopsis of kprobe_events
$stack : Fetch stack address. $stack : Fetch stack address.
$retval : Fetch return value.(*) $retval : Fetch return value.(*)
+|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**) +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**)
NAME=FETCHARG: Set NAME as the argument name of FETCHARG. NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
(u8/u16/u32/u64/s8/s16/s32/s64) are supported.
(*) only for return probe. (*) only for return probe.
(**) this is useful for fetching a field of data structures. (**) this is useful for fetching a field of data structures.
......
...@@ -4353,13 +4353,13 @@ M: Paul Mackerras <paulus@samba.org> ...@@ -4353,13 +4353,13 @@ M: Paul Mackerras <paulus@samba.org>
M: Ingo Molnar <mingo@elte.hu> M: Ingo Molnar <mingo@elte.hu>
M: Arnaldo Carvalho de Melo <acme@redhat.com> M: Arnaldo Carvalho de Melo <acme@redhat.com>
S: Supported S: Supported
F: kernel/perf_event.c F: kernel/perf_event*.c
F: include/linux/perf_event.h F: include/linux/perf_event.h
F: arch/*/kernel/perf_event.c F: arch/*/kernel/perf_event*.c
F: arch/*/kernel/*/perf_event.c F: arch/*/kernel/*/perf_event*.c
F: arch/*/kernel/*/*/perf_event.c F: arch/*/kernel/*/*/perf_event*.c
F: arch/*/include/asm/perf_event.h F: arch/*/include/asm/perf_event.h
F: arch/*/lib/perf_event.c F: arch/*/lib/perf_event*.c
F: arch/*/kernel/perf_callchain.c F: arch/*/kernel/perf_callchain.c
F: tools/perf/ F: tools/perf/
......
...@@ -42,15 +42,10 @@ config KPROBES ...@@ -42,15 +42,10 @@ config KPROBES
If in doubt, say "N". If in doubt, say "N".
config OPTPROBES config OPTPROBES
bool "Kprobes jump optimization support (EXPERIMENTAL)" def_bool y
default y depends on KPROBES && HAVE_OPTPROBES
depends on KPROBES
depends on !PREEMPT depends on !PREEMPT
depends on HAVE_OPTPROBES
select KALLSYMS_ALL select KALLSYMS_ALL
help
This option will allow kprobes to optimize breakpoint to
a jump for reducing its overhead.
config HAVE_EFFICIENT_UNALIGNED_ACCESS config HAVE_EFFICIENT_UNALIGNED_ACCESS
bool bool
...@@ -142,6 +137,17 @@ config HAVE_HW_BREAKPOINT ...@@ -142,6 +137,17 @@ config HAVE_HW_BREAKPOINT
bool bool
depends on PERF_EVENTS depends on PERF_EVENTS
config HAVE_MIXED_BREAKPOINTS_REGS
bool
depends on HAVE_HW_BREAKPOINT
help
Depending on the arch implementation of hardware breakpoints,
some of them have separate registers for data and instruction
breakpoints addresses, others have mixed registers to store
them but define the access type in a control register.
Select this option if your arch implements breakpoints under the
latter fashion.
config HAVE_USER_RETURN_NOTIFIER config HAVE_USER_RETURN_NOTIFIER
bool bool
......
...@@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data { ...@@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data {
struct omap_musb_board_data { struct omap_musb_board_data {
u8 interface_type; u8 interface_type;
u8 mode; u8 mode;
u8 power; u16 power;
}; };
enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
......
...@@ -49,7 +49,7 @@ config AR7 ...@@ -49,7 +49,7 @@ config AR7
family: TNETD7100, 7200 and 7300. family: TNETD7100, 7200 and 7300.
config BCM47XX config BCM47XX
bool "BCM47XX based boards" bool "Broadcom BCM47XX based boards"
select CEVT_R4K select CEVT_R4K
select CSRC_R4K select CSRC_R4K
select DMA_NONCOHERENT select DMA_NONCOHERENT
...@@ -509,6 +509,7 @@ config SIBYTE_SWARM ...@@ -509,6 +509,7 @@ config SIBYTE_SWARM
bool "Sibyte BCM91250A-SWARM" bool "Sibyte BCM91250A-SWARM"
select BOOT_ELF32 select BOOT_ELF32
select DMA_COHERENT select DMA_COHERENT
select HAVE_PATA_PLATFORM
select NR_CPUS_DEFAULT_2 select NR_CPUS_DEFAULT_2
select SIBYTE_SB1250 select SIBYTE_SB1250
select SWAP_IO_SPACE select SWAP_IO_SPACE
...@@ -523,6 +524,7 @@ config SIBYTE_LITTLESUR ...@@ -523,6 +524,7 @@ config SIBYTE_LITTLESUR
depends on EXPERIMENTAL depends on EXPERIMENTAL
select BOOT_ELF32 select BOOT_ELF32
select DMA_COHERENT select DMA_COHERENT
select HAVE_PATA_PLATFORM
select NR_CPUS_DEFAULT_2 select NR_CPUS_DEFAULT_2
select SIBYTE_SB1250 select SIBYTE_SB1250
select SWAP_IO_SPACE select SWAP_IO_SPACE
...@@ -1305,6 +1307,33 @@ config CPU_CAVIUM_OCTEON ...@@ -1305,6 +1307,33 @@ config CPU_CAVIUM_OCTEON
endchoice endchoice
if CPU_LOONGSON2F
config CPU_NOP_WORKAROUNDS
bool
config CPU_JUMP_WORKAROUNDS
bool
config CPU_LOONGSON2F_WORKAROUNDS
bool "Loongson 2F Workarounds"
default y
select CPU_NOP_WORKAROUNDS
select CPU_JUMP_WORKAROUNDS
help
Loongson 2F01 / 2F02 processors have the NOP & JUMP issues which
require workarounds. Without workarounds the system may hang
unexpectedly. For more information please refer to the gas
-mfix-loongson2f-nop and -mfix-loongson2f-jump options.
Loongson 2F03 and later have fixed these issues and no workarounds
are needed. The workarounds have no significant side effect on them
but may decrease the performance of the system so this option should
be disabled unless the kernel is intended to be run on 2F01 or 2F02
systems.
If unsure, please say Y.
endif # CPU_LOONGSON2F
config SYS_SUPPORTS_ZBOOT config SYS_SUPPORTS_ZBOOT
bool bool
select HAVE_KERNEL_GZIP select HAVE_KERNEL_GZIP
......
...@@ -136,6 +136,19 @@ cflags-$(CONFIG_CPU_LOONGSON2E) += \ ...@@ -136,6 +136,19 @@ cflags-$(CONFIG_CPU_LOONGSON2E) += \
$(call cc-option,-march=loongson2e,-march=r4600) $(call cc-option,-march=loongson2e,-march=r4600)
cflags-$(CONFIG_CPU_LOONGSON2F) += \ cflags-$(CONFIG_CPU_LOONGSON2F) += \
$(call cc-option,-march=loongson2f,-march=r4600) $(call cc-option,-march=loongson2f,-march=r4600)
# enable the workarounds for loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
$(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop)
else
cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop
endif
ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),)
$(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump)
else
cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump
endif
endif
cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
-Wa,-mips32 -Wa,--trap -Wa,-mips32 -Wa,--trap
......
...@@ -66,12 +66,16 @@ static int __init db1200_arch_init(void) ...@@ -66,12 +66,16 @@ static int __init db1200_arch_init(void)
set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW); set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW);
bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT); bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
/* do not autoenable these: CPLD has broken edge int handling, /* insert/eject pairs: one of both is always screaming. To avoid
* and the CD handler setup requires manual enabling to work * issues they must not be automatically enabled when initially
* around that. * requested.
*/ */
irq_to_desc(DB1200_SD0_INSERT_INT)->status |= IRQ_NOAUTOEN; irq_to_desc(DB1200_SD0_INSERT_INT)->status |= IRQ_NOAUTOEN;
irq_to_desc(DB1200_SD0_EJECT_INT)->status |= IRQ_NOAUTOEN; irq_to_desc(DB1200_SD0_EJECT_INT)->status |= IRQ_NOAUTOEN;
irq_to_desc(DB1200_PC0_INSERT_INT)->status |= IRQ_NOAUTOEN;
irq_to_desc(DB1200_PC0_EJECT_INT)->status |= IRQ_NOAUTOEN;
irq_to_desc(DB1200_PC1_INSERT_INT)->status |= IRQ_NOAUTOEN;
irq_to_desc(DB1200_PC1_EJECT_INT)->status |= IRQ_NOAUTOEN;
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
({ \ ({ \
__typeof(*(m)) __ret; \ __typeof(*(m)) __ret; \
\ \
if (kernel_uses_llsc && R10000_LLSC_WAR) { \ if (kernel_uses_llsc && R10000_LLSC_WAR) { \
__asm__ __volatile__( \ __asm__ __volatile__( \
" .set push \n" \ " .set push \n" \
" .set noat \n" \ " .set noat \n" \
......
...@@ -307,7 +307,7 @@ extern unsigned long _loongson_addrwincfg_base; ...@@ -307,7 +307,7 @@ extern unsigned long _loongson_addrwincfg_base;
*/ */
#define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\ #define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\
s##_WIN##w##_BASE = (src); \ s##_WIN##w##_BASE = (src); \
s##_WIN##w##_MMAP = (src) | ADDRWIN_MAP_DST_##d; \ s##_WIN##w##_MMAP = (dst) | ADDRWIN_MAP_DST_##d; \
s##_WIN##w##_MASK = ~(size-1); \ s##_WIN##w##_MASK = ~(size-1); \
} while (0) } while (0)
......
...@@ -120,9 +120,14 @@ ...@@ -120,9 +120,14 @@
#endif #endif
#define FIRST_USER_ADDRESS 0UL #define FIRST_USER_ADDRESS 0UL
#define VMALLOC_START MAP_BASE /*
* TLB refill handlers also map the vmalloc area into xuseg. Avoid
* the first couple of pages so NULL pointer dereferences will still
* reliably trap.
*/
#define VMALLOC_START (MAP_BASE + (2 * PAGE_SIZE))
#define VMALLOC_END \ #define VMALLOC_END \
(VMALLOC_START + \ (MAP_BASE + \
min(PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE, \ min(PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE, \
(1UL << cpu_vmbits)) - (1UL << 32)) (1UL << cpu_vmbits)) - (1UL << 32))
......
...@@ -142,9 +142,9 @@ extern int ptrace_set_watch_regs(struct task_struct *child, ...@@ -142,9 +142,9 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
extern NORET_TYPE void die(const char *, const struct pt_regs *) ATTRIB_NORET; extern NORET_TYPE void die(const char *, struct pt_regs *) ATTRIB_NORET;
static inline void die_if_kernel(const char *str, const struct pt_regs *regs) static inline void die_if_kernel(const char *str, struct pt_regs *regs)
{ {
if (unlikely(!user_mode(regs))) if (unlikely(!user_mode(regs)))
die(str, regs); die(str, regs);
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
.endm .endm
#else #else
.macro get_saved_sp /* Uniprocessor variation */ .macro get_saved_sp /* Uniprocessor variation */
#ifdef CONFIG_CPU_LOONGSON2F #ifdef CONFIG_CPU_JUMP_WORKAROUNDS
/* /*
* Clear BTB (branch target buffer), forbid RAS (return address * Clear BTB (branch target buffer), forbid RAS (return address
* stack) to workaround the Out-of-order Issue in Loongson2F * stack) to workaround the Out-of-order Issue in Loongson2F
......
...@@ -167,6 +167,24 @@ static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ ...@@ -167,6 +167,24 @@ static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1) #define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
unsigned int a2, unsigned int a3)
{
if (a3 < 32)
uasm_i_dsrl(p, a1, a2, a3);
else
uasm_i_dsrl32(p, a1, a2, a3 - 32);
}
static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
unsigned int a2, unsigned int a3)
{
if (a3 < 32)
uasm_i_dsll(p, a1, a2, a3);
else
uasm_i_dsll32(p, a1, a2, a3 - 32);
}
/* Handle relocations. */ /* Handle relocations. */
struct uasm_reloc { struct uasm_reloc {
u32 *addr; u32 *addr;
......
...@@ -76,15 +76,9 @@ void __init plat_mem_setup(void) ...@@ -76,15 +76,9 @@ void __init plat_mem_setup(void)
#ifdef CONFIG_VT #ifdef CONFIG_VT
screen_info = (struct screen_info) { screen_info = (struct screen_info) {
0, 0, /* orig-x, orig-y */ .orig_video_cols = 160,
0, /* unused */ .orig_video_lines = 64,
0, /* orig_video_page */ .orig_video_points = 16,
0, /* orig_video_mode */
160, /* orig_video_cols */
0, 0, 0, /* unused, ega_bx, unused */
64, /* orig_video_lines */
0, /* orig_video_isVGA */
16 /* orig_video_points */
}; };
#endif #endif
......
...@@ -352,9 +352,10 @@ void show_registers(const struct pt_regs *regs) ...@@ -352,9 +352,10 @@ void show_registers(const struct pt_regs *regs)
static DEFINE_SPINLOCK(die_lock); static DEFINE_SPINLOCK(die_lock);
void __noreturn die(const char * str, const struct pt_regs * regs) void __noreturn die(const char * str, struct pt_regs * regs)
{ {
static int die_counter; static int die_counter;
int sig = SIGSEGV;
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
unsigned long dvpret = dvpe(); unsigned long dvpret = dvpe();
#endif /* CONFIG_MIPS_MT_SMTC */ #endif /* CONFIG_MIPS_MT_SMTC */
...@@ -365,6 +366,10 @@ void __noreturn die(const char * str, const struct pt_regs * regs) ...@@ -365,6 +366,10 @@ void __noreturn die(const char * str, const struct pt_regs * regs)
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
mips_mt_regdump(dvpret); mips_mt_regdump(dvpret);
#endif /* CONFIG_MIPS_MT_SMTC */ #endif /* CONFIG_MIPS_MT_SMTC */
if (notify_die(DIE_OOPS, str, regs, 0, current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
sig = 0;
printk("%s[#%d]:\n", str, ++die_counter); printk("%s[#%d]:\n", str, ++die_counter);
show_registers(regs); show_registers(regs);
add_taint(TAINT_DIE); add_taint(TAINT_DIE);
...@@ -379,7 +384,7 @@ void __noreturn die(const char * str, const struct pt_regs * regs) ...@@ -379,7 +384,7 @@ void __noreturn die(const char * str, const struct pt_regs * regs)
panic("Fatal exception"); panic("Fatal exception");
} }
do_exit(SIGSEGV); do_exit(sig);
} }
extern struct exception_table_entry __start___dbe_table[]; extern struct exception_table_entry __start___dbe_table[];
...@@ -1557,12 +1562,7 @@ static char panic_null_cerr[] __cpuinitdata = ...@@ -1557,12 +1562,7 @@ static char panic_null_cerr[] __cpuinitdata =
void __cpuinit set_uncached_handler(unsigned long offset, void *addr, void __cpuinit set_uncached_handler(unsigned long offset, void *addr,
unsigned long size) unsigned long size)
{ {
#ifdef CONFIG_32BIT unsigned long uncached_ebase = CKSEG1ADDR(ebase);
unsigned long uncached_ebase = KSEG1ADDR(ebase);
#endif
#ifdef CONFIG_64BIT
unsigned long uncached_ebase = TO_UNCAC(ebase);
#endif
if (!addr) if (!addr)
panic(panic_null_cerr); panic(panic_null_cerr);
......
...@@ -24,7 +24,7 @@ static const char *system_types[] = { ...@@ -24,7 +24,7 @@ static const char *system_types[] = {
[MACH_LEMOTE_FL2F] "lemote-fuloong-2f-box", [MACH_LEMOTE_FL2F] "lemote-fuloong-2f-box",
[MACH_LEMOTE_ML2F7] "lemote-mengloong-2f-7inches", [MACH_LEMOTE_ML2F7] "lemote-mengloong-2f-7inches",
[MACH_LEMOTE_YL2F89] "lemote-yeeloong-2f-8.9inches", [MACH_LEMOTE_YL2F89] "lemote-yeeloong-2f-8.9inches",
[MACH_DEXXON_GDIUM2F10] "dexxon-gidum-2f-10inches", [MACH_DEXXON_GDIUM2F10] "dexxon-gdium-2f",
[MACH_LEMOTE_NAS] "lemote-nas-2f", [MACH_LEMOTE_NAS] "lemote-nas-2f",
[MACH_LEMOTE_LL2F] "lemote-lynloong-2f", [MACH_LEMOTE_LL2F] "lemote-lynloong-2f",
[MACH_LOONGSON_END] NULL, [MACH_LOONGSON_END] NULL,
......
...@@ -75,7 +75,7 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, ...@@ -75,7 +75,7 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long end = offset + size; unsigned long end = offset + size;
if (__uncached_access(file, offset)) { if (__uncached_access(file, offset)) {
if (((uca_start && offset) >= uca_start) && if (uca_start && (offset >= uca_start) &&
(end <= uca_end)) (end <= uca_end))
return __pgprot((pgprot_val(vma_prot) & return __pgprot((pgprot_val(vma_prot) &
~_CACHE_MASK) | ~_CACHE_MASK) |
...@@ -96,7 +96,7 @@ static int __init find_vga_mem_init(void) ...@@ -96,7 +96,7 @@ static int __init find_vga_mem_init(void)
return 0; return 0;
for_each_pci_dev(dev) { for_each_pci_dev(dev) {
if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA) { if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) { for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
r = &dev->resource[idx]; r = &dev->resource[idx];
if (!r->start && r->end) if (!r->start && r->end)
......
...@@ -16,13 +16,31 @@ ...@@ -16,13 +16,31 @@
#include <loongson.h> #include <loongson.h>
static inline void loongson_reboot(void)
{
#ifndef CONFIG_CPU_JUMP_WORKAROUNDS
((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();
#else
void (*func)(void);
func = (void *)ioremap_nocache(LOONGSON_BOOT_BASE, 4);
__asm__ __volatile__(
" .set noat \n"
" jr %[func] \n"
" .set at \n"
: /* No outputs */
: [func] "r" (func));
#endif
}
static void loongson_restart(char *command) static void loongson_restart(char *command)
{ {
/* do preparation for reboot */ /* do preparation for reboot */
mach_prepare_reboot(); mach_prepare_reboot();
/* reboot via jumping to boot base address */ /* reboot via jumping to boot base address */
((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) (); loongson_reboot();
} }
static void loongson_poweroff(void) static void loongson_poweroff(void)
......
...@@ -41,15 +41,12 @@ void __init plat_mem_setup(void) ...@@ -41,15 +41,12 @@ void __init plat_mem_setup(void)
conswitchp = &vga_con; conswitchp = &vga_con;
screen_info = (struct screen_info) { screen_info = (struct screen_info) {
0, 25, /* orig-x, orig-y */ .orig_x = 0,
0, /* unused */ .orig_y = 25,
0, /* orig-video-page */ .orig_video_cols = 80,
0, /* orig-video-mode */ .orig_video_lines = 25,
80, /* orig-video-cols */ .orig_video_isVGA = VIDEO_TYPE_VGAC,
0, 0, 0, /* ega_ax, ega_bx, ega_cx */ .orig_video_points = 16,
25, /* orig-video-lines */
VIDEO_TYPE_VGAC, /* orig-video-isVGA */
16 /* orig-video-points */
}; };
#elif defined(CONFIG_DUMMY_CONSOLE) #elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con; conswitchp = &dummy_con;
......
...@@ -79,7 +79,7 @@ void mach_irq_dispatch(unsigned int pending) ...@@ -79,7 +79,7 @@ void mach_irq_dispatch(unsigned int pending)
if (pending & CAUSEF_IP7) if (pending & CAUSEF_IP7)
do_IRQ(LOONGSON_TIMER_IRQ); do_IRQ(LOONGSON_TIMER_IRQ);
else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */ else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */
#ifdef CONFIG_OPROFILE #if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
do_IRQ(LOONGSON2_PERFCNT_IRQ); do_IRQ(LOONGSON2_PERFCNT_IRQ);
#endif #endif
bonito_irqdispatch(); bonito_irqdispatch();
......
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
#include <asm/war.h> #include <asm/war.h>
#include <asm/uasm.h> #include <asm/uasm.h>
/*
* TLB load/store/modify handlers.
*
* Only the fastpath gets synthesized at runtime, the slowpath for
* do_page_fault remains normal asm.
*/
extern void tlb_do_page_fault_0(void);
extern void tlb_do_page_fault_1(void);
static inline int r45k_bvahwbug(void) static inline int r45k_bvahwbug(void)
{ {
/* XXX: We should probe for the presence of this bug, but we don't. */ /* XXX: We should probe for the presence of this bug, but we don't. */
...@@ -83,6 +93,7 @@ enum label_id { ...@@ -83,6 +93,7 @@ enum label_id {
label_nopage_tlbm, label_nopage_tlbm,
label_smp_pgtable_change, label_smp_pgtable_change,
label_r3000_write_probe_fail, label_r3000_write_probe_fail,
label_large_segbits_fault,
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
label_tlb_huge_update, label_tlb_huge_update,
#endif #endif
...@@ -101,6 +112,7 @@ UASM_L_LA(_nopage_tlbs) ...@@ -101,6 +112,7 @@ UASM_L_LA(_nopage_tlbs)
UASM_L_LA(_nopage_tlbm) UASM_L_LA(_nopage_tlbm)
UASM_L_LA(_smp_pgtable_change) UASM_L_LA(_smp_pgtable_change)
UASM_L_LA(_r3000_write_probe_fail) UASM_L_LA(_r3000_write_probe_fail)
UASM_L_LA(_large_segbits_fault)
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
UASM_L_LA(_tlb_huge_update) UASM_L_LA(_tlb_huge_update)
#endif #endif
...@@ -157,6 +169,10 @@ static u32 tlb_handler[128] __cpuinitdata; ...@@ -157,6 +169,10 @@ static u32 tlb_handler[128] __cpuinitdata;
static struct uasm_label labels[128] __cpuinitdata; static struct uasm_label labels[128] __cpuinitdata;
static struct uasm_reloc relocs[128] __cpuinitdata; static struct uasm_reloc relocs[128] __cpuinitdata;
#ifdef CONFIG_64BIT
static int check_for_high_segbits __cpuinitdata;
#endif
#ifndef CONFIG_MIPS_PGD_C0_CONTEXT #ifndef CONFIG_MIPS_PGD_C0_CONTEXT
/* /*
* CONFIG_MIPS_PGD_C0_CONTEXT implies 64 bit and lack of pgd_current, * CONFIG_MIPS_PGD_C0_CONTEXT implies 64 bit and lack of pgd_current,
...@@ -408,7 +424,7 @@ static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p, ...@@ -408,7 +424,7 @@ static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC)); UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
} else { } else {
#ifdef CONFIG_64BIT_PHYS_ADDR #ifdef CONFIG_64BIT_PHYS_ADDR
uasm_i_dsrl(p, reg, reg, ilog2(_PAGE_GLOBAL)); uasm_i_dsrl_safe(p, reg, reg, ilog2(_PAGE_GLOBAL));
#else #else
UASM_i_SRL(p, reg, reg, ilog2(_PAGE_GLOBAL)); UASM_i_SRL(p, reg, reg, ilog2(_PAGE_GLOBAL));
#endif #endif
...@@ -532,7 +548,24 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, ...@@ -532,7 +548,24 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
* The vmalloc handling is not in the hotpath. * The vmalloc handling is not in the hotpath.
*/ */
uasm_i_dmfc0(p, tmp, C0_BADVADDR); uasm_i_dmfc0(p, tmp, C0_BADVADDR);
uasm_il_bltz(p, r, tmp, label_vmalloc);
if (check_for_high_segbits) {
/*
* The kernel currently implicitely assumes that the
* MIPS SEGBITS parameter for the processor is
* (PGDIR_SHIFT+PGDIR_BITS) or less, and will never
* allocate virtual addresses outside the maximum
* range for SEGBITS = (PGDIR_SHIFT+PGDIR_BITS). But
* that doesn't prevent user code from accessing the
* higher xuseg addresses. Here, we make sure that
* everything but the lower xuseg addresses goes down
* the module_alloc/vmalloc path.
*/
uasm_i_dsrl_safe(p, ptr, tmp, PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3);
uasm_il_bnez(p, r, ptr, label_vmalloc);
} else {
uasm_il_bltz(p, r, tmp, label_vmalloc);
}
/* No uasm_i_nop needed here, since the next insn doesn't touch TMP. */ /* No uasm_i_nop needed here, since the next insn doesn't touch TMP. */
#ifdef CONFIG_MIPS_PGD_C0_CONTEXT #ifdef CONFIG_MIPS_PGD_C0_CONTEXT
...@@ -549,14 +582,14 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, ...@@ -549,14 +582,14 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
* SMTC uses TCBind value as "CPU" index * SMTC uses TCBind value as "CPU" index
*/ */
uasm_i_mfc0(p, ptr, C0_TCBIND); uasm_i_mfc0(p, ptr, C0_TCBIND);
uasm_i_dsrl(p, ptr, ptr, 19); uasm_i_dsrl_safe(p, ptr, ptr, 19);
# else # else
/* /*
* 64 bit SMP running in XKPHYS has smp_processor_id() << 3 * 64 bit SMP running in XKPHYS has smp_processor_id() << 3
* stored in CONTEXT. * stored in CONTEXT.
*/ */
uasm_i_dmfc0(p, ptr, C0_CONTEXT); uasm_i_dmfc0(p, ptr, C0_CONTEXT);
uasm_i_dsrl(p, ptr, ptr, 23); uasm_i_dsrl_safe(p, ptr, ptr, 23);
# endif # endif
UASM_i_LA_mostly(p, tmp, pgdc); UASM_i_LA_mostly(p, tmp, pgdc);
uasm_i_daddu(p, ptr, ptr, tmp); uasm_i_daddu(p, ptr, ptr, tmp);
...@@ -569,44 +602,78 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, ...@@ -569,44 +602,78 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
uasm_l_vmalloc_done(l, *p); uasm_l_vmalloc_done(l, *p);
if (PGDIR_SHIFT - 3 < 32) /* get pgd offset in bytes */ /* get pgd offset in bytes */
uasm_i_dsrl(p, tmp, tmp, PGDIR_SHIFT-3); uasm_i_dsrl_safe(p, tmp, tmp, PGDIR_SHIFT - 3);
else
uasm_i_dsrl32(p, tmp, tmp, PGDIR_SHIFT - 3 - 32);
uasm_i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3); uasm_i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3);
uasm_i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */ uasm_i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */
#ifndef __PAGETABLE_PMD_FOLDED #ifndef __PAGETABLE_PMD_FOLDED
uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */ uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */
uasm_i_ld(p, ptr, 0, ptr); /* get pmd pointer */ uasm_i_ld(p, ptr, 0, ptr); /* get pmd pointer */
uasm_i_dsrl(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */ uasm_i_dsrl_safe(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */
uasm_i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3); uasm_i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3);
uasm_i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */ uasm_i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */
#endif #endif
} }
enum vmalloc64_mode {not_refill, refill};
/* /*
* BVADDR is the faulting address, PTR is scratch. * BVADDR is the faulting address, PTR is scratch.
* PTR will hold the pgd for vmalloc. * PTR will hold the pgd for vmalloc.
*/ */
static void __cpuinit static void __cpuinit
build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
unsigned int bvaddr, unsigned int ptr) unsigned int bvaddr, unsigned int ptr,
enum vmalloc64_mode mode)
{ {
long swpd = (long)swapper_pg_dir; long swpd = (long)swapper_pg_dir;
int single_insn_swpd;
int did_vmalloc_branch = 0;
single_insn_swpd = uasm_in_compat_space_p(swpd) && !uasm_rel_lo(swpd);
uasm_l_vmalloc(l, *p); uasm_l_vmalloc(l, *p);
if (uasm_in_compat_space_p(swpd) && !uasm_rel_lo(swpd)) { if (mode == refill && check_for_high_segbits) {
uasm_il_b(p, r, label_vmalloc_done); if (single_insn_swpd) {
uasm_i_lui(p, ptr, uasm_rel_hi(swpd)); uasm_il_bltz(p, r, bvaddr, label_vmalloc_done);
} else { uasm_i_lui(p, ptr, uasm_rel_hi(swpd));
UASM_i_LA_mostly(p, ptr, swpd); did_vmalloc_branch = 1;
uasm_il_b(p, r, label_vmalloc_done); /* fall through */
if (uasm_in_compat_space_p(swpd)) } else {
uasm_i_addiu(p, ptr, ptr, uasm_rel_lo(swpd)); uasm_il_bgez(p, r, bvaddr, label_large_segbits_fault);
else }
uasm_i_daddiu(p, ptr, ptr, uasm_rel_lo(swpd)); }
if (!did_vmalloc_branch) {
if (uasm_in_compat_space_p(swpd) && !uasm_rel_lo(swpd)) {
uasm_il_b(p, r, label_vmalloc_done);
uasm_i_lui(p, ptr, uasm_rel_hi(swpd));
} else {
UASM_i_LA_mostly(p, ptr, swpd);
uasm_il_b(p, r, label_vmalloc_done);
if (uasm_in_compat_space_p(swpd))
uasm_i_addiu(p, ptr, ptr, uasm_rel_lo(swpd));
else
uasm_i_daddiu(p, ptr, ptr, uasm_rel_lo(swpd));
}
}
if (mode == refill && check_for_high_segbits) {
uasm_l_large_segbits_fault(l, *p);
/*
* We get here if we are an xsseg address, or if we are
* an xuseg address above (PGDIR_SHIFT+PGDIR_BITS) boundary.
*
* Ignoring xsseg (assume disabled so would generate
* (address errors?), the only remaining possibility
* is the upper xuseg addresses. On processors with
* TLB_SEGBITS <= PGDIR_SHIFT+PGDIR_BITS, these
* addresses would have taken an address error. We try
* to mimic that here by taking a load/istream page
* fault.
*/
UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0);
uasm_i_jr(p, ptr);
uasm_i_nop(p);
} }
} }
...@@ -720,9 +787,9 @@ static void __cpuinit build_update_entries(u32 **p, unsigned int tmp, ...@@ -720,9 +787,9 @@ static void __cpuinit build_update_entries(u32 **p, unsigned int tmp,
UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */ UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
UASM_i_ROTR(p, ptep, ptep, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC)); UASM_i_ROTR(p, ptep, ptep, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
} else { } else {
uasm_i_dsrl(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); /* convert to entrylo0 */ uasm_i_dsrl_safe(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); /* convert to entrylo0 */
UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */ UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
uasm_i_dsrl(p, ptep, ptep, ilog2(_PAGE_GLOBAL)); /* convert to entrylo1 */ uasm_i_dsrl_safe(p, ptep, ptep, ilog2(_PAGE_GLOBAL)); /* convert to entrylo1 */
} }
UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */ UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */
} else { } else {
...@@ -793,9 +860,9 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) ...@@ -793,9 +860,9 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
uasm_i_dmfc0(&p, K0, C0_BADVADDR); uasm_i_dmfc0(&p, K0, C0_BADVADDR);
uasm_i_dmfc0(&p, K1, C0_ENTRYHI); uasm_i_dmfc0(&p, K1, C0_ENTRYHI);
uasm_i_xor(&p, K0, K0, K1); uasm_i_xor(&p, K0, K0, K1);
uasm_i_dsrl32(&p, K1, K0, 62 - 32); uasm_i_dsrl_safe(&p, K1, K0, 62);
uasm_i_dsrl(&p, K0, K0, 12 + 1); uasm_i_dsrl_safe(&p, K0, K0, 12 + 1);
uasm_i_dsll32(&p, K0, K0, 64 + 12 + 1 - segbits - 32); uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits);
uasm_i_or(&p, K0, K0, K1); uasm_i_or(&p, K0, K0, K1);
uasm_il_bnez(&p, &r, K0, label_leave); uasm_il_bnez(&p, &r, K0, label_leave);
/* No need for uasm_i_nop */ /* No need for uasm_i_nop */
...@@ -825,7 +892,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) ...@@ -825,7 +892,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
#endif #endif
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
build_get_pgd_vmalloc64(&p, &l, &r, K0, K1); build_get_pgd_vmalloc64(&p, &l, &r, K0, K1, refill);
#endif #endif
/* /*
...@@ -934,15 +1001,6 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) ...@@ -934,15 +1001,6 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
dump_handler((u32 *)ebase, 64); dump_handler((u32 *)ebase, 64);
} }
/*
* TLB load/store/modify handlers.
*
* Only the fastpath gets synthesized at runtime, the slowpath for
* do_page_fault remains normal asm.
*/
extern void tlb_do_page_fault_0(void);
extern void tlb_do_page_fault_1(void);
/* /*
* 128 instructions for the fastpath handler is generous and should * 128 instructions for the fastpath handler is generous and should
* never be exceeded. * never be exceeded.
...@@ -1302,7 +1360,7 @@ build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l, ...@@ -1302,7 +1360,7 @@ build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l,
uasm_i_eret(p); /* return from trap */ uasm_i_eret(p); /* return from trap */
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
build_get_pgd_vmalloc64(p, l, r, tmp, ptr); build_get_pgd_vmalloc64(p, l, r, tmp, ptr, not_refill);
#endif #endif
} }
...@@ -1322,9 +1380,9 @@ static void __cpuinit build_r4000_tlb_load_handler(void) ...@@ -1322,9 +1380,9 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
uasm_i_dmfc0(&p, K0, C0_BADVADDR); uasm_i_dmfc0(&p, K0, C0_BADVADDR);
uasm_i_dmfc0(&p, K1, C0_ENTRYHI); uasm_i_dmfc0(&p, K1, C0_ENTRYHI);
uasm_i_xor(&p, K0, K0, K1); uasm_i_xor(&p, K0, K0, K1);
uasm_i_dsrl32(&p, K1, K0, 62 - 32); uasm_i_dsrl_safe(&p, K1, K0, 62);
uasm_i_dsrl(&p, K0, K0, 12 + 1); uasm_i_dsrl_safe(&p, K0, K0, 12 + 1);
uasm_i_dsll32(&p, K0, K0, 64 + 12 + 1 - segbits - 32); uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits);
uasm_i_or(&p, K0, K0, K1); uasm_i_or(&p, K0, K0, K1);
uasm_il_bnez(&p, &r, K0, label_leave); uasm_il_bnez(&p, &r, K0, label_leave);
/* No need for uasm_i_nop */ /* No need for uasm_i_nop */
...@@ -1526,6 +1584,10 @@ void __cpuinit build_tlb_refill_handler(void) ...@@ -1526,6 +1584,10 @@ void __cpuinit build_tlb_refill_handler(void)
*/ */
static int run_once = 0; static int run_once = 0;
#ifdef CONFIG_64BIT
check_for_high_segbits = current_cpu_data.vmbits > (PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3);
#endif
switch (current_cpu_type()) { switch (current_cpu_type()) {
case CPU_R2000: case CPU_R2000:
case CPU_R3000: case CPU_R3000:
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* Reset the PNX8550 board. * Reset the PNX8550 board.
* *
*/ */
#include <linux/kernel.h>
#include <asm/reboot.h> #include <asm/reboot.h>
#include <glb.h> #include <glb.h>
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/vt.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -254,7 +255,7 @@ static int __init sb1250_pcibios_init(void) ...@@ -254,7 +255,7 @@ static int __init sb1250_pcibios_init(void)
* XXX ehs: Should this happen in PCI Device mode? * XXX ehs: Should this happen in PCI Device mode?
*/ */
io_map_base = ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES, 1024 * 1024); io_map_base = ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES, 1024 * 1024);
sb1250_controller.io_map_base = io_map_base; sb1250_controller.io_map_base = (unsigned long)io_map_base;
set_io_port_base((unsigned long)io_map_base); set_io_port_base((unsigned long)io_map_base);
#ifdef CONFIG_SIBYTE_HAS_LDT #ifdef CONFIG_SIBYTE_HAS_LDT
......
...@@ -89,7 +89,7 @@ static void print_buserr(void) ...@@ -89,7 +89,7 @@ static void print_buserr(void)
void ip22_be_interrupt(int irq) void ip22_be_interrupt(int irq)
{ {
const int field = 2 * sizeof(unsigned long); const int field = 2 * sizeof(unsigned long);
const struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
save_and_clear_buserr(); save_and_clear_buserr();
print_buserr(); print_buserr();
......
...@@ -453,7 +453,7 @@ static int ip28_be_interrupt(const struct pt_regs *regs) ...@@ -453,7 +453,7 @@ static int ip28_be_interrupt(const struct pt_regs *regs)
void ip22_be_interrupt(int irq) void ip22_be_interrupt(int irq)
{ {
const struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
count_be_interrupt++; count_be_interrupt++;
......
...@@ -145,15 +145,14 @@ void __init plat_mem_setup(void) ...@@ -145,15 +145,14 @@ void __init plat_mem_setup(void)
#ifdef CONFIG_VT #ifdef CONFIG_VT
screen_info = (struct screen_info) { screen_info = (struct screen_info) {
0, 0, /* orig-x, orig-y */ .orig_video_page = 52,
0, /* unused */ .orig_video_mode = 3,
52, /* orig_video_page */ .orig_video_cols = 80,
3, /* orig_video_mode */ .flags = 12,
80, /* orig_video_cols */ .orig_video_ega_bx = 3,
4626, 3, 9, /* unused, ega_bx, unused */ .orig_video_lines = 25,
25, /* orig_video_lines */ .orig_video_isVGA = 0x22,
0x22, /* orig_video_isVGA */ .orig_video_points = 16,
16 /* orig_video_points */
}; };
/* XXXKW for CFE, get lines/cols from environment */ /* XXXKW for CFE, get lines/cols from environment */
#endif #endif
......
...@@ -35,6 +35,9 @@ struct cpu_hw_events { ...@@ -35,6 +35,9 @@ struct cpu_hw_events {
u64 alternatives[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES]; u64 alternatives[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
unsigned long amasks[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES]; unsigned long amasks[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
unsigned long avalues[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES]; unsigned long avalues[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
unsigned int group_flag;
int n_txn_start;
}; };
DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events); DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
...@@ -718,66 +721,6 @@ static int collect_events(struct perf_event *group, int max_count, ...@@ -718,66 +721,6 @@ static int collect_events(struct perf_event *group, int max_count,
return n; return n;
} }
static void event_sched_in(struct perf_event *event)
{
event->state = PERF_EVENT_STATE_ACTIVE;
event->oncpu = smp_processor_id();
event->tstamp_running += event->ctx->time - event->tstamp_stopped;
if (is_software_event(event))
event->pmu->enable(event);
}
/*
* Called to enable a whole group of events.
* Returns 1 if the group was enabled, or -EAGAIN if it could not be.
* Assumes the caller has disabled interrupts and has
* frozen the PMU with hw_perf_save_disable.
*/
int hw_perf_group_sched_in(struct perf_event *group_leader,
struct perf_cpu_context *cpuctx,
struct perf_event_context *ctx)
{
struct cpu_hw_events *cpuhw;
long i, n, n0;
struct perf_event *sub;
if (!ppmu)
return 0;
cpuhw = &__get_cpu_var(cpu_hw_events);
n0 = cpuhw->n_events;
n = collect_events(group_leader, ppmu->n_counter - n0,
&cpuhw->event[n0], &cpuhw->events[n0],
&cpuhw->flags[n0]);
if (n < 0)
return -EAGAIN;
if (check_excludes(cpuhw->event, cpuhw->flags, n0, n))
return -EAGAIN;
i = power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n + n0);
if (i < 0)
return -EAGAIN;
cpuhw->n_events = n0 + n;
cpuhw->n_added += n;
/*
* OK, this group can go on; update event states etc.,
* and enable any software events
*/
for (i = n0; i < n0 + n; ++i)
cpuhw->event[i]->hw.config = cpuhw->events[i];
cpuctx->active_oncpu += n;
n = 1;
event_sched_in(group_leader);
list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
if (sub->state != PERF_EVENT_STATE_OFF) {
event_sched_in(sub);
++n;
}
}
ctx->nr_active += n;
return 1;
}
/* /*
* Add a event to the PMU. * Add a event to the PMU.
* If all events are not already frozen, then we disable and * If all events are not already frozen, then we disable and
...@@ -805,12 +748,22 @@ static int power_pmu_enable(struct perf_event *event) ...@@ -805,12 +748,22 @@ static int power_pmu_enable(struct perf_event *event)
cpuhw->event[n0] = event; cpuhw->event[n0] = event;
cpuhw->events[n0] = event->hw.config; cpuhw->events[n0] = event->hw.config;
cpuhw->flags[n0] = event->hw.event_base; cpuhw->flags[n0] = event->hw.event_base;
/*
* If group events scheduling transaction was started,
* skip the schedulability test here, it will be peformed
* at commit time(->commit_txn) as a whole
*/
if (cpuhw->group_flag & PERF_EVENT_TXN_STARTED)
goto nocheck;
if (check_excludes(cpuhw->event, cpuhw->flags, n0, 1)) if (check_excludes(cpuhw->event, cpuhw->flags, n0, 1))
goto out; goto out;
if (power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n0 + 1)) if (power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n0 + 1))
goto out; goto out;
event->hw.config = cpuhw->events[n0]; event->hw.config = cpuhw->events[n0];
nocheck:
++cpuhw->n_events; ++cpuhw->n_events;
++cpuhw->n_added; ++cpuhw->n_added;
...@@ -896,11 +849,65 @@ static void power_pmu_unthrottle(struct perf_event *event) ...@@ -896,11 +849,65 @@ static void power_pmu_unthrottle(struct perf_event *event)
local_irq_restore(flags); local_irq_restore(flags);
} }
/*
* Start group events scheduling transaction
* Set the flag to make pmu::enable() not perform the
* schedulability test, it will be performed at commit time
*/
void power_pmu_start_txn(const struct pmu *pmu)
{
struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
cpuhw->group_flag |= PERF_EVENT_TXN_STARTED;
cpuhw->n_txn_start = cpuhw->n_events;
}
/*
* Stop group events scheduling transaction
* Clear the flag and pmu::enable() will perform the
* schedulability test.
*/
void power_pmu_cancel_txn(const struct pmu *pmu)
{
struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED;
}
/*
* Commit group events scheduling transaction
* Perform the group schedulability test as a whole
* Return 0 if success
*/
int power_pmu_commit_txn(const struct pmu *pmu)
{
struct cpu_hw_events *cpuhw;
long i, n;
if (!ppmu)
return -EAGAIN;
cpuhw = &__get_cpu_var(cpu_hw_events);
n = cpuhw->n_events;
if (check_excludes(cpuhw->event, cpuhw->flags, 0, n))
return -EAGAIN;
i = power_check_constraints(cpuhw, cpuhw->events, cpuhw->flags, n);
if (i < 0)
return -EAGAIN;
for (i = cpuhw->n_txn_start; i < n; ++i)
cpuhw->event[i]->hw.config = cpuhw->events[i];
return 0;
}
struct pmu power_pmu = { struct pmu power_pmu = {
.enable = power_pmu_enable, .enable = power_pmu_enable,
.disable = power_pmu_disable, .disable = power_pmu_disable,
.read = power_pmu_read, .read = power_pmu_read,
.unthrottle = power_pmu_unthrottle, .unthrottle = power_pmu_unthrottle,
.start_txn = power_pmu_start_txn,
.cancel_txn = power_pmu_cancel_txn,
.commit_txn = power_pmu_commit_txn,
}; };
/* /*
......
...@@ -44,6 +44,7 @@ config SUPERH32 ...@@ -44,6 +44,7 @@ config SUPERH32
select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_ARCH_KGDB select HAVE_ARCH_KGDB
select HAVE_HW_BREAKPOINT select HAVE_HW_BREAKPOINT
select HAVE_MIXED_BREAKPOINTS_REGS
select PERF_EVENTS if HAVE_HW_BREAKPOINT select PERF_EVENTS if HAVE_HW_BREAKPOINT
select ARCH_HIBERNATION_POSSIBLE if MMU select ARCH_HIBERNATION_POSSIBLE if MMU
......
...@@ -46,10 +46,14 @@ struct pmu; ...@@ -46,10 +46,14 @@ struct pmu;
/* Maximum number of UBC channels */ /* Maximum number of UBC channels */
#define HBP_NUM 2 #define HBP_NUM 2
static inline int hw_breakpoint_slots(int type)
{
return HBP_NUM;
}
/* arch/sh/kernel/hw_breakpoint.c */ /* arch/sh/kernel/hw_breakpoint.c */
extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len); extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
extern int arch_validate_hwbkpt_settings(struct perf_event *bp, extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
struct task_struct *tsk);
extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
unsigned long val, void *data); unsigned long val, void *data);
......
...@@ -119,26 +119,17 @@ static int get_hbp_len(u16 hbp_len) ...@@ -119,26 +119,17 @@ static int get_hbp_len(u16 hbp_len)
return len_in_bytes; return len_in_bytes;
} }
/*
* Check for virtual address in user space.
*/
int arch_check_va_in_userspace(unsigned long va, u16 hbp_len)
{
unsigned int len;
len = get_hbp_len(hbp_len);
return (va <= TASK_SIZE - len);
}
/* /*
* Check for virtual address in kernel space. * Check for virtual address in kernel space.
*/ */
static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len) int arch_check_bp_in_kernelspace(struct perf_event *bp)
{ {
unsigned int len; unsigned int len;
unsigned long va;
struct arch_hw_breakpoint *info = counter_arch_bp(bp);
len = get_hbp_len(hbp_len); va = info->address;
len = get_hbp_len(info->len);
return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE); return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
} }
...@@ -226,8 +217,7 @@ static int arch_build_bp_info(struct perf_event *bp) ...@@ -226,8 +217,7 @@ static int arch_build_bp_info(struct perf_event *bp)
/* /*
* Validate the arch-specific HW Breakpoint register settings * Validate the arch-specific HW Breakpoint register settings
*/ */
int arch_validate_hwbkpt_settings(struct perf_event *bp, int arch_validate_hwbkpt_settings(struct perf_event *bp)
struct task_struct *tsk)
{ {
struct arch_hw_breakpoint *info = counter_arch_bp(bp); struct arch_hw_breakpoint *info = counter_arch_bp(bp);
unsigned int align; unsigned int align;
...@@ -270,15 +260,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp, ...@@ -270,15 +260,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
if (info->address & align) if (info->address & align)
return -EINVAL; return -EINVAL;
/* Check that the virtual address is in the proper range */
if (tsk) {
if (!arch_check_va_in_userspace(info->address, info->len))
return -EFAULT;
} else {
if (!arch_check_va_in_kernelspace(info->address, info->len))
return -EFAULT;
}
return 0; return 0;
} }
...@@ -363,8 +344,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args) ...@@ -363,8 +344,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
perf_bp_event(bp, args->regs); perf_bp_event(bp, args->regs);
/* Deliver the signal to userspace */ /* Deliver the signal to userspace */
if (arch_check_va_in_userspace(bp->attr.bp_addr, if (!arch_check_bp_in_kernelspace(bp)) {
bp->attr.bp_len)) {
siginfo_t info; siginfo_t info;
info.si_signo = args->signr; info.si_signo = args->signr;
......
...@@ -85,7 +85,7 @@ static int set_single_step(struct task_struct *tsk, unsigned long addr) ...@@ -85,7 +85,7 @@ static int set_single_step(struct task_struct *tsk, unsigned long addr)
bp = thread->ptrace_bps[0]; bp = thread->ptrace_bps[0];
if (!bp) { if (!bp) {
hw_breakpoint_init(&attr); ptrace_breakpoint_init(&attr);
attr.bp_addr = addr; attr.bp_addr = addr;
attr.bp_len = HW_BREAKPOINT_LEN_2; attr.bp_len = HW_BREAKPOINT_LEN_2;
......
...@@ -53,11 +53,15 @@ config X86 ...@@ -53,11 +53,15 @@ config X86
select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO select HAVE_KERNEL_LZO
select HAVE_HW_BREAKPOINT select HAVE_HW_BREAKPOINT
select HAVE_MIXED_BREAKPOINTS_REGS
select PERF_EVENTS select PERF_EVENTS
select ANON_INODES select ANON_INODES
select HAVE_ARCH_KMEMCHECK select HAVE_ARCH_KMEMCHECK
select HAVE_USER_RETURN_NOTIFIER select HAVE_USER_RETURN_NOTIFIER
config INSTRUCTION_DECODER
def_bool (KPROBES || PERF_EVENTS)
config OUTPUT_FORMAT config OUTPUT_FORMAT
string string
default "elf32-i386" if X86_32 default "elf32-i386" if X86_32
......
...@@ -502,23 +502,3 @@ config CPU_SUP_UMC_32 ...@@ -502,23 +502,3 @@ config CPU_SUP_UMC_32
CPU might render the kernel unbootable. CPU might render the kernel unbootable.
If unsure, say N. If unsure, say N.
config X86_DS
def_bool X86_PTRACE_BTS
depends on X86_DEBUGCTLMSR
select HAVE_HW_BRANCH_TRACER
config X86_PTRACE_BTS
bool "Branch Trace Store"
default y
depends on X86_DEBUGCTLMSR
depends on BROKEN
---help---
This adds a ptrace interface to the hardware's branch trace store.
Debuggers may use it to collect an execution trace of the debugged
application in order to answer the question 'how did I get here?'.
Debuggers may trace user mode as well as kernel mode.
Say Y unless there is no application development on this machine
and you want to save a small amount of code size.
...@@ -174,15 +174,6 @@ config IOMMU_LEAK ...@@ -174,15 +174,6 @@ config IOMMU_LEAK
Add a simple leak tracer to the IOMMU code. This is useful when you Add a simple leak tracer to the IOMMU code. This is useful when you
are debugging a buggy device driver that leaks IOMMU mappings. are debugging a buggy device driver that leaks IOMMU mappings.
config X86_DS_SELFTEST
bool "DS selftest"
default y
depends on DEBUG_KERNEL
depends on X86_DS
---help---
Perform Debug Store selftests at boot time.
If in doubt, say "N".
config HAVE_MMIOTRACE_SUPPORT config HAVE_MMIOTRACE_SUPPORT
def_bool y def_bool y
......
...@@ -373,6 +373,7 @@ extern atomic_t init_deasserted; ...@@ -373,6 +373,7 @@ extern atomic_t init_deasserted;
extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip); extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip);
#endif #endif
#ifdef CONFIG_X86_LOCAL_APIC
static inline u32 apic_read(u32 reg) static inline u32 apic_read(u32 reg)
{ {
return apic->read(reg); return apic->read(reg);
...@@ -403,10 +404,19 @@ static inline u32 safe_apic_wait_icr_idle(void) ...@@ -403,10 +404,19 @@ static inline u32 safe_apic_wait_icr_idle(void)
return apic->safe_wait_icr_idle(); return apic->safe_wait_icr_idle();
} }
#else /* CONFIG_X86_LOCAL_APIC */
static inline u32 apic_read(u32 reg) { return 0; }
static inline void apic_write(u32 reg, u32 val) { }
static inline u64 apic_icr_read(void) { return 0; }
static inline void apic_icr_write(u32 low, u32 high) { }
static inline void apic_wait_icr_idle(void) { }
static inline u32 safe_apic_wait_icr_idle(void) { return 0; }
#endif /* CONFIG_X86_LOCAL_APIC */
static inline void ack_APIC_irq(void) static inline void ack_APIC_irq(void)
{ {
#ifdef CONFIG_X86_LOCAL_APIC
/* /*
* ack_APIC_irq() actually gets compiled as a single instruction * ack_APIC_irq() actually gets compiled as a single instruction
* ... yummie. * ... yummie.
...@@ -414,7 +424,6 @@ static inline void ack_APIC_irq(void) ...@@ -414,7 +424,6 @@ static inline void ack_APIC_irq(void)
/* Docs say use 0 for future compatibility */ /* Docs say use 0 for future compatibility */
apic_write(APIC_EOI, 0); apic_write(APIC_EOI, 0);
#endif
} }
static inline unsigned default_get_apic_id(unsigned long x) static inline unsigned default_get_apic_id(unsigned long x)
......
/*
* Debug Store (DS) support
*
* This provides a low-level interface to the hardware's Debug Store
* feature that is used for branch trace store (BTS) and
* precise-event based sampling (PEBS).
*
* It manages:
* - DS and BTS hardware configuration
* - buffer overflow handling (to be done)
* - buffer access
*
* It does not do:
* - security checking (is the caller allowed to trace the task)
* - buffer allocation (memory accounting)
*
*
* Copyright (C) 2007-2009 Intel Corporation.
* Markus Metzger <markus.t.metzger@intel.com>, 2007-2009
*/
#ifndef _ASM_X86_DS_H
#define _ASM_X86_DS_H
#include <linux/types.h>
#include <linux/init.h>
#include <linux/err.h>
#ifdef CONFIG_X86_DS
struct task_struct;
struct ds_context;
struct ds_tracer;
struct bts_tracer;
struct pebs_tracer;
typedef void (*bts_ovfl_callback_t)(struct bts_tracer *);
typedef void (*pebs_ovfl_callback_t)(struct pebs_tracer *);
/*
* A list of features plus corresponding macros to talk about them in
* the ds_request function's flags parameter.
*
* We use the enum to index an array of corresponding control bits;
* we use the macro to index a flags bit-vector.
*/
enum ds_feature {
dsf_bts = 0,
dsf_bts_kernel,
#define BTS_KERNEL (1 << dsf_bts_kernel)
/* trace kernel-mode branches */
dsf_bts_user,
#define BTS_USER (1 << dsf_bts_user)
/* trace user-mode branches */
dsf_bts_overflow,
dsf_bts_max,
dsf_pebs = dsf_bts_max,
dsf_pebs_max,
dsf_ctl_max = dsf_pebs_max,
dsf_bts_timestamps = dsf_ctl_max,
#define BTS_TIMESTAMPS (1 << dsf_bts_timestamps)
/* add timestamps into BTS trace */
#define BTS_USER_FLAGS (BTS_KERNEL | BTS_USER | BTS_TIMESTAMPS)
};
/*
* Request BTS or PEBS
*
* Due to alignement constraints, the actual buffer may be slightly
* smaller than the requested or provided buffer.
*
* Returns a pointer to a tracer structure on success, or
* ERR_PTR(errcode) on failure.
*
* The interrupt threshold is independent from the overflow callback
* to allow users to use their own overflow interrupt handling mechanism.
*
* The function might sleep.
*
* task: the task to request recording for
* cpu: the cpu to request recording for
* base: the base pointer for the (non-pageable) buffer;
* size: the size of the provided buffer in bytes
* ovfl: pointer to a function to be called on buffer overflow;
* NULL if cyclic buffer requested
* th: the interrupt threshold in records from the end of the buffer;
* -1 if no interrupt threshold is requested.
* flags: a bit-mask of the above flags
*/
extern struct bts_tracer *ds_request_bts_task(struct task_struct *task,
void *base, size_t size,
bts_ovfl_callback_t ovfl,
size_t th, unsigned int flags);
extern struct bts_tracer *ds_request_bts_cpu(int cpu, void *base, size_t size,
bts_ovfl_callback_t ovfl,
size_t th, unsigned int flags);
extern struct pebs_tracer *ds_request_pebs_task(struct task_struct *task,
void *base, size_t size,
pebs_ovfl_callback_t ovfl,
size_t th, unsigned int flags);
extern struct pebs_tracer *ds_request_pebs_cpu(int cpu,
void *base, size_t size,
pebs_ovfl_callback_t ovfl,
size_t th, unsigned int flags);
/*
* Release BTS or PEBS resources
* Suspend and resume BTS or PEBS tracing
*
* Must be called with irq's enabled.
*
* tracer: the tracer handle returned from ds_request_~()
*/
extern void ds_release_bts(struct bts_tracer *tracer);
extern void ds_suspend_bts(struct bts_tracer *tracer);
extern void ds_resume_bts(struct bts_tracer *tracer);
extern void ds_release_pebs(struct pebs_tracer *tracer);
extern void ds_suspend_pebs(struct pebs_tracer *tracer);
extern void ds_resume_pebs(struct pebs_tracer *tracer);
/*
* Release BTS or PEBS resources
* Suspend and resume BTS or PEBS tracing
*
* Cpu tracers must call this on the traced cpu.
* Task tracers must call ds_release_~_noirq() for themselves.
*
* May be called with irq's disabled.
*
* Returns 0 if successful;
* -EPERM if the cpu tracer does not trace the current cpu.
* -EPERM if the task tracer does not trace itself.
*
* tracer: the tracer handle returned from ds_request_~()
*/
extern int ds_release_bts_noirq(struct bts_tracer *tracer);
extern int ds_suspend_bts_noirq(struct bts_tracer *tracer);
extern int ds_resume_bts_noirq(struct bts_tracer *tracer);
extern int ds_release_pebs_noirq(struct pebs_tracer *tracer);
extern int ds_suspend_pebs_noirq(struct pebs_tracer *tracer);
extern int ds_resume_pebs_noirq(struct pebs_tracer *tracer);
/*
* The raw DS buffer state as it is used for BTS and PEBS recording.
*
* This is the low-level, arch-dependent interface for working
* directly on the raw trace data.
*/
struct ds_trace {
/* the number of bts/pebs records */
size_t n;
/* the size of a bts/pebs record in bytes */
size_t size;
/* pointers into the raw buffer:
- to the first entry */
void *begin;
/* - one beyond the last entry */
void *end;
/* - one beyond the newest entry */
void *top;
/* - the interrupt threshold */
void *ith;
/* flags given on ds_request() */
unsigned int flags;
};
/*
* An arch-independent view on branch trace data.
*/
enum bts_qualifier {
bts_invalid,
#define BTS_INVALID bts_invalid
bts_branch,
#define BTS_BRANCH bts_branch
bts_task_arrives,
#define BTS_TASK_ARRIVES bts_task_arrives
bts_task_departs,
#define BTS_TASK_DEPARTS bts_task_departs
bts_qual_bit_size = 4,
bts_qual_max = (1 << bts_qual_bit_size),
};
struct bts_struct {
__u64 qualifier;
union {
/* BTS_BRANCH */
struct {
__u64 from;
__u64 to;
} lbr;
/* BTS_TASK_ARRIVES or BTS_TASK_DEPARTS */
struct {
__u64 clock;
pid_t pid;
} event;
} variant;
};
/*
* The BTS state.
*
* This gives access to the raw DS state and adds functions to provide
* an arch-independent view of the BTS data.
*/
struct bts_trace {
struct ds_trace ds;
int (*read)(struct bts_tracer *tracer, const void *at,
struct bts_struct *out);
int (*write)(struct bts_tracer *tracer, const struct bts_struct *in);
};
/*
* The PEBS state.
*
* This gives access to the raw DS state and the PEBS-specific counter
* reset value.
*/
struct pebs_trace {
struct ds_trace ds;
/* the number of valid counters in the below array */
unsigned int counters;
#define MAX_PEBS_COUNTERS 4
/* the counter reset value */
unsigned long long counter_reset[MAX_PEBS_COUNTERS];
};
/*
* Read the BTS or PEBS trace.
*
* Returns a view on the trace collected for the parameter tracer.
*
* The view remains valid as long as the traced task is not running or
* the tracer is suspended.
* Writes into the trace buffer are not reflected.
*
* tracer: the tracer handle returned from ds_request_~()
*/
extern const struct bts_trace *ds_read_bts(struct bts_tracer *tracer);
extern const struct pebs_trace *ds_read_pebs(struct pebs_tracer *tracer);
/*
* Reset the write pointer of the BTS/PEBS buffer.
*
* Returns 0 on success; -Eerrno on error
*
* tracer: the tracer handle returned from ds_request_~()
*/
extern int ds_reset_bts(struct bts_tracer *tracer);
extern int ds_reset_pebs(struct pebs_tracer *tracer);
/*
* Set the PEBS counter reset value.
*
* Returns 0 on success; -Eerrno on error
*
* tracer: the tracer handle returned from ds_request_pebs()
* counter: the index of the counter
* value: the new counter reset value
*/
extern int ds_set_pebs_reset(struct pebs_tracer *tracer,
unsigned int counter, u64 value);
/*
* Initialization
*/
struct cpuinfo_x86;
extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *);
/*
* Context switch work
*/
extern void ds_switch_to(struct task_struct *prev, struct task_struct *next);
#else /* CONFIG_X86_DS */
struct cpuinfo_x86;
static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {}
static inline void ds_switch_to(struct task_struct *prev,
struct task_struct *next) {}
#endif /* CONFIG_X86_DS */
#endif /* _ASM_X86_DS_H */
...@@ -41,12 +41,16 @@ struct arch_hw_breakpoint { ...@@ -41,12 +41,16 @@ struct arch_hw_breakpoint {
/* Total number of available HW breakpoint registers */ /* Total number of available HW breakpoint registers */
#define HBP_NUM 4 #define HBP_NUM 4
static inline int hw_breakpoint_slots(int type)
{
return HBP_NUM;
}
struct perf_event; struct perf_event;
struct pmu; struct pmu;
extern int arch_check_va_in_userspace(unsigned long va, u8 hbp_len); extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
extern int arch_validate_hwbkpt_settings(struct perf_event *bp, extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
struct task_struct *tsk);
extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
unsigned long val, void *data); unsigned long val, void *data);
......
...@@ -68,6 +68,8 @@ struct insn { ...@@ -68,6 +68,8 @@ struct insn {
const insn_byte_t *next_byte; const insn_byte_t *next_byte;
}; };
#define MAX_INSN_SIZE 16
#define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6) #define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6)
#define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3) #define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3)
#define X86_MODRM_RM(modrm) ((modrm) & 0x07) #define X86_MODRM_RM(modrm) ((modrm) & 0x07)
......
...@@ -347,6 +347,7 @@ extern void __iomem *early_ioremap(resource_size_t phys_addr, ...@@ -347,6 +347,7 @@ extern void __iomem *early_ioremap(resource_size_t phys_addr,
extern void __iomem *early_memremap(resource_size_t phys_addr, extern void __iomem *early_memremap(resource_size_t phys_addr,
unsigned long size); unsigned long size);
extern void early_iounmap(void __iomem *addr, unsigned long size); extern void early_iounmap(void __iomem *addr, unsigned long size);
extern void fixup_early_ioremap(void);
#define IO_SPACE_LIMIT 0xffff #define IO_SPACE_LIMIT 0xffff
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <asm/insn.h>
#define __ARCH_WANT_KPROBES_INSN_SLOT #define __ARCH_WANT_KPROBES_INSN_SLOT
...@@ -36,7 +37,6 @@ typedef u8 kprobe_opcode_t; ...@@ -36,7 +37,6 @@ typedef u8 kprobe_opcode_t;
#define RELATIVEJUMP_SIZE 5 #define RELATIVEJUMP_SIZE 5
#define RELATIVECALL_OPCODE 0xe8 #define RELATIVECALL_OPCODE 0xe8
#define RELATIVE_ADDR_SIZE 4 #define RELATIVE_ADDR_SIZE 4
#define MAX_INSN_SIZE 16
#define MAX_STACK_SIZE 64 #define MAX_STACK_SIZE 64
#define MIN_STACK_SIZE(ADDR) \ #define MIN_STACK_SIZE(ADDR) \
(((MAX_STACK_SIZE) < (((unsigned long)current_thread_info()) + \ (((MAX_STACK_SIZE) < (((unsigned long)current_thread_info()) + \
......
...@@ -71,11 +71,14 @@ ...@@ -71,11 +71,14 @@
#define MSR_IA32_LASTINTTOIP 0x000001de #define MSR_IA32_LASTINTTOIP 0x000001de
/* DEBUGCTLMSR bits (others vary by model): */ /* DEBUGCTLMSR bits (others vary by model): */
#define _DEBUGCTLMSR_LBR 0 /* last branch recording */ #define DEBUGCTLMSR_LBR (1UL << 0) /* last branch recording */
#define _DEBUGCTLMSR_BTF 1 /* single-step on branches */ #define DEBUGCTLMSR_BTF (1UL << 1) /* single-step on branches */
#define DEBUGCTLMSR_TR (1UL << 6)
#define DEBUGCTLMSR_LBR (1UL << _DEBUGCTLMSR_LBR) #define DEBUGCTLMSR_BTS (1UL << 7)
#define DEBUGCTLMSR_BTF (1UL << _DEBUGCTLMSR_BTF) #define DEBUGCTLMSR_BTINT (1UL << 8)
#define DEBUGCTLMSR_BTS_OFF_OS (1UL << 9)
#define DEBUGCTLMSR_BTS_OFF_USR (1UL << 10)
#define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11)
#define MSR_IA32_MC0_CTL 0x00000400 #define MSR_IA32_MC0_CTL 0x00000400
#define MSR_IA32_MC0_STATUS 0x00000401 #define MSR_IA32_MC0_STATUS 0x00000401
...@@ -359,6 +362,8 @@ ...@@ -359,6 +362,8 @@
#define MSR_P4_U2L_ESCR0 0x000003b0 #define MSR_P4_U2L_ESCR0 0x000003b0
#define MSR_P4_U2L_ESCR1 0x000003b1 #define MSR_P4_U2L_ESCR1 0x000003b1
#define MSR_P4_PEBS_MATRIX_VERT 0x000003f2
/* Intel Core-based CPU performance counters */ /* Intel Core-based CPU performance counters */
#define MSR_CORE_PERF_FIXED_CTR0 0x00000309 #define MSR_CORE_PERF_FIXED_CTR0 0x00000309
#define MSR_CORE_PERF_FIXED_CTR1 0x0000030a #define MSR_CORE_PERF_FIXED_CTR1 0x0000030a
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Performance event hw details: * Performance event hw details:
*/ */
#define X86_PMC_MAX_GENERIC 8 #define X86_PMC_MAX_GENERIC 32
#define X86_PMC_MAX_FIXED 3 #define X86_PMC_MAX_FIXED 3
#define X86_PMC_IDX_GENERIC 0 #define X86_PMC_IDX_GENERIC 0
...@@ -18,39 +18,31 @@ ...@@ -18,39 +18,31 @@
#define MSR_ARCH_PERFMON_EVENTSEL0 0x186 #define MSR_ARCH_PERFMON_EVENTSEL0 0x186
#define MSR_ARCH_PERFMON_EVENTSEL1 0x187 #define MSR_ARCH_PERFMON_EVENTSEL1 0x187
#define ARCH_PERFMON_EVENTSEL_ENABLE (1 << 22) #define ARCH_PERFMON_EVENTSEL_EVENT 0x000000FFULL
#define ARCH_PERFMON_EVENTSEL_ANY (1 << 21) #define ARCH_PERFMON_EVENTSEL_UMASK 0x0000FF00ULL
#define ARCH_PERFMON_EVENTSEL_INT (1 << 20) #define ARCH_PERFMON_EVENTSEL_USR (1ULL << 16)
#define ARCH_PERFMON_EVENTSEL_OS (1 << 17) #define ARCH_PERFMON_EVENTSEL_OS (1ULL << 17)
#define ARCH_PERFMON_EVENTSEL_USR (1 << 16) #define ARCH_PERFMON_EVENTSEL_EDGE (1ULL << 18)
#define ARCH_PERFMON_EVENTSEL_INT (1ULL << 20)
/* #define ARCH_PERFMON_EVENTSEL_ANY (1ULL << 21)
* Includes eventsel and unit mask as well: #define ARCH_PERFMON_EVENTSEL_ENABLE (1ULL << 22)
*/ #define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23)
#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL
#define INTEL_ARCH_EVTSEL_MASK 0x000000FFULL #define AMD64_EVENTSEL_EVENT \
#define INTEL_ARCH_UNIT_MASK 0x0000FF00ULL (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32))
#define INTEL_ARCH_EDGE_MASK 0x00040000ULL #define INTEL_ARCH_EVENT_MASK \
#define INTEL_ARCH_INV_MASK 0x00800000ULL (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT)
#define INTEL_ARCH_CNT_MASK 0xFF000000ULL
#define INTEL_ARCH_EVENT_MASK (INTEL_ARCH_UNIT_MASK|INTEL_ARCH_EVTSEL_MASK) #define X86_RAW_EVENT_MASK \
(ARCH_PERFMON_EVENTSEL_EVENT | \
/* ARCH_PERFMON_EVENTSEL_UMASK | \
* filter mask to validate fixed counter events. ARCH_PERFMON_EVENTSEL_EDGE | \
* the following filters disqualify for fixed counters: ARCH_PERFMON_EVENTSEL_INV | \
* - inv ARCH_PERFMON_EVENTSEL_CMASK)
* - edge #define AMD64_RAW_EVENT_MASK \
* - cnt-mask (X86_RAW_EVENT_MASK | \
* The other filters are supported by fixed counters. AMD64_EVENTSEL_EVENT)
* The any-thread option is supported starting with v3.
*/
#define INTEL_ARCH_FIXED_MASK \
(INTEL_ARCH_CNT_MASK| \
INTEL_ARCH_INV_MASK| \
INTEL_ARCH_EDGE_MASK|\
INTEL_ARCH_UNIT_MASK|\
INTEL_ARCH_EVENT_MASK)
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
...@@ -67,7 +59,7 @@ ...@@ -67,7 +59,7 @@
union cpuid10_eax { union cpuid10_eax {
struct { struct {
unsigned int version_id:8; unsigned int version_id:8;
unsigned int num_events:8; unsigned int num_counters:8;
unsigned int bit_width:8; unsigned int bit_width:8;
unsigned int mask_length:8; unsigned int mask_length:8;
} split; } split;
...@@ -76,7 +68,7 @@ union cpuid10_eax { ...@@ -76,7 +68,7 @@ union cpuid10_eax {
union cpuid10_edx { union cpuid10_edx {
struct { struct {
unsigned int num_events_fixed:4; unsigned int num_counters_fixed:4;
unsigned int reserved:28; unsigned int reserved:28;
} split; } split;
unsigned int full; unsigned int full;
...@@ -136,6 +128,18 @@ extern void perf_events_lapic_init(void); ...@@ -136,6 +128,18 @@ extern void perf_events_lapic_init(void);
#define PERF_EVENT_INDEX_OFFSET 0 #define PERF_EVENT_INDEX_OFFSET 0
/*
* Abuse bit 3 of the cpu eflags register to indicate proper PEBS IP fixups.
* This flag is otherwise unused and ABI specified to be 0, so nobody should
* care what we do with it.
*/
#define PERF_EFLAGS_EXACT (1UL << 3)
struct pt_regs;
extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
extern unsigned long perf_misc_flags(struct pt_regs *regs);
#define perf_misc_flags(regs) perf_misc_flags(regs)
#else #else
static inline void init_hw_perf_events(void) { } static inline void init_hw_perf_events(void) { }
static inline void perf_events_lapic_init(void) { } static inline void perf_events_lapic_init(void) { }
......
This diff is collapsed.
...@@ -21,7 +21,6 @@ struct mm_struct; ...@@ -21,7 +21,6 @@ struct mm_struct;
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/desc_defs.h> #include <asm/desc_defs.h>
#include <asm/nops.h> #include <asm/nops.h>
#include <asm/ds.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
...@@ -29,6 +28,7 @@ struct mm_struct; ...@@ -29,6 +28,7 @@ struct mm_struct;
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/math64.h> #include <linux/math64.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/err.h>
#define HBP_NUM 4 #define HBP_NUM 4
/* /*
...@@ -473,10 +473,6 @@ struct thread_struct { ...@@ -473,10 +473,6 @@ struct thread_struct {
unsigned long iopl; unsigned long iopl;
/* Max allowed port in the bitmap, in bytes: */ /* Max allowed port in the bitmap, in bytes: */
unsigned io_bitmap_max; unsigned io_bitmap_max;
/* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */
unsigned long debugctlmsr;
/* Debug Store context; see asm/ds.h */
struct ds_context *ds_ctx;
}; };
static inline unsigned long native_get_debugreg(int regno) static inline unsigned long native_get_debugreg(int regno)
...@@ -803,7 +799,7 @@ extern void cpu_init(void); ...@@ -803,7 +799,7 @@ extern void cpu_init(void);
static inline unsigned long get_debugctlmsr(void) static inline unsigned long get_debugctlmsr(void)
{ {
unsigned long debugctlmsr = 0; unsigned long debugctlmsr = 0;
#ifndef CONFIG_X86_DEBUGCTLMSR #ifndef CONFIG_X86_DEBUGCTLMSR
if (boot_cpu_data.x86 < 6) if (boot_cpu_data.x86 < 6)
...@@ -811,21 +807,6 @@ static inline unsigned long get_debugctlmsr(void) ...@@ -811,21 +807,6 @@ static inline unsigned long get_debugctlmsr(void)
#endif #endif
rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
return debugctlmsr;
}
static inline unsigned long get_debugctlmsr_on_cpu(int cpu)
{
u64 debugctlmsr = 0;
u32 val1, val2;
#ifndef CONFIG_X86_DEBUGCTLMSR
if (boot_cpu_data.x86 < 6)
return 0;
#endif
rdmsr_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, &val1, &val2);
debugctlmsr = val1 | ((u64)val2 << 32);
return debugctlmsr; return debugctlmsr;
} }
...@@ -838,18 +819,6 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr) ...@@ -838,18 +819,6 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr)
wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
} }
static inline void update_debugctlmsr_on_cpu(int cpu,
unsigned long debugctlmsr)
{
#ifndef CONFIG_X86_DEBUGCTLMSR
if (boot_cpu_data.x86 < 6)
return;
#endif
wrmsr_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR,
(u32)((u64)debugctlmsr),
(u32)((u64)debugctlmsr >> 32));
}
/* /*
* from system description table in BIOS. Mostly for MCA use, but * from system description table in BIOS. Mostly for MCA use, but
* others may find it useful: * others may find it useful:
......
...@@ -82,61 +82,6 @@ ...@@ -82,61 +82,6 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/types.h> #include <linux/types.h>
#endif
/* configuration/status structure used in PTRACE_BTS_CONFIG and
PTRACE_BTS_STATUS commands.
*/
struct ptrace_bts_config {
/* requested or actual size of BTS buffer in bytes */
__u32 size;
/* bitmask of below flags */
__u32 flags;
/* buffer overflow signal */
__u32 signal;
/* actual size of bts_struct in bytes */
__u32 bts_size;
};
#endif /* __ASSEMBLY__ */
#define PTRACE_BTS_O_TRACE 0x1 /* branch trace */
#define PTRACE_BTS_O_SCHED 0x2 /* scheduling events w/ jiffies */
#define PTRACE_BTS_O_SIGNAL 0x4 /* send SIG<signal> on buffer overflow
instead of wrapping around */
#define PTRACE_BTS_O_ALLOC 0x8 /* (re)allocate buffer */
#define PTRACE_BTS_CONFIG 40
/* Configure branch trace recording.
ADDR points to a struct ptrace_bts_config.
DATA gives the size of that buffer.
A new buffer is allocated, if requested in the flags.
An overflow signal may only be requested for new buffers.
Returns the number of bytes read.
*/
#define PTRACE_BTS_STATUS 41
/* Return the current configuration in a struct ptrace_bts_config
pointed to by ADDR; DATA gives the size of that buffer.
Returns the number of bytes written.
*/
#define PTRACE_BTS_SIZE 42
/* Return the number of available BTS records for draining.
DATA and ADDR are ignored.
*/
#define PTRACE_BTS_GET 43
/* Get a single BTS record.
DATA defines the index into the BTS array, where 0 is the newest
entry, and higher indices refer to older entries.
ADDR is pointing to struct bts_struct (see asm/ds.h).
*/
#define PTRACE_BTS_CLEAR 44
/* Clear the BTS buffer.
DATA and ADDR are ignored.
*/
#define PTRACE_BTS_DRAIN 45
/* Read all available BTS records and clear the buffer.
ADDR points to an array of struct bts_struct.
DATA gives the size of that buffer.
BTS records are read from oldest to newest.
Returns number of BTS records drained.
*/
#endif /* _ASM_X86_PTRACE_ABI_H */ #endif /* _ASM_X86_PTRACE_ABI_H */
...@@ -289,12 +289,6 @@ extern int do_get_thread_area(struct task_struct *p, int idx, ...@@ -289,12 +289,6 @@ extern int do_get_thread_area(struct task_struct *p, int idx,
extern int do_set_thread_area(struct task_struct *p, int idx, extern int do_set_thread_area(struct task_struct *p, int idx,
struct user_desc __user *info, int can_allocate); struct user_desc __user *info, int can_allocate);
#ifdef CONFIG_X86_PTRACE_BTS
extern void ptrace_bts_untrace(struct task_struct *tsk);
#define arch_ptrace_untrace(tsk) ptrace_bts_untrace(tsk)
#endif /* CONFIG_X86_PTRACE_BTS */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
......
...@@ -92,8 +92,7 @@ struct thread_info { ...@@ -92,8 +92,7 @@ struct thread_info {
#define TIF_IO_BITMAP 22 /* uses I/O bitmap */ #define TIF_IO_BITMAP 22 /* uses I/O bitmap */
#define TIF_FREEZE 23 /* is freezing for suspend */ #define TIF_FREEZE 23 /* is freezing for suspend */
#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */
#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */ #define TIF_BLOCKSTEP 25 /* set when we want DEBUGCTLMSR_BTF */
#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */
#define TIF_LAZY_MMU_UPDATES 27 /* task is updating the mmu lazily */ #define TIF_LAZY_MMU_UPDATES 27 /* task is updating the mmu lazily */
#define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */ #define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */
...@@ -115,8 +114,7 @@ struct thread_info { ...@@ -115,8 +114,7 @@ struct thread_info {
#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
#define _TIF_FREEZE (1 << TIF_FREEZE) #define _TIF_FREEZE (1 << TIF_FREEZE)
#define _TIF_FORCED_TF (1 << TIF_FORCED_TF) #define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR) #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR)
#define _TIF_LAZY_MMU_UPDATES (1 << TIF_LAZY_MMU_UPDATES) #define _TIF_LAZY_MMU_UPDATES (1 << TIF_LAZY_MMU_UPDATES)
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
...@@ -147,7 +145,7 @@ struct thread_info { ...@@ -147,7 +145,7 @@ struct thread_info {
/* flags to check in __switch_to() */ /* flags to check in __switch_to() */
#define _TIF_WORK_CTXSW \ #define _TIF_WORK_CTXSW \
(_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_NOTSC) (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP)
#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
......
...@@ -47,8 +47,6 @@ obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o ...@@ -47,8 +47,6 @@ obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
obj-y += process.o obj-y += process.o
obj-y += i387.o xsave.o obj-y += i387.o xsave.o
obj-y += ptrace.o obj-y += ptrace.o
obj-$(CONFIG_X86_DS) += ds.o
obj-$(CONFIG_X86_DS_SELFTEST) += ds_selftest.o
obj-$(CONFIG_X86_32) += tls.o obj-$(CONFIG_X86_32) += tls.o
obj-$(CONFIG_IA32_EMULATION) += tls.o obj-$(CONFIG_IA32_EMULATION) += tls.o
obj-y += step.o obj-y += step.o
......
...@@ -2545,6 +2545,9 @@ void irq_force_complete_move(int irq) ...@@ -2545,6 +2545,9 @@ void irq_force_complete_move(int irq)
struct irq_desc *desc = irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(irq);
struct irq_cfg *cfg = desc->chip_data; struct irq_cfg *cfg = desc->chip_data;
if (!cfg)
return;
__irq_complete_move(&desc, cfg->vector); __irq_complete_move(&desc, cfg->vector);
} }
#else #else
......
...@@ -929,7 +929,8 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, ...@@ -929,7 +929,8 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
powernow_table[i].index = index; powernow_table[i].index = index;
/* Frequency may be rounded for these */ /* Frequency may be rounded for these */
if (boot_cpu_data.x86 == 0x10 || boot_cpu_data.x86 == 0x11) { if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
|| boot_cpu_data.x86 == 0x11) {
powernow_table[i].frequency = powernow_table[i].frequency =
freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7); freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7);
} else } else
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/ds.h>
#include <asm/bugs.h> #include <asm/bugs.h>
#include <asm/cpu.h> #include <asm/cpu.h>
...@@ -388,7 +387,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) ...@@ -388,7 +387,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_BTS); set_cpu_cap(c, X86_FEATURE_BTS);
if (!(l1 & (1<<12))) if (!(l1 & (1<<12)))
set_cpu_cap(c, X86_FEATURE_PEBS); set_cpu_cap(c, X86_FEATURE_PEBS);
ds_init_intel(c);
} }
if (c->x86 == 6 && c->x86_model == 29 && cpu_has_clflush) if (c->x86 == 6 && c->x86_model == 29 && cpu_has_clflush)
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
static DEFINE_RAW_SPINLOCK(amd_nb_lock); static DEFINE_RAW_SPINLOCK(amd_nb_lock);
static __initconst u64 amd_hw_cache_event_ids static __initconst const u64 amd_hw_cache_event_ids
[PERF_COUNT_HW_CACHE_MAX] [PERF_COUNT_HW_CACHE_MAX]
[PERF_COUNT_HW_CACHE_OP_MAX] [PERF_COUNT_HW_CACHE_OP_MAX]
[PERF_COUNT_HW_CACHE_RESULT_MAX] = [PERF_COUNT_HW_CACHE_RESULT_MAX] =
...@@ -111,22 +111,19 @@ static u64 amd_pmu_event_map(int hw_event) ...@@ -111,22 +111,19 @@ static u64 amd_pmu_event_map(int hw_event)
return amd_perfmon_event_map[hw_event]; return amd_perfmon_event_map[hw_event];
} }
static u64 amd_pmu_raw_event(u64 hw_event) static int amd_pmu_hw_config(struct perf_event *event)
{ {
#define K7_EVNTSEL_EVENT_MASK 0xF000000FFULL int ret = x86_pmu_hw_config(event);
#define K7_EVNTSEL_UNIT_MASK 0x00000FF00ULL
#define K7_EVNTSEL_EDGE_MASK 0x000040000ULL if (ret)
#define K7_EVNTSEL_INV_MASK 0x000800000ULL return ret;
#define K7_EVNTSEL_REG_MASK 0x0FF000000ULL
if (event->attr.type != PERF_TYPE_RAW)
#define K7_EVNTSEL_MASK \ return 0;
(K7_EVNTSEL_EVENT_MASK | \
K7_EVNTSEL_UNIT_MASK | \ event->hw.config |= event->attr.config & AMD64_RAW_EVENT_MASK;
K7_EVNTSEL_EDGE_MASK | \
K7_EVNTSEL_INV_MASK | \ return 0;
K7_EVNTSEL_REG_MASK)
return hw_event & K7_EVNTSEL_MASK;
} }
/* /*
...@@ -165,7 +162,7 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc, ...@@ -165,7 +162,7 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
* be removed on one CPU at a time AND PMU is disabled * be removed on one CPU at a time AND PMU is disabled
* when we come here * when we come here
*/ */
for (i = 0; i < x86_pmu.num_events; i++) { for (i = 0; i < x86_pmu.num_counters; i++) {
if (nb->owners[i] == event) { if (nb->owners[i] == event) {
cmpxchg(nb->owners+i, event, NULL); cmpxchg(nb->owners+i, event, NULL);
break; break;
...@@ -215,7 +212,7 @@ amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) ...@@ -215,7 +212,7 @@ amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
struct amd_nb *nb = cpuc->amd_nb; struct amd_nb *nb = cpuc->amd_nb;
struct perf_event *old = NULL; struct perf_event *old = NULL;
int max = x86_pmu.num_events; int max = x86_pmu.num_counters;
int i, j, k = -1; int i, j, k = -1;
/* /*
...@@ -293,7 +290,7 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id) ...@@ -293,7 +290,7 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
/* /*
* initialize all possible NB constraints * initialize all possible NB constraints
*/ */
for (i = 0; i < x86_pmu.num_events; i++) { for (i = 0; i < x86_pmu.num_counters; i++) {
__set_bit(i, nb->event_constraints[i].idxmsk); __set_bit(i, nb->event_constraints[i].idxmsk);
nb->event_constraints[i].weight = 1; nb->event_constraints[i].weight = 1;
} }
...@@ -371,21 +368,22 @@ static void amd_pmu_cpu_dead(int cpu) ...@@ -371,21 +368,22 @@ static void amd_pmu_cpu_dead(int cpu)
raw_spin_unlock(&amd_nb_lock); raw_spin_unlock(&amd_nb_lock);
} }
static __initconst struct x86_pmu amd_pmu = { static __initconst const struct x86_pmu amd_pmu = {
.name = "AMD", .name = "AMD",
.handle_irq = x86_pmu_handle_irq, .handle_irq = x86_pmu_handle_irq,
.disable_all = x86_pmu_disable_all, .disable_all = x86_pmu_disable_all,
.enable_all = x86_pmu_enable_all, .enable_all = x86_pmu_enable_all,
.enable = x86_pmu_enable_event, .enable = x86_pmu_enable_event,
.disable = x86_pmu_disable_event, .disable = x86_pmu_disable_event,
.hw_config = amd_pmu_hw_config,
.schedule_events = x86_schedule_events,
.eventsel = MSR_K7_EVNTSEL0, .eventsel = MSR_K7_EVNTSEL0,
.perfctr = MSR_K7_PERFCTR0, .perfctr = MSR_K7_PERFCTR0,
.event_map = amd_pmu_event_map, .event_map = amd_pmu_event_map,
.raw_event = amd_pmu_raw_event,
.max_events = ARRAY_SIZE(amd_perfmon_event_map), .max_events = ARRAY_SIZE(amd_perfmon_event_map),
.num_events = 4, .num_counters = 4,
.event_bits = 48, .cntval_bits = 48,
.event_mask = (1ULL << 48) - 1, .cntval_mask = (1ULL << 48) - 1,
.apic = 1, .apic = 1,
/* use highest bit to detect overflow */ /* use highest bit to detect overflow */
.max_period = (1ULL << 47) - 1, .max_period = (1ULL << 47) - 1,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -27,24 +27,6 @@ static u64 p6_pmu_event_map(int hw_event) ...@@ -27,24 +27,6 @@ static u64 p6_pmu_event_map(int hw_event)
*/ */
#define P6_NOP_EVENT 0x0000002EULL #define P6_NOP_EVENT 0x0000002EULL
static u64 p6_pmu_raw_event(u64 hw_event)
{
#define P6_EVNTSEL_EVENT_MASK 0x000000FFULL
#define P6_EVNTSEL_UNIT_MASK 0x0000FF00ULL
#define P6_EVNTSEL_EDGE_MASK 0x00040000ULL
#define P6_EVNTSEL_INV_MASK 0x00800000ULL
#define P6_EVNTSEL_REG_MASK 0xFF000000ULL
#define P6_EVNTSEL_MASK \
(P6_EVNTSEL_EVENT_MASK | \
P6_EVNTSEL_UNIT_MASK | \
P6_EVNTSEL_EDGE_MASK | \
P6_EVNTSEL_INV_MASK | \
P6_EVNTSEL_REG_MASK)
return hw_event & P6_EVNTSEL_MASK;
}
static struct event_constraint p6_event_constraints[] = static struct event_constraint p6_event_constraints[] =
{ {
INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FLOPS */ INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FLOPS */
...@@ -66,7 +48,7 @@ static void p6_pmu_disable_all(void) ...@@ -66,7 +48,7 @@ static void p6_pmu_disable_all(void)
wrmsrl(MSR_P6_EVNTSEL0, val); wrmsrl(MSR_P6_EVNTSEL0, val);
} }
static void p6_pmu_enable_all(void) static void p6_pmu_enable_all(int added)
{ {
unsigned long val; unsigned long val;
...@@ -102,22 +84,23 @@ static void p6_pmu_enable_event(struct perf_event *event) ...@@ -102,22 +84,23 @@ static void p6_pmu_enable_event(struct perf_event *event)
(void)checking_wrmsrl(hwc->config_base + hwc->idx, val); (void)checking_wrmsrl(hwc->config_base + hwc->idx, val);
} }
static __initconst struct x86_pmu p6_pmu = { static __initconst const struct x86_pmu p6_pmu = {
.name = "p6", .name = "p6",
.handle_irq = x86_pmu_handle_irq, .handle_irq = x86_pmu_handle_irq,
.disable_all = p6_pmu_disable_all, .disable_all = p6_pmu_disable_all,
.enable_all = p6_pmu_enable_all, .enable_all = p6_pmu_enable_all,
.enable = p6_pmu_enable_event, .enable = p6_pmu_enable_event,
.disable = p6_pmu_disable_event, .disable = p6_pmu_disable_event,
.hw_config = x86_pmu_hw_config,
.schedule_events = x86_schedule_events,
.eventsel = MSR_P6_EVNTSEL0, .eventsel = MSR_P6_EVNTSEL0,
.perfctr = MSR_P6_PERFCTR0, .perfctr = MSR_P6_PERFCTR0,
.event_map = p6_pmu_event_map, .event_map = p6_pmu_event_map,
.raw_event = p6_pmu_raw_event,
.max_events = ARRAY_SIZE(p6_perfmon_event_map), .max_events = ARRAY_SIZE(p6_perfmon_event_map),
.apic = 1, .apic = 1,
.max_period = (1ULL << 31) - 1, .max_period = (1ULL << 31) - 1,
.version = 0, .version = 0,
.num_events = 2, .num_counters = 2,
/* /*
* Events have 40 bits implemented. However they are designed such * Events have 40 bits implemented. However they are designed such
* that bits [32-39] are sign extensions of bit 31. As such the * that bits [32-39] are sign extensions of bit 31. As such the
...@@ -125,8 +108,8 @@ static __initconst struct x86_pmu p6_pmu = { ...@@ -125,8 +108,8 @@ static __initconst struct x86_pmu p6_pmu = {
* *
* See IA-32 Intel Architecture Software developer manual Vol 3B * See IA-32 Intel Architecture Software developer manual Vol 3B
*/ */
.event_bits = 32, .cntval_bits = 32,
.event_mask = (1ULL << 32) - 1, .cntval_mask = (1ULL << 32) - 1,
.get_event_constraints = x86_get_event_constraints, .get_event_constraints = x86_get_event_constraints,
.event_constraints = p6_event_constraints, .event_constraints = p6_event_constraints,
}; };
......
This diff is collapsed.
This diff is collapsed.
/*
* Debug Store support - selftest
*
*
* Copyright (C) 2009 Intel Corporation.
* Markus Metzger <markus.t.metzger@intel.com>, 2009
*/
#ifdef CONFIG_X86_DS_SELFTEST
extern int ds_selftest_bts(void);
extern int ds_selftest_pebs(void);
#else
static inline int ds_selftest_bts(void) { return 0; }
static inline int ds_selftest_pebs(void) { return 0; }
#endif
...@@ -224,11 +224,6 @@ unsigned __kprobes long oops_begin(void) ...@@ -224,11 +224,6 @@ unsigned __kprobes long oops_begin(void)
int cpu; int cpu;
unsigned long flags; unsigned long flags;
/* notify the hw-branch tracer so it may disable tracing and
add the last trace to the trace buffer -
the earlier this happens, the more useful the trace. */
trace_hw_branch_oops();
oops_enter(); oops_enter();
/* racy, but better than risking deadlock. */ /* racy, but better than risking deadlock. */
......
...@@ -188,26 +188,17 @@ static int get_hbp_len(u8 hbp_len) ...@@ -188,26 +188,17 @@ static int get_hbp_len(u8 hbp_len)
return len_in_bytes; return len_in_bytes;
} }
/*
* Check for virtual address in user space.
*/
int arch_check_va_in_userspace(unsigned long va, u8 hbp_len)
{
unsigned int len;
len = get_hbp_len(hbp_len);
return (va <= TASK_SIZE - len);
}
/* /*
* Check for virtual address in kernel space. * Check for virtual address in kernel space.
*/ */
static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len) int arch_check_bp_in_kernelspace(struct perf_event *bp)
{ {
unsigned int len; unsigned int len;
unsigned long va;
struct arch_hw_breakpoint *info = counter_arch_bp(bp);
len = get_hbp_len(hbp_len); va = info->address;
len = get_hbp_len(info->len);
return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE); return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
} }
...@@ -300,8 +291,7 @@ static int arch_build_bp_info(struct perf_event *bp) ...@@ -300,8 +291,7 @@ static int arch_build_bp_info(struct perf_event *bp)
/* /*
* Validate the arch-specific HW Breakpoint register settings * Validate the arch-specific HW Breakpoint register settings
*/ */
int arch_validate_hwbkpt_settings(struct perf_event *bp, int arch_validate_hwbkpt_settings(struct perf_event *bp)
struct task_struct *tsk)
{ {
struct arch_hw_breakpoint *info = counter_arch_bp(bp); struct arch_hw_breakpoint *info = counter_arch_bp(bp);
unsigned int align; unsigned int align;
...@@ -314,16 +304,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp, ...@@ -314,16 +304,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
ret = -EINVAL; ret = -EINVAL;
if (info->type == X86_BREAKPOINT_EXECUTE)
/*
* Ptrace-refactoring code
* For now, we'll allow instruction breakpoint only for user-space
* addresses
*/
if ((!arch_check_va_in_userspace(info->address, info->len)) &&
info->len != X86_BREAKPOINT_EXECUTE)
return ret;
switch (info->len) { switch (info->len) {
case X86_BREAKPOINT_LEN_1: case X86_BREAKPOINT_LEN_1:
align = 0; align = 0;
...@@ -350,15 +330,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp, ...@@ -350,15 +330,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
if (info->address & align) if (info->address & align)
return -EINVAL; return -EINVAL;
/* Check that the virtual address is in the proper range */
if (tsk) {
if (!arch_check_va_in_userspace(info->address, info->len))
return -EFAULT;
} else {
if (!arch_check_va_in_kernelspace(info->address, info->len))
return -EFAULT;
}
return 0; return 0;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/idle.h> #include <asm/idle.h>
#include <asm/syscalls.h> #include <asm/syscalls.h>
#include <asm/ds.h>
#include <asm/debugreg.h> #include <asm/debugreg.h>
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
...@@ -238,13 +237,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, ...@@ -238,13 +237,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
kfree(p->thread.io_bitmap_ptr); kfree(p->thread.io_bitmap_ptr);
p->thread.io_bitmap_max = 0; p->thread.io_bitmap_max = 0;
} }
clear_tsk_thread_flag(p, TIF_DS_AREA_MSR);
p->thread.ds_ctx = NULL;
clear_tsk_thread_flag(p, TIF_DEBUGCTLMSR);
p->thread.debugctlmsr = 0;
return err; return err;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment