2019-05-26 23:55:01 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2009-01-08 23:01:53 -07:00
|
|
|
/*
|
2010-02-25 17:09:45 -07:00
|
|
|
* Performance event support - hardware-specific disambiguation
|
2009-01-08 23:01:53 -07:00
|
|
|
*
|
2010-02-25 17:09:45 -07:00
|
|
|
* For now this is a compile-time decision, but eventually it should be
|
|
|
|
* runtime. This would allow multiplatform perf event support for e300 (fsl
|
|
|
|
* embedded perf counters) plus server/classic, and would accommodate
|
|
|
|
* devices other than the core which provide their own performance counters.
|
|
|
|
*
|
|
|
|
* Copyright 2010 Freescale Semiconductor, Inc.
|
2009-01-08 23:01:53 -07:00
|
|
|
*/
|
2009-06-17 04:52:09 -07:00
|
|
|
|
2009-06-17 04:50:04 -07:00
|
|
|
#ifdef CONFIG_PPC_PERF_CTRS
|
2010-02-25 17:09:45 -07:00
|
|
|
#include <asm/perf_event_server.h>
|
2020-06-14 01:36:04 -07:00
|
|
|
#else
|
|
|
|
static inline bool is_sier_available(void) { return false; }
|
2021-02-02 23:55:36 -07:00
|
|
|
static inline unsigned long get_pmcs_ext_regs(int idx) { return 0; }
|
2009-06-17 04:50:04 -07:00
|
|
|
#endif
|
|
|
|
|
2010-02-25 17:09:45 -07:00
|
|
|
#ifdef CONFIG_FSL_EMB_PERF_EVENT
|
|
|
|
#include <asm/perf_event_fsl_emb.h>
|
|
|
|
#endif
|
2010-05-19 22:47:21 -07:00
|
|
|
|
|
|
|
#ifdef CONFIG_PERF_EVENTS
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/reg.h>
|
|
|
|
|
2018-12-06 02:27:01 -07:00
|
|
|
#define perf_arch_bpf_user_pt_regs(regs) ®s->user_regs
|
|
|
|
|
2012-06-25 18:01:36 -07:00
|
|
|
/*
|
|
|
|
* Overload regs->result to specify whether we should use the MSR (result
|
|
|
|
* is zero) or the SIAR (result is non zero).
|
|
|
|
*/
|
2010-05-19 22:47:21 -07:00
|
|
|
#define perf_arch_fetch_caller_regs(regs, __ip) \
|
|
|
|
do { \
|
2012-06-25 18:01:36 -07:00
|
|
|
(regs)->result = 0; \
|
2010-05-19 22:47:21 -07:00
|
|
|
(regs)->nip = __ip; \
|
2020-02-20 04:51:37 -07:00
|
|
|
(regs)->gpr[1] = current_stack_frame(); \
|
2010-05-19 22:47:21 -07:00
|
|
|
asm volatile("mfmsr %0" : "=r" ((regs)->msr)); \
|
|
|
|
} while (0)
|
2018-12-09 02:25:35 -07:00
|
|
|
|
|
|
|
/* To support perf_regs sier update */
|
|
|
|
extern bool is_sier_available(void);
|
2021-02-02 23:55:36 -07:00
|
|
|
extern unsigned long get_pmcs_ext_regs(int idx);
|
2020-08-07 03:05:00 -07:00
|
|
|
/* To define perf extended regs mask value */
|
|
|
|
extern u64 PERF_REG_EXTENDED_MASK;
|
|
|
|
#define PERF_REG_EXTENDED_MASK PERF_REG_EXTENDED_MASK
|
2010-05-19 22:47:21 -07:00
|
|
|
#endif
|