From 772ab3a95c828335d8594f547707645679d33193 Mon Sep 17 00:00:00 2001 From: Qian Wang Date: Thu, 24 Sep 2020 13:24:14 +0800 Subject: [PATCH] hv: remove UNCACHED for pSRAM EPT memmap segment We remove the UNCACHED bit for pSRAM EPT memmap segment, otherwise access to pSRAM region may bypass pSRAM. Tracked-On: #5330 Signed-off-by: Qian Wang Signed-off-by: Li Fei1 --- hypervisor/common/hypercall.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 0cc2cab3f..6c0867d00 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -21,6 +21,7 @@ #include #include #include +#include #define DBG_LEVEL_HYCALL 6U @@ -649,6 +650,11 @@ static int32_t add_vm_memory_region(struct acrn_vm *vm, struct acrn_vm *target_v } else { prot |= EPT_UNCACHED; } +#ifdef CONFIG_PTCM_ENABLED + if (hpa == PSRAM_BASE_HPA) { + prot |= EPT_WB; + } +#endif /* create gpa to hpa EPT mapping */ ept_add_mr(target_vm, pml4_page, hpa, region->gpa, region->size, prot);