Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2001-2003 Hewlett-Packard Co
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *               Stephane Eranian <eranian@hpl.hp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef _ASM_IA64_PERFMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define _ASM_IA64_PERFMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <uapi/asm/perfmon.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) extern long perfmonctl(int fd, int cmd, void *arg, int narg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	void (*handler)(int irq, void *arg, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) } pfm_intr_handler_desc_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) extern void pfm_save_regs (struct task_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) extern void pfm_load_regs (struct task_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) extern void pfm_exit_thread(struct task_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) extern int  pfm_use_debug_registers(struct task_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) extern int  pfm_release_debug_registers(struct task_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) extern void pfm_syst_wide_update_task(struct task_struct *, unsigned long info, int is_ctxswin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) extern void pfm_inherit(struct task_struct *task, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) extern void pfm_init_percpu(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) extern void pfm_handle_work(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) extern int  pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *h);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) extern int  pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *h);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * Reset PMD register flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define PFM_PMD_SHORT_RESET	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define PFM_PMD_LONG_RESET	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) typedef union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	unsigned int val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		unsigned int notify_user:1;	/* notify user program of overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		unsigned int reset_ovfl_pmds:1;	/* reset overflowed PMDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		unsigned int block_task:1;	/* block monitored task on kernel exit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		unsigned int mask_monitoring:1; /* mask monitors via PMCx.plm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		unsigned int reserved:28;	/* for future use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	} bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) } pfm_ovfl_ctrl_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	unsigned char	ovfl_pmd;			/* index of overflowed PMD  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	unsigned char   ovfl_notify;			/* =1 if monitor requested overflow notification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	unsigned short  active_set;			/* event set active at the time of the overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	pfm_ovfl_ctrl_t ovfl_ctrl;			/* return: perfmon controls to set by handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	unsigned long   pmd_last_reset;			/* last reset value of of the PMD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	unsigned long	smpl_pmds[4];			/* bitmask of other PMD of interest on overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	unsigned long   smpl_pmds_values[PMU_MAX_PMDS]; /* values for the other PMDs of interest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	unsigned long   pmd_value;			/* current 64-bit value of the PMD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	unsigned long	pmd_eventid;			/* eventid associated with PMD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) } pfm_ovfl_arg_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	char		*fmt_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	pfm_uuid_t	fmt_uuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	size_t		fmt_arg_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	unsigned long	fmt_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	int		(*fmt_validate)(struct task_struct *task, unsigned int flags, int cpu, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	int		(*fmt_getsize)(struct task_struct *task, unsigned int flags, int cpu, void *arg, unsigned long *size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	int 		(*fmt_init)(struct task_struct *task, void *buf, unsigned int flags, int cpu, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	int		(*fmt_handler)(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, struct pt_regs *regs, unsigned long stamp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	int		(*fmt_restart)(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int		(*fmt_restart_active)(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int		(*fmt_exit)(struct task_struct *task, void *buf, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	struct list_head fmt_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) } pfm_buffer_fmt_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) extern int pfm_register_buffer_fmt(pfm_buffer_fmt_t *fmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) extern int pfm_unregister_buffer_fmt(pfm_uuid_t uuid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * perfmon interface exported to modules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) extern int pfm_mod_read_pmds(struct task_struct *, void *req, unsigned int nreq, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) extern int pfm_mod_write_pmcs(struct task_struct *, void *req, unsigned int nreq, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) extern int pfm_mod_write_ibrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) extern int pfm_mod_write_dbrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * describe the content of the local_cpu_date->pfm_syst_info field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define PFM_CPUINFO_SYST_WIDE	0x1	/* if set a system wide session exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define PFM_CPUINFO_DCR_PP	0x2	/* if set the system wide session has started */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define PFM_CPUINFO_EXCL_IDLE	0x4	/* the system wide session excludes the idle task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  * sysctl control structure. visible to sampling formats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	int	debug;		/* turn on/off debugging via syslog */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	int	debug_ovfl;	/* turn on/off debug printk in overflow handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	int	fastctxsw;	/* turn on/off fast (unsecure) ctxsw */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	int	expert_mode;	/* turn on/off value checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) } pfm_sysctl_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) extern pfm_sysctl_t pfm_sysctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #endif /* _ASM_IA64_PERFMON_H */