From c787aaa3280ad5d6f1683956b01cf1d45d6867d3 Mon Sep 17 00:00:00 2001 From: Peter Fang Date: Sun, 23 Jun 2019 00:12:11 -0700 Subject: [PATCH] dm: allow High BIOS to be modifiable by the guest In order to support OVMF NV storage writeback, the High BIOS region in the guest will behave as RAM and can be modified by OVMF itself. Give the guest write permission to this page. Tracked-On: #3413 Signed-off-by: Peter Fang Acked-by: Yin Fengwei --- devicemodel/core/hugetlb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/devicemodel/core/hugetlb.c b/devicemodel/core/hugetlb.c index bcd54dfce..e314503d5 100644 --- a/devicemodel/core/hugetlb.c +++ b/devicemodel/core/hugetlb.c @@ -773,9 +773,14 @@ int hugetlb_setup_memory(struct vmctx *ctx) /* map ept for biosmem */ if (ctx->biosmem > 0) { + /* + * The High BIOS region can behave as RAM and be + * modified by the boot firmware itself (e.g. OVMF + * NV data storage region). + */ if (vm_map_memseg_vma(ctx, ctx->biosmem, 4 * GB - ctx->biosmem, (uint64_t)(ctx->baseaddr + 4 * GB - ctx->biosmem), - PROT_READ | PROT_EXEC) < 0) + PROT_ALL) < 0) goto err; }