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

@@ -516,6 +516,12 @@ vrtc_fail:
static void
vm_deinit_vdevs(struct vmctx *ctx)
{
/*
* Write ovmf NV storage back to the original file from guest
* memory before deinit operations.
*/
acrn_writeback_ovmf_nvstorage(ctx);
deinit_pci(ctx);
monitor_close();
@@ -535,6 +541,12 @@ vm_deinit_vdevs(struct vmctx *ctx)
static void
vm_reset_vdevs(struct vmctx *ctx)
{
/*
* Write ovmf NV storage back to the original file from guest
* memory before deinit operations.
*/
acrn_writeback_ovmf_nvstorage(ctx);
/*
* The current virtual devices doesn't define virtual
* device reset function. So we call vdev deinit/init