dm: support OVMF split images

In addition to a single OVMF image (OVMF.fd), split images
(OVMF_CODE.fd, OVMF_VARS.fd) can be used to facilitate VM management.

From the OVMF Whitepaper:

  The variable store and the firmware executable are also available in
  the build output as separate files entitled: "OVMF_VARS.fd" and
  "OVMF_CODE.fd". This enables central management and updates of the
  firmware executable, while each virtual machine can retain its own
  variable store.

An example to launch acrn-dm with the split images:

  --ovmf code=/usr/share/acrn/bios/OVMF_CODE.fd, \
  vars=/usr/share/acrn/bios/OVMF_VARS.fd

v1 -> v2:
- use memory-mapped file I/O for writeback
- use fcntl to lock OVMF image files

Tracked-On: #5487
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Peter Fang
2020-10-28 00:07:32 -07:00
committed by wenlingz
parent 5c3f6819d2
commit 3d99082411
5 changed files with 219 additions and 77 deletions

View File

@@ -41,6 +41,8 @@ extern char *guest_uuid_str;
extern uint8_t trusty_enabled;
extern char *vsbl_file_name;
extern char *ovmf_file_name;
extern char *ovmf_code_file_name;
extern char *ovmf_vars_file_name;
extern char *kernel_file_name;
extern char *elf_file_name;
extern char *vmname;

View File

@@ -55,7 +55,6 @@ struct e820_entry {
extern const struct e820_entry e820_default_entries[NUM_E820_ENTRIES];
extern int with_bootargs;
extern bool writeback_nv_storage;
size_t ovmf_image_size(void);