debuggers.hg

changeset 20842:13d4e78ede97

x86 hvm: Change default setting of guest CPUID RDTSCP bit

Expose RDTSCP CPUID to guest only when tsc_mode == TSC_MODE_DEFAULT
and host_tsc_is_safe() returns 1.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 13 08:33:34 2010 +0000 (2010-01-13)
parents 6512068aa0db
children 517364d0823d
files xen/arch/x86/hvm/hvm.c xen/arch/x86/time.c xen/include/asm-x86/time.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Wed Jan 13 08:18:38 2010 +0000
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Wed Jan 13 08:33:34 2010 +0000
     1.3 @@ -1955,8 +1955,10 @@ void hvm_cpuid(unsigned int input, unsig
     1.4          }
     1.5          break;
     1.6      case 0x80000001:
     1.7 -        /* Don't expose RDTSCP feature when in PVRDTSCP mode. */
     1.8 -        if ( v->domain->arch.tsc_mode == TSC_MODE_PVRDTSCP )
     1.9 +        /* We expose RDTSCP feature to guest only when
    1.10 +           tsc_mode == TSC_MODE_DEFAULT and host_tsc_is_safe() returns 1 */
    1.11 +        if ( v->domain->arch.tsc_mode != TSC_MODE_DEFAULT ||
    1.12 +             !host_tsc_is_safe() )
    1.13              *edx &= ~bitmaskof(X86_FEATURE_RDTSCP);
    1.14          break;
    1.15      }
     2.1 --- a/xen/arch/x86/time.c	Wed Jan 13 08:18:38 2010 +0000
     2.2 +++ b/xen/arch/x86/time.c	Wed Jan 13 08:33:34 2010 +0000
     2.3 @@ -1628,7 +1628,7 @@ void pv_soft_rdtsc(struct vcpu *v, struc
     2.4               (d->arch.tsc_mode == TSC_MODE_PVRDTSCP) ? d->arch.incarnation : 0;
     2.5  }
     2.6  
     2.7 -static int host_tsc_is_safe(void)
     2.8 +int host_tsc_is_safe(void)
     2.9  {
    2.10      if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
    2.11          return 1;
     3.1 --- a/xen/include/asm-x86/time.h	Wed Jan 13 08:18:38 2010 +0000
     3.2 +++ b/xen/include/asm-x86/time.h	Wed Jan 13 08:33:34 2010 +0000
     3.3 @@ -70,6 +70,7 @@ void tsc_get_info(struct domain *d, uint
     3.4  
     3.5  void force_update_vcpu_system_time(struct vcpu *v);
     3.6  
     3.7 +int host_tsc_is_safe(void);
     3.8  void cpuid_time_leaf(uint32_t sub_idx, unsigned int *eax, unsigned int *ebx,
     3.9                        unsigned int *ecx, unsigned int *edx);
    3.10