now marked as experimental. TSC offseting support is turned back on in svm.c and
vmx.c, but the offset should now always be zero unless time dilation support is
turned on (and it is currently broken).
menu "Time Management"
-config VIRTUALIZE_TIME
- bool "Enable Time virtualization"
+config TIME_DILATION
+ bool "Control Guest/Host Time Offseting"
default n
+ depends on EXPERIMENTAL
help
- Enables the timer virtualization extensions
-
+ Controls the relative speeds of the guest and host processor
+ to allow the VM to provide the illusion of the guest seeing time
+ pass at a different rate than the host system does.
+
config TIME_HIDE_VM_COST
bool "Hide VMM Run Cost"
default n
- depends on VIRTUALIZE_TIME
+ depends on EXPERIMENTAL
help
Offset guest time from host time sufficiently to hide the cost of
running in the virtual machine. This can aid the consistency of
config TIME_VIRTUALIZE_TSC
bool "Fully virtualize guest TSC"
default n
- depends on VIRTUALIZE_TIME
+ depends on EXPERIMENTAL
help
Virtualize the processor time stamp counter in the guest,
generally increasing consistency between various time sources
but also potentially making guest time run slower than real time.
-
+
endmenu
#endif
v3_time_enter_vm(info);
- // guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state);
+ guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state);
//V3_Print("Calling v3_svm_launch\n");
return 0;
}
+#ifdef V3_CONFIG_TIME_DILATION
static uint64_t compute_target_host_time(struct guest_info * info)
{
struct vm_time * time_state = &(info->time_state);
return 0;
}
+#endif /* V3_CONFIG_TIME_DILATION */
// Control guest time in relation to host time so that the two stay
// appropriately synchronized to the extent possible.
int v3_adjust_time(struct guest_info * info) {
+#ifdef V3_CONFIG_TIME_DILATION
/* First deal with yielding if we want to slow down the guest */
yield_host_time(info);
* or because the VMM is doing something that takes a long time to emulate)
* allow guest time to jump forward a bit */
skew_guest_time(info);
-
+#endif
return 0;
}
host_time = v3_get_host_time(time_state);
guest_time = v3_get_guest_time(time_state);
time_state->enter_time = host_time;
+#ifdef V3_CONFIG_TIME_DILATION
time_state->guest_host_offset = (sint64_t)guest_time - (sint64_t)host_time;
+#else
+ time_state->guest_host_offset = 0;
+#endif
return 0;
}
*/
int v3_vmx_enter(struct guest_info * info) {
int ret = 0;
- //uint32_t tsc_offset_low, tsc_offset_high;
+ uint32_t tsc_offset_low, tsc_offset_high;
struct vmx_exit_info exit_info;
struct vmx_data * vmx_info = (struct vmx_data *)(info->vmm_data);
// Perform last-minute time bookkeeping prior to entering the VM
v3_time_enter_vm(info);
- // tsc_offset_high = (uint32_t)((v3_tsc_host_offset(&info->time_state) >> 32) & 0xffffffff);
- // tsc_offset_low = (uint32_t)(v3_tsc_host_offset(&info->time_state) & 0xffffffff);
- // check_vmcs_write(VMCS_TSC_OFFSET_HIGH, tsc_offset_high);
- // check_vmcs_write(VMCS_TSC_OFFSET, tsc_offset_low);
+ tsc_offset_high = (uint32_t)((v3_tsc_host_offset(&info->time_state) >> 32) & 0xffffffff);
+ tsc_offset_low = (uint32_t)(v3_tsc_host_offset(&info->time_state) & 0xffffffff);
+ check_vmcs_write(VMCS_TSC_OFFSET_HIGH, tsc_offset_high);
+ check_vmcs_write(VMCS_TSC_OFFSET, tsc_offset_low);
if (v3_update_vmcs_host_state(info)) {
v3_enable_ints();