@@ -1086,9 +1086,6 @@ static int cf_check hvm_load_cpu_ctxt(st
v->arch.hvm.guest_cr[2] = ctxt.cr2;
hvm_update_guest_cr(v, 2);
- if ( hvm_funcs.tsc_scaling.setup )
- alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
-
v->arch.msrs->tsc_aux = ctxt.msr_tsc_aux;
hvm_set_guest_tsc_fixed(v, ctxt.tsc, d->arch.hvm.sync_tsc);
@@ -4033,9 +4030,6 @@ void hvm_vcpu_reset_state(struct vcpu *v
hvm_set_segment_register(v, x86_seg_gdtr, ®);
hvm_set_segment_register(v, x86_seg_idtr, ®);
- if ( hvm_funcs.tsc_scaling.setup )
- alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
-
/* Sync AP's TSC with BSP's. */
v->arch.hvm.cache_tsc_offset =
v->domain->vcpu[0]->arch.hvm.cache_tsc_offset;
@@ -1454,20 +1454,13 @@ static void cf_check vmx_handle_cd(struc
}
}
-static void cf_check vmx_setup_tsc_scaling(struct vcpu *v)
-{
- if ( v->domain->arch.vtsc )
- return;
-
- vmx_vmcs_enter(v);
- __vmwrite(TSC_MULTIPLIER, hvm_tsc_scaling_ratio(v->domain));
- vmx_vmcs_exit(v);
-}
-
static void cf_check vmx_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc)
{
vmx_vmcs_enter(v);
+ if ( !v->domain->arch.vtsc && cpu_has_vmx_tsc_scaling )
+ __vmwrite(TSC_MULTIPLIER, hvm_tsc_scaling_ratio(v->domain));
+
if ( nestedhvm_vcpu_in_guestmode(v) )
offset += nvmx_get_tsc_offset(v);
@@ -3031,10 +3024,7 @@ const struct hvm_function_table * __init
}
if ( cpu_has_vmx_tsc_scaling )
- {
vmx_function_table.tsc_scaling.ratio_frac_bits = 48;
- vmx_function_table.tsc_scaling.setup = vmx_setup_tsc_scaling;
- }
model_specific_lbr = get_model_specific_lbr();
lbr_tsx_fixup_check();
@@ -240,9 +240,6 @@ struct hvm_function_table {
uint8_t ratio_frac_bits;
/* maximum-allowed TSC scaling ratio */
uint64_t max_ratio;
-
- /* Architecture function to setup TSC scaling ratio */
- void (*setup)(struct vcpu *v);
} tsc_scaling;
};