1ca9f4942SBharata B Rao /* SPDX-License-Identifier: GPL-2.0 */
2ca9f4942SBharata B Rao #ifndef __ASM_KVM_BOOK3S_UVMEM_H__
3ca9f4942SBharata B Rao #define __ASM_KVM_BOOK3S_UVMEM_H__
4ca9f4942SBharata B Rao
5ca9f4942SBharata B Rao #ifdef CONFIG_PPC_UV
6ca9f4942SBharata B Rao int kvmppc_uvmem_init(void);
7ca9f4942SBharata B Rao void kvmppc_uvmem_free(void);
89a5788c6SPaul Mackerras bool kvmppc_uvmem_available(void);
9ca9f4942SBharata B Rao int kvmppc_uvmem_slot_init(struct kvm *kvm, const struct kvm_memory_slot *slot);
10ca9f4942SBharata B Rao void kvmppc_uvmem_slot_free(struct kvm *kvm,
11ca9f4942SBharata B Rao const struct kvm_memory_slot *slot);
12ca9f4942SBharata B Rao unsigned long kvmppc_h_svm_page_in(struct kvm *kvm,
13ca9f4942SBharata B Rao unsigned long gra,
14ca9f4942SBharata B Rao unsigned long flags,
15ca9f4942SBharata B Rao unsigned long page_shift);
16ca9f4942SBharata B Rao unsigned long kvmppc_h_svm_page_out(struct kvm *kvm,
17ca9f4942SBharata B Rao unsigned long gra,
18ca9f4942SBharata B Rao unsigned long flags,
19ca9f4942SBharata B Rao unsigned long page_shift);
20ca9f4942SBharata B Rao unsigned long kvmppc_h_svm_init_start(struct kvm *kvm);
21ca9f4942SBharata B Rao unsigned long kvmppc_h_svm_init_done(struct kvm *kvm);
22008e359cSBharata B Rao int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn);
233a43970dSSukadev Bhattiprolu unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm);
24c3262257SBharata B Rao void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
25ce477a7aSSukadev Bhattiprolu struct kvm *kvm, bool skip_page_out);
26*a2ce7200SLaurent Dufour int kvmppc_uvmem_memslot_create(struct kvm *kvm,
27*a2ce7200SLaurent Dufour const struct kvm_memory_slot *new);
28*a2ce7200SLaurent Dufour void kvmppc_uvmem_memslot_delete(struct kvm *kvm,
29*a2ce7200SLaurent Dufour const struct kvm_memory_slot *old);
30ca9f4942SBharata B Rao #else
kvmppc_uvmem_init(void)31ca9f4942SBharata B Rao static inline int kvmppc_uvmem_init(void)
32ca9f4942SBharata B Rao {
33ca9f4942SBharata B Rao return 0;
34ca9f4942SBharata B Rao }
35ca9f4942SBharata B Rao
kvmppc_uvmem_free(void)36ca9f4942SBharata B Rao static inline void kvmppc_uvmem_free(void) { }
37ca9f4942SBharata B Rao
kvmppc_uvmem_available(void)389a5788c6SPaul Mackerras static inline bool kvmppc_uvmem_available(void)
399a5788c6SPaul Mackerras {
409a5788c6SPaul Mackerras return false;
419a5788c6SPaul Mackerras }
429a5788c6SPaul Mackerras
43ca9f4942SBharata B Rao static inline int
kvmppc_uvmem_slot_init(struct kvm * kvm,const struct kvm_memory_slot * slot)44ca9f4942SBharata B Rao kvmppc_uvmem_slot_init(struct kvm *kvm, const struct kvm_memory_slot *slot)
45ca9f4942SBharata B Rao {
46ca9f4942SBharata B Rao return 0;
47ca9f4942SBharata B Rao }
48ca9f4942SBharata B Rao
49ca9f4942SBharata B Rao static inline void
kvmppc_uvmem_slot_free(struct kvm * kvm,const struct kvm_memory_slot * slot)50ca9f4942SBharata B Rao kvmppc_uvmem_slot_free(struct kvm *kvm, const struct kvm_memory_slot *slot) { }
51ca9f4942SBharata B Rao
52ca9f4942SBharata B Rao static inline unsigned long
kvmppc_h_svm_page_in(struct kvm * kvm,unsigned long gra,unsigned long flags,unsigned long page_shift)53ca9f4942SBharata B Rao kvmppc_h_svm_page_in(struct kvm *kvm, unsigned long gra,
54ca9f4942SBharata B Rao unsigned long flags, unsigned long page_shift)
55ca9f4942SBharata B Rao {
56ca9f4942SBharata B Rao return H_UNSUPPORTED;
57ca9f4942SBharata B Rao }
58ca9f4942SBharata B Rao
59ca9f4942SBharata B Rao static inline unsigned long
kvmppc_h_svm_page_out(struct kvm * kvm,unsigned long gra,unsigned long flags,unsigned long page_shift)60ca9f4942SBharata B Rao kvmppc_h_svm_page_out(struct kvm *kvm, unsigned long gra,
61ca9f4942SBharata B Rao unsigned long flags, unsigned long page_shift)
62ca9f4942SBharata B Rao {
63ca9f4942SBharata B Rao return H_UNSUPPORTED;
64ca9f4942SBharata B Rao }
65ca9f4942SBharata B Rao
kvmppc_h_svm_init_start(struct kvm * kvm)66ca9f4942SBharata B Rao static inline unsigned long kvmppc_h_svm_init_start(struct kvm *kvm)
67ca9f4942SBharata B Rao {
68ca9f4942SBharata B Rao return H_UNSUPPORTED;
69ca9f4942SBharata B Rao }
70ca9f4942SBharata B Rao
kvmppc_h_svm_init_done(struct kvm * kvm)71ca9f4942SBharata B Rao static inline unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
72ca9f4942SBharata B Rao {
73ca9f4942SBharata B Rao return H_UNSUPPORTED;
74ca9f4942SBharata B Rao }
75008e359cSBharata B Rao
kvmppc_h_svm_init_abort(struct kvm * kvm)763a43970dSSukadev Bhattiprolu static inline unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm)
773a43970dSSukadev Bhattiprolu {
783a43970dSSukadev Bhattiprolu return H_UNSUPPORTED;
793a43970dSSukadev Bhattiprolu }
803a43970dSSukadev Bhattiprolu
kvmppc_send_page_to_uv(struct kvm * kvm,unsigned long gfn)81008e359cSBharata B Rao static inline int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn)
82008e359cSBharata B Rao {
83008e359cSBharata B Rao return -EFAULT;
84008e359cSBharata B Rao }
85c3262257SBharata B Rao
86c3262257SBharata B Rao static inline void
kvmppc_uvmem_drop_pages(const struct kvm_memory_slot * free,struct kvm * kvm,bool skip_page_out)87c3262257SBharata B Rao kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
88ce477a7aSSukadev Bhattiprolu struct kvm *kvm, bool skip_page_out) { }
89*a2ce7200SLaurent Dufour
kvmppc_uvmem_memslot_create(struct kvm * kvm,const struct kvm_memory_slot * new)90*a2ce7200SLaurent Dufour static inline int kvmppc_uvmem_memslot_create(struct kvm *kvm,
91*a2ce7200SLaurent Dufour const struct kvm_memory_slot *new)
92*a2ce7200SLaurent Dufour {
93*a2ce7200SLaurent Dufour return H_UNSUPPORTED;
94*a2ce7200SLaurent Dufour }
95*a2ce7200SLaurent Dufour
kvmppc_uvmem_memslot_delete(struct kvm * kvm,const struct kvm_memory_slot * old)96*a2ce7200SLaurent Dufour static inline void kvmppc_uvmem_memslot_delete(struct kvm *kvm,
97*a2ce7200SLaurent Dufour const struct kvm_memory_slot *old) { }
98*a2ce7200SLaurent Dufour
99ca9f4942SBharata B Rao #endif /* CONFIG_PPC_UV */
100ca9f4942SBharata B Rao #endif /* __ASM_KVM_BOOK3S_UVMEM_H__ */
101