1 /*
2  * asm-x86/hvm/grant_table.h
3  *
4  * Grant table interfaces for HVM guests
5  *
6  * Copyright (C) 2017 Wei Liu <wei.liu2@citrix.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms and conditions of the GNU General Public
10  * License, version 2, as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public
18  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __X86_HVM_GRANT_TABLE_H__
22 #define __X86_HVM_GRANT_TABLE_H__
23 
24 #ifdef CONFIG_HVM
25 
26 int create_grant_p2m_mapping(uint64_t addr, unsigned long frame,
27                              unsigned int flags,
28                              unsigned int cache_flags);
29 int replace_grant_p2m_mapping(uint64_t addr, unsigned long frame,
30                               uint64_t new_addr, unsigned int flags);
31 
32 #else
33 
34 #include <public/grant_table.h>
35 
create_grant_p2m_mapping(uint64_t addr,unsigned long frame,unsigned int flags,unsigned int cache_flags)36 static inline int create_grant_p2m_mapping(uint64_t addr, unsigned long frame,
37                                            unsigned int flags,
38                                            unsigned int cache_flags)
39 {
40     return GNTST_general_error;
41 }
42 
replace_grant_p2m_mapping(uint64_t addr,unsigned long frame,uint64_t new_addr,unsigned int flags)43 static inline int replace_grant_p2m_mapping(uint64_t addr, unsigned long frame,
44                                             uint64_t new_addr, unsigned int flags)
45 {
46     return GNTST_general_error;
47 }
48 
49 #endif
50 
51 #endif /* __X86_HVM_GRANT_TABLE_H__ */
52 
53 /*
54  * Local variables:
55  * mode: C
56  * c-file-style: "BSD"
57  * c-basic-offset: 4
58  * tab-width: 4
59  * indent-tabs-mode: nil
60  * End:
61  */
62