The current model of loader copy "rom blobs" and kept in memory until a reset occurs and waste host memory.
This serial of patches set uimage/initrd/vmlinux as reloadable images and use private reset handlers to load these images from hard disk on reset, which could make loader framework more dynamic and reduce the memory consumption of QEMU process. Provides new API do_info_images() to display the information about the reloadable images (uImage/initrd/vmlinux). Olivia Yin (4): use image_file_reset to reload initrd use uimage_reset to reload uImage use elf_reset to reload elf image use info images to check images which could be reloaded on reset hw/elf_ops.h | 54 +++++++++++++++++-- hw/loader.c | 147 +++++++++++++++++++++++++++++++++++++++++++++------- hw/loader.h | 36 +++++++++++-- hw/ppc/e500.c | 2 +- hw/ppc440_bamboo.c | 2 +- monitor.c | 7 +++ 6 files changed, 218 insertions(+), 30 deletions(-) v10: patch 2/4: add error check in uimage_reset() and remove UImageFile structure patch 4/4: modify the format of 'info images' For example, (qemu) info images ImageType File PhyAddr MemSize uImage /media/ram/uImage 0000000000000000 0x7a28c0 raw /media/ram/ramdisk 0000000002000000 0x3f922f (qemu) info images ImageType File PhyAddr MemSize ELF phdr #0: /media/ram/vmlinux 0000000000000000 0x709a0c raw /media/ram/ramdisk 0000000002000000 0x3f922f v9: patch 4/4: set uimage/initrd/vmlinux as reloadable and free them on rom_reset; use 'info images' to display the information of reloadable images For example, (qemu) info images load_addr=0000000000000000 size=0x07cac80 type=UIMAGE file="uImage" load_addr=0000000002000000 size=0x188e844 type=FLAT file="ramdisk" (qemu) info images load_addr=0000000000000000 size=0x0709a0c type=FLAT file="vmlinux" load_addr=0000000002000000 size=0x188e844 type=FLAT file="ramdisk" v8: unify the structure ImageFile for uimage/initrd/vmlinux, and remove rom_reset(). v7: clean structure ImageFile v6: patch 3/4: load symbol only when startup v5: patch 2/4: remove global variables is_linux and kernel_loaded. patch 3/4: register reset handlers in loader.c for elf images. extract the duplicated source code into function elf_phy_loader(). patch 4/4: fix the issue of memory increasing (about 1.4MB) once reload elf image. v4: fix elf reload and register reset handler in hw/elf_ops.h v3: reload elf v2: Rename target_phys_addr_t to hwaddr v1: support uimage/initrd reload