* [PATCH] x86 cpufreq: use rdmsrl/wrmsrl
@ 2010-06-25 11:44 Christoph Egger
0 siblings, 0 replies; only message in thread
From: Christoph Egger @ 2010-06-25 11:44 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 418 bytes --]
Hi!
Attached patch makes x86 cpufreq code using rdmsrl/wrmsrl
and cleans up surrounding code.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_cpufreq.diff --]
[-- Type: text/x-diff, Size: 3977 bytes --]
diff -r b54f9c9f9144 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Wed Jun 23 23:24:42 2010 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Thu Jun 24 17:36:42 2010 +0200
@@ -137,13 +137,12 @@ struct drv_cmd {
static void do_drv_read(void *drvcmd)
{
struct drv_cmd *cmd;
- u32 h;
cmd = (struct drv_cmd *)drvcmd;
switch (cmd->type) {
case SYSTEM_INTEL_MSR_CAPABLE:
- rdmsr(cmd->addr.msr.reg, cmd->val, h);
+ rdmsrl(cmd->addr.msr.reg, cmd->val);
break;
case SYSTEM_IO_CAPABLE:
acpi_os_read_port((acpi_io_address)cmd->addr.io.port,
@@ -157,15 +156,16 @@ static void do_drv_read(void *drvcmd)
static void do_drv_write(void *drvcmd)
{
struct drv_cmd *cmd;
- u32 lo, hi;
+ uint64_t msr_content;
cmd = (struct drv_cmd *)drvcmd;
switch (cmd->type) {
case SYSTEM_INTEL_MSR_CAPABLE:
- rdmsr(cmd->addr.msr.reg, lo, hi);
- lo = (lo & ~INTEL_MSR_RANGE) | (cmd->val & INTEL_MSR_RANGE);
- wrmsr(cmd->addr.msr.reg, lo, hi);
+ rdmsrl(cmd->addr.msr.reg, msr_content);
+ msr_content = (msr_content & ~INTEL_MSR_RANGE)
+ | (cmd->val & INTEL_MSR_RANGE);
+ wrmsrl(cmd->addr.msr.reg, msr_content);
break;
case SYSTEM_IO_CAPABLE:
acpi_os_write_port((acpi_io_address)cmd->addr.io.port,
@@ -252,8 +252,8 @@ static void read_measured_perf_ctrs(void
{
struct perf_pair *readin = _readin;
- rdmsr(MSR_IA32_APERF, readin->aperf.split.lo, readin->aperf.split.hi);
- rdmsr(MSR_IA32_MPERF, readin->mperf.split.lo, readin->mperf.split.hi);
+ rdmsrl(MSR_IA32_APERF, readin->aperf.whole);
+ rdmsrl(MSR_IA32_MPERF, readin->mperf.whole);
}
/*
diff -r b54f9c9f9144 xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c Wed Jun 23 23:24:42 2010 +0100
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c Thu Jun 24 17:36:42 2010 +0200
@@ -44,7 +44,7 @@
#define USE_HW_PSTATE 0x00000080
#define HW_PSTATE_MASK 0x00000007
#define HW_PSTATE_VALID_MASK 0x80000000
-#define HW_PSTATE_MAX_MASK 0x000000f0
+#define HW_PSTATE_MAX_MASK 0x000000f000000000ULL
#define HW_PSTATE_MAX_SHIFT 4
#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */
#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */
@@ -77,15 +77,15 @@ static void transition_pstate(void *drvc
cmd = (struct drv_cmd *) drvcmd;
if (cmd->turbo != CPUFREQ_TURBO_UNSUPPORTED) {
- u32 lo, hi;
- rdmsr(MSR_K8_HWCR, lo, hi);
+ uint64_t msr_content;
+ rdmsrl(MSR_K8_HWCR, msr_content);
if (cmd->turbo == CPUFREQ_TURBO_ENABLED)
- lo &= ~MSR_HWCR_CPBDIS_MASK;
+ msr_content &= ~MSR_HWCR_CPBDIS_MASK;
else
- lo |= MSR_HWCR_CPBDIS_MASK;
- wrmsr(MSR_K8_HWCR, lo, hi);
+ msr_content |= MSR_HWCR_CPBDIS_MASK;
+ wrmsrl(MSR_K8_HWCR, msr_content);
}
- wrmsr(MSR_PSTATE_CTRL, cmd->val, 0);
+ wrmsrl(MSR_PSTATE_CTRL, cmd->val);
}
static int powernow_cpufreq_target(struct cpufreq_policy *policy,
@@ -194,7 +194,8 @@ static int powernow_cpufreq_cpu_init(str
struct powernow_cpufreq_data *data;
unsigned int result = 0;
struct processor_performance *perf;
- u32 max_hw_pstate, hi = 0, lo = 0;
+ u32 max_hw_pstate;
+ uint64_t msr_content;
struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
data = xmalloc(struct powernow_cpufreq_data);
@@ -226,8 +227,8 @@ static int powernow_cpufreq_cpu_init(str
result = -ENODEV;
goto err_unreg;
}
- rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo);
- max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
+ rdmsrl(MSR_PSTATE_CUR_LIMIT, msr_content);
+ max_hw_pstate = (msr_content & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
if (perf->control_register.space_id != perf->status_register.space_id) {
result = -ENODEV;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-25 11:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 11:44 [PATCH] x86 cpufreq: use rdmsrl/wrmsrl Christoph Egger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.