Print this page
3832 AMD E721 workaround panics on KVM
Reviewed by: Marcel Telka <marcel@telka.sk>

@@ -26,10 +26,11 @@
  * Copyright (c) 2010, Intel Corporation.
  * All rights reserved.
  */
 /*
  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <sys/types.h>
 #include <sys/thread.h>
 #include <sys/cpuvar.h>

@@ -75,10 +76,11 @@
 #include <sys/sysmacros.h>
 #if defined(__xpv)
 #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 */
 struct cpu      *cpu_free_list;                 /* list for released CPUs */
 cpu_core_t      cpu_core[NCPU];                 /* cpu_core structures */

@@ -1184,11 +1186,17 @@
 
         missing += do_erratum_298(cpu);
 
         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);
                 missing++;
 #endif