1 /*
2  * Alternate p2m HVM
3  * Copyright (c) 2014, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __ASM_X86_ALTP2M_H
19 #define __ASM_X86_ALTP2M_H
20 
21 #include <xen/types.h>
22 #include <xen/sched.h>         /* for struct vcpu, struct domain */
23 #include <asm/hvm/vcpu.h>      /* for vcpu_altp2m */
24 
25 /* Alternate p2m HVM on/off per domain */
altp2m_active(const struct domain * d)26 static inline bool_t altp2m_active(const struct domain *d)
27 {
28     return d->arch.altp2m_active;
29 }
30 
31 /* Alternate p2m VCPU */
32 void altp2m_vcpu_initialise(struct vcpu *v);
33 void altp2m_vcpu_destroy(struct vcpu *v);
34 void altp2m_vcpu_reset(struct vcpu *v);
35 
altp2m_vcpu_idx(const struct vcpu * v)36 static inline uint16_t altp2m_vcpu_idx(const struct vcpu *v)
37 {
38     return vcpu_altp2m(v).p2midx;
39 }
40 
41 #endif /* __ASM_X86_ALTP2M_H */
42