On 3/28/22 06:57, Xiaojuan Yang wrote:
Signed-off-by: Xiaojuan Yang<yangxiaoj...@loongson.cn> Signed-off-by: Song Gao<gaos...@loongson.cn> --- hw/loongarch/Kconfig | 4 ++ hw/loongarch/fw_cfg.c | 33 ++++++++++++++ hw/loongarch/fw_cfg.h | 15 +++++++ hw/loongarch/loongson3.c | 76 +++++++++++++++++++++++++++++++- hw/loongarch/meson.build | 1 + include/hw/loongarch/loongarch.h | 8 ++++ 6 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 hw/loongarch/fw_cfg.c create mode 100644 hw/loongarch/fw_cfg.h
Not within this patch, but you will want to create a submodule for this bios image, as we do for roms/edk2 etc. You will want to commit a pre-built image as well, like we do for other targets.
+ /* load the BIOS image. */ + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, + machine->firmware ?: LOONGSON3_BIOSNAME); + if (filename) { + bios_size = load_image_targphys(filename, LA_BIOS_BASE, LA_BIOS_SIZE); + lams->fw_cfg = loongarch_fw_cfg_init(ram_size, machine); + rom_set_fw(lams->fw_cfg); + g_free(filename); + } else { + bios_size = -1; + }
While loading the efi bios may be the most common usage, it's not efficient for simple tests. I think you should attempt to load an elf image, and only if that fails treat it as the firmware blob that efi builds.
Or not require a bios image if -kernel is present, or something. At the moment one cannot run the tests/tcg/multiarch tests without loongarch.bios. r~