ia64/xen-unstable

view xen/include/asm-powerpc/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 a94bf8086002
children cb3e47897b85
line source
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 *
16 * Copyright (C) IBM Corp. 2005
17 *
18 * Authors: Jimi Xenidis <jimix@watson.ibm.com>
19 */
21 #ifndef __ASM_PPC_GRANT_TABLE_H__
22 #define __ASM_PPC_GRANT_TABLE_H__
24 #include <asm/mm.h>
26 #define INITIAL_NR_GRANT_FRAMES 4
28 /*
29 * Caller must own caller's BIGLOCK, is responsible for flushing the TLB, and
30 * must hold a reference to the page.
31 */
32 extern long pte_enter(ulong flags, ulong ptex, ulong vsid, ulong rpn);
33 extern long pte_remove(ulong flags, ulong ptex, ulong avpn,
34 ulong *hi, ulong *lo);
36 int create_grant_host_mapping(unsigned long addr, unsigned long frame,
37 unsigned int flags, unsigned int cache_flags);
38 int replace_grant_host_mapping(
39 unsigned long addr, unsigned long frame, unsigned long new_addr,
40 unsigned int flags);
42 #define gnttab_create_shared_page(d, t, i) \
43 do { \
44 share_xen_page_with_guest( \
45 virt_to_page((t)->shared[(i)]), \
46 (d), XENSHARE_writable); \
47 } while ( 0 )
49 #define gnttab_shared_mfn(d, t, i) (virt_to_mfn((t)->shared[(i)]))
51 #define gnttab_shared_gmfn(d, t, i) \
52 (mfn_to_gmfn(d, gnttab_shared_mfn(d, t, i)))
54 static inline void mark_dirty(struct domain *d, unsigned int mfn)
55 {
56 return;
57 }
58 #define gnttab_mark_dirty(d, f) mark_dirty((d), (f))
59 #define gnttab_log_dirty(d, f) mark_dirty((d), (f))
61 static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
62 {
63 unsigned long *laddr;
64 unsigned long lnr;
66 BUG_ON((ulong)addr % sizeof(ulong));
68 lnr = (BITS_PER_LONG - (sizeof(*addr) * 8)) + nr;
69 laddr = (unsigned long *)addr;
70 clear_bit(lnr, laddr);
71 }
73 static inline uint cpu_foreign_map_order(void)
74 {
75 /* 16 GiB */
76 return 34 - PAGE_SHIFT;
77 }
79 #if 0
80 /*
81 * without put_page()/put_page_and_type() page might be leaked.
82 * with put_page()/put_page_and_type() freed page might be accessed.
83 */
84 #define gnttab_release_put_page(page) put_page((page))
85 #define gnttab_release_put_page_and_type(page) put_page_and_type((page))
86 #else
87 #define gnttab_release_put_page(page) do { } while (0)
88 #define gnttab_release_put_page_and_type(page) do { } while (0)
89 #endif
91 static inline int replace_grant_supported(void)
92 {
93 return 0;
94 }
95 #endif /* __ASM_PPC_GRANT_TABLE_H__ */