From af62d57567bf7b78f5b2e0ca73b0598fd5f60cec Mon Sep 17 00:00:00 2001 From: Qian Wang Date: Sun, 27 Sep 2020 16:41:22 +0800 Subject: [PATCH] hv: prevent WBINVD after psram is initialized Prevent WBINVD to be called after psram is initialized, otherwise the content of pSRAM will be destroyed. Tracked-On: #5330 Signed-off-by: Qian Wang --- hypervisor/include/arch/x86/mmu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hypervisor/include/arch/x86/mmu.h b/hypervisor/include/arch/x86/mmu.h index 251581e5b..cfaccb598 100644 --- a/hypervisor/include/arch/x86/mmu.h +++ b/hypervisor/include/arch/x86/mmu.h @@ -150,9 +150,11 @@ void flush_address_space(void *addr, uint64_t size); */ void invept(const void *eptp); +extern volatile bool psram_is_initialized; static inline void cache_flush_invalidate_all(void) { - asm volatile (" wbinvd\n" : : : "memory"); + if (psram_is_initialized == false) + asm volatile (" wbinvd\n" : : : "memory"); } static inline void clflush(const volatile void *p)