ia64/xen-unstable

view xen/include/asm-ia64/grant_table.h @ 16407:2e5d922b7ee3

xen: Allow granting of foreign access to iomem pages, and with
arbitrary cache attributes.
Signed-off-by: Kieran Mansley <kmansley@solarflare.com>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Nov 20 17:26:48 2007 +0000 (2007-11-20)
parents e2d76fb12ae2
children cb3e47897b85
line source
1 /******************************************************************************
2 * include/asm-ia64/grant_table.h
3 */
5 #ifndef __ASM_GRANT_TABLE_H__
6 #define __ASM_GRANT_TABLE_H__
8 #define INITIAL_NR_GRANT_FRAMES 1
10 // for grant map/unmap
11 int create_grant_host_mapping(unsigned long gpaddr, unsigned long mfn,
12 unsigned int flags, unsigned int cache_flags);
13 int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn, unsigned long new_gpaddr, unsigned int flags);
15 // for grant transfer
16 int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
18 /* XXX
19 * somewhere appropriate
20 * those constand shouldn't be pre-defined and
21 * those area should be reserved by EFI MD.
22 */
23 /* Guest phsyical address of shared_info */
24 #define IA64_SHARED_INFO_PADDR (1UL << 40)
25 /* Guest phsyical address of mapped_regs */
26 #define IA64_XMAPPEDREGS_BASE_PADDR (IA64_SHARED_INFO_PADDR + XSI_SIZE)
27 #define IA64_XMAPPEDREGS_PADDR(vcpu_id) \
28 (IA64_XMAPPEDREGS_BASE_PADDR + \
29 (vcpu_id) * max_t(unsigned long, PAGE_SIZE, XMAPPEDREGS_SIZE))
31 /* Guest physical address of the grant table. */
32 #define IA64_GRANT_TABLE_PADDR IA64_XMAPPEDREGS_PADDR(NR_CPUS)
34 #define gnttab_shared_maddr(t, i) (virt_to_maddr((t)->shared[(i)]))
35 #define gnttab_shared_page(t, i) (virt_to_page((t)->shared[(i)]))
37 #define ia64_gnttab_create_shared_page(d, t, i) \
38 do { \
39 BUG_ON((d)->arch.mm.pgd == NULL); \
40 assign_domain_page((d), \
41 IA64_GRANT_TABLE_PADDR + ((i) << PAGE_SHIFT), \
42 gnttab_shared_maddr((t), (i))); \
43 } while (0)
45 /*
46 * for grant table shared page
47 * grant_table_create() might call this macro before allocating the p2m table.
48 * In such case, arch_domain_create() completes the initialization.
49 */
50 #define gnttab_create_shared_page(d, t, i) \
51 do { \
52 share_xen_page_with_guest(gnttab_shared_page((t), (i)), \
53 (d), XENSHARE_writable); \
54 if ((d)->arch.mm.pgd) \
55 ia64_gnttab_create_shared_page((d), (t), (i)); \
56 } while (0)
58 #define gnttab_shared_gmfn(d, t, i) \
59 ((IA64_GRANT_TABLE_PADDR >> PAGE_SHIFT) + (i))
61 #define gnttab_mark_dirty(d, f) ((void)f)
63 static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
64 {
65 clear_bit(nr, addr);
66 }
68 #define gnttab_release_put_page(page) put_page((page))
69 #define gnttab_release_put_page_and_type(page) put_page_and_type((page))
71 static inline int replace_grant_supported(void)
72 {
73 return 1;
74 }
76 #endif /* __ASM_GRANT_TABLE_H__ */