From 8890db929c1c7d9450d80227f8ea736d8c95bd44 Mon Sep 17 00:00:00 2001 From: avg Date: Thu, 27 Oct 2016 07:57:43 +0000 Subject: [PATCH] MFC r305539: work around AMD erratum 793 for family 16h, models 00h-0Fh git-svn-id: svn://svn.freebsd.org/base/stable/10@307998 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/amd64/amd64/initcpu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index e20a27176..66e465e29 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -139,6 +139,20 @@ init_amd(void) wrmsr(0xc001102a, msr); } } + + /* + * Work around Erratum 793: Specific Combination of Writes to Write + * Combined Memory Types and Locked Instructions May Cause Core Hang. + * See Revision Guide for AMD Family 16h Models 00h-0Fh Processors, + * revision 3.04 or later, publication 51810. + */ + if (CPUID_TO_FAMILY(cpu_id) == 0x16 && CPUID_TO_MODEL(cpu_id) <= 0xf) { + if ((cpu_feature2 & CPUID2_HV) == 0) { + msr = rdmsr(0xc0011020); + msr |= (uint64_t)1 << 15; + wrmsr(0xc0011020, msr); + } + } } /* -- 2.45.0