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


  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 /*
  26  * Copyright (c) 2010, Intel Corporation.
  27  * All rights reserved.
  28  */
  29 /*
  30  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.

  31  */
  32 
  33 #include <sys/types.h>
  34 #include <sys/thread.h>
  35 #include <sys/cpuvar.h>
  36 #include <sys/cpu.h>
  37 #include <sys/t_lock.h>
  38 #include <sys/param.h>
  39 #include <sys/proc.h>
  40 #include <sys/disp.h>
  41 #include <sys/class.h>
  42 #include <sys/cmn_err.h>
  43 #include <sys/debug.h>
  44 #include <sys/note.h>
  45 #include <sys/asm_linkage.h>
  46 #include <sys/x_call.h>
  47 #include <sys/systm.h>
  48 #include <sys/var.h>
  49 #include <sys/vtrace.h>
  50 #include <vm/hat.h>


  60 #include <sys/traptrace.h>
  61 #include <sys/clock.h>
  62 #include <sys/cpc_impl.h>
  63 #include <sys/pg.h>
  64 #include <sys/cmt.h>
  65 #include <sys/dtrace.h>
  66 #include <sys/archsystm.h>
  67 #include <sys/fp.h>
  68 #include <sys/reboot.h>
  69 #include <sys/kdi_machimpl.h>
  70 #include <vm/hat_i86.h>
  71 #include <vm/vm_dep.h>
  72 #include <sys/memnode.h>
  73 #include <sys/pci_cfgspace.h>
  74 #include <sys/mach_mmu.h>
  75 #include <sys/sysmacros.h>
  76 #if defined(__xpv)
  77 #include <sys/hypervisor.h>
  78 #endif
  79 #include <sys/cpu_module.h>

  80 
  81 struct cpu      cpus[1];                        /* CPU data */
  82 struct cpu      *cpu[NCPU] = {&cpus[0]};    /* pointers to all CPUs */
  83 struct cpu      *cpu_free_list;                 /* list for released CPUs */
  84 cpu_core_t      cpu_core[NCPU];                 /* cpu_core structures */
  85 
  86 #define cpu_next_free   cpu_prev
  87 
  88 /*
  89  * Useful for disabling MP bring-up on a MP capable system.
  90  */
  91 int use_mp = 1;
  92 
  93 /*
  94  * to be set by a PSM to indicate what cpus
  95  * are sitting around on the system.
  96  */
  97 cpuset_t mp_cpus;
  98 
  99 /*


1169                                 opteron_workaround_6323525++;
1170                         }
1171 #else   /* __xpv */
1172                 } else if (is_x86_feature(x86_featureset, X86FSET_SSE2) &&
1173                     ((opteron_get_nnodes() *
1174                     cpuid_get_ncpu_per_chip(cpu)) > 1)) {
1175                         if ((xrdmsr(MSR_AMD_BU_CFG) & (UINT64_C(1) << 33)) == 0)
1176                                 opteron_workaround_6323525++;
1177 #endif  /* __xpv */
1178                 }
1179 #else
1180                 workaround_warning(cpu, 6323525);
1181                 missing++;
1182 #endif
1183         }
1184 
1185         missing += do_erratum_298(cpu);
1186 
1187         if (cpuid_opteron_erratum(cpu, 721) > 0) {
1188 #if defined(OPTERON_ERRATUM_721)
1189                 wrmsr(MSR_AMD_DE_CFG, rdmsr(MSR_AMD_DE_CFG) | AMD_DE_CFG_E721);






1190                 opteron_erratum_721++;
1191 #else
1192                 workaround_warning(cpu, 721);
1193                 missing++;
1194 #endif
1195         }
1196 
1197 #ifdef __xpv
1198         return (0);
1199 #else
1200         return (missing);
1201 #endif
1202 }
1203 
1204 void
1205 workaround_errata_end()
1206 {
1207 #if defined(OPTERON_ERRATUM_88)
1208         if (opteron_erratum_88)
1209                 workaround_applied(88);




  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 /*
  26  * Copyright (c) 2010, Intel Corporation.
  27  * All rights reserved.
  28  */
  29 /*
  30  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
  31  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  32  */
  33 
  34 #include <sys/types.h>
  35 #include <sys/thread.h>
  36 #include <sys/cpuvar.h>
  37 #include <sys/cpu.h>
  38 #include <sys/t_lock.h>
  39 #include <sys/param.h>
  40 #include <sys/proc.h>
  41 #include <sys/disp.h>
  42 #include <sys/class.h>
  43 #include <sys/cmn_err.h>
  44 #include <sys/debug.h>
  45 #include <sys/note.h>
  46 #include <sys/asm_linkage.h>
  47 #include <sys/x_call.h>
  48 #include <sys/systm.h>
  49 #include <sys/var.h>
  50 #include <sys/vtrace.h>
  51 #include <vm/hat.h>


  61 #include <sys/traptrace.h>
  62 #include <sys/clock.h>
  63 #include <sys/cpc_impl.h>
  64 #include <sys/pg.h>
  65 #include <sys/cmt.h>
  66 #include <sys/dtrace.h>
  67 #include <sys/archsystm.h>
  68 #include <sys/fp.h>
  69 #include <sys/reboot.h>
  70 #include <sys/kdi_machimpl.h>
  71 #include <vm/hat_i86.h>
  72 #include <vm/vm_dep.h>
  73 #include <sys/memnode.h>
  74 #include <sys/pci_cfgspace.h>
  75 #include <sys/mach_mmu.h>
  76 #include <sys/sysmacros.h>
  77 #if defined(__xpv)
  78 #include <sys/hypervisor.h>
  79 #endif
  80 #include <sys/cpu_module.h>
  81 #include <sys/ontrap.h>
  82 
  83 struct cpu      cpus[1];                        /* CPU data */
  84 struct cpu      *cpu[NCPU] = {&cpus[0]};    /* pointers to all CPUs */
  85 struct cpu      *cpu_free_list;                 /* list for released CPUs */
  86 cpu_core_t      cpu_core[NCPU];                 /* cpu_core structures */
  87 
  88 #define cpu_next_free   cpu_prev
  89 
  90 /*
  91  * Useful for disabling MP bring-up on a MP capable system.
  92  */
  93 int use_mp = 1;
  94 
  95 /*
  96  * to be set by a PSM to indicate what cpus
  97  * are sitting around on the system.
  98  */
  99 cpuset_t mp_cpus;
 100 
 101 /*


1171                                 opteron_workaround_6323525++;
1172                         }
1173 #else   /* __xpv */
1174                 } else if (is_x86_feature(x86_featureset, X86FSET_SSE2) &&
1175                     ((opteron_get_nnodes() *
1176                     cpuid_get_ncpu_per_chip(cpu)) > 1)) {
1177                         if ((xrdmsr(MSR_AMD_BU_CFG) & (UINT64_C(1) << 33)) == 0)
1178                                 opteron_workaround_6323525++;
1179 #endif  /* __xpv */
1180                 }
1181 #else
1182                 workaround_warning(cpu, 6323525);
1183                 missing++;
1184 #endif
1185         }
1186 
1187         missing += do_erratum_298(cpu);
1188 
1189         if (cpuid_opteron_erratum(cpu, 721) > 0) {
1190 #if defined(OPTERON_ERRATUM_721)
1191                 on_trap_data_t otd;
1192 
1193                 if (!on_trap(&otd, OT_DATA_ACCESS))
1194                         wrmsr(MSR_AMD_DE_CFG,
1195                             rdmsr(MSR_AMD_DE_CFG) | AMD_DE_CFG_E721);
1196                 no_trap();
1197 
1198                 opteron_erratum_721++;
1199 #else
1200                 workaround_warning(cpu, 721);
1201                 missing++;
1202 #endif
1203         }
1204 
1205 #ifdef __xpv
1206         return (0);
1207 #else
1208         return (missing);
1209 #endif
1210 }
1211 
1212 void
1213 workaround_errata_end()
1214 {
1215 #if defined(OPTERON_ERRATUM_88)
1216         if (opteron_erratum_88)
1217                 workaround_applied(88);