Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 Set the "method" string at boot time too.
details: https://anonhg.NetBSD.org/src/rev/52d4ab4f378c
branches: trunk
changeset: 360893:52d4ab4f378c
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Apr 05 15:04:29 2018 +0000
description:
Set the "method" string at boot time too.
diffstat:
sys/arch/x86/x86/spectre.c | 41 +++++++++++++++++++++++++++--------------
1 files changed, 27 insertions(+), 14 deletions(-)
diffs (83 lines):
diff -r 86ee282819fa -r 52d4ab4f378c sys/arch/x86/x86/spectre.c
--- a/sys/arch/x86/x86/spectre.c Thu Apr 05 14:14:27 2018 +0000
+++ b/sys/arch/x86/x86/spectre.c Thu Apr 05 15:04:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spectre.c,v 1.9 2018/04/04 16:23:27 maxv Exp $ */
+/* $NetBSD: spectre.c,v 1.10 2018/04/05 15:04:29 maxv Exp $ */
/*
* Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.9 2018/04/04 16:23:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.10 2018/04/05 15:04:29 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -85,6 +85,29 @@
}
static void
+speculation_set_name(void)
+{
+ const char *name;
+
+ if (!spec_mitigation_enabled) {
+ name = "(none)";
+ } else {
+ switch (mitigation_method) {
+ case MITIGATION_AMD_DIS_IND:
+ name = "AMD DIS_IND";
+ break;
+ case MITIGATION_INTEL_IBRS:
+ name = "Intel IBRS";
+ break;
+ default:
+ panic("%s: impossible", __func__);
+ }
+ }
+ strlcpy(spec_mitigation_name, name,
+ sizeof(spec_mitigation_name));
+}
+
+static void
speculation_detect_method(void)
{
struct cpu_info *ci = curcpu();
@@ -270,7 +293,6 @@
struct cpu_info *ci = NULL;
CPU_INFO_ITERATOR cii;
uint64_t xc;
- const char *name;
speculation_detect_method();
@@ -308,17 +330,7 @@
printf(" done!\n");
spec_mitigation_enabled = enabled;
mutex_exit(&cpu_lock);
-
- if (!enabled) {
- name = "(none)";
- } else if (mitigation_method == MITIGATION_AMD_DIS_IND) {
- name = "AMD DIS_IND";
- } else {
- name = "Intel IBRS";
- }
- strlcpy(spec_mitigation_name, name,
- sizeof(spec_mitigation_name));
-
+ speculation_set_name();
return 0;
default:
panic("impossible");
@@ -336,6 +348,7 @@
speculation_detect_method();
spec_mitigation_enabled =
(mitigation_method != MITIGATION_NONE);
+ speculation_set_name();
}
if (mitigation_method != MITIGATION_NONE) {
Home |
Main Index |
Thread Index |
Old Index