WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] powernow-k8 + linux-image-2.6.16-1-xen-k7

To: Hannes Petschauer <hapet@xxxxxx>, xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] powernow-k8 + linux-image-2.6.16-1-xen-k7
From: Ralf Schenk <rs@xxxxxxxxxx>
Date: Sun, 17 Sep 2006 12:35:29 +0200
Delivery-date: Sun, 17 Sep 2006 03:36:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <450D16D9.5030205@xxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <450D16D9.5030205@xxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)
Hannes Petschauer schrieb:
> Hi
> 
> i'm running sarge, xen 3.0.2 with original debian-kernel 2.6.16-1-xen-k7.
> 
> my problem:
> when i try to alter cpufrequency in dom0 via
> /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed,
> it results in an error:
> powernow-k8: vid trans failed, vid 0x11, curr 0x12
> 
> when i boot my coputer with non-Xen debian-kernel 2.6.16-1-k7, i have no
> problem changing cpu-speed.
> 
> do i have to use a more recent kernel or xen-unstable to get it work
> (which), or is there a other problem?
> 
> Thanks!

You have to patch the kernel to get powernow-k8 running under xen. The
(small) patch is attached and works for me for kernel 2.6.16.[0-29].

Bye

-- 
__________________________________________________

Ralf Schenk
fon (02 41) 9 91 21-0
fax (02 41) 9 91 21-59
rs@xxxxxxxxxx

Databay AG
Hüttenstraße 7
D-52068 Aachen
www.databay.de

Databay - einfach machen.

_________________________________________________

Diese E-Mail und etwa angehängte Dateien enthalten vertrauliche
Informationen und sind ausschließlich für den Adressaten bestimmt.
Sollten Sie irrtümlich diese E-Mail erhalten haben, bitten wir Sie,
uns darüber unter info@xxxxxxxxxx zu informieren und die E-Mail
ungelesen an uns zurückzusenden und aus Ihrem System zu löschen.

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
info@xxxxxxxxxxx If you are not the named recipient, you should return
this message without reading further and delete it from your system.
--- 
linux-2.6.16-mtyrel-k8-64bit-xen/arch/i386/kernel/cpu/cpufreq/powernow-k8.c~    
    2006-03-28 13:52:05.553985250 -0500
+++ linux-2.6.16-mtyrel-k8-64bit-xen/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 
2006-03-29 18:30:17.260355500 -0500
@@ -48,6 +48,37 @@
 #define VERSION "version 1.60.0"
 #include "powernow-k8.h"
 
+/* Xen support */
+
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+int xen_access_msr(u32 msr, int write, u32* out1, u32* out2, u32 in1, u32 in2) 
{
+       dom0_op_t op;
+       op.cmd = DOM0_MSR;
+  op.u.msr.write = write;
+  op.u.msr.cpu_mask = 1; /* only first CPU: not clear how to read multiple 
CPUs */
+  op.u.msr.msr = msr;
+  op.u.msr.in1 = in1;
+  op.u.msr.in2 = in2;
+       BUG_ON(HYPERVISOR_dom0_op(&op));
+
+  if (!write) {
+    *out1 = op.u.msr.out1; /* low 32 bits */
+    *out2 = op.u.msr.out2; /* high 32 bits */
+  }
+
+  return 0;
+}
+
+#define cpu_rdmsr(msr, val1, val2) xen_access_msr((msr), 0, &(val1), &(val2), 
0, 0)
+#define cpu_wrmsr(msr, val1, val2) xen_access_msr((msr), 1, NULL, NULL, 
(val1), (val2))
+
+#else
+
+#define cpu_rdmsr(msr, val1, val2) rdmsr(msr, val1, val2)
+#define cpu_wrmsr(msr, val1, val2) wrmsr(msr, val1, val2)
+
+#endif
+
 /* serialize freq changes  */
 static DECLARE_MUTEX(fidvid_sem);
 
@@ -98,7 +129,7 @@
 {
        u32 lo, hi;
 
-       rdmsr(MSR_FIDVID_STATUS, lo, hi);
+       cpu_rdmsr(MSR_FIDVID_STATUS, lo, hi);
        return lo & MSR_S_LO_CHANGE_PENDING ? 1 : 0;
 }
 
@@ -116,7 +147,7 @@
                        dprintk("detected change pending stuck\n");
                        return 1;
                }
-               rdmsr(MSR_FIDVID_STATUS, lo, hi);
+               cpu_rdmsr(MSR_FIDVID_STATUS, lo, hi);
        } while (lo & MSR_S_LO_CHANGE_PENDING);
 
        data->currvid = hi & MSR_S_HI_CURRENT_VID;
@@ -145,13 +176,13 @@
        u32 lo, hi;
        u8 fid, vid;
 
-       rdmsr(MSR_FIDVID_STATUS, lo, hi);
+       cpu_rdmsr(MSR_FIDVID_STATUS, lo, hi);
        vid = hi & MSR_S_HI_CURRENT_VID;
        fid = lo & MSR_S_LO_CURRENT_FID;
        lo = fid | (vid << MSR_C_LO_VID_SHIFT);
        hi = MSR_C_HI_STP_GNT_BENIGN;
        dprintk("cpu%d, init lo 0x%x, hi 0x%x\n", smp_processor_id(), lo, hi);
-       wrmsr(MSR_FIDVID_CTL, lo, hi);
+       cpu_wrmsr(MSR_FIDVID_CTL, lo, hi);
 }
 
 
@@ -173,7 +204,7 @@
                fid, lo, data->plllock * PLL_LOCK_CONVERSION);
 
        do {
-               wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION);
+               cpu_wrmsr(MSR_FIDVID_CTL, lo, data->plllock * 
PLL_LOCK_CONVERSION);
                if (i++ > 100) {
                        printk(KERN_ERR PFX "internal error - pending bit very 
stuck - no further pstate changes possible\n");
                        return 1;
@@ -215,7 +246,7 @@
                vid, lo, STOP_GRANT_5NS);
 
        do {
-               wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS);
+               cpu_wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS);
                if (i++ > 100) {
                        printk(KERN_ERR PFX "internal error - pending bit very 
stuck - no further pstate changes possible\n");
                        return 1;
@@ -294,7 +325,7 @@
                smp_processor_id(),
                data->currfid, data->currvid, reqvid, data->rvo);
 
-       rdmsr(MSR_FIDVID_STATUS, lo, maxvid);
+       cpu_rdmsr(MSR_FIDVID_STATUS, lo, maxvid);
        maxvid = 0x1f & (maxvid >> 16);
        dprintk("ph1 maxvid=0x%x\n", maxvid);
        if (reqvid < maxvid) /* lower numbers are higher voltages */
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>