debuggers.hg
changeset 16654:136f80d21958
cpufreq: Always return successfully from cpufreq MSR traps
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Dec 14 11:37:02 2007 +0000 (2007-12-14) |
parents | 3ee37b6279b7 |
children | cb0ce96c02de |
files | xen/arch/x86/traps.c |
line diff
1.1 --- a/xen/arch/x86/traps.c Fri Dec 14 10:48:18 2007 +0000 1.2 +++ b/xen/arch/x86/traps.c Fri Dec 14 11:37:02 2007 +0000 1.3 @@ -1878,7 +1878,7 @@ static int emulate_privileged_op(struct 1.4 eax = regs->eax; 1.5 edx = regs->edx; 1.6 res = ((u64)edx << 32) | eax; 1.7 - switch ( regs->ecx ) 1.8 + switch ( (u32)regs->ecx ) 1.9 { 1.10 #ifdef CONFIG_X86_64 1.11 case MSR_FS_BASE: 1.12 @@ -1916,15 +1916,19 @@ static int emulate_privileged_op(struct 1.13 case MSR_K8_PSTATE5: 1.14 case MSR_K8_PSTATE6: 1.15 case MSR_K8_PSTATE7: 1.16 - if ( (cpufreq_controller != FREQCTL_dom0_kernel) || 1.17 - (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) || 1.18 - wrmsr_safe(regs->ecx, eax, edx) ) 1.19 + if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) 1.20 + goto fail; 1.21 + if ( cpufreq_controller != FREQCTL_dom0_kernel ) 1.22 + break; 1.23 + if ( wrmsr_safe(regs->ecx, eax, edx) != 0 ) 1.24 goto fail; 1.25 break; 1.26 case MSR_IA32_PERF_CTL: 1.27 - if ( (cpufreq_controller != FREQCTL_dom0_kernel) || 1.28 - (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) || 1.29 - wrmsr_safe(regs->ecx, eax, edx) ) 1.30 + if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) 1.31 + goto fail; 1.32 + if ( cpufreq_controller != FREQCTL_dom0_kernel ) 1.33 + break; 1.34 + if ( wrmsr_safe(regs->ecx, eax, edx) != 0 ) 1.35 goto fail; 1.36 break; 1.37 default: 1.38 @@ -1944,7 +1948,7 @@ static int emulate_privileged_op(struct 1.39 break; 1.40 1.41 case 0x32: /* RDMSR */ 1.42 - switch ( regs->ecx ) 1.43 + switch ( (u32)regs->ecx ) 1.44 { 1.45 #ifdef CONFIG_X86_64 1.46 case MSR_FS_BASE: 1.47 @@ -1979,9 +1983,14 @@ static int emulate_privileged_op(struct 1.48 case MSR_K8_PSTATE5: 1.49 case MSR_K8_PSTATE6: 1.50 case MSR_K8_PSTATE7: 1.51 - if ( (cpufreq_controller != FREQCTL_dom0_kernel) || 1.52 - (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) || 1.53 - rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) 1.54 + if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) 1.55 + goto fail; 1.56 + if ( cpufreq_controller != FREQCTL_dom0_kernel ) 1.57 + { 1.58 + regs->eax = regs->edx = 0; 1.59 + break; 1.60 + } 1.61 + if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) != 0 ) 1.62 goto fail; 1.63 break; 1.64 case MSR_EFER: