18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2020 IBM Corporation
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_KVM_GUEST_H_
78c2ecf20Sopenharmony_ci#define _ASM_POWERPC_KVM_GUEST_H_
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_GUEST)
108c2ecf20Sopenharmony_ci#include <linux/jump_label.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciDECLARE_STATIC_KEY_FALSE(kvm_guest);
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistatic inline bool is_kvm_guest(void)
158c2ecf20Sopenharmony_ci{
168c2ecf20Sopenharmony_ci	return static_branch_unlikely(&kvm_guest);
178c2ecf20Sopenharmony_ci}
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciint check_kvm_guest(void);
208c2ecf20Sopenharmony_ci#else
218c2ecf20Sopenharmony_cistatic inline bool is_kvm_guest(void) { return false; }
228c2ecf20Sopenharmony_cistatic inline int check_kvm_guest(void) { return 0; }
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_KVM_GUEST_H_ */
26