linux/arch/ia64/xen/grant-table.c
<<
>>
Prefs
   1/******************************************************************************
   2 * arch/ia64/xen/grant-table.c
   3 *
   4 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
   5 *                    VA Linux Systems Japan K.K.
   6 *
   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.
  11 *
  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.
  16 *
  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
  20 *
  21 */
  22
  23#include <linux/module.h>
  24#include <linux/vmalloc.h>
  25#include <linux/slab.h>
  26#include <linux/mm.h>
  27
  28#include <xen/interface/xen.h>
  29#include <xen/interface/memory.h>
  30#include <xen/grant_table.h>
  31
  32#include <asm/xen/hypervisor.h>
  33
  34/****************************************************************************
  35 * grant table hack
  36 * cmd: GNTTABOP_xxx
  37 */
  38
  39int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
  40                           unsigned long max_nr_gframes,
  41                           struct grant_entry **__shared)
  42{
  43        *__shared = __va(frames[0] << PAGE_SHIFT);
  44        return 0;
  45}
  46
  47void arch_gnttab_unmap_shared(struct grant_entry *shared,
  48                              unsigned long nr_gframes)
  49{
  50        /* nothing */
  51}
  52
  53static void
  54gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
  55{
  56        uint32_t flags;
  57
  58        flags = uop->flags;
  59
  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();
  66                }
  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();
  72                }
  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();
  78        }
  79}
  80
  81int
  82HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
  83{
  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);
  89                }
  90        }
  91        return xencomm_hypercall_grant_table_op(cmd, uop, count);
  92}
  93
  94EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
  95