mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
svm: Do not intercept RDTSC(P) when TSC scaling is supported by hardware
When running in TSC_MODE_ALWAYS_EMULATE mode on processors that support TSC scaling we don't need to intercept RDTSC/RDTSCP instructions. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Acked-by: Wei Huang <wei.huang2@amd.com> Tested-by: Wei Huang <wei.huang2@amd.com> Committed-by: Keir Fraser <keir@xen.org>
This commit is contained in:
1 parent
6e1a7d28c9
commit
4aab59a3c5
1 file changed
+8
-1
@@ -724,12 +724,19 @@ static void svm_set_rdtsc_exiting(struct vcpu *v, bool_t enable)
|
||||
{
|
||||
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
|
||||
u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
|
||||
u32 general2_intercepts = vmcb_get_general2_intercepts(vmcb);
|
||||
|
||||
general1_intercepts &= ~GENERAL1_INTERCEPT_RDTSC;
|
||||
if ( enable )
|
||||
general2_intercepts &= ~GENERAL2_INTERCEPT_RDTSCP;
|
||||
|
||||
if ( enable && !cpu_has_tsc_ratio )
|
||||
{
|
||||
general1_intercepts |= GENERAL1_INTERCEPT_RDTSC;
|
||||
general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP;
|
||||
}
|
||||
|
||||
vmcb_set_general1_intercepts(vmcb, general1_intercepts);
|
||||
vmcb_set_general2_intercepts(vmcb, general2_intercepts);
|
||||
}
|
||||
|
||||
static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
|
||||
|
||||