X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_time.c;h=a028b2f45d7d880f74a226376e40a993ca438c96;hb=198151f1d58834ff7889389007232a3d250f51f1;hp=f7cbb9e77e8cc40c98205db58bf372e814346248;hpb=5a8d27bb121cfde8da7098c36984e16aa21db594;p=palacios.git diff --git a/palacios/src/palacios/vmm_time.c b/palacios/src/palacios/vmm_time.c index f7cbb9e..a028b2f 100644 --- a/palacios/src/palacios/vmm_time.c +++ b/palacios/src/palacios/vmm_time.c @@ -346,7 +346,7 @@ handle_time_configuration(struct v3_vm_info * vm, v3_cfg_tree_t *cfg) { } else { PrintDebug(vm, VCORE_NONE,"VM time slaved to host TSC.\n"); } - } + } // Should we make a separate TSC device that handles this sort of thing? tsc = v3_cfg_val(cfg, "tsc"); @@ -356,7 +356,7 @@ handle_time_configuration(struct v3_vm_info * vm, v3_cfg_tree_t *cfg) { PrintError(vm, VCORE_NONE, "WARNING: Guest TSC set to passthrough host TSC, but guest time not slaved to host time."); } vm->time_state.flags |= V3_TIME_TSC_PASSTHROUGH; - } else if (strcasecmp(source, "guest") != 0) { + } else if (!source || (strcasecmp(source, "guest") != 0)) { PrintError(vm, VCORE_NONE, "ERROR: Unknown TSC configuration in time configuration.\n"); } } @@ -388,7 +388,7 @@ handle_time_configuration(struct v3_vm_info * vm, v3_cfg_tree_t *cfg) { int v3_init_time_vm(struct v3_vm_info * vm) { v3_cfg_tree_t * cfg_tree = vm->cfg_data->cfg; - int ret; + int ret=0; PrintDebug(vm, VCORE_NONE, "Installing TSC MSR hook.\n"); ret = v3_hook_msr(vm, TSC_MSR, @@ -409,10 +409,19 @@ int v3_init_time_vm(struct v3_vm_info * vm) { PrintDebug(vm, VCORE_NONE, "Registering TIME_CPUFREQ hypercall.\n"); ret = v3_register_hypercall(vm, TIME_CPUFREQ_HCALL, handle_cpufreq_hcall, NULL); + + if (ret!=0) { + return ret; + } + PrintDebug(vm, VCORE_NONE, "Registering TIME_RDHTSC hypercall.\n"); ret = v3_register_hypercall(vm, TIME_RDHTSC_HCALL, handle_rdhtsc_hcall, NULL); + if (ret!=0) { + return ret; + } + handle_time_configuration(vm, v3_cfg_subtree(cfg_tree, "time")); return ret; @@ -490,7 +499,7 @@ void v3_init_time_core(struct guest_info * info) { (time_state->clock_ratio_num != 1) || (info->vm_info->time_state.td_num != 1) || (info->vm_info->time_state.td_denom != 1)) { - if (time_state->flags | VM_TIME_TSC_PASSTHROUGH) { + if (time_state->flags & VM_TIME_TSC_PASSTHROUGH) { PrintError(info->vm_info, info, "WARNING: Cannot use reqested passthrough TSC with clock or time modification also requested.\n"); time_state->flags &= ~VM_TIME_TSC_PASSTHROUGH; }