Module Name: src Committed By: martin Date: Sun Jun 2 08:29:30 UTC 2019
Modified Files: src/sys/arch/x86/x86 [netbsd-8]: spectre.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1279): sys/arch/x86/x86/spectre.c: revision 1.29 Mmh, check the highest leaf before calling x86_cpuid(), otherwise on old CPUs we might be getting garbage. While here fix a typo. Likely fixes PR/54256. To generate a diff of this commit: cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/arch/x86/x86/spectre.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/spectre.c diff -u src/sys/arch/x86/x86/spectre.c:1.19.2.3 src/sys/arch/x86/x86/spectre.c:1.19.2.4 --- src/sys/arch/x86/x86/spectre.c:1.19.2.3 Tue May 14 17:12:19 2019 +++ src/sys/arch/x86/x86/spectre.c Sun Jun 2 08:29:30 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: spectre.c,v 1.19.2.3 2019/05/14 17:12:19 martin Exp $ */ +/* $NetBSD: spectre.c,v 1.19.2.4 2019/06/02 08:29:30 martin Exp $ */ /* * Copyright (c) 2018 NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.19.2.3 2019/05/14 17:12:19 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.19.2.4 2019/06/02 08:29:30 martin Exp $"); #include "opt_spectre.h" @@ -552,6 +552,10 @@ mds_detect_method(void) return; } + if (cpuid_level < 7) { + return; + } + x86_cpuid(0x7, descs); if (descs[3] & CPUID_SEF_ARCH_CAP) { msr = rdmsr(MSR_IA32_ARCH_CAPABILITIES); @@ -688,7 +692,7 @@ cpu_speculation_init(struct cpu_info *ci #endif /* - * Microarchectural Data Sampling. + * Microarchitectural Data Sampling. * * cpu0 is the one that detects the method and sets the global * variable.