From 4f51b0f7fe81677f3cd205cd2820aee6fb78f1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 7 Jun 2018 06:47:48 +0300 Subject: arch/x86: Fix payload loading via bounce-buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix regression (supposedly) after commit: 23d62dd lib/bootmem: Add more bootmem tags Without RELOCATABLE_RAMSTAGE, payload is allowed to overwrite memory regions of the running ramstage. This case is handled gracefully via a bounce-buffer implementation in arch/x86/boot.c. Change-Id: I1c9bbdb963a7210d0817a7a990a70a1e4fc03624 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/26935 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Julius Werner --- src/lib/selfboot.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lib/selfboot.c') diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c index 42f7efcc28..4046649522 100644 --- a/src/lib/selfboot.c +++ b/src/lib/selfboot.c @@ -350,6 +350,15 @@ static int payload_targets_usable_ram(struct segment *head) if (payload_arch_usable_ram_quirk(ptr->s_dstaddr, ptr->s_memsz)) continue; + if (arch_supports_bounce_buffer() && + bootmem_region_usable_with_bounce(ptr->s_dstaddr, + ptr->s_memsz)) { + printk(BIOS_DEBUG, + "Payload is loaded over non-relocatable " + "ramstage. Will use bounce-buffer.\n"); + return 1; + } + /* Payload segment not targeting RAM. */ printk(BIOS_ERR, "SELF Payload doesn't target RAM:\n"); printk(BIOS_ERR, "Failed Segment: 0x%lx, %lu bytes\n", -- cgit v1.2.3