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:
Boris Ostrovsky committed 2012-04-25 13:53:14 +01:00
1 parent 6e1a7d28c9
commit 4aab59a3c5
1 file changed
+8 -1
+8 -1
View File
@@ -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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.