18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2014, Michael Ellerman, IBM Corp.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __SELFTESTS_POWERPC_PMU_LIB_H
78c2ecf20Sopenharmony_ci#define __SELFTESTS_POWERPC_PMU_LIB_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <stdbool.h>
108c2ecf20Sopenharmony_ci#include <stdio.h>
118c2ecf20Sopenharmony_ci#include <stdint.h>
128c2ecf20Sopenharmony_ci#include <string.h>
138c2ecf20Sopenharmony_ci#include <unistd.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciunion pipe {
168c2ecf20Sopenharmony_ci	struct {
178c2ecf20Sopenharmony_ci		int read_fd;
188c2ecf20Sopenharmony_ci		int write_fd;
198c2ecf20Sopenharmony_ci	};
208c2ecf20Sopenharmony_ci	int fds[2];
218c2ecf20Sopenharmony_ci};
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciextern int bind_to_cpu(int cpu);
248c2ecf20Sopenharmony_ciextern int kill_child_and_wait(pid_t child_pid);
258c2ecf20Sopenharmony_ciextern int wait_for_child(pid_t child_pid);
268c2ecf20Sopenharmony_ciextern int sync_with_child(union pipe read_pipe, union pipe write_pipe);
278c2ecf20Sopenharmony_ciextern int wait_for_parent(union pipe read_pipe);
288c2ecf20Sopenharmony_ciextern int notify_parent(union pipe write_pipe);
298c2ecf20Sopenharmony_ciextern int notify_parent_of_error(union pipe write_pipe);
308c2ecf20Sopenharmony_ciextern pid_t eat_cpu(int (test_function)(void));
318c2ecf20Sopenharmony_ciextern bool require_paranoia_below(int level);
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct addr_range {
348c2ecf20Sopenharmony_ci	uint64_t first, last;
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciextern struct addr_range libc, vdso;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciint parse_proc_maps(void);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif /* __SELFTESTS_POWERPC_PMU_LIB_H */
42