1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_KVM_BOOK3S_UVMEM_H__
3 #define __ASM_KVM_BOOK3S_UVMEM_H__
4 
5 #ifdef CONFIG_PPC_UV
6 int kvmppc_uvmem_init(void);
7 void kvmppc_uvmem_free(void);
8 int kvmppc_uvmem_slot_init(struct kvm *kvm, const struct kvm_memory_slot *slot);
9 void kvmppc_uvmem_slot_free(struct kvm *kvm,
10 			    const struct kvm_memory_slot *slot);
11 unsigned long kvmppc_h_svm_page_in(struct kvm *kvm,
12 				   unsigned long gra,
13 				   unsigned long flags,
14 				   unsigned long page_shift);
15 unsigned long kvmppc_h_svm_page_out(struct kvm *kvm,
16 				    unsigned long gra,
17 				    unsigned long flags,
18 				    unsigned long page_shift);
19 unsigned long kvmppc_h_svm_init_start(struct kvm *kvm);
20 unsigned long kvmppc_h_svm_init_done(struct kvm *kvm);
21 int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn);
22 unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm);
23 void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
24 			     struct kvm *kvm, bool skip_page_out);
25 #else
26 static inline int kvmppc_uvmem_init(void)
27 {
28 	return 0;
29 }
30 
31 static inline void kvmppc_uvmem_free(void) { }
32 
33 static inline int
34 kvmppc_uvmem_slot_init(struct kvm *kvm, const struct kvm_memory_slot *slot)
35 {
36 	return 0;
37 }
38 
39 static inline void
40 kvmppc_uvmem_slot_free(struct kvm *kvm, const struct kvm_memory_slot *slot) { }
41 
42 static inline unsigned long
43 kvmppc_h_svm_page_in(struct kvm *kvm, unsigned long gra,
44 		     unsigned long flags, unsigned long page_shift)
45 {
46 	return H_UNSUPPORTED;
47 }
48 
49 static inline unsigned long
50 kvmppc_h_svm_page_out(struct kvm *kvm, unsigned long gra,
51 		      unsigned long flags, unsigned long page_shift)
52 {
53 	return H_UNSUPPORTED;
54 }
55 
56 static inline unsigned long kvmppc_h_svm_init_start(struct kvm *kvm)
57 {
58 	return H_UNSUPPORTED;
59 }
60 
61 static inline unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
62 {
63 	return H_UNSUPPORTED;
64 }
65 
66 static inline unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm)
67 {
68 	return H_UNSUPPORTED;
69 }
70 
71 static inline int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn)
72 {
73 	return -EFAULT;
74 }
75 
76 static inline void
77 kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
78 			struct kvm *kvm, bool skip_page_out) { }
79 #endif /* CONFIG_PPC_UV */
80 #endif /* __ASM_KVM_BOOK3S_UVMEM_H__ */
81