~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to xen/include/asm-x86/grant_table.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#define INITIAL_NR_GRANT_FRAMES 4
 
11
 
 
12
/*
 
13
 * Caller must own caller's BIGLOCK, is responsible for flushing the TLB, and
 
14
 * must hold a reference to the page.
 
15
 */
 
16
int create_grant_host_mapping(uint64_t addr, unsigned long frame,
 
17
                              unsigned int flags, unsigned int cache_flags);
 
18
int replace_grant_host_mapping(
 
19
    uint64_t addr, unsigned long frame, uint64_t new_addr, unsigned int flags);
 
20
 
 
21
#define gnttab_create_shared_page(d, t, i)                               \
 
22
    do {                                                                 \
 
23
        share_xen_page_with_guest(                                       \
 
24
            virt_to_page((char *)(t)->shared_raw[i]),                    \
 
25
            (d), XENSHARE_writable);                                     \
 
26
    } while ( 0 )
 
27
 
 
28
#define gnttab_create_status_page(d, t, i)                               \
 
29
    do {                                                                 \
 
30
        share_xen_page_with_guest(                                       \
 
31
           virt_to_page((char *)(t)->status[i]),                         \
 
32
            (d), XENSHARE_writable);                                     \
 
33
    } while ( 0 )
 
34
 
 
35
 
 
36
#define gnttab_shared_mfn(d, t, i)                      \
 
37
    ((virt_to_maddr((t)->shared_raw[i]) >> PAGE_SHIFT))
 
38
 
 
39
#define gnttab_shared_gmfn(d, t, i)                     \
 
40
    (mfn_to_gmfn(d, gnttab_shared_mfn(d, t, i)))
 
41
 
 
42
 
 
43
#define gnttab_status_mfn(t, i)                         \
 
44
    ((virt_to_maddr((t)->status[i]) >> PAGE_SHIFT))
 
45
 
 
46
#define gnttab_status_gmfn(d, t, i)                     \
 
47
    (mfn_to_gmfn(d, gnttab_status_mfn(t, i)))
 
48
 
 
49
#define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
50
 
 
51
static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
 
52
{
 
53
    clear_bit(nr, (unsigned long *)addr);
 
54
}
 
55
 
 
56
/* Foreign mappings of HHVM-guest pages do not modify the type count. */
 
57
#define gnttab_host_mapping_get_page_type(op, ld, rd)   \
 
58
    (!((op)->flags & GNTMAP_readonly) &&                \
 
59
     (((ld) == (rd)) || !paging_mode_external(rd)))
 
60
 
 
61
/* Done implicitly when page tables are destroyed. */
 
62
#define gnttab_release_host_mappings(domain) ( paging_mode_external(domain) )
 
63
 
 
64
static inline int replace_grant_supported(void)
 
65
{
 
66
    return 1;
 
67
}
 
68
 
 
69
#endif /* __ASM_GRANT_TABLE_H__ */