qemu/include/hw/nvram
Jason A. Donenfeld e935b73508 x86: return modified setup_data only if read as memory, not as file
If setup_data is being read into a specific memory location, then
generally the setup_data address parameter is read first, so that the
caller knows where to read it into. In that case, we should return
setup_data containing the absolute addresses that are hard coded and
determined a priori. This is the case when kernels are loaded by BIOS,
for example. In contrast, when setup_data is read as a file, then we
shouldn't modify setup_data, since the absolute address will be wrong by
definition. This is the case when OVMF loads the image.

This allows setup_data to be used like normal, without crashing when EFI
tries to use it.

(As a small development note, strangely, fw_cfg_add_file_callback() was
exported but fw_cfg_add_bytes_callback() wasn't, so this makes that
consistent.)

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Laurent Vivier <laurent@vivier.eu>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Message-Id: <20220921093134.2936487-1-Jason@zx2c4.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-09-27 11:30:59 +02:00
..
chrp_nvram.h nvram: Exit QEMU if NVRAM cannot contain all -prom-env data 2020-08-14 13:34:31 +10:00
eeprom93xx.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
fw_cfg.h x86: return modified setup_data only if read as memory, not as file 2022-09-27 11:30:59 +02:00
npcm7xx_otp.h hw/nvram: NPCM7xx OTP device model 2020-09-14 14:24:59 +01:00
nrf51_nvm.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
sun_nvram.h nvram: Rename openbios_firmware_abi.h into sun_nvram.h 2016-10-28 09:36:58 +11:00
xlnx-bbram.h hw/nvram: Introduce Xilinx battery-backed ram 2021-09-30 13:42:10 +01:00
xlnx-efuse.h hw/nvram: Introduce Xilinx eFuse QOM 2021-09-30 13:42:09 +01:00
xlnx-versal-efuse.h hw/nvram: Introduce Xilinx Versal eFuse device 2021-09-30 13:42:10 +01:00
xlnx-zynqmp-efuse.h hw/nvram: Introduce Xilinx ZynqMP eFuse device 2021-09-30 13:42:10 +01:00