All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/microcode: Look for the initrd at the correct address on 32-bit
@ 2017-06-14 14:06 Borislav Petkov
  2017-06-14 14:06 ` [PATCH 2/2] x86/microcode/intel: Save pointer to ucode patch for early AP loading Borislav Petkov
  2017-06-20 13:28 ` [tip:x86/microcode] x86/microcode: Look for the initrd at the correct address on 32-bit tip-bot for Borislav Petkov
  0 siblings, 2 replies; 4+ messages in thread
From: Borislav Petkov @ 2017-06-14 14:06 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Early during boot, the BSP finds the ramdisk's position from boot_params
but by the time the APs get to boot, the BSP has continued in the mean
time and has potentially managed to relocate that ramdisk.

And in that case, the APs need to find the ramdisk at its new position,
in *physical* memory as they're running before paging has been enabled.

Thus, get the updated physical location of the ramdisk which is in the
relocated_ramdisk variable.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/microcode/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index e53d3c909840..9cb98ee103db 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -290,6 +290,17 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa)
 			return (struct cpio_data){ NULL, 0, "" };
 		if (initrd_start)
 			start = initrd_start;
+	} else {
+		/*
+		 * The picture with physical addresses is a bit different: we
+		 * need to get the *physical* address to which the ramdisk was
+		 * relocated, i.e., relocated_ramdisk (not initrd_start) and
+		 * since we're running from physical addresses, we need to access
+		 * relocated_ramdisk through its *physical* address too.
+		 */
+		u64 *rr = (u64 *)__pa_nodebug(&relocated_ramdisk);
+		if (*rr)
+			start = *rr;
 	}
 
 	return find_cpio_data(path, (void *)start, size, NULL);
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-20 13:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 14:06 [PATCH 1/2] x86/microcode: Look for the initrd at the correct address on 32-bit Borislav Petkov
2017-06-14 14:06 ` [PATCH 2/2] x86/microcode/intel: Save pointer to ucode patch for early AP loading Borislav Petkov
2017-06-20 13:29   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2017-06-20 13:28 ` [tip:x86/microcode] x86/microcode: Look for the initrd at the correct address on 32-bit tip-bot for Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.