public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Volkmann <haveaniceday@cv-sv.de>
To: Claas Langbehn <claas@rootdir.de>
Cc: Artur Kedzierski <artur@kedzierski.org>, linux-kernel@vger.kernel.org
Subject: Re: This kernel requires the following features not present on the CPU... (on a VIA C7 CPU)
Date: Tue, 22 May 2007 17:53:11 +0200	[thread overview]
Message-ID: <465311E7.3080608@cv-sv.de> (raw)
In-Reply-To: <465293FA.1040909@rootdir.de>

Claas Langbehn wrote:
> Could anyone explain to me what CMPXCHG64 / cx8 is and what happens if
> the kernel has been compiled to use it but the CPU does not have it?
> 
> Regards,
> claas
> 


Hi Claas,

the bug is at another place. But it's hidden if X86_CMPXCHG64 is
switched of.

There are 3 errors.

First: Via is capable of CMPXCHG64, but switch the related CPU bit off
to work with old Win NT versions. ( So the NT error is the fourth... but who cares
about that error. ;-) )

Second:  verify_cpu.S
This checks during the boot the capability of the CPU. It expected
the related bit, but... see first.
This error is switched of if X86_CMPXCHG64 is disabled.

Third: setup.S "PANIC: CPU too old for this kernel." is not printed
cause of a missing set register in setup.S.


As I have learned the NX-bit of the C7 is a BIOS issue.

The only real required patch is below. It enables the right bits for the C3/C7.

The first error is out of scope, and the fix for the "CPU too old.." is for
me just a cosmetic print out in case of boot errors.

I suppose .rc3 should contain a fix for this bug.


Best regards,

Christian







--- linux.orig/arch/i386/kernel/verify_cpu.S
+++ linux/arch/i386/kernel/verify_cpu.S
@@ -2,6 +2,7 @@
    This runs in 16bit mode so that the caller can still use the BIOS
    to output errors on the screen */
 #include <asm/cpufeature.h>
+#include <asm/msr.h>

 verify_cpu:
        pushfl                          # Save caller passed flags
@@ -45,6 +46,28 @@
        cmpl    $0x1,%eax
        jb      bad                     # no cpuid 1

+#if REQUIRED_MASK1 & NEED_CMPXCHG64
+       /* Some VIA C3s need magic MSRs to enable CX64. Do this here */
+       cmpl    $0x746e6543,%ebx        # Cent
+       jne     1f
+       cmpl    $0x48727561,%edx        # aurH
+       jne     1f
+       cmpl    $0x736c7561,%ecx        # auls
+       jne     1f
+       movl    $1,%eax                 # check model
+       cpuid
+       shr     $4,%eax
+       andl    $0xf,%eax               # get model
+       cmpl    $6,%eax
+       jb      1f
+       cmpl    $10,%eax                 # newer vias hopefully don't require
+       ja      1f                      # this anymore
+       movl    $MSR_VIA_FCR,%ecx
+       rdmsr
+       orl     $((1<<1)|(1<<7)),%eax   # enable CMPXCHG64 and PGE
+       wrmsr
+1:
+#endif
        movl    $0x1,%eax               # Does the cpu have what it takes
        cpuid

  reply	other threads:[~2007-05-22 15:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20  1:30 This kernel requires the following features not present on the CPU... (on a VIA C7 CPU) Artur Kedzierski
2007-05-22  6:55 ` Claas Langbehn
2007-05-22 15:53   ` Christian Volkmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-17 12:27 Claas Langbehn
2007-05-17 15:24 ` Alan Cox
2007-05-17 15:41   ` Claas Langbehn
2007-05-17 18:33 ` H. Peter Anvin
2007-05-18 11:17   ` Claas Langbehn
2007-05-17 20:12 ` Simon Arlott
2007-05-17 20:15   ` H. Peter Anvin
2007-05-17 22:16     ` Simon Arlott
2007-05-17 22:19       ` H. Peter Anvin
2007-05-18  6:24   ` Jan Engelhardt
2007-05-17 20:13 ` Simon Arlott

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=465311E7.3080608@cv-sv.de \
    --to=haveaniceday@cv-sv.de \
    --cc=artur@kedzierski.org \
    --cc=claas@rootdir.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox