DM: ovmf NV storage writeback support

To support modification of OVMF NV storage, add an option "w" for
--ovmf to write the changed OVMF NV data section back to the OVMF image
from guest memory before deinit operations. This will enable persistent
EFI variables. Only option "w" is supported, dm will exit if passing
invalid option. It expects OVMF NV storage writeback with option "w"
when power off or reboot the UOS, poweroff, cold and warm reboot in EFI
shell and when dm recieves SIGINT and SIGHUP.

Tracked-On: #3413
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Reviewed-by:Eddie Dong <eddie.dong@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Yang, Yu-chu
2019-07-11 15:53:03 -07:00
committed by wenlingz
parent c787aaa328
commit 16a7d2522c
4 changed files with 97 additions and 11 deletions

View File

@@ -55,6 +55,7 @@ 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);
@@ -78,6 +79,7 @@ int acrn_sw_load_bzimage(struct vmctx *ctx);
int acrn_sw_load_elf(struct vmctx *ctx);
int acrn_sw_load_vsbl(struct vmctx *ctx);
int acrn_sw_load_ovmf(struct vmctx *ctx);
int acrn_writeback_ovmf_nvstorage(struct vmctx *ctx);
int acrn_sw_load(struct vmctx *ctx);
#endif

View File

@@ -33,15 +33,13 @@
#include <uuid/uuid.h>
#include "types.h"
#include "vmm.h"
#include "macros.h"
/*
* API version for out-of-tree consumers for making compile time decisions.
*/
#define VMMAPI_VERSION 0103 /* 2 digit major followed by 2 digit minor */
#define MB (1024 * 1024UL)
#define GB (1024 * 1024 * 1024UL)
#define ALIGN_UP(x, align) (((x) + ((align)-1)) & ~((align)-1))
#define ALIGN_DOWN(x, align) ((x) & ~((align)-1))