Skip to contentSkip to conversation

Always return successfully from PowerNow! MSR traps

PATCH New Mark Langsdorf 1 participant 1 message Dec 13, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

xen/arch/x86/traps.c +2 -2
diff -r 4054cd60895b xen/arch/x86/traps.c
@@ -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) )