github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/vmexit/vmexit_init.c (about) 1 /* 2 * Copyright (c) 2013 Intel Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * Unless required by applicable law or agreed to in writing, software 9 * distributed under the License is distributed on an "AS IS" BASIS, 10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 * See the License for the specific language governing permissions and 12 * limitations under the License. 13 */ 14 15 #include "file_codes.h" 16 #define VMM_DEADLOOP() VMM_DEADLOOP_LOG(VMEXIT_INIT_C) 17 #define VMM_ASSERT(__condition) VMM_ASSERT_LOG(VMEXIT_INIT_C, __condition) 18 #include "vmm_defs.h" 19 #include "guest_cpu.h" 20 #include "guest.h" 21 #include "local_apic.h" 22 #include "vmm_dbg.h" 23 #include "hw_utils.h" 24 #include "vmcs_init.h" 25 #include "vmm_events_data.h" 26 #ifdef JLMDEBUG 27 #include "jlmdebug.h" 28 #endif 29 30 31 // FUNCTION : vmexit_init_event() 32 // PURPOSE : reset CPU 33 // ARGUMENTS: GUEST_CPU_HANDLE gcpu 34 // NOTE : Propagate INIT signal from primary guest to CPU 35 VMEXIT_HANDLING_STATUS vmexit_init_event(GUEST_CPU_HANDLE gcpu) 36 { 37 CPU_ID cpu_id = hw_cpu_id(); 38 39 VMM_LOG(mask_anonymous, level_trace, 40 "INIT signal in Guest#%d GuestCPU#%d HostCPU#%d\n", 41 guest_vcpu(gcpu)->guest_id, guest_vcpu(gcpu)->guest_cpu_id, hw_cpu_id()); 42 VMM_ASSERT(guest_is_primary(gcpu_guest_handle(gcpu))); 43 if (cpu_id == 0) { // If cpu is BSP 44 VMM_LOG(mask_anonymous, level_trace,"[%d] Perform global reset\n", cpu_id); 45 hw_reset_platform(); // then preform cold reset. 46 VMM_DEADLOOP(); 47 } 48 else { 49 VMM_LOG(mask_anonymous, level_trace,"[%d] Switch to Wait for SIPI mode\n", cpu_id); 50 // Switch to Wait for SIPI state. 51 gcpu_set_activity_state(gcpu, Ia32VmxVmcsGuestSleepStateWaitForSipi); 52 } 53 return VMEXIT_HANDLED; 54 } 55 56