Skip to content

Commit 639475d

Browse files
socram8888suryasaimadhu
authored andcommitted
x86/CPU: Add support for Vortex CPUs
DM&P devices were not being properly identified, which resulted in unneeded Spectre/Meltdown mitigations being applied. The manufacturer states that these devices execute always in-order and don't support either speculative execution or branch prediction, so they are not vulnerable to this class of attack. [1] This is something I've personally tested by a simple timing analysis on my Vortex86MX CPU, and can confirm it is true. Add identification for some devices that lack the CPUID product name call, so they appear properly on /proc/cpuinfo. ¹https://www.ssv-embedded.de/doks/infos/DMP_Ann_180108_Meltdown.pdf [ bp: Massage commit message. ] Signed-off-by: Marcos Del Sol Vives <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent f3f07ae commit 639475d

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

arch/x86/Kconfig.cpu

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,16 @@ config CPU_SUP_ZHAOXIN
508508
CPU might render the kernel unbootable.
509509

510510
If unsure, say N.
511+
512+
config CPU_SUP_VORTEX_32
513+
default y
514+
bool "Support Vortex processors" if PROCESSOR_SELECT
515+
depends on X86_32
516+
help
517+
This enables detection, tunings and quirks for Vortex processors
518+
519+
You need this enabled if you want your kernel to run on a
520+
Vortex CPU. Disabling this option on other types of CPUs
521+
makes the kernel a tiny bit smaller.
522+
523+
If unsure, say N.

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ enum cpuid_regs_idx {
164164
#define X86_VENDOR_NSC 8
165165
#define X86_VENDOR_HYGON 9
166166
#define X86_VENDOR_ZHAOXIN 10
167-
#define X86_VENDOR_NUM 11
167+
#define X86_VENDOR_VORTEX 11
168+
#define X86_VENDOR_NUM 12
168169

169170
#define X86_VENDOR_UNKNOWN 0xff
170171

arch/x86/kernel/cpu/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ obj-$(CONFIG_CPU_SUP_CENTAUR) += centaur.o
4343
obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o
4444
obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
4545
obj-$(CONFIG_CPU_SUP_ZHAOXIN) += zhaoxin.o
46+
obj-$(CONFIG_CPU_SUP_VORTEX_32) += vortex.o
4647

4748
obj-$(CONFIG_X86_MCE) += mce/
4849
obj-$(CONFIG_MTRR) += mtrr/

arch/x86/kernel/cpu/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,8 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = {
10441044
VULNWL(CENTAUR, 5, X86_MODEL_ANY, NO_SPECULATION),
10451045
VULNWL(INTEL, 5, X86_MODEL_ANY, NO_SPECULATION),
10461046
VULNWL(NSC, 5, X86_MODEL_ANY, NO_SPECULATION),
1047+
VULNWL(VORTEX, 5, X86_MODEL_ANY, NO_SPECULATION),
1048+
VULNWL(VORTEX, 6, X86_MODEL_ANY, NO_SPECULATION),
10471049

10481050
/* Intel Family 6 */
10491051
VULNWL_INTEL(ATOM_SALTWELL, NO_SPECULATION | NO_ITLB_MULTIHIT),

arch/x86/kernel/cpu/vortex.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include <linux/kernel.h>
3+
#include <asm/processor.h>
4+
#include "cpu.h"
5+
6+
/*
7+
* No special init required for Vortex processors.
8+
*/
9+
10+
static const struct cpu_dev vortex_cpu_dev = {
11+
.c_vendor = "Vortex",
12+
.c_ident = { "Vortex86 SoC" },
13+
.legacy_models = {
14+
{
15+
.family = 5,
16+
.model_names = {
17+
[2] = "Vortex86DX",
18+
[8] = "Vortex86MX",
19+
},
20+
},
21+
{
22+
.family = 6,
23+
.model_names = {
24+
/*
25+
* Both the Vortex86EX and the Vortex86EX2
26+
* have the same family and model id.
27+
*
28+
* However, the -EX2 supports the product name
29+
* CPUID call, so this name will only be used
30+
* for the -EX, which does not.
31+
*/
32+
[0] = "Vortex86EX",
33+
},
34+
},
35+
},
36+
.c_x86_vendor = X86_VENDOR_VORTEX,
37+
};
38+
39+
cpu_dev_register(vortex_cpu_dev);

0 commit comments

Comments
 (0)