All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Bilski" <rafalbilski@interia.pl>
To: "Herbert G. Fischer" <herbert.fischer@gmail.com>
Cc: cpufreq@lists.linux.org.uk
Subject: Re: VIA C3 'Ezra-T' [C5M] - longhaul - do nothing
Date: Fri, 31 Aug 2007 08:49:18 +0200	[thread overview]
Message-ID: <46D7B9EE.2040607@interia.pl> (raw)
In-Reply-To: <9f90e8bf0708291342h70cf50c2r979981d3e8faec8@mail.gmail.com>

Thanks. Sorry for late reply.
>>> cpufreq-core: notification 1 of frequency transition to 399000 kHz
Good. ACPI C3 is working too.
>> Yes. It is working. Longhaul ver. 2 wasn't working probably because of the
>> same reason. Now I have to think how to deal with this situation. I have
>> Nehemiah with RevID = 0. Good. I have Ezra with RevID = 1 and voltage
>> scaling. Bad. I have to check if it is working with RevID = 0. Probably
>> not because VIA documentation advise to poke RevKey with RevID. But
>> I will read it again to refresh my memory.
Yup. Ezra isn't working with RevID = 0. 
> I'm sorry I cannot understand this in detail because I don't know how
> VIA LongHaul works internally, but I'm also C programmer and know
> something about the kernel (did a very small module for IBM RS6000
> once). Maybe I can help more, if needed. If so, could you send me some
> documentation (like the VIA ones)?
Sorry. I can't.
To avoid random frequency transitions VIA did bits 4..7 as the key. If You 
read it You will read 0xf. You have to set it to correct value or frequency 
change request will be ignored. This value should be in bits 0..3. It is 
0 for CPU without voltage scaling capability. It is 1 for CPU with voltage 
scaling. Your processor doesn't have voltage scaling, but it is reporting 
that it has. It needs key set to 0. I was so busy with adding voltage 
scaling (Longhaul ver. 2) and overclocking to longhaul that I failed to 
properly test it on other CPU's then Ezra and Nehemiah.

Patch below is IMO the best solution for this problem because it will be 
transparent to user. However You can still provide module options to override 
defaults.
I need to add some printk()'s and comments and test it more.

Let me know if it is working for You.
Thanks

---
 arch/i386/kernel/cpu/cpufreq/longhaul.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -76,6 +76,7 @@ static unsigned int longhaul_index;
 /* Module parameters */
 static int scale_voltage;
 static int disable_acpi_c3;
+static int revid_errata;
 
 #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longhaul", msg)
 
@@ -168,7 +169,10 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index,
 
 	rdmsrl(MSR_VIA_LONGHAUL, longhaul.val);
 	/* Setup new frequency */
-	longhaul.bits.RevisionKey = longhaul.bits.RevisionID;
+	if (!revid_errata)
+		longhaul.bits.RevisionKey = longhaul.bits.RevisionID;
+	else
+		longhaul.bits.RevisionKey = 0;
 	longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
 	longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
 	/* Setup new voltage */
@@ -272,7 +276,7 @@ static void longhaul_setstate(unsigned int table_index)
 
 	dprintk ("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n",
 			fsb, mult/10, mult%10, print_speed(speed/1000));
-
+retry_loop:
 	preempt_disable();
 	local_irq_save(flags);
 
@@ -344,6 +348,22 @@ static void longhaul_setstate(unsigned int table_index)
 	preempt_enable();
 
 	freqs.new = calc_speed(longhaul_get_cpu_mult());
+	/* Check if requested frequency is set */
+	if (unlikely(freqs.new != speed)) {
+		if (!revid_errata) {
+			revid_errata = 1;
+			msleep(200);
+			goto retry_loop;
+		}
+		if (longhaul_flags & USE_ACPI_C3) {
+			longhaul_flags &= ~USE_ACPI_C3;
+			if (revid_errata)
+				revid_errata = 0;
+			msleep(200);
+			goto retry_loop;
+		}
+		printk(KERN_INFO PFX "Failed to set requested frequency!\n");
+	}
 	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 
 	if (!bm_timeout)
@@ -962,6 +982,9 @@ MODULE_PARM_DESC(disable_acpi_c3, "Don't use ACPI C3 support");
 module_param (scale_voltage, int, 0644);
 MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor");
 
+module_param (revid_errata, int, 0644);
+MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID");
+
 MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
 MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors.");
 MODULE_LICENSE ("GPL");
-- 



----------------------------------------------------------------------
Zamiesc ogloszenie za darmo!
Kliknij >>> http://link.interia.pl/f1b7f

  reply	other threads:[~2007-08-31  6:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9f90e8bf0708280759x6068ae15j9f24e654307a3037@mail.gmail.com>
     [not found] ` <46D4433A.7000509@interia.pl>
     [not found]   ` <9f90e8bf0708281101q19afb3ableb3589b7c363759c@mail.gmail.com>
     [not found]     ` <46D46CC2.6080405@interia.pl>
     [not found]       ` <9f90e8bf0708281314v28f29cb3o8e68a3b77701e656@mail.gmail.com>
     [not found]         ` <46D5000D.7010503@interia.pl>
2007-08-29 13:24           ` VIA C3 'Ezra-T' [C5M] - longhaul - do nothing Herbert G. Fischer
2007-08-29 17:36             ` Rafał Bilski
2007-08-29 18:35               ` Herbert G. Fischer
2007-08-29 19:16                 ` Rafał Bilski
2007-08-29 19:40                   ` Herbert G. Fischer
2007-08-29 20:21                     ` Rafał Bilski
2007-08-29 20:42                       ` Herbert G. Fischer
2007-08-31  6:49                         ` Rafał Bilski [this message]
2007-08-31 10:51                           ` Herbert G. Fischer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46D7B9EE.2040607@interia.pl \
    --to=rafalbilski@interia.pl \
    --cc=cpufreq@lists.linux.org.uk \
    --cc=herbert.fischer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.