Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119997
b: refs/heads/master
c: 280a9ca
h: refs/heads/master
i:
  119995: b1c0f30
v: v3
  • Loading branch information
Dmitry Adamushko authored and Ingo Molnar committed Dec 20, 2008
1 parent ed158ef commit ce44db9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9bc03ac312c6b65a32a183424f1f1383d94f5cf
refs/heads/master: 280a9ca5d0663b185ddc4443052076c29652a328
19 changes: 14 additions & 5 deletions trunk/arch/x86/kernel/microcode_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,18 @@ static struct attribute_group mc_attr_group = {
.name = "microcode",
};

static void microcode_fini_cpu(int cpu)
static void __microcode_fini_cpu(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;

mutex_lock(&microcode_mutex);
microcode_ops->microcode_fini_cpu(cpu);
uci->valid = 0;
}

static void microcode_fini_cpu(int cpu)
{
mutex_lock(&microcode_mutex);
__microcode_fini_cpu(cpu);
mutex_unlock(&microcode_mutex);
}

Expand Down Expand Up @@ -306,12 +311,16 @@ static int microcode_resume_cpu(int cpu)
* to this cpu (a bit of paranoia):
*/
if (microcode_ops->collect_cpu_info(cpu, &nsig)) {
microcode_fini_cpu(cpu);
__microcode_fini_cpu(cpu);
printk(KERN_ERR "failed to collect_cpu_info for resuming cpu #%d\n",
cpu);
return -1;
}

if (memcmp(&nsig, &uci->cpu_sig, sizeof(nsig))) {
microcode_fini_cpu(cpu);
if ((nsig.sig != uci->cpu_sig.sig) || (nsig.pf != uci->cpu_sig.pf)) {
__microcode_fini_cpu(cpu);
printk(KERN_ERR "cached ucode doesn't match the resuming cpu #%d\n",
cpu);
/* Should we look for a new ucode here? */
return 1;
}
Expand Down
6 changes: 6 additions & 0 deletions trunk/arch/x86/kernel/microcode_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ static DEFINE_SPINLOCK(microcode_update_lock);
static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
{
struct cpuinfo_x86 *c = &cpu_data(cpu_num);
unsigned long flags;
unsigned int val[2];

memset(csig, 0, sizeof(*csig));
Expand All @@ -174,11 +175,16 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
csig->pf = 1 << ((val[1] >> 18) & 7);
}

/* serialize access to the physical write to MSR 0x79 */
spin_lock_irqsave(&microcode_update_lock, flags);

wrmsr(MSR_IA32_UCODE_REV, 0, 0);
/* see notes above for revision 1.07. Apparent chip bug */
sync_core();
/* get the current revision from MSR 0x8B */
rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev);
spin_unlock_irqrestore(&microcode_update_lock, flags);

pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n",
csig->sig, csig->pf, csig->rev);

Expand Down

0 comments on commit ce44db9

Please sign in to comment.