Module Name: src Committed By: snj Date: Thu Jul 14 06:48:53 UTC 2016
Modified Files: src/sys/arch/x86/include [netbsd-6-1]: cpufunc.h src/sys/arch/x86/x86 [netbsd-6-1]: errata.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1361): sys/arch/x86/include/cpufunc.h: revision 1.19 sys/arch/x86/x86/errata.c: revision 1.23 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.13 -r1.13.22.1 src/sys/arch/x86/include/cpufunc.h cvs rdiff -u -r1.19.14.1 -r1.19.14.1.6.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.13 src/sys/arch/x86/include/cpufunc.h:1.13.22.1 --- src/sys/arch/x86/include/cpufunc.h:1.13 Sat Sep 24 10:32:52 2011 +++ src/sys/arch/x86/include/cpufunc.h Thu Jul 14 06:48:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.13 2011/09/24 10:32:52 jym Exp $ */ +/* $NetBSD: cpufunc.h,v 1.13.22.1 2016/07/14 06:48:53 snj Exp $ */ /*- * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. @@ -117,12 +117,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.19.14.1 src/sys/arch/x86/x86/errata.c:1.19.14.1.6.1 --- src/sys/arch/x86/x86/errata.c:1.19.14.1 Mon Apr 9 18:02:25 2012 +++ src/sys/arch/x86/x86/errata.c Thu Jul 14 06:48:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: errata.c,v 1.19.14.1 2012/04/09 18:02:25 riz Exp $ */ +/* $NetBSD: errata.c,v 1.19.14.1.6.1 2016/07/14 06:48:53 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.19.14.1 2012/04/09 18:02:25 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.19.14.1.6.1 2016/07/14 06:48:53 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);