Skip to contentSkip to conversation

Fix microcode change for i386

PATCH In review Andi Kleen 3 participants 3 messages Feb 18, 2004 – Feb 19, 2004

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Fix microcode change for i386

This patch should fix the i386 compile problem in the microcode driver I caused with the IA32e updates.

arch/i386/kernel/microcode.c renamed from arch/i386/kernel/microcode.c-o +2 -2
diff -u linux-2.6.3-amd64/arch/i386/kernel/microcode.c-o linux-2.6.3-amd64/arch/i386/kernel/microcode.c
@@ -371,8 +371,8 @@
 	spin_lock_irqsave(&microcode_update_lock, flags);          
 
 	/* write microcode via MSR 0x79 */
-	wrmsr(MSR_IA32_UCODE_WRITE, (u64)(uci->mc->bits), 
-	      (u64)(uci->mc->bits) >> 32);
+	wrmsr(MSR_IA32_UCODE_WRITE, (u32)(unsigned long)(uci->mc->bits), 
+	      (u32)(((unsigned long)uci->mc->bits) >> 32));
 	wrmsr(MSR_IA32_UCODE_REV, 0, 0);
 
 	__asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
#1 lore raw
Quoted 3 lines · Andi Kleen

This patch should fix the i386 compile problem in the microcode driver I caused with the IA32e updates.

I doubt it. Doing a ">>32" on an "unsigned long" on x86 should give you a warning about undefined behaviour.

See the patch I posted, which should be safe, afaik.

Linus

#2 lore raw
In reply to Andi Kleen
Quoted 7 lines · Andi Kleen

This patch should fix the i386 compile problem in the microcode driver I caused with the IA32e updates.

diff -u linux-2.6.3-amd64/arch/i386/kernel/microcode.c-o linux-2.6.3-amd64/arch/i386/kernel/microcode.c

arch/i386/kernel/microcode.c line 375

Quoted 7 lines
arch/i386/kernel/microcode.c renamed from arch/i386/kernel/microcode.c-o +2 -2
@@ -371,8 +371,8 @@
 	spin_lock_irqsave(&microcode_update_lock, flags);          
 
 	/* write microcode via MSR 0x79 */
-	wrmsr(MSR_IA32_UCODE_WRITE, (u64)(uci->mc->bits), 
-	      (u64)(uci->mc->bits) >> 32);
+	wrmsr(MSR_IA32_UCODE_WRITE, (u32)(unsigned long)(uci->mc->bits), 
+	      (u32)(((unsigned long)uci->mc->bits) >> 32));

You still want to do two 16-bit shifts instead of a single 32-bit shift.

Jeff