Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/arch/x86/mm/altp2m.c
Line
Count
Source (jump to first uncovered line)
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
#include <asm/hvm/support.h>
19
#include <asm/hvm/hvm.h>
20
#include <asm/p2m.h>
21
#include <asm/altp2m.h>
22
23
void
24
altp2m_vcpu_reset(struct vcpu *v)
25
0
{
26
0
    struct altp2mvcpu *av = &vcpu_altp2m(v);
27
0
28
0
    av->p2midx = INVALID_ALTP2M;
29
0
    av->veinfo_gfn = INVALID_GFN;
30
0
}
31
32
void
33
altp2m_vcpu_initialise(struct vcpu *v)
34
0
{
35
0
    if ( v != current )
36
0
        vcpu_pause(v);
37
0
38
0
    altp2m_vcpu_reset(v);
39
0
    vcpu_altp2m(v).p2midx = 0;
40
0
    atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
41
0
42
0
    altp2m_vcpu_update_p2m(v);
43
0
44
0
    if ( v != current )
45
0
        vcpu_unpause(v);
46
0
}
47
48
void
49
altp2m_vcpu_destroy(struct vcpu *v)
50
0
{
51
0
    struct p2m_domain *p2m;
52
0
53
0
    if ( v != current )
54
0
        vcpu_pause(v);
55
0
56
0
    if ( (p2m = p2m_get_altp2m(v)) )
57
0
        atomic_dec(&p2m->active_vcpus);
58
0
59
0
    altp2m_vcpu_reset(v);
60
0
61
0
    altp2m_vcpu_update_p2m(v);
62
0
    altp2m_vcpu_update_vmfunc_ve(v);
63
0
64
0
    if ( v != current )
65
0
        vcpu_unpause(v);
66
0
}
67
68
/*
69
 * Local variables:
70
 * mode: C
71
 * c-file-style: "BSD"
72
 * c-basic-offset: 4
73
 * tab-width: 4
74
 * indent-tabs-mode: nil
75
 * End:
76
 */