Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/asm/grant_table.h
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 * include/asm-x86/grant_table.h
3
 *
4
 * Copyright (c) 2004-2005 K A Fraser
5
 */
6
7
#ifndef __ASM_GRANT_TABLE_H__
8
#define __ASM_GRANT_TABLE_H__
9
10
#include <asm/paging.h>
11
12
#include <asm/hvm/grant_table.h>
13
#include <asm/pv/grant_table.h>
14
15
2
#define INITIAL_NR_GRANT_FRAMES 1U
16
17
struct grant_table_arch {
18
};
19
20
/*
21
 * Caller must own caller's BIGLOCK, is responsible for flushing the TLB, and
22
 * must hold a reference to the page.
23
 */
24
static inline int create_grant_host_mapping(uint64_t addr, unsigned long frame,
25
                                            unsigned int flags,
26
                                            unsigned int cache_flags)
27
0
{
28
0
    if ( paging_mode_external(current->domain) )
29
0
        return create_grant_p2m_mapping(addr, frame, flags, cache_flags);
30
0
    return create_grant_pv_mapping(addr, frame, flags, cache_flags);
31
0
}
Unexecuted instantiation: domctl.c:create_grant_host_mapping
Unexecuted instantiation: domain.c:create_grant_host_mapping
Unexecuted instantiation: grant_table.c:create_grant_host_mapping
Unexecuted instantiation: mm.c:create_grant_host_mapping
Unexecuted instantiation: mem_sharing.c:create_grant_host_mapping
32
33
static inline int replace_grant_host_mapping(uint64_t addr, unsigned long frame,
34
                                             uint64_t new_addr,
35
                                             unsigned int flags)
36
0
{
37
0
    if ( paging_mode_external(current->domain) )
38
0
        return replace_grant_p2m_mapping(addr, frame, new_addr, flags);
39
0
    return replace_grant_pv_mapping(addr, frame, new_addr, flags);
40
0
}
Unexecuted instantiation: mem_sharing.c:replace_grant_host_mapping
Unexecuted instantiation: domctl.c:replace_grant_host_mapping
Unexecuted instantiation: mm.c:replace_grant_host_mapping
Unexecuted instantiation: grant_table.c:replace_grant_host_mapping
Unexecuted instantiation: domain.c:replace_grant_host_mapping
41
42
static inline unsigned int gnttab_dom0_max(void)
43
1
{
44
1
    return UINT_MAX;
45
1
}
Unexecuted instantiation: domctl.c:gnttab_dom0_max
Unexecuted instantiation: domain.c:gnttab_dom0_max
grant_table.c:gnttab_dom0_max
Line
Count
Source
43
1
{
44
1
    return UINT_MAX;
45
1
}
Unexecuted instantiation: mm.c:gnttab_dom0_max
Unexecuted instantiation: mem_sharing.c:gnttab_dom0_max
46
47
1
#define gnttab_init_arch(gt) 0
48
0
#define gnttab_destroy_arch(gt) do {} while ( 0 )
49
1
#define gnttab_set_frame_gfn(gt, idx, gfn) do {} while ( 0 )
50
51
#define gnttab_create_shared_page(d, t, i)                               \
52
2
    do {                                                                 \
53
1
        share_xen_page_with_guest(                                       \
54
1
            virt_to_page((char *)(t)->shared_raw[i]),                    \
55
1
            (d), XENSHARE_writable);                                     \
56
1
    } while ( 0 )
57
58
#define gnttab_create_status_page(d, t, i)                               \
59
0
    do {                                                                 \
60
0
        share_xen_page_with_guest(                                       \
61
0
           virt_to_page((char *)(t)->status[i]),                         \
62
0
            (d), XENSHARE_writable);                                     \
63
0
    } while ( 0 )
64
65
66
#define gnttab_shared_mfn(d, t, i)                      \
67
    ((virt_to_maddr((t)->shared_raw[i]) >> PAGE_SHIFT))
68
69
#define gnttab_shared_gmfn(d, t, i)                     \
70
0
    (mfn_to_gmfn(d, gnttab_shared_mfn(d, t, i)))
71
72
73
#define gnttab_status_mfn(t, i)                         \
74
    ((virt_to_maddr((t)->status[i]) >> PAGE_SHIFT))
75
76
#define gnttab_status_gmfn(d, t, i)                     \
77
0
    (mfn_to_gmfn(d, gnttab_status_mfn(t, i)))
78
79
0
#define gnttab_mark_dirty(d, f) paging_mark_dirty((d), _mfn(f))
80
81
static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
82
0
{
83
0
    /*
84
0
     * Note that this cannot be clear_bit(), as the access must be
85
0
     * confined to the specified 2 bytes.
86
0
     */
87
0
    asm volatile ("lock btrw %w1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
88
0
}
Unexecuted instantiation: domctl.c:gnttab_clear_flag
Unexecuted instantiation: domain.c:gnttab_clear_flag
Unexecuted instantiation: grant_table.c:gnttab_clear_flag
Unexecuted instantiation: mm.c:gnttab_clear_flag
Unexecuted instantiation: mem_sharing.c:gnttab_clear_flag
89
90
/* Foreign mappings of HHVM-guest pages do not modify the type count. */
91
#define gnttab_host_mapping_get_page_type(ro, ld, rd)   \
92
0
    (!(ro) && (((ld) == (rd)) || !paging_mode_external(rd)))
93
94
/* Done implicitly when page tables are destroyed. */
95
0
#define gnttab_release_host_mappings(domain) ( paging_mode_external(domain) )
96
97
#define gnttab_need_iommu_mapping(d)                \
98
0
    (!paging_mode_translate(d) && need_iommu(d))
99
100
static inline int replace_grant_supported(void)
101
0
{
102
0
    return 1;
103
0
}
Unexecuted instantiation: domctl.c:replace_grant_supported
Unexecuted instantiation: mem_sharing.c:replace_grant_supported
Unexecuted instantiation: mm.c:replace_grant_supported
Unexecuted instantiation: grant_table.c:replace_grant_supported
Unexecuted instantiation: domain.c:replace_grant_supported
104
105
#endif /* __ASM_GRANT_TABLE_H__ */