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 void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
23 			     struct kvm *kvm);
24 #else
25 static inline int kvmppc_uvmem_init(void)
26 {
27 	return 0;
28 }
29 
30 static inline void kvmppc_uvmem_free(void) { }
31 
32 static inline int
33 kvmppc_uvmem_slot_init(struct kvm *kvm, const struct kvm_memory_slot *slot)
34 {
35 	return 0;
36 }
37 
38 static inline void
39 kvmppc_uvmem_slot_free(struct kvm *kvm, const struct kvm_memory_slot *slot) { }
40 
41 static inline unsigned long
42 kvmppc_h_svm_page_in(struct kvm *kvm, unsigned long gra,
43 		     unsigned long flags, unsigned long page_shift)
44 {
45 	return H_UNSUPPORTED;
46 }
47 
48 static inline unsigned long
49 kvmppc_h_svm_page_out(struct kvm *kvm, unsigned long gra,
50 		      unsigned long flags, unsigned long page_shift)
51 {
52 	return H_UNSUPPORTED;
53 }
54 
55 static inline unsigned long kvmppc_h_svm_init_start(struct kvm *kvm)
56 {
57 	return H_UNSUPPORTED;
58 }
59 
60 static inline unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
61 {
62 	return H_UNSUPPORTED;
63 }
64 
65 static inline int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn)
66 {
67 	return -EFAULT;
68 }
69 
70 static inline void
71 kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
72 			struct kvm *kvm) { }
73 #endif /* CONFIG_PPC_UV */
74 #endif /* __ASM_KVM_BOOK3S_UVMEM_H__ */
75