PageRenderTime 21ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/arch/powerpc/include/asm/kvm_para.h

http://github.com/mirrors/linux
C Header | 63 lines | 39 code | 17 blank | 7 comment | 4 complexity | 051985a7efbc9ad7ad26f2e765081589 MD5 | raw file
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 *
 4 * Copyright IBM Corp. 2008
 5 *
 6 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
 7 */
 8#ifndef __POWERPC_KVM_PARA_H__
 9#define __POWERPC_KVM_PARA_H__
10
11#include <uapi/asm/kvm_para.h>
12
13#ifdef CONFIG_KVM_GUEST
14
15#include <linux/of.h>
16
17static inline int kvm_para_available(void)
18{
19	struct device_node *hyper_node;
20
21	hyper_node = of_find_node_by_path("/hypervisor");
22	if (!hyper_node)
23		return 0;
24
25	if (!of_device_is_compatible(hyper_node, "linux,kvm"))
26		return 0;
27
28	return 1;
29}
30
31#else
32
33static inline int kvm_para_available(void)
34{
35	return 0;
36}
37
38#endif
39
40static inline unsigned int kvm_arch_para_features(void)
41{
42	unsigned long r;
43
44	if (!kvm_para_available())
45		return 0;
46
47	if(epapr_hypercall0_1(KVM_HCALL_TOKEN(KVM_HC_FEATURES), &r))
48		return 0;
49
50	return r;
51}
52
53static inline unsigned int kvm_arch_para_hints(void)
54{
55	return 0;
56}
57
58static inline bool kvm_check_and_clear_guest_paused(void)
59{
60	return false;
61}
62
63#endif /* __POWERPC_KVM_PARA_H__ */