Merge branch 'akpm'
[linux-2.6/next.git] / arch / ia64 / xen / hypervisor.c
blobcac4d97c0b5a549fac4c359daf939c74f9928b85
1 /******************************************************************************
2 * arch/ia64/xen/hypervisor.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/efi.h>
24 #include <asm/xen/hypervisor.h>
25 #include <asm/xen/privop.h>
27 #include "irq_xen.h"
29 struct shared_info *HYPERVISOR_shared_info __read_mostly =
30 (struct shared_info *)XSI_BASE;
31 EXPORT_SYMBOL(HYPERVISOR_shared_info);
33 DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
35 struct start_info *xen_start_info;
36 EXPORT_SYMBOL(xen_start_info);
38 EXPORT_SYMBOL(xen_domain_type);
40 EXPORT_SYMBOL(__hypercall);
42 /* Stolen from arch/x86/xen/enlighten.c */
44 * Flag to determine whether vcpu info placement is available on all
45 * VCPUs. We assume it is to start with, and then set it to zero on
46 * the first failure. This is because it can succeed on some VCPUs
47 * and not others, since it can involve hypervisor memory allocation,
48 * or because the guest failed to guarantee all the appropriate
49 * constraints on all VCPUs (ie buffer can't cross a page boundary).
51 * Note that any particular CPU may be using a placed vcpu structure,
52 * but we can only optimise if the all are.
54 * 0: not available, 1: available
57 static void __init xen_vcpu_setup(int cpu)
60 * WARNING:
61 * before changing MAX_VIRT_CPUS,
62 * check that shared_info fits on a page
64 BUILD_BUG_ON(sizeof(struct shared_info) > PAGE_SIZE);
65 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
68 void __init xen_setup_vcpu_info_placement(void)
70 int cpu;
72 for_each_possible_cpu(cpu)
73 xen_vcpu_setup(cpu);
76 void __cpuinit
77 xen_cpu_init(void)
79 xen_smp_intr_init();
82 /**************************************************************************
83 * opt feature
85 void
86 xen_ia64_enable_opt_feature(void)
88 /* Enable region 7 identity map optimizations in Xen */
89 struct xen_ia64_opt_feature optf;
91 optf.cmd = XEN_IA64_OPTF_IDENT_MAP_REG7;
92 optf.on = XEN_IA64_OPTF_ON;
93 optf.pgprot = pgprot_val(PAGE_KERNEL);
94 optf.key = 0; /* No key on linux. */
95 HYPERVISOR_opt_feature(&optf);