ba6e01
From 4232c1bb6b7ed45b96d2112e6f151cf5c9c28470 Mon Sep 17 00:00:00 2001
ba6e01
From: Borislav Petkov <bp@alien8.de>
ba6e01
Date: Sat, 1 Nov 2014 11:01:00 +0100
ba6e01
Subject: [PATCH] x86, microcode, AMD: Fix early ucode loading on 32-bit
ba6e01
ba6e01
Hi guys,
ba6e01
ba6e01
please queue this for the next batch to Linus.
ba6e01
ba6e01
Thanks.
ba6e01
---
ba6e01
 arch/x86/kernel/cpu/microcode/amd_early.c | 9 +++++++--
ba6e01
 1 file changed, 7 insertions(+), 2 deletions(-)
ba6e01
ba6e01
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c
ba6e01
index 617a9e284245..65bdfb598880 100644
ba6e01
--- a/arch/x86/kernel/cpu/microcode/amd_early.c
ba6e01
+++ b/arch/x86/kernel/cpu/microcode/amd_early.c
ba6e01
@@ -348,6 +348,7 @@ int __init save_microcode_in_initrd_amd(void)
ba6e01
 {
ba6e01
 	unsigned long cont;
ba6e01
 	enum ucode_state ret;
ba6e01
+	u8 *cont_va;
ba6e01
 	u32 eax;
ba6e01
 
ba6e01
 	if (!container)
ba6e01
@@ -355,13 +356,15 @@ int __init save_microcode_in_initrd_amd(void)
ba6e01
 
ba6e01
 #ifdef CONFIG_X86_32
ba6e01
 	get_bsp_sig();
ba6e01
-	cont = (unsigned long)container;
ba6e01
+	cont	= (unsigned long)container;
ba6e01
+	cont_va = __va(container);
ba6e01
 #else
ba6e01
 	/*
ba6e01
 	 * We need the physical address of the container for both bitness since
ba6e01
 	 * boot_params.hdr.ramdisk_image is a physical address.
ba6e01
 	 */
ba6e01
-	cont = __pa(container);
ba6e01
+	cont    = __pa(container);
ba6e01
+	cont_va = container;
ba6e01
 #endif
ba6e01
 
ba6e01
 	/*
ba6e01
@@ -372,6 +375,8 @@ int __init save_microcode_in_initrd_amd(void)
ba6e01
 	if (relocated_ramdisk)
ba6e01
 		container = (u8 *)(__va(relocated_ramdisk) +
ba6e01
 			     (cont - boot_params.hdr.ramdisk_image));
ba6e01
+	else
ba6e01
+		container = cont_va;
ba6e01
 
ba6e01
 	if (ucode_new_rev)
ba6e01
 		pr_info("microcode: updated early to new patch_level=0x%08x\n",
ba6e01
-- 
ba6e01
1.9.3
ba6e01