Module Name: src Committed By: snj Date: Sat Feb 6 20:26:55 UTC 2016
Modified Files: src/sys/arch/x86/include [netbsd-7-0]: cpufunc.h src/sys/arch/x86/x86 [netbsd-7-0]: errata.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1073): sys/arch/x86/x86/errata.c: revision 1.23 sys/arch/x86/include/cpufunc.h: revision 1.19 Adapt prototypes and usage of rdmsr_locked() and wrmsr_locked() to their implementation. Both functions don't take the passcode as argument. As wrmsr_locked() no longer writes the passcode to the msr the erratum 721 on my Opteron 2356 really gets patched and cc1 no longer crashes with SIGSEGV. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/arch/x86/include/cpufunc.h cvs rdiff -u -r1.21 -r1.21.16.1 src/sys/arch/x86/x86/errata.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/include/cpufunc.h diff -u src/sys/arch/x86/include/cpufunc.h:1.18 src/sys/arch/x86/include/cpufunc.h:1.18.8.1 --- src/sys/arch/x86/include/cpufunc.h:1.18 Tue Feb 25 22:16:52 2014 +++ src/sys/arch/x86/include/cpufunc.h Sat Feb 6 20:26:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.18 2014/02/25 22:16:52 dsl Exp $ */ +/* $NetBSD: cpufunc.h,v 1.18.8.1 2016/02/06 20:26:55 snj Exp $ */ /*- * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. @@ -134,12 +134,12 @@ void x86_reset(void); #define OPTERON_MSR_PASSCODE 0x9c5a203aU uint64_t rdmsr(u_int); -uint64_t rdmsr_locked(u_int, u_int); +uint64_t rdmsr_locked(u_int); int rdmsr_safe(u_int, uint64_t *); uint64_t rdtsc(void); uint64_t rdpmc(u_int); void wrmsr(u_int, uint64_t); -void wrmsr_locked(u_int, u_int, uint64_t); +void wrmsr_locked(u_int, uint64_t); void setfs(int); void setusergs(int); Index: src/sys/arch/x86/x86/errata.c diff -u src/sys/arch/x86/x86/errata.c:1.21 src/sys/arch/x86/x86/errata.c:1.21.16.1 --- src/sys/arch/x86/x86/errata.c:1.21 Thu Mar 21 13:22:37 2013 +++ src/sys/arch/x86/x86/errata.c Sat Feb 6 20:26:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: errata.c,v 1.21 2013/03/21 13:22:37 christos Exp $ */ +/* $NetBSD: errata.c,v 1.21.16.1 2016/02/06 20:26:55 snj Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.21 2013/03/21 13:22:37 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.21.16.1 2016/02/06 20:26:55 snj Exp $"); #include <sys/types.h> #include <sys/systm.h> @@ -294,7 +294,7 @@ x86_errata_testmsr(struct cpu_info *ci, (void)ci; - val = rdmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE); + val = rdmsr_locked(e->e_data1); if ((val & e->e_data2) != 0) return FALSE; @@ -309,10 +309,10 @@ x86_errata_setmsr(struct cpu_info *ci, e (void)ci; - val = rdmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE); + val = rdmsr_locked(e->e_data1); if ((val & e->e_data2) != 0) return FALSE; - wrmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE, val | e->e_data2); + wrmsr_locked(e->e_data1, val | e->e_data2); aprint_debug_dev(ci->ci_dev, "erratum %d patched\n", e->e_num);