License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-01-19 20:36:33 +07:00
|
|
|
|
|
|
|
#include <linux/sched.h>
|
2017-02-01 22:36:40 +07:00
|
|
|
#include <linux/sched/clock.h>
|
2008-02-18 09:30:47 +07:00
|
|
|
|
2016-01-27 04:12:04 +07:00
|
|
|
#include <asm/cpufeature.h>
|
2017-01-27 16:27:10 +07:00
|
|
|
#include <asm/e820/api.h>
|
2006-03-23 17:59:50 +07:00
|
|
|
#include <asm/mtrr.h>
|
2009-03-14 18:24:02 +07:00
|
|
|
#include <asm/msr.h>
|
2008-02-18 09:30:47 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#include "cpu.h"
|
|
|
|
|
|
|
|
#define ACE_PRESENT (1 << 6)
|
|
|
|
#define ACE_ENABLED (1 << 7)
|
|
|
|
#define ACE_FCR (1 << 28) /* MSR_VIA_FCR */
|
|
|
|
|
|
|
|
#define RNG_PRESENT (1 << 2)
|
|
|
|
#define RNG_ENABLED (1 << 3)
|
|
|
|
#define RNG_ENABLE (1 << 6) /* MSR_VIA_RNG */
|
|
|
|
|
2018-04-20 15:29:28 +07:00
|
|
|
#define X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW 0x00200000
|
|
|
|
#define X86_VMX_FEATURE_PROC_CTLS_VNMI 0x00400000
|
|
|
|
#define X86_VMX_FEATURE_PROC_CTLS_2ND_CTLS 0x80000000
|
|
|
|
#define X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC 0x00000001
|
|
|
|
#define X86_VMX_FEATURE_PROC_CTLS2_EPT 0x00000002
|
|
|
|
#define X86_VMX_FEATURE_PROC_CTLS2_VPID 0x00000020
|
|
|
|
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 05:23:59 +07:00
|
|
|
static void init_c3(struct cpuinfo_x86 *c)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
u32 lo, hi;
|
|
|
|
|
|
|
|
/* Test for Centaur Extended Feature Flags presence */
|
|
|
|
if (cpuid_eax(0xC0000000) >= 0xC0000001) {
|
|
|
|
u32 tmp = cpuid_edx(0xC0000001);
|
|
|
|
|
|
|
|
/* enable ACE unit, if present and disabled */
|
|
|
|
if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {
|
2008-02-18 05:30:23 +07:00
|
|
|
rdmsr(MSR_VIA_FCR, lo, hi);
|
2005-04-17 05:20:36 +07:00
|
|
|
lo |= ACE_FCR; /* enable ACE unit */
|
2008-02-18 05:30:23 +07:00
|
|
|
wrmsr(MSR_VIA_FCR, lo, hi);
|
2016-02-02 10:45:02 +07:00
|
|
|
pr_info("CPU: Enabled ACE h/w crypto\n");
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* enable RNG unit, if present and disabled */
|
|
|
|
if ((tmp & (RNG_PRESENT | RNG_ENABLED)) == RNG_PRESENT) {
|
2008-02-18 05:30:23 +07:00
|
|
|
rdmsr(MSR_VIA_RNG, lo, hi);
|
2005-04-17 05:20:36 +07:00
|
|
|
lo |= RNG_ENABLE; /* enable RNG unit */
|
2008-02-18 05:30:23 +07:00
|
|
|
wrmsr(MSR_VIA_RNG, lo, hi);
|
2016-02-02 10:45:02 +07:00
|
|
|
pr_info("CPU: Enabled h/w RNG\n");
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* store Centaur Extended Feature Flags as
|
|
|
|
* word 5 of the CPU capability bit array
|
|
|
|
*/
|
2015-12-07 16:39:40 +07:00
|
|
|
c->x86_capability[CPUID_C000_0001_EDX] = cpuid_edx(0xC0000001);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2009-03-14 18:24:02 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
2007-10-20 06:13:56 +07:00
|
|
|
/* Cyrix III family needs CX8 & PGE explicitly enabled. */
|
2011-12-15 22:11:28 +07:00
|
|
|
if (c->x86_model >= 6 && c->x86_model <= 13) {
|
2008-02-18 05:30:23 +07:00
|
|
|
rdmsr(MSR_VIA_FCR, lo, hi);
|
2005-04-17 05:20:36 +07:00
|
|
|
lo |= (1<<1 | 1<<7);
|
2008-02-18 05:30:23 +07:00
|
|
|
wrmsr(MSR_VIA_FCR, lo, hi);
|
2008-02-26 14:51:22 +07:00
|
|
|
set_cpu_cap(c, X86_FEATURE_CX8);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Before Nehemiah, the C3's had 3dNOW! */
|
2008-02-18 05:30:23 +07:00
|
|
|
if (c->x86_model >= 6 && c->x86_model < 9)
|
2008-02-26 14:51:22 +07:00
|
|
|
set_cpu_cap(c, X86_FEATURE_3DNOW);
|
2009-03-14 18:24:02 +07:00
|
|
|
#endif
|
|
|
|
if (c->x86 == 0x6 && c->x86_model >= 0xf) {
|
|
|
|
c->x86_cache_alignment = c->x86_clflush_size * 2;
|
|
|
|
set_cpu_cap(c, X86_FEATURE_REP_GOOD);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2009-11-21 20:01:45 +07:00
|
|
|
cpu_detect_cache_sizes(c);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2008-02-18 09:30:47 +07:00
|
|
|
enum {
|
|
|
|
ECX8 = 1<<1,
|
|
|
|
EIERRINT = 1<<2,
|
|
|
|
DPM = 1<<3,
|
|
|
|
DMCE = 1<<4,
|
|
|
|
DSTPCLK = 1<<5,
|
|
|
|
ELINEAR = 1<<6,
|
|
|
|
DSMC = 1<<7,
|
|
|
|
DTLOCK = 1<<8,
|
|
|
|
EDCTLB = 1<<8,
|
|
|
|
EMMX = 1<<9,
|
|
|
|
DPDC = 1<<11,
|
|
|
|
EBRPRED = 1<<12,
|
|
|
|
DIC = 1<<13,
|
|
|
|
DDC = 1<<14,
|
|
|
|
DNA = 1<<15,
|
|
|
|
ERETSTK = 1<<16,
|
|
|
|
E2MMX = 1<<19,
|
|
|
|
EAMD3D = 1<<20,
|
|
|
|
};
|
|
|
|
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 05:23:59 +07:00
|
|
|
static void early_init_centaur(struct cpuinfo_x86 *c)
|
2008-09-05 02:09:43 +07:00
|
|
|
{
|
|
|
|
switch (c->x86) {
|
2009-03-14 18:24:02 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
2008-09-05 02:09:43 +07:00
|
|
|
case 5:
|
|
|
|
/* Emulate MTRRs using Centaur's MCR. */
|
|
|
|
set_cpu_cap(c, X86_FEATURE_CENTAUR_MCR);
|
|
|
|
break;
|
2009-03-14 18:24:02 +07:00
|
|
|
#endif
|
|
|
|
case 6:
|
|
|
|
if (c->x86_model >= 0xf)
|
|
|
|
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
|
|
|
|
break;
|
2008-09-05 02:09:43 +07:00
|
|
|
}
|
2009-03-14 18:24:02 +07:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
set_cpu_cap(c, X86_FEATURE_SYSENTER32);
|
|
|
|
#endif
|
2018-01-22 17:14:17 +07:00
|
|
|
if (c->x86_power & (1 << 8)) {
|
|
|
|
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
|
|
|
|
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
|
|
|
|
}
|
2008-09-05 02:09:43 +07:00
|
|
|
}
|
|
|
|
|
2018-04-20 15:29:28 +07:00
|
|
|
static void centaur_detect_vmx_virtcap(struct cpuinfo_x86 *c)
|
|
|
|
{
|
|
|
|
u32 vmx_msr_low, vmx_msr_high, msr_ctl, msr_ctl2;
|
|
|
|
|
|
|
|
rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, vmx_msr_low, vmx_msr_high);
|
|
|
|
msr_ctl = vmx_msr_high | vmx_msr_low;
|
|
|
|
|
|
|
|
if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW)
|
|
|
|
set_cpu_cap(c, X86_FEATURE_TPR_SHADOW);
|
|
|
|
if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_VNMI)
|
|
|
|
set_cpu_cap(c, X86_FEATURE_VNMI);
|
|
|
|
if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_2ND_CTLS) {
|
|
|
|
rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2,
|
|
|
|
vmx_msr_low, vmx_msr_high);
|
|
|
|
msr_ctl2 = vmx_msr_high | vmx_msr_low;
|
|
|
|
if ((msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC) &&
|
|
|
|
(msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW))
|
|
|
|
set_cpu_cap(c, X86_FEATURE_FLEXPRIORITY);
|
|
|
|
if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT)
|
|
|
|
set_cpu_cap(c, X86_FEATURE_EPT);
|
|
|
|
if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VPID)
|
|
|
|
set_cpu_cap(c, X86_FEATURE_VPID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 05:23:59 +07:00
|
|
|
static void init_centaur(struct cpuinfo_x86 *c)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2009-03-14 18:24:02 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
2005-04-17 05:20:36 +07:00
|
|
|
char *name;
|
2008-02-18 05:30:23 +07:00
|
|
|
u32 fcr_set = 0;
|
|
|
|
u32 fcr_clr = 0;
|
|
|
|
u32 lo, hi, newlo;
|
|
|
|
u32 aa, bb, cc, dd;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-02-18 09:30:47 +07:00
|
|
|
/*
|
|
|
|
* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
|
|
|
|
* 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway
|
|
|
|
*/
|
2008-02-26 14:51:22 +07:00
|
|
|
clear_cpu_cap(c, 0*32+31);
|
2009-03-14 18:24:02 +07:00
|
|
|
#endif
|
|
|
|
early_init_centaur(c);
|
2018-05-03 09:32:46 +07:00
|
|
|
init_intel_cacheinfo(c);
|
2018-05-13 16:43:53 +07:00
|
|
|
detect_num_cpu_cores(c);
|
2018-05-03 09:32:46 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
|
|
|
detect_ht(c);
|
|
|
|
#endif
|
2018-04-20 15:29:28 +07:00
|
|
|
|
|
|
|
if (c->cpuid_level > 9) {
|
|
|
|
unsigned int eax = cpuid_eax(10);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for version and the number of counters
|
|
|
|
* Version(eax[7:0]) can't be 0;
|
|
|
|
* Counters(eax[15:8]) should be greater than 1;
|
|
|
|
*/
|
|
|
|
if ((eax & 0xff) && (((eax >> 8) & 0xff) > 1))
|
|
|
|
set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
switch (c->x86) {
|
2009-03-14 18:24:02 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
2008-02-18 05:30:23 +07:00
|
|
|
case 5:
|
2008-02-18 09:30:47 +07:00
|
|
|
switch (c->x86_model) {
|
|
|
|
case 4:
|
|
|
|
name = "C6";
|
|
|
|
fcr_set = ECX8|DSMC|EDCTLB|EMMX|ERETSTK;
|
|
|
|
fcr_clr = DPDC;
|
2016-02-02 10:45:02 +07:00
|
|
|
pr_notice("Disabling bugged TSC.\n");
|
2008-02-26 14:51:22 +07:00
|
|
|
clear_cpu_cap(c, X86_FEATURE_TSC);
|
2008-02-18 09:30:47 +07:00
|
|
|
break;
|
|
|
|
case 8:
|
2018-01-01 08:52:10 +07:00
|
|
|
switch (c->x86_stepping) {
|
2008-02-18 09:30:47 +07:00
|
|
|
default:
|
|
|
|
name = "2";
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
2008-02-18 09:30:47 +07:00
|
|
|
case 7 ... 9:
|
|
|
|
name = "2A";
|
|
|
|
break;
|
|
|
|
case 10 ... 15:
|
|
|
|
name = "2B";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK|
|
|
|
|
E2MMX|EAMD3D;
|
|
|
|
fcr_clr = DPDC;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
name = "3";
|
|
|
|
fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK|
|
|
|
|
E2MMX|EAMD3D;
|
|
|
|
fcr_clr = DPDC;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
name = "??";
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-02-18 09:30:47 +07:00
|
|
|
rdmsr(MSR_IDT_FCR1, lo, hi);
|
|
|
|
newlo = (lo|fcr_set) & (~fcr_clr);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-02-18 09:30:47 +07:00
|
|
|
if (newlo != lo) {
|
2016-02-02 10:45:02 +07:00
|
|
|
pr_info("Centaur FCR was 0x%X now 0x%X\n",
|
2008-02-18 09:30:47 +07:00
|
|
|
lo, newlo);
|
|
|
|
wrmsr(MSR_IDT_FCR1, newlo, hi);
|
|
|
|
} else {
|
2016-02-02 10:45:02 +07:00
|
|
|
pr_info("Centaur FCR is 0x%X\n", lo);
|
2008-02-18 09:30:47 +07:00
|
|
|
}
|
|
|
|
/* Emulate MTRRs using Centaur's MCR. */
|
2008-02-26 14:51:22 +07:00
|
|
|
set_cpu_cap(c, X86_FEATURE_CENTAUR_MCR);
|
2008-02-18 09:30:47 +07:00
|
|
|
/* Report CX8 */
|
2008-02-26 14:51:22 +07:00
|
|
|
set_cpu_cap(c, X86_FEATURE_CX8);
|
2008-02-18 09:30:47 +07:00
|
|
|
/* Set 3DNow! on Winchip 2 and above. */
|
|
|
|
if (c->x86_model >= 8)
|
2008-02-26 14:51:22 +07:00
|
|
|
set_cpu_cap(c, X86_FEATURE_3DNOW);
|
2008-02-18 09:30:47 +07:00
|
|
|
/* See if we can find out some more. */
|
|
|
|
if (cpuid_eax(0x80000000) >= 0x80000005) {
|
|
|
|
/* Yes, we can. */
|
|
|
|
cpuid(0x80000005, &aa, &bb, &cc, &dd);
|
|
|
|
/* Add L1 data and code cache sizes. */
|
|
|
|
c->x86_cache_size = (cc>>24)+(dd>>24);
|
|
|
|
}
|
|
|
|
sprintf(c->x86_model_id, "WinChip %s", name);
|
|
|
|
break;
|
2009-03-14 18:24:02 +07:00
|
|
|
#endif
|
2008-02-18 05:30:23 +07:00
|
|
|
case 6:
|
2008-02-18 09:30:47 +07:00
|
|
|
init_c3(c);
|
|
|
|
break;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2009-03-14 18:24:02 +07:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
|
|
|
|
#endif
|
2018-04-20 15:29:28 +07:00
|
|
|
|
|
|
|
if (cpu_has(c, X86_FEATURE_VMX))
|
|
|
|
centaur_detect_vmx_virtcap(c);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2013-10-21 15:35:20 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 05:23:59 +07:00
|
|
|
static unsigned int
|
2008-02-18 09:30:47 +07:00
|
|
|
centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
/* VIA C3 CPUs (670-68F) need further shifting. */
|
|
|
|
if ((c->x86 == 6) && ((c->x86_model == 7) || (c->x86_model == 8)))
|
|
|
|
size >>= 8;
|
|
|
|
|
2008-02-18 09:30:47 +07:00
|
|
|
/*
|
|
|
|
* There's also an erratum in Nehemiah stepping 1, which
|
|
|
|
* returns '65KB' instead of '64KB'
|
|
|
|
* - Note, it seems this may only be in engineering samples.
|
|
|
|
*/
|
|
|
|
if ((c->x86 == 6) && (c->x86_model == 9) &&
|
2018-01-01 08:52:10 +07:00
|
|
|
(c->x86_stepping == 1) && (size == 65))
|
2008-02-18 05:30:23 +07:00
|
|
|
size -= 1;
|
2005-04-17 05:20:36 +07:00
|
|
|
return size;
|
|
|
|
}
|
2013-10-21 15:35:20 +07:00
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 05:23:59 +07:00
|
|
|
static const struct cpu_dev centaur_cpu_dev = {
|
2005-04-17 05:20:36 +07:00
|
|
|
.c_vendor = "Centaur",
|
|
|
|
.c_ident = { "CentaurHauls" },
|
2008-09-05 02:09:43 +07:00
|
|
|
.c_early_init = early_init_centaur,
|
2005-04-17 05:20:36 +07:00
|
|
|
.c_init = init_centaur,
|
2013-10-21 15:35:20 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
|
|
|
.legacy_cache_size = centaur_size_cache,
|
|
|
|
#endif
|
2008-09-05 02:09:45 +07:00
|
|
|
.c_x86_vendor = X86_VENDOR_CENTAUR,
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2008-09-05 02:09:45 +07:00
|
|
|
cpu_dev_register(centaur_cpu_dev);
|