1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * asm-x86/pv/mm.h
4  *
5  * Memory management interfaces for PV guests
6  *
7  * Copyright (C) 2017 Wei Liu <wei.liu2@citrix.com>
8  */
9 
10 #ifndef __X86_PV_MM_H__
11 #define __X86_PV_MM_H__
12 
13 #ifdef CONFIG_PV
14 
15 int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs);
16 
17 int pv_set_gdt(struct vcpu *v, const unsigned long frames[],
18                unsigned int entries);
19 void pv_destroy_gdt(struct vcpu *v);
20 
21 bool pv_map_ldt_shadow_page(unsigned int off);
22 bool pv_destroy_ldt(struct vcpu *v);
23 
24 int validate_segdesc_page(struct page_info *page);
25 
26 #else
27 
28 #include <xen/errno.h>
29 #include <xen/lib.h>
30 
pv_ro_page_fault(unsigned long addr,struct cpu_user_regs * regs)31 static inline int pv_ro_page_fault(unsigned long addr,
32                                    struct cpu_user_regs *regs)
33 {
34     ASSERT_UNREACHABLE();
35     return 0;
36 }
37 
pv_set_gdt(struct vcpu * v,const unsigned long frames[],unsigned int entries)38 static inline int pv_set_gdt(struct vcpu *v, const unsigned long frames[],
39                              unsigned int entries)
40 { ASSERT_UNREACHABLE(); return -EINVAL; }
pv_destroy_gdt(struct vcpu * v)41 static inline void pv_destroy_gdt(struct vcpu *v) { ASSERT_UNREACHABLE(); }
42 
pv_map_ldt_shadow_page(unsigned int off)43 static inline bool pv_map_ldt_shadow_page(unsigned int off) { return false; }
pv_destroy_ldt(struct vcpu * v)44 static inline bool pv_destroy_ldt(struct vcpu *v)
45 { ASSERT_UNREACHABLE(); return false; }
46 
47 #endif
48 
49 #endif /* __X86_PV_MM_H__ */
50