direct-io.hg

view xen/include/asm-powerpc/grant_table.h @ 14394:809f36b1b685

Add two arch hooks to gnttab_release_mappings().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author kfraser@localhost.localdomain
date Thu Mar 15 10:43:13 2007 +0000 (2007-03-15)
parents 7e9dc164b572
children 1f7a6456c330
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(
37 unsigned long addr, unsigned long frame, unsigned int flags);
38 int destroy_grant_host_mapping(
39 unsigned long addr, unsigned long frame, unsigned int flags);
41 #define gnttab_create_shared_page(d, t, i) \
42 do { \
43 share_xen_page_with_guest( \
44 virt_to_page((t)->shared[(i)]), \
45 (d), XENSHARE_writable); \
46 } while ( 0 )
48 #define gnttab_shared_mfn(d, t, i) (virt_to_mfn((t)->shared[(i)]))
50 #define gnttab_shared_gmfn(d, t, i) \
51 (mfn_to_gmfn(d, gnttab_shared_mfn(d, t, i)))
53 #define gnttab_log_dirty(d, f) mark_dirty((d), (f))
55 static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
56 {
57 unsigned long *laddr;
58 unsigned long lnr;
60 BUG_ON((ulong)addr % sizeof(ulong));
62 lnr = (BITS_PER_LONG - (sizeof(*addr) * 8)) + nr;
63 laddr = (unsigned long *)addr;
64 clear_bit(lnr, laddr);
65 }
67 static inline uint cpu_foreign_map_order(void)
68 {
69 /* 16 GiB */
70 return 34 - PAGE_SHIFT;
71 }
73 #if 0
74 /*
75 * without put_page()/put_page_and_type() page might be leaked.
76 * with put_page()/put_page_and_type() freed page might be accessed.
77 */
78 #define gnttab_release_put_page(page) put_page((page))
79 #define gnttab_release_put_page_and_type(page) put_page_and_type((page))
80 #else
81 #define gnttab_release_put_page(page) do { } while (0)
82 #define gnttab_release_put_page_and_type(page) do { } while (0)
83 #endif
85 #endif /* __ASM_PPC_GRANT_TABLE_H__ */