Module Name:    src
Committed By:   maxv
Date:           Thu May  9 18:53:14 UTC 2019

Modified Files:
        src/sys/arch/x86/x86: cpu_ucode_intel.c

Log Message:
Invalidate the cache before updating the microcode. Some platforms require
this. Seen in Illumos and FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/cpu_ucode_intel.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/cpu_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.15 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.16
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.15	Sun Jan 27 02:08:39 2019
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c	Thu May  9 18:53:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.15 2019/01/27 02:08:39 pgoyette Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.16 2019/05/09 18:53:14 maxv Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.15 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.16 2019/05/09 18:53:14 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xen.h"
@@ -213,7 +213,14 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
 		rv = EEXIST; /* ??? */
 		goto out;
 	}
+
+	/*
+	 * Perform update. On some platforms a cache invalidation is
+	 * required.
+	 */
+	wbinvd();
 	wrmsr(MSR_BIOS_UPDT_TRIG, (uintptr_t)uh + 48);
+
 	intel_getcurrentucode(&nucodeversion, &platformid);
 	cpuid = curcpu()->ci_index;
 

Reply via email to