From 15235b2d89c6b5cb9b26ce5fc892d9ff5ea037c8 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Thu, 18 Nov 2021 17:16:45 +0100 Subject: [PATCH] emulation/qemu-i440fx,q35: avoid writing to ROM libcbfs has a workaround to avoid writing to ROM areas: /* Hacky way to not load programs over read only media. The stages * that would hit this path initialize themselves. */ if ((ENV_BOOTBLOCK || ENV_SEPARATE_VERSTAGE) && !CONFIG(NO_XIP_EARLY_STAGES) && CONFIG(BOOT_DEVICE_MEMORY_MAPPED)) { This workaround is not triggered in QEMU, because BOOT_DEVICE_MEMORY_MAPPED is only selected for SPI boot devices. This results in confusing (to the VMM developer) writes to read-only memory. As far as I can tell, this issue is weird but harmless, because the code does memcpy to ROM with source == destination. The concensus in the mailing list thread [1] was that it's worthwhile to be fixed regardless. [1] https://mail.coreboot.org/hyperkitty/list/coreboot@coreboot.org/message/KDI6YQCPXSQF4NDUAAC7TIXQKSZ6T4X7/ Change-Id: I5cefbc31f917021236105f7dc969118d612ac399 Signed-off-by: Julian Stecklina Reviewed-on: https://review.coreboot.org/c/coreboot/+/59474 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Paul Menzel --- src/mainboard/emulation/qemu-i440fx/Kconfig | 1 + src/mainboard/emulation/qemu-q35/Kconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mainboard/emulation/qemu-i440fx/Kconfig b/src/mainboard/emulation/qemu-i440fx/Kconfig index dd11092bfa..436bb20d07 100644 --- a/src/mainboard/emulation/qemu-i440fx/Kconfig +++ b/src/mainboard/emulation/qemu-i440fx/Kconfig @@ -16,6 +16,7 @@ config BOARD_SPECIFIC_OPTIONS select HAVE_ASAN_IN_ROMSTAGE select NO_SMM select BOOT_DEVICE_NOT_SPI_FLASH + select BOOT_DEVICE_MEMORY_MAPPED config VBOOT select VBOOT_MUST_REQUEST_DISPLAY diff --git a/src/mainboard/emulation/qemu-q35/Kconfig b/src/mainboard/emulation/qemu-q35/Kconfig index 155540dd02..1fc82b5ff0 100644 --- a/src/mainboard/emulation/qemu-q35/Kconfig +++ b/src/mainboard/emulation/qemu-q35/Kconfig @@ -16,6 +16,7 @@ config BOARD_SPECIFIC_OPTIONS select MAINBOARD_HAS_CHROMEOS select SOUTHBRIDGE_INTEL_COMMON_ACPI_MADT select BOOT_DEVICE_NOT_SPI_FLASH + select BOOT_DEVICE_MEMORY_MAPPED config VBOOT select VBOOT_MUST_REQUEST_DISPLAY