perf/hw_breakpoint: Pass arch breakpoint struct to arch_check_bp_in_kernelspace()
[linux-2.6-block.git] / arch / sh / include / asm / hw_breakpoint.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
09a07294
PM
2#ifndef __ASM_SH_HW_BREAKPOINT_H
3#define __ASM_SH_HW_BREAKPOINT_H
4
0a9426df
DH
5#include <uapi/asm/hw_breakpoint.h>
6
09a07294
PM
7#define __ARCH_HW_BREAKPOINT_H
8
31a090ae
PM
9#include <linux/kdebug.h>
10#include <linux/types.h>
11
09a07294
PM
12struct arch_hw_breakpoint {
13 char *name; /* Contains name of the symbol to set bkpt */
14 unsigned long address;
09a07294
PM
15 u16 len;
16 u16 type;
17};
18
19enum {
20 SH_BREAKPOINT_READ = (1 << 1),
21 SH_BREAKPOINT_WRITE = (1 << 2),
22 SH_BREAKPOINT_RW = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
23
24 SH_BREAKPOINT_LEN_1 = (1 << 12),
25 SH_BREAKPOINT_LEN_2 = (1 << 13),
26 SH_BREAKPOINT_LEN_4 = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
27 SH_BREAKPOINT_LEN_8 = (1 << 14),
28};
29
4352fc1b
PM
30struct sh_ubc {
31 const char *name;
32 unsigned int num_events;
33 unsigned int trap_nr;
34 void (*enable)(struct arch_hw_breakpoint *, int);
35 void (*disable)(struct arch_hw_breakpoint *, int);
36 void (*enable_all)(unsigned long);
37 void (*disable_all)(void);
38 unsigned long (*active_mask)(void);
39 unsigned long (*triggered_mask)(void);
40 void (*clear_triggered_mask)(unsigned long);
41 struct clk *clk; /* optional interface clock / MSTP bit */
42};
09a07294
PM
43
44struct perf_event;
45struct task_struct;
46struct pmu;
47
4352fc1b
PM
48/* Maximum number of UBC channels */
49#define HBP_NUM 2
50
feef47d0
FW
51static inline int hw_breakpoint_slots(int type)
52{
53 return HBP_NUM;
54}
55
4352fc1b 56/* arch/sh/kernel/hw_breakpoint.c */
8e983ff9 57extern int arch_check_bp_in_kernelspace(struct arch_hw_breakpoint *hw);
b2812d03 58extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
09a07294
PM
59extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
60 unsigned long val, void *data);
61
62int arch_install_hw_breakpoint(struct perf_event *bp);
63void arch_uninstall_hw_breakpoint(struct perf_event *bp);
64void hw_breakpoint_pmu_read(struct perf_event *bp);
09a07294
PM
65
66extern void arch_fill_perf_breakpoint(struct perf_event *bp);
4352fc1b 67extern int register_sh_ubc(struct sh_ubc *);
09a07294
PM
68
69extern struct pmu perf_ops_bp;
70
09a07294 71#endif /* __ASM_SH_HW_BREAKPOINT_H */