Skip to contentSkip to conversation

Allow dom0 pstate control to read MSRs

PATCH New Mark Langsdorf 1 participant 1 message Aug 12, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow dom0 pstate control to read MSRs

The current version of the powernow driver uses the APERF/MPEF and the HWCR MSRs. Add cases in traps.c to let dom0 access those MSRs.

The previous version used some old code. This version is correct.

--Mark Langsdorf
Operating System Research Center

xen/arch/x86/traps.c +10 -0
diff -r f45026ec8db5 xen/arch/x86/traps.c
@@ -2228,6 +2228,7 @@
         case MSR_K8_PSTATE5:
         case MSR_K8_PSTATE6:
         case MSR_K8_PSTATE7:
+        case MSR_K8_HWCR:
             if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD )
                 goto fail;
             if ( !is_cpufreq_controller(v->domain) )
@@ -2267,6 +2268,15 @@
             break;
         case MSR_IA32_MPERF:
         case MSR_IA32_APERF:
+            if (( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) &&
+                ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) )
+                goto fail;
+            if ( !is_cpufreq_controller(v->domain) )
+                break;
+            if ( wrmsr_safe(regs->ecx, msr_content ) != 0 )
+                goto fail;
+            break;
+
         case MSR_IA32_PERF_CTL:
             if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
                 goto fail;