arch/x86: Fix payload loading via bounce-buffer
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 <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/26935
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
d022718001
commit
4f51b0f7fe
|
@ -203,7 +203,7 @@ static void jmp_payload(void *entry, unsigned long buffer, unsigned long size)
|
||||||
|
|
||||||
int arch_supports_bounce_buffer(void)
|
int arch_supports_bounce_buffer(void)
|
||||||
{
|
{
|
||||||
return 1;
|
return !IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size)
|
int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size)
|
||||||
|
|
|
@ -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))
|
if (payload_arch_usable_ram_quirk(ptr->s_dstaddr, ptr->s_memsz))
|
||||||
continue;
|
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. */
|
/* Payload segment not targeting RAM. */
|
||||||
printk(BIOS_ERR, "SELF Payload doesn't target RAM:\n");
|
printk(BIOS_ERR, "SELF Payload doesn't target RAM:\n");
|
||||||
printk(BIOS_ERR, "Failed Segment: 0x%lx, %lu bytes\n",
|
printk(BIOS_ERR, "Failed Segment: 0x%lx, %lu bytes\n",
|
||||||
|
|
Loading…
Reference in New Issue