X86: cpu_debug support for VIA / Centaur CPU's
PATCH 1/1 X86: cpu_debug support for VIA / Centaur CPU's
This patch adds the MSR definitions for the VIA/Centaur CPU models to cpu_debug.c
--- arch/x86/include/asm/cpu_debug.h | 21 +++++- arch/x86/kernel/cpu/cpu_debug.c | 176 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+), 1 deletions(-)
arch/x86/include/asm/cpu_debug.h +20 -1
@@ -134,6 +134,12 @@ enum cpu_processor_bit {CPU_AMD_0F_BIT ,CPU_AMD_10_BIT ,CPU_AMD_11_BIT , +/* Centaur */ +CPU_CENTAUR_C3_BIT , +CPU_CENTAUR_C5_BIT , +CPU_CENTAUR_C7A_BIT , +CPU_CENTAUR_C7D_BIT , + CPU_CENTAUR_NANO_BIT, };#define CPU_INTEL_PENTIUM (1 << CPU_INTEL_PENTIUM_BIT)
@@ -183,8 +189,21 @@ enum cpu_processor_bit {/* Select all supported AMD CPUs */ #define CPU_AMD_ALL (CPU_AMD_K6 | CPU_K7_PLUS) + +#define CPU_CENT_C3 (1 << CPU_CENTAUR_C3_BIT) +#define CPU_CENT_C5 (1 << CPU_CENTAUR_C5_BIT) +#define CPU_CENT_C7A (1 << CPU_CENTAUR_C7A_BIT) +#define CPU_CENT_C7D (1 << CPU_CENTAUR_C7D_BIT) +#define CPU_CENT_NANO (1 << CPU_CENTAUR_NANO_BIT) + +#define CPU_CENT_C7 (CPU_CENT_C7A | CPU_CENT_C7D) +#define CPU_CENT_C7_PLUS (CPU_CENT_C7 | CPU_CENT_NANO) + +#define CPU_CENT_ALL (CPU_CENT_C3 | CPU_CENT_C5 | CPU_CENT_C7 \ + | CPU_CENT_NANO) +/* Select all supported CPUs */ -#define CPU_ALL (CPU_INTEL_ALL | CPU_AMD_ALL) +#define CPU_ALL (CPU_INTEL_ALL | CPU_AMD_ALL | CPU_CENT_ALL)#define MAX_CPU_FILES 512
arch/x86/kernel/cpu/cpu_debug.c +176 -0
218 lines not on this page · raw message
Signature · 1 line
1.6.3.1
Hello Harald,
Quoted 4 lines · Harald Welte
This patch adds the MSR definitions for the VIA/Centaur CPU models to
cpu_debug.cSigned-off-by Harald Welte <[email protected]>
As per Ingo suggestion, we removed model information from cpu_debug and is available in -tip :
Please check latest -tip from and see how it works with your chips :git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip.git
Currently I am doing more changes and available in :
http://git.kernel.org/?p=linux/kernel/git/jaswinder/linux-2.6-cpu.git;a=shortlog;h=x86/cpu
Thanks,
--
JSR
Thanks for your quick response.
Quoted 8 lines · Jaswinder Singh Rajput
Quoted 4 lines · Harald Welte
This patch adds the MSR definitions for the VIA/Centaur CPU models to
cpu_debug.cSigned-off-by Harald Welte <[email protected]>As per Ingo suggestion, we removed model information from
cpu_debugand is available in -tip :
but what happens if one MSR has a different group from vendor A to vendor B? and what happens if you read MSR's on a CPU that doesn't have them? I suppose you get a segmentation fault, at least that's what I've received in the past when accidentially reading a MSR that doesn't exist. Is that what the _safe_ variant of rdmsr is for?
Quoted 1 line
Please check latest -tip from and see how it works with your chips :
I suppose it works, but it probably lacks all the via/centaur specific MSR's. I'll work on a patch as soon as i find time.
Quoted 5 lines
git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip.gitCurrently I am doing more changes and available in :
http://git.kernel.org/?p=linux/kernel/git/jaswinder/linux-2.6-cpu.git;a=shortlog;h=x86/cpu
Which means I should base on which of those tree to make sure it can be merged?
Signature · 3 lines
- Harald Welte <[email protected]> http://linux.via.com.tw/ ============================================================================ VIA Free and Open Source Software Liaison
Quoted 8 lines · Harald Welte
Thanks for your quick response.
Quoted 4 lines · Jaswinder Singh Rajput
Quoted 3 lines · Harald Welte
This patch adds the MSR definitions for the VIA/Centaur CPU models to
cpu_debug.c
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Harald Welte <[email protected]>As per Ingo suggestion, we removed model information from
cpu_debugand is available in -tip :but what happens if one MSR has a different group from vendor A to vendor B? [...]
MSRs should really be enumerated along CPU features. They will be accessed if a CPU offers that CPU feature.
Quoted 5 lines
[...] and what happens if you read MSR's on a CPU that doesn't have them? I suppose you get a segmentation fault, at least that's what I've received in the past when accidentially reading a MSR that doesn't exist. Is that what the _safe_ variant of rdmsr is for?
Yeah, the safe read should never fault - there should be all zeroes or an error return.
Ingo
Quoted 4 lines · Ingo Molnar
MSRs should really be enumerated along CPU features. They will be accessed if a CPU offers that CPU feature.
Nice in theory, but so many MSRs have to be enumerated with obscure test combinations, that it really isn't practical in the general case. That is why we have the safe MSR variants.
Quoted 4 lines
Yeah, the safe read should never fault - there should be all zeroes or an error return.
Error return, MSRs #GP if not present. All zero means a present MSR (which is zero.)
-hpa
Quoted 11 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
MSRs should really be enumerated along CPU features. They will be accessed if a CPU offers that CPU feature.
Nice in theory, but so many MSRs have to be enumerated with obscure test combinations, that it really isn't practical in the general case. That is why we have the safe MSR variants.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Yeah, the safe read should never fault - there should be all zeroes or an error return.
Error return, MSRs #GP if not present. All zero means a present MSR (which is zero.)
yes, of course - i meant the /debug/x86/cpu/* behavior: it should either result zeroes, or should return -EINVAL. (probably the latter)
Ingo
Quoted 18 lines · Ingo Molnar
Quoted 15 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
MSRs should really be enumerated along CPU features. They will be accessed if a CPU offers that CPU feature.
Nice in theory, but so many MSRs have to be enumerated with obscure test combinations, that it really isn't practical in the general case. That is why we have the safe MSR variants.
Quoted 4 lines
Yeah, the safe read should never fault - there should be all zeroes or an error return.
Quoted 7 lines
Quoted 2 lines
Error return, MSRs #GP if not present. All zero means a present MSR (which is zero.)
yes, of course - i meant the /debug/x86/cpu/* behavior: it should either result zeroes, or should return
-EINVAL. (probably the latter)
Return zeroes - same as hardware case for bits which can't be set. Returning -EINVAL might match a specific bit pattern caller is looking for.
Mike
Quoted 8 lines
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 22 lines · Michael S. Zick
Quoted 21 lines · Ingo Molnar
Quoted 17 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
MSRs should really be enumerated along CPU features. They will be accessed if a CPU offers that CPU feature.
Nice in theory, but so many MSRs have to be enumerated with obscure test combinations, that it really isn't practical in the general case. That is why we have the safe MSR variants.
Quoted 4 lines
Yeah, the safe read should never fault - there should be all zeroes or an error return.
Error return, MSRs #GP if not present. All zero means a present MSR (which is zero.)
Quoted 8 lines
Quoted 4 lines
yes, of course - i meant the /debug/x86/cpu/* behavior: it should either result zeroes, or should return
-EINVAL. (probably the latter)Return zeroes - same as hardware case for bits which can't be set. Returning
-EINVALmight match a specific bit pattern caller is looking for.
these files are accessed via read(). The -EINVAL is the syscall return value. The value (if any) goes into the buffer that is being read into. So there's no way to 'match a specific bit pattern' - it's two separate spaces.
Ingo
Quoted 30 lines · Ingo Molnar
Quoted 27 lines · Michael S. Zick
Quoted 25 lines · Ingo Molnar
Quoted 11 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
MSRs should really be enumerated along CPU features. They will be accessed if a CPU offers that CPU feature.
Nice in theory, but so many MSRs have to be enumerated with obscure test combinations, that it really isn't practical in the general case. That is why we have the safe MSR variants.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Yeah, the safe read should never fault - there should be all zeroes or an error return.
Error return, MSRs #GP if not present. All zero means a present MSR (which is zero.)
yes, of course - i meant the /debug/x86/cpu/* behavior: it should either result zeroes, or should return
-EINVAL. (probably the latter)
Quoted 9 lines
Quoted 3 lines
Return zeroes - same as hardware case for bits which can't be set. Returning
-EINVALmight match a specific bit pattern caller is looking for.these files are accessed via
read(). The-EINVALis the syscall return value. The value (if any) goes into the buffer that is being read into. So there's no way to 'match a specific bit pattern' - it's two separate spaces.
Right. Prior post was just a bad case of nerves. ;)
Mike
Quoted 8 lines
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
H. Peter Anvin
reviewerQuoted 8 lines · Michael S. Zick
Quoted 4 lines
yes, of course - i meant the /debug/x86/cpu/* behavior: it should either result zeroes, or should return
-EINVAL. (probably the latter)Return zeroes - same as hardware case for bits which can't be set. Returning
-EINVALmight match a specific bit pattern caller is looking for.
It should be -EIO anyway, which is what /dev/cpu/*/msr does.
-hpa
Quoted 10 lines · Harald Welte
Thanks for your quick response.
Quoted 6 lines · Jaswinder Singh Rajput
Quoted 4 lines · Harald Welte
This patch adds the MSR definitions for the VIA/Centaur CPU models to
cpu_debug.cSigned-off-by Harald Welte <[email protected]>
Quoted 9 lines
Quoted 2 lines
As per Ingo suggestion, we removed model information from
cpu_debugand is available in -tip :but what happens if one MSR has a different group from vendor A to vendor B? and what happens if you read MSR's on a CPU that doesn't have them? I suppose you get a segmentation fault, at least that's what I've received in the past when accidentially reading a MSR that doesn't exist. Is that what the _safe_ variant of rdmsr is for?
AFAIK we are using safe variant. That's why I requested you to test latest -tip and let us know your result and feedback.
Quoted 7 lines
Quoted 4 lines
Currently I am doing more changes and available in :
http://git.kernel.org/?p=linux/kernel/git/jaswinder/linux-2.6-cpu.git;a=shortlog;h=x86/cpu
Which means I should base on which of those tree to make sure it can be merged?
-tip will be better option.
Thanks,
--
JSR