3832 AMD E721 workaround panics on KVM
authorHans Rosenfeld <hans.rosenfeld@nexenta.com>
Wed, 19 Jun 2013 13:34:25 -0400
changeset 14136 e9339ccf0537
parent 14135 b99338e2b7ed
child 14137 1a63e2c4c1b9
3832 AMD E721 workaround panics on KVM Reviewed by: Marcel Telka <[email protected]> Reviewed by: Robert Mustacchi <[email protected]> Approved by: Dan McDonald <[email protected]>
usr/src/uts/i86pc/os/mp_startup.c
--- a/usr/src/uts/i86pc/os/mp_startup.c	Wed Jun 19 07:56:09 2013 -0700
+++ b/usr/src/uts/i86pc/os/mp_startup.c	Wed Jun 19 13:34:25 2013 -0400
@@ -28,6 +28,7 @@
  */
 /*
  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <sys/types.h>
@@ -77,6 +78,7 @@
 #include <sys/hypervisor.h>
 #endif
 #include <sys/cpu_module.h>
+#include <sys/ontrap.h>
 
 struct cpu	cpus[1];			/* CPU data */
 struct cpu	*cpu[NCPU] = {&cpus[0]};	/* pointers to all CPUs */
@@ -1186,7 +1188,13 @@
 
 	if (cpuid_opteron_erratum(cpu, 721) > 0) {
 #if defined(OPTERON_ERRATUM_721)
-		wrmsr(MSR_AMD_DE_CFG, rdmsr(MSR_AMD_DE_CFG) | AMD_DE_CFG_E721);
+		on_trap_data_t otd;
+
+		if (!on_trap(&otd, OT_DATA_ACCESS))
+			wrmsr(MSR_AMD_DE_CFG,
+			    rdmsr(MSR_AMD_DE_CFG) | AMD_DE_CFG_E721);
+		no_trap();
+
 		opteron_erratum_721++;
 #else
 		workaround_warning(cpu, 721);