diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index b6ed6a670..2bb4b6de5 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -523,13 +523,13 @@ static void prepare_service_vm_memmap(struct acrn_vm *vm) pci_mmcfg = get_mmcfg_region(); ept_del_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp, pci_mmcfg->address, get_pci_mmcfg_size(pci_mmcfg)); -#if defined(PRE_RTVM_SW_SRAM_ENABLED) /* remove Software SRAM region from Service VM EPT, to prevent Service VM from using clflush to * flush the Software SRAM cache. * This is applicable to prelaunch RTVM case only, for post-launch RTVM, Service VM is trusted. + * When system don't have Software SRAM or not enabled, get_software_sram_size() will return 0. + * In this case no mem region will be removed. */ - ept_del_mr(vm, pml4_page, PRE_RTVM_SW_SRAM_BASE_GPA, PRE_RTVM_SW_SRAM_END_GPA - PRE_RTVM_SW_SRAM_BASE_GPA); -#endif + ept_del_mr(vm, pml4_page, service_vm_hpa2gpa(get_software_sram_base()), get_software_sram_size()); /* unmap Intel IOMMU register pages for below reason: * Service VM can detect IOMMU capability in its ACPI table hence it may access diff --git a/hypervisor/include/arch/x86/asm/rtct.h b/hypervisor/include/arch/x86/asm/rtct.h index c3adbfca8..de57d1710 100644 --- a/hypervisor/include/arch/x86/asm/rtct.h +++ b/hypervisor/include/arch/x86/asm/rtct.h @@ -33,19 +33,13 @@ #define RTCT_V2_MEMORY_HIERARCHY_LATENCY 8U #define RTCT_V2_ERROR_LOG_ADDRESS 9U -#if !defined(PRE_RTVM_SW_SRAM_ENABLED) /* - * PRE_RTVM_SW_SRAM_BASE_GPA is for Prelaunch VM only and - * is configured by config tool on platform that Software SRAM is detected. + * PRE_RTVM_SW_SRAM_MAX_SIZE is for Prelaunch VM only and + * is generated by config tool on platform that Software SRAM is configured. * - * For cases that Software SRAM is not detected, we still hardcode a dummy - * placeholder entry in vE820 table of Prelaunch VM to unify the logic - * to initialize the vE820. + * For cases that Software SRAM is not configured, PRE_RTVM_SW_SRAM_MAX_SIZE is defined as 0 */ #define PRE_RTVM_SW_SRAM_BASE_GPA (GPU_OPREGION_GPA - PRE_RTVM_SW_SRAM_MAX_SIZE) -#endif - -#define PRE_RTVM_SW_SRAM_MAX_SIZE 0x00800000U struct rtct_entry { uint16_t size;