From: "Mark Langsdorf" Subject: [PATCH][cpufreq] Always return successfully from PowerNow! MSR traps Date: Wed, 12 Dec 2007 18:15:02 -0600 Message-ID: <200712121815.02703.mark.langsdorf@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com, Joachim Deguara List-Id: xen-devel@lists.xenproject.org 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 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) )