Mark Langsdorf
2007-Dec-13 00:15 UTC
[Xen-devel] [PATCH][cpufreq] Always return successfully from PowerNow! MSR traps
When testing the Xen PowerNow! driver, we discovered the Linux kernel will oops while accessing the AMD PowerNow! MSRs if "cpufreq=dom0-kernel" is not passed on the Xen command line. Fix this bug by having the MSR access always succeed, even if the data involved is bogus. Note that kernels other than dom0 still cannot access the PowerNow! MSRs. Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com> diff -r 4054cd60895b xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Mon Dec 10 13:49:22 2007 +0000 +++ b/xen/arch/x86/traps.c Wed Dec 12 17:52:12 2007 -0600 @@ -1911,7 +1911,7 @@ static int emulate_privileged_op(struct if ( (cpufreq_controller != FREQCTL_dom0_kernel) || (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) || wrmsr_safe(regs->ecx, eax, edx) ) - goto fail; + eax = 0; break; case MSR_IA32_PERF_CTL: if ( (cpufreq_controller != FREQCTL_dom0_kernel) || @@ -1974,7 +1974,7 @@ static int emulate_privileged_op(struct if ( (cpufreq_controller != FREQCTL_dom0_kernel) || (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) || rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) - goto fail; + regs->eax = regs->edx = 0; break; case MSR_EFER: if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel