acrn-hypervisor/hypervisor/common
Victor Sun 1b3a75c984 HV: place kernel and ramdisk by find_space_from_ve820()
We should not hardcode the VM ramdisk load address right after kernel
load address because of two reasons:
	1. Per Linux kernel boot protocol, the Kernel need a size of
	   contiguous memory(i.e. init_size field in zeropage) from
	   its load address to boot, then the address would overlap
	   with ramdisk;
	2. The hardcoded address could not be ensured as a valid address
	   in guest e820 table, especially with a huge ramdisk;

Also we should not hardcode the VM kernel load address to its pref_address
which work for non-relocatable kernel only. For a relocatable kernel,
it could run from any valid address where bootloader load to.

The patch will set the VM kernel and ramdisk load address by scanning
guest e820 table with find_space_from_ve820() api:
	1. For SOS VM, the ramdisk has been loaded by multiboot bootloader
	   already so set the load address as module source address,
	   the relocatable kernel would be relocated to a appropriate address
	   out space of hypervisor and boot modules to avoid guest memory
	   copy corruption;
	2. For pre-launched VM, the kernel would be loaded to pref_address
	   first, then ramdisk will be put to a appropriate address out space
	   of kernel according to guest memory layout and maximum ramdisk
	   address limit under 4GB;

Tracked-On: #5879

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-06-11 10:06:02 +08:00
..
delay.c hv/mod_timer: separate delay functions from the timer module 2021-05-18 16:43:28 +08:00
efi_mmap.c HV: add efi memory map parsing function 2021-06-11 10:06:02 +08:00
event.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
hv_main.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
hypercall.c hv: hypercall: 72 reserved bytes are used in struct hc_platform_info to pass physical APIC and cat IDs shift to DM 2021-05-26 11:23:06 +08:00
irq.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
ptdev.c hv/mod_timer: refine timer interface 2021-05-18 16:43:28 +08:00
sched_bvt.c hv/mod_timer: refine timer interface 2021-05-18 16:43:28 +08:00
sched_iorr.c hv/mod_timer: refine timer interface 2021-05-18 16:43:28 +08:00
sched_noop.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
schedule.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
softirq.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
ticks.c hv/mod_timer: split tsc handling code from timer. 2021-05-18 16:43:28 +08:00
timer.c hv/mod_timer: refine timer interface 2021-05-18 16:43:28 +08:00
trusty_hypercall.c hv: hypercalls: refactor permission-checking and dispatching logic 2021-05-12 13:43:41 +08:00
vm_load.c HV: place kernel and ramdisk by find_space_from_ve820() 2021-06-11 10:06:02 +08:00