18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * S390 Version
48c2ecf20Sopenharmony_ci *   Copyright IBM Corp. 2002, 2011
58c2ecf20Sopenharmony_ci *   Author(s): Thomas Spatzier (tspat@de.ibm.com)
68c2ecf20Sopenharmony_ci *   Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com)
78c2ecf20Sopenharmony_ci *   Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com)
88c2ecf20Sopenharmony_ci *   Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com)
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * @remark Copyright 2002-2011 OProfile authors
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/oprofile.h>
148c2ecf20Sopenharmony_ci#include <linux/init.h>
158c2ecf20Sopenharmony_ci#include <asm/processor.h>
168c2ecf20Sopenharmony_ci#include <asm/unwind.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistatic void s390_backtrace(struct pt_regs *regs, unsigned int depth)
198c2ecf20Sopenharmony_ci{
208c2ecf20Sopenharmony_ci	struct unwind_state state;
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	unwind_for_each_frame(&state, current, regs, 0) {
238c2ecf20Sopenharmony_ci		if (depth-- == 0)
248c2ecf20Sopenharmony_ci			break;
258c2ecf20Sopenharmony_ci		oprofile_add_trace(state.ip);
268c2ecf20Sopenharmony_ci	}
278c2ecf20Sopenharmony_ci}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciint __init oprofile_arch_init(struct oprofile_operations *ops)
308c2ecf20Sopenharmony_ci{
318c2ecf20Sopenharmony_ci	ops->backtrace = s390_backtrace;
328c2ecf20Sopenharmony_ci	return 0;
338c2ecf20Sopenharmony_ci}
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_civoid oprofile_arch_exit(void)
368c2ecf20Sopenharmony_ci{
378c2ecf20Sopenharmony_ci}
38