ia64/xen-unstable

annotate xen/arch/ia64/vmx/vmx_init.c @ 9169:8a551ec13d93

[IA64] Remove the last compile warnings

This patch intends to remove the last warnings when compile

Signed-off-by: Zhang xiantao <xiantao.zhang@intel.com>
author awilliam@xenbuild.aw
date Tue Mar 14 12:27:57 2006 -0700 (2006-03-14)
parents 1abf3783975d
children 695aa28b7cb1
rev   line source
djm@6458 1 /* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
djm@6458 2 /*
djm@6458 3 * vmx_init.c: initialization work for vt specific domain
djm@6458 4 * Copyright (c) 2005, Intel Corporation.
djm@6458 5 * Kun Tian (Kevin Tian) <kevin.tian@intel.com>
djm@6458 6 * Xuefei Xu (Anthony Xu) <anthony.xu@intel.com>
djm@6458 7 * Fred Yang <fred.yang@intel.com>
djm@6458 8 *
djm@6458 9 * This program is free software; you can redistribute it and/or modify it
djm@6458 10 * under the terms and conditions of the GNU General Public License,
djm@6458 11 * version 2, as published by the Free Software Foundation.
djm@6458 12 *
djm@6458 13 * This program is distributed in the hope it will be useful, but WITHOUT
djm@6458 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
djm@6458 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
djm@6458 16 * more details.
djm@6458 17 *
djm@6458 18 * You should have received a copy of the GNU General Public License along with
djm@6458 19 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
djm@6458 20 * Place - Suite 330, Boston, MA 02111-1307 USA.
djm@6458 21 *
djm@6458 22 */
djm@6458 23
djm@6458 24 /*
djm@6458 25 * 05/08/16 Kun tian (Kevin Tian) <kevin.tian@intel.com>:
djm@6458 26 * Disable doubling mapping
djm@6458 27 *
djm@6458 28 * 05/03/23 Kun Tian (Kevin Tian) <kevin.tian@intel.com>:
djm@6458 29 * Simplied design in first step:
djm@6458 30 * - One virtual environment
djm@6458 31 * - Domain is bound to one LP
djm@6458 32 * Later to support guest SMP:
djm@6458 33 * - Need interface to handle VP scheduled to different LP
djm@6458 34 */
djm@6458 35 #include <xen/config.h>
djm@6458 36 #include <xen/types.h>
djm@6458 37 #include <xen/sched.h>
djm@6458 38 #include <asm/pal.h>
djm@6458 39 #include <asm/page.h>
djm@6458 40 #include <asm/processor.h>
djm@6458 41 #include <asm/vmx_vcpu.h>
djm@6458 42 #include <xen/lib.h>
djm@6458 43 #include <asm/vmmu.h>
djm@6458 44 #include <public/arch-ia64.h>
kaf24@8492 45 #include <public/hvm/ioreq.h>
djm@6458 46 #include <asm/vmx_phy_mode.h>
djm@6458 47 #include <asm/processor.h>
djm@6458 48 #include <asm/vmx.h>
djm@6458 49 #include <xen/mm.h>
djm@7333 50 #include <public/arch-ia64.h>
kaf24@8708 51 #include <asm/hvm/vioapic.h>
kaf24@8971 52 #include <public/event_channel.h>
awilliam@9169 53 #include <xen/event.h>
awilliam@9169 54 #include <asm/vlsapic.h>
djm@6458 55
djm@6458 56 /* Global flag to identify whether Intel vmx feature is on */
djm@6458 57 u32 vmx_enabled = 0;
kaf24@7720 58 unsigned int opt_vmx_debug_level = 0;
djm@6458 59 static u32 vm_order;
djm@6458 60 static u64 buffer_size;
djm@6458 61 static u64 vp_env_info;
djm@6458 62 static u64 vm_buffer = 0; /* Buffer required to bring up VMX feature */
djm@6458 63 u64 __vsa_base = 0; /* Run-time service base of VMX */
djm@6458 64
djm@6458 65 /* Check whether vt feature is enabled or not. */
djm@6458 66 void
djm@6458 67 identify_vmx_feature(void)
djm@6458 68 {
djm@6458 69 pal_status_t ret;
djm@6458 70 u64 avail = 1, status = 1, control = 1;
djm@6458 71
djm@6458 72 vmx_enabled = 0;
djm@6458 73 /* Check VT-i feature */
djm@6458 74 ret = ia64_pal_proc_get_features(&avail, &status, &control);
djm@6458 75 if (ret != PAL_STATUS_SUCCESS) {
djm@6458 76 printk("Get proc features failed.\n");
djm@6458 77 goto no_vti;
djm@6458 78 }
djm@6458 79
djm@6458 80 /* FIXME: do we need to check status field, to see whether
djm@6458 81 * PSR.vm is actually enabled? If yes, aonther call to
djm@6458 82 * ia64_pal_proc_set_features may be reuqired then.
djm@6458 83 */
djm@6458 84 printk("avail:0x%lx, status:0x%lx,control:0x%lx, vm?0x%lx\n",
djm@6458 85 avail, status, control, avail & PAL_PROC_VM_BIT);
djm@6458 86 if (!(avail & PAL_PROC_VM_BIT)) {
djm@6458 87 printk("No VT feature supported.\n");
djm@6458 88 goto no_vti;
djm@6458 89 }
djm@6458 90
djm@6458 91 ret = ia64_pal_vp_env_info(&buffer_size, &vp_env_info);
djm@6458 92 if (ret != PAL_STATUS_SUCCESS) {
djm@6458 93 printk("Get vp environment info failed.\n");
djm@6458 94 goto no_vti;
djm@6458 95 }
djm@6458 96
djm@6458 97 /* Does xen has ability to decode itself? */
djm@6458 98 if (!(vp_env_info & VP_OPCODE))
djm@6458 99 printk("WARNING: no opcode provided from hardware(%lx)!!!\n", vp_env_info);
djm@6458 100 vm_order = get_order(buffer_size);
awilliam@9164 101 printk("vm buffer size: %ld, order: %d\n", buffer_size, vm_order);
djm@6458 102
djm@6458 103 vmx_enabled = 1;
djm@6458 104 no_vti:
djm@6458 105 return;
djm@6458 106 }
djm@6458 107
djm@6458 108 /*
djm@6458 109 * Init virtual environment on current LP
djm@6458 110 * vsa_base is the indicator whether it's first LP to be initialized
djm@6458 111 * for current domain.
djm@6458 112 */
djm@6458 113 void
djm@6458 114 vmx_init_env(void)
djm@6458 115 {
djm@6458 116 u64 status, tmp_base;
djm@6458 117
djm@6458 118 if (!vm_buffer) {
awilliam@8916 119 vm_buffer = (unsigned long)alloc_xenheap_pages(vm_order);
djm@6458 120 ASSERT(vm_buffer);
djm@6458 121 printk("vm_buffer: 0x%lx\n", vm_buffer);
djm@6458 122 }
djm@6458 123
djm@6458 124 status=ia64_pal_vp_init_env(__vsa_base ? VP_INIT_ENV : VP_INIT_ENV_INITALIZE,
djm@6458 125 __pa(vm_buffer),
djm@6458 126 vm_buffer,
djm@6458 127 &tmp_base);
djm@6458 128
djm@6458 129 if (status != PAL_STATUS_SUCCESS) {
djm@6458 130 printk("ia64_pal_vp_init_env failed.\n");
awilliam@8916 131 return ;
djm@6458 132 }
djm@6458 133
djm@6458 134 if (!__vsa_base)
djm@6458 135 __vsa_base = tmp_base;
djm@6458 136 else
djm@6458 137 ASSERT(tmp_base != __vsa_base);
djm@6458 138
djm@6458 139 }
djm@6458 140
djm@6458 141 typedef union {
djm@6458 142 u64 value;
djm@6458 143 struct {
djm@6458 144 u64 number : 8;
djm@6458 145 u64 revision : 8;
djm@6458 146 u64 model : 8;
djm@6458 147 u64 family : 8;
djm@6458 148 u64 archrev : 8;
djm@6458 149 u64 rv : 24;
djm@6458 150 };
djm@6458 151 } cpuid3_t;
djm@6458 152
djm@6458 153 /* Allocate vpd from xenheap */
djm@6458 154 static vpd_t *alloc_vpd(void)
djm@6458 155 {
djm@6458 156 int i;
djm@6458 157 cpuid3_t cpuid3;
djm@6458 158 vpd_t *vpd;
djm@6458 159
djm@6458 160 vpd = alloc_xenheap_pages(get_order(VPD_SIZE));
djm@6458 161 if (!vpd) {
djm@6458 162 printk("VPD allocation failed.\n");
djm@6458 163 return NULL;
djm@6458 164 }
djm@6458 165
awilliam@9169 166 printk("vpd base: 0x%p, vpd size:%ld\n", vpd, sizeof(vpd_t));
djm@6458 167 memset(vpd, 0, VPD_SIZE);
djm@6458 168 /* CPUID init */
djm@6458 169 for (i = 0; i < 5; i++)
djm@6458 170 vpd->vcpuid[i] = ia64_get_cpuid(i);
djm@6458 171
djm@6458 172 /* Limit the CPUID number to 5 */
djm@6458 173 cpuid3.value = vpd->vcpuid[3];
djm@6458 174 cpuid3.number = 4; /* 5 - 1 */
djm@6458 175 vpd->vcpuid[3] = cpuid3.value;
djm@6458 176
awilliam@9011 177 vpd->vac.a_from_int_cr = 1;
awilliam@9011 178 vpd->vac.a_to_int_cr = 1;
awilliam@9011 179 vpd->vac.a_from_psr = 1;
awilliam@9011 180 vpd->vac.a_from_cpuid = 1;
awilliam@9011 181 vpd->vac.a_cover = 1;
awilliam@9011 182 vpd->vac.a_bsw = 1;
awilliam@9011 183
djm@6458 184 vpd->vdc.d_vmsw = 1;
awilliam@9011 185
djm@6458 186 return vpd;
djm@6458 187 }
djm@6458 188
djm@6458 189
djm@6458 190 /*
djm@6458 191 * Create a VP on intialized VMX environment.
djm@6458 192 */
djm@6458 193 static void
djm@6458 194 vmx_create_vp(struct vcpu *v)
djm@6458 195 {
djm@6458 196 u64 ret;
djm@6801 197 vpd_t *vpd = v->arch.privregs;
djm@6458 198 u64 ivt_base;
djm@6458 199 extern char vmx_ia64_ivt;
djm@6458 200 /* ia64_ivt is function pointer, so need this tranlation */
djm@6458 201 ivt_base = (u64) &vmx_ia64_ivt;
djm@6458 202 printk("ivt_base: 0x%lx\n", ivt_base);
awilliam@8916 203 ret = ia64_pal_vp_create((u64 *)vpd, (u64 *)ivt_base, 0);
djm@6458 204 if (ret != PAL_STATUS_SUCCESS)
djm@6458 205 panic("ia64_pal_vp_create failed. \n");
djm@6458 206 }
djm@6458 207
djm@6458 208 /* Other non-context related tasks can be done in context switch */
djm@6458 209 void
djm@6458 210 vmx_save_state(struct vcpu *v)
djm@6458 211 {
awilliam@8916 212 u64 status;
djm@6458 213
djm@6458 214 /* FIXME: about setting of pal_proc_vector... time consuming */
awilliam@8916 215 status = ia64_pal_vp_save((u64 *)v->arch.privregs, 0);
djm@6458 216 if (status != PAL_STATUS_SUCCESS)
djm@6458 217 panic("Save vp status failed\n");
djm@6458 218
djm@6458 219
djm@6458 220 /* Need to save KR when domain switch, though HV itself doesn;t
djm@6458 221 * use them.
djm@6458 222 */
djm@6458 223 v->arch.arch_vmx.vkr[0] = ia64_get_kr(0);
djm@6458 224 v->arch.arch_vmx.vkr[1] = ia64_get_kr(1);
djm@6458 225 v->arch.arch_vmx.vkr[2] = ia64_get_kr(2);
djm@6458 226 v->arch.arch_vmx.vkr[3] = ia64_get_kr(3);
djm@6458 227 v->arch.arch_vmx.vkr[4] = ia64_get_kr(4);
djm@6458 228 v->arch.arch_vmx.vkr[5] = ia64_get_kr(5);
djm@6458 229 v->arch.arch_vmx.vkr[6] = ia64_get_kr(6);
djm@6458 230 v->arch.arch_vmx.vkr[7] = ia64_get_kr(7);
djm@6458 231 }
djm@6458 232
djm@6458 233 /* Even guest is in physical mode, we still need such double mapping */
djm@6458 234 void
djm@6458 235 vmx_load_state(struct vcpu *v)
djm@6458 236 {
awilliam@8916 237 u64 status;
djm@6458 238
awilliam@9169 239 status = ia64_pal_vp_restore((u64 *)v->arch.privregs, 0);
djm@6458 240 if (status != PAL_STATUS_SUCCESS)
djm@6458 241 panic("Restore vp status failed\n");
djm@6458 242
djm@6458 243 ia64_set_kr(0, v->arch.arch_vmx.vkr[0]);
djm@6458 244 ia64_set_kr(1, v->arch.arch_vmx.vkr[1]);
djm@6458 245 ia64_set_kr(2, v->arch.arch_vmx.vkr[2]);
djm@6458 246 ia64_set_kr(3, v->arch.arch_vmx.vkr[3]);
djm@6458 247 ia64_set_kr(4, v->arch.arch_vmx.vkr[4]);
djm@6458 248 ia64_set_kr(5, v->arch.arch_vmx.vkr[5]);
djm@6458 249 ia64_set_kr(6, v->arch.arch_vmx.vkr[6]);
djm@6458 250 ia64_set_kr(7, v->arch.arch_vmx.vkr[7]);
djm@6458 251 /* Guest vTLB is not required to be switched explicitly, since
djm@6458 252 * anchored in vcpu */
djm@6458 253 }
djm@6458 254
djm@6458 255 /*
djm@6458 256 * Initialize VMX envirenment for guest. Only the 1st vp/vcpu
djm@6458 257 * is registered here.
djm@6458 258 */
djm@6458 259 void
kaf24@7720 260 vmx_final_setup_guest(struct vcpu *v)
djm@6458 261 {
djm@6458 262 vpd_t *vpd;
djm@6458 263
djm@6458 264 vpd = alloc_vpd();
djm@6458 265 ASSERT(vpd);
djm@6458 266
kaf24@7720 267 v->arch.privregs = vpd;
djm@6458 268 vpd->virt_env_vaddr = vm_buffer;
djm@6458 269
djm@6878 270 /* Per-domain vTLB and vhpt implementation. Now vmx domain will stick
djm@6878 271 * to this solution. Maybe it can be deferred until we know created
djm@6878 272 * one as vmx domain */
djm@6878 273 v->arch.vtlb = init_domain_tlb(v);
djm@6878 274
djm@6458 275 /* v->arch.schedule_tail = arch_vmx_do_launch; */
djm@6458 276 vmx_create_vp(v);
djm@6458 277
djm@6458 278 /* Set this ed to be vmx */
djm@6458 279 set_bit(ARCH_VMX_VMCS_LOADED, &v->arch.arch_vmx.flags);
djm@6458 280
djm@6458 281 /* Physical mode emulation initialization, including
djm@6458 282 * emulation ID allcation and related memory request
djm@6458 283 */
djm@6458 284 physical_mode_init(v);
djm@6458 285
djm@6458 286 vlsapic_reset(v);
djm@6458 287 vtm_init(v);
djm@6458 288
kaf24@7720 289 /* One more step to enable interrupt assist */
kaf24@7720 290 set_bit(ARCH_VMX_INTR_ASSIST, &v->arch.arch_vmx.flags);
djm@6458 291 }
djm@6799 292
djm@6799 293 typedef struct io_range {
djm@6799 294 unsigned long start;
djm@6799 295 unsigned long size;
djm@6799 296 unsigned long type;
djm@6799 297 } io_range_t;
djm@6799 298
djm@6799 299 io_range_t io_ranges[] = {
djm@6799 300 {VGA_IO_START, VGA_IO_SIZE, GPFN_FRAME_BUFFER},
djm@6799 301 {MMIO_START, MMIO_SIZE, GPFN_LOW_MMIO},
djm@6799 302 {LEGACY_IO_START, LEGACY_IO_SIZE, GPFN_LEGACY_IO},
djm@6799 303 {IO_SAPIC_START, IO_SAPIC_SIZE, GPFN_IOSAPIC},
djm@6799 304 {PIB_START, PIB_SIZE, GPFN_PIB},
djm@6799 305 };
djm@6799 306
djm@7333 307 #define VMX_SYS_PAGES (2 + (GFW_SIZE >> PAGE_SHIFT))
djm@6799 308 #define VMX_CONFIG_PAGES(d) ((d)->max_pages - VMX_SYS_PAGES)
djm@6799 309
djm@6799 310 int vmx_alloc_contig_pages(struct domain *d)
djm@6799 311 {
awilliam@9011 312 unsigned long i, j, start,tmp, end, pgnr, conf_nr;
kaf24@8726 313 struct page_info *page;
djm@6799 314 struct vcpu *v = d->vcpu[0];
djm@6799 315
djm@6799 316 ASSERT(!test_bit(ARCH_VMX_CONTIG_MEM, &v->arch.arch_vmx.flags));
djm@6799 317
djm@7333 318 /* Mark I/O ranges */
djm@7333 319 for (i = 0; i < (sizeof(io_ranges) / sizeof(io_range_t)); i++) {
djm@7333 320 for (j = io_ranges[i].start;
djm@7333 321 j < io_ranges[i].start + io_ranges[i].size;
djm@7333 322 j += PAGE_SIZE)
awilliam@8778 323 assign_domain_page(d, j, io_ranges[i].type);
djm@7333 324 }
djm@7333 325
djm@6799 326 conf_nr = VMX_CONFIG_PAGES(d);
awilliam@9011 327 if((conf_nr<<PAGE_SHIFT)<(1UL<<(_PAGE_SIZE_64M+1)))
awilliam@9011 328 panic("vti domain needs 128M memory at least\n");
awilliam@9011 329 /*
djm@6799 330 order = get_order_from_pages(conf_nr);
djm@6799 331 if (unlikely((page = alloc_domheap_pages(d, order, 0)) == NULL)) {
djm@6799 332 printk("Could not allocate order=%d pages for vmx contig alloc\n",
djm@6799 333 order);
djm@6799 334 return -1;
djm@6799 335 }
awilliam@9011 336 */
awilliam@9011 337
awilliam@9011 338 /* reserve contiguous 64M for linux kernel */
awilliam@9011 339
awilliam@9011 340 if (unlikely((page = alloc_domheap_pages(d,(KERNEL_TR_PAGE_SHIFT-PAGE_SHIFT), 0)) == NULL)) {
awilliam@9011 341 printk("No enough memory for vti domain!!!\n");
awilliam@9011 342 return -1;
awilliam@9011 343 }
awilliam@9011 344 pgnr = page_to_mfn(page);
awilliam@9011 345 for (i=(1UL<<KERNEL_TR_PAGE_SHIFT);i<(1UL<<(KERNEL_TR_PAGE_SHIFT+1));i+=PAGE_SIZE,pgnr++){
awilliam@9011 346 assign_domain_page(d, i, pgnr << PAGE_SHIFT);
awilliam@9011 347 }
awilliam@9011 348
awilliam@9011 349 for (i = 0; i < (1UL<<KERNEL_TR_PAGE_SHIFT) ; i += PAGE_SIZE){
awilliam@9011 350 if (unlikely((page = alloc_domheap_pages(d, 0, 0)) == NULL)) {
awilliam@9011 351 printk("No enough memory for vti domain!!!\n");
awilliam@9011 352 return -1;
awilliam@9011 353 }
awilliam@9011 354 pgnr = page_to_mfn(page);
awilliam@9011 355 assign_domain_page(d, i, pgnr << PAGE_SHIFT);
awilliam@9011 356 }
djm@6799 357
djm@6799 358 /* Map normal memory below 3G */
djm@6799 359 end = conf_nr << PAGE_SHIFT;
awilliam@9011 360 tmp = end < MMIO_START ? end : MMIO_START;
awilliam@9011 361 for (i = (1UL<<(KERNEL_TR_PAGE_SHIFT+1)); i < tmp; i += PAGE_SIZE){
awilliam@9011 362 if (unlikely((page = alloc_domheap_pages(d, 0, 0)) == NULL)) {
awilliam@9011 363 printk("No enough memory for vti domain!!!\n");
awilliam@9011 364 return -1;
awilliam@9011 365 }
awilliam@9011 366 pgnr = page_to_mfn(page);
awilliam@8778 367 assign_domain_page(d, i, pgnr << PAGE_SHIFT);
awilliam@9011 368 }
djm@6799 369 /* Map normal memory beyond 4G */
djm@6799 370 if (unlikely(end > MMIO_START)) {
djm@6799 371 start = 4 * MEM_G;
djm@6799 372 end = start + (end - 3 * MEM_G);
awilliam@9011 373 for (i = start; i < end; i += PAGE_SIZE){
awilliam@9011 374 if (unlikely((page = alloc_domheap_pages(d, 0, 0)) == NULL)) {
awilliam@9011 375 printk("No enough memory for vti domain!!!\n");
awilliam@9011 376 return -1;
awilliam@9011 377 }
awilliam@9011 378 pgnr = page_to_mfn(page);
awilliam@9011 379 assign_domain_page(d, i, pgnr << PAGE_SHIFT);
awilliam@9011 380 }
djm@6799 381 }
djm@6799 382
djm@6799 383 d->arch.max_pfn = end >> PAGE_SHIFT;
awilliam@9011 384 /*
djm@7333 385 order = get_order_from_pages(GFW_SIZE >> PAGE_SHIFT);
djm@6799 386 if (unlikely((page = alloc_domheap_pages(d, order, 0)) == NULL)) {
djm@6799 387 printk("Could not allocate order=%d pages for vmx contig alloc\n",
awilliam@9011 388 order);`
djm@6799 389 return -1;
djm@6799 390 }
awilliam@9011 391 */
djm@7333 392 /* Map guest firmware */
awilliam@9011 393 for (i = GFW_START; i < GFW_START + GFW_SIZE; i += PAGE_SIZE, pgnr++){
awilliam@9011 394 if (unlikely((page = alloc_domheap_pages(d, 0, 0)) == NULL)) {
awilliam@9011 395 printk("No enough memory for vti domain!!!\n");
awilliam@9011 396 return -1;
awilliam@9011 397 }
awilliam@9011 398 pgnr = page_to_mfn(page);
awilliam@8778 399 assign_domain_page(d, i, pgnr << PAGE_SHIFT);
awilliam@9011 400 }
djm@7333 401
awilliam@9011 402 /*
djm@7333 403 if (unlikely((page = alloc_domheap_pages(d, 1, 0)) == NULL)) {
djm@7333 404 printk("Could not allocate order=1 pages for vmx contig alloc\n");
djm@7333 405 return -1;
djm@7333 406 }
awilliam@9011 407 */
djm@6799 408 /* Map for shared I/O page and xenstore */
awilliam@9011 409 if (unlikely((page = alloc_domheap_pages(d, 0, 0)) == NULL)) {
awilliam@9011 410 printk("No enough memory for vti domain!!!\n");
awilliam@9011 411 return -1;
awilliam@9011 412 }
kaf24@8726 413 pgnr = page_to_mfn(page);
awilliam@8778 414 assign_domain_page(d, IO_PAGE_START, pgnr << PAGE_SHIFT);
awilliam@9011 415
awilliam@9011 416 if (unlikely((page = alloc_domheap_pages(d, 0, 0)) == NULL)) {
awilliam@9011 417 printk("No enough memory for vti domain!!!\n");
awilliam@9011 418 return -1;
awilliam@9011 419 }
awilliam@9011 420 pgnr = page_to_mfn(page);
awilliam@8778 421 assign_domain_page(d, STORE_PAGE_START, pgnr << PAGE_SHIFT);
djm@6799 422
djm@6799 423 set_bit(ARCH_VMX_CONTIG_MEM, &v->arch.arch_vmx.flags);
djm@6799 424 return 0;
djm@6799 425 }
djm@7333 426
kaf24@7720 427 void vmx_setup_platform(struct domain *d, struct vcpu_guest_context *c)
djm@7333 428 {
djm@7333 429 ASSERT(d != dom0); /* only for non-privileged vti domain */
djm@7333 430 d->arch.vmx_platform.shared_page_va =
awilliam@8916 431 (unsigned long)__va(__gpa_to_mpa(d, IO_PAGE_START));
djm@7333 432 /* TEMP */
djm@7333 433 d->arch.vmx_platform.pib_base = 0xfee00000UL;
djm@7333 434
djm@7333 435 /* Only open one port for I/O and interrupt emulation */
kaf24@7720 436 memset(&d->shared_info->evtchn_mask[0], 0xff,
kaf24@7720 437 sizeof(d->shared_info->evtchn_mask));
djm@7333 438
kaf24@7720 439 /* Initialize the virtual interrupt lines */
kaf24@7720 440 vmx_virq_line_init(d);
djm@7333 441
kaf24@7720 442 /* Initialize iosapic model within hypervisor */
kaf24@8708 443 hvm_vioapic_init(d);
djm@7333 444 }
djm@7333 445
kaf24@8971 446 void vmx_do_launch(struct vcpu *v)
kaf24@8971 447 {
kaf24@8971 448 if (evtchn_bind_vcpu(iopacket_port(v), v->vcpu_id) < 0) {
kaf24@8971 449 printk("VMX domain bind port %d to vcpu %d failed!\n",
kaf24@8971 450 iopacket_port(v), v->vcpu_id);
kaf24@8971 451 domain_crash_synchronous();
kaf24@8971 452 }
djm@7333 453
kaf24@8971 454 clear_bit(iopacket_port(v),
kaf24@8971 455 &v->domain->shared_info->evtchn_mask[0]);
kaf24@8971 456
kaf24@8971 457 vmx_load_all_rr(v);
kaf24@8971 458 }