/******************************************************************************1* arch/ia64/xen/hypervisor.c2*3* Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>4* VA Linux Systems Japan K.K.5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2 of the License, or9* (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19*20*/2122#include <linux/efi.h>23#include <asm/xen/hypervisor.h>24#include <asm/xen/privop.h>2526#include "irq_xen.h"2728struct shared_info *HYPERVISOR_shared_info __read_mostly =29(struct shared_info *)XSI_BASE;30EXPORT_SYMBOL(HYPERVISOR_shared_info);3132DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);3334struct start_info *xen_start_info;35EXPORT_SYMBOL(xen_start_info);3637EXPORT_SYMBOL(xen_domain_type);3839EXPORT_SYMBOL(__hypercall);4041/* Stolen from arch/x86/xen/enlighten.c */42/*43* Flag to determine whether vcpu info placement is available on all44* VCPUs. We assume it is to start with, and then set it to zero on45* the first failure. This is because it can succeed on some VCPUs46* and not others, since it can involve hypervisor memory allocation,47* or because the guest failed to guarantee all the appropriate48* constraints on all VCPUs (ie buffer can't cross a page boundary).49*50* Note that any particular CPU may be using a placed vcpu structure,51* but we can only optimise if the all are.52*53* 0: not available, 1: available54*/5556static void __init xen_vcpu_setup(int cpu)57{58/*59* WARNING:60* before changing MAX_VIRT_CPUS,61* check that shared_info fits on a page62*/63BUILD_BUG_ON(sizeof(struct shared_info) > PAGE_SIZE);64per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];65}6667void __init xen_setup_vcpu_info_placement(void)68{69int cpu;7071for_each_possible_cpu(cpu)72xen_vcpu_setup(cpu);73}7475void __cpuinit76xen_cpu_init(void)77{78xen_smp_intr_init();79}8081/**************************************************************************82* opt feature83*/84void85xen_ia64_enable_opt_feature(void)86{87/* Enable region 7 identity map optimizations in Xen */88struct xen_ia64_opt_feature optf;8990optf.cmd = XEN_IA64_OPTF_IDENT_MAP_REG7;91optf.on = XEN_IA64_OPTF_ON;92optf.pgprot = pgprot_val(PAGE_KERNEL);93optf.key = 0; /* No key on linux. */94HYPERVISOR_opt_feature(&optf);95}969798