]>
Commit | Line | Data |
---|---|---|
d94d71cb | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
bbf45ba5 | 2 | /* |
bbf45ba5 HB |
3 | * |
4 | * Copyright IBM Corp. 2008 | |
5 | * | |
6 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> | |
7 | */ | |
bbf45ba5 HB |
8 | #ifndef __POWERPC_KVM_PARA_H__ |
9 | #define __POWERPC_KVM_PARA_H__ | |
10 | ||
c3617f72 | 11 | #include <uapi/asm/kvm_para.h> |
bbf45ba5 | 12 | |
2a342ed5 AG |
13 | #ifdef CONFIG_KVM_GUEST |
14 | ||
26e673c3 AG |
15 | #include <linux/of.h> |
16 | ||
2a342ed5 AG |
17 | static 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 | ||
2a342ed5 AG |
31 | #else |
32 | ||
bbf45ba5 HB |
33 | static inline int kvm_para_available(void) |
34 | { | |
35 | return 0; | |
36 | } | |
37 | ||
2a342ed5 AG |
38 | #endif |
39 | ||
bbf45ba5 HB |
40 | static inline unsigned int kvm_arch_para_features(void) |
41 | { | |
2a342ed5 AG |
42 | unsigned long r; |
43 | ||
44 | if (!kvm_para_available()) | |
45 | return 0; | |
46 | ||
b1f0d94c | 47 | if(epapr_hypercall0_1(KVM_HCALL_TOKEN(KVM_HC_FEATURES), &r)) |
2a342ed5 AG |
48 | return 0; |
49 | ||
50 | return r; | |
bbf45ba5 HB |
51 | } |
52 | ||
a4429e53 WL |
53 | static inline unsigned int kvm_arch_para_hints(void) |
54 | { | |
55 | return 0; | |
56 | } | |
57 | ||
3b5d56b9 EM |
58 | static inline bool kvm_check_and_clear_guest_paused(void) |
59 | { | |
60 | return false; | |
61 | } | |
62 | ||
bbf45ba5 | 63 | #endif /* __POWERPC_KVM_PARA_H__ */ |