Linux 3.12.28
[linux/fpc-iii.git] / arch / ia64 / xen / grant-table.c
blobc18281332f8472bb8204928655d7dfdc8f9ace86
1 /******************************************************************************
2 * arch/ia64/xen/grant-table.c
4 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/module.h>
24 #include <linux/vmalloc.h>
25 #include <linux/slab.h>
26 #include <linux/mm.h>
28 #include <xen/interface/xen.h>
29 #include <xen/interface/memory.h>
30 #include <xen/grant_table.h>
32 #include <asm/xen/hypervisor.h>
34 /****************************************************************************
35 * grant table hack
36 * cmd: GNTTABOP_xxx
39 int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
40 unsigned long max_nr_gframes,
41 struct grant_entry **__shared)
43 *__shared = __va(frames[0] << PAGE_SHIFT);
44 return 0;
47 void arch_gnttab_unmap_shared(struct grant_entry *shared,
48 unsigned long nr_gframes)
50 /* nothing */
53 static void
54 gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
56 uint32_t flags;
58 flags = uop->flags;
60 if (flags & GNTMAP_host_map) {
61 if (flags & GNTMAP_application_map) {
62 printk(KERN_DEBUG
63 "GNTMAP_application_map is not supported yet: "
64 "flags 0x%x\n", flags);
65 BUG();
67 if (flags & GNTMAP_contains_pte) {
68 printk(KERN_DEBUG
69 "GNTMAP_contains_pte is not supported yet: "
70 "flags 0x%x\n", flags);
71 BUG();
73 } else if (flags & GNTMAP_device_map) {
74 printk("GNTMAP_device_map is not supported yet 0x%x\n", flags);
75 BUG(); /* not yet. actually this flag is not used. */
76 } else {
77 BUG();
81 int
82 HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
84 if (cmd == GNTTABOP_map_grant_ref) {
85 unsigned int i;
86 for (i = 0; i < count; i++) {
87 gnttab_map_grant_ref_pre(
88 (struct gnttab_map_grant_ref *)uop + i);
91 return xencomm_hypercall_grant_table_op(cmd, uop, count);
94 EXPORT_SYMBOL(HYPERVISOR_grant_table_op);