diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2019-01-10 14:57:27 +0100 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2019-01-16 01:14:09 +0100 |
commit | 295dd902155035151caae3e4db3f41c8deebba34 (patch) | |
tree | 03924ebe7e5cecc8cb26effb53dc9599c0a8c429 | |
parent | 9c48d67901bec379c9342e79a2dfa7c95a7a130f (diff) | |
download | qboot-295dd902155035151caae3e4db3f41c8deebba34.zip qboot-295dd902155035151caae3e4db3f41c8deebba34.tar.gz qboot-295dd902155035151caae3e4db3f41c8deebba34.tar.bz2 |
pvh: load initrd from fw_cfg
If we found initrd through fw_cfg, we can load it and use the
first module of hvm_start_info to pass initrd address and size
to the kernel.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
-rw-r--r-- | fw_cfg.c | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -217,7 +217,7 @@ static void boot_pvh_from_fw_cfg(void) start_info.magic = XEN_HVM_START_MAGIC_VALUE; start_info.version = 1; start_info.flags = 0; - start_info.nr_modules = 1; + start_info.nr_modules = 0; start_info.reserved = 0; fw_cfg_select(FW_CFG_CMDLINE_SIZE); @@ -227,11 +227,22 @@ static void boot_pvh_from_fw_cfg(void) args.cmdline_size); start_info.cmdline_paddr = (uintptr_t)args.cmdline_addr; - /* Use this field for pvhboot. Not used by pvhboot otherwise */ - fw_cfg_read_entry(FW_CFG_KERNEL_DATA, &ramdisk_mod, - sizeof(ramdisk_mod)); - ramdisk_mod.cmdline_paddr = (uintptr_t)&ramdisk_mod; - start_info.modlist_paddr = (uintptr_t)&ramdisk_mod; + fw_cfg_select(FW_CFG_INITRD_SIZE); + args.initrd_size = fw_cfg_readl_le(); + if (args.initrd_size) { + fw_cfg_select(FW_CFG_INITRD_SIZE); + args.initrd_addr = (void *)fw_cfg_readl_le(); + + fw_cfg_read_entry(FW_CFG_INITRD_DATA, args.initrd_addr, + args.initrd_size); + + ramdisk_mod.paddr = (uintptr_t)args.initrd_addr; + ramdisk_mod.size = (uintptr_t)args.initrd_size; + + /* The first module is always ramdisk. */ + start_info.modlist_paddr = (uintptr_t)&ramdisk_mod; + start_info.nr_modules = 1; + } pvh_e820_setup(); |