Skip to content

Commit

Permalink
x86/CPU: Add support for Vortex CPUs
Browse files Browse the repository at this point in the history
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 <marcos@orca.pet>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211017094408.1512158-1-marcos@orca.pet
  • Loading branch information
socram8888 authored and Borislav Petkov committed Oct 21, 2021
1 parent f3f07ae commit 639475d
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
13 changes: 13 additions & 0 deletions arch/x86/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,16 @@ config CPU_SUP_ZHAOXIN
CPU might render the kernel unbootable.

If unsure, say N.

config CPU_SUP_VORTEX_32
default y
bool "Support Vortex processors" if PROCESSOR_SELECT
depends on X86_32
help
This enables detection, tunings and quirks for Vortex processors

You need this enabled if you want your kernel to run on a
Vortex CPU. Disabling this option on other types of CPUs
makes the kernel a tiny bit smaller.

If unsure, say N.
3 changes: 2 additions & 1 deletion arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ enum cpuid_regs_idx {
#define X86_VENDOR_NSC 8
#define X86_VENDOR_HYGON 9
#define X86_VENDOR_ZHAOXIN 10
#define X86_VENDOR_NUM 11
#define X86_VENDOR_VORTEX 11
#define X86_VENDOR_NUM 12

#define X86_VENDOR_UNKNOWN 0xff

Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/cpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ obj-$(CONFIG_CPU_SUP_CENTAUR) += centaur.o
obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o
obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
obj-$(CONFIG_CPU_SUP_ZHAOXIN) += zhaoxin.o
obj-$(CONFIG_CPU_SUP_VORTEX_32) += vortex.o

obj-$(CONFIG_X86_MCE) += mce/
obj-$(CONFIG_MTRR) += mtrr/
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,8 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = {
VULNWL(CENTAUR, 5, X86_MODEL_ANY, NO_SPECULATION),
VULNWL(INTEL, 5, X86_MODEL_ANY, NO_SPECULATION),
VULNWL(NSC, 5, X86_MODEL_ANY, NO_SPECULATION),
VULNWL(VORTEX, 5, X86_MODEL_ANY, NO_SPECULATION),
VULNWL(VORTEX, 6, X86_MODEL_ANY, NO_SPECULATION),

/* Intel Family 6 */
VULNWL_INTEL(ATOM_SALTWELL, NO_SPECULATION | NO_ITLB_MULTIHIT),
Expand Down
39 changes: 39 additions & 0 deletions arch/x86/kernel/cpu/vortex.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <asm/processor.h>
#include "cpu.h"

/*
* No special init required for Vortex processors.
*/

static const struct cpu_dev vortex_cpu_dev = {
.c_vendor = "Vortex",
.c_ident = { "Vortex86 SoC" },
.legacy_models = {
{
.family = 5,
.model_names = {
[2] = "Vortex86DX",
[8] = "Vortex86MX",
},
},
{
.family = 6,
.model_names = {
/*
* Both the Vortex86EX and the Vortex86EX2
* have the same family and model id.
*
* However, the -EX2 supports the product name
* CPUID call, so this name will only be used
* for the -EX, which does not.
*/
[0] = "Vortex86EX",
},
},
},
.c_x86_vendor = X86_VENDOR_VORTEX,
};

cpu_dev_register(vortex_cpu_dev);

0 comments on commit 639475d

Please sign in to comment.