Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/arch/x86/x86 Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/d7cb00893d1e
branches: netbsd-7
changeset: 799661:d7cb00893d1e
user: riz <riz%NetBSD.org@localhost>
date: Fri Nov 06 22:50:56 2015 +0000
description:
Pull up following revision(s) (requested by jym in ticket #994):
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.10
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.9
kmem_free() the address returned by kmem_alloc(). found by Brainy.
use the newly aligned location if we needed it. found by kre.
Cache CPU index in the non-preemptible part otherwise it can be
unreliable (and report a CPU as patched while it was not).
diffstat:
sys/arch/x86/x86/cpu_ucode_intel.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diffs (70 lines):
diff -r 6fc1effdb8c2 -r d7cb00893d1e sys/arch/x86/x86/cpu_ucode_intel.c
--- a/sys/arch/x86/x86/cpu_ucode_intel.c Fri Nov 06 20:29:03 2015 +0000
+++ b/sys/arch/x86/x86/cpu_ucode_intel.c Fri Nov 06 22:50:56 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.5.4.2 2015/08/11 05:13:44 snj Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.5.4.3 2015/11/06 22:50:56 riz Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.5.4.2 2015/08/11 05:13:44 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.5.4.3 2015/11/06 22:50:56 riz Exp $");
#include "opt_xen.h"
#include "opt_cpu_ucode.h"
@@ -109,8 +109,9 @@
cpu_ucode_intel_apply(struct cpu_ucode_softc *sc, int cpuno)
{
uint32_t ucodetarget, oucodeversion, nucodeversion;
- int platformid;
+ int platformid, cpuid;
struct intel1_ucode_header *uh;
+ void *uha;
size_t newbufsize = 0;
int rv = 0;
@@ -126,12 +127,12 @@
if ((uintptr_t)(sc->sc_blob) & 15) {
/* Make the buffer 16 byte aligned */
newbufsize = sc->sc_blobsize + 15;
- uh = kmem_alloc(newbufsize, KM_SLEEP);
- if (uh == NULL) {
+ uha = kmem_alloc(newbufsize, KM_SLEEP);
+ if (uha == NULL) {
printf("%s: memory allocation failed\n", __func__);
return EINVAL;
}
- uh = (struct intel1_ucode_header *)roundup2((uintptr_t)uh, 16);
+ uh = (struct intel1_ucode_header *)roundup2((uintptr_t)uha, 16);
/* Copy to the new area */
memcpy(uh, sc->sc_blob, sc->sc_blobsize);
}
@@ -144,8 +145,9 @@
rv = EEXIST; /* ??? */
goto out;
}
- wrmsr(MSR_BIOS_UPDT_TRIG, (uintptr_t)(sc->sc_blob) + 48);
+ wrmsr(MSR_BIOS_UPDT_TRIG, (uintptr_t)uh + 48);
intel_getcurrentucode(&nucodeversion, &platformid);
+ cpuid = curcpu()->ci_index;
kpreempt_enable();
@@ -154,11 +156,11 @@
goto out;
}
- printf("cpu %d: ucode 0x%x->0x%x\n", curcpu()->ci_index,
+ printf("cpu %d: ucode 0x%x->0x%x\n", cpuid,
oucodeversion, nucodeversion);
out:
if (newbufsize != 0)
- kmem_free(uh, newbufsize);
+ kmem_free(uha, newbufsize);
return rv;
}
#endif /* ! XEN */
Home |
Main Index |
Thread Index |
Old Index